From b08cb65abd44cdc2cb7e14595e8ef6c6ae0182fe Mon Sep 17 00:00:00 2001
From: lau572 <1010031226@qq.com>
Date: Tue, 5 Nov 2024 14:47:11 +0800
Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BA=94=E6=80=A5=E4=BA=BA?=
=?UTF-8?q?=E5=91=98=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=E7=94=A8=E6=88=B7?=
=?UTF-8?q?id?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/zc/business/domain/DcEmployees.java | 11 ++++++++++
.../service/impl/DcEmployeesServiceImpl.java | 21 +++++++++++++++++++
.../mapper/business/DcEmployeesMapper.xml | 4 ++++
3 files changed, 36 insertions(+)
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}