租赁推送到bms合同查询查不到就查通用

This commit is contained in:
zhou-hongcheng
2026-03-17 16:53:34 +08:00
parent 86a2151330
commit 9b5075a6a9
6 changed files with 79 additions and 23 deletions
@@ -331,6 +331,11 @@ public interface SystemServiceFeign {
@GetMapping("/contractManageApi/getInfoByCode")
public AjaxResult getInfoByCode(@RequestParam("contractNumber") String contractNumber);
/**
* 获取通用合同
*/
@GetMapping("/contractManageApi/getGeneralContract")
public AjaxResult getGeneralContract();
/**
* 根据结算主体获取合同信息
*/
@@ -472,7 +472,7 @@ public class LeaseApplicationService {
jsonObject.put("lease_area",leasePO.getLeaseArea());//租赁面积
jsonObject.put("jiecun_cbm",0);//结存体积
businessDataPushDTO.setDocumentFormJson(jsonObject.toJSONString());
businessDataPushDTO.setDocumentTypeCode("ckzld");
businessDataPushDTO.setDocumentTypeCode("仓库租赁单");
businessDataPushDTO.setSettlementEntityId(leasePO.getShipperId());
businessDataPushDTO.setSecondSubjectCode(leasePO.getSecondSubjectCode());
businessDataPushDTO.setServiceItemsCode(leasePO.getServiceItemsCode());
@@ -518,10 +518,10 @@ public class LeaseApplicationService {
jsonObject.put("lease_area",0);//租赁面积
jsonObject.put("jiecun_cbm",totalVolume);//结存体积
businessDataPushDTO.setDocumentFormJson(jsonObject.toJSONString());
businessDataPushDTO.setDocumentTypeCode("ckzld");
businessDataPushDTO.setDocumentTypeCode("仓库租赁单");
businessDataPushDTO.setSettlementEntityId(leasePO.getShipperId());
businessDataPushDTO.setSecondSubjectCode("26WMS01");
businessDataPushDTO.setServiceItemsCode("26WMS费用");
businessDataPushDTO.setSecondSubjectCode(leasePO.getSecondSubjectCode());
businessDataPushDTO.setServiceItemsCode(leasePO.getServiceItemsCode());
businessDataPushDTO.setDataSources(1);
bmsServiceFeign.businessDocumentApiSave(businessDataPushDTO);
}
@@ -478,5 +478,7 @@ public class ContractManageApplicationService {
}
public ContractManagePO getGeneralContract() {
return contractManageDomainService.getGeneralContract();
}
}
@@ -155,13 +155,39 @@ public class ContractManageDomainService {
}
public ContractManagePO getGeneralContract() {
ContractManagePO contractManagePO = new ContractManagePO();
LambdaQueryWrapper<ContractManage> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ContractManage::getCommonContractFlag,1);
queryWrapper.eq(ContractManage::getDelFlag,1);
ContractManage contractManage = contractManageService.getOne(queryWrapper);
if(null != contractManage){
BeanUtils.copyProperties(contractManage,contractManagePO);
//得到合同后,查询合同明细
List<ContractManageDetailPO> contractManageDetailPOList = contractManageDetailDomainService.queryListByManageId(contractManagePO.getContractManageId());
List<ContractManageDetailPO> contractManageDetailSaveList = new ArrayList<>();
if(contractManageDetailPOList != null && contractManageDetailPOList.size()>0){
//将临时合同中没有,但是通用合同中有的数据过滤出(使用 ObjectUtil.equal 避免 firstSubjectCode/secondSubjectCode 为 null 时 NPE
contractManageDetailSaveList = contractManageDetailPOList.stream().filter(item -> contractManageDetailPOList.stream().anyMatch(item1 -> ObjectUtil.equal(item1.getFirstSubjectCode(), item.getFirstSubjectCode()) && ObjectUtil.equal(item1.getSecondSubjectCode(), item.getSecondSubjectCode()) && item1.getSubjectType()==1)).collect(Collectors.toList());
//首先根据结算科目类型将临时合同过滤出
List<ContractManageDetailPO> tempContractManageDetailPOList = contractManageDetailPOList.stream().filter(item -> item.getSubjectType()==2).collect(Collectors.toList());
//遍历两个集合,将相同费用科目code的数据,进行比较,如果结算科目类型是临时且合同有效期有效,则使用该条数据,将另一条移除
for (ContractManageDetailPO manageDetailPO : tempContractManageDetailPOList) {
for (ContractManageDetailPO contractManageDetailPO : contractManageDetailPOList) {
if(ObjectUtil.equal(contractManageDetailPO.getFirstSubjectCode(), manageDetailPO.getFirstSubjectCode()) && ObjectUtil.equal(contractManageDetailPO.getSecondSubjectCode(), manageDetailPO.getSecondSubjectCode())){
//判断如果是临时合同在有效期内,则将该条数据保存到集合contractManageDetailSaveList
DateTime start = DateUtil.parseDate(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
DateTime end = DateUtil.parseDateTime(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
DateTime now = DateUtil.beginOfDay(DateUtil.date());
if (now.isAfterOrEquals(start) && now.isBefore(end)) {
contractManageDetailSaveList.add(manageDetailPO);
}
}
}
}
}
contractManagePO.setContractManageDetailPOList(contractManageDetailSaveList);
}
return contractManagePO;
}
}
@@ -126,6 +126,13 @@ public class ContractManageApi extends BaseController{
return AjaxResult.success(contractManageApplicationService.getInfoByCode(contractNumber));
}
@ApiOperation("查询通用合同")
@GetMapping(value = "/getGeneralContract")
public AjaxResult getGeneralContract()
{
return AjaxResult.success(contractManageApplicationService.getGeneralContract());
}
@ApiOperation("查询所有合同管理")
@GetMapping("/queryList")
@@ -119,15 +119,31 @@ public class CostCalculationApplicationService {
private BillingRulesPO chooseBillingParams(CostCalculationDTO costCalculationDTO,TaskFlowRecordsDO taskFlowRecordsDO) {
//获取合同信息
AjaxResult ajaxResult = systemServiceFeign.getInfoByCode(costCalculationDTO.getContractNumber());
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
throw new ServiceException("合同信息未找到");
}
ContractManagePO contractPO = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), ContractManagePO.class);
if (null == contractPO) {
throw new ServiceException("合同信息未找到");
}
if(contractPO.getContractManageDetailPOList() == null || contractPO.getContractManageDetailPOList().size() == 0){
throw new ServiceException("合同详情列表为空,无法进行计算");
ContractManagePO contractPO = null;
try {
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
throw new ServiceException("合同信息未找到");
}
contractPO = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), ContractManagePO.class);
if (null == contractPO) {
throw new ServiceException("合同信息未找到");
}
if(contractPO.getContractManageDetailPOList() == null || contractPO.getContractManageDetailPOList().size() == 0){
throw new ServiceException("合同详情列表为空,无法进行计算");
}
} catch (ServiceException e) {
//查询通用合同
AjaxResult generalContract = systemServiceFeign.getGeneralContract();
if (!"200".equals(String.valueOf(generalContract.get("code")))) {
throw new ServiceException("通用合同信息未找到");
}
contractPO = JSONObject.parseObject(JSONObject.toJSONString(generalContract.get("data")), ContractManagePO.class);
if (null == contractPO) {
throw new ServiceException("通用合同信息未找到");
}
if(contractPO.getContractManageDetailPOList() == null || contractPO.getContractManageDetailPOList().size() == 0){
throw new ServiceException("通用合同详情列表为空,无法进行计算");
}
}
//查询单据信息