Browse Source

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

master
wangxianzhang 3 years ago
parent
commit
38e744bef9
  1. 27
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java

27
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceRecordServiceImpl.java

@ -127,13 +127,18 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl<Workdiary
// orgidPath
Optional.ofNullable(CustomerOrgRedis.getGridInfo(dto.getGridId()))
.ifPresent(gi -> entity.setOrgIdPath(gi.getPids().concat(":").concat(gi.getId())));
.ifPresent(gi -> {
entity.setOrgIdPath(gi.getPids().concat(":").concat(gi.getId()));
entity.setAgencyId(gi.getPid());
});
IcResiUserDTO applicant = getResultDataOrThrowsException(userOpenFeignClient.getIcResiUserDTO(dto.getApplicantId()), ServiceConstant.EPMET_USER_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到申请人信息");
entity.setCustomerId(EpmetRequestHolder.getLoginUserCustomerId());
if (applicant != null) {
entity.setApplicantName(applicant.getName());
entity.setCustomerId(applicant.getCustomerId());
}
insert(entity);
}
@ -142,6 +147,26 @@ public class WorkdiaryServiceRecordServiceImpl extends BaseServiceImpl<Workdiary
@Transactional(rollbackFor = Exception.class)
public void update(WorkdiaryServiceRecordDTO dto) {
WorkdiaryServiceRecordEntity entity = ConvertUtils.sourceToTarget(dto, WorkdiaryServiceRecordEntity.class);
// orgidPath
if (StringUtils.isNotBlank(dto.getGridId())) {
Optional.ofNullable(CustomerOrgRedis.getGridInfo(dto.getGridId()))
.ifPresent(gi -> {
entity.setOrgIdPath(gi.getPids().concat(":").concat(gi.getId()));
entity.setAgencyId(gi.getPid());
});
}
if (StringUtils.isNotBlank(dto.getApplicantId())) {
IcResiUserDTO applicant = getResultDataOrThrowsException(userOpenFeignClient.getIcResiUserDTO(dto.getApplicantId()), ServiceConstant.EPMET_USER_SERVER,
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到申请人信息");
if (applicant != null) {
entity.setApplicantName(applicant.getName());
entity.setCustomerId(applicant.getCustomerId());
}
}
updateById(entity);
}

Loading…
Cancel
Save