diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java index ba5d69631..fa4869587 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java @@ -337,6 +337,64 @@ public class ContractManageApplicationService { return result; } + public List getPrice(String documentTypeCode, String settlementCustomersCode,Long organizationId,Long topOrganizationId) { + List result = new ArrayList<>(); + ContractManagePO contractManagePO = getInfoByCustomerAndOrganizationId(settlementCustomersCode, 1, topOrganizationId, organizationId); + if (contractManagePO != null) { + List contractManageDetailPOList = contractManagePO.getContractManageDetailPOList(); + if (contractManageDetailPOList != null && contractManageDetailPOList.size() > 0) { + List contractManageDetailPOs = contractManageDetailPOList.stream() + .filter(item -> item.getDocumentType().equals(documentTypeCode)) + .collect(Collectors.toList()); + if (contractManageDetailPOs != null && contractManageDetailPOs.size() > 0) { + for (ContractManageDetailPO contractManageDetailPO : contractManageDetailPOs) { + Long accountingStrategyId = contractManageDetailPO.getAccountingStrategyId(); + List billingParams = contractManageDetailMapper.getBillingParams(accountingStrategyId); + if (billingParams != null && billingParams.size() > 0) { + //if (billingParams != null && billingParams.size() > 0) { + BillingParamsPO billingParam = billingParams.get(0); + String billingParamsJson = billingParam.getBillingParamsJson(); + String preSetRules = billingParam.getPreSetRules(); + Long billingParamsId = billingParam.getBillingParamsId(); + List> preSetRulesList = JSON.parseObject(preSetRules, new TypeReference>>() {}); + List> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference>>() {}); + Map stringObjectMap1 = preSetRulesList.get(0); + for (Map stringObjectMap : billingParamsList) { + String fieldsName = (String) stringObjectMap.get("fieldsName"); + String isShow = (String) stringObjectMap.get("isShow"); + String isFee = (String) stringObjectMap.get("isFee"); + String isPush = (String) stringObjectMap.get("isPush"); + if ("1".equals(isFee)) { + Integer sort = (Integer) stringObjectMap.get("sort"); + String chargingId = (String) stringObjectMap.get("chargingId"); + String fields = (String) stringObjectMap.get("fields"); + String price = (String) stringObjectMap1.get("fields" + sort); + SubjectAndPriceReturn subjectAndPriceReturn = new SubjectAndPriceReturn(); + subjectAndPriceReturn.setName(fieldsName); + subjectAndPriceReturn.setPrice(new BigDecimal(price)); + subjectAndPriceReturn.setChargingId(chargingId); + subjectAndPriceReturn.setFields(fields); + subjectAndPriceReturn.setBillingRulesId(accountingStrategyId); + subjectAndPriceReturn.setIsShow(isShow); + subjectAndPriceReturn.setIsFee(isFee); + subjectAndPriceReturn.setIsPush(isPush); + subjectAndPriceReturn.setRulesId(billingParamsId); + result.add(subjectAndPriceReturn); + } + } + //} + } else { + throw new ServiceException("计费参数不存在"); + } + } + } + } + } else { + throw new ServiceException("合同信息不存在"); + } + return null; + } + public List getSubject(SubjectAndPriceDTO contractManageDTO) { List result = new ArrayList<>(); Long settlementCustomersId = contractManageDTO.getSettlementCustomersId(); diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManage/ContractManageApi.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManage/ContractManageApi.java index 502883e1c..1e2039f0e 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManage/ContractManageApi.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManage/ContractManageApi.java @@ -70,6 +70,19 @@ public class ContractManageApi extends BaseController{ return AjaxResult.success(contractManageApplicationService.getSubject(subjectAndPriceDTO)); } + /** + * 获取单价 + */ + @ApiOperation("获取单价") + @GetMapping(value = "/getPrice") + public AjaxResult getPrice(@RequestParam("documentTypeCode") String documentTypeCode, + @RequestParam("settlementCustomersCode") String settlementCustomersCode, + @RequestParam("organizationId") Long organizationId, + @RequestParam("topOrganizationId") Long topOrganizationId) + { + return AjaxResult.success(contractManageApplicationService.getPrice(documentTypeCode,settlementCustomersCode,organizationId,topOrganizationId)); + } + /** * 获取科目和单价 */