提交 9e537c74 authored 作者: 000516's avatar 000516

根据工号做员工勤策账号禁用

上级 02ffb339
package com.sfa.job.domain.qince.dao;
/**
* @author : liqiulin
* @date : 2025-12-05 17
* @describe :
*/
public interface IQinceEmployeeDao {
String getQcIdByEmpCode(String empCode);
void userResigned(String empQcId);
}
package com.sfa.job.domain.qince.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sfa.job.domain.qince.entity.QinceEmployee;
import com.sfa.job.domain.qince.mapper.QinceEmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author : liqiulin
* @date : 2025-12-05 17
* @describe :
*/
@DS("promotion")
@Service
public class QinceEmployeeDaoImpl implements IQinceEmployeeDao {
@Autowired
private QinceEmployeeMapper qinceEmployeeMapper;
@Override
public String getQcIdByEmpCode(String empCode) {
LambdaQueryWrapper<QinceEmployee> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(QinceEmployee::getEmpCode, empCode);
QinceEmployee qinceEmployee = qinceEmployeeMapper.selectOne(lambdaQueryWrapper);
if (qinceEmployee == null){
return null;
}
return qinceEmployee.getQcId();
}
@Override
public void userResigned(String empQcId) {
qinceEmployeeMapper.userResigned(empQcId);
}
}
package com.sfa.job.domain.qince.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
/**
* 勤策-人员数据
* @TableName qince_employee
*/
@TableName(value ="qince_employee")
@Data
public class QinceEmployee implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 勤策的员工唯一标识
*/
private String qcId;
/**
* 来源第三方系统的员工唯一标识
*/
private String empId;
/**
* 员工登录帐号
*/
private String empCode;
/**
* 姓名
*/
private String empName;
/**
* 员工别名
*/
private String aliasName;
/**
* 人员编码
*/
private String employeeCode;
/**
* 员工性别。F:女性,M:男性
*/
private String empSex;
/**
* 员工手机号码
*/
private String empMobile;
/**
* 员工手机地区码
*/
private String mobileDistrictCode;
/**
* 固定电话,示例:025-68736873
*/
private String empTel;
/**
* 生日。格式:yyyy-MM-dd
*/
private String empBirthday;
/**
* QQ
*/
private String empQq;
/**
* 微信
*/
private String empWeixin;
/**
* 来源企微员工唯一标识。只有企微同步过来的人员该字段才有值
*/
private String empWechatCode;
/**
* 身份证号码
*/
private String empIdcard;
/**
* 邮箱
*/
private String empEmail;
/**
* 地址
*/
private String empAddr;
/**
* 来源第三方系统隶属部门
*/
private String empOrgId;
/**
* 隶属部门编码
*/
private String empOrgCode;
/**
* 勤策部门唯一标识
*/
private String waiqin365OrgId;
/**
* 来源第三方系统,员工上级唯一标识
*/
private String empParentId;
/**
* 员工上级编码
*/
private String parentCode;
/**
* 勤策员工上级唯一标识
*/
private String waiqin365ParentId;
/**
* 是否机构领导。0:否,1:是,默认值0
*/
private String empIsOrgLearder;
/**
* 员工账号状态。0:销户,1:正常,2:停用
*/
private String empStatus;
/**
* 手机卡绑定。0:不绑定,1:绑定
*/
private String empImsiBinding;
/**
* 勤策经销商唯一标识
*/
private String dealerId;
/**
* 经销商中文名称
*/
private String dealerName;
/**
* 常驻地省信息
*/
private String empBaseprovince;
/**
* 常驻地市信息
*/
private String empBasecity;
/**
* 勤策职务唯一标识
*/
private String waiqin365PositionId;
/**
* 职务编码
*/
private String empPositionCode;
/**
* 职务名称
*/
private String empPosition;
/**
* 勤策岗位唯一标识
*/
private String waiqin365JobId;
/**
* 岗位编码
*/
private String empJobCode;
/**
* 岗位名称
*/
private String empJob;
/**
* 手机认证,0为是,1为否
*/
private String mobileAuth;
/**
* 客户端类型。0:标准客户端(APP)、1:定制客户端(APP)、2:微信小程序、3:企业微信
*/
private String terminalType;
/**
* 头像上传时间
*/
private String faceTime;
/**
* 入职时间
*/
private String empEnrollmentTime;
/**
* 离职时间
*/
private String empResignationTime;
/**
* 最近登录时间
*/
private String lastUseTime;
/**
* 创建时间
*/
private String createTime;
/**
* 修改时间
*/
private String modifyTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.sfa.job.domain.qince.mapper;
import com.sfa.job.domain.qince.entity.QinceEmployee;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【qince_employee(勤策-人员数据)】的数据库操作Mapper
* @createDate 2025-12-05 17:16:32
* @Entity com.sfa.job.domain.qince.entity.QinceEmployee
*/
@Repository
public interface QinceEmployeeMapper extends BaseMapper<QinceEmployee> {
void userResigned(@Param("empQcId") String empQcId);
}
......@@ -5,18 +5,21 @@ import com.lark.oapi.service.corehr.v2.model.*;
import com.sfa.common.core.enums.promotion.PlanStatus;
import com.sfa.common.core.utils.sdk.FeiShuUtil;
import com.sfa.job.domain.promotion.dao.IActivityPlanDao;
import com.sfa.job.domain.qince.dao.IQinceEmployeeDao;
import com.sfa.job.domain.system.dao.ISysDeptDao;
import com.sfa.job.domain.system.dao.ISysEventLogDao;
import com.sfa.job.domain.system.dao.ISysUserDao;
import com.sfa.job.pojo.feishu.event.EventCallBackDto;
import com.sfa.job.pojo.promotion.response.ActivityPlanApprovalDto;
import com.sfa.job.pojo.response.SysEventLogDto;
import com.sfa.job.util.QinCeUtils;
import com.sfa.job.util.T100Util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.Objects;
/**
......@@ -36,9 +39,13 @@ public class EventCallbackServiceImpl implements IEventCallbackService{
@Autowired
private ISysEventLogDao sysEventLogDao;
@Autowired
private IQinceEmployeeDao qinceEmployeeDao;
@Autowired
private FeiShuUtil feiShuUtil;
@Autowired
private T100Util t100Util;
@Autowired
private QinCeUtils qinCeUtils;
@Override
public void planCP(EventCallBackDto.Event event) {
......@@ -192,8 +199,22 @@ public class EventCallbackServiceImpl implements IEventCallbackService{
if (StringUtils.isEmpty(employeeNo)){
return;
}
// 链路中心人员离职
// 链路中心人员离职 - 根据工号
sysUserDao.deleteUser(employeeNo);
// 勤策人员离职 - 根据工号+勤策ID
try {
String empQcId = qinceEmployeeDao.getQcIdByEmpCode(employeeNo);
if (StringUtils.isEmpty(empQcId)){
return;
}
Map<String, Object> map = qinCeUtils.disabledUserParams(employeeNo,empQcId);
String url = qinCeUtils.builderUrl(QinCeUtils.MODIFY_USER, map);
qinCeUtils.postQC(url, map);
qinceEmployeeDao.userResigned(empQcId);
}catch (Exception e){
log.error("勤策接口禁用用户异常,详情:{}",e.getMessage());
}
}
private void userAUT100(Employee emp){
......
......@@ -48,6 +48,9 @@ public class QinCeUtils {
public static final String QUERY_CUS_VISIT_RECORD = "/api/cusVisit/v1/queryCusVisitRecord/";
// 直营发货单自定义字段更新
public static final String MODIFY_SENT_DEFINED_VAL = "/api/dmssent/v1/modifyUseDefinedVal/";
// 修改人员
public static final String MODIFY_USER = "/api/employee/v3/modifyEmployee/";
public String builderUrl(String sidepath, Map<String, Object> params) {
......@@ -84,6 +87,16 @@ public class QinCeUtils {
return params;
}
public Map<String,Object> disabledUserParams(String userCode,String qcId){
Map<String,Object> params = new HashMap<>();
// 员工登录帐号
params.put("emp_code",userCode);
params.put("id",qcId);
// 员工账号状态。0:删除,1:正常,2:停用
// 不传,默认值为1
params.put("emp_status", "2");
return params;
}
public JSONObject postQC(String url, Object params) throws Exception {
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sfa.job.domain.qince.mapper.QinceEmployeeMapper">
<resultMap id="QinceEmployeeBase" type="com.sfa.job.domain.qince.entity.QinceEmployee">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="qcId" column="qc_id" jdbcType="VARCHAR"/>
<result property="empId" column="emp_id" jdbcType="VARCHAR"/>
<result property="empCode" column="emp_code" jdbcType="VARCHAR"/>
<result property="empName" column="emp_name" jdbcType="VARCHAR"/>
<result property="aliasName" column="alias_name" jdbcType="VARCHAR"/>
<result property="employeeCode" column="employee_code" jdbcType="VARCHAR"/>
<result property="empSex" column="emp_sex" jdbcType="CHAR"/>
<result property="empMobile" column="emp_mobile" jdbcType="VARCHAR"/>
<result property="mobileDistrictCode" column="mobile_district_code" jdbcType="VARCHAR"/>
<result property="empTel" column="emp_tel" jdbcType="VARCHAR"/>
<result property="empBirthday" column="emp_birthday" jdbcType="CHAR"/>
<result property="empQq" column="emp_qq" jdbcType="VARCHAR"/>
<result property="empWeixin" column="emp_weixin" jdbcType="VARCHAR"/>
<result property="empWechatCode" column="emp_wechat_code" jdbcType="VARCHAR"/>
<result property="empIdcard" column="emp_idcard" jdbcType="VARCHAR"/>
<result property="empEmail" column="emp_email" jdbcType="VARCHAR"/>
<result property="empAddr" column="emp_addr" jdbcType="VARCHAR"/>
<result property="empOrgId" column="emp_org_id" jdbcType="VARCHAR"/>
<result property="empOrgCode" column="emp_org_code" jdbcType="VARCHAR"/>
<result property="waiqin365OrgId" column="waiqin365_org_id" jdbcType="VARCHAR"/>
<result property="empParentId" column="emp_parent_id" jdbcType="VARCHAR"/>
<result property="parentCode" column="parent_code" jdbcType="VARCHAR"/>
<result property="waiqin365ParentId" column="waiqin365_parent_id" jdbcType="VARCHAR"/>
<result property="empIsOrgLearder" column="emp_is_org_learder" jdbcType="CHAR"/>
<result property="empStatus" column="emp_status" jdbcType="CHAR"/>
<result property="empImsiBinding" column="emp_imsi_binding" jdbcType="CHAR"/>
<result property="dealerId" column="dealer_id" jdbcType="VARCHAR"/>
<result property="dealerName" column="dealer_name" jdbcType="VARCHAR"/>
<result property="empBaseprovince" column="emp_baseprovince" jdbcType="VARCHAR"/>
<result property="empBasecity" column="emp_basecity" jdbcType="VARCHAR"/>
<result property="waiqin365PositionId" column="waiqin365_position_id" jdbcType="VARCHAR"/>
<result property="empPositionCode" column="emp_position_code" jdbcType="VARCHAR"/>
<result property="empPosition" column="emp_position" jdbcType="VARCHAR"/>
<result property="waiqin365JobId" column="waiqin365_job_id" jdbcType="VARCHAR"/>
<result property="empJobCode" column="emp_job_code" jdbcType="VARCHAR"/>
<result property="empJob" column="emp_job" jdbcType="VARCHAR"/>
<result property="mobileAuth" column="mobile_auth" jdbcType="CHAR"/>
<result property="terminalType" column="terminal_type" jdbcType="VARCHAR"/>
<result property="faceTime" column="face_time" jdbcType="VARCHAR"/>
<result property="empEnrollmentTime" column="emp_enrollment_time" jdbcType="VARCHAR"/>
<result property="empResignationTime" column="emp_resignation_time" jdbcType="VARCHAR"/>
<result property="lastUseTime" column="last_use_time" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="VARCHAR"/>
<result property="modifyTime" column="modify_time" jdbcType="VARCHAR"/>
</resultMap>
<update id="userResigned" parameterType="java.lang.String">
update qince_employee set emp_status = '2',emp_resignation_time = now() where qc_id = #{empQcId}
</update>
</mapper>
package com.sfa.job.service.feishu;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
/**
* @author : liqiulin
* @date : 2025-12-05 16
* @describe :
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class EventCallbackServiceImplTest {
@Autowired
private IEventCallbackService eventCallbackService;
@Test
public void userResigned() {
eventCallbackService.userResigned("");
}
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论