查询显示科目单价;

This commit is contained in:
王奎兴
2026-04-02 16:03:22 +08:00
parent ba5137899f
commit 21ae63e78d
7 changed files with 221 additions and 9 deletions
@@ -0,0 +1,88 @@
package com.mhd.common.core.domain.po;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 计费参数对象 billing_params
*
* @author gen
* @date 2024-07-12
*/
@Data
@ApiModel(value = "计费参数对象", description = "计费参数响应对象")
public class BillingParamsPO extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("计费参数id")
private Long billingParamsId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("计费参数表名称")
@Excel(name = "计费参数表名称")
private String billingParamsName;
@ApiModelProperty("说明")
@Excel(name = "说明")
private String billingIllustrate;
/**
* {
* "fields":"参与字段",
* "chargingId":"计费标识P1、P2",
* "ladderType":"阶梯类型(1-固定参数,2-无阶梯,3-到达阶梯,4-累进阶梯)",
* "ladderRule":"阶梯规则(1-左开右闭,2-左闭右开)",
* "ladderNum":"阶梯值",
* "sort":"排序"
* }
*/
@ApiModelProperty("计费参数json串")
@Excel(name = "计费参数json串")
private String billingParamsJson;
/**
*{
* "outFields":"输出字段",
* "outChargingId":"输出计费标识",
* "fieIdsType":"字段类型(1-整数,2-浮点数,3-时间)",
* "sort":"排序"
* }
*/
@ApiModelProperty("计费参数输出json串")
@Excel(name = "计费参数输出json串")
private String billingOutputJson;
/**
* {
* "fieIds1":"字段1",
* "fieIds2":"字段2",
* "fieIdsn":"字段N",
* "outFieIds1":"输出字段1",
* "outFieIds2":"输出字段2",
* "outFieIdsn":"输出字段n"
* }
*/
@ApiModelProperty("预置规则json串")
@Excel(name = "预置规则json串")
private String preSetRules;
@ApiModelProperty("计费规则id")
private Long billingRulesId;
}
@@ -4,8 +4,11 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.basic.domain.contractManage.entity.ContractManage;
import com.mhd.basic.domain.contractManage.repository.mapper.ContractManageMapper;
import com.mhd.basic.domain.contractManage.repository.po.ContractManagePO;
import com.mhd.basic.domain.contractManage.repository.todo.ContractManageDO;
import com.mhd.basic.domain.contractManage.service.ContractManageDomainService;
@@ -17,11 +20,9 @@ import com.mhd.basic.domain.contractManageDetail.service.ContractManageDetailDom
import com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO;
import com.mhd.basic.domain.expenseAccount.service.ExpenseAccountDomainService;
import com.mhd.basic.interfaces.dto.contractManage.ContractManageDTO;
import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceDTO;
import com.mhd.basic.interfaces.dto.contractManageDetail.ContractManageDetailDTO;
import com.mhd.common.core.domain.po.BillingRulesPO;
import com.mhd.common.core.domain.po.DocumentTypePO;
import com.mhd.common.core.domain.po.SettlementCustomersPO;
import com.mhd.common.core.domain.po.SysDictDataVo;
import com.mhd.common.core.domain.po.*;
import com.mhd.common.core.enums.DictCode;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
@@ -42,6 +43,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -63,8 +65,10 @@ public class ContractManageApplicationService {
private ExpenseAccountDomainService expenseAccountDomainService;
@Autowired
private ContractManageDetailDomainService contractManageDetailDomainService;
@Autowired
@Resource
private ContractManageDetailMapper contractManageDetailMapper;
@Resource
private ContractManageMapper contractManageMapper;
@Autowired
private BmsServiceFeign bmsServiceFeign;
@@ -125,6 +129,70 @@ public class ContractManageApplicationService {
return contractManageDomainService.queryList(contractManageDO);
}
public List<Map<String, Object>> getSubjectAndPrice(SubjectAndPriceDTO contractManageDTO) {
List<Map<String, Object>> result = new ArrayList<>();
Long settlementCustomersId = contractManageDTO.getSettlementCustomersId();
Long organizationId = contractManageDTO.getOrganizationId();
String sunjectCode = contractManageDTO.getSubjectCode();
Long topOrganizationId = contractManageDTO.getTopOrganizationId();
List<ContractManage> UserContractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
.eq(ContractManage::getSettlementCustomersId, settlementCustomersId)
.eq(ContractManage::getDelFlag, 1)
.eq(ContractManage::getOrganizationId, organizationId)
.eq(ContractManage::getTopOrganizationId, topOrganizationId)
.eq(ContractManage::getCommonContractFlag, 2));
if (UserContractManages != null && UserContractManages.size() > 0) {
}else{
List<ContractManage> commonContractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
.eq(ContractManage::getDelFlag, 1)
.eq(ContractManage::getOrganizationId, organizationId)
.eq(ContractManage::getTopOrganizationId, topOrganizationId)
.eq(ContractManage::getCommonContractFlag, 1));
if (commonContractManages != null && commonContractManages.size() > 0) {
ContractManage contractManage = commonContractManages.get(0);
Long contractManageId = contractManage.getContractManageId();
List<ContractManageDetail> contractManageDetails = contractManageDetailMapper.selectList(new LambdaQueryWrapper<ContractManageDetail>()
.eq(ContractManageDetail::getContractManageId, contractManageId)
.eq(ContractManageDetail::getDelFlag, 1));
if (contractManageDetails != null && contractManageDetails.size() > 0) {
for (ContractManageDetail contractManageDetail : contractManageDetails) {
String code = contractManageDetail.getFirstSubjectCode();
if (sunjectCode.equals(code)) {
Long accountingStrategyId = contractManageDetail.getAccountingStrategyId();
BillingRulesPO billingRule = contractManageDetailMapper.getBillingRules(accountingStrategyId);
if (billingRule != null) {
Long billingRulesId = billingRule.getBillingRulesId();
List<BillingParamsPO> billingParams = contractManageDetailMapper.getBillingParams(billingRulesId);
if (billingParams != null && billingParams.size() > 0) {
BillingParamsPO billingParam = billingParams.get(0);
String billingParamsJson = billingParam.getBillingParamsJson();
String preSetRules = billingParam.getPreSetRules();
List<Map<String, Object>> preSetRulesList = JSON.parseObject(preSetRules, new TypeReference<List<Map<String, Object>>>() {});
List<Map<String, Object>> billingParamsList = JSON.parseObject(billingParamsJson, new TypeReference<List<Map<String, Object>>>() {});
Map<String, Object> stringObjectMap1 = preSetRulesList.get(0);
for (Map<String, Object> stringObjectMap : billingParamsList) {
String fieldsName = (String) stringObjectMap.get("fieldsName");
if (fieldsName != null && ("装卸费单价".equals(fieldsName) ||
"纸箱贴标单价".equals(fieldsName)||"木箱贴标单价".equals(fieldsName)
|| "进出仓操作费单价".equals(fieldsName))) {
Map<String, Object> subjectAndPrice = billingParamsList.get(0);
String sort = (String) stringObjectMap.get("sort");
String price = (String) stringObjectMap1.get("fields" + sort);
subjectAndPrice.put("name", fieldsName);
subjectAndPrice.put("price", price);
result.add(subjectAndPrice);
}
}
}
}
}
}
}
}
}
return result;
}
/**
* 新增合同管理
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.basic.domain.contractManageDetail.entity.ContractManageDetail;
import com.mhd.basic.domain.contractManageDetail.repository.po.ContractManageDetailPO;
import com.mhd.basic.domain.contractManageDetail.repository.todo.ContractManageDetailDO;
import com.mhd.common.core.domain.po.BillingParamsPO;
import com.mhd.common.core.domain.po.BillingRulesPO;
import org.apache.ibatis.annotations.Param;
/**
* 合同管理详情Mapper接口
@@ -20,4 +22,8 @@ public interface ContractManageDetailMapper extends BaseMapper<ContractManageDet
public List<ContractManageDetailPO> queryList(@Param("contractManageDetailDO") ContractManageDetailDO contractManageDetailDO);
List<ContractManageDetailPO> getListByContractManageId(@Param("contractManageId") Long contractManageId);
}
BillingRulesPO getBillingRules(@Param("id") Long id);
List<BillingParamsPO> getBillingParams(@Param("id") Long id);
}
@@ -0,0 +1,30 @@
package com.mhd.basic.interfaces.dto.contractManage;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class SubjectAndPriceDTO extends BaseVOEntity {
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("结算主体")
@Excel(name = "结算主体")
private Long settlementCustomersId;
@ApiModelProperty("价格")
@Excel(name = "价格")
private String subjectCode;
}
@@ -3,6 +3,7 @@ package com.mhd.basic.interfaces.facade.contractManage;
import java.util.List;
import com.mhd.basic.interfaces.assember.contractManage.ContractManageAssembler;
import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +47,17 @@ public class ContractManageApi extends BaseController{
return getDataTable(list);
}
/**
* 获取科目和单价
*/
@ApiOperation("获取科目和单价")
@GetMapping("/getSubjectAndPrice")
public AjaxResult getSubjectAndPrice(SubjectAndPriceDTO subjectAndPriceDTO)
{
//转换实体
return AjaxResult.success(contractManageApplicationService.getSubjectAndPrice(subjectAndPriceDTO));
}
/**
* 保存合同管理
*/
@@ -146,4 +158,4 @@ public class ContractManageApi extends BaseController{
}
}
@@ -76,4 +76,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
contract_manage_id = #{contractManageId}
</select>
</mapper>
<select id="getBillingRules" resultType="com.mhd.common.core.domain.po.BillingRulesPO" parameterType="java.lang.Long">
select * from "NGWL_TEST_BMS".billing_rules where billing_rules_id = #{id} and del_flag = 1
</select>
<select id="getBillingParams" resultType="com.mhd.common.core.domain.po.BillingParamsPO" parameterType="java.lang.Long">
select * from "NGWL_TEST_BMS".billing_params where billing_rules_id = #{id} and del_flag = 1
</select>
</mapper>
+1 -1
View File
@@ -4,4 +4,4 @@ ALTER TABLE "NGWL_TEST_SYSTEM"."EXPENSE_ACCOUNT" ADD COLUMN "out_order_display"
COMMENT ON COLUMN "NGWL_TEST_SYSTEM"."EXPENSE_ACCOUNT"."in_order_display" IS '入库单是否固定显示 0-否 1-是';
COMMENT ON COLUMN "NGWL_TEST_SYSTEM"."EXPENSE_ACCOUNT"."out_order_display" IS '出库单是否固定显示 0-否 1-是'
COMMENT ON COLUMN "NGWL_TEST_SYSTEM"."EXPENSE_ACCOUNT"."out_order_display" IS '出库单是否固定显示 0-否 1-是';