Commit 548b31d2 authored by 赵啸非's avatar 赵啸非

添加员工钉钉同步userId

parent 4e9d5846
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author: finegirl
* @date: 2021/7/16 11:50
* @description: 组件枚举类
**/
public enum QiongLaiProcessInstanceEnum {
邛崃大厅人员请假("PROC-E1A4A56A-0EA7-43FE-A073-52E2B9C53E58", "邛崃大厅人员请假"),
邛崃大厅人员因公外出("PROC-034CE8B1-ED6D-492F-AC2C-61BAC5C0B4B9", "邛崃大厅人员因公外出"),
邛崃大厅人员补卡申请("PROC-16D29417-3049-4EB8-9710-9D39F9EDD1BD", "邛崃大厅人员补卡申请"),
/*
邛崃机关人员补卡申请("PROC-DDBEBB18-4FFC-486A-8E97-BAD7911BB9F2", "邛崃机关人员补卡申请"),
邛崃机关人员请假("PROC-7C84DFC5-579E-4500-9159-F38642E7238C", "邛崃机关人员请假"),
邛崃机关人员因公外出("PROC-6B46D143-4A05-4E9B-9C99-E0BD75A29003", "机关人员因公外出"),*/;
private String value;
private String desc;
QiongLaiProcessInstanceEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static QiongLaiProcessInstanceEnum getByValue(String value) {
for (QiongLaiProcessInstanceEnum componentEnum : QiongLaiProcessInstanceEnum.values()) {
if (componentEnum.getValue() == value) {
return componentEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (QiongLaiProcessInstanceEnum item : QiongLaiProcessInstanceEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
......@@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
......@@ -86,7 +87,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
//同步钉钉人员
staffService.syncPersonsByDingTalk(null);
log.info("同步钉钉usreId");
syncDingDingLocalUserIds();
//syncDingDingLocalUserIds();
log.info("钉钉直连同步人员信息");
//同步最近10天请假信息
......@@ -116,47 +117,33 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
}
private void syncDingDingUserIds() {
try {
List<UserEntity> userList = userService.getCacheList().stream()
.filter(f -> !ObjectUtils.isEmpty(f.getCustomerId()))
.filter(f -> ObjectUtils.isEmpty(f.getDingUserId())).collect(Collectors.toList());
List<UserEntity> updateUserList = userList.stream().map(item -> {
UserEntity userEntity = new UserEntity();
userEntity.setId(item.getId());
String mobile = "";
StaffEntity staffCache = staffService.getCache(item.getCustomerId().toString());
if (!ObjectUtils.isEmpty(staffCache) && !ObjectUtils.isEmpty(staffCache.getPhoneNumber())) {
mobile = staffCache.getPhoneNumber();
if (ObjectUtils.isEmpty(item.getMobile())) {
userEntity.setMobile(mobile);
}
}
if (!ObjectUtils.isEmpty(mobile)) {
Rest<String> personByMobile = dingPersonService.getPersonByMobile(mobile);
List<StaffEntity> staffList = staffService.getCacheList();
List<StaffEntity> updateList = new ArrayList<>();
for (StaffEntity staffCache : staffList) {
if (!ObjectUtils.isEmpty(staffCache) && !ObjectUtils.isEmpty(staffCache.getPhoneNumber())) {
String phoneNumber = staffCache.getPhoneNumber();
if (!ObjectUtils.isEmpty(phoneNumber)) {
Rest<String> personByMobile = dingPersonService.getPersonByMobile(phoneNumber);
if (!ObjectUtils.isEmpty(personByMobile) &&
YesNoEnum.YES.getValue() == personByMobile.getCode()
&& !ObjectUtils.isEmpty(personByMobile.getData())) {
userEntity.setDingUserId(personByMobile.getData());
StaffEntity updateStaff = new StaffEntity();
updateStaff.setId(staffCache.getId());
updateStaff.setDingUserId(personByMobile.getData());
updateList.add(updateStaff);
}
}
userEntity.setUpdateTime(new Date());
userEntity.setUpdateUserId(1L);
return userEntity;
}).filter(f -> !ObjectUtils.isEmpty(f.getDingUserId())).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(updateUserList)) {
log.info("更新用户钉钉id信息数量:{}", updateUserList.size());
userService.getUserDao().updateBatch(updateUserList);
}
} catch (Exception e) {
log.error("同步钉钉usreId失败");
if (!ObjectUtils.isEmpty(updateList)) {
log.info("更新用户钉钉id信息数量:{}", updateList.size());
staffService.update(updateList);
}
}
}
private void syncDingDingLocalUserIds() {
try {
List<UserEntity> userList = userService.getCacheList().stream()
......
......@@ -8,8 +8,6 @@ import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.annotation.desensitization.IdCardDesensitize;
import com.mortals.framework.annotation.desensitization.MobileDesensitize;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.staff.model.vo.StaffVo;
import lombok.Data;
......@@ -17,7 +15,7 @@ import lombok.Data;
* 员工基本信息实体对象
*
* @author zxfei
* @date 2024-01-11
* @date 2025-04-02
*/
@Data
public class StaffEntity extends StaffVo {
......@@ -26,12 +24,10 @@ public class StaffEntity extends StaffVo {
/**
* 员工姓名
*/
@Excel(name = "员工姓名")
private String name;
/**
* 性别(1.男,2.女)
*/
@Excel(name = "性别", readConverterExp = "1=男,2=女")
private Integer gender;
/**
* 出生日期
......@@ -44,19 +40,14 @@ public class StaffEntity extends StaffVo {
/**
* 联系电话
*/
@Excel(name = "联系电话")
@MobileDesensitize
private String phoneNumber;
/**
* 身份证号码
*/
@Excel(name = "身份证号码")
@IdCardDesensitize
private String idCard;
/**
* 工号
*/
@Excel(name = "工号")
private String workNum;
/**
* 政治面貌 (1.中共党员,2.中共预备党员,3.共青团员,4.群众,5.其它)
......@@ -69,7 +60,6 @@ public class StaffEntity extends StaffVo {
/**
* 所属部门名称
*/
@Excel(name = "所属部门名称")
private String deptName;
/**
* 职位ID
......@@ -78,22 +68,15 @@ public class StaffEntity extends StaffVo {
/**
* 职位名称
*/
@Excel(name = "职位名称")
private String positionName;
/**
* 员工类型(1.全职,2.兼职,3.实习)
*/
@Excel(name = "员工类型", readConverterExp = "1=全职,2=兼职,3=实习")
private Integer staffType;
/**
* 员工状态(1.正式,2.试用,3.离职)
*/
@Excel(name = "员工状态", readConverterExp = "1=正式,2=试用,3=离职")
private Integer status;
/**
* 员工来源(1.外部,2.内部)
*/
private Integer source;
/**
* 入职登记表
*/
......@@ -101,7 +84,6 @@ public class StaffEntity extends StaffVo {
/**
* 入职时间
*/
@Excel(name = "入职时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date entryDate;
/**
* 转正时间
......@@ -119,6 +101,10 @@ public class StaffEntity extends StaffVo {
* 备注
*/
private String remarkId;
/**
* 员工来源(1.外部,2.内部)
*/
private Integer source;
/**
* 相对图片pic
*/
......@@ -127,22 +113,6 @@ public class StaffEntity extends StaffVo {
* 图片资源唯一标识
*/
private String serverIndexCode;
/**
* 绩效分数
*/
private BigDecimal score;
/**
* 员工登录名
*/
private String loginName;
/**
* 员工登录密码
*/
private String loginPwd;
/**
* 最后登录时间
*/
private Date lastLoginTime;
/**
* 考勤授权(0.不启用,1.启用)
*/
......@@ -175,6 +145,26 @@ public class StaffEntity extends StaffVo {
* 所属大厅名称
*/
private String salaName;
/**
* 绩效分数
*/
private BigDecimal score;
/**
* 员工登录名
*/
private String loginName;
/**
* 员工登录密码
*/
private String loginPwd;
/**
* 最后登录时间
*/
private Date lastLoginTime;
/**
* 钉钉userId
*/
private String dingUserId;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -206,19 +196,15 @@ public class StaffEntity extends StaffVo {
this.positionName = "";
this.staffType = 1;
this.status = 1;
this.source = 1;
this.registerPath = "";
this.entryDate = null;
this.regularDate = null;
this.leaveDate = null;
this.remark = "";
this.remarkId = "";
this.source = 1;
this.picUri = "";
this.serverIndexCode = "";
this.score = BigDecimal.ZERO;
this.loginName = "";
this.loginPwd = "";
this.lastLoginTime = null;
this.attendCheck = 1;
this.complainCheck = 1;
this.reviewCheck = 1;
......@@ -227,5 +213,10 @@ public class StaffEntity extends StaffVo {
this.otherCheck = 1;
this.salaId = null;
this.salaName = "";
this.score = BigDecimal.ZERO;
this.loginName = "";
this.loginPwd = "";
this.lastLoginTime = null;
this.dingUserId = "";
}
}
\ No newline at end of file
......@@ -143,7 +143,7 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"staffId": 816,
"staffId": 349,
"startTimeStart": "2025-02-01",
"endTimeEnd": "2025-03-31"
}
......
......@@ -1375,4 +1375,10 @@ CREATE TABLE mortals_xhx_window_perform_summary(
PRIMARY KEY (`id`)
,KEY `year` (`year`) USING BTREE
,KEY `deptName` (`deptName`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='窗口绩效汇总登记';
\ No newline at end of file
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='窗口绩效汇总登记';
-- ----------------------------
-- 2025-04-02
-- ----------------------------
ALTER TABLE mortals_xhx_staff ADD COLUMN `dingUserId` varchar(128) COMMENT '钉钉userId';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment