Browse Source

获取工作人员信息 从缓存获取

master
jianjun 4 years ago
parent
commit
d50d40557d
  1. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  2. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserIdsFormDTO.java
  3. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  4. 31
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -2789,4 +2789,4 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
return baseDao.selectByOriginId(originId);
}
}
}

6
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserIdsFormDTO.java

@ -2,6 +2,8 @@ package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
@ -14,5 +16,9 @@ public class UserIdsFormDTO implements Serializable {
private static final long serialVersionUID = -6168528618954442905L;
@NotBlank(message = "客户ID不能为空")
private String customerId;
@NotEmpty(message = "工作人员Id 不能为空")
private List<String> userIds;
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -21,7 +21,6 @@ import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -40,12 +39,10 @@ import com.epmet.excel.CustomerStaffExcel;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.CustomerStaffService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;
@ -367,7 +364,8 @@ public class CustomerStaffController {
* @date 2020/8/13 1:45 下午
*/
@PostMapping("getstaffinfolist")
public Result<List<StaffSinGridResultDTO>> getStaffInfoList(@RequestBody UserIdsFormDTO formDTO){
public Result<List<StaffSinGridResultDTO>> getStaffInfoList(@RequestHeader("customerId") String customerId,@RequestBody UserIdsFormDTO formDTO){
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO);
return new Result<List<StaffSinGridResultDTO>>().ok(customerStaffService.getStaffInfoList(formDTO));
}

31
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -22,7 +22,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.entity.DataScope;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
@ -54,7 +53,6 @@ import com.epmet.feign.AuthFeignClient;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.CustomerStaffService;
import com.epmet.service.GovStaffRoleService;
import com.epmet.service.StaffRoleService;
@ -64,7 +62,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -603,7 +600,31 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
public List<StaffSinGridResultDTO> getStaffInfoList(UserIdsFormDTO formDTO) {
List<String> userIds = formDTO.getUserIds();
// 1. 根据userId查询人员基本信息
List<StaffSinGridResultDTO> staffInfoList = customerStaffDao.getStaffInfoList(userIds);
List<StaffSinGridResultDTO> staffInfoList = new ArrayList<>();
userIds.forEach(staffId->{
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), staffId);
if (staffInfo ==null){
log.error("getStaffInfoList fail customerId:{}, staffId:{} not exist in db",formDTO.getCustomerId(), staffId);
return;
}
StaffSinGridResultDTO resultDTO = new StaffSinGridResultDTO();
resultDTO.setStaffId(staffInfo.getStaffId());
resultDTO.setStaffName(staffInfo.getRealName());
resultDTO.setHeadPhoto(staffInfo.getHeadPhoto());
resultDTO.setGender(staffInfo.getGender());
List<RoleResultDTO> roleInfoList = new ArrayList<>();
staffInfo.getRoleMap().forEach((key,value) ->{
RoleResultDTO dto = new RoleResultDTO();
dto.setRoleKey(key);
dto.setRoleName(value);
roleInfoList.add(dto);
});
resultDTO.setRoleList(roleInfoList);
staffInfoList.add(resultDTO);
});
/*List<StaffSinGridResultDTO> staffInfoList = customerStaffDao.getStaffInfoList(userIds);
if (staffInfoList.size() == NumConstant.ZERO){
return staffInfoList;
}
@ -619,7 +640,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
}
});
staffInfo.setRoleList(roleResult);
});
});*/
return staffInfoList;
}

Loading…
Cancel
Save