Browse Source

保存增加参数校验

dev
sunyuchao 3 years ago
parent
commit
f4f694ed21
  1. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  2. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java
  3. 29
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java

@ -99,6 +99,8 @@ public interface StrConstant {
String PY_CUSTOMER = "6f203e30de1a65aab7e69c058826cd80";
//平音客户跟组织Id
String PY_ROOT_AGENCY = "53613e1c5de6ed473467f0159a10b135";
//磐石街道客户Id
String PS_CUSTOMER_ID = "1580460084738760705";
/**
* 单位积分,积分上限积分说明积分事件

3
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java

@ -179,6 +179,7 @@ public class IcTripReportFormDTO implements Serializable {
/**
* 交通方式来源字典表(traffic_type)
*/
@NotBlank(message = "返回方式不能为空", groups = {ResiUserRequired.class})
private String trafficType;
/**
* 其他返回方式交通方式为其他时此列需要有值
@ -187,6 +188,7 @@ public class IcTripReportFormDTO implements Serializable {
/**
* 来源地详细信息 source_address字段的说明
*/
@NotBlank(message = "来自地区不能为空", groups = {ResiUserRequired.class})
private String sourceDetailAddress;
/**
* 疫苗接种针次 (0针 1针 2针 3针)小寨子
@ -199,6 +201,7 @@ public class IcTripReportFormDTO implements Serializable {
/**
* 户籍地 磐石
*/
@NotBlank(message = "户籍地不能为空", groups = {ResiUserRequired.class})
private String registeredResidence;
/**
* 年龄磐石

29
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java

@ -11,6 +11,7 @@ import com.epmet.commons.mybatis.enums.DelFlagEnum;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -205,6 +206,20 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
@Override
@Transactional(rollbackFor = Exception.class)
public String save(IcTripReportFormDTO formDTO) {
//按客户校验参数
if ("5".equals(formDTO.getTrafficType()) && StringUtils.isBlank(formDTO.getTrafficTypeExplain())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "返回方式为其他时,“其他返回方式”为必填", "返回方式为其他时,“其他返回方式”为必填");
}
//磐石
if(StrConstant.PS_CUSTOMER_ID.equals(formDTO.getCustomerId())){
if(StringUtils.isEmpty(formDTO.getNatOutcome())){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "48小时核算记录为必填", "48小时核算记录为必填");
}
}else {//其他客户
if(StringUtils.isEmpty(formDTO.getVaccineNum())||StringUtils.isEmpty(formDTO.getIsNatRecord())){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "疫苗接种针次和48小时核算记录为必填", "疫苗接种针次和48小时核算记录为必填");
}
}
//如果是单个录入的,默认数据属于当前用户所属组织id
if(IcResiUserConstant.USER_TYPE_INPUT.equals(formDTO.getUserType())){
//获取当前登录用户所属组织id
@ -326,6 +341,20 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
@Override
@Transactional(rollbackFor = Exception.class)
public String resiSave(IcTripReportFormDTO formDTO) {
//按客户校验参数
if ("5".equals(formDTO.getTrafficType()) && StringUtils.isBlank(formDTO.getTrafficTypeExplain())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "返回方式为其他时,“其他返回方式”为必填", "返回方式为其他时,“其他返回方式”为必填");
}
//磐石
if(StrConstant.PS_CUSTOMER_ID.equals(formDTO.getCustomerId())){
if(StringUtils.isEmpty(formDTO.getNatOutcome())){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "48小时核算记录为必填", "48小时核算记录为必填");
}
}else {//其他客户
if(StringUtils.isEmpty(formDTO.getVaccineNum())||StringUtils.isEmpty(formDTO.getIsNatRecord())){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "疫苗接种针次和48小时核算记录为必填", "疫苗接种针次和48小时核算记录为必填");
}
}
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(formDTO.getGridId());
if (null == gridInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询网格信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());

Loading…
Cancel
Save