diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEmployees.java b/zc-business/src/main/java/com/zc/business/domain/DcEmployees.java index ea44e535..1fac0993 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEmployees.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEmployees.java @@ -55,6 +55,9 @@ public class DcEmployees extends BaseEntity //类型参数 private String type; + //企业微信用户id + private String wxUserId; + public String getType() { return type; } @@ -141,6 +144,14 @@ public class DcEmployees extends BaseEntity return contactNumber; } + public String getWxUserId() { + return wxUserId; + } + + public void setWxUserId(String wxUserId) { + this.wxUserId = wxUserId; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java index 562e3ea9..e234eedb 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java @@ -1,10 +1,12 @@ package com.zc.business.service.impl; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; import com.zc.business.domain.DcEmployees; import com.zc.business.enums.UniversalEnum; import com.zc.business.mapper.DcEmployeesMapper; import com.zc.business.service.IDcEmployeesService; +import com.zc.business.utils.QYWXUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,6 +26,8 @@ import java.util.stream.Collectors; public class DcEmployeesServiceImpl implements IDcEmployeesService { @Autowired private DcEmployeesMapper dcEmployeesMapper; + @Autowired + private QYWXUtil qywxUtil; /** * 查询值班人员信息 @@ -56,6 +60,15 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService { @Override public int insertDcEmployees(DcEmployees dcEmployees) { dcEmployees.setCreateTime(DateUtils.getNowDate()); + + //获取企业微信用户id + if (StringUtils.isNotEmpty(dcEmployees.getContactNumber())){ + String wxUserId = qywxUtil.getUserIdByMobile(dcEmployees.getContactNumber()); + if (StringUtils.isNotEmpty(wxUserId)){ + dcEmployees.setWxUserId(wxUserId); + } + } + return dcEmployeesMapper.insertDcEmployees(dcEmployees); } @@ -68,6 +81,14 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService { @Override public int updateDcEmployees(DcEmployees dcEmployees) { dcEmployees.setUpdateTime(DateUtils.getNowDate()); + + //获取企业微信用户id + if (StringUtils.isNotEmpty(dcEmployees.getContactNumber())){ + String wxUserId = qywxUtil.getUserIdByMobile(dcEmployees.getContactNumber()); + if (StringUtils.isNotEmpty(wxUserId)){ + dcEmployees.setWxUserId(wxUserId); + } + } return dcEmployeesMapper.updateDcEmployees(dcEmployees); } diff --git a/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml b/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml index f1661a18..f772b632 100644 --- a/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml @@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time, update_time, employees_type, + wx_user_id, #{id}, @@ -64,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, #{updateTime}, #{employeesType}, + #{wxUserId}, @@ -77,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_time = #{createTime}, update_time = #{updateTime}, employees_type = #{employeesType}, + wx_user_id = #{wxUserId}, where id = #{id}