Browse Source

获取应急人员企业微信用户id

develop
lau572 3 weeks ago
parent
commit
b08cb65abd
  1. 11
      zc-business/src/main/java/com/zc/business/domain/DcEmployees.java
  2. 21
      zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java
  3. 4
      zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml

11
zc-business/src/main/java/com/zc/business/domain/DcEmployees.java

@ -55,6 +55,9 @@ public class DcEmployees extends BaseEntity
//类型参数 //类型参数
private String type; private String type;
//企业微信用户id
private String wxUserId;
public String getType() { public String getType() {
return type; return type;
} }
@ -141,6 +144,14 @@ public class DcEmployees extends BaseEntity
return contactNumber; return contactNumber;
} }
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

21
zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java

@ -1,10 +1,12 @@
package com.zc.business.service.impl; package com.zc.business.service.impl;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.zc.business.domain.DcEmployees; import com.zc.business.domain.DcEmployees;
import com.zc.business.enums.UniversalEnum; import com.zc.business.enums.UniversalEnum;
import com.zc.business.mapper.DcEmployeesMapper; import com.zc.business.mapper.DcEmployeesMapper;
import com.zc.business.service.IDcEmployeesService; import com.zc.business.service.IDcEmployeesService;
import com.zc.business.utils.QYWXUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -24,6 +26,8 @@ import java.util.stream.Collectors;
public class DcEmployeesServiceImpl implements IDcEmployeesService { public class DcEmployeesServiceImpl implements IDcEmployeesService {
@Autowired @Autowired
private DcEmployeesMapper dcEmployeesMapper; private DcEmployeesMapper dcEmployeesMapper;
@Autowired
private QYWXUtil qywxUtil;
/** /**
* 查询值班人员信息 * 查询值班人员信息
@ -56,6 +60,15 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService {
@Override @Override
public int insertDcEmployees(DcEmployees dcEmployees) { public int insertDcEmployees(DcEmployees dcEmployees) {
dcEmployees.setCreateTime(DateUtils.getNowDate()); 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); return dcEmployeesMapper.insertDcEmployees(dcEmployees);
} }
@ -68,6 +81,14 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService {
@Override @Override
public int updateDcEmployees(DcEmployees dcEmployees) { public int updateDcEmployees(DcEmployees dcEmployees) {
dcEmployees.setUpdateTime(DateUtils.getNowDate()); 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); return dcEmployeesMapper.updateDcEmployees(dcEmployees);
} }

4
zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml

@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="postName" column="post_name" /> <result property="postName" column="post_name" />
<result property="organizationName" column="organization_name" /> <result property="organizationName" column="organization_name" />
<result property="employeesType" column="employees_type" /> <result property="employeesType" column="employees_type" />
<result property="wxUserId" column="wx_user_id" />
</resultMap> </resultMap>
<sql id="selectDcEmployeesVo"> <sql id="selectDcEmployeesVo">
@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="employeesType != null">employees_type,</if> <if test="employeesType != null">employees_type,</if>
<if test="wxUserId != null">wx_user_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
@ -64,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="employeesType != null">#{employeesType},</if> <if test="employeesType != null">#{employeesType},</if>
<if test="wxUserId != null">#{wxUserId},</if>
</trim> </trim>
</insert> </insert>
@ -77,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="employeesType != null">employees_type = #{employeesType},</if> <if test="employeesType != null">employees_type = #{employeesType},</if>
<if test="wxUserId != null">wx_user_id = #{wxUserId},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

Loading…
Cancel
Save