Browse Source

Merge branch 'dev_staff_info' of http://git.elinkit.com.cn:7070/r/epmet-cloud into develop

dev_shibei_match
jianjun 4 years ago
parent
commit
0286f81c55
  1. 20
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java
  2. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java
  3. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/ListStaffResultDTO.java
  4. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  5. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java
  6. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  7. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml
  8. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml
  9. 13
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java
  10. 1
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoGroupReceiversDao.xml

20
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java

@ -2,6 +2,7 @@ package com.epmet.commons.tools.redis.common;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.CommonAggFeignClient; import com.epmet.commons.tools.feign.CommonAggFeignClient;
@ -102,14 +103,17 @@ public class CustomerStaffRedis {
* @param staffId * @param staffId
*/ */
public static Map<String, String> getStaffRoleMap(String customerId, String staffId) { public static Map<String, String> getStaffRoleMap(String customerId, String staffId) {
String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); int retryTime = 0;
Map<String, String> roleMap = (Map<String, String>) customerStaffRedis.redisUtils.hGet(key, ROLE_MAP_KEY); do {
if (!CollectionUtils.isEmpty(roleMap)) { String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId);
return roleMap; Map<String, String> roleMap = (Map<String, String>) customerStaffRedis.redisUtils.hGet(key, ROLE_MAP_KEY);
} if (!CollectionUtils.isEmpty(roleMap)) {
return roleMap;
reloadStaffCache(staffId, key); }
return getStaffRoleMap(customerId, staffId); retryTime++;
reloadStaffCache(staffId, key);
} while (retryTime < NumConstant.TWO);
return null;
} }
/** /**

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java

@ -53,6 +53,8 @@ public class StaffListFormDTO implements Serializable {
private String userId; private String userId;
//起止巡查开始时间 //起止巡查开始时间
private String patrolStartTime; private String patrolStartTime;
//token中客户Id
private String customerId;
public interface Staff extends CustomerClientShowGroup {} public interface Staff extends CustomerClientShowGroup {}
} }

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/ListStaffResultDTO.java

@ -13,6 +13,8 @@ import java.util.List;
public class ListStaffResultDTO implements Serializable { public class ListStaffResultDTO implements Serializable {
private static final long serialVersionUID = 7129564173128153335L; private static final long serialVersionUID = 7129564173128153335L;
//工作人员所属组织Id
private String agencyId = "";
//工作人员用户id //工作人员用户id
private String staffId = ""; private String staffId = "";
//工作人员姓名 //工作人员姓名

1
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -100,6 +100,7 @@ public class EpmetUserController {
/*if (formDTO.getTime() != 1 && formDTO.getTime() != 3) { /*if (formDTO.getTime() != 1 && formDTO.getTime() != 3) {
throw new RenException("参数错误,最近时间值不正确"); throw new RenException("参数错误,最近时间值不正确");
}*/ }*/
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId()); formDTO.setUserId(tokenDto.getUserId());
return new Result<List<StaffListResultDTO>>().ok(epmetUserService.staffPatrolList(formDTO)); return new Result<List<StaffListResultDTO>>().ok(epmetUserService.staffPatrolList(formDTO));
} }

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java

@ -46,7 +46,7 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @Description 按staffId查询基础信息 * @Description 按staffId查询基础信息
* @author sun * @author sun
*/ */
List<CustomerStaffDTO> selectByStaffIds(@Param("staffIds") List<String> staffIds, @Param("realName") String realName); List<CustomerStaffDTO> selectByStaffIds(@Param("customerId") String customerId, @Param("staffIds") List<String> staffIds, @Param("realName") String realName);
/** /**
* @Description 模糊查询用户角色信息 * @Description 模糊查询用户角色信息

9
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -299,7 +299,7 @@ public class EpmetUserServiceImpl implements EpmetUserService {
List<CustomerStaffDTO> staffList = new ArrayList<>(); List<CustomerStaffDTO> staffList = new ArrayList<>();
//2-1.按名字检索时先查询人员基础信息 //2-1.按名字检索时先查询人员基础信息
if (!StringUtils.isEmpty(formDTO.getStaffName())) { if (!StringUtils.isEmpty(formDTO.getStaffName())) {
staffList = customerStaffDao.selectByStaffIds(null, formDTO.getStaffName()); staffList = customerStaffDao.selectByStaffIds(formDTO.getCustomerId(), null, formDTO.getStaffName());
if (!CollectionUtils.isEmpty(staffList)) { if (!CollectionUtils.isEmpty(staffList)) {
formDTO.setStaffId(staffList.get(0).getUserId()); formDTO.setStaffId(staffList.get(0).getUserId());
}else { }else {
@ -311,7 +311,7 @@ public class EpmetUserServiceImpl implements EpmetUserService {
//2-3.查询人员基本信息【之前sql关联人员表查性别、姓名效率低 所以分开查) //2-3.查询人员基本信息【之前sql关联人员表查性别、姓名效率低 所以分开查)
if (CollectionUtils.isEmpty(staffList)) { if (CollectionUtils.isEmpty(staffList)) {
List<String> staffIdList = resultList.stream().map(StaffListResultDTO::getStaffId).collect(Collectors.toList()); List<String> staffIdList = resultList.stream().map(StaffListResultDTO::getStaffId).collect(Collectors.toList());
staffList = customerStaffDao.selectByStaffIds(staffIdList, null); staffList = customerStaffDao.selectByStaffIds(formDTO.getCustomerId(), staffIdList, null);
} }
//3.封装数据并返回 //3.封装数据并返回
@ -460,7 +460,10 @@ public class EpmetUserServiceImpl implements EpmetUserService {
List<StaffOrgNameResultDTO> orgList = govOrgService.getStaffOrgName(staffIdList); List<StaffOrgNameResultDTO> orgList = govOrgService.getStaffOrgName(staffIdList);
//3.封装数据并返回 //3.封装数据并返回
resultList.forEach(re -> orgList.stream().filter(l -> re.getStaffId().equals(l.getStaffId())).forEach(s -> re.setOrgName(s.getOrgName()))); resultList.forEach(re -> orgList.stream().filter(l -> re.getStaffId().equals(l.getStaffId())).forEach(s -> {
re.setAgencyId(s.getAgencyId());
re.setOrgName(s.getOrgName());
}));
return resultList; return resultList;
} }

2
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml

@ -29,7 +29,7 @@
<if test="null != receiverGroupId and receiverGroupId !=''"> <if test="null != receiverGroupId and receiverGroupId !=''">
and irg.id=#{receiverGroupId} and irg.id=#{receiverGroupId}
</if> </if>
order by irg.CREATED_TIME asc,igr.id asc order by irg.CREATED_TIME desc
</select> </select>
<!-- 我创建的组内所有的人 --> <!-- 我创建的组内所有的人 -->

3
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml

@ -20,7 +20,8 @@
* *
FROM FROM
customer_staff customer_staff
WHERE 1=1 WHERE del_flag = '0'
AND customer_id = #{customerId}
<if test="realName != null and realName != '' "> <if test="realName != null and realName != '' ">
AND real_name = #{realName} AND real_name = #{realName}
</if> </if>

13
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java

@ -317,6 +317,16 @@ public class InfoServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implem
if (infoReceiverGroupDao.selectCountName(formDTO.getName().trim(),formDTO.getCustomerId(),formDTO.getUserId()) > 1) { if (infoReceiverGroupDao.selectCountName(formDTO.getName().trim(),formDTO.getCustomerId(),formDTO.getUserId()) > 1) {
throw new RenException(EpmetErrorCode.INFO_GROUP_NAME_EXISTS.getCode(), EpmetErrorCode.INFO_GROUP_NAME_EXISTS.getMsg()); throw new RenException(EpmetErrorCode.INFO_GROUP_NAME_EXISTS.getCode(), EpmetErrorCode.INFO_GROUP_NAME_EXISTS.getMsg());
} }
Set<String> members=new LinkedHashSet<String>();
members.addAll(formDTO.getStaffIdList());
members.addAll(orgStaffIds);
if(CollectionUtils.isNotEmpty(members)&&members.contains(formDTO.getUserId())){
members.remove(formDTO.getUserId());
}
if(CollectionUtils.isEmpty(members)){
throw new RenException(EpmetErrorCode.PLEASE_CHOOSE_MEMBER.getCode(), EpmetErrorCode.PLEASE_CHOOSE_MEMBER.getMsg());
}
InfoReceiverGroupEntity groupEntity=new InfoReceiverGroupEntity(); InfoReceiverGroupEntity groupEntity=new InfoReceiverGroupEntity();
groupEntity.setCustomerId(formDTO.getCustomerId()); groupEntity.setCustomerId(formDTO.getCustomerId());
groupEntity.setName(formDTO.getName()); groupEntity.setName(formDTO.getName());
@ -324,9 +334,6 @@ public class InfoServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implem
// 4、插入小组表 // 4、插入小组表
infoReceiverGroupDao.insert(groupEntity); infoReceiverGroupDao.insert(groupEntity);
Set<String> members=new LinkedHashSet<String>();
members.addAll(formDTO.getStaffIdList());
members.addAll(orgStaffIds);
members.forEach(memStaffId->{ members.forEach(memStaffId->{
// 5、插入群成员表 // 5、插入群成员表
InfoGroupReceiversEntity memberEntity=new InfoGroupReceiversEntity(); InfoGroupReceiversEntity memberEntity=new InfoGroupReceiversEntity();

1
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoGroupReceiversDao.xml

@ -16,7 +16,6 @@
<foreach collection="groupIdList" item="groupId" separator="," open="(" close=")"> <foreach collection="groupIdList" item="groupId" separator="," open="(" close=")">
#{groupId} #{groupId}
</foreach> </foreach>
)
</if> </if>
</select> </select>

Loading…
Cancel
Save