Browse Source

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

master
wangxianzhang 3 years ago
parent
commit
f03ba75eb2
  1. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcServiceRecordV2DTO.java
  2. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcServiceRecordV2AddEditFormDTO.java
  3. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceRecordV2ListFormDTO.java
  4. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/policy/IcPolicyFormDTO.java
  5. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceRecordV2Controller.java
  6. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcServiceRecordV2Entity.java
  7. 16
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPolicyServiceImpl.java
  8. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.26__add_service_v2_category.sql
  9. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcServiceRecordV2DTO.java

@ -1,8 +1,9 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -109,4 +110,6 @@ public class IcServiceRecordV2DTO implements Serializable {
*/
private String policyId;
private String serviceCategoryKey;
}

3
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcServiceRecordV2AddEditFormDTO.java

@ -37,6 +37,9 @@ public class IcServiceRecordV2AddEditFormDTO implements Serializable {
*/
@NotBlank(message = "服务名称不能为空", groups = {AddGroup.class})
private String serviceOrgType;
@NotBlank(message = "serviceCategoryKey不能为空", groups = {AddGroup.class})
private String serviceCategoryKey;
/**
* 服务组织Id
*/

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/ServiceRecordV2ListFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
@ -15,11 +16,16 @@ public class ServiceRecordV2ListFormDTO extends PageFormDTO implements Serializa
private static final long serialVersionUID = 88592831607216246L;
public interface ServiceRecordV2ListForm{}
/**
* 服务名称
*/
private String serviceName;
@NotBlank(message = "serviceCategoryKey不能为空",groups = ServiceRecordV2ListForm.class)
private String serviceCategoryKey;
/**
* 服务组织ID
*/

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/policy/IcPolicyFormDTO.java

@ -95,5 +95,7 @@ public class IcPolicyFormDTO implements Serializable {
@Valid
@NotEmpty(message = "政策细则不能为空",groups =AddUserShowGroup.class )
private List<IcPolicyRuleFormDTO> ruleList;
private String agencyId;
}

1
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceRecordV2Controller.java

@ -92,6 +92,7 @@ public class IcServiceRecordV2Controller {
*/
@PostMapping("list")
public Result<PageData> serviceRecordV2List(@LoginUser TokenDto tokenDto, @RequestBody ServiceRecordV2ListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, ServiceRecordV2ListFormDTO.ServiceRecordV2ListForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<PageData>().ok(icServiceRecordV2Service.serviceRecordV2List(formDTO));

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcServiceRecordV2Entity.java

@ -79,4 +79,6 @@ public class IcServiceRecordV2Entity extends BaseEpmetEntity {
*/
private String policyId;
private String serviceCategoryKey;
}

16
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPolicyServiceImpl.java

@ -13,7 +13,6 @@ import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dao.*;
@ -27,7 +26,6 @@ import com.epmet.dto.form.policy.IcPolicyFormDTO;
import com.epmet.dto.form.policy.IcPolicyPageFormDTO;
import com.epmet.dto.form.policy.IcPolicyRuleDetailDTO;
import com.epmet.dto.form.policy.IcPolicyRuleFormDTO;
import com.epmet.dto.result.resi.ResiByPolicyInfoResultDTO;
import com.epmet.entity.*;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.service.IcPolicyService;
@ -98,13 +96,14 @@ public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEn
@Transactional(rollbackFor = Exception.class)
@Override
public void addOrUpdatePolicy(IcPolicyFormDTO formDTO) {
// 校验参数
checkAddFormDTO(formDTO);
// 设置所属组织
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if (null == staffInfo || StringUtils.isBlank(staffInfo.getAgencyId())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "工作人员缓存信息异常", "工作人员信息异常");
}
formDTO.setAgencyId(staffInfo.getAgencyId());
// 校验参数
checkAddFormDTO(formDTO);
IcPolicyEntity icPolicyEntity = ConvertUtils.sourceToTarget(formDTO, IcPolicyEntity.class);
icPolicyEntity.setOrgId(staffInfo.getAgencyId());
icPolicyEntity.setOrgIdPath(StringUtils.isNotBlank(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfo.getAgencyId()) : staffInfo.getAgencyId());
@ -208,6 +207,15 @@ public class IcPolicyServiceImpl extends BaseServiceImpl<IcPolicyDao, IcPolicyEn
private void checkAddFormDTO(IcPolicyFormDTO formDTO) {
//同组织下,政策标题唯一
LambdaQueryWrapper<IcPolicyEntity> policyEntityLambdaQueryWrapper=new LambdaQueryWrapper<>();
policyEntityLambdaQueryWrapper.eq(IcPolicyEntity::getTitle,formDTO.getTitle())
.eq(IcPolicyEntity::getOrgId,formDTO.getAgencyId());
policyEntityLambdaQueryWrapper.ne(StringUtils.isNotBlank(formDTO.getPolicyId()),IcPolicyEntity::getId,formDTO.getPolicyId());
int count=baseDao.selectCount(policyEntityLambdaQueryWrapper);
if(count>0){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"当前组织内已经存在相同标题的政策","当前组织内已经存在相同标题的政策");
}
List<IcPolicyRuleFormDTO> ruleList = formDTO.getRuleList();
for (IcPolicyRuleFormDTO rule : ruleList) {
if (CollectionUtils.isEmpty(rule.getResiRuleList())

1
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.26__add_service_v2_category.sql

@ -0,0 +1 @@
alter table ic_service_record_v2 add COLUMN SERVICE_CATEGORY_KEY VARCHAR(64) comment '服务类别KEY' AFTER remark;

1
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml

@ -19,6 +19,7 @@
left JOIN ic_service_feedback_v2 sf ON sf.SERVICE_RECORD_ID = sr.ID AND sf.DEL_FLAG = 0
INNER JOIN ic_service_scope_v2 ss ON ss.SERVICE_RECORD_ID = sr.ID AND ss.DEL_FLAG = '0'
WHERE sr.DEL_FLAG = '0'
AND sr.SERVICE_CATEGORY_KEY = #{serviceCategoryKey}
AND ss.OBJECT_ID_PATH LIKE concat('%',#{orgId},'%')
AND sr.CUSTOMER_ID = #{customerId}
<if test='serviceName != null and serviceName != ""'>

Loading…
Cancel
Save