|
@@ -439,8 +439,18 @@ public class KwcContractTradeService {
|
|
|
if (Objects.isNull(baseInfo)) {
|
|
if (Objects.isNull(baseInfo)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- boolean hasAgentEnt = Objects.nonNull(baseInfo.getAgentEntId());
|
|
|
|
|
- boolean hasAgentPhone = StringUtils.isNotBlank(baseInfo.getAgentPhone());
|
|
|
|
|
|
|
+ validateAgentUnitParam(baseInfo.getAgentEntId(), baseInfo.getAgentPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 校验代理单位和联系电话必须同时填写或同时不填写。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param agentEntId 代理单位ID
|
|
|
|
|
+ * @param agentPhone 代理单位联系电话
|
|
|
|
|
+ */
|
|
|
|
|
+ static void validateAgentUnitParam(Long agentEntId, String agentPhone) {
|
|
|
|
|
+ boolean hasAgentEnt = Objects.nonNull(agentEntId);
|
|
|
|
|
+ boolean hasAgentPhone = StringUtils.isNotBlank(agentPhone);
|
|
|
if (!hasAgentEnt && !hasAgentPhone) {
|
|
if (!hasAgentEnt && !hasAgentPhone) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -676,6 +686,13 @@ public class KwcContractTradeService {
|
|
|
tradeBaseInfoResVo.setPurchaseContacts(kwcContractTradeUnit.getContacts());
|
|
tradeBaseInfoResVo.setPurchaseContacts(kwcContractTradeUnit.getContacts());
|
|
|
tradeBaseInfoResVo.setPurchaseEntId(kwcContractTradeUnit.getEntId());
|
|
tradeBaseInfoResVo.setPurchaseEntId(kwcContractTradeUnit.getEntId());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (Objects.equals(kwcContractTradeUnit.getUnitType(), KwcContractTradeUnitService.TRADE_AGENT_UNIT_TYPE)) {
|
|
|
|
|
+ tradeBaseInfoResVo.setAgentEntName(kwcContractTradeUnit.getFirmName());
|
|
|
|
|
+ tradeBaseInfoResVo.setAgentPhone(kwcContractTradeUnit.getSignPhone());
|
|
|
|
|
+ tradeBaseInfoResVo.setAgentContacts(kwcContractTradeUnit.getContacts());
|
|
|
|
|
+ tradeBaseInfoResVo.setAgentEntId(kwcContractTradeUnit.getEntId());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
contractTradeDetailResVo.setBaseInfo(tradeBaseInfoResVo);
|
|
contractTradeDetailResVo.setBaseInfo(tradeBaseInfoResVo);
|
|
@@ -897,6 +914,8 @@ public class KwcContractTradeService {
|
|
|
EntTypeResDto entTypeResDto = remoteSystemService.queryEntTypeById(LoginUserHolder.getEntId());
|
|
EntTypeResDto entTypeResDto = remoteSystemService.queryEntTypeById(LoginUserHolder.getEntId());
|
|
|
|
|
|
|
|
TradeBaseInfoReqVo baseInfo = reqVo.getBaseInfo();
|
|
TradeBaseInfoReqVo baseInfo = reqVo.getBaseInfo();
|
|
|
|
|
+ // 更新时控制器不会自动级联校验嵌套对象,在业务层保证代理信息完整。
|
|
|
|
|
+ validateAgentUnitParam(baseInfo);
|
|
|
if (Objects.equals(baseInfo.getUnloadWay(), Integer.parseInt(DictEnum.LOAD_UNLOAD_WAY_2.getValue())) && Objects.isNull(baseInfo.getMeasurementWay())) {
|
|
if (Objects.equals(baseInfo.getUnloadWay(), Integer.parseInt(DictEnum.LOAD_UNLOAD_WAY_2.getValue())) && Objects.isNull(baseInfo.getMeasurementWay())) {
|
|
|
throw new BusinessException("卸货方式为按卸货筽量时,计量方式不能为空!");
|
|
throw new BusinessException("卸货方式为按卸货筽量时,计量方式不能为空!");
|
|
|
}
|
|
}
|
|
@@ -1516,6 +1535,7 @@ public class KwcContractTradeService {
|
|
|
|
|
|
|
|
private void checkParam(SupplyContractTradeReq.TradeBaseInfo baseInfo) {
|
|
private void checkParam(SupplyContractTradeReq.TradeBaseInfo baseInfo) {
|
|
|
if (Objects.nonNull(baseInfo)) {
|
|
if (Objects.nonNull(baseInfo)) {
|
|
|
|
|
+ validateAgentUnitParam(baseInfo.getAgentEntId(), baseInfo.getAgentPhone());
|
|
|
if (StringUtils.isNotBlank(baseInfo.getContractCode()) && baseInfo.getContractCode().length() > 20) {
|
|
if (StringUtils.isNotBlank(baseInfo.getContractCode()) && baseInfo.getContractCode().length() > 20) {
|
|
|
throw new SystemException("合同编号超长!");
|
|
throw new SystemException("合同编号超长!");
|
|
|
}
|
|
}
|