From 3349552e10fe9f218ef81cf057faa1bbcd9922f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 28 Aug 2026 17:32:02 +0800 Subject: [PATCH 01/32] =?UTF-8?q?=E7=BB=93=E7=AE=97=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E6=94=B9=E9=80=A0;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mhd/system/api/OmsServiceFeign.java | 2 +- .../mhd/system/api/SystemServiceFeign.java | 6 + .../domain/ContractManageDetailFeignDTO.java | 110 +++++++++ .../api/domain/ContractManageFeignDTO.java | 228 ++++++++++++++++++ .../RemoteSystemFeignFallbackFactory.java | 6 + .../ContractManageApplicationService.java | 31 +++ .../contractManage/entity/ContractManage.java | 12 + .../repository/po/ContractManagePO.java | 13 + .../repository/todo/ContractManageDO.java | 12 + .../dto/contractManage/ContractManageDTO.java | 12 + .../contractManage/ContractManageApi.java | 20 ++ .../mapper/basic/ContractManageMapper.xml | 6 + ...SettlementCustomersApplicationService.java | 143 ++++++++++- ...ntCustomersNcConfigApplicationService.java | 87 +++++++ ...CustomersParametersApplicationService.java | 87 +++++++ .../entity/SettlementCustomers.java | 3 +- .../persistence/SettlementCustomersImpl.java | 25 +- .../repository/po/SettlementCustomersPO.java | 8 + .../todo/SettlementCustomersDO.java | 9 + .../entity/SettlementCustomersNcConfig.java | 80 ++++++ .../ISettlementCustomersNcConfigService.java | 42 ++++ .../SettlementCustomersNcConfigMapper.java | 23 ++ .../SettlementCustomersNcConfigImpl.java | 81 +++++++ .../po/SettlementCustomersNcConfigPO.java | 77 ++++++ .../todo/SettlementCustomersNcConfigDO.java | 81 +++++++ ...tlementCustomersNcConfigDomainService.java | 59 +++++ .../entity/SettlementCustomersParameters.java | 69 ++++++ ...ISettlementCustomersParametersService.java | 42 ++++ .../SettlementCustomersParametersMapper.java | 23 ++ .../SettlementCustomersParametersImpl.java | 81 +++++++ .../po/SettlementCustomersParametersPO.java | 64 +++++ .../todo/SettlementCustomersParametersDO.java | 68 ++++++ ...ementCustomersParametersDomainService.java | 59 +++++ .../SettlementCustomersNcConfigAssembler.java | 71 ++++++ ...ettlementCustomersParametersAssembler.java | 71 ++++++ .../SettlementCustomersDTO.java | 10 + .../SettlementCustomersNcConfigDTO.java | 78 ++++++ .../SettlementCustomersParametersDTO.java | 65 +++++ .../SettlementCustomersNcConfigApi.java | 91 +++++++ .../SettlementCustomersParametersApi.java | 92 +++++++ .../mapper/SettlementCustomersMapper.xml | 2 + .../SettlementCustomersNcConfigMapper.xml | 90 +++++++ .../SettlementCustomersParametersMapper.xml | 84 +++++++ 43 files changed, 2308 insertions(+), 15 deletions(-) create mode 100644 mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageDetailFeignDTO.java create mode 100644 mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageFeignDTO.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersNcConfig/SettlementCustomersNcConfigApplicationService.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersParameters/SettlementCustomersParametersApplicationService.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/entity/SettlementCustomersNcConfig.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/facade/ISettlementCustomersNcConfigService.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/mapper/SettlementCustomersNcConfigMapper.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/persistence/SettlementCustomersNcConfigImpl.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/po/SettlementCustomersNcConfigPO.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/todo/SettlementCustomersNcConfigDO.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/service/SettlementCustomersNcConfigDomainService.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/entity/SettlementCustomersParameters.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/facade/ISettlementCustomersParametersService.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/mapper/SettlementCustomersParametersMapper.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/persistence/SettlementCustomersParametersImpl.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/po/SettlementCustomersParametersPO.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/todo/SettlementCustomersParametersDO.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/service/SettlementCustomersParametersDomainService.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/settlementCustomersNcConfig/SettlementCustomersNcConfigAssembler.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/settlementCustomersParameters/SettlementCustomersParametersAssembler.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomersNcConfig/SettlementCustomersNcConfigDTO.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomersParameters/SettlementCustomersParametersDTO.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersNcConfigApi.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersParametersApi.java create mode 100644 mhd_bms/src/main/resources/mapper/SettlementCustomersNcConfigMapper.xml create mode 100644 mhd_bms/src/main/resources/mapper/SettlementCustomersParametersMapper.xml diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 4ef3bed80..6a9fd6081 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://127.0.0.1:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/SystemServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/SystemServiceFeign.java index f9abbe1f6..af6d318b4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/SystemServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/SystemServiceFeign.java @@ -12,6 +12,7 @@ import com.mhd.common.core.domain.entity.R; import com.mhd.common.core.domain.po.SysMultistageDictPo; import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.system.api.domain.ContainerFeignPO; +import com.mhd.system.api.domain.ContractManageFeignDTO; import com.mhd.system.api.domain.SysDictData; import com.mhd.system.api.factory.RemoteSystemFeignFallbackFactory; import com.mhd.system.api.feign.FeignAutoConfiguration; @@ -390,4 +391,9 @@ public interface SystemServiceFeign { public AjaxResult matchForMaterialImport(@RequestParam("keyword") String keyword, @RequestParam("organizationId") Long organizationId); + + @ApiOperation("保存临时合同管理") + @PostMapping("/contractManageApi/feignSave") + public AjaxResult feignSave(@RequestBody ContractManageFeignDTO contractManageFeignDTO); + } \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageDetailFeignDTO.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageDetailFeignDTO.java new file mode 100644 index 000000000..621f28c83 --- /dev/null +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageDetailFeignDTO.java @@ -0,0 +1,110 @@ +package com.mhd.system.api.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * 合同管理详情对象 contract_manage_detail + * + * @author gen + * @date 2024-06-07 + */ + +@Data +public class ContractManageDetailFeignDTO extends BaseVOEntity{ + private static final long serialVersionUID = 1L; + + @ApiModelProperty("合同管理详情id") + private Long contractManageDetailId; + + @ApiModelProperty("合同管理id") + @Excel(name = "合同管理id") + private Long contractManageId; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("结算科目类型(1-通用,2-临时)") + @Excel(name = "结算科目类型", readConverterExp = "1=-通用,2-临时") + private Integer subjectType; + + @ApiModelProperty("一级费用科目code") + @Excel(name = "一级费用科目code") + private String firstSubjectCode; + + @ApiModelProperty("一级费用科目") + @Excel(name = "一级费用科目") + private String firstSubjectName; + + @ApiModelProperty("二级费用科目code") + @Excel(name = "二级费用科目code") + private String secondSubjectCode; + + @ApiModelProperty("二级费用科目") + @Excel(name = "二级费用科目") + private String secondSubjectName; + + @ApiModelProperty("计费策略id") + @Excel(name = "计费策略id") + private Long accountingStrategyId; + + @ApiModelProperty("计费策略") + @Excel(name = "计费策略") + private String accountingStrategy; + + @ApiModelProperty("计费策略编码") + @Excel(name = "计费策略编码") + private String accountingStrategyCode; + + @ApiModelProperty("计费周期") + @Excel(name = "计费周期") + private String billingAttributes; + + @ApiModelProperty("计费周期编码") + @Excel(name = "计费周期编码") + private String billingAttributesCode; + + @ApiModelProperty("合同有效日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "合同有效日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date subjectEffectiveDate; + + @ApiModelProperty("合同到期日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "合同到期日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date subjectExpirationDate; + + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + + @ApiModelProperty("单据类型code") + private String documentTypeCode; + + @ApiModelProperty("单据类型") + private String documentType; + + @ApiModelProperty("费用类别编码") + private String serviceItemsCode; + + @ApiModelProperty("费用类别名称") + private String serviceItemsName; +} \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageFeignDTO.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageFeignDTO.java new file mode 100644 index 000000000..626bc8ea9 --- /dev/null +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageFeignDTO.java @@ -0,0 +1,228 @@ +package com.mhd.system.api.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * 合同管理对象 contract_manage + * + * @author gen + * @date 2024-06-07 + */ + +@Data +public class ContractManageFeignDTO extends BaseVOEntity{ + private static final long serialVersionUID = 1L; + + @ApiModelProperty("合同管理id") + private Long contractManageId; + + @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 originalContractNumber; + + @ApiModelProperty("合同编号") + @Excel(name = "合同编号") + private String contractNumber; + + @ApiModelProperty("合同名称") + @Excel(name = "合同名称") + private String contractName; + + @ApiModelProperty("是否通用合同(1-是,2-否)") + @Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否") + private Integer commonContractFlag; + + @ApiModelProperty("合同类型(1-仓储,2-运输,3-其他)") + @Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输,3=-其他") + private Integer contractType; + + @ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)") + @Excel(name = "合同状态", readConverterExp = "1=-未生效,2-使用中,3-已过期,4-已作废") + private Integer contractState; + + @ApiModelProperty("签订单位") + @Excel(name = "签订单位") + private String signingUnit; + + @ApiModelProperty("结算主体") + @Excel(name = "结算主体") + private String settlementCustomers; + + @ApiModelProperty("结算主体id") + @Excel(name = "结算主体id") + private Long settlementCustomersId; + + @ApiModelProperty("结算主体code") + @Excel(name = "结算主体code") + private String settlementCustomersCode; + + @ApiModelProperty("我司身份(1-甲方,2-乙方)") + @Excel(name = "我司身份", readConverterExp = "1=-甲方,2-乙方") + private Integer ourIdentity; + + @ApiModelProperty("账期(1-每月,2-双月,3-季度)") + @Excel(name = "账期", readConverterExp = "1=-每月,2-双月,3-季度") + private Integer accountingPeriod; + + @ApiModelProperty("合同签订日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "合同签订日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date signingDate; + + @ApiModelProperty("合同生效日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "合同生效日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date effectiveDate; + + @ApiModelProperty("合同到期日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "合同到期日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expirationDate; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("合同正本附件地址") + @Excel(name = "合同正本附件地址") + private String contractOriginalUrl; + + @ApiModelProperty("廉政协议附件地址") + @Excel(name = "廉政协议附件地址") + private String integrityAgreementUrl; + + @ApiModelProperty("安全协议附件地址") + @Excel(name = "安全协议附件地址") + private String securityProtocolUrl; + + @ApiModelProperty("其他附件地址") + @Excel(name = "其他附件地址") + private String otherAttachmentsUrl; + + @ApiModelProperty("合同正本附件原始文件名") + private String contractOriginalName; + + @ApiModelProperty("廉政协议附件原始文件名") + private String integrityAgreementName; + + @ApiModelProperty("安全协议附件原始文件名") + private String securityProtocolName; + + @ApiModelProperty("其他附件原始文件名(多文件时与 otherAttachmentsUrl 同分隔符、同顺序)") + private String otherAttachmentsName; + + @ApiModelProperty("我司签订人") + @Excel(name = "我司签订人") + private String ourSinged; + + @ApiModelProperty("我司签订人联系方式") + @Excel(name = "我司签订人联系方式") + private String ourSingedPhone; + + @ApiModelProperty("我司经办人") + @Excel(name = "我司经办人") + private String ourOperator; + + @ApiModelProperty("我司经办人联系方式") + @Excel(name = "我司经办人联系方式") + private String ourOperatorPhone; + + @ApiModelProperty("对方签订人") + @Excel(name = "对方签订人") + private String theySinged; + + @ApiModelProperty("对方签订人联系方式") + @Excel(name = "对方签订人联系方式") + private String theySingedPhone; + + @ApiModelProperty("对方经办人") + @Excel(name = "对方经办人") + private String theyOperator; + + @ApiModelProperty("对方经办人联系方式") + @Excel(name = "对方经办人联系方式") + private String theyOperatorPhone; + + @ApiModelProperty(name = "组织ID集合") + private List organizationIdList; + + @ApiModelProperty(name = "权限菜单ID") + private Long permissionMenuId; + + @ApiModelProperty(name = "合同科目详情列表") + private List contractManageDetailDTOList; + + @ApiModelProperty("合同管理ids") + private String contractManageIds; + + @ApiModelProperty(name = "合同签订查询条件开始日期") + private String signingDateStart; + @ApiModelProperty(name = "合同签订查询条件结束日期") + private String signingDateEnd; + + @ApiModelProperty(name = "合同生效查询条件开始日期") + private String effectiveDateStart; + @ApiModelProperty(name = "合同生效查询条件结束日期") + private String effectiveDateEnd; + + @ApiModelProperty(name = "合同到期查询条件开始日期") + private String expirationDateStart; + @ApiModelProperty(name = "合同到期查询条件结束日期") + private String expirationDateEnd; + + @ApiModelProperty(name = "结算主体基础数据id(可以是用户id也可以是企业id)") + private String settlementId; + + @ApiModelProperty(name = "是否自动出账(1-是,2-否)") + private Integer automaticFlag; + + @ApiModelProperty("出账日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date paymentDate; + + @ApiModelProperty(name = "出账天数") + private Integer billDays; + + @ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)") + private Integer principalType; + + @ApiModelProperty("客户类型") + private String customerType; + + @ApiModelProperty("客户类型编码") + private String customerTypeCode; + + @ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)") + private Integer transportationCosts; + + @ApiModelProperty("客户类型") + private String contractRentType; + + @ApiModelProperty("客户类型编码") + private String contractRentTypeName; + + @ApiModelProperty("仓库温层类型") + private String warehouseTempLayerType; + + @ApiModelProperty("仓库温层类型编码") + private String warehouseTempLayerTypeName; +} \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteSystemFeignFallbackFactory.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteSystemFeignFallbackFactory.java index a4b0bfe44..d1bb306cc 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteSystemFeignFallbackFactory.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteSystemFeignFallbackFactory.java @@ -13,6 +13,7 @@ import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.system.api.AssociationWarehouseFeign; import com.mhd.system.api.SystemServiceFeign; import com.mhd.system.api.domain.ContainerFeignPO; +import com.mhd.system.api.domain.ContractManageFeignDTO; import com.mhd.system.api.domain.SysDictData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -318,6 +319,11 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory and a.top_organization_id = #{contractManageDO.topOrganizationId} + + and a.contract_rent_type = #{contractManageDO.contractRentType} + + + and a.warehouse_temp_layer_type = #{contractManageDO.warehouseTempLayerType} + and b.FIRST_SUBJECT_CODE = #{contractManageDO.firstSubjectCode} diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java index 76879467f..66d41ca11 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java @@ -1,5 +1,6 @@ package com.mhd.bms.application.server.settlementCustomers; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSONObject; @@ -10,11 +11,14 @@ import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersP import com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO; import com.mhd.bms.domain.settlementCustomers.repository.persistence.SettlementCustomersImpl; import com.mhd.bms.domain.settlementCustomers.service.SettlementCustomersDomainService; +import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService; +import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters; +import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService; import com.mhd.bms.interfaces.dto.settlementCustomers.SettlementCustomersDTO; -import com.mhd.common.core.domain.po.SysDictDataVo; -import com.mhd.common.core.domain.po.UserDriverPo; -import com.mhd.common.core.domain.po.UserPo; -import com.mhd.common.core.domain.po.UserShipperPo; +import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO; +import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO; +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; @@ -25,19 +29,20 @@ import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.common.security.utils.SecurityUtils; import com.mhd.system.api.SystemServiceFeign; import com.mhd.system.api.UserServiceFeign; +import com.mhd.system.api.domain.BatchDetailFeignPO; +import com.mhd.system.api.domain.ContractManageFeignDTO; +import com.mhd.system.api.domain.WarehouseFeignPO; import com.mhd.system.api.model.LoginUser; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -60,6 +65,10 @@ public class SettlementCustomersApplicationService { private SettlementCustomersMapper settlementCustomersMapper; @Autowired private SettlementCustomersImpl settlementCustomersImpl; + @Autowired + private ISettlementCustomersParametersService settlementCustomersParametersService; + @Autowired + private ISettlementCustomersNcConfigService settlementCustomersNcConfigService; private static final int SYNC_BATCH_SIZE = 500; @@ -138,7 +147,38 @@ public class SettlementCustomersApplicationService { settlementCustomersDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); settlementCustomersDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); settlementCustomersDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); - return settlementCustomersDomainService.insert(settlementCustomersDO); + Boolean insert = settlementCustomersDomainService.insert(settlementCustomersDO); + if (insert) { + List settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigDTOList(); + if (CollectionUtil.isNotEmpty(settlementCustomersNcConfigDTOList)) { + for (SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO : settlementCustomersNcConfigDTOList) { + SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig(); + settlementCustomersNcConfigDTO.setSettlementCustomersId(settlementCustomersDO.getSettlementCustomersId()); + settlementCustomersNcConfigDTO.setOrganizationId(settlementCustomersDO.getOrganizationId()); + settlementCustomersNcConfigDTO.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId()); + settlementCustomersNcConfigDTO.setOrganizationName(settlementCustomersDO.getOrganizationName()); + BeanUtils.copyProperties(settlementCustomersNcConfigDTO, settlementCustomersNcConfig); + settlementCustomersNcConfigService.save(settlementCustomersNcConfig); + } + } + List settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParametersDTOList(); + if (CollectionUtil.isNotEmpty(settlementCustomersParametersDTOList)) { + for (SettlementCustomersParametersDTO settlementCustomersParametersDTO : settlementCustomersParametersDTOList) { + SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters(); + settlementCustomersParametersDTO.setSettlementCustomersId(settlementCustomersDO.getSettlementCustomersId()); + settlementCustomersParametersDTO.setOrganizationId(settlementCustomersDO.getOrganizationId()); + settlementCustomersParametersDTO.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId()); + settlementCustomersParametersDTO.setOrganizationName(settlementCustomersDO.getOrganizationName()); + settlementCustomersParametersDTO.setSettlementCustomersCode(settlementCustomersDO.getSettlementCustomersCode()); + settlementCustomersParametersDTO.setSettlementEntity(settlementCustomersDO.getSettlementEntity()); + settlementCustomersParametersDTO.setSettlementEntityId(settlementCustomersDO.getSettlementEntityId()); + BeanUtils.copyProperties(settlementCustomersParametersDTO, settlementCustomersParameters); + settlementCustomersParametersService.save(settlementCustomersParameters); + } + } + } + + return insert; } /** @@ -216,9 +256,89 @@ public class SettlementCustomersApplicationService { } //处理数据字典 handleDict(settlementCustomersDO); + + List settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigDTOList(); + if (CollectionUtil.isNotEmpty(settlementCustomersNcConfigDTOList)) { + settlementCustomersNcConfigService.remove(new LambdaQueryWrapper() + .eq(SettlementCustomersNcConfig::getSettlementCustomersId, settlementCustomersDO.getSettlementCustomersId())); + for (SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO : settlementCustomersNcConfigDTOList) { + SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig(); + settlementCustomersNcConfigDTO.setSettlementCustomersId(settlementCustomersDO.getSettlementCustomersId()); + settlementCustomersNcConfigDTO.setOrganizationId(settlementCustomersDO.getOrganizationId()); + settlementCustomersNcConfigDTO.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId()); + settlementCustomersNcConfigDTO.setOrganizationName(settlementCustomersDO.getOrganizationName()); + BeanUtils.copyProperties(settlementCustomersNcConfigDTO, settlementCustomersNcConfig); + settlementCustomersNcConfigService.save(settlementCustomersNcConfig); + } + } + List settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParametersDTOList(); + if (CollectionUtil.isNotEmpty(settlementCustomersParametersDTOList)) { + settlementCustomersParametersService.remove(new LambdaQueryWrapper() + .eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersDO.getSettlementCustomersId())); + for (SettlementCustomersParametersDTO settlementCustomersParametersDTO : settlementCustomersParametersDTOList) { + SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters(); + settlementCustomersParametersDTO.setSettlementCustomersId(settlementCustomersDO.getSettlementCustomersId()); + settlementCustomersParametersDTO.setOrganizationId(settlementCustomersDO.getOrganizationId()); + settlementCustomersParametersDTO.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId()); + settlementCustomersParametersDTO.setOrganizationName(settlementCustomersDO.getOrganizationName()); + settlementCustomersParametersDTO.setSettlementCustomersCode(settlementCustomersDO.getSettlementCustomersCode()); + settlementCustomersParametersDTO.setSettlementEntity(settlementCustomersDO.getSettlementEntity()); + settlementCustomersParametersDTO.setSettlementEntityId(settlementCustomersDO.getSettlementEntityId()); + BeanUtils.copyProperties(settlementCustomersParametersDTO, settlementCustomersParameters); + Long contractManageId1 = settlementCustomersParameters.getContractManageId(); + if (contractManageId1==null) { + ContractManageFeignDTO contractManageDTO = new ContractManageFeignDTO(); + contractManageDTO.setSettlementCustomersCode(settlementCustomersDO.getSettlementCustomersCode()); + contractManageDTO.setContractRentType("TEMP"); + contractManageDTO.setContractRentTypeName("临时合同"); + contractManageDTO.setOriginalContractNumber(generateHtCode()); + contractManageDTO.setContractName("临时合同"); + contractManageDTO.setSigningUnit(settlementCustomersDO.getOrganizationName()); + contractManageDTO.setCustomerTypeCode("1"); + contractManageDTO.setCommonContractFlag(2); + contractManageDTO.setSigningDate(new Date()); + contractManageDTO.setEffectiveDate(new Date()); + Calendar calendar = Calendar.getInstance(); + calendar.set(9999, Calendar.DECEMBER, 31, 0, 0, 0); + Date date = calendar.getTime(); + contractManageDTO.setExpirationDate(date); + contractManageDTO.setContractState(2); + contractManageDTO.setPaymentDate(new Date()); + contractManageDTO.setBillDays(10); + AjaxResult ajaxResult = systemServiceFeign.feignSave(contractManageDTO); + if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) { + ContractManageFeignDTO contractManageFeignDTO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), ContractManageFeignDTO.class); + Long contractManageId = contractManageFeignDTO.getContractManageId(); + String originalContractNumber = contractManageFeignDTO.getOriginalContractNumber(); + settlementCustomersParameters.setContractManageId(contractManageId); + settlementCustomersParameters.setContractNumber(originalContractNumber); + } else { + throw new ServiceException("创建临时合同失败"); + } + } + settlementCustomersParametersService.save(settlementCustomersParameters); + } + } return settlementCustomersDomainService.update(settlementCustomersDO); } + private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyMMdd"); + private static final Random RANDOM = new Random(); + + /** + * 生成编码:HT + 当天yyMMdd + 6位随机数字 + * 示例:HT260828123456 + * @return 编码字符串 + */ + public static String generateHtCode() { + // 当天yyMMdd + String dateStr = LocalDate.now().format(FORMATTER); + // 6位随机数 000000‑999999 + int randomNum = RANDOM.nextInt(1_000_000); + String randomStr = String.format("%06d", randomNum); + return "HT" + dateStr + randomStr; + } + /** * 批量删除结算对象 */ @@ -433,6 +553,7 @@ public class SettlementCustomersApplicationService { ? userShipperPo.getTopOrganizationId() : loginUser.getUserPo().getTopOrganizationId()); saveEntity.setCreateTime(new Date()); + saveEntity.setOrgCode(userShipperPo.getOrgCode()); return saveEntity; } diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersNcConfig/SettlementCustomersNcConfigApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersNcConfig/SettlementCustomersNcConfigApplicationService.java new file mode 100644 index 000000000..fa1d51765 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersNcConfig/SettlementCustomersNcConfigApplicationService.java @@ -0,0 +1,87 @@ +package com.mhd.bms.application.server.settlementCustomersNcConfig; + +import cn.hutool.core.util.ObjectUtil; +import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO; +import com.mhd.bms.domain.settlementCustomersNcConfig.service.SettlementCustomersNcConfigDomainService; +import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO; +import com.mhd.common.core.exception.ServiceException; +import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException; +import com.mhd.common.core.exception.digitalLogisticsException.UserError; +import com.mhd.common.core.utils.StringUtils; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.system.api.model.LoginUser; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * 结算对象NC配置ApplicationService + * + * @author gen + * @date 2024-06-17 + */ +@Service +@Slf4j +public class SettlementCustomersNcConfigApplicationService { + + @Autowired + private SettlementCustomersNcConfigDomainService settlementCustomersNcConfigDomainService; + + /** + * 分页查询结算对象NC配置列表 + */ + public List queryList(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) { + return settlementCustomersNcConfigDomainService.queryList(settlementCustomersNcConfigDO); + } + + /** + * 新增结算对象NC配置 + */ + public Boolean insert(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + settlementCustomersNcConfigDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + settlementCustomersNcConfigDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); + settlementCustomersNcConfigDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + return settlementCustomersNcConfigDomainService.insert(settlementCustomersNcConfigDO); + } + + /** + * 修改结算对象NC配置 + */ + public Boolean update(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + return settlementCustomersNcConfigDomainService.update(settlementCustomersNcConfigDO); + } + + /** + * 获取结算对象NC配置详细信息 + */ + public SettlementCustomersNcConfigPO getInfo(Long id) { + return settlementCustomersNcConfigDomainService.getInfo(id); + } + + /** + * 批量删除结算对象NC配置 + */ + public Boolean deleteByIds(SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO) { + if (!StringUtils.isNotEmpty(settlementCustomersNcConfigDTO.getIds())) { + throw new ServiceException("id不能为空"); + } + Set idSet = Stream.of(settlementCustomersNcConfigDTO.getIds().split(",")).collect(Collectors.toSet()); + Long[] ids = idSet.stream().map(Long::valueOf).toArray(Long[]::new); + return settlementCustomersNcConfigDomainService.delete(ids); + } +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersParameters/SettlementCustomersParametersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersParameters/SettlementCustomersParametersApplicationService.java new file mode 100644 index 000000000..47959ecc6 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersParameters/SettlementCustomersParametersApplicationService.java @@ -0,0 +1,87 @@ +package com.mhd.bms.application.server.settlementCustomersParameters; + +import cn.hutool.core.util.ObjectUtil; +import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters; +import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO; +import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO; +import com.mhd.bms.domain.settlementCustomersParameters.service.SettlementCustomersParametersDomainService; +import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO; +import com.mhd.common.core.exception.ServiceException; +import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException; +import com.mhd.common.core.exception.digitalLogisticsException.UserError; +import com.mhd.common.core.utils.StringUtils; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.system.api.model.LoginUser; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * 结算对象参数ApplicationService + * + * @author gen + * @date 2024-06-17 + */ +@Service +@Slf4j +public class SettlementCustomersParametersApplicationService { + + @Autowired + private SettlementCustomersParametersDomainService settlementCustomersParametersDomainService; + + /** + * 分页查询结算对象参数列表 + */ + public List queryList(SettlementCustomersParametersDO settlementCustomersParametersDO) { + return settlementCustomersParametersDomainService.queryList(settlementCustomersParametersDO); + } + + /** + * 新增结算对象参数 + */ + public Boolean insert(SettlementCustomersParametersDO settlementCustomersParametersDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + settlementCustomersParametersDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + settlementCustomersParametersDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); + settlementCustomersParametersDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + return settlementCustomersParametersDomainService.insert(settlementCustomersParametersDO); + } + + /** + * 修改结算对象参数 + */ + public Boolean update(SettlementCustomersParametersDO settlementCustomersParametersDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + return settlementCustomersParametersDomainService.update(settlementCustomersParametersDO); + } + + /** + * 获取结算对象参数详细信息 + */ + public SettlementCustomersParametersPO getInfo(Long id) { + return settlementCustomersParametersDomainService.getInfo(id); + } + + /** + * 批量删除结算对象参数 + */ + public Boolean deleteByIds(SettlementCustomersParametersDTO settlementCustomersParametersDTO) { + if (!StringUtils.isNotEmpty(settlementCustomersParametersDTO.getIds())) { + throw new ServiceException("id不能为空"); + } + Set idSet = Stream.of(settlementCustomersParametersDTO.getIds().split(",")).collect(Collectors.toSet()); + Long[] ids = idSet.stream().map(Long::valueOf).toArray(Long[]::new); + return settlementCustomersParametersDomainService.delete(ids); + } +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java index cd49f93d7..52d80fbcf 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java @@ -94,6 +94,7 @@ public class SettlementCustomers extends BaseVOEntity{ @ApiModelProperty("默认结算币种") private String settlementCurrency; - + @ApiModelProperty(name = "组织代码") + private String orgCode; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/persistence/SettlementCustomersImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/persistence/SettlementCustomersImpl.java index 9b176f853..4cecec153 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/persistence/SettlementCustomersImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/persistence/SettlementCustomersImpl.java @@ -1,11 +1,16 @@ package com.mhd.bms.domain.settlementCustomers.repository.persistence; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers; import com.mhd.bms.domain.settlementCustomers.repository.facade.ISettlementCustomersService; import com.mhd.bms.domain.settlementCustomers.repository.mapper.SettlementCustomersMapper; import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO; import com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO; +import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.mapper.SettlementCustomersNcConfigMapper; +import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters; +import com.mhd.bms.domain.settlementCustomersParameters.repository.mapper.SettlementCustomersParametersMapper; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -23,6 +28,10 @@ import java.util.List; public class SettlementCustomersImpl extends ServiceImpl implements ISettlementCustomersService{ @Autowired private SettlementCustomersMapper settlementCustomersMapper; + @Autowired + private SettlementCustomersParametersMapper settlementCustomersParametersMapper; + @Autowired + private SettlementCustomersNcConfigMapper settlementCustomersNcConfigMapper; /** * 查询结算对象列表 @@ -30,7 +39,19 @@ public class SettlementCustomersImpl extends ServiceImpl queryList(SettlementCustomersDO settlementCustomersDO) { - return settlementCustomersMapper.queryList(settlementCustomersDO); + List settlementCustomersPOS = settlementCustomersMapper.queryList(settlementCustomersDO); + if (settlementCustomersPOS != null && settlementCustomersPOS.size() > 0) { + for (SettlementCustomersPO settlementCustomersPO : settlementCustomersPOS) { + Long settlementCustomersId = settlementCustomersPO.getSettlementCustomersId(); + List settlementCustomersParameters = settlementCustomersParametersMapper.selectList(new LambdaQueryWrapper() + .eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersId)); + List settlementCustomersNcConfigs = settlementCustomersNcConfigMapper.selectList(new LambdaQueryWrapper() + .eq(SettlementCustomersNcConfig::getSettlementCustomersId, settlementCustomersId)); + settlementCustomersPO.setSettlementCustomersParameters(settlementCustomersParameters); + settlementCustomersPO.setSettlementCustomersNcConfigs(settlementCustomersNcConfigs); + } + } + return settlementCustomersPOS; } @Override @@ -88,4 +109,4 @@ public class SettlementCustomersImpl extends ServiceImpl settlementCustomersNcConfigs; + List settlementCustomersParameters; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java index 413b81ed6..6c90e5c4e 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java @@ -1,5 +1,7 @@ package com.mhd.bms.domain.settlementCustomers.repository.todo; +import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO; +import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO; import com.mhd.common.core.annotation.Excel; import lombok.Data; import java.util.Date; @@ -131,5 +133,12 @@ public class SettlementCustomersDO extends BaseVOEntity{ @ApiModelProperty("单据类型编码") private String documentTypeCode; + @ApiModelProperty(name = "组织代码") + private String orgCode; + @ApiModelProperty("结算对象参数") + private List settlementCustomersParametersDTOList; + + @ApiModelProperty("结算对象nc配置") + private List settlementCustomersNcConfigDTOList; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/entity/SettlementCustomersNcConfig.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/entity/SettlementCustomersNcConfig.java new file mode 100644 index 000000000..e1c23835d --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/entity/SettlementCustomersNcConfig.java @@ -0,0 +1,80 @@ +package com.mhd.bms.domain.settlementCustomersNcConfig.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * 结算对象对象 settlement_customers + * + * @author gen + * @date 2024-06-17 + */ + +@Data +public class SettlementCustomersNcConfig extends BaseVOEntity{ + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("结算对象id") + private Long settlementCustomersId; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("nc编码") + @Excel(name = "nc编码") + private String ncCode; + + @ApiModelProperty("结算方式") + @Excel(name = "结算方式") + private String ncSettleMethod; + + @ApiModelProperty("仓库温层类型") + @Excel(name = "仓库温层类型") + private String warehouseTempLayerType; + + @ApiModelProperty("散租计费配置") + @Excel(name = "散租计费配置") + private String scatterRentBillingConfig; + + @ApiModelProperty("结算方式") + @Excel(name = "结算方式") + private String ncSettleMethodName; + + @ApiModelProperty("仓库温层类型") + @Excel(name = "仓库温层类型") + private String warehouseTempLayerTypeName; + + @ApiModelProperty("散租计费配置") + @Excel(name = "散租计费配置") + private String scatterRentBillingConfigName; + + @ApiModelProperty("欠租期上限 (月)") + @Excel(name = "欠租期上限 (月)") + private Integer oweRentMaxMonth; + + @ApiModelProperty("账期 (天)") + @Excel(name = "账期 (天)") + private Integer accountPeriodDay; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/facade/ISettlementCustomersNcConfigService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/facade/ISettlementCustomersNcConfigService.java new file mode 100644 index 000000000..d1b92331a --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/facade/ISettlementCustomersNcConfigService.java @@ -0,0 +1,42 @@ +package com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO; + +import java.util.List; + +/** + * 结算对象NC配置Service接口 + * + * @author gen + * @date 2024-06-17 + */ +public interface ISettlementCustomersNcConfigService extends IService { + + /** + * 分页查询结算对象NC配置列表 + */ + public List queryList(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO); + + /** + * 新增结算对象NC配置 + */ + public Boolean insert(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO); + + /** + * 修改结算对象NC配置 + */ + public Boolean update(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO); + + /** + * 批量删除结算对象NC配置 + */ + public Boolean delete(Long[] ids); + + /** + * 查询结算对象NC配置 + */ + public SettlementCustomersNcConfigPO getInfo(Long id); +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/mapper/SettlementCustomersNcConfigMapper.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/mapper/SettlementCustomersNcConfigMapper.java new file mode 100644 index 000000000..8631ffbea --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/mapper/SettlementCustomersNcConfigMapper.java @@ -0,0 +1,23 @@ +package com.mhd.bms.domain.settlementCustomersNcConfig.repository.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO; +import org.apache.ibatis.annotations.Param; + +/** + * 结算对象NC配置Mapper接口 + * + * @author gen + * @date 2024-06-17 + */ +public interface SettlementCustomersNcConfigMapper extends BaseMapper { + + /** + * 查询结算对象NC配置列表 + */ + public List queryList(@Param("settlementCustomersNcConfigDO") SettlementCustomersNcConfigDO settlementCustomersNcConfigDO); + +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/persistence/SettlementCustomersNcConfigImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/persistence/SettlementCustomersNcConfigImpl.java new file mode 100644 index 000000000..d73c6f6dd --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/persistence/SettlementCustomersNcConfigImpl.java @@ -0,0 +1,81 @@ +package com.mhd.bms.domain.settlementCustomersNcConfig.repository.persistence; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.mapper.SettlementCustomersNcConfigMapper; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * 结算对象NC配置Service业务层处理 + * + * @author gen + * @date 2024-06-17 + */ +@Service +public class SettlementCustomersNcConfigImpl extends ServiceImpl implements ISettlementCustomersNcConfigService { + + @Autowired + private SettlementCustomersNcConfigMapper settlementCustomersNcConfigMapper; + + /** + * 查询结算对象NC配置列表 + */ + @Override + public List queryList(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) { + return settlementCustomersNcConfigMapper.queryList(settlementCustomersNcConfigDO); + } + + /** + * 新增结算对象NC配置 + */ + @Override + public Boolean insert(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) { + SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig(); + BeanUtils.copyProperties(settlementCustomersNcConfigDO, settlementCustomersNcConfig); + return this.save(settlementCustomersNcConfig); + } + + /** + * 修改结算对象NC配置 + */ + @Override + public Boolean update(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) { + SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig(); + BeanUtils.copyProperties(settlementCustomersNcConfigDO, settlementCustomersNcConfig); + return this.updateById(settlementCustomersNcConfig); + } + + /** + * 批量删除结算对象NC配置 + */ + @Override + public Boolean delete(Long[] ids) { + List list = new ArrayList<>(); + for (Long id : ids) { + SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig(); + settlementCustomersNcConfig.setId(id); + settlementCustomersNcConfig.setDelFlag(2); + list.add(settlementCustomersNcConfig); + } + return this.updateBatchById(list); + } + + /** + * 查询结算对象NC配置 + */ + @Override + public SettlementCustomersNcConfigPO getInfo(Long id) { + SettlementCustomersNcConfig settlementCustomersNcConfig = this.getById(id); + SettlementCustomersNcConfigPO settlementCustomersNcConfigPO = new SettlementCustomersNcConfigPO(); + BeanUtils.copyProperties(settlementCustomersNcConfig, settlementCustomersNcConfigPO); + return settlementCustomersNcConfigPO; + } +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/po/SettlementCustomersNcConfigPO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/po/SettlementCustomersNcConfigPO.java new file mode 100644 index 000000000..ea98b9086 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/po/SettlementCustomersNcConfigPO.java @@ -0,0 +1,77 @@ +package com.mhd.bms.domain.settlementCustomersNcConfig.repository.po; + +import com.mhd.common.core.annotation.Excel; +import lombok.Data; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; + +/** + * 结算对象NC配置对象 settlement_customers_nc_config + * + * @author gen + * @date 2024-06-17 + */ +@Data +@ApiModel(value = "结算对象NC配置对象", description = "结算对象NC配置响应对象") +public class SettlementCustomersNcConfigPO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("结算对象id") + private Long settlementCustomersId; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("nc编码") + @Excel(name = "nc编码") + private String ncCode; + + @ApiModelProperty("结算方式") + @Excel(name = "结算方式") + private String ncSettleMethod; + + @ApiModelProperty("仓库温层类型") + @Excel(name = "仓库温层类型") + private String warehouseTempLayerType; + + @ApiModelProperty("散租计费配置") + @Excel(name = "散租计费配置") + private String scatterRentBillingConfig; + + @ApiModelProperty("结算方式") + @Excel(name = "结算方式") + private String ncSettleMethodName; + + @ApiModelProperty("仓库温层类型") + @Excel(name = "仓库温层类型") + private String warehouseTempLayerTypeName; + + @ApiModelProperty("散租计费配置") + @Excel(name = "散租计费配置") + private String scatterRentBillingConfigName; + + @ApiModelProperty("欠租期上限 (月)") + @Excel(name = "欠租期上限 (月)") + private Integer oweRentMaxMonth; + + @ApiModelProperty("账期 (天)") + @Excel(name = "账期 (天)") + private Integer accountPeriodDay; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/todo/SettlementCustomersNcConfigDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/todo/SettlementCustomersNcConfigDO.java new file mode 100644 index 000000000..466947395 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/repository/todo/SettlementCustomersNcConfigDO.java @@ -0,0 +1,81 @@ +package com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo; + +import com.mhd.common.core.annotation.Excel; +import lombok.Data; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; + +/** + * 结算对象NC配置对象 settlement_customers_nc_config + * + * @author gen + * @date 2024-06-17 + */ +@Data +public class SettlementCustomersNcConfigDO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("结算对象id") + private Long settlementCustomersId; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("nc编码") + @Excel(name = "nc编码") + private String ncCode; + + @ApiModelProperty("结算方式") + @Excel(name = "结算方式") + private String ncSettleMethod; + + @ApiModelProperty("仓库温层类型") + @Excel(name = "仓库温层类型") + private String warehouseTempLayerType; + + @ApiModelProperty("散租计费配置") + @Excel(name = "散租计费配置") + private String scatterRentBillingConfig; + + @ApiModelProperty("结算方式") + @Excel(name = "结算方式") + private String ncSettleMethodName; + + @ApiModelProperty("仓库温层类型") + @Excel(name = "仓库温层类型") + private String warehouseTempLayerTypeName; + + @ApiModelProperty("散租计费配置") + @Excel(name = "散租计费配置") + private String scatterRentBillingConfigName; + + @ApiModelProperty("欠租期上限 (月)") + @Excel(name = "欠租期上限 (月)") + private Integer oweRentMaxMonth; + + @ApiModelProperty("账期 (天)") + @Excel(name = "账期 (天)") + private Integer accountPeriodDay; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty(name = "创建时间查询条件开始日期") + private String createTimeStart; + + @ApiModelProperty(name = "创建时间查询条件结束日期") + private String createTimeEnd; +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/service/SettlementCustomersNcConfigDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/service/SettlementCustomersNcConfigDomainService.java new file mode 100644 index 000000000..257ccec6b --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersNcConfig/service/SettlementCustomersNcConfigDomainService.java @@ -0,0 +1,59 @@ +package com.mhd.bms.domain.settlementCustomersNcConfig.service; + +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 结算对象NC配置领域服务 + * + * @author gen + * @date 2024-06-17 + */ +@Service +@Slf4j +public class SettlementCustomersNcConfigDomainService { + + @Autowired + private ISettlementCustomersNcConfigService settlementCustomersNcConfigService; + + /** + * 分页查询结算对象NC配置列表 + */ + public List queryList(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) { + return settlementCustomersNcConfigService.queryList(settlementCustomersNcConfigDO); + } + + /** + * 新增结算对象NC配置 + */ + public Boolean insert(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) { + return settlementCustomersNcConfigService.insert(settlementCustomersNcConfigDO); + } + + /** + * 修改结算对象NC配置 + */ + public Boolean update(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) { + return settlementCustomersNcConfigService.update(settlementCustomersNcConfigDO); + } + + /** + * 批量删除结算对象NC配置 + */ + public Boolean delete(Long[] ids) { + return settlementCustomersNcConfigService.delete(ids); + } + + /** + * 获取结算对象NC配置详细信息 + */ + public SettlementCustomersNcConfigPO getInfo(Long id) { + return settlementCustomersNcConfigService.getInfo(id); + } +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/entity/SettlementCustomersParameters.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/entity/SettlementCustomersParameters.java new file mode 100644 index 000000000..4fe19b3a6 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/entity/SettlementCustomersParameters.java @@ -0,0 +1,69 @@ +package com.mhd.bms.domain.settlementCustomersParameters.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * 结算对象对象 settlement_customers + * + * @author gen + * @date 2024-06-17 + */ + +@Data +public class SettlementCustomersParameters extends BaseVOEntity{ + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("结算对象id") + private Long settlementCustomersId; + + @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 settlementCustomersCode; + + @ApiModelProperty("结算主体id") + @Excel(name = "结算主体id") + private Long settlementEntityId; + + @ApiModelProperty("结算主体") + @Excel(name = "结算主体") + private String settlementEntity; + + @ApiModelProperty("合同编号") + @Excel(name = "合同编号") + private String contractNumber; + + @ApiModelProperty("合同管理id") + private Long contractManageId; + + @ApiModelProperty("参数内容") + @Excel(name = "参数内容") + private String content; + + @ApiModelProperty("参数名称") + @Excel(name = "参数名称") + private String parametersName; + + +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/facade/ISettlementCustomersParametersService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/facade/ISettlementCustomersParametersService.java new file mode 100644 index 000000000..97a8a3840 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/facade/ISettlementCustomersParametersService.java @@ -0,0 +1,42 @@ +package com.mhd.bms.domain.settlementCustomersParameters.repository.facade; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters; +import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO; +import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO; + +import java.util.List; + +/** + * 结算对象参数Service接口 + * + * @author gen + * @date 2024-06-17 + */ +public interface ISettlementCustomersParametersService extends IService { + + /** + * 分页查询结算对象参数列表 + */ + public List queryList(SettlementCustomersParametersDO settlementCustomersParametersDO); + + /** + * 新增结算对象参数 + */ + public Boolean insert(SettlementCustomersParametersDO settlementCustomersParametersDO); + + /** + * 修改结算对象参数 + */ + public Boolean update(SettlementCustomersParametersDO settlementCustomersParametersDO); + + /** + * 批量删除结算对象参数 + */ + public Boolean delete(Long[] ids); + + /** + * 查询结算对象参数 + */ + public SettlementCustomersParametersPO getInfo(Long id); +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/mapper/SettlementCustomersParametersMapper.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/mapper/SettlementCustomersParametersMapper.java new file mode 100644 index 000000000..620eb4784 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/mapper/SettlementCustomersParametersMapper.java @@ -0,0 +1,23 @@ +package com.mhd.bms.domain.settlementCustomersParameters.repository.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters; +import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO; +import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO; +import org.apache.ibatis.annotations.Param; + +/** + * 结算对象参数Mapper接口 + * + * @author gen + * @date 2024-06-17 + */ +public interface SettlementCustomersParametersMapper extends BaseMapper { + + /** + * 查询结算对象参数列表 + */ + public List queryList(@Param("settlementCustomersParametersDO") SettlementCustomersParametersDO settlementCustomersParametersDO); + +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/persistence/SettlementCustomersParametersImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/persistence/SettlementCustomersParametersImpl.java new file mode 100644 index 000000000..51f397a5c --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/persistence/SettlementCustomersParametersImpl.java @@ -0,0 +1,81 @@ +package com.mhd.bms.domain.settlementCustomersParameters.repository.persistence; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters; +import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService; +import com.mhd.bms.domain.settlementCustomersParameters.repository.mapper.SettlementCustomersParametersMapper; +import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO; +import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * 结算对象参数Service业务层处理 + * + * @author gen + * @date 2024-06-17 + */ +@Service +public class SettlementCustomersParametersImpl extends ServiceImpl implements ISettlementCustomersParametersService { + + @Autowired + private SettlementCustomersParametersMapper settlementCustomersParametersMapper; + + /** + * 查询结算对象参数列表 + */ + @Override + public List queryList(SettlementCustomersParametersDO settlementCustomersParametersDO) { + return settlementCustomersParametersMapper.queryList(settlementCustomersParametersDO); + } + + /** + * 新增结算对象参数 + */ + @Override + public Boolean insert(SettlementCustomersParametersDO settlementCustomersParametersDO) { + SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters(); + BeanUtils.copyProperties(settlementCustomersParametersDO, settlementCustomersParameters); + return this.save(settlementCustomersParameters); + } + + /** + * 修改结算对象参数 + */ + @Override + public Boolean update(SettlementCustomersParametersDO settlementCustomersParametersDO) { + SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters(); + BeanUtils.copyProperties(settlementCustomersParametersDO, settlementCustomersParameters); + return this.updateById(settlementCustomersParameters); + } + + /** + * 批量删除结算对象参数 + */ + @Override + public Boolean delete(Long[] ids) { + List list = new ArrayList<>(); + for (Long id : ids) { + SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters(); + settlementCustomersParameters.setId(id); + settlementCustomersParameters.setDelFlag(2); + list.add(settlementCustomersParameters); + } + return this.updateBatchById(list); + } + + /** + * 查询结算对象参数 + */ + @Override + public SettlementCustomersParametersPO getInfo(Long id) { + SettlementCustomersParameters settlementCustomersParameters = this.getById(id); + SettlementCustomersParametersPO settlementCustomersParametersPO = new SettlementCustomersParametersPO(); + BeanUtils.copyProperties(settlementCustomersParameters, settlementCustomersParametersPO); + return settlementCustomersParametersPO; + } +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/po/SettlementCustomersParametersPO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/po/SettlementCustomersParametersPO.java new file mode 100644 index 000000000..0dccab69e --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/po/SettlementCustomersParametersPO.java @@ -0,0 +1,64 @@ +package com.mhd.bms.domain.settlementCustomersParameters.repository.po; + +import com.mhd.common.core.annotation.Excel; +import lombok.Data; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; + +/** + * 结算对象参数对象 settlement_customers_parameters + * + * @author gen + * @date 2024-06-17 + */ +@Data +@ApiModel(value = "结算对象参数对象", description = "结算对象参数响应对象") +public class SettlementCustomersParametersPO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("结算对象id") + private Long settlementCustomersId; + + @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 settlementCustomersCode; + + @ApiModelProperty("结算主体id") + @Excel(name = "结算主体id") + private Long settlementEntityId; + + @ApiModelProperty("结算主体") + @Excel(name = "结算主体") + private String settlementEntity; + + @ApiModelProperty("合同编号") + @Excel(name = "合同编号") + private String contractNumber; + + @ApiModelProperty("合同管理id") + private Long contractManageId; + + @ApiModelProperty("参数内容") + @Excel(name = "参数内容") + private String content; + + @ApiModelProperty("参数名称") + @Excel(name = "参数名称") + private String parametersName; +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/todo/SettlementCustomersParametersDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/todo/SettlementCustomersParametersDO.java new file mode 100644 index 000000000..9cce537a9 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/todo/SettlementCustomersParametersDO.java @@ -0,0 +1,68 @@ +package com.mhd.bms.domain.settlementCustomersParameters.repository.todo; + +import com.mhd.common.core.annotation.Excel; +import lombok.Data; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; + +/** + * 结算对象参数对象 settlement_customers_parameters + * + * @author gen + * @date 2024-06-17 + */ +@Data +public class SettlementCustomersParametersDO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("结算对象id") + private Long settlementCustomersId; + + @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 settlementCustomersCode; + + @ApiModelProperty("结算主体id") + @Excel(name = "结算主体id") + private Long settlementEntityId; + + @ApiModelProperty("结算主体") + @Excel(name = "结算主体") + private String settlementEntity; + + @ApiModelProperty("合同编号") + @Excel(name = "合同编号") + private String contractNumber; + + @ApiModelProperty("合同管理id") + private Long contractManageId; + + @ApiModelProperty("参数内容") + @Excel(name = "参数内容") + private String content; + + @ApiModelProperty("参数名称") + @Excel(name = "参数名称") + private String parametersName; + + @ApiModelProperty(name = "创建时间查询条件开始日期") + private String createTimeStart; + + @ApiModelProperty(name = "创建时间查询条件结束日期") + private String createTimeEnd; +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/service/SettlementCustomersParametersDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/service/SettlementCustomersParametersDomainService.java new file mode 100644 index 000000000..683bde910 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/service/SettlementCustomersParametersDomainService.java @@ -0,0 +1,59 @@ +package com.mhd.bms.domain.settlementCustomersParameters.service; + +import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService; +import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO; +import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 结算对象参数领域服务 + * + * @author gen + * @date 2024-06-17 + */ +@Service +@Slf4j +public class SettlementCustomersParametersDomainService { + + @Autowired + private ISettlementCustomersParametersService settlementCustomersParametersService; + + /** + * 分页查询结算对象参数列表 + */ + public List queryList(SettlementCustomersParametersDO settlementCustomersParametersDO) { + return settlementCustomersParametersService.queryList(settlementCustomersParametersDO); + } + + /** + * 新增结算对象参数 + */ + public Boolean insert(SettlementCustomersParametersDO settlementCustomersParametersDO) { + return settlementCustomersParametersService.insert(settlementCustomersParametersDO); + } + + /** + * 修改结算对象参数 + */ + public Boolean update(SettlementCustomersParametersDO settlementCustomersParametersDO) { + return settlementCustomersParametersService.update(settlementCustomersParametersDO); + } + + /** + * 批量删除结算对象参数 + */ + public Boolean delete(Long[] ids) { + return settlementCustomersParametersService.delete(ids); + } + + /** + * 获取结算对象参数详细信息 + */ + public SettlementCustomersParametersPO getInfo(Long id) { + return settlementCustomersParametersService.getInfo(id); + } +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/settlementCustomersNcConfig/SettlementCustomersNcConfigAssembler.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/settlementCustomersNcConfig/SettlementCustomersNcConfigAssembler.java new file mode 100644 index 000000000..15656190e --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/settlementCustomersNcConfig/SettlementCustomersNcConfigAssembler.java @@ -0,0 +1,71 @@ +package com.mhd.bms.interfaces.assembler.settlementCustomersNcConfig; + +import cn.hutool.core.util.ObjectUtil; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO; +import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO; +import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException; +import com.mhd.common.core.exception.digitalLogisticsException.UserError; +import com.mhd.common.core.utils.bean.BeanUtils; +import com.mhd.common.core.utils.IgnoreNullUtil; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.system.api.model.LoginUser; +import org.springframework.stereotype.Component; + +import java.util.Date; + +/** + * 结算对象NC配置Assembler + * + * @author gen + * @date 2024-06-17 + */ +@Component +public class SettlementCustomersNcConfigAssembler { + + /** + * 转换实体 + */ + public SettlementCustomersNcConfigDO toDO(SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO) { + SettlementCustomersNcConfigDO settlementCustomersNcConfigDO = new SettlementCustomersNcConfigDO(); + // 拷贝 + BeanUtils.copyProperties(settlementCustomersNcConfigDTO, settlementCustomersNcConfigDO, IgnoreNullUtil.getNullPropertyNames(settlementCustomersNcConfigDTO)); + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + // 获取用户姓名,优先使用userPo中的userName,如果为空则使用realname,最后使用username + String userName = null; + if (loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null) { + userName = loginUser.getUserPo().getUserName(); + } else if (loginUser.getRealname() != null) { + userName = loginUser.getRealname(); + } else { + userName = loginUser.getUsername(); + } + // 获取登录人id + Long userId = loginUser.getUserid(); + if (settlementCustomersNcConfigDTO.getId() != null) { + if (userId != null) { + settlementCustomersNcConfigDO.setUpdateBy(userId); + } else { + settlementCustomersNcConfigDO.setUpdateBy(0L); + } + settlementCustomersNcConfigDO.setUpdateByName(userName); + settlementCustomersNcConfigDO.setUpdateTime(new Date()); + } else { + if (userId != null) { + settlementCustomersNcConfigDO.setCreateBy(userId); + settlementCustomersNcConfigDO.setUpdateBy(userId); + } else { + settlementCustomersNcConfigDO.setCreateBy(0L); + settlementCustomersNcConfigDO.setUpdateBy(0L); + } + settlementCustomersNcConfigDO.setCreateByName(userName); + settlementCustomersNcConfigDO.setUpdateByName(userName); + settlementCustomersNcConfigDO.setCreateTime(new Date()); + settlementCustomersNcConfigDO.setUpdateTime(new Date()); + settlementCustomersNcConfigDO.setDelFlag(1); + } + return settlementCustomersNcConfigDO; + } +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/settlementCustomersParameters/SettlementCustomersParametersAssembler.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/settlementCustomersParameters/SettlementCustomersParametersAssembler.java new file mode 100644 index 000000000..3f3f6602f --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/assembler/settlementCustomersParameters/SettlementCustomersParametersAssembler.java @@ -0,0 +1,71 @@ +package com.mhd.bms.interfaces.assembler.settlementCustomersParameters; + +import cn.hutool.core.util.ObjectUtil; +import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO; +import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO; +import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException; +import com.mhd.common.core.exception.digitalLogisticsException.UserError; +import com.mhd.common.core.utils.bean.BeanUtils; +import com.mhd.common.core.utils.IgnoreNullUtil; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.system.api.model.LoginUser; +import org.springframework.stereotype.Component; + +import java.util.Date; + +/** + * 结算对象参数Assembler + * + * @author gen + * @date 2024-06-17 + */ +@Component +public class SettlementCustomersParametersAssembler { + + /** + * 转换实体 + */ + public SettlementCustomersParametersDO toDO(SettlementCustomersParametersDTO settlementCustomersParametersDTO) { + SettlementCustomersParametersDO settlementCustomersParametersDO = new SettlementCustomersParametersDO(); + // 拷贝 + BeanUtils.copyProperties(settlementCustomersParametersDTO, settlementCustomersParametersDO, IgnoreNullUtil.getNullPropertyNames(settlementCustomersParametersDTO)); + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + // 获取用户姓名,优先使用userPo中的userName,如果为空则使用realname,最后使用username + String userName = null; + if (loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null) { + userName = loginUser.getUserPo().getUserName(); + } else if (loginUser.getRealname() != null) { + userName = loginUser.getRealname(); + } else { + userName = loginUser.getUsername(); + } + // 获取登录人id + Long userId = loginUser.getUserid(); + if (settlementCustomersParametersDTO.getId() != null) { + if (userId != null) { + settlementCustomersParametersDO.setUpdateBy(userId); + } else { + settlementCustomersParametersDO.setUpdateBy(0L); + } + settlementCustomersParametersDO.setUpdateByName(userName); + settlementCustomersParametersDO.setUpdateTime(new Date()); + } else { + if (userId != null) { + settlementCustomersParametersDO.setCreateBy(userId); + settlementCustomersParametersDO.setUpdateBy(userId); + } else { + settlementCustomersParametersDO.setCreateBy(0L); + settlementCustomersParametersDO.setUpdateBy(0L); + } + settlementCustomersParametersDO.setCreateByName(userName); + settlementCustomersParametersDO.setUpdateByName(userName); + settlementCustomersParametersDO.setCreateTime(new Date()); + settlementCustomersParametersDO.setUpdateTime(new Date()); + settlementCustomersParametersDO.setDelFlag(1); + } + return settlementCustomersParametersDO; + } +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java index 71bf8914f..ec4c2a180 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java @@ -1,5 +1,8 @@ package com.mhd.bms.interfaces.dto.settlementCustomers; +import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig; +import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO; +import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO; import com.mhd.common.core.annotation.Excel; import lombok.Data; import java.util.Date; @@ -130,4 +133,11 @@ public class SettlementCustomersDTO extends BaseVOEntity{ @ApiModelProperty("单据类型编码") private String documentTypeCode; + @ApiModelProperty(name = "组织代码") + private String orgCode; + + @ApiModelProperty("结算对象参数") + private List settlementCustomersParametersDTOList; + @ApiModelProperty("结算对象nc配置") + private List settlementCustomersNcConfigDTOList; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomersNcConfig/SettlementCustomersNcConfigDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomersNcConfig/SettlementCustomersNcConfigDTO.java new file mode 100644 index 000000000..76fc83c55 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomersNcConfig/SettlementCustomersNcConfigDTO.java @@ -0,0 +1,78 @@ +package com.mhd.bms.interfaces.dto.settlementCustomersNcConfig; + +import com.mhd.common.core.annotation.Excel; +import lombok.Data; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; + +/** + * 结算对象NC配置对象 settlement_customers_nc_config + * + * @author gen + * @date 2024-06-17 + */ +@Data +public class SettlementCustomersNcConfigDTO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("结算对象id") + private Long settlementCustomersId; + + @ApiModelProperty("一级组织表ID") + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @ApiModelProperty("组织表ID") + @Excel(name = "组织表ID") + private Long organizationId; + + @ApiModelProperty("组织名称") + @Excel(name = "组织名称") + private String organizationName; + + @ApiModelProperty("nc编码") + @Excel(name = "nc编码") + private String ncCode; + + @ApiModelProperty("结算方式") + @Excel(name = "结算方式") + private String ncSettleMethod; + + @ApiModelProperty("仓库温层类型") + @Excel(name = "仓库温层类型") + private String warehouseTempLayerType; + + @ApiModelProperty("散租计费配置") + @Excel(name = "散租计费配置") + private String scatterRentBillingConfig; + + @ApiModelProperty("结算方式") + @Excel(name = "结算方式") + private String ncSettleMethodName; + + @ApiModelProperty("仓库温层类型") + @Excel(name = "仓库温层类型") + private String warehouseTempLayerTypeName; + + @ApiModelProperty("散租计费配置") + @Excel(name = "散租计费配置") + private String scatterRentBillingConfigName; + + @ApiModelProperty("欠租期上限 (月)") + @Excel(name = "欠租期上限 (月)") + private Integer oweRentMaxMonth; + + @ApiModelProperty("账期 (天)") + @Excel(name = "账期 (天)") + private Integer accountPeriodDay; + + @ApiModelProperty("备注") + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("ids(批量删除用)") + private String ids; +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomersParameters/SettlementCustomersParametersDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomersParameters/SettlementCustomersParametersDTO.java new file mode 100644 index 000000000..fdfa67981 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomersParameters/SettlementCustomersParametersDTO.java @@ -0,0 +1,65 @@ +package com.mhd.bms.interfaces.dto.settlementCustomersParameters; + +import com.mhd.common.core.annotation.Excel; +import lombok.Data; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; + +/** + * 结算对象参数对象 settlement_customers_parameters + * + * @author gen + * @date 2024-06-17 + */ +@Data +public class SettlementCustomersParametersDTO extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("结算对象id") + private Long settlementCustomersId; + + @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 settlementCustomersCode; + + @ApiModelProperty("结算主体id") + @Excel(name = "结算主体id") + private Long settlementEntityId; + + @ApiModelProperty("结算主体") + @Excel(name = "结算主体") + private String settlementEntity; + + @ApiModelProperty("合同编号") + @Excel(name = "合同编号") + private String contractNumber; + + @ApiModelProperty("合同管理id") + private Long contractManageId; + + @ApiModelProperty("参数内容") + @Excel(name = "参数内容") + private String content; + + @ApiModelProperty("参数名称") + @Excel(name = "参数名称") + private String parametersName; + + @ApiModelProperty("ids(批量删除用)") + private String ids; +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersNcConfigApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersNcConfigApi.java new file mode 100644 index 000000000..b3b7f78af --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersNcConfigApi.java @@ -0,0 +1,91 @@ +package com.mhd.bms.interfaces.facadeApi; + +import java.util.List; + +import com.mhd.bms.application.server.settlementCustomersNcConfig.SettlementCustomersNcConfigApplicationService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO; +import com.mhd.bms.interfaces.assembler.settlementCustomersNcConfig.SettlementCustomersNcConfigAssembler; +import javax.annotation.Resource; +import com.mhd.common.core.web.controller.BaseController; +import com.mhd.common.core.web.domain.AjaxResult; +import com.mhd.common.core.web.page.TableDataInfo; + +/** + * 结算对象NC配置Api + * + * @author gen + * @date 2024-06-17 + */ +@Api(tags = "结算对象NC配置") +@RestController +@RequestMapping("/settlementCustomersNcConfigApi") +public class SettlementCustomersNcConfigApi extends BaseController { + + @Autowired + private SettlementCustomersNcConfigApplicationService settlementCustomersNcConfigApplicationService; + + @Resource + private SettlementCustomersNcConfigAssembler settlementCustomersNcConfigAssembler; + + /** + * 分页查询结算对象NC配置列表 + */ + @ApiOperation("查询结算对象NC配置列表") + @GetMapping("/list") + public TableDataInfo list(SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO) { + SettlementCustomersNcConfigDO settlementCustomersNcConfigDO = new SettlementCustomersNcConfigDO(); + BeanUtils.copyProperties(settlementCustomersNcConfigDTO, settlementCustomersNcConfigDO); + startPage(); + List list = settlementCustomersNcConfigApplicationService.queryList(settlementCustomersNcConfigDO); + return getDataTable(list); + } + + /** + * 保存结算对象NC配置 + */ + @ApiOperation("保存结算对象NC配置") + @PostMapping("/save") + public AjaxResult save(@RequestBody SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO) { + try { + // 转换实体 + SettlementCustomersNcConfigDO settlementCustomersNcConfigDO = settlementCustomersNcConfigAssembler.toDO(settlementCustomersNcConfigDTO); + if (settlementCustomersNcConfigDTO.getId() != null) { + return toAjax(settlementCustomersNcConfigApplicationService.update(settlementCustomersNcConfigDO)); + } else { + return toAjax(settlementCustomersNcConfigApplicationService.insert(settlementCustomersNcConfigDO)); + } + } catch (Exception e) { + return AjaxResult.error("操作失败:" + e.getMessage()); + } + } + + /** + * 批量删除结算对象NC配置 + */ + @ApiOperation("批量删除结算对象NC配置") + @PostMapping("/deleteByIds") + public AjaxResult deleteByIds(@RequestBody SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO) { + try { + settlementCustomersNcConfigApplicationService.deleteByIds(settlementCustomersNcConfigDTO); + return AjaxResult.success("操作成功"); + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 获取结算对象NC配置详细信息 + */ + @ApiOperation("获取结算对象NC配置") + @GetMapping(value = "/getInfoById") + public AjaxResult getInfoById(SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO) { + return AjaxResult.success(settlementCustomersNcConfigApplicationService.getInfo(settlementCustomersNcConfigDTO.getId())); + } +} diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersParametersApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersParametersApi.java new file mode 100644 index 000000000..8e0a67ca9 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersParametersApi.java @@ -0,0 +1,92 @@ +package com.mhd.bms.interfaces.facadeApi; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.mhd.bms.application.server.settlementCustomersParameters.SettlementCustomersParametersApplicationService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO; +import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO; +import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO; +import com.mhd.bms.interfaces.assembler.settlementCustomersParameters.SettlementCustomersParametersAssembler; +import javax.annotation.Resource; +import com.mhd.common.core.web.controller.BaseController; +import com.mhd.common.core.web.domain.AjaxResult; +import com.mhd.common.core.web.page.TableDataInfo; + +/** + * 结算对象参数Api + * + * @author gen + * @date 2024-06-17 + */ +@RestController +@RequestMapping("/settlementCustomersParametersApi") +public class SettlementCustomersParametersApi extends BaseController { + + @Autowired + private SettlementCustomersParametersApplicationService settlementCustomersParametersApplicationService; + + @Resource + private SettlementCustomersParametersAssembler settlementCustomersParametersAssembler; + + /** + * 分页查询结算对象参数列表 + */ + @ApiOperation("查询结算对象参数列表") + @GetMapping("/list") + public TableDataInfo list(SettlementCustomersParametersDTO settlementCustomersParametersDTO) { + SettlementCustomersParametersDO settlementCustomersParametersDO = new SettlementCustomersParametersDO(); + BeanUtils.copyProperties(settlementCustomersParametersDTO, settlementCustomersParametersDO); + startPage(); + List list = settlementCustomersParametersApplicationService.queryList(settlementCustomersParametersDO); + return getDataTable(list); + } + + /** + * 保存结算对象参数 + */ + @ApiOperation("保存结算对象参数") + @PostMapping("/save") + public AjaxResult save(@RequestBody SettlementCustomersParametersDTO settlementCustomersParametersDTO) { + try { + // 转换实体 + SettlementCustomersParametersDO settlementCustomersParametersDO = settlementCustomersParametersAssembler.toDO(settlementCustomersParametersDTO); + if (settlementCustomersParametersDTO.getId() != null) { + return toAjax(settlementCustomersParametersApplicationService.update(settlementCustomersParametersDO)); + } else { + return toAjax(settlementCustomersParametersApplicationService.insert(settlementCustomersParametersDO)); + } + } catch (Exception e) { + return AjaxResult.error("操作失败:" + e.getMessage()); + } + } + + /** + * 批量删除结算对象参数 + */ + @ApiOperation("批量删除结算对象参数") + @PostMapping("/deleteByIds") + public AjaxResult deleteByIds(@RequestBody SettlementCustomersParametersDTO settlementCustomersParametersDTO) { + try { + settlementCustomersParametersApplicationService.deleteByIds(settlementCustomersParametersDTO); + return AjaxResult.success("操作成功"); + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 获取结算对象参数详细信息 + */ + @ApiOperation("获取结算对象参数") + @GetMapping(value = "/getInfoById") + public AjaxResult getInfoById(SettlementCustomersParametersDTO settlementCustomersParametersDTO) { + return AjaxResult.success(settlementCustomersParametersApplicationService.getInfo(settlementCustomersParametersDTO.getId())); + } +} diff --git a/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml b/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml index e2fd28e11..e3b71ac36 100644 --- a/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml +++ b/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml @@ -43,6 +43,7 @@ + @@ -115,6 +116,7 @@ bd.business_state, bd.document_type, bd.document_type_code, + a.org_code, bd.create_time as business_create_time from settlement_customers a left join "NGWL_TEST_USER"."USER_SHIPPER" b on a.settlement_entity_id = b.user_id diff --git a/mhd_bms/src/main/resources/mapper/SettlementCustomersNcConfigMapper.xml b/mhd_bms/src/main/resources/mapper/SettlementCustomersNcConfigMapper.xml new file mode 100644 index 000000000..b5008151b --- /dev/null +++ b/mhd_bms/src/main/resources/mapper/SettlementCustomersNcConfigMapper.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a.id, + a.settlement_customers_id, + a.top_organization_id, + a.organization_id, + a.organization_name, + a.nc_code, + a.nc_settle_method, + a.warehouse_temp_layer_type, + a.scatter_rent_billing_config, + a.nc_settle_method_name, + a.warehouse_temp_layer_type_name, + a.scatter_rent_billing_config_name, + a.owe_rent_max_month, + a.account_period_day, + a.remark, + a.create_time, + a.create_by, + a.create_by_name, + a.update_time, + a.update_by, + a.update_by_name, + a.del_flag + + + + + diff --git a/mhd_bms/src/main/resources/mapper/SettlementCustomersParametersMapper.xml b/mhd_bms/src/main/resources/mapper/SettlementCustomersParametersMapper.xml new file mode 100644 index 000000000..58c2a4b5b --- /dev/null +++ b/mhd_bms/src/main/resources/mapper/SettlementCustomersParametersMapper.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + a.id, + a.settlement_customers_id, + a.top_organization_id, + a.organization_id, + a.organization_name, + a.settlement_customers_code, + a.settlement_entity_id, + a.settlement_entity, + a.contract_number, + a.contract_manage_id, + a.content, + a.parameters_name, + a.create_time, + a.create_by, + a.create_by_name, + a.update_time, + a.update_by, + a.update_by_name, + a.del_flag + + + + + From 2c60dc8f84500e98c2a3b4703904407bd5858baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Tue, 1 Sep 2026 16:58:39 +0800 Subject: [PATCH 02/32] =?UTF-8?q?bms=E6=94=B9=E9=80=A0;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mhd/system/api/BmsServiceFeign.java | 4 + .../mhd/system/api/SystemServiceFeign.java | 5 + .../api/domain/BusinessDocumentFeign.java | 197 ++++++++++++++++++ .../domain/ContractManageParametersFeign.java | 52 +++++ .../RemoteBmsFeignFallbackFactory.java | 8 +- .../RemoteSystemFeignFallbackFactory.java | 6 + .../ContractManageApplicationService.java | 77 ++++++- ...actManageParametersApplicationService.java | 72 +++++++ .../contractManage/entity/ContractManage.java | 22 +- .../repository/po/ContractManagePO.java | 18 ++ .../repository/todo/ContractManageDO.java | 16 ++ .../service/ContractManageDomainService.java | 16 ++ .../entity/ContractManageParameters.java | 52 +++++ .../IContractManageParametersService.java | 47 +++++ .../ContractManageParametersMapper.java | 26 +++ .../ContractManageParametersImpl.java | 86 ++++++++ .../po/ContractManageParametersPO.java | 51 +++++ .../todo/ContractManageParametersDO.java | 49 +++++ ...ContractManageParametersDomainService.java | 105 ++++++++++ .../ContractManageParametersAssembler.java | 65 ++++++ .../dto/contractManage/ContractManageDTO.java | 25 ++- .../ContractManageParametersDTO.java | 48 +++++ .../ContractManageParametersApi.java | 105 ++++++++++ .../mapper/basic/ContractManageMapper.xml | 12 ++ .../basic/ContractManageParametersMapper.xml | 53 +++++ ...SettlementCustomersApplicationService.java | 16 ++ .../SettlementCustomersDomainService.java | 21 +- mhd_oms/pom.xml | 6 +- .../IReservationStockInOrderService.java | 2 + .../mapper/ReservationStockInOrderMapper.java | 2 + .../ReservationStockInOrderImpl.java | 4 + ...rvationStockInOrderApplicationService.java | 23 ++ .../ReservationStockInOrderDomainService.java | 4 + .../ReservationStockInOrderApi.java | 22 ++ .../ReservationStockInOrderMapper.xml | 8 + .../MaterialInventoryApplicationService.java | 113 +++++++++- .../facade/IMaterialInventoryService.java | 11 + .../mapper/MaterialInventoryMapper.java | 12 ++ .../persistence/MaterialInventoryImpl.java | 21 ++ .../MaterialInventoryDomainService.java | 23 +- .../MaterialInventoryApi.java | 21 ++ .../MaterialInventoryMapper.xml | 51 +++++ 42 files changed, 1561 insertions(+), 16 deletions(-) create mode 100644 mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BusinessDocumentFeign.java create mode 100644 mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageParametersFeign.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManageParameters/ContractManageParametersApplicationService.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/entity/ContractManageParameters.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/facade/IContractManageParametersService.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/mapper/ContractManageParametersMapper.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/persistence/ContractManageParametersImpl.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/po/ContractManageParametersPO.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/todo/ContractManageParametersDO.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/service/ContractManageParametersDomainService.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/assember/contractManageParameters/ContractManageParametersAssembler.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManageParameters/ContractManageParametersDTO.java create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManageParameters/ContractManageParametersApi.java create mode 100644 mhd-modules/mhd-system/src/main/resources/mapper/basic/ContractManageParametersMapper.xml diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 4ba01f192..c46ed32b1 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -3,6 +3,7 @@ package com.mhd.system.api; import com.mhd.common.core.constant.ServiceNameConstants; import com.mhd.common.core.domain.dto.BusinessDataPushDTO; import com.mhd.common.core.web.domain.AjaxResult; +import com.mhd.system.api.domain.BusinessDocumentFeign; import com.mhd.system.api.factory.RemoteBmsFeignFallbackFactory; import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; @@ -68,4 +69,7 @@ public interface BmsServiceFeign { */ @PostMapping("/businessDocumentApi/wholeRentSynchronizationZXF") public AjaxResult wholeRentSynchronizationZXF(@RequestBody BusinessDataPushDTO businessDataPushDTO); + + @PostMapping("/businessDocumentApi/save") + public AjaxResult feignSaveBusinessDocument(@RequestBody BusinessDocumentFeign businessDocumentFeign); } \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/SystemServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/SystemServiceFeign.java index af6d318b4..1105c8faa 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/SystemServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/SystemServiceFeign.java @@ -13,6 +13,7 @@ import com.mhd.common.core.domain.po.SysMultistageDictPo; import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.system.api.domain.ContainerFeignPO; import com.mhd.system.api.domain.ContractManageFeignDTO; +import com.mhd.system.api.domain.ContractManageParametersFeign; import com.mhd.system.api.domain.SysDictData; import com.mhd.system.api.factory.RemoteSystemFeignFallbackFactory; import com.mhd.system.api.feign.FeignAutoConfiguration; @@ -396,4 +397,8 @@ public interface SystemServiceFeign { @PostMapping("/contractManageApi/feignSave") public AjaxResult feignSave(@RequestBody ContractManageFeignDTO contractManageFeignDTO); + @ApiOperation("Feign保存合约信息规则维护") + @PostMapping("/contractManageParametersApi/feignSave") + public AjaxResult feignSaveContractParameters(@RequestBody ContractManageParametersFeign contractManageParametersFeign); + } \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BusinessDocumentFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BusinessDocumentFeign.java new file mode 100644 index 000000000..a25cdc40c --- /dev/null +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BusinessDocumentFeign.java @@ -0,0 +1,197 @@ +package com.mhd.system.api.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + + +/** + * 业务单据对象 business_document + * + * @author gen + * @date 2024-06-21 + */ + +@Data +public class BusinessDocumentFeign extends BaseVOEntity{ + private static final long serialVersionUID = 1L; + + @ApiModelProperty("业务单据记录id") + @TableId(type = IdType.AUTO) + private Long businessDocumentId; + + @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 businessFlow; + + @ApiModelProperty("状态(1-未生效,2-已生效,3-已计费,4-已驳回,5-已作废") + @Excel(name = "状态", readConverterExp = "状态(1-未生效,2-已生效,3-已计费,4-已驳回,5-已作废") + private Integer businessState; + + @ApiModelProperty("来源模块") + @Excel(name = "来源模块") + private String belongModule; + + @ApiModelProperty("来源模块code") + @Excel(name = "来源模块code") + private String belongModuleCode; + + @ApiModelProperty("数据来源(1-系统生成,2-手工录入)") + @Excel(name = "数据来源", readConverterExp = "1=-系统生成,2-手工录入") + private Integer dataSources; + + @ApiModelProperty("单据类型id") + @Excel(name = "单据类型id") + private Long documentTypeId; + + @ApiModelProperty("单据类型code") + @Excel(name = "单据类型code") + private String documentTypeCode; + + @ApiModelProperty("单据类型") + @Excel(name = "单据类型") + private String documentType; + + @ApiModelProperty("原始业务单号") + @Excel(name = "原始业务单号") + private String originalBusinessNum; + + @ApiModelProperty("项目编码") + @Excel(name = "项目编码") + private String projectCode; + + @ApiModelProperty("项目名称") + @Excel(name = "项目名称") + private String projectName; + + @ApiModelProperty("合同编号") + @Excel(name = "合同编号") + private String contractNumber; + + @ApiModelProperty("合同名称") + @Excel(name = "合同名称") + private String contractName; + + @ApiModelProperty("账单金额") + @Excel(name = "账单金额") + private BigDecimal billAmount; + + @ApiModelProperty("预计费金额") + @Excel(name = "预计费金额") + private BigDecimal estimatedCost; + + @ApiModelProperty("一级费用科目code") + @Excel(name = "一级费用科目code") + private String firstSubjectCode; + + @ApiModelProperty("一级费用科目(结算项)") + @Excel(name = "一级费用科目") + private String firstSubjectName; + + @ApiModelProperty("二级费用科目code") + @Excel(name = "二级费用科目code") + private String secondSubjectCode; + + @ApiModelProperty("二级费用科目(结算项)") + @Excel(name = "二级费用科目") + private String secondSubjectName; + + @ApiModelProperty("结算对象id") + @Excel(name = "结算对象id") + private Long settlementCustomersId; + + @ApiModelProperty("结算对象code") + @Excel(name = "结算对象code") + private String settlementCustomersCode; + + @ApiModelProperty("结算对象") + @Excel(name = "结算对象") + private String settlementEntity; + + @ApiModelProperty("计费时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "计费时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date billingTime; + + @ApiModelProperty("单据表单json数据") + @Excel(name = "单据表单json数据") + private String documentFormJson; + + @ApiModelProperty("合同管理id") + @Excel(name = "合同管理id", readConverterExp = "合同管理id") + private Long contractManageId; + + @ApiModelProperty("项目管理id") + @Excel(name = "项目管理id", readConverterExp = "项目管理id") + private Long projectManageId; + + @ApiModelProperty("原始流水号") + @Excel(name = "原始流水号") + private String originalSerialNumber; + + @ApiModelProperty("费用类型code(服务项)") + @Excel(name = "费用类型code(服务项)") + private String serviceItemsCode; + + @ApiModelProperty("费用类型") + @Excel(name = "费用类型") + private String serviceItemsName; + + @ApiModelProperty("费用类型id(服务项)") + @Excel(name = "费用类型id(服务项)") + private Long serviceItemsManageId; + + @ApiModelProperty("单据备注") + @Excel(name = "单据备注") + private String remark; + + @ApiModelProperty("审核备注") + @Excel(name = "审核备注") + private String reviewRemarks; + + @ApiModelProperty("结算方式(1-现金,2-油卡)") + private Integer settlementWay; + + @ApiModelProperty("结算币种") + private String settlementCurrency; + @ApiModelProperty("业务员ID") + private String salesmanId; + @ApiModelProperty("业务员名称") + private String salesmanName; + @ApiModelProperty("税率") + private Double taxRate; + @ApiModelProperty("收款帐户") + private String paymentAccountId; + @ApiModelProperty("收款帐户名称") + private String paymentAccountName; + + @ApiModelProperty("计费单位") + private String billingUnit; + @ApiModelProperty("计费单位2") + private String billingUnit2; + @ApiModelProperty("计费数量") + private BigDecimal billingNum; + @ApiModelProperty("计费单价") + private BigDecimal billingUnitPrice; + @ApiModelProperty("nc科目编码") + private String ncSubjectCode; +} \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageParametersFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageParametersFeign.java new file mode 100644 index 000000000..77018b8dc --- /dev/null +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/ContractManageParametersFeign.java @@ -0,0 +1,52 @@ +package com.mhd.system.api.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.mhd.common.core.annotation.Excel; +import com.mhd.common.core.web.domain.BaseVOEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * 合约信息规则维护表 + * + * @author gen + * @date 2024-06-07 + */ + +@Data +public class ContractManageParametersFeign extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("合同管理id") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("合同管理id") + private Long contractManageId; + + @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 contractNumber; + + @ApiModelProperty("合同名称") + @Excel(name = "合同名称") + private String contractName; + + @ApiModelProperty("合约信息规则维护") + @Excel(name = "合约信息规则维护表") + private String parametersJson; +} \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java index 1ff15b40c..091297e45 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java @@ -6,6 +6,7 @@ import com.mhd.common.core.domain.po.OrganizationPo; import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.system.api.BmsServiceFeign; import com.mhd.system.api.ProductServiceFeign; +import com.mhd.system.api.domain.BusinessDocumentFeign; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; @@ -66,6 +67,11 @@ public class RemoteBmsFeignFallbackFactory implements FallbackFactory list = contractManageDomainService.queryList(contractManageDO); + + if (!list.isEmpty()) { + List contractManageIds = list.stream() + .map(ContractManagePO::getContractManageId) + .collect(Collectors.toList()); + List allParams = contractManageParametersDomainService.queryListByManageIds(contractManageIds); + Map> paramsMap = allParams.stream() + .collect(Collectors.groupingBy(ContractManageParametersPO::getContractManageId)); + for (ContractManagePO po : list) { + po.setContractManageParametersList(paramsMap.getOrDefault(po.getContractManageId(), new ArrayList<>())); + } + } + + return list; } // public BigDecimal getAmount(List subjectAndPriceReturnList) { @@ -610,6 +636,7 @@ public class ContractManageApplicationService { */ //20260702取消同一时间段不能有相同合同校验 //checkContract(contractManageDO); + checkUniqueActiveContract(contractManageDO); handleData(contractManageDO); handleDict(contractManageDO); contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT")); @@ -618,6 +645,7 @@ public class ContractManageApplicationService { contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); boolean flag = contractManageDomainService.insert(contractManageDO); handleDetils(contractManageDO, true); + handleParameters(contractManageDO); return flag; } @@ -638,6 +666,7 @@ public class ContractManageApplicationService { */ //20260702取消同一时间段不能有相同合同校验 //checkContract(contractManageDO); + checkUniqueActiveContract(contractManageDO); handleData(contractManageDO); handleDict(contractManageDO); contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT")); @@ -645,7 +674,7 @@ public class ContractManageApplicationService { contractManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); boolean flag = contractManageDomainService.insert(contractManageDO); - if (flag) { + if (!flag) { throw new ServiceException("新增合同管理失败,请检查数据"); } handleDetils(contractManageDO, true); @@ -779,6 +808,26 @@ public class ContractManageApplicationService { } } + private void checkUniqueActiveContract(ContractManageDO contractManageDO) { + if (contractManageDO.getContractState() != null && contractManageDO.getContractState() != 2) { + return; + } + if (contractManageDO.getSettlementCustomersId() == null + || StringUtils.isEmpty(contractManageDO.getWarehouseTempLayerType()) + || StringUtils.isEmpty(contractManageDO.getContractRentType())) { + return; + } + long count = contractManageDomainService.countByUniqueKey( + contractManageDO.getSettlementCustomersId(), + contractManageDO.getWarehouseTempLayerType(), + contractManageDO.getContractRentType(), + contractManageDO.getContractManageId() + ); + if (count > 0) { + throw new ServiceException("同一结算客户、同一温层、同一租赁类型只能存在一个使用中的合同"); + } + } + /** * 处理合同详情 */ @@ -877,6 +926,26 @@ public class ContractManageApplicationService { } } + private void handleParameters(ContractManageDO contractManageDO) { + List existingList = contractManageParametersDomainService.queryListByManageId(contractManageDO.getContractManageId()); + if (!existingList.isEmpty()) { + Long[] ids = existingList.stream().map(ContractManageParametersPO::getId).toArray(Long[]::new); + contractManageParametersDomainService.delete(ids); + } + if (StringUtils.isNotEmpty(contractManageDO.getParametersJson())) { + ContractManageParametersDTO dto = new ContractManageParametersDTO(); + dto.setContractManageId(contractManageDO.getContractManageId()); + dto.setContractNumber(contractManageDO.getContractNumber()); + dto.setContractName(contractManageDO.getContractName()); + dto.setParametersJson(contractManageDO.getParametersJson()); + dto.setOrganizationId(contractManageDO.getOrganizationId()); + dto.setOrganizationName(contractManageDO.getOrganizationName()); + dto.setTopOrganizationId(contractManageDO.getTopOrganizationId()); + ContractManageParametersDO parametersDO = contractManageParametersAssembler.toDO(dto); + contractManageParametersDomainService.insert(parametersDO); + } + } + /** * 修改合同管理 */ @@ -884,8 +953,10 @@ public class ContractManageApplicationService { public Boolean update(ContractManageDO contractManageDO) { validateContractType(contractManageDO.getContractType()); //checkContract(contractManageDO); + checkUniqueActiveContract(contractManageDO); handleData(contractManageDO); handleDetils(contractManageDO, false); + handleParameters(contractManageDO); handleDict(contractManageDO); return contractManageDomainService.update(contractManageDO); } @@ -911,6 +982,8 @@ public class ContractManageApplicationService { ContractManagePO result = contractManageDomainService.getInfo(contractManageId); List contractManageDetailPOList = contractManageDetailDomainService.queryListByManageId(result.getContractManageId()); result.setContractManageDetailPOList(contractManageDetailPOList); + List paramsList = contractManageParametersDomainService.queryListByManageId(result.getContractManageId()); + result.setContractManageParametersList(paramsList); return result; } diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManageParameters/ContractManageParametersApplicationService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManageParameters/ContractManageParametersApplicationService.java new file mode 100644 index 000000000..1b1ad2aa9 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManageParameters/ContractManageParametersApplicationService.java @@ -0,0 +1,72 @@ +package com.mhd.basic.application.service.contractManageParameters; + +import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO; +import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO; +import com.mhd.basic.domain.contractManageParameters.service.ContractManageParametersDomainService; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.system.api.model.LoginUser; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; +/** + * 合约信息规则维护表ApplicationService + * + * @author gen + * @date 2024-06-07 + */ +@Service +@Slf4j +public class ContractManageParametersApplicationService { + @Autowired + private ContractManageParametersDomainService contractManageParametersDomainService; + + + /** + * 分页查询合约信息规则维护表列表 + */ + + public List queryList(ContractManageParametersDO contractManageParametersDO) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null){ + Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId(); + if (topOrganizationId != null && topOrganizationId != 1){ + contractManageParametersDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + } + } + return contractManageParametersDomainService.queryList(contractManageParametersDO); + } + + + /** + * 新增合约信息规则维护表 + */ + public Boolean insert(ContractManageParametersDO contractManageParametersDO) { + + return contractManageParametersDomainService.insert(contractManageParametersDO); + } + + /** + * 修改合约信息规则维护表 + */ + public Boolean update(ContractManageParametersDO contractManageParametersDO) { + return contractManageParametersDomainService.update(contractManageParametersDO); + } + + /** + * 批量删除合约信息规则维护表 + */ + public boolean delete(Long[] ids) { + return contractManageParametersDomainService.delete(ids); + } + + /** + * 获取合约信息规则维护表详细信息 + */ + public ContractManageParametersPO getInfo(Long id) + { + return contractManageParametersDomainService.getInfo(id); + } + + +} diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/entity/ContractManage.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/entity/ContractManage.java index f6164a5e8..da25eac0a 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/entity/ContractManage.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/entity/ContractManage.java @@ -192,16 +192,30 @@ public class ContractManage extends BaseVOEntity{ @ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)") private Integer transportationCosts; - @ApiModelProperty("客户类型") + @ApiModelProperty("合同租赁类型") private String contractRentType; - @ApiModelProperty("客户类型编码") + @ApiModelProperty("合同租赁类型") private String contractRentTypeName; - @ApiModelProperty("客户类型") + @ApiModelProperty("仓库温层类型") private String warehouseTempLayerType; - @ApiModelProperty("客户类型编码") + @ApiModelProperty("仓库温层类型") private String warehouseTempLayerTypeName; + @ApiModelProperty("续期提前天数") + private Integer renewalAdvanceDays; + + @ApiModelProperty("标的物") + private String subjectMatter; + + @ApiModelProperty("性质") + private String nature; + + @ApiModelProperty("合同最初起始日") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "合同最初起始日", width = 30, dateFormat = "yyyy-MM-dd") + private Date initialStartDate; + } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/po/ContractManagePO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/po/ContractManagePO.java index 882259a00..83d580820 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/po/ContractManagePO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/po/ContractManagePO.java @@ -1,6 +1,7 @@ package com.mhd.basic.domain.contractManage.repository.po; import com.mhd.basic.domain.contractManageDetail.repository.po.ContractManageDetailPO; +import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO; import com.mhd.basic.interfaces.dto.contractManageDetail.ContractManageDetailDTO; import com.mhd.common.core.annotation.Excel; import lombok.Data; @@ -209,4 +210,21 @@ public class ContractManagePO extends BaseVOEntity{ private String warehouseTempLayerTypeName; private String isMany; + + @ApiModelProperty("合约信息规则维护列表") + private List contractManageParametersList; + + @ApiModelProperty("续期提前天数") + private Integer renewalAdvanceDays; + + @ApiModelProperty("标的物") + private String subjectMatter; + + @ApiModelProperty("性质") + private String nature; + + @ApiModelProperty("合同最初起始日") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "合同最初起始日", width = 30, dateFormat = "yyyy-MM-dd") + private Date initialStartDate; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/todo/ContractManageDO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/todo/ContractManageDO.java index 028244045..3eec53c8a 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/todo/ContractManageDO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/todo/ContractManageDO.java @@ -240,4 +240,20 @@ public class ContractManageDO extends BaseVOEntity{ @ApiModelProperty("一级费用科目code") private String firstSubjectCode; + + @ApiModelProperty("合约信息规则维护JSON") + private String parametersJson; + + @ApiModelProperty("续期提前天数") + private Integer renewalAdvanceDays; + + @ApiModelProperty("标的物") + private String subjectMatter; + + @ApiModelProperty("性质") + private String nature; + + @ApiModelProperty("合同最初起始日") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date initialStartDate; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java index d4b05c992..6d1606e88 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java @@ -193,6 +193,22 @@ public class ContractManageDomainService { } + /** + * 同结算客户+同温层+同租赁类型+使用中 的合同数量(用于唯一性校验) + */ + public long countByUniqueKey(Long settlementCustomersId, String warehouseTempLayerType, String contractRentType, Long excludeId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ContractManage::getSettlementCustomersId, settlementCustomersId); + wrapper.eq(ContractManage::getWarehouseTempLayerType, warehouseTempLayerType); + wrapper.eq(ContractManage::getContractRentType, contractRentType); + wrapper.eq(ContractManage::getContractState, 2); + wrapper.eq(ContractManage::getDelFlag, 1); + if (excludeId != null) { + wrapper.ne(ContractManage::getContractManageId, excludeId); + } + return contractManageService.count(wrapper); + } + public ContractManagePO getGeneralContract() { ContractManagePO contractManagePO = new ContractManagePO(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/entity/ContractManageParameters.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/entity/ContractManageParameters.java new file mode 100644 index 000000000..428f32365 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/entity/ContractManageParameters.java @@ -0,0 +1,52 @@ +package com.mhd.basic.domain.contractManageParameters.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.mhd.common.core.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; +import lombok.Data; + + +/** + * 合约信息规则维护表 + * + * @author gen + * @date 2024-06-07 + */ + +@Data +public class ContractManageParameters extends BaseVOEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("合同管理id") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("合同管理id") + private Long contractManageId; + + @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 contractNumber; + + @ApiModelProperty("合同名称") + @Excel(name = "合同名称") + private String contractName; + + @ApiModelProperty("合约信息规则维护") + @Excel(name = "合约信息规则维护表") + private String parametersJson; +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/facade/IContractManageParametersService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/facade/IContractManageParametersService.java new file mode 100644 index 000000000..f335cc106 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/facade/IContractManageParametersService.java @@ -0,0 +1,47 @@ +package com.mhd.basic.domain.contractManageParameters.repository.facade; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters; +import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO; +import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO; + +import java.util.List; + +/** + * 合约信息规则维护表Service接口 + * + * @author gen + * @date 2024-06-07 + */ +public interface IContractManageParametersService extends IService +{ + /** + * 分页查询合约信息规则维护表列表 + */ + public List queryList(ContractManageParametersDO contractManageParametersDO); + + /** + * 新增合约信息规则维护表 + */ + public Boolean insert(ContractManageParametersDO contractManageParametersDO); + + /** + * 修改合约信息规则维护表 + */ + public Boolean update(ContractManageParametersDO contractManageParametersDO); + + /** + * 批量删除合约信息规则维护表 + */ + public Boolean delete(Long[] ids); + + /** + * 查询合约信息规则维护表 + */ + public ContractManageParametersPO getInfo(Long id); + + /** + * 根据合同管理id查询合约信息规则维护列表 + */ + List getListByContractManageId(Long contractManageId); +} diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/mapper/ContractManageParametersMapper.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/mapper/ContractManageParametersMapper.java new file mode 100644 index 000000000..70d1f8cec --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/mapper/ContractManageParametersMapper.java @@ -0,0 +1,26 @@ +package com.mhd.basic.domain.contractManageParameters.repository.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters; +import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO; +import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO; +import org.apache.ibatis.annotations.Param; +/** + * 合约信息规则维护表Mapper接口 + * + * @author gen + * @date 2024-06-07 + */ +public interface ContractManageParametersMapper extends BaseMapper +{ + /** + * 查询合约信息规则维护表列表 + */ + public List queryList(@Param("contractManageParametersDO") ContractManageParametersDO contractManageParametersDO); + + /** + * 根据合同管理id查询合约信息规则维护列表 + */ + List getListByContractManageId(@Param("contractManageId") Long contractManageId); +} diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/persistence/ContractManageParametersImpl.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/persistence/ContractManageParametersImpl.java new file mode 100644 index 000000000..83523bfda --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/persistence/ContractManageParametersImpl.java @@ -0,0 +1,86 @@ +package com.mhd.basic.domain.contractManageParameters.repository.persistence; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters; +import com.mhd.basic.domain.contractManageParameters.repository.facade.IContractManageParametersService; +import com.mhd.basic.domain.contractManageParameters.repository.mapper.ContractManageParametersMapper; +import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO; +import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * 合约信息规则维护表Service业务层处理 + * + * @author gen + * @date 2024-06-07 + */ +@Service +public class ContractManageParametersImpl extends ServiceImpl implements IContractManageParametersService{ + @Autowired + private ContractManageParametersMapper contractManageParametersMapper; + + /** + * 查询合约信息规则维护表列表 + */ + @Override + public List queryList(ContractManageParametersDO contractManageParametersDO) + { + return contractManageParametersMapper.queryList(contractManageParametersDO); + } + + /** + * 新增合约信息规则维护表 + */ + @Override + public Boolean insert(ContractManageParametersDO contractManageParametersDO) { + ContractManageParameters contractManageParameters = new ContractManageParameters(); + BeanUtils.copyProperties(contractManageParametersDO,contractManageParameters); + return this.save(contractManageParameters); + } + + /** + * 修改合约信息规则维护表 + */ + @Override + public Boolean update(ContractManageParametersDO contractManageParametersDO) { + ContractManageParameters contractManageParameters = new ContractManageParameters(); + BeanUtils.copyProperties(contractManageParametersDO,contractManageParameters); + return this.updateById(contractManageParameters); + } + + /** + * 批量删除合约信息规则维护表 + */ + @Override + public Boolean delete(Long[] ids ) { + List list = new ArrayList<>(); + for (Long id : ids) { + ContractManageParameters contractManageParameters = new ContractManageParameters(); + contractManageParameters.setId(id); + contractManageParameters.setDelFlag(2); + list.add(contractManageParameters); + } + return this.updateBatchById(list); + } + + /** + * 查询合约信息规则维护表 + */ + @Override + public ContractManageParametersPO getInfo(Long id) { + ContractManageParameters contractManageParameters = this.getById(id); + ContractManageParametersPO contractManageParametersPO = new ContractManageParametersPO(); + BeanUtils.copyProperties(contractManageParameters,contractManageParametersPO); + return contractManageParametersPO; + } + + @Override + public List getListByContractManageId(Long contractManageId) { + return contractManageParametersMapper.getListByContractManageId(contractManageId); + } +} diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/po/ContractManageParametersPO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/po/ContractManageParametersPO.java new file mode 100644 index 000000000..6c76a08a2 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/po/ContractManageParametersPO.java @@ -0,0 +1,51 @@ +package com.mhd.basic.domain.contractManageParameters.repository.po; + +import com.mhd.common.core.annotation.Excel; +import lombok.Data; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; + + +/** + * 合约信息规则维护表对象 contract_manage_parameters + * + * @author gen + * @date 2024-06-07 + */ + +@Data +@ApiModel(value = "合约信息规则维护表对象", description = "合约信息规则维护表响应对象") +public class ContractManageParametersPO extends BaseVOEntity{ + private static final long serialVersionUID = 1L; + + @ApiModelProperty("合同管理id") + private Long id; + + @ApiModelProperty("合同管理id") + private Long contractManageId; + + @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 contractNumber; + + @ApiModelProperty("合同名称") + @Excel(name = "合同名称") + private String contractName; + + @ApiModelProperty("合约信息规则维护") + @Excel(name = "合约信息规则维护表") + private String parametersJson; +} diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/todo/ContractManageParametersDO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/todo/ContractManageParametersDO.java new file mode 100644 index 000000000..dc4a0d8a1 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/repository/todo/ContractManageParametersDO.java @@ -0,0 +1,49 @@ +package com.mhd.basic.domain.contractManageParameters.repository.todo; + +import com.mhd.common.core.annotation.Excel; +import lombok.Data; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; + + +/** + * 合约信息规则维护表对象 contract_manage_parameters + * + * @author gen + * @date 2024-06-07 + */ + +@Data +public class ContractManageParametersDO extends BaseVOEntity{ + private static final long serialVersionUID = 1L; + + @ApiModelProperty("合同管理id") + private Long id; + + @ApiModelProperty("合同管理id") + private Long contractManageId; + + @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 contractNumber; + + @ApiModelProperty("合同名称") + @Excel(name = "合同名称") + private String contractName; + + @ApiModelProperty("合约信息规则维护") + @Excel(name = "合约信息规则维护表") + private String parametersJson; +} diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/service/ContractManageParametersDomainService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/service/ContractManageParametersDomainService.java new file mode 100644 index 000000000..c8cfe039b --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageParameters/service/ContractManageParametersDomainService.java @@ -0,0 +1,105 @@ +package com.mhd.basic.domain.contractManageParameters.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters; +import com.mhd.basic.domain.contractManageParameters.repository.facade.IContractManageParametersService; +import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO; +import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +/** + * 合约信息规则维护表 + * + * @author gen + * @date 2024-06-07 + */ +@Service +@Slf4j +public class ContractManageParametersDomainService { + + @Autowired + private IContractManageParametersService contractManageParametersService; + + + /** + * 分页查询合约信息规则维护表列表 + */ + public List queryList(ContractManageParametersDO contractManageParametersDO) { + return contractManageParametersService.queryList(contractManageParametersDO); + } + + + /** + * 新增合约信息规则维护表 + */ + public Boolean insert(ContractManageParametersDO contractManageParametersDO) { + + return contractManageParametersService.insert(contractManageParametersDO); + } + + /** + * 修改合约信息规则维护表 + */ + public Boolean update(ContractManageParametersDO contractManageParametersDO) { + return contractManageParametersService.update(contractManageParametersDO); + } + + /** + * 批量删除合约信息规则维护表 + */ + public Boolean delete(Long[] ids) { + return contractManageParametersService.delete(ids); + } + + /** + * 获取合约信息规则维护表详细信息 + */ + public ContractManageParametersPO getInfo(Long id) + { + return contractManageParametersService.getInfo(id); + } + + /** + * 根据合同管理id查询合约信息规则维护列表 + * @param contractManageId + * @return + */ + public List queryListByManageId(Long contractManageId) { + List resultList = new ArrayList<>(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ContractManageParameters::getContractManageId,contractManageId); + queryWrapper.eq(ContractManageParameters::getDelFlag,1); + List contractManageParametersList = contractManageParametersService.list(queryWrapper); + if(contractManageParametersList.size()>0){ + for (ContractManageParameters contractManageParameters : contractManageParametersList) { + ContractManageParametersPO contractManageParametersPO = new ContractManageParametersPO(); + BeanUtils.copyProperties(contractManageParameters,contractManageParametersPO); + resultList.add(contractManageParametersPO); + } + } + return resultList; + } + + public List queryListByManageIds(Collection contractManageIds) { + List resultList = new ArrayList<>(); + if (contractManageIds == null || contractManageIds.isEmpty()) { + return resultList; + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(ContractManageParameters::getContractManageId, contractManageIds); + queryWrapper.eq(ContractManageParameters::getDelFlag, 1); + List entityList = contractManageParametersService.list(queryWrapper); + for (ContractManageParameters entity : entityList) { + ContractManageParametersPO po = new ContractManageParametersPO(); + BeanUtils.copyProperties(entity, po); + resultList.add(po); + } + return resultList; + } +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/assember/contractManageParameters/ContractManageParametersAssembler.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/assember/contractManageParameters/ContractManageParametersAssembler.java new file mode 100644 index 000000000..f68062690 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/assember/contractManageParameters/ContractManageParametersAssembler.java @@ -0,0 +1,65 @@ +package com.mhd.basic.interfaces.assember.contractManageParameters; + +import cn.hutool.core.util.ObjectUtil; +import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO; +import com.mhd.basic.interfaces.dto.contractManageParameters.ContractManageParametersDTO; +import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException; +import com.mhd.common.core.exception.digitalLogisticsException.UserError; +import com.mhd.common.core.utils.bean.BeanUtils; +import com.mhd.common.core.utils.IgnoreNullUtil; +import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.system.api.model.LoginUser; +import org.springframework.stereotype.Component; + +import java.util.Date; + +/** + * 合约信息规则维护表Assembler + * + * @author gen + * @date 2024-06-07 + */ +@Component +public class ContractManageParametersAssembler { + + /** + * 转换实体 + */ + public ContractManageParametersDO toDO(ContractManageParametersDTO contractManageParametersDTO) { + ContractManageParametersDO contractManageParametersDO = new ContractManageParametersDO(); + // 拷贝 + BeanUtils.copyProperties(contractManageParametersDTO, contractManageParametersDO, IgnoreNullUtil.getNullPropertyNames(contractManageParametersDTO)); + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (ObjectUtil.isNull(loginUser)) { + throw new DigitalLogisticsException(UserError.TIMEOUT); + } + String userName = loginUser.getUsername(); + // 获取登录人id + Long userId = loginUser.getUserid(); + if(contractManageParametersDTO.getId() != null){ + if(userId != null){ + contractManageParametersDO.setUpdateBy(userId); + }else { + contractManageParametersDO.setUpdateBy(new Long("0")); + } + contractManageParametersDO.setUpdateByName(userName); + contractManageParametersDO.setUpdateTime(new Date()); + + }else { + if(userId != null){ + contractManageParametersDO.setCreateBy(userId); + contractManageParametersDO.setUpdateBy(userId); + }else { + contractManageParametersDO.setCreateBy(new Long("0")); + contractManageParametersDO.setUpdateBy(new Long("0")); + } + contractManageParametersDO.setCreateByName(userName); + contractManageParametersDO.setUpdateByName(userName); + contractManageParametersDO.setCreateTime(new Date()); + contractManageParametersDO.setUpdateTime(new Date()); + contractManageParametersDO.setDelFlag(1); + } + return contractManageParametersDO; + } + +} diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManage/ContractManageDTO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManage/ContractManageDTO.java index 7701786df..229340afd 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManage/ContractManageDTO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManage/ContractManageDTO.java @@ -217,15 +217,32 @@ public class ContractManageDTO extends BaseVOEntity{ @ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)") private Integer transportationCosts; - @ApiModelProperty("客户类型") + @ApiModelProperty("合同租赁类型code") private String contractRentType; - @ApiModelProperty("客户类型编码") + @ApiModelProperty("合同租赁类型名称") private String contractRentTypeName; - @ApiModelProperty("仓库温层类型") + @ApiModelProperty("仓库温层类型code") private String warehouseTempLayerType; - @ApiModelProperty("仓库温层类型编码") + @ApiModelProperty("仓库温层类型编码名称") private String warehouseTempLayerTypeName; + + @ApiModelProperty("合约信息规则维护JSON") + private String parametersJson; + + @ApiModelProperty("续期提前天数") + private Integer renewalAdvanceDays; + + @ApiModelProperty("标的物") + private String subjectMatter; + + @ApiModelProperty("性质") + private String nature; + + @ApiModelProperty("合同最初起始日") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @Excel(name = "合同最初起始日", width = 30, dateFormat = "yyyy-MM-dd") + private Date initialStartDate; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManageParameters/ContractManageParametersDTO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManageParameters/ContractManageParametersDTO.java new file mode 100644 index 000000000..a67e8840a --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManageParameters/ContractManageParametersDTO.java @@ -0,0 +1,48 @@ +package com.mhd.basic.interfaces.dto.contractManageParameters; + +import com.mhd.common.core.annotation.Excel; +import lombok.Data; +import io.swagger.annotations.ApiModelProperty; +import com.mhd.common.core.web.domain.BaseVOEntity; + +/** + * 合约信息规则维护表对象 contract_manage_parameters + * + * @author gen + * @date 2024-06-07 + */ + +@Data +public class ContractManageParametersDTO extends BaseVOEntity{ + private static final long serialVersionUID = 1L; + + @ApiModelProperty("合同管理id") + private Long id; + + @ApiModelProperty("合同管理id") + private Long contractManageId; + + @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 contractNumber; + + @ApiModelProperty("合同名称") + @Excel(name = "合同名称") + private String contractName; + + @ApiModelProperty("合约信息规则维护") + @Excel(name = "合约信息规则维护表") + private String parametersJson; +} diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManageParameters/ContractManageParametersApi.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManageParameters/ContractManageParametersApi.java new file mode 100644 index 000000000..761a0d5dd --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManageParameters/ContractManageParametersApi.java @@ -0,0 +1,105 @@ +package com.mhd.basic.interfaces.facade.contractManageParameters; + +import java.util.List; + +import com.mhd.basic.interfaces.assember.contractManageParameters.ContractManageParametersAssembler; +import com.mhd.system.api.domain.ContractManageParametersFeign; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.mhd.basic.interfaces.dto.contractManageParameters.ContractManageParametersDTO; +import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO; +import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO; +import com.mhd.basic.application.service.contractManageParameters.ContractManageParametersApplicationService; +import javax.annotation.Resource; +import com.mhd.common.core.web.controller.BaseController; +import com.mhd.common.core.web.domain.AjaxResult; +import com.mhd.common.core.web.page.TableDataInfo; + +/** + * 合约信息规则维护表Api + * + * @author gen + * @date 2024-06-07 + */ +@RestController +@RequestMapping("/contractManageParametersApi") +public class ContractManageParametersApi extends BaseController{ + @Autowired + private ContractManageParametersApplicationService contractManageParametersApplicationService; + + @Resource + private ContractManageParametersAssembler contractManageParametersAssembler; + + /** + * 分页查询合约信息规则维护表列表 + */ + @ApiOperation("查询合约信息规则维护表列表") + @GetMapping("/list") + public TableDataInfo list(ContractManageParametersDTO contractManageParametersDTO) + { + //转换实体 + ContractManageParametersDO contractManageParametersDO = contractManageParametersAssembler.toDO(contractManageParametersDTO); + startPage(); + List list = contractManageParametersApplicationService.queryList(contractManageParametersDO); + return getDataTable(list); + } + + /** + * 编辑合约信息规则维护表 + */ + @ApiOperation("编辑合约信息规则维护表") + @PostMapping("/edit") + public AjaxResult edit(@RequestBody ContractManageParametersDTO contractManageParametersDTO) + { + //转换实体 + ContractManageParametersDO contractManageParametersDO = contractManageParametersAssembler.toDO(contractManageParametersDTO); + if(contractManageParametersDTO.getId() != null){ + return toAjax(contractManageParametersApplicationService.update(contractManageParametersDO)); + }else { + return toAjax(contractManageParametersApplicationService.insert(contractManageParametersDO)); + } + } + + /** + * 批量删除合约信息规则维护表 + */ + @ApiOperation("批量删除合约信息规则维护表") + @DeleteMapping("/deleteByIds/{ids}") + public AjaxResult delete(@PathVariable Long[] ids) + { + return toAjax(contractManageParametersApplicationService.delete(ids)); + } + + /** + * 获取合约信息规则维护表详细信息 + */ + @ApiOperation("获取合约信息规则维护表") + @GetMapping(value = "/getInfo/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(contractManageParametersApplicationService.getInfo(id)); + } + + @ApiOperation("Feign保存合约信息规则维护") + @PostMapping("/feignSave") + public AjaxResult feignSave(@RequestBody ContractManageParametersFeign contractManageParametersFeign) + { + try { + ContractManageParametersDTO contractManageParametersDTO = new ContractManageParametersDTO(); + BeanUtils.copyProperties(contractManageParametersFeign, contractManageParametersDTO); + ContractManageParametersDO contractManageParametersDO = contractManageParametersAssembler.toDO(contractManageParametersDTO); + return toAjax(contractManageParametersApplicationService.insert(contractManageParametersDO)); + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } + +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/resources/mapper/basic/ContractManageMapper.xml b/mhd-modules/mhd-system/src/main/resources/mapper/basic/ContractManageMapper.xml index 8055043aa..988aefebd 100644 --- a/mhd-modules/mhd-system/src/main/resources/mapper/basic/ContractManageMapper.xml +++ b/mhd-modules/mhd-system/src/main/resources/mapper/basic/ContractManageMapper.xml @@ -210,6 +210,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and b.FIRST_SUBJECT_CODE = #{contractManageDO.firstSubjectCode} + + and a.renewal_advance_days = #{contractManageDO.renewalAdvanceDays} + + + and a.subject_matter like concat('%', #{contractManageDO.subjectMatter}, '%') + + + and a.nature = #{contractManageDO.nature} + + + and a.initial_start_date = #{contractManageDO.initialStartDate} + \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/resources/mapper/basic/ContractManageParametersMapper.xml b/mhd-modules/mhd-system/src/main/resources/mapper/basic/ContractManageParametersMapper.xml new file mode 100644 index 000000000..ac42df8f6 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/resources/mapper/basic/ContractManageParametersMapper.xml @@ -0,0 +1,53 @@ + + + + + + + + select + * + from contract_manage_parameters + + + + + + and contract_manage_id = #{contractManageId} + + + and top_organization_id = #{topOrganizationId} + + + and organization_id = #{organizationId} + + + and organization_name like concat('%', #{organizationName}, '%') + + + and contract_number like concat('%', #{contractNumber}, '%') + + + and contract_name like concat('%', #{contractName}, '%') + + + + + + + + diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java index 66d41ca11..9b622d0eb 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java @@ -31,6 +31,7 @@ import com.mhd.system.api.SystemServiceFeign; import com.mhd.system.api.UserServiceFeign; import com.mhd.system.api.domain.BatchDetailFeignPO; import com.mhd.system.api.domain.ContractManageFeignDTO; +import com.mhd.system.api.domain.ContractManageParametersFeign; import com.mhd.system.api.domain.WarehouseFeignPO; import com.mhd.system.api.model.LoginUser; import lombok.extern.slf4j.Slf4j; @@ -39,6 +40,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.time.format.DateTimeFormatter; @@ -243,6 +245,7 @@ public class SettlementCustomersApplicationService { /** * 修改结算对象 */ + @Transactional public Boolean update(SettlementCustomersDO settlementCustomersDO) { LoginUser loginUser = SecurityUtils.getLoginUser(); if (ObjectUtil.isNull(loginUser)) { @@ -305,6 +308,7 @@ public class SettlementCustomersApplicationService { contractManageDTO.setContractState(2); contractManageDTO.setPaymentDate(new Date()); contractManageDTO.setBillDays(10); + contractManageDTO.setContractType(1); AjaxResult ajaxResult = systemServiceFeign.feignSave(contractManageDTO); if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) { ContractManageFeignDTO contractManageFeignDTO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), ContractManageFeignDTO.class); @@ -312,6 +316,18 @@ public class SettlementCustomersApplicationService { String originalContractNumber = contractManageFeignDTO.getOriginalContractNumber(); settlementCustomersParameters.setContractManageId(contractManageId); settlementCustomersParameters.setContractNumber(originalContractNumber); + ContractManageParametersFeign contractManageParametersFeign = new ContractManageParametersFeign(); + contractManageParametersFeign.setContractManageId(contractManageId); + contractManageParametersFeign.setContractName(contractManageFeignDTO.getContractName()); + contractManageParametersFeign.setContractNumber(contractManageFeignDTO.getContractNumber()); + contractManageParametersFeign.setParametersJson(settlementCustomersParametersDTO.getContent()); + contractManageParametersFeign.setOrganizationId(settlementCustomersDO.getOrganizationId()); + contractManageParametersFeign.setOrganizationName(settlementCustomersDO.getOrganizationName()); + contractManageParametersFeign.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId()); + AjaxResult paramResult = systemServiceFeign.feignSaveContractParameters(contractManageParametersFeign); + if (paramResult == null || !"200".equals(String.valueOf(paramResult.get("code")))) { + throw new ServiceException("保存合同参数失败"); + } } else { throw new ServiceException("创建临时合同失败"); } diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/service/SettlementCustomersDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/service/SettlementCustomersDomainService.java index e19edf83e..2da9d3ecf 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/service/SettlementCustomersDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/service/SettlementCustomersDomainService.java @@ -5,6 +5,10 @@ import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers; import com.mhd.bms.domain.settlementCustomers.repository.facade.ISettlementCustomersService; import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO; import com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO; +import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig; +import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService; +import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters; +import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService; import com.mhd.common.security.utils.SecurityUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -24,6 +28,11 @@ public class SettlementCustomersDomainService { @Autowired private ISettlementCustomersService settlementCustomersService; + @Autowired + private ISettlementCustomersNcConfigService settlementCustomersNcConfigService; + + @Autowired + private ISettlementCustomersParametersService settlementCustomersParametersService; /** * 分页查询结算对象列表 @@ -64,7 +73,17 @@ public class SettlementCustomersDomainService { */ public SettlementCustomersPO getInfo(Long settlementCustomersId) { - return settlementCustomersService.getInfo(settlementCustomersId); + SettlementCustomersPO info = settlementCustomersService.getInfo(settlementCustomersId); + + LambdaQueryWrapper ncConfigWrapper = new LambdaQueryWrapper<>(); + ncConfigWrapper.eq(SettlementCustomersNcConfig::getSettlementCustomersId, settlementCustomersId); + info.setSettlementCustomersNcConfigs(settlementCustomersNcConfigService.list(ncConfigWrapper)); + + LambdaQueryWrapper parametersWrapper = new LambdaQueryWrapper<>(); + parametersWrapper.eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersId); + info.setSettlementCustomersParameters(settlementCustomersParametersService.list(parametersWrapper)); + + return info; } diff --git a/mhd_oms/pom.xml b/mhd_oms/pom.xml index 0e328f990..170cf7d1f 100644 --- a/mhd_oms/pom.xml +++ b/mhd_oms/pom.xml @@ -127,7 +127,11 @@ com.mhd mhd-common-log - + + com.xuxueli + xxl-job-core + 2.4.0 + diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/facade/IReservationStockInOrderService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/facade/IReservationStockInOrderService.java index 5e62c95f9..068e4b62a 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/facade/IReservationStockInOrderService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/facade/IReservationStockInOrderService.java @@ -66,4 +66,6 @@ public interface IReservationStockInOrderService extends IService queryPushBmsList(); } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/mapper/ReservationStockInOrderMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/mapper/ReservationStockInOrderMapper.java index 8f6078a99..6c3f72dd8 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/mapper/ReservationStockInOrderMapper.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/mapper/ReservationStockInOrderMapper.java @@ -77,4 +77,6 @@ public interface ReservationStockInOrderMapper extends BaseMapper generateReserveOrderNumber1(@Param("prefix") String prefix); int existsByOrderNumber(@Param("inOrderNumber") String inOrderNumber); + + public List queryPushBmsList(); } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java index 26d21686d..d7c311578 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java @@ -770,5 +770,9 @@ public class ReservationStockInOrderImpl extends ServiceImpl queryPushBmsList() { + return stockInOrderMapper.queryPushBmsList(); + } + } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java index fe3a31e02..b84d86932 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java @@ -18,6 +18,8 @@ import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper; import com.mhd.oms.domain.reservationInMaterialDetail.entity.ReservationInMaterialDetail; import com.mhd.oms.domain.reservationInMaterialDetail.repository.mapper.ReservationInMaterialDetailMapper; import com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO; +import com.mhd.oms.domain.reservationMaterialInventory.repository.facade.IReservationMaterialInventoryService; +import com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper; import com.mhd.oms.domain.reservationStockInOrder.entity.ReservationStockInOrder; import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper; import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO; @@ -76,6 +78,8 @@ public class ReservationStockInOrderApplicationService { private ReservationStockInOrderMapper reservationStockInOrderMapper; @Autowired private ReservationInMaterialDetailMapper reservationInMaterialDetailMapper; + @Autowired + private IReservationMaterialInventoryService reservationMaterialInventoryService; // @Autowired // private IMaterialBaseInfoService materialBaseInfoService; private static final String PUSH_API_URL = "http://10.102.192.15/nagu-erp-api/transfer/pushData"; @@ -2285,4 +2289,23 @@ public class ReservationStockInOrderApplicationService { public String generateReserveOrderNumber1() { return stockInOrderDomainService.generateReserveOrderNumber1(); } + + public List queryPushBmsList() { + return stockInOrderDomainService.queryPushBmsList(); + } + + public void pushBillingRecord() { + + //reservationMaterialInventoryService + // 当天应该推送的数据 + List reservationStockInOrderPOS = stockInOrderDomainService.queryPushBmsList(); + if (reservationStockInOrderPOS!=null&&reservationStockInOrderPOS.size()>0){ + for (ReservationStockInOrderPO reservationStockInOrderPO : reservationStockInOrderPOS) { + String inOrderNumber = reservationStockInOrderPO.getInOrderNumber(); + ReservationInMaterialDetail reservationInMaterialDetail = reservationInMaterialDetailMapper.selectOne(new LambdaQueryWrapper() + .eq(ReservationInMaterialDetail::getInOrderNumber, inOrderNumber) + .eq(ReservationInMaterialDetail::getDelFlag, 0)); + } + } + } } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java index 591c799b1..ce5d6f45f 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java @@ -1474,4 +1474,8 @@ public class ReservationStockInOrderDomainService { // 与 generateReserveOrderNumber 收敛为同一套跨表取号逻辑,避免两份实现日后分叉 return generateReserveOrderNumber(); } + + public List queryPushBmsList() { + return stockInOrderService.queryPushBmsList(); + } } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationStockInOrder/ReservationStockInOrderApi.java b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationStockInOrder/ReservationStockInOrderApi.java index e7894a630..623fb7e32 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationStockInOrder/ReservationStockInOrderApi.java +++ b/mhd_oms/src/main/java/com/mhd/oms/interfaces/facade/reservationStockInOrder/ReservationStockInOrderApi.java @@ -16,6 +16,8 @@ import com.mhd.system.api.domain.InMaterialDetail; import com.mhd.system.api.domain.InMaterialDetailTZPD; import com.mhd.system.api.domain.StockInOrder; import com.mhd.system.api.domain.StockInOrderTZPD; +import com.xxl.job.core.context.XxlJobHelper; +import com.xxl.job.core.handler.annotation.XxlJob; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -299,4 +301,24 @@ public class ReservationStockInOrderApi extends BaseController { return AjaxResult.success(stockInOrderApplicationService.generateReserveOrderNumber1()); } + /** + * 1. 简单任务示例(Bean模式) + * 这里的 demoJobHandler 必须和调度中心配置一致 + */ +// @XxlJob("pushBillingRecord") + public void pushBillingRecord() { + // 获取任务参数 + String param = XxlJobHelper.getJobParam(); + logger.info("XXL-JOB 开始入库业务单推送bms计费流水,参数:{}", param); + + try { + stockInOrderApplicationService.pushBillingRecord(); + // 设置任务执行结果 + XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功"); + } catch (Exception e) { + logger.error("XXL-JOB 执行失败", e); + XxlJobHelper.handleFail("入库业务单推送bms计费流水执行失败:" + e.getMessage()); + } + } + } \ No newline at end of file diff --git a/mhd_oms/src/main/resources/mapper/reservationStockInOrder/ReservationStockInOrderMapper.xml b/mhd_oms/src/main/resources/mapper/reservationStockInOrder/ReservationStockInOrderMapper.xml index 8d7578d06..801e14f34 100644 --- a/mhd_oms/src/main/resources/mapper/reservationStockInOrder/ReservationStockInOrderMapper.xml +++ b/mhd_oms/src/main/resources/mapper/reservationStockInOrder/ReservationStockInOrderMapper.xml @@ -688,4 +688,12 @@ + + \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java index 8f6e08d00..ef042c5cc 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java @@ -3,16 +3,21 @@ package com.mhd.wms.application.service.materialInventory; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSONObject; import com.alibaba.nacos.common.utils.CollectionUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.mhd.common.core.exception.ServiceException; import com.mhd.common.core.utils.bean.BeanUtils; import com.mhd.common.core.utils.StringUtils; import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.common.security.utils.SecurityUtils; +import com.mhd.system.api.BmsServiceFeign; import com.mhd.system.api.SystemServiceFeign; import com.mhd.system.api.domain.BatchDetailFeignPO; +import com.mhd.system.api.domain.BusinessDocumentFeign; import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO; import com.mhd.system.api.domain.cache.SystemServiceCacheUtil; import com.mhd.system.api.model.LoginUser; +import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo; +import com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper; import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper; import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO; import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO; @@ -32,9 +37,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.lang.reflect.Field; import java.math.BigDecimal; import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.ZoneId; import java.util.*; import java.util.stream.Collectors; @@ -49,8 +57,10 @@ import java.util.stream.Collectors; public class MaterialInventoryApplicationService { @Autowired private MaterialInventoryDomainService materialInventoryDomainService; - @Autowired + @Resource private SystemServiceFeign systemServiceFeign; + @Resource + private BmsServiceFeign bmsServiceFeign; @Autowired private MaterialInventoryMapper materialInventoryMapper; @Autowired @@ -59,6 +69,8 @@ public class MaterialInventoryApplicationService { private IStockOutOrderService stockOutOrderService; @Autowired private OutMaterialDetailMapper outMaterialDetailMapper; + @Autowired + private MaterialBaseInfoMapper materialBaseInfoMapper; /** @@ -873,4 +885,101 @@ public class MaterialInventoryApplicationService { } } } -} + + public void pushBillingRecord(String shipperId) { + //非首次推送 + List materialInventoryPOS = materialInventoryDomainService.queryPushBms(shipperId); + if (materialInventoryPOS==null || materialInventoryPOS.size()==0) return; + for (MaterialInventoryPO materialInventoryPO : materialInventoryPOS) { + Date createTime = materialInventoryPO.getCreateTime(); + Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId(); + String lotNumber = materialInventoryPO.getLotNumber(); + String inOrderNumber = materialInventoryPO.getInOrderNumber(); + List> monthFee = materialInventoryDomainService.getMonthFee(inOrderNumber, materialBaseInfoId,lotNumber); + if (monthFee == null || monthFee.size()==0) return; + Map feeMap = monthFee.get(0); + //半月仓租 + BigDecimal halfMonthWhFee = (BigDecimal) feeMap.get("halfMonthWhFee"); + //整月仓租 + BigDecimal monthlyWarehouseFee = (BigDecimal) feeMap.get("monthlyWarehouseFee"); + // 判断是否为昨天 + boolean isYesterday = false; + if (createTime != null) { + LocalDate yesterday = LocalDate.now().minusDays(1); + LocalDate createDate = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + isYesterday = yesterday.isEqual(createDate); + } + if (isYesterday) { + //首次计费 需要夫力费 + //库存数量 + BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity(); + //仓租 + BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee); + //夫力费 + BigDecimal manpowerFee = totalWarehouseRent.multiply(new BigDecimal("0.2")); + MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId); + BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); + //火险保费 + BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003")); + + + } else { + //期间付费 不需要夫力费 + //库存数量 + BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity(); + //仓租 + BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee); + MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId); + BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); + //火险保费 + BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003")); + + } + } + } + + + private void buildBusinessDocument(BigDecimal fee, MaterialInventoryPO materialInventoryPO) { + Long shipperId = materialInventoryPO.getShipperId(); + Map shipper = materialInventoryMapper.querySetlleByShipperId(shipperId); + if (shipper == null) { + return; + } + Long settlementCustomersId = (Long) shipper.get("settlementCustomersId"); + Long settlementEntityId = (Long) shipper.get("settlementEntityId"); + String settlementEntity = (String) shipper.get("settlementEntity"); + String settlementCustomersCode = (String) shipper.get("settlementCustomersCode"); + BusinessDocumentFeign businessDocumentFeign = new BusinessDocumentFeign(); + businessDocumentFeign.setBillAmount(fee); + businessDocumentFeign.setOrganizationId(materialInventoryPO.getOrganizationId()); + businessDocumentFeign.setOrganizationName(materialInventoryPO.getOrganizationName()); + businessDocumentFeign.setTopOrganizationId(materialInventoryPO.getTopOrganizationId()); + businessDocumentFeign.setBelongModuleCode("wms"); + businessDocumentFeign.setBelongModule("WMS"); + businessDocumentFeign.setDataSources(1); + businessDocumentFeign.setSettlementEntity(settlementEntity); + businessDocumentFeign.setSettlementCustomersId(settlementCustomersId); + businessDocumentFeign.setSettlementCustomersCode(settlementCustomersCode); + businessDocumentFeign.setDocumentTypeId(5l); + businessDocumentFeign.setDocumentTypeCode("CM_SZ"); + businessDocumentFeign.setDocumentType("仓码散租"); + businessDocumentFeign.setFirstSubjectCode("0D81"); + businessDocumentFeign.setFirstSubjectName("仓租费"); + businessDocumentFeign.setBillingTime(new Date()); + businessDocumentFeign.setServiceItemsCode("CMCZ"); + businessDocumentFeign.setServiceItemsName("干仓仓租"); + businessDocumentFeign.setSettlementWay(1); + Map contract = materialInventoryDomainService.queryContract(materialInventoryPO.getShipperId()); + if (contract == null) {return;} + String contractName = (String) contract.get("contractName"); + String contractNumber = (String) contract.get("contractNumber"); + Long contractManageId = (Long) contract.get("contractManageId"); + businessDocumentFeign.setContractName(contractName); + businessDocumentFeign.setContractNumber(contractNumber); + businessDocumentFeign.setContractManageId(contractManageId); + AjaxResult ajaxResult = bmsServiceFeign.feignSaveBusinessDocument(businessDocumentFeign); + if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code")))) { + log.error("保存业务单据失败: {}", ajaxResult != null ? ajaxResult.get("msg") : "feign调用异常"); + } + } +} \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java index d21794b81..c0da6ea7c 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java @@ -14,6 +14,7 @@ import com.mhd.wms.domain.statementStatistics.todo.ImmediateInventoryDO; import java.math.BigDecimal; import java.util.List; +import java.util.Map; /** * 物料库存Service接口 @@ -120,4 +121,14 @@ public interface IMaterialInventoryService extends IService public void xgkc(MaterialInventoryParamDO materialInventoryParamDO); public void kctzjl(MaterialInventoryParamDO materialInventoryParamDO,String adjustAction,LoginUser loginUser); + + public List queryPushBmsFirst(String shipperId); + + public List queryPushBms(String shipperId); + + public List> getMonthFee(String shipperId, Long materialBaseInfoId,String lotNumber); + + public Map querySetlleByShipperId(Long ShipperId); + + public Map queryContract(Long shipperId); } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java index 4da220e1c..e2a308915 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java @@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Select; import java.math.BigDecimal; import java.util.List; +import java.util.Map; /** * 物料库存Mapper接口 @@ -124,4 +125,15 @@ public interface MaterialInventoryMapper extends BaseMapper MaterialInventoryPO selectByIdWithBatchAttributes(@Param("materialInventoryId") Long materialInventoryId); public void insertReservationInventoryAdjustmentRecord(com.mhd.wms.domain.inventoryAdjustmentRecord.entity.InventoryAdjustmentRecord inventoryAdjustmentRecord); + + + public List queryPushBmsFirst(@Param("shipperId") String shipperId); + + public List queryPushBms(@Param("shipperId") String shipperId); + + public List> getMonthFee(@Param("inOrderNumber") String inOrderNumber,@Param("materialBaseInfoId") Long materialBaseInfoId,@Param("lotNumber") String lotNumber); + + public Map querySetlleByShipperId(@Param("shipperId") Long shipperId); + + public Map queryContract(@Param("shipperId") Long shipperId); } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java index ee83c4cd7..9112fc962 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java @@ -37,6 +37,7 @@ import com.mhd.wms.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO; import com.mhd.wms.domain.shelfMaterialDetail.entity.ShelfMaterialDetail; import com.mhd.wms.domain.statementStatistics.po.ImmediateInventoryPO; import com.mhd.wms.domain.statementStatistics.todo.ImmediateInventoryDO; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -1235,4 +1236,24 @@ public class MaterialInventoryImpl extends ServiceImpl queryPushBmsFirst(String shipperId) { + return materialInventoryMapper.queryPushBmsFirst(shipperId); + } + + public List queryPushBms(String shipperId) { + return materialInventoryMapper.queryPushBms(shipperId); + } + + public List> getMonthFee(String shipperId ,Long materialBaseInfoId,String lotNumber) { + return materialInventoryMapper.getMonthFee(shipperId, materialBaseInfoId,lotNumber); + } + + public Map querySetlleByShipperId(Long shipperId) { + return materialInventoryMapper.querySetlleByShipperId(shipperId); + } + + public Map queryContract(Long shipperId) { + return materialInventoryMapper.queryContract(shipperId); + } } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java index 30eba9147..41db880e6 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java @@ -15,6 +15,7 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.List; +import java.util.Map; /** * 物料库存 @@ -120,4 +121,24 @@ public class MaterialInventoryDomainService { public MaterialInventoryPO selectOneByWhere(MaterialInventoryDO materialInventoryDO) { return materialInventoryService.selectOneByWhere(materialInventoryDO); } -} + + public List queryPushBmsFirst(String shipperId) { + return materialInventoryService.queryPushBmsFirst(shipperId); + } + + public List queryPushBms(String shipperId) { + return materialInventoryService.queryPushBms(shipperId); + } + + public List> getMonthFee(String shipperId,Long materialBaseInfoId,String lotNumber) { + return materialInventoryService.getMonthFee(shipperId,materialBaseInfoId,lotNumber); + } + + public Map querySetlleByShipperId(Long shipperId) { + return materialInventoryService.querySetlleByShipperId(shipperId); + } + + public Map queryContract(Long shipperId) { + return materialInventoryService.queryContract(shipperId); + } +} \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialInventory/MaterialInventoryApi.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialInventory/MaterialInventoryApi.java index 2369c4637..e3ec4f54f 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialInventory/MaterialInventoryApi.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialInventory/MaterialInventoryApi.java @@ -19,6 +19,8 @@ import com.mhd.wms.interfaces.assember.materialInventory.MaterialInventoryAssemb import com.mhd.wms.interfaces.dto.materialInventory.MaterialInventoryDTO; import com.mhd.wms.interfaces.dto.materialInventory.MaterialInventoryQueryListDTO; import com.mhd.wms.util.TongyuOrgUtil; +import com.xxl.job.core.context.XxlJobHelper; +import com.xxl.job.core.handler.annotation.XxlJob; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -262,4 +264,23 @@ public class MaterialInventoryApi extends BaseController { return AjaxResult.success(materialInventoryApplicationService.sumInventoryQuantity(materialInventoryDO)); } + /** + * 1. 简单任务示例(Bean模式) + * 这里的 demoJobHandler 必须和调度中心配置一致 + */ + @XxlJob("pushBillingRecord") + public void pushBillingRecord() { + // 获取任务参数(货主id) + String shipperId = XxlJobHelper.getJobParam(); + logger.info("XXL-JOB 开始入库业务单推送bms计费流水,货主id参数:{}", shipperId); + try { + materialInventoryApplicationService.pushBillingRecord(shipperId); + // 设置任务执行结果 + XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功"); + } catch (Exception e) { + logger.error("XXL-JOB 执行失败", e); + XxlJobHelper.handleFail("入库业务单推送bms计费流水执行失败:" + e.getMessage()); + } + } + } \ No newline at end of file diff --git a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml index cfeb130d3..557093b5e 100644 --- a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml +++ b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml @@ -1691,4 +1691,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{batchNumber}, + + + + + + + + + + + + + \ No newline at end of file From 6108606daa3bf11443c9032392ea7872524732c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 4 Sep 2026 11:11:39 +0800 Subject: [PATCH 03/32] =?UTF-8?q?bms=E6=94=B9=E9=80=A0;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mhd/system/api/BmsServiceFeign.java | 2 +- .../api/domain/BusinessDocumentFeign.java | 6 + mhd-modules/mhd-system/pom.xml | 5 + .../ContractManageApplicationService.java | 99 +++++++ .../service/ContractManageDomainService.java | 9 +- .../entity/MaterialBaseInfo.java | 16 ++ .../repository/po/MaterialBaseInfoPO.java | 16 ++ .../repository/todo/MaterialBaseInfoDO.java | 16 ++ .../entity/MaterialClassify.java | 16 ++ .../repository/po/MaterialClassifyPO.java | 16 ++ .../repository/todo/MaterialClassifyDO.java | 16 ++ .../materialBaseInfo/MaterialBaseInfoDTO.java | 15 ++ .../materialClassify/MaterialClassifyDTO.java | 16 ++ .../contractManage/ContractManageApi.java | 21 ++ .../MaterialClassifyMapper.xml | 7 +- mhd_bms/pom.xml | 6 + .../BillingStatementApplicationService.java | 125 +++++++++ ...SettlementCustomersApplicationService.java | 8 +- .../entity/BillingStatement.java | 3 + .../mapper/BillingStatementMapper.java | 9 +- .../repository/po/BillingStatementPO.java | 2 + .../repository/todo/BillingStatementDO.java | 2 + .../BillingStatementDomainService.java | 27 +- .../entity/BusinessDocument.java | 5 + .../repository/po/BusinessDocumentPO.java | 5 + .../repository/todo/BusinessDocumentDO.java | 5 +- .../BusinessDocumentDomainService.java | 23 +- .../todo/SettlementCustomersDO.java | 4 +- .../billingStatement/BillingStatementDTO.java | 3 +- .../businessDocument/BusinessDocumentDTO.java | 4 + .../SettlementCustomersDTO.java | 4 +- .../facadeApi/BillingStatementApi.java | 23 +- .../facadeApi/BusinessDocumentApi.java | 35 +++ .../mapper/BillingStatementMapper.xml | 12 + .../HandoverTaskOrderApplicationService.java | 17 +- .../MaterialInventoryApplicationService.java | 247 ++++++++++++++++-- .../HandoverTaskOrderDomainService.java | 25 +- .../entity/MaterialBaseInfo.java | 16 ++ .../repository/po/MaterialBaseInfoPO.java | 16 ++ .../repository/todo/MaterialBaseInfoDO.java | 16 ++ .../entity/MaterialInventory.java | 6 + .../facade/IMaterialInventoryService.java | 9 +- .../mapper/MaterialInventoryMapper.java | 6 +- .../persistence/MaterialInventoryImpl.java | 39 ++- .../repository/po/MaterialInventoryPO.java | 6 + .../po/MaterialInventoryQueryListPO.java | 6 + .../repository/todo/MaterialInventoryDO.java | 9 + .../todo/MaterialInventoryQueryListDO.java | 9 + .../MaterialInventoryDomainService.java | 12 +- .../materialBaseInfo/MaterialBaseInfoDTO.java | 16 ++ .../MaterialInventoryDTO.java | 7 + .../MaterialInventoryQueryListDTO.java | 7 + .../MaterialBaseInfoMapper.xml | 7 +- .../MaterialInventoryMapper.xml | 76 +++++- 54 files changed, 1052 insertions(+), 81 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index c46ed32b1..567a2a6c7 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -70,6 +70,6 @@ public interface BmsServiceFeign { @PostMapping("/businessDocumentApi/wholeRentSynchronizationZXF") public AjaxResult wholeRentSynchronizationZXF(@RequestBody BusinessDataPushDTO businessDataPushDTO); - @PostMapping("/businessDocumentApi/save") + @PostMapping("/businessDocumentApi/feignSave") public AjaxResult feignSaveBusinessDocument(@RequestBody BusinessDocumentFeign businessDocumentFeign); } \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BusinessDocumentFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BusinessDocumentFeign.java index a25cdc40c..d460e8f3f 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BusinessDocumentFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/BusinessDocumentFeign.java @@ -194,4 +194,10 @@ public class BusinessDocumentFeign extends BaseVOEntity{ private BigDecimal billingUnitPrice; @ApiModelProperty("nc科目编码") private String ncSubjectCode; + + @ApiModelProperty("是否推送") + private Integer isPush; + + @ApiModelProperty("仓库类型") + private String warehouseType; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/pom.xml b/mhd-modules/mhd-system/pom.xml index 505d9822a..cb2dcc86f 100644 --- a/mhd-modules/mhd-system/pom.xml +++ b/mhd-modules/mhd-system/pom.xml @@ -111,6 +111,11 @@ 2.24 + + com.xuxueli + xxl-job-core + 2.4.0 + 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 b785649b5..ff7c71714 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 @@ -18,6 +18,8 @@ import com.mhd.basic.domain.contractManageDetail.repository.po.ContractManageDet import com.mhd.basic.domain.contractManageDetail.repository.todo.ContractManageDetailDO; import com.mhd.basic.domain.contractManageDetail.service.ContractManageDetailDomainService; import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters; +import com.mhd.basic.domain.contractManageParameters.repository.facade.IContractManageParametersService; +import com.mhd.basic.domain.contractManageParameters.repository.mapper.ContractManageParametersMapper; import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO; import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO; import com.mhd.basic.domain.contractManageParameters.service.ContractManageParametersDomainService; @@ -38,6 +40,8 @@ import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.common.security.utils.SecurityUtils; import com.mhd.system.api.BmsServiceFeign; import com.mhd.system.api.SystemServiceFeign; +import com.mhd.system.api.domain.BusinessDocumentFeign; +import com.mhd.system.api.domain.MaterialInventoryPO; import com.mhd.system.api.domain.SysDictData; import com.mhd.system.api.model.LoginUser; import com.mhd.system.service.ISysDictTypeService; @@ -86,6 +90,10 @@ public class ContractManageApplicationService { @Autowired private ContractManageParametersAssembler contractManageParametersAssembler; + @Autowired + private ContractManageParametersMapper contractManageParametersMapper; + @Autowired + private IContractManageParametersService contractManageParametersService; /** @@ -1275,4 +1283,95 @@ public class ContractManageApplicationService { } return exportList; } + + /* + * 获取结算对象 + * */ + public SettlementCustomersPO getSettlementCustomers(Long shipperId) { + try { + Long topOrganizationId = null; + AjaxResult ajaxResult = bmsServiceFeign.getCustomersInfoBySettlementEntityId(shipperId, topOrganizationId); + if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code"))) || ajaxResult.get("data") == null) { + log.warn("按 settlementEntityId 查询结算对象未成功:shipperId={}, code={}", shipperId, ajaxResult != null ? ajaxResult.get("code") : null); + return null; + } + return JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")), SettlementCustomersPO.class); + } catch (Exception e) { + log.warn("按 settlementEntityId 查询结算对象异常,shipperId={}", shipperId, e); + return null; + } + } + + public void pushContractManageToBms(String shipperId) { + SettlementCustomersPO settlementCustomers = getSettlementCustomers(Long.valueOf(shipperId)); + if (settlementCustomers == null) { + log.warn("pushContractManageToBms 未找到结算对象,shipperId={}", shipperId); + return; + } + Long settlementCustomersId = settlementCustomers.getSettlementCustomersId(); + List contractManages = contractManageMapper.selectList(new LambdaQueryWrapper() + .eq(ContractManage::getContractRentType, "NORMAL") + .eq(ContractManage::getContractState, 2) + .eq(ContractManage::getDelFlag, 1) + .eq(ContractManage::getSettlementCustomersId, settlementCustomers.getSettlementCustomersId())); + if (contractManages == null || contractManages.isEmpty()) { + log.warn("未找到正式合同"); + return; + } + for (ContractManage contractManage : contractManages) { + Long contractManageId = contractManage.getContractManageId(); + ContractManageParameters contractManageParameters = contractManageParametersService.getOne(new LambdaQueryWrapper() + .eq(ContractManageParameters::getContractManageId, contractManageId),false); + if (contractManageParameters == null) { + continue; + } + String parametersJson = contractManageParameters.getParametersJson(); + Map parametersMap = JSON.parseObject(parametersJson, new TypeReference>() {}); + //合约价 + BigDecimal hyj = (BigDecimal) parametersMap.get("hyj"); + buildBusinessDocument(hyj,settlementCustomers,contractManage,"","",""); + } + } + + private void buildBusinessDocument(BigDecimal fee, SettlementCustomersPO settlementCustomers,ContractManage contractManage, String code, String name, String warehouseType) { + + Long settlementCustomersId = settlementCustomers.getSettlementCustomersId(); + Long settlementEntityId = settlementCustomers.getSettlementEntityId(); + String settlementEntity = settlementCustomers.getSettlementEntity(); + String settlementCustomersCode = settlementCustomers.getSettlementCustomersCode(); + BusinessDocumentFeign businessDocumentFeign = new BusinessDocumentFeign(); + businessDocumentFeign.setBillAmount(fee); + businessDocumentFeign.setOrganizationId(contractManage.getOrganizationId()); + businessDocumentFeign.setOrganizationName(contractManage.getOrganizationName()); + businessDocumentFeign.setTopOrganizationId(contractManage.getTopOrganizationId()); + businessDocumentFeign.setBelongModuleCode("wms"); + businessDocumentFeign.setBelongModule("WMS"); + businessDocumentFeign.setDataSources(1); + businessDocumentFeign.setSettlementEntity(settlementEntity); + businessDocumentFeign.setSettlementCustomersId(settlementCustomersId); + businessDocumentFeign.setSettlementCustomersCode(settlementCustomersCode); + businessDocumentFeign.setDocumentTypeId(4l); + businessDocumentFeign.setDocumentTypeCode("CM_ZL"); + businessDocumentFeign.setDocumentType("仓库租赁单"); + businessDocumentFeign.setFirstSubjectCode(code); + businessDocumentFeign.setFirstSubjectName(name); + businessDocumentFeign.setBillingTime(new Date()); + businessDocumentFeign.setServiceItemsCode("GC_CZ"); + businessDocumentFeign.setServiceItemsName("干仓仓租费用"); + businessDocumentFeign.setSettlementWay(1); + businessDocumentFeign.setOriginalBusinessNum(contractManage.getContractNumber()); + businessDocumentFeign.setWarehouseType(warehouseType); + String contractName = contractManage.getContractName(); + String contractNumber = contractManage.getContractNumber(); + Long contractManageId = contractManage.getContractManageId(); + businessDocumentFeign.setContractName(contractName); + businessDocumentFeign.setContractNumber(contractNumber); + businessDocumentFeign.setContractManageId(contractManageId); + businessDocumentFeign.setBusinessFlow(OrderSequence.getOrderCode("LS")); + businessDocumentFeign.setIsPush(1); + AjaxResult ajaxResult = bmsServiceFeign.feignSaveBusinessDocument(businessDocumentFeign); + if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code")))) { + log.error("保存业务单据失败: {}", ajaxResult != null ? ajaxResult.get("msg") : "feign调用异常"); + } + } } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java index 6d1606e88..36e39fc07 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java @@ -23,10 +23,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -244,4 +241,8 @@ public class ContractManageDomainService { } return contractManagePO; } + + public Map getSettlementCustomers(String shipperId) { + + } } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/entity/MaterialBaseInfo.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/entity/MaterialBaseInfo.java index 95a81b9dd..0fa2435d5 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/entity/MaterialBaseInfo.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/entity/MaterialBaseInfo.java @@ -413,4 +413,20 @@ public class MaterialBaseInfo extends BaseVOEntity{ @ApiModelProperty(name = "是否正常物料: 0-是 1-否") private Integer isNormalMaterial; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/repository/po/MaterialBaseInfoPO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/repository/po/MaterialBaseInfoPO.java index b876cb1c2..b07470a04 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/repository/po/MaterialBaseInfoPO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/repository/po/MaterialBaseInfoPO.java @@ -399,4 +399,20 @@ public class MaterialBaseInfoPO extends BaseVOEntity{ @ApiModelProperty(name = "是否正常物料: 0-是 1-否") private Integer isNormalMaterial; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/repository/todo/MaterialBaseInfoDO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/repository/todo/MaterialBaseInfoDO.java index d1e95243e..98e8e43d3 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/repository/todo/MaterialBaseInfoDO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialBaseInfo/repository/todo/MaterialBaseInfoDO.java @@ -405,4 +405,20 @@ public class MaterialBaseInfoDO extends BaseVOEntity{ @ApiModelProperty(name = "是否正常物料: 0-是 1-否") private Integer isNormalMaterial; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/entity/MaterialClassify.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/entity/MaterialClassify.java index 081c81727..1fe580b67 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/entity/MaterialClassify.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/entity/MaterialClassify.java @@ -82,4 +82,20 @@ public class MaterialClassify extends BaseVOEntity{ @Excel(name = "单位") private String unit; + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; + } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/repository/po/MaterialClassifyPO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/repository/po/MaterialClassifyPO.java index 276e24432..4968f3cf1 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/repository/po/MaterialClassifyPO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/repository/po/MaterialClassifyPO.java @@ -89,4 +89,20 @@ public class MaterialClassifyPO extends BaseVOEntity{ @Excel(name = "单位") private String unit; + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; + } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/repository/todo/MaterialClassifyDO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/repository/todo/MaterialClassifyDO.java index 9cc61a2fa..e325f813f 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/repository/todo/MaterialClassifyDO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/materialClassify/repository/todo/MaterialClassifyDO.java @@ -89,4 +89,20 @@ public class MaterialClassifyDO extends BaseVOEntity{ @ApiModelProperty("单位") @Excel(name = "单位") private String unit; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/materialBaseInfo/MaterialBaseInfoDTO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/materialBaseInfo/MaterialBaseInfoDTO.java index 9ab26e7a9..c3d8800d4 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/materialBaseInfo/MaterialBaseInfoDTO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/materialBaseInfo/MaterialBaseInfoDTO.java @@ -385,4 +385,19 @@ public class MaterialBaseInfoDTO extends BaseVOEntity{ @ApiModelProperty(name = "是否正常物料: 0-是 1-否") private Integer isNormalMaterial; + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/materialClassify/MaterialClassifyDTO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/materialClassify/MaterialClassifyDTO.java index 36a18c532..f33082987 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/materialClassify/MaterialClassifyDTO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/materialClassify/MaterialClassifyDTO.java @@ -89,4 +89,20 @@ public class MaterialClassifyDTO extends BaseVOEntity{ @ApiModelProperty("单位") @Excel(name = "单位") private String unit; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file 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 3f671c56d..bbc4bc538 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 @@ -9,6 +9,8 @@ import com.mhd.basic.interfaces.dto.contractManage.ContractManageExportVO; import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceDTO; import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceReturn; import com.mhd.system.api.domain.ContractManageFeignDTO; +import com.xxl.job.core.context.XxlJobHelper; +import com.xxl.job.core.handler.annotation.XxlJob; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -250,4 +252,23 @@ public class ContractManageApi extends BaseController{ util.exportExcel(response, list, "合同导出"); } + + /** + * 1. 简单任务示例(Bean模式) + * 这里的 demoJobHandler 必须和调度中心配置一致 + */ + @XxlJob("pushContractManageToBms") + public void pushContractManageToBms() { + // 获取任务参数(货主id) + String shipperId = XxlJobHelper.getJobParam(); + logger.info("XXL-JOB 开始入库业务单推送bms计费流水,货主id参数:{}", shipperId); + try { + // 设置任务执行结果 + XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功"); + } catch (Exception e) { + logger.error("XXL-JOB 执行失败", e); + XxlJobHelper.handleFail("入库业务单推送bms计费流水执行失败:" + e.getMessage()); + } + } + } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/resources/mapper/basic/materialClassify/MaterialClassifyMapper.xml b/mhd-modules/mhd-system/src/main/resources/mapper/basic/materialClassify/MaterialClassifyMapper.xml index c6879ab23..b1feefbcc 100644 --- a/mhd-modules/mhd-system/src/main/resources/mapper/basic/materialClassify/MaterialClassifyMapper.xml +++ b/mhd-modules/mhd-system/src/main/resources/mapper/basic/materialClassify/MaterialClassifyMapper.xml @@ -27,13 +27,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + select material_classify_id, organization_id, organization_name, top_organization_id, code, name, level, parent_code, parent_name, code_path, name_path, remark, nullify, create_time, create_by, create_by_name, update_time, update_by, - update_by_name, del_flag,CHARGE_STANDARD,unit + update_by_name, del_flag,CHARGE_STANDARD,unit, + monthly_warehouse_rent, half_month_warehouse_rent, monthly_warehouse_rent_unit, half_month_warehouse_rent_unit from material_classify diff --git a/mhd_bms/pom.xml b/mhd_bms/pom.xml index 7ecf1ce39..fa731f470 100644 --- a/mhd_bms/pom.xml +++ b/mhd_bms/pom.xml @@ -94,6 +94,12 @@ DmJdbcDriver18 8.1.1.193 + + + com.xuxueli + xxl-job-core + 2.4.0 + com.alibaba diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index 28104f719..909567b9f 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -3,17 +3,27 @@ package com.mhd.bms.application.server.billingStatement; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.mhd.bms.application.server.billManage.BillManageApplicationService; import com.mhd.bms.domain.billManage.repository.po.BillManagePO; import com.mhd.bms.domain.billManage.service.BillManageDomainService; +import com.mhd.bms.domain.billingStatement.entity.BillingStatement; +import com.mhd.bms.domain.billingStatement.repository.facade.IBillingStatementService; +import com.mhd.bms.domain.billingStatement.repository.mapper.BillingStatementMapper; +import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementADDVO; import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementCollectPO; import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO; import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementCollectDO; import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO; import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService; +import com.mhd.bms.domain.businessDocument.entity.BusinessDocument; +import com.mhd.bms.domain.businessDocument.repository.facade.IBusinessDocumentService; import com.mhd.bms.domain.businessDocument.repository.po.BusinessDocumentPO; import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers; +import com.mhd.bms.domain.settlementCustomers.repository.mapper.SettlementCustomersMapper; import com.mhd.bms.domain.settlementCustomers.service.SettlementCustomersDomainService; +import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters; +import com.mhd.bms.domain.settlementCustomersParameters.repository.mapper.SettlementCustomersParametersMapper; import com.mhd.bms.infrastructure.feign.vo.ContractManagePO; import com.mhd.bms.infrastructure.feign.vo.ExpenseAccountPO; import com.mhd.bms.interfaces.assembler.billingStatement.BillingStatementAssembler; @@ -39,6 +49,7 @@ import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -64,6 +75,16 @@ public class BillingStatementApplicationService { private BillManageApplicationService billManageApplicationService; @Autowired private BillManageDomainService billManageDomainService; + @Autowired + private IBusinessDocumentService businessDocumentService; + @Autowired + private IBillingStatementService billingStatementService; + @Autowired + private BillingStatementMapper billingStatementMapper; + @Autowired + private SettlementCustomersMapper settlementCustomersMapper; + @Autowired + private SettlementCustomersParametersMapper settlementCustomersParametersMapper; /** @@ -631,4 +652,108 @@ public class BillingStatementApplicationService { } return billingStatementDomainService.getBillDetailsList(billingStatementDO); } + + public void pushBillManage(String shipperId) { + SettlementCustomers settlementCustomers = settlementCustomersMapper.selectOne(new LambdaQueryWrapper() + .eq(SettlementCustomers::getSettlementEntityId, shipperId) + .eq(SettlementCustomers::getDelFlag, 1)); + if (ObjectUtil.isNull(settlementCustomers)) { + //未找到结算对象 + return; + } + Long settlementCustomersId = settlementCustomers.getSettlementCustomersId(); + SettlementCustomersParameters settlementCustomersParameters = settlementCustomersParametersMapper.selectOne(new LambdaQueryWrapper() + .eq(SettlementCustomersParameters::getSettlementEntityId, settlementCustomersId)); + if (ObjectUtil.isNull(settlementCustomersParameters)) { + //结算对象未配置参数 + return; + } + String content = settlementCustomersParameters.getContent(); + Map contentMap = JSON.parseObject(content, Map.class); + //主费用开票策略 + String zfycl = (String) contentMap.get("zfycl"); + //附加费用开票策略 + String fjfykpcl = (String) contentMap.get("fjfykpcl"); + //合并开票 + Integer hbcp = (Integer) contentMap.get("hbcp"); + Boolean isMerge = false; + if (hbcp == 1) { + //判断是否合并开票 + isMerge = true; + } + + if (!isMerge) { + List list = businessDocumentService.list(new LambdaQueryWrapper() + .eq(BusinessDocument::getIsPush, 1) + .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) + .eq(BusinessDocument::getBusinessState, 3) + .eq(BusinessDocument::getDelFlag, 1)); + Map> groupedMap = list.stream() + .collect(Collectors.groupingBy(BusinessDocument::getOriginalBusinessNum)); + for (Map.Entry> entry : groupedMap.entrySet()) { + List groupList = entry.getValue(); + String originalBusinessNum = entry.getKey(); + for (BusinessDocument businessDocument : groupList) { + String businessFlow = businessDocument.getBusinessFlow(); + List billingStatements = billingStatementService.list(new LambdaQueryWrapper() + .eq(BillingStatement::getBusinessFlow, businessFlow) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatements != null && billingStatements.size() > 0) { + List billingStatementADDVOS = new ArrayList<>(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "MOP"; + for (BillingStatement billingStatement : billingStatements) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + //未找到费用科目 + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + //审核通过 + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + //生成账单 + generateBills(billingStatementDTO1); + } + } + } + } else { + + } + } } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java index 9b622d0eb..5b8f83044 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java @@ -151,7 +151,7 @@ public class SettlementCustomersApplicationService { settlementCustomersDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); Boolean insert = settlementCustomersDomainService.insert(settlementCustomersDO); if (insert) { - List settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigDTOList(); + List settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigs(); if (CollectionUtil.isNotEmpty(settlementCustomersNcConfigDTOList)) { for (SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO : settlementCustomersNcConfigDTOList) { SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig(); @@ -163,7 +163,7 @@ public class SettlementCustomersApplicationService { settlementCustomersNcConfigService.save(settlementCustomersNcConfig); } } - List settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParametersDTOList(); + List settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParameters(); if (CollectionUtil.isNotEmpty(settlementCustomersParametersDTOList)) { for (SettlementCustomersParametersDTO settlementCustomersParametersDTO : settlementCustomersParametersDTOList) { SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters(); @@ -260,7 +260,7 @@ public class SettlementCustomersApplicationService { //处理数据字典 handleDict(settlementCustomersDO); - List settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigDTOList(); + List settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigs(); if (CollectionUtil.isNotEmpty(settlementCustomersNcConfigDTOList)) { settlementCustomersNcConfigService.remove(new LambdaQueryWrapper() .eq(SettlementCustomersNcConfig::getSettlementCustomersId, settlementCustomersDO.getSettlementCustomersId())); @@ -274,7 +274,7 @@ public class SettlementCustomersApplicationService { settlementCustomersNcConfigService.save(settlementCustomersNcConfig); } } - List settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParametersDTOList(); + List settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParameters(); if (CollectionUtil.isNotEmpty(settlementCustomersParametersDTOList)) { settlementCustomersParametersService.remove(new LambdaQueryWrapper() .eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersDO.getSettlementCustomersId())); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/entity/BillingStatement.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/entity/BillingStatement.java index 98d69bbcf..421de5430 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/entity/BillingStatement.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/entity/BillingStatement.java @@ -222,4 +222,7 @@ public class BillingStatement extends BaseVOEntity{ private BigDecimal billingUnitPrice; @ApiModelProperty("nc科目编码") private String ncSubjectCode; + + @ApiModelProperty("仓储单号") + private String wmsNumber; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/mapper/BillingStatementMapper.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/mapper/BillingStatementMapper.java index f9541d496..48ebf8d60 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/mapper/BillingStatementMapper.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/mapper/BillingStatementMapper.java @@ -1,6 +1,8 @@ package com.mhd.bms.domain.billingStatement.repository.mapper; import java.util.List; +import java.util.Map; + import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mhd.bms.domain.billingStatement.entity.BillingStatement; import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementCollectPO; @@ -42,4 +44,9 @@ public interface BillingStatementMapper extends BaseMapper * 根据账单id,查询流水明细列表 */ List getDetailsByManageId(@Param("billManageId") Long billManageId); -} + + /** + * 查询税率 + */ + Map getTaxRate(@Param("organizationId") Long organizationId, @Param("subjectCode") String subjectCode, @Param("subjectName") String subjectName); +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java index 6a5d308c7..1814d6c10 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java @@ -236,4 +236,6 @@ public class BillingStatementPO extends BaseVOEntity{ private BigDecimal billingUnitPrice; @ApiModelProperty("nc科目编码") private String ncSubjectCode; + @ApiModelProperty("仓储单号") + private String wmsNumber; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java index 23fc1d687..4e7aeb159 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java @@ -254,4 +254,6 @@ public class BillingStatementDO extends BaseVOEntity{ private BigDecimal billingUnitPrice; @ApiModelProperty("nc科目编码") private String ncSubjectCode; + @ApiModelProperty("仓储单号") + private String wmsNumber; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java index 74392e216..4f517b8da 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/service/BillingStatementDomainService.java @@ -396,7 +396,7 @@ public class BillingStatementDomainService { public Boolean generateFlow(BusinessDocumentPO businessDocumentPO) { LoginUser loginUser = SecurityUtils.getLoginUser(); if (ObjectUtil.isNull(loginUser)) { - throw new DigitalLogisticsException(UserError.TIMEOUT); +// throw new DigitalLogisticsException(UserError.TIMEOUT); } BillingStatementDO billingStatementDO = new BillingStatementDO(); String[] ignroreFields = new String[]{"billingStatementId","dataSources","createBy","createByName","createTime","updateBy","updateByName","updateTime"}; @@ -414,13 +414,24 @@ public class BillingStatementDomainService { billingStatementDO.setBillingAmount(businessDocumentPO.getBillAmount()); billingStatementDO.setBillingState(1); billingStatementDO.setDataSources(1); - billingStatementDO.setCreateBy(loginUser.getUserPo().getUserId()); - billingStatementDO.setCreateByName(loginUser.getUserPo().getUserName()); - billingStatementDO.setCreateTime(new Date()); - billingStatementDO.setBillingFlow(businessDocumentPO.getBusinessFlow()); - billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); - billingStatementDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); - billingStatementDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + if (loginUser==null) { + billingStatementDO.setCreateBy(businessDocumentPO.getCreateBy()); + billingStatementDO.setCreateByName(businessDocumentPO.getCreateByName()); + billingStatementDO.setCreateTime(new Date()); + billingStatementDO.setBillingFlow(businessDocumentPO.getBusinessFlow()); + billingStatementDO.setTopOrganizationId(businessDocumentPO.getTopOrganizationId()); + billingStatementDO.setOrganizationId(businessDocumentPO.getOrganizationId()); + billingStatementDO.setOrganizationName(businessDocumentPO.getOrganizationName()); + } else { + billingStatementDO.setCreateBy(loginUser.getUserPo().getUserId()); + billingStatementDO.setCreateByName(loginUser.getUserPo().getUserName()); + billingStatementDO.setCreateTime(new Date()); + billingStatementDO.setBillingFlow(businessDocumentPO.getBusinessFlow()); + billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); + billingStatementDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); + billingStatementDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); + } + //收款帐户信息 billingStatementDO.setPaymentAccountId(businessDocumentPO.getPaymentAccountId()); //收款帐户ID billingStatementDO.setPaymentAccountName(businessDocumentPO.getPaymentAccountName()); //收款帐户名称 diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/entity/BusinessDocument.java b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/entity/BusinessDocument.java index dd740c80f..be7d9c194 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/entity/BusinessDocument.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/entity/BusinessDocument.java @@ -194,4 +194,9 @@ public class BusinessDocument extends BaseVOEntity{ private BigDecimal billingUnitPrice; @ApiModelProperty("nc科目编码") private String ncSubjectCode; + + @ApiModelProperty("是否推送") + private Integer isPush; + @ApiModelProperty("仓库类型") + private String warehouseType; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/po/BusinessDocumentPO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/po/BusinessDocumentPO.java index 66e8a517e..9a4c449c2 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/po/BusinessDocumentPO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/po/BusinessDocumentPO.java @@ -198,4 +198,9 @@ public class BusinessDocumentPO extends BaseVOEntity{ private BigDecimal billingUnitPrice; @ApiModelProperty("nc科目编码") private String ncSubjectCode; + + @ApiModelProperty("是否推送") + private Integer isPush; + @ApiModelProperty("仓库类型") + private String warehouseType; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/todo/BusinessDocumentDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/todo/BusinessDocumentDO.java index 8b2e0e056..fed91cd49 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/todo/BusinessDocumentDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/repository/todo/BusinessDocumentDO.java @@ -218,6 +218,9 @@ public class BusinessDocumentDO extends BaseVOEntity{ private BigDecimal billingUnitPrice; @ApiModelProperty("nc科目编码") private String ncSubjectCode; - private Long billManageId; + @ApiModelProperty("是否推送") + private Integer isPush; + @ApiModelProperty("仓库类型") + private String warehouseType; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/service/BusinessDocumentDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/service/BusinessDocumentDomainService.java index 2ffc4383f..249b8e596 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/service/BusinessDocumentDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/businessDocument/service/BusinessDocumentDomainService.java @@ -121,7 +121,13 @@ public class BusinessDocumentDomainService { public Boolean takeEffectByIds(List businessDocumentIdLongList) { LoginUser loginUser = SecurityUtils.getLoginUser(); if (ObjectUtil.isNull(loginUser)) { - throw new DigitalLogisticsException(UserError.TIMEOUT); + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.set(BusinessDocument::getBusinessState,2); +// updateWrapper.set(BusinessDocument::getUpdateBy,loginUser.getUserPo().getUserId()); +// updateWrapper.set(BusinessDocument::getUpdateTime,new Date()); +// updateWrapper.set(BusinessDocument::getUpdateByName,loginUser.getUserPo().getUserName()); + updateWrapper.in(BusinessDocument::getBusinessDocumentId,businessDocumentIdLongList); + return businessDocumentService.update(updateWrapper); } if(businessDocumentIdLongList != null && businessDocumentIdLongList.size() > 0){ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); @@ -160,7 +166,20 @@ public class BusinessDocumentDomainService { public Boolean auditByIds(List businessDocumentIdLongList, BusinessDocumentDTO businessDocumentDTO) { LoginUser loginUser = SecurityUtils.getLoginUser(); if (ObjectUtil.isNull(loginUser)) { - throw new DigitalLogisticsException(UserError.TIMEOUT); + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + if(businessDocumentDTO.getAuditOperation() == 1){ + //同意 + updateWrapper.set(BusinessDocument::getBusinessState,3); + }else { + //驳回 + updateWrapper.set(BusinessDocument::getBusinessState,4); + } + updateWrapper.set(BusinessDocument::getReviewRemarks,businessDocumentDTO.getReviewRemarks()); +// updateWrapper.set(BusinessDocument::getUpdateBy,loginUser.getUserPo().getUserId()); +// updateWrapper.set(BusinessDocument::getUpdateTime,new Date()); +// updateWrapper.set(BusinessDocument::getUpdateByName,loginUser.getUserPo().getUserName()); + updateWrapper.in(BusinessDocument::getBusinessDocumentId,businessDocumentIdLongList); + return businessDocumentService.update(updateWrapper); } if(businessDocumentIdLongList != null && businessDocumentIdLongList.size() > 0){ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java index 6c90e5c4e..f2753742f 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java @@ -136,9 +136,9 @@ public class SettlementCustomersDO extends BaseVOEntity{ @ApiModelProperty(name = "组织代码") private String orgCode; @ApiModelProperty("结算对象参数") - private List settlementCustomersParametersDTOList; + private List settlementCustomersParameters; @ApiModelProperty("结算对象nc配置") - private List settlementCustomersNcConfigDTOList; + private List settlementCustomersNcConfigs; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java index 855e5040b..1a032f659 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java @@ -264,5 +264,6 @@ public class BillingStatementDTO extends BaseVOEntity{ private BigDecimal billingUnitPrice; @ApiModelProperty("nc科目编码") private String ncSubjectCode; - + @ApiModelProperty("仓储单号") + private String wmsNumber; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/businessDocument/BusinessDocumentDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/businessDocument/BusinessDocumentDTO.java index 3e6a93304..d33f80eef 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/businessDocument/BusinessDocumentDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/businessDocument/BusinessDocumentDTO.java @@ -215,4 +215,8 @@ public class BusinessDocumentDTO extends BaseVOEntity{ private String paymentAccountName; private Long billManageId; + @ApiModelProperty("仓库类型") + private String warehouseType; + @ApiModelProperty("是否推送") + private Integer isPush; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java index ec4c2a180..7c3c7e22a 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java @@ -137,7 +137,7 @@ public class SettlementCustomersDTO extends BaseVOEntity{ private String orgCode; @ApiModelProperty("结算对象参数") - private List settlementCustomersParametersDTOList; + private List settlementCustomersParameters; @ApiModelProperty("结算对象nc配置") - private List settlementCustomersNcConfigDTOList; + private List settlementCustomersNcConfigs; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillingStatementApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillingStatementApi.java index 774f4988d..c1f898c9b 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillingStatementApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillingStatementApi.java @@ -21,6 +21,8 @@ import com.mhd.common.core.exception.ServiceException; import com.mhd.common.core.utils.StringUtils; import com.mhd.common.redis.enums.RedisLockTypeEnum; import com.mhd.common.redis.service.RedisLock; +import com.xxl.job.core.context.XxlJobHelper; +import com.xxl.job.core.handler.annotation.XxlJob; import lombok.extern.slf4j.Slf4j; import org.redisson.RedissonMultiLock; import org.redisson.api.RLock; @@ -327,4 +329,23 @@ public class BillingStatementApi extends BaseController { return getDataTable(list); } -} + /** + * 1. 简单任务示例(Bean模式) + * 这里的 demoJobHandler 必须和调度中心配置一致 + */ + @XxlJob("pushBillManage") + public void pushBillManage() { + // 获取任务参数(货主id) + String shipperId = XxlJobHelper.getJobParam(); + logger.info("XXL-JOB 开始入库业务单推送bms计费流水,货主id参数:{}", shipperId); + try { + billingStatementApplicationService.pushBillManage(shipperId); + // 设置任务执行结果 + XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功"); + } catch (Exception e) { + logger.error("XXL-JOB 执行失败", e); + XxlJobHelper.handleFail("入库业务单推送bms计费流水执行失败:" + e.getMessage()); + } + } + +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BusinessDocumentApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BusinessDocumentApi.java index ad94d9f94..1a3decb57 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BusinessDocumentApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BusinessDocumentApi.java @@ -1,10 +1,15 @@ package com.mhd.bms.interfaces.facadeApi; +import java.util.ArrayList; import java.util.List; import com.mhd.bms.application.server.businessDocument.BusinessDocumentApplicationService; +import com.mhd.bms.domain.businessDocument.entity.BusinessDocument; +import com.mhd.bms.domain.businessDocument.repository.facade.IBusinessDocumentService; +import com.mhd.bms.domain.businessDocument.repository.mapper.BusinessDocumentMapper; import com.mhd.common.core.domain.dto.BusinessDataPushDTO; import com.mhd.common.core.utils.IgnoreNullUtil; +import com.mhd.system.api.domain.BusinessDocumentFeign; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -41,6 +46,9 @@ public class BusinessDocumentApi extends BaseController{ @Resource private BusinessDocumentAssembler businessDocumentAssembler; + @Autowired + private IBusinessDocumentService businessDocumentService; + /** * 分页查询业务单据列表 */ @@ -79,6 +87,33 @@ public class BusinessDocumentApi extends BaseController{ } + + @ApiOperation("保存业务单据") + @PostMapping("/feignSave") + public AjaxResult feignSave(@RequestBody BusinessDocumentFeign businessDocumentFeign) + { + try { + BusinessDocument businessDocumentDO = new BusinessDocument(); + BeanUtils.copyProperties(businessDocumentFeign,businessDocumentDO); + boolean save = businessDocumentService.save(businessDocumentDO); + if (save) { + Long businessDocumentId = businessDocumentDO.getBusinessDocumentId(); + BusinessDocumentDTO businessDocumentDTO = new BusinessDocumentDTO(); + businessDocumentDTO.setBusinessDocumentIds(String.valueOf(businessDocumentId)); + //生效 + takeEffectByIds(businessDocumentDTO); + businessDocumentDTO.setAuditOperation(1); + //审核 + auditByIds(businessDocumentDTO); + } + return toAjax(save); + } catch (ServiceException e) { + return AjaxResult.error(e.getMessage()); + } catch (Exception e){ + return AjaxResult.error("保存业务单据失败:" + e.getMessage()); + } + } + /** * 保存业务单据 */ diff --git a/mhd_bms/src/main/resources/mapper/BillingStatementMapper.xml b/mhd_bms/src/main/resources/mapper/BillingStatementMapper.xml index a7a274c01..82ebab40d 100644 --- a/mhd_bms/src/main/resources/mapper/BillingStatementMapper.xml +++ b/mhd_bms/src/main/resources/mapper/BillingStatementMapper.xml @@ -271,4 +271,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/handoverTaskOrder/HandoverTaskOrderApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/handoverTaskOrder/HandoverTaskOrderApplicationService.java index ffb191f0c..1bae47fdf 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/handoverTaskOrder/HandoverTaskOrderApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/handoverTaskOrder/HandoverTaskOrderApplicationService.java @@ -23,6 +23,8 @@ import com.mhd.wms.domain.handoverTaskOrder.repository.facade.IHandoverTaskOrder import com.mhd.wms.domain.handoverTaskOrder.repository.po.HandoverTaskOrderPO; import com.mhd.wms.domain.handoverTaskOrder.repository.todo.HandoverTaskOrderDO; import com.mhd.wms.domain.handoverTaskOrder.service.HandoverTaskOrderDomainService; +import com.mhd.wms.application.service.materialInventory.MaterialInventoryApplicationService; +import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParamDO; import com.mhd.wms.domain.shiftManage.repository.todo.ShiftManageDO; import com.mhd.wms.domain.stockOutOrder.entity.StockOutOrder; import com.mhd.wms.domain.stockOutOrder.repository.facade.IStockOutOrderService; @@ -33,6 +35,7 @@ import org.springframework.stereotype.Service; import java.text.ParseException; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; /** @@ -58,6 +61,9 @@ public class HandoverTaskOrderApplicationService { @Autowired private IStockOutOrderService stockOutOrderService; + @Autowired + private MaterialInventoryApplicationService materialInventoryApplicationService; + /** * 分页查询交接作业单列表 @@ -200,7 +206,12 @@ public class HandoverTaskOrderApplicationService { * @return Boolean */ public Boolean completeHandover(HandoverTaskOrderDO handoverTaskOrderDO){ - return handoverTaskOrderDomainService.completeHandover(handoverTaskOrderDO); + Boolean result = handoverTaskOrderDomainService.completeHandover(handoverTaskOrderDO); + List clearoutParamDOs = handoverTaskOrderDomainService.getLastClearoutParamDOs(); + for (MaterialInventoryParamDO paramDO : clearoutParamDOs) { + materialInventoryApplicationService.pushBillingRecordClearout(paramDO.getMaterialInventoryId(), paramDO.getQuantity()); + } + return result; } @@ -297,6 +308,10 @@ public class HandoverTaskOrderApplicationService { completeDO.setHandoverTaskOrderIds(handoverTaskOrderIds.stream().map(String::valueOf).collect(Collectors.toList())); completeDO.setBillingJson(handoverTaskOrderDO.getBillingJson()); handoverTaskOrderDomainService.completeHandover(completeDO); + List clearoutParamDOs = handoverTaskOrderDomainService.getLastClearoutParamDOs(); + for (MaterialInventoryParamDO paramDO : clearoutParamDOs) { + materialInventoryApplicationService.pushBillingRecordClearout(paramDO.getMaterialInventoryId(), paramDO.getQuantity()); + } } } } diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java index ef042c5cc..ef0fa1a07 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject; import com.alibaba.nacos.common.utils.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.mhd.common.core.exception.ServiceException; +import com.mhd.common.core.utils.OrderSequence; import com.mhd.common.core.utils.bean.BeanUtils; import com.mhd.common.core.utils.StringUtils; import com.mhd.common.core.web.domain.AjaxResult; @@ -18,6 +19,7 @@ import com.mhd.system.api.domain.cache.SystemServiceCacheUtil; import com.mhd.system.api.model.LoginUser; import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo; import com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper; +import com.mhd.wms.domain.materialInventory.entity.MaterialInventory; import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper; import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO; import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO; @@ -33,6 +35,7 @@ import com.mhd.wms.domain.outMaterialDetail.repository.mapper.OutMaterialDetailM import com.mhd.wms.domain.stockOutOrder.repository.facade.IStockOutOrderService; import com.mhd.wms.domain.stockOutOrder.repository.po.StockOutOrderPO; import com.mhd.wms.util.BatchNoTokenUtil; +import com.xxl.job.core.handler.annotation.XxlJob; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -43,6 +46,7 @@ import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.ZoneId; +import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; @@ -886,16 +890,36 @@ public class MaterialInventoryApplicationService { } } - public void pushBillingRecord(String shipperId) { - //非首次推送 - List materialInventoryPOS = materialInventoryDomainService.queryPushBms(shipperId); - if (materialInventoryPOS==null || materialInventoryPOS.size()==0) return; - for (MaterialInventoryPO materialInventoryPO : materialInventoryPOS) { - Date createTime = materialInventoryPO.getCreateTime(); - Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId(); - String lotNumber = materialInventoryPO.getLotNumber(); - String inOrderNumber = materialInventoryPO.getInOrderNumber(); + //推送清仓计费记录 + public void pushBillingRecordClearout(Long materialInventoryId,BigDecimal quantity) { + + MaterialInventory materialInventory = materialInventoryMapper.selectById(materialInventoryId); + MaterialInventoryPO materialInventoryPO = new MaterialInventoryPO(); + BeanUtils.copyProperties(materialInventory, materialInventoryPO); + //未查询到库存记录 + Long shipperId = materialInventoryPO.getShipperId(); + Date createTime = materialInventoryPO.getCreateTime(); + Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId(); + String lotNumber = materialInventoryPO.getLotNumber(); + String inOrderNumber = materialInventoryPO.getInOrderNumber(); + Long warehouseId = materialInventoryPO.getWarehouseId(); + Date lastBillingTime = materialInventoryPO.getLastBillingTime(); + if (warehouseId==19) {//干仓计费 + Map shipperParameters = materialInventoryDomainService.queryShipperParameters(shipperId,"干仓计费配置"); + //客户未配置干仓计费配置 + if (shipperParameters == null || shipperParameters.size()==0) return; + Long contractManageId = (Long) shipperParameters.get("contractManageId"); + Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId"); + String contractNumber = (String) shipperParameters.get("contractNumber"); + String content = (String) shipperParameters.get("content"); + Map contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>(); + Integer sfzdcz = (Integer) contentMap.get("sfzdcz"); + //客户未配置或是否自动推送设置为否 + if (sfzdcz==null) return; + if (sfzdcz!=1) return; + //计算费用 List> monthFee = materialInventoryDomainService.getMonthFee(inOrderNumber, materialBaseInfoId,lotNumber); + //入库业务单未设置每月仓租 if (monthFee == null || monthFee.size()==0) return; Map feeMap = monthFee.get(0); //半月仓租 @@ -912,7 +936,7 @@ public class MaterialInventoryApplicationService { if (isYesterday) { //首次计费 需要夫力费 //库存数量 - BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity(); + BigDecimal inventoryQuantity = quantity; //仓租 BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee); //夫力费 @@ -921,7 +945,9 @@ public class MaterialInventoryApplicationService { BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); //火险保费 BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003")); - + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓"); + buildBusinessDocument(manpowerFee, materialInventoryPO,"0D082","夫力费",contractManageId,"干仓"); + buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓"); } else { //期间付费 不需要夫力费 @@ -933,13 +959,188 @@ public class MaterialInventoryApplicationService { BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); //火险保费 BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003")); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"冻仓"); + buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"冻仓"); + } + } else if (warehouseId==20) {//冻仓计费 + Map shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置"); + if (shipperParameters == null || shipperParameters.size()==0) return; + Long contractManageId = (Long) shipperParameters.get("contractManageId"); + Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId"); + String contractNumber = (String) shipperParameters.get("contractNumber"); + String content = (String) shipperParameters.get("content"); + Map contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>(); + Integer sfzdcz = (Integer) contentMap.get("sfzdcz"); + //客户未配置或是否自动推送设置为否 + if (sfzdcz==null) return; + if (sfzdcz!=1) return; + //计算费用 + MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId); + BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); + String materialClassifyId = materialBaseInfo.getMaterialClassifyId(); + BigDecimal weightLimit = materialBaseInfo.getWeightLimit(); + Map materialClassify = materialInventoryDomainService.queryMaterialClassify(Long.valueOf(materialClassifyId)); + //物料分类不存在 + if (materialClassify == null || materialClassify.size()==0) return; + BigDecimal monthlyWarehouseRent = (BigDecimal) materialClassify.get("monthlyWarehouseRent"); + BigDecimal halfMonthWarehouseRent = (BigDecimal) materialClassify.get("halfMonthWarehouseRent"); + String monthlyWarehouseRentUnit = (String) materialClassify.get("monthlyWarehouseRentUnit"); + String halfMonthWarehouseRentUnit = (String) materialClassify.get("halfMonthWarehouseRentUnit"); + //半月仓租 + BigDecimal halfMonthWhFee = halfMonthWarehouseRent; + //整月仓租 + BigDecimal monthlyWarehouseFee = monthlyWarehouseRent; + long daysDiff = 0; + if (lastBillingTime != null) { + LocalDate lastBillingDate = lastBillingTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + daysDiff = ChronoUnit.DAYS.between(lastBillingDate, LocalDate.now()); + } else { + daysDiff = -1; + } + BigDecimal inventoryQuantity = quantity; + if (daysDiff < 15) { + // 不足半月: 收半月仓租 + BigDecimal totalWarehouseRent = inventoryQuantity.multiply(halfMonthWhFee).multiply(weightLimit); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓"); + } else { + // 大于等于半月: 收整月仓租 + BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee).multiply(weightLimit); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓"); + } + //更新最后计费时间 + Long id = materialInventoryPO.getMaterialInventoryId(); + MaterialInventory Inventory = materialInventoryMapper.selectById(id); + Inventory.setLastBillingTime(new Date()); + materialInventoryMapper.updateById(Inventory); + } + } + public void pushBillingRecord(String shipperId) { + + List materialInventoryPOS = materialInventoryDomainService.queryPushBms(shipperId); + //未查询到库存记录 + if (materialInventoryPOS==null || materialInventoryPOS.size()==0) return; + for (MaterialInventoryPO materialInventoryPO : materialInventoryPOS) { + Date createTime = materialInventoryPO.getCreateTime(); + Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId(); + String lotNumber = materialInventoryPO.getLotNumber(); + String inOrderNumber = materialInventoryPO.getInOrderNumber(); + Long warehouseId = materialInventoryPO.getWarehouseId(); + Date lastBillingTime = materialInventoryPO.getLastBillingTime(); + if (warehouseId==19) {//干仓计费 + Map shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"干仓计费配置"); + //客户未配置干仓计费配置 + if (shipperParameters == null || shipperParameters.size()==0) continue; + Long contractManageId = (Long) shipperParameters.get("contractManageId"); + Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId"); + String contractNumber = (String) shipperParameters.get("contractNumber"); + String content = (String) shipperParameters.get("content"); + Map contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>(); + Integer sfzdcz = (Integer) contentMap.get("sfzdcz"); + //客户未配置或是否自动推送设置为否 + if (sfzdcz==null) continue; + if (sfzdcz!=1) continue; + //计算费用 + List> monthFee = materialInventoryDomainService.getMonthFee(inOrderNumber, materialBaseInfoId,lotNumber); + //入库业务单未设置每月仓租 + if (monthFee == null || monthFee.size()==0) continue; + Map feeMap = monthFee.get(0); + //半月仓租 + BigDecimal halfMonthWhFee = (BigDecimal) feeMap.get("halfMonthWhFee"); + //整月仓租 + BigDecimal monthlyWarehouseFee = (BigDecimal) feeMap.get("monthlyWarehouseFee"); + // 判断是否为昨天 + boolean isYesterday = false; + if (createTime != null) { + LocalDate yesterday = LocalDate.now().minusDays(1); + LocalDate createDate = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + isYesterday = yesterday.isEqual(createDate); + } + if (isYesterday) { + //首次计费 需要夫力费 + //库存数量 + BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity(); + //仓租 + BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee); + //夫力费 + BigDecimal manpowerFee = totalWarehouseRent.multiply(new BigDecimal("0.2")); + MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId); + BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); + //火险保费 + BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003")); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓"); + buildBusinessDocument(manpowerFee, materialInventoryPO,"0D082","夫力费",contractManageId,"干仓"); + buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓"); + + } else { + //期间付费 不需要夫力费 + //库存数量 + BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity(); + //仓租 + BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee); + MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId); + BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); + //火险保费 + BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003")); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓"); + buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓"); + } + } else if (warehouseId==20) {//冻仓计费 + Map shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置"); + if (shipperParameters == null || shipperParameters.size()==0) continue; + Long contractManageId = (Long) shipperParameters.get("contractManageId"); + Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId"); + String contractNumber = (String) shipperParameters.get("contractNumber"); + String content = (String) shipperParameters.get("content"); + Map contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>(); + Integer sfzdcz = (Integer) contentMap.get("sfzdcz"); + //客户未配置或是否自动推送设置为否 + if (sfzdcz==null) continue; + if (sfzdcz!=1) continue; + //计算费用 + MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId); + BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); + String materialClassifyId = materialBaseInfo.getMaterialClassifyId(); + BigDecimal weightLimit = materialBaseInfo.getWeightLimit(); + Map materialClassify = materialInventoryDomainService.queryMaterialClassify(Long.valueOf(materialClassifyId)); + //物料分类不存在 + if (materialClassify == null || materialClassify.size()==0) continue; + BigDecimal monthlyWarehouseRent = (BigDecimal) materialClassify.get("monthlyWarehouseRent"); + BigDecimal halfMonthWarehouseRent = (BigDecimal) materialClassify.get("halfMonthWarehouseRent"); + String monthlyWarehouseRentUnit = (String) materialClassify.get("monthlyWarehouseRentUnit"); + String halfMonthWarehouseRentUnit = (String) materialClassify.get("halfMonthWarehouseRentUnit"); + //半月仓租 + BigDecimal halfMonthWhFee = halfMonthWarehouseRent; + //整月仓租 + BigDecimal monthlyWarehouseFee = monthlyWarehouseRent; + long daysDiff = 0; + if (lastBillingTime != null) { + LocalDate lastBillingDate = lastBillingTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + daysDiff = ChronoUnit.DAYS.between(lastBillingDate, LocalDate.now()); + } else { + daysDiff = -1; + } + BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity(); + if (daysDiff < 15) { + // 不足半月: 收半月仓租 + BigDecimal totalWarehouseRent = inventoryQuantity.multiply(halfMonthWhFee).multiply(weightLimit); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓"); + } else { + // 大于等于半月: 收整月仓租 + BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee).multiply(weightLimit); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓"); + } + //更新最后计费时间 + Long materialInventoryId = materialInventoryPO.getMaterialInventoryId(); + MaterialInventory materialInventory = materialInventoryMapper.selectById(materialInventoryId); + materialInventory.setLastBillingTime(new Date()); + materialInventoryMapper.updateById(materialInventory); } } } - private void buildBusinessDocument(BigDecimal fee, MaterialInventoryPO materialInventoryPO) { + private void buildBusinessDocument(BigDecimal fee, MaterialInventoryPO materialInventoryPO,String code,String name,Long contractManageId,String warehouseType) { Long shipperId = materialInventoryPO.getShipperId(); Map shipper = materialInventoryMapper.querySetlleByShipperId(shipperId); if (shipper == null) { @@ -960,23 +1161,27 @@ public class MaterialInventoryApplicationService { businessDocumentFeign.setSettlementEntity(settlementEntity); businessDocumentFeign.setSettlementCustomersId(settlementCustomersId); businessDocumentFeign.setSettlementCustomersCode(settlementCustomersCode); - businessDocumentFeign.setDocumentTypeId(5l); - businessDocumentFeign.setDocumentTypeCode("CM_SZ"); - businessDocumentFeign.setDocumentType("仓码散租"); - businessDocumentFeign.setFirstSubjectCode("0D81"); - businessDocumentFeign.setFirstSubjectName("仓租费"); + businessDocumentFeign.setDocumentTypeId(4l); + businessDocumentFeign.setDocumentTypeCode("CM_ZL"); + businessDocumentFeign.setDocumentType("仓库租赁单"); + businessDocumentFeign.setFirstSubjectCode(code); + businessDocumentFeign.setFirstSubjectName(name); businessDocumentFeign.setBillingTime(new Date()); - businessDocumentFeign.setServiceItemsCode("CMCZ"); - businessDocumentFeign.setServiceItemsName("干仓仓租"); + businessDocumentFeign.setServiceItemsCode("GC_CZ"); + businessDocumentFeign.setServiceItemsName("干仓仓租费用"); businessDocumentFeign.setSettlementWay(1); - Map contract = materialInventoryDomainService.queryContract(materialInventoryPO.getShipperId()); + businessDocumentFeign.setOriginalBusinessNum(materialInventoryPO.getInOrderNumber()); + businessDocumentFeign.setWarehouseType(warehouseType); + businessDocumentFeign.setOriginalBusinessNum(materialInventoryPO.getInOrderNumber()); + Map contract = materialInventoryDomainService.queryContract(contractManageId); if (contract == null) {return;} String contractName = (String) contract.get("contractName"); String contractNumber = (String) contract.get("contractNumber"); - Long contractManageId = (Long) contract.get("contractManageId"); businessDocumentFeign.setContractName(contractName); businessDocumentFeign.setContractNumber(contractNumber); businessDocumentFeign.setContractManageId(contractManageId); + businessDocumentFeign.setBusinessFlow(OrderSequence.getOrderCode("LS")); + businessDocumentFeign.setIsPush(1); AjaxResult ajaxResult = bmsServiceFeign.feignSaveBusinessDocument(businessDocumentFeign); if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code")))) { log.error("保存业务单据失败: {}", ajaxResult != null ? ajaxResult.get("msg") : "feign调用异常"); diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/handoverTaskOrder/service/HandoverTaskOrderDomainService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/handoverTaskOrder/service/HandoverTaskOrderDomainService.java index e9ecea6d7..458e444e0 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/handoverTaskOrder/service/HandoverTaskOrderDomainService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/handoverTaskOrder/service/HandoverTaskOrderDomainService.java @@ -351,7 +351,7 @@ public class HandoverTaskOrderDomainService { } LoginUser loginUser = SecurityUtils.getLoginUser(); //修改库存 - xgkc(handoverTaskOrderIds,loginUser); + List clearoutParamDOs = xgkc(handoverTaskOrderIds,loginUser); //推送oms(需报关的单子等海关确认放行后再推) for (Long handoverTaskOrderId : handoverTaskOrderIds) { // HandoverTaskOrder hto = handoverTaskOrderService.getById(handoverTaskOrderId); @@ -371,6 +371,7 @@ public class HandoverTaskOrderDomainService { } HandoverTaskOrder handoverTaskOrder = handoverTaskOrderService.getById(handoverTaskOrderIds.get(0)); stockOutOrderService.update(null,new UpdateWrapper().lambda().set(StockOutOrder::getBillingJson,handoverTaskOrderDO.getBillingJson()).eq(StockOutOrder::getOutOrderNumber,handoverTaskOrder.getOrderNumber())); + this.lastClearoutParamDOs = clearoutParamDOs; return handoverTaskOrderService.update(null, new UpdateWrapper().lambda() .set(HandoverTaskOrder::getStatus, 2) .set(HandoverTaskOrder::getUpdateBy, loginUser.getUserid()) @@ -398,11 +399,18 @@ public class HandoverTaskOrderDomainService { @Autowired private ICopyCodeReferenceService copyCodeReferenceService; - public synchronized void xgkc(List handoverTaskOrderIds,LoginUser loginUser) { + private List lastClearoutParamDOs = new ArrayList<>(); + + public List getLastClearoutParamDOs() { + return lastClearoutParamDOs; + } + + public synchronized List xgkc(List handoverTaskOrderIds,LoginUser loginUser) { + List allClearoutParamDOs = new ArrayList<>(); for (Long handoverTaskOrderId : handoverTaskOrderIds) { HandoverTaskOrder handoverTaskOrder = handoverTaskOrderService.getById(handoverTaskOrderId); if (handoverTaskOrder == null) { - return; + continue; } //交接完成节点修改库存 String orderNumber = handoverTaskOrder.getOrderNumber(); @@ -422,15 +430,17 @@ public class HandoverTaskOrderDomainService { //完成交接状态改为已出库 stockOutOrder.setStatus(9); stockOutOrderMapper.updateById(stockOutOrder); - doStockOutDeduct(orderNumber, stockOutOrder, loginUser); + allClearoutParamDOs.addAll(doStockOutDeduct(orderNumber, stockOutOrder, loginUser)); } + return allClearoutParamDOs; } /** * 出库扣减:同步OMS明细 + 联单状态 + 扣实物库存 + 推OMS库存 * (从 xgkc 抽取,供「不需报关交接」和「海关确认」两处复用) */ - private void doStockOutDeduct(String orderNumber, StockOutOrder stockOutOrder, LoginUser loginUser) { + private List doStockOutDeduct(String orderNumber, StockOutOrder stockOutOrder, LoginUser loginUser) { + List clearoutParamDOs = new ArrayList<>(); List outMaterialDetailList = outMaterialDetailMapper.selectList(new QueryWrapper().lambda() .eq(OutMaterialDetail::getOutOrderNumber, orderNumber) .eq(OutMaterialDetail::getDelFlag, 1)); @@ -489,16 +499,17 @@ public class HandoverTaskOrderDomainService { materialInventoryOmsParamDO.setLoginUser(loginUser); if (stockOutOrder != null && !"yang_pin_chu_ku".equals(stockOutOrder.getBusinessType())) { materialInventoryService.kctzjl(materialInventoryParamDO,"出库",loginUser); - materialInventoryService.xgkc(materialInventoryParamDO); + clearoutParamDOs.addAll(materialInventoryService.xgkc(materialInventoryParamDO)); //库存推送oms omsServiceFeign.omsEdit(materialInventoryOmsParamDO); } } } + return clearoutParamDOs; } // /** -// * 定时任务入口:每小时整点扫描「已交接(13)」状态的需报关出库单,调 sendDec 查报关结果, +// * 定时任务入口 // * 放行/结关的 → 状态 13→9 + 扣库存 + 推OMS;未放行 → 跳过下次再查。 // * 由 @Scheduled 触发,无需在 sys_job 表配置。 // */ diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/entity/MaterialBaseInfo.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/entity/MaterialBaseInfo.java index a227976e3..f81f97f5b 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/entity/MaterialBaseInfo.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/entity/MaterialBaseInfo.java @@ -243,4 +243,20 @@ public class MaterialBaseInfo extends BaseVOEntity { @ApiModelProperty(name = "是否正常物料: 0-是 1-否") private Integer isNormalMaterial; + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; + } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/repository/po/MaterialBaseInfoPO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/repository/po/MaterialBaseInfoPO.java index 0f7b436ba..7181779d5 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/repository/po/MaterialBaseInfoPO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/repository/po/MaterialBaseInfoPO.java @@ -292,4 +292,20 @@ public class MaterialBaseInfoPO extends BaseVOEntity { @ApiModelProperty(name = "是否正常物料: 0-是 1-否") private Integer isNormalMaterial; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/repository/todo/MaterialBaseInfoDO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/repository/todo/MaterialBaseInfoDO.java index a0976ccac..c27b6eb77 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/repository/todo/MaterialBaseInfoDO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialBaseInfo/repository/todo/MaterialBaseInfoDO.java @@ -265,4 +265,20 @@ public class MaterialBaseInfoDO extends BaseVOEntity { @ApiModelProperty(name = "是否正常物料: 0-是 1-否") private Integer isNormalMaterial; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/entity/MaterialInventory.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/entity/MaterialInventory.java index 22cd47527..6fd394b4b 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/entity/MaterialInventory.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/entity/MaterialInventory.java @@ -236,4 +236,10 @@ public class MaterialInventory extends BaseVOEntity { @Excel(name = "LOT编号") private String lotNumber; + @ApiModelProperty("上次计费时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date lastBillingTime; + } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java index c0da6ea7c..7168ca15b 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java @@ -15,6 +15,7 @@ import com.mhd.wms.domain.statementStatistics.todo.ImmediateInventoryDO; import java.math.BigDecimal; import java.util.List; import java.util.Map; +import java.util.Set; /** * 物料库存Service接口 @@ -118,7 +119,7 @@ public interface IMaterialInventoryService extends IService * type 类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结) * materialInventoryId 物料库存ID * */ - public void xgkc(MaterialInventoryParamDO materialInventoryParamDO); + public List xgkc(MaterialInventoryParamDO materialInventoryParamDO); public void kctzjl(MaterialInventoryParamDO materialInventoryParamDO,String adjustAction,LoginUser loginUser); @@ -130,5 +131,9 @@ public interface IMaterialInventoryService extends IService public Map querySetlleByShipperId(Long ShipperId); - public Map queryContract(Long shipperId); + public Map queryContract(Long contractManageId); + + public Map queryShipperParameters(Long shipperId,String parametersName); + + Map queryMaterialClassify(Long id); } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java index e2a308915..7e0ed1acc 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java @@ -135,5 +135,9 @@ public interface MaterialInventoryMapper extends BaseMapper public Map querySetlleByShipperId(@Param("shipperId") Long shipperId); - public Map queryContract(@Param("shipperId") Long shipperId); + public Map queryContract(@Param("contractManageId") Long contractManageId); + + public Map queryShipperParameters(@Param("shipperId") Long shipperId,@Param("parametersName") String parametersName); + + public Map queryMaterialClassify(@Param("id") Long id); } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java index 9112fc962..d60537952 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java @@ -544,7 +544,7 @@ public class MaterialInventoryImpl extends ServiceImpl xgkc(MaterialInventoryParamDO materialInventoryParamDO) { BigDecimal netWeight = materialInventoryParamDO.getNetWeight() != null ? materialInventoryParamDO.getNetWeight() : BigDecimal.ZERO; BigDecimal grossWeight = materialInventoryParamDO.getGrossWeight() != null ? materialInventoryParamDO.getGrossWeight() : BigDecimal.ZERO; BigDecimal volume = materialInventoryParamDO.getVolume() != null ? materialInventoryParamDO.getVolume() : BigDecimal.ZERO; @@ -552,6 +552,7 @@ public class MaterialInventoryImpl extends ServiceImpl clearoutList = new ArrayList<>(); //类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结) switch (type) { @@ -569,7 +570,10 @@ public class MaterialInventoryImpl extends ServiceImpl queryContract(Long shipperId) { - return materialInventoryMapper.queryContract(shipperId); + public Map queryContract(Long contractManageId) { + return materialInventoryMapper.queryContract(contractManageId); + } + + public Map queryShipperParameters(Long shipperId,String parametersName) { + return materialInventoryMapper.queryShipperParameters(shipperId,parametersName); + } + + @Override + public Map queryMaterialClassify(Long id) { + return materialInventoryMapper.queryMaterialClassify(id); } } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryPO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryPO.java index dd8fafbb0..15bd2ecff 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryPO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryPO.java @@ -233,4 +233,10 @@ public class MaterialInventoryPO extends MaterialBasePO { @ApiModelProperty("规格型号") @Excel(name = "规格型号") private String specificationModel; + + @ApiModelProperty("上次计费时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date lastBillingTime; } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryQueryListPO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryQueryListPO.java index 92005c41f..09a74729f 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryQueryListPO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryQueryListPO.java @@ -288,4 +288,10 @@ public class MaterialInventoryQueryListPO extends MaterialBasePO { @ApiModelProperty("总面积(SQM),PDA 表单区显示") private BigDecimal totalArea; + + @ApiModelProperty("上次计费时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date lastBillingTime; } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryDO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryDO.java index a5b752277..e022564df 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryDO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryDO.java @@ -271,4 +271,13 @@ public class MaterialInventoryDO extends MaterialBaseDO { @ApiModelProperty("库存分配匹配:Batch Ref NO's token 列表(默认不启用,仅显式赋值时参与匹配)") private List batchRefNoList; + + @ApiModelProperty("上次计费时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date lastBillingTime; + + private String lastBillingTimeStart; + private String lastBillingTimeEnd; } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryQueryListDO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryQueryListDO.java index f9b6056f6..092a25075 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryQueryListDO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryQueryListDO.java @@ -268,4 +268,13 @@ public class MaterialInventoryQueryListDO extends MaterialBaseDO { private String updateTimeStart; private String updateTimeEnd; + + @ApiModelProperty("上次计费时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date lastBillingTime; + + private String lastBillingTimeStart; + private String lastBillingTimeEnd; } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java index 41db880e6..95a0b8718 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java @@ -138,7 +138,15 @@ public class MaterialInventoryDomainService { return materialInventoryService.querySetlleByShipperId(shipperId); } - public Map queryContract(Long shipperId) { - return materialInventoryService.queryContract(shipperId); + public Map queryContract(Long contractManageId) { + return materialInventoryService.queryContract(contractManageId); + } + + public Map queryShipperParameters(Long shipperId,String parametersName) { + return materialInventoryService.queryShipperParameters(shipperId,parametersName); + } + + public Map queryMaterialClassify(Long id) { + return materialInventoryService.queryMaterialClassify(id); } } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialBaseInfo/MaterialBaseInfoDTO.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialBaseInfo/MaterialBaseInfoDTO.java index 85c38d9e5..a7d894c67 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialBaseInfo/MaterialBaseInfoDTO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialBaseInfo/MaterialBaseInfoDTO.java @@ -316,4 +316,20 @@ public class MaterialBaseInfoDTO extends BaseVOEntity { private String orgId; @ApiModelProperty(name = "是否正常物料: 0-是 1-否") private Integer isNormalMaterial; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryDTO.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryDTO.java index 2c5009552..86f9df456 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryDTO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryDTO.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; +import java.util.Date; import java.util.List; /** @@ -203,4 +204,10 @@ public class MaterialInventoryDTO extends MaterialBaseDTO { private String updateTimeStart; private String updateTimeEnd; + @ApiModelProperty("上次计费时间") + private Date lastBillingTime; + + private String lastBillingTimeStart; + private String lastBillingTimeEnd; + } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryQueryListDTO.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryQueryListDTO.java index 490d8c868..e6b8e0f46 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryQueryListDTO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryQueryListDTO.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; +import java.util.Date; import java.util.List; /** @@ -201,4 +202,10 @@ public class MaterialInventoryQueryListDTO extends MaterialBaseDTO { private String updateTimeStart; private String updateTimeEnd; + + @ApiModelProperty("上次计费时间") + private Date lastBillingTime; + + private String lastBillingTimeStart; + private String lastBillingTimeEnd; } \ No newline at end of file diff --git a/mhd_wms/src/main/resources/mapper/materialBaseInfo/MaterialBaseInfoMapper.xml b/mhd_wms/src/main/resources/mapper/materialBaseInfo/MaterialBaseInfoMapper.xml index 7f4bc7e12..da19ff069 100644 --- a/mhd_wms/src/main/resources/mapper/materialBaseInfo/MaterialBaseInfoMapper.xml +++ b/mhd_wms/src/main/resources/mapper/materialBaseInfo/MaterialBaseInfoMapper.xml @@ -69,6 +69,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + @@ -78,7 +82,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_shape_name, a.material_size, a.material_length, a.material_width, a.material_height, a.remark, a.nullify, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag, a.common, sku_code, a.unit_price, a.currency, a.origin_country, a.hs_code, a.declaration_unit, a.statutory_unit, a.statutory_second_unit, a.copy_code, a.push_status,a.push_time,a.push_by,a.goods_type,a.gross_weight,a.push_by_name,a.unit,a.INSURE_AMOUNT,a.CHARGE_STANDARD, - specification_model as specification_model,nvl(b.stock_qty,0) as stock_quantity,c.charge_standard as charge_standard_class,a.is_normal_material + specification_model as specification_model,nvl(b.stock_qty,0) as stock_quantity,c.charge_standard as charge_standard_class,a.is_normal_material, + a.monthly_warehouse_rent, a.half_month_warehouse_rent, a.monthly_warehouse_rent_unit, a.half_month_warehouse_rent_unit from material_base_info a left join ( select material_base_info_id, sum(INVENTORY_QUANTITY) as stock_qty from MATERIAL_INVENTORY group by material_base_info_id diff --git a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml index 557093b5e..1c2c95561 100644 --- a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml +++ b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml @@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -88,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.BATCH_REF_NO, a.SHEET_REF_NO, a.BOX_PALLET_NO,nvl(a.unit_name,b.unit_name) as unit_name, a.bar_code as inv_bar_code, a.in_order_number,a.lot_number, + a.last_billing_time, CASE WHEN IFNULL(sum(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END as sort_order @@ -112,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.BATCH_REF_NO, a.SHEET_REF_NO, a.BOX_PALLET_NO,nvl(a.unit_name,b.unit_name) as unit_name, a.bar_code as inv_bar_code, a.in_order_number,a.lot_number, + a.last_billing_time, CASE WHEN IFNULL(sum(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END as sort_order @@ -263,6 +266,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and a.expiry_date DATEADD(DAY, 1, #{expiryDateEnd}) + + and a.last_billing_time >= #{lastBillingTimeStart} + + + and a.last_billing_time DATEADD(DAY, 1, #{lastBillingTimeEnd}) + @@ -381,6 +390,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and mi.BOX_PALLET_NO like concat('%', #{boxPalletNo}, '%') + + and mi.last_billing_time >= #{lastBillingTimeStart} + + + and mi.last_billing_time DATEADD(DAY, 1, #{lastBillingTimeEnd}) + @@ -1725,21 +1743,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + \ No newline at end of file From c25a9a5f68e388eae4059d5c98be869a1a4d45c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 4 Sep 2026 14:06:48 +0800 Subject: [PATCH 04/32] =?UTF-8?q?=E5=8F=9130?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 567a2a6c7..252a6a5d2 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -19,7 +19,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.31:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.33:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 6a9fd6081..cf92dfb8a 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://127.0.0.1:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.32:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { From 5a329904c3129fb2b7fd2c116cc9731219bc3cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 4 Sep 2026 15:40:19 +0800 Subject: [PATCH 05/32] =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E5=90=88=E5=90=8C?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mhd/system/api/BmsServiceFeign.java | 6 ++ .../RemoteBmsFeignFallbackFactory.java | 5 ++ .../po/SettlementCustomersParametersPO.java | 58 ++++++++++++ .../ContractManageApplicationService.java | 89 +++++++++++++++---- .../service/ContractManageDomainService.java | 2 - .../contractManage/ContractManageApi.java | 1 + ...CustomersParametersApplicationService.java | 9 +- ...ISettlementCustomersParametersService.java | 7 +- .../SettlementCustomersParametersImpl.java | 16 +++- ...ementCustomersParametersDomainService.java | 9 +- .../SettlementCustomersParametersApi.java | 11 ++- 11 files changed, 187 insertions(+), 26 deletions(-) create mode 100644 mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/domain/po/SettlementCustomersParametersPO.java diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 252a6a5d2..caf732f29 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -72,4 +72,10 @@ public interface BmsServiceFeign { @PostMapping("/businessDocumentApi/feignSave") public AjaxResult feignSaveBusinessDocument(@RequestBody BusinessDocumentFeign businessDocumentFeign); + + /** + * 根据结算对象id查询结算对象参数列表 + */ + @GetMapping("/settlementCustomersParametersApi/getListBySettlementCustomersId") + AjaxResult getListBySettlementCustomersId(@RequestParam("settlementCustomersId") Long settlementCustomersId); } \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java index 091297e45..e6b97690d 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java @@ -72,6 +72,11 @@ public class RemoteBmsFeignFallbackFactory implements FallbackFactory getSettlementCustomersParameters(Long settlementCustomersId) { + try { + AjaxResult ajaxResult = bmsServiceFeign.getListBySettlementCustomersId(settlementCustomersId); + if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code"))) || ajaxResult.get("data") == null) { + log.warn("按 settlementCustomersId 查询结算对象参数未成功:settlementCustomersId={}, code={}", settlementCustomersId, ajaxResult != null ? ajaxResult.get("code") : null); + return null; + } + return JSON.parseArray(JSON.toJSONString(ajaxResult.get("data")), SettlementCustomersParametersPO.class); + } catch (Exception e) { + log.warn("按 settlementCustomersId 查询结算对象参数异常,settlementCustomersId={}", settlementCustomersId, e); + return null; + } + } + public void pushContractManageToBms(String shipperId) { SettlementCustomersPO settlementCustomers = getSettlementCustomers(Long.valueOf(shipperId)); if (settlementCustomers == null) { @@ -1309,31 +1326,65 @@ public class ContractManageApplicationService { return; } Long settlementCustomersId = settlementCustomers.getSettlementCustomersId(); - List contractManages = contractManageMapper.selectList(new LambdaQueryWrapper() - .eq(ContractManage::getContractRentType, "NORMAL") - .eq(ContractManage::getContractState, 2) - .eq(ContractManage::getDelFlag, 1) - .eq(ContractManage::getSettlementCustomersId, settlementCustomers.getSettlementCustomersId())); - if (contractManages == null || contractManages.isEmpty()) { - log.warn("未找到正式合同"); + List parametersList = getSettlementCustomersParameters(settlementCustomersId); + if (parametersList == null || parametersList.isEmpty()) { + log.warn("pushContractManageToBms 未找到结算对象参数,settlementCustomersId={}", settlementCustomersId); return; } - for (ContractManage contractManage : contractManages) { - Long contractManageId = contractManage.getContractManageId(); - ContractManageParameters contractManageParameters = contractManageParametersService.getOne(new LambdaQueryWrapper() - .eq(ContractManageParameters::getContractManageId, contractManageId),false); - if (contractManageParameters == null) { + + for (SettlementCustomersParametersPO param : parametersList) { + String parametersName = param.getParametersName(); + String content = param.getContent(); + if (StringUtils.isEmpty(content)) { + log.warn("结算对象参数 content 为空,parametersName={}, settlementCustomersId={}", parametersName, settlementCustomersId); continue; } - String parametersJson = contractManageParameters.getParametersJson(); - Map parametersMap = JSON.parseObject(parametersJson, new TypeReference>() {}); - //合约价 - BigDecimal hyj = (BigDecimal) parametersMap.get("hyj"); - buildBusinessDocument(hyj,settlementCustomers,contractManage,"","",""); + Map contentMap = JSON.parseObject(content, new TypeReference>() {}); + Integer sfzdcz = Integer.valueOf(contentMap.get("sfzdcz").toString()); + if (sfzdcz != 1) { + log.info("结算对象参数 sfzdcz 不为1,跳过推送,parametersName={}, sfzdcz={}", parametersName, sfzdcz); + continue; + } + + String warehouseTempLayerType; + String serviceItemsName; + if ("冻仓计费配置".equals(parametersName)) { + warehouseTempLayerType = "DC"; + serviceItemsName = "冻仓仓租费用"; + } else if ("干仓计费配置".equals(parametersName)) { + warehouseTempLayerType = "GC"; + serviceItemsName = "干仓仓租费用"; + } else { + log.warn("未知的结算对象参数类型,parametersName={}", parametersName); + continue; + } + + List contractManages = contractManageMapper.selectList(new LambdaQueryWrapper() + .eq(ContractManage::getContractRentType, "NORMAL") + .eq(ContractManage::getContractState, 2) + .eq(ContractManage::getDelFlag, 1) + .eq(ContractManage::getSettlementCustomersId, settlementCustomersId) + .eq(ContractManage::getWarehouseTempLayerType, warehouseTempLayerType)); + if (contractManages == null || contractManages.isEmpty()) { + log.warn("未找到正式合同,warehouseTempLayerType={}, settlementCustomersId={}", warehouseTempLayerType, settlementCustomersId); + continue; + } + for (ContractManage contractManage : contractManages) { + Long contractManageId = contractManage.getContractManageId(); + ContractManageParameters contractManageParameters = contractManageParametersService.getOne(new LambdaQueryWrapper() + .eq(ContractManageParameters::getContractManageId, contractManageId), false); + if (contractManageParameters == null) { + continue; + } + String parametersJson = contractManageParameters.getParametersJson(); + Map parametersMap = JSON.parseObject(parametersJson, new TypeReference>() {}); + BigDecimal hyj = (BigDecimal) parametersMap.get("hyj"); + buildBusinessDocument(hyj, settlementCustomers, contractManage, "0D081", "干仓仓租费用", warehouseTempLayerType, serviceItemsName); + } } } - private void buildBusinessDocument(BigDecimal fee, SettlementCustomersPO settlementCustomers,ContractManage contractManage, String code, String name, String warehouseType) { + private void buildBusinessDocument(BigDecimal fee, SettlementCustomersPO settlementCustomers, ContractManage contractManage, String code, String name, String warehouseType, String serviceItemsName) { Long settlementCustomersId = settlementCustomers.getSettlementCustomersId(); Long settlementEntityId = settlementCustomers.getSettlementEntityId(); @@ -1357,7 +1408,7 @@ public class ContractManageApplicationService { businessDocumentFeign.setFirstSubjectName(name); businessDocumentFeign.setBillingTime(new Date()); businessDocumentFeign.setServiceItemsCode("GC_CZ"); - businessDocumentFeign.setServiceItemsName("干仓仓租费用"); + businessDocumentFeign.setServiceItemsName(serviceItemsName); businessDocumentFeign.setSettlementWay(1); businessDocumentFeign.setOriginalBusinessNum(contractManage.getContractNumber()); businessDocumentFeign.setWarehouseType(warehouseType); diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java index 36e39fc07..d48b02d9e 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/service/ContractManageDomainService.java @@ -242,7 +242,5 @@ public class ContractManageDomainService { return contractManagePO; } - public Map getSettlementCustomers(String shipperId) { - } } \ No newline at end of file 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 bbc4bc538..71b3dde17 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 @@ -263,6 +263,7 @@ public class ContractManageApi extends BaseController{ String shipperId = XxlJobHelper.getJobParam(); logger.info("XXL-JOB 开始入库业务单推送bms计费流水,货主id参数:{}", shipperId); try { + contractManageApplicationService.pushContractManageToBms(shipperId); // 设置任务执行结果 XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功"); } catch (Exception e) { diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersParameters/SettlementCustomersParametersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersParameters/SettlementCustomersParametersApplicationService.java index 47959ecc6..3863fb2d7 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersParameters/SettlementCustomersParametersApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomersParameters/SettlementCustomersParametersApplicationService.java @@ -84,4 +84,11 @@ public class SettlementCustomersParametersApplicationService { Long[] ids = idSet.stream().map(Long::valueOf).toArray(Long[]::new); return settlementCustomersParametersDomainService.delete(ids); } -} + + /** + * 根据结算对象id查询结算对象参数列表 + */ + public List getListBySettlementCustomersId(Long settlementCustomersId) { + return settlementCustomersParametersDomainService.getListBySettlementCustomersId(settlementCustomersId); + } +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/facade/ISettlementCustomersParametersService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/facade/ISettlementCustomersParametersService.java index 97a8a3840..68b91c32e 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/facade/ISettlementCustomersParametersService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/facade/ISettlementCustomersParametersService.java @@ -39,4 +39,9 @@ public interface ISettlementCustomersParametersService extends IService getListBySettlementCustomersId(Long settlementCustomersId); +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/persistence/SettlementCustomersParametersImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/persistence/SettlementCustomersParametersImpl.java index 51f397a5c..60b582c73 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/persistence/SettlementCustomersParametersImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/repository/persistence/SettlementCustomersParametersImpl.java @@ -1,5 +1,6 @@ package com.mhd.bms.domain.settlementCustomersParameters.repository.persistence; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters; import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService; @@ -12,6 +13,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * 结算对象参数Service业务层处理 @@ -78,4 +80,16 @@ public class SettlementCustomersParametersImpl extends ServiceImpl getListBySettlementCustomersId(Long settlementCustomersId) { + List list = this.list(new LambdaQueryWrapper() + .eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersId) + .eq(SettlementCustomersParameters::getDelFlag, 1)); + return list.stream().map(item -> { + SettlementCustomersParametersPO po = new SettlementCustomersParametersPO(); + BeanUtils.copyProperties(item, po); + return po; + }).collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/service/SettlementCustomersParametersDomainService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/service/SettlementCustomersParametersDomainService.java index 683bde910..69012b64b 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/service/SettlementCustomersParametersDomainService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomersParameters/service/SettlementCustomersParametersDomainService.java @@ -56,4 +56,11 @@ public class SettlementCustomersParametersDomainService { public SettlementCustomersParametersPO getInfo(Long id) { return settlementCustomersParametersService.getInfo(id); } -} + + /** + * 根据结算对象id查询结算对象参数列表 + */ + public List getListBySettlementCustomersId(Long settlementCustomersId) { + return settlementCustomersParametersService.getListBySettlementCustomersId(settlementCustomersId); + } +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersParametersApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersParametersApi.java index 8e0a67ca9..8d24ecfb3 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersParametersApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersParametersApi.java @@ -89,4 +89,13 @@ public class SettlementCustomersParametersApi extends BaseController { public AjaxResult getInfoById(SettlementCustomersParametersDTO settlementCustomersParametersDTO) { return AjaxResult.success(settlementCustomersParametersApplicationService.getInfo(settlementCustomersParametersDTO.getId())); } -} + + /** + * 根据结算对象id查询结算对象参数列表 + */ + @ApiOperation("根据结算对象id查询结算对象参数列表") + @GetMapping(value = "/getListBySettlementCustomersId") + public AjaxResult getListBySettlementCustomersId(@RequestParam("settlementCustomersId") Long settlementCustomersId) { + return AjaxResult.success(settlementCustomersParametersApplicationService.getListBySettlementCustomersId(settlementCustomersId)); + } +} \ No newline at end of file From befdb82b536ca9790fb535098c5d1624a646641b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 4 Sep 2026 19:16:57 +0800 Subject: [PATCH 06/32] =?UTF-8?q?=E8=81=94=E6=9F=A5=E5=90=88=E5=90=8C?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContractManageApplicationService.java | 198 ++++++++- .../repository/util/HttpWebServiceUtil.java | 96 +++++ .../contractManage/ContractManageApi.java | 14 + .../BillingStatementApplicationService.java | 386 +++++++++++++++++- .../MaterialInventoryApplicationService.java | 24 +- 5 files changed, 688 insertions(+), 30 deletions(-) create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/HttpWebServiceUtil.java 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 65157c931..2d8034d60 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 @@ -4,6 +4,7 @@ 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.JSONArray; import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -11,6 +12,7 @@ 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.repository.util.HttpWebServiceUtil; import com.mhd.basic.domain.contractManage.service.ContractManageDomainService; import com.mhd.basic.domain.contractManageDetail.entity.ContractManageDetail; import com.mhd.basic.domain.contractManageDetail.repository.mapper.ContractManageDetailMapper; @@ -1348,12 +1350,14 @@ public class ContractManageApplicationService { String warehouseTempLayerType; String serviceItemsName; + Boolean isGc = false; if ("冻仓计费配置".equals(parametersName)) { warehouseTempLayerType = "DC"; serviceItemsName = "冻仓仓租费用"; } else if ("干仓计费配置".equals(parametersName)) { warehouseTempLayerType = "GC"; serviceItemsName = "干仓仓租费用"; + isGc=true; } else { log.warn("未知的结算对象参数类型,parametersName={}", parametersName); continue; @@ -1379,7 +1383,7 @@ public class ContractManageApplicationService { String parametersJson = contractManageParameters.getParametersJson(); Map parametersMap = JSON.parseObject(parametersJson, new TypeReference>() {}); BigDecimal hyj = (BigDecimal) parametersMap.get("hyj"); - buildBusinessDocument(hyj, settlementCustomers, contractManage, "0D081", "干仓仓租费用", warehouseTempLayerType, serviceItemsName); + buildBusinessDocument(hyj, settlementCustomers, contractManage, "0D01", "租金(固定租)", warehouseTempLayerType, serviceItemsName); } } } @@ -1425,4 +1429,196 @@ public class ContractManageApplicationService { log.error("保存业务单据失败: {}", ajaxResult != null ? ajaxResult.get("msg") : "feign调用异常"); } } + + + private static final String WEBSERVICE_URL = "http://10.33.0.116:8080/sys/webservice/ngLegalByFindWebserviceService"; + + public List getContractNosByCompanyName(String companyName) { + List contractNos = new ArrayList<>(); + + try { + log.info("=== 开始查询合同编号 ==="); + log.info("查询公司: {}", companyName); + + // 1. 构建JSON参数 - 使用绝对正确的格式 + String fdRelativePersonJson = "{\"fdName\":\"" + companyName + "\"}"; + log.info("JSON参数: {}", fdRelativePersonJson); + + // 2. 构建XML请求 - 使用和Postman完全相同的格式 + String httpRequest = buildXmlRequest(companyName); + log.info("XML请求: {}", httpRequest); + log.info("XML请求生成完成,长度: {} 字符", httpRequest.length()); + + // 3. 调用WebService + log.info("正在调用WebService..."); + String httpResponse = HttpWebServiceUtil.callWebService(httpRequest, WEBSERVICE_URL); + + // 4. 提取JSON - 使用更可靠的提取方法 + String jsonData = extractJsonFromResponse(httpResponse); + + log.info("正在解析JSON..."+jsonData); + //jsonData内容 +// { +// "returnState": "2", +// "data": [ +// { +// "contract_Id": "16f830763e15793f5aafab14b309075c", +// "contract_Name": "档案保管服务协议", +// "contract_No": "HT20200108130", +// "contract_Total": 134323.36, +// "contract_Star": "20181101", +// "contract_End": "20231101", +// "contract_relative": [ +// { +// "relativeName": "珠海通宇物流有限公司" +// } +// ], +// "contract_Operator": "蔡振燕", +// "contract_capitalFlows": "支出", +// "contract_SigningName": "南光置业有限公司-本部", +// "contract_pay": [], +// "contract_purchases": [] +// } +// ] +// } + + if (jsonData == null || jsonData.trim().isEmpty()) { + log.warn("未提取到JSON数据,返回空列表"); + return contractNos; + } + + log.info("提取到JSON数据,长度: {} 字符", jsonData.length()); + + // 5. 解析JSON + List result = parseContractNosFromJson(jsonData); + contractNos.addAll(result); + + log.info("=== 查询完成 ==="); + log.info("找到 {} 个合同编号", contractNos.size()); + + } catch (Exception e) { + log.error("查询合同编号失败", e); + throw new RuntimeException("查询合同编号失败: " + e.getMessage(), e); + } + + return contractNos; + } + + /** + * 构建XML请求 - 硬编码确保和Postman完全一致 + */ + private String buildXmlRequest(String companyName) { + // 使用和Postman完全相同的格式 + String jsonParam = "{\"fdName\":\"" + companyName + "\"}"; + + return "" + + "" + + "" + + "" + + "" + + "1" + + "10" + + "" + + "" + + "NA0301" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; + } + + /** + * 从SOAP响应中提取JSON + */ + private String extractJsonFromResponse(String soapResponse) { + if (soapResponse == null || soapResponse.isEmpty()) { + return null; + } + + // 直接查找JSON部分 + int jsonStart = soapResponse.indexOf("{\"returnState\":"); + int jsonEnd = soapResponse.indexOf("}"); + + if (jsonStart != -1 && jsonEnd != -1) { + // 找到JSON结束位置 + jsonEnd = jsonEnd + 1; // 包含右大括号 + + String json = soapResponse.substring(jsonStart, jsonEnd); + log.info("直接提取JSON成功"); + return json; + } + + // 备用方法:查找标签 + int start = soapResponse.indexOf(""); + int end = soapResponse.indexOf(""); + + if (start != -1 && end != -1) { + start += "".length(); + String json = soapResponse.substring(start, end); + + // 解码XML实体 + json = json.replace("<", "<") + .replace(">", ">") + .replace("&", "&") + .replace(""", "\"") + .replace("'", "'"); + + log.info("从标签提取JSON成功"); + return json.trim(); + } + + log.warn("无法从响应中提取JSON"); + return null; + } + + /** + * 解析JSON获取合同编号 + */ + private List parseContractNosFromJson(String jsonData) { + List contractNos = new ArrayList<>(); + + try { + com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(jsonData); + + // 检查返回状态 + String returnState = jsonObject.getString("returnState"); + if (!"2".equals(returnState)) { + log.warn("返回状态异常: {}", returnState); + return contractNos; + } + + // 获取data数组 + JSONArray dataArray = jsonObject.getJSONArray("data"); + if (dataArray == null || dataArray.isEmpty()) { + log.info("查询成功,但未找到合同数据"); + return contractNos; + } + + log.info("找到 {} 个合同", dataArray.size()); + + // 遍历提取合同编号 + for (int i = 0; i < dataArray.size(); i++) { + com.alibaba.fastjson.JSONObject contract = dataArray.getJSONObject(i); + String contractNo = contract.getString("contract_No"); + String contractName = contract.getString("contract_Name"); + + if (contractNo != null && !contractNo.trim().isEmpty()) { + contractNos.add(contractNo.trim() + " " + contractName.trim()); + log.info("合同 {}: {}", i + 1, contractNo); + } else { + log.warn("第 {} 个合同没有编号", i + 1); + } + } + + } catch (Exception e) { + log.error("JSON解析失败", e); + log.error("原始JSON: {}", jsonData); + } + + return contractNos; + } } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/HttpWebServiceUtil.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/HttpWebServiceUtil.java new file mode 100644 index 000000000..e3294b304 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/HttpWebServiceUtil.java @@ -0,0 +1,96 @@ +package com.mhd.basic.domain.contractManage.repository.util; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.*; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.Collections; +import java.util.zip.GZIPInputStream; + +@Slf4j +@Component +public class HttpWebServiceUtil { + + /** + * 调用HTTP WebService + */ + public static String callWebService(String requestBody, String endpointUrl) { + try { + // 创建RestTemplate + RestTemplate restTemplate = new RestTemplate(); + + // 设置请求头 + HttpHeaders headers = new HttpHeaders(); +// headers.setContentType(MediaType.TEXT_XML); +// headers.setAccept(Collections.singletonList(MediaType.TEXT_XML)); + headers.setContentType(MediaType.parseMediaType("text/xml; charset=UTF-8")); // 核心修复 + headers.setAccept(Collections.singletonList(MediaType.ALL)); + headers.set("SOAPAction", ""); + headers.set("User-Agent", "PostmanRuntime/7.26.10"); + headers.set("Cache-Control", "no-cache"); + headers.set("Accept-Encoding", "gzip, deflate"); + headers.set("Connection", "keep-alive"); + + // 创建请求实体 + HttpEntity entity = new HttpEntity<>(requestBody, headers); + + log.info("发送请求到: {}", endpointUrl); + + // 发送请求 + ResponseEntity response = restTemplate.exchange( + endpointUrl, + HttpMethod.POST, + entity, + byte[].class + ); + + log.info("响应状态: {}", response.getStatusCode()); + + // 处理响应 + byte[] rawResponse = response.getBody(); + if (rawResponse == null) { + return ""; + } + + // 检查是否gzip压缩 + String contentEncoding = response.getHeaders().getFirst("Content-Encoding"); + String responseBody; + + if ("gzip".equalsIgnoreCase(contentEncoding)) { + responseBody = decompressGzip(rawResponse); + log.info("已解压gzip响应,长度: {} 字符", responseBody.length()); + } else { + responseBody = new String(rawResponse, StandardCharsets.UTF_8); + log.info("响应长度: {} 字符", responseBody.length()); + } + + return responseBody; + + } catch (Exception e) { + log.error("WebService调用失败", e); + throw new RuntimeException("WebService调用失败: " + e.getMessage(), e); + } + } + + /** + * 解压缩GZIP内容 + */ + private static String decompressGzip(byte[] compressedData) throws IOException { + try (GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(compressedData)); + InputStreamReader reader = new InputStreamReader(gis, StandardCharsets.UTF_8)) { + + StringBuilder sb = new StringBuilder(); + char[] buffer = new char[1024]; + int len; + while ((len = reader.read(buffer)) != -1) { + sb.append(buffer, 0, len); + } + return sb.toString(); + } + } +} \ No newline at end of file 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 71b3dde17..003ed148f 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 @@ -8,6 +8,7 @@ import com.mhd.basic.interfaces.assember.contractManage.ContractManageAssembler; import com.mhd.basic.interfaces.dto.contractManage.ContractManageExportVO; import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceDTO; import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceReturn; +import com.mhd.common.core.utils.sms.Result; import com.mhd.system.api.domain.ContractManageFeignDTO; import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.handler.annotation.XxlJob; @@ -272,4 +273,17 @@ public class ContractManageApi extends BaseController{ } } + + + /** + * 根据公司名称获取合同编号列表 + * @param companyName 公司名称 + * @return 合同编号列表 + */ + @GetMapping("/contractNos") + public AjaxResult getContractNosByCompanyName(@RequestParam String companyName) { + contractManageApplicationService.getContractNosByCompanyName(companyName); + return AjaxResult.success(); + } + } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index 909567b9f..e31712d19 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -663,7 +663,8 @@ public class BillingStatementApplicationService { } Long settlementCustomersId = settlementCustomers.getSettlementCustomersId(); SettlementCustomersParameters settlementCustomersParameters = settlementCustomersParametersMapper.selectOne(new LambdaQueryWrapper() - .eq(SettlementCustomersParameters::getSettlementEntityId, settlementCustomersId)); + .eq(SettlementCustomersParameters::getSettlementEntityId, settlementCustomersId) + .eq(SettlementCustomersParameters::getParametersName, "干仓计费配置")); if (ObjectUtil.isNull(settlementCustomersParameters)) { //结算对象未配置参数 return; @@ -683,16 +684,42 @@ public class BillingStatementApplicationService { } if (!isMerge) { - List list = businessDocumentService.list(new LambdaQueryWrapper() - .eq(BusinessDocument::getIsPush, 1) - .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) - .eq(BusinessDocument::getBusinessState, 3) - .eq(BusinessDocument::getDelFlag, 1)); - Map> groupedMap = list.stream() - .collect(Collectors.groupingBy(BusinessDocument::getOriginalBusinessNum)); - for (Map.Entry> entry : groupedMap.entrySet()) { - List groupList = entry.getValue(); - String originalBusinessNum = entry.getKey(); + //按入仓单和收费事项分开计费 + if ("warehouse_receipt".equals(zfycl) && "fee_item".equals(fjfykpcl)) { + calcReceiptAndItemSeparately(settlementCustomersId); + } + //按合同和收费事项分开计费 + else if ("project_monthly".equals(zfycl) && "fee_item".equals(fjfykpcl)) { + calcContractAndItemSeparately(settlementCustomersId); + } + } else { + //按入仓单和收费事项合并计费 + if ("warehouse_receipt".equals(zfycl) && "fee_item".equals(fjfykpcl)) { + mergeCalcByReceiptAndItem(settlementCustomersId); + } + //按合同和收费事项合并计费 + else if ("project_monthly".equals(zfycl) && "fee_item".equals(fjfykpcl)) { + mergeCalcByContractAndItem(settlementCustomersId); + } + } + } + + /* + * 按入仓单和收费事项分开计费 + * */ + public void calcReceiptAndItemSeparately(Long settlementCustomersId) { + List list = businessDocumentService.list(new LambdaQueryWrapper() + .eq(BusinessDocument::getBelongModuleCode, "干仓") + .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) + .eq(BusinessDocument::getBusinessState, 3) + .eq(BusinessDocument::getDelFlag, 1)); + Map> groupedMap = list.stream() + .collect(Collectors.groupingBy(BusinessDocument::getFirstSubjectCode)); + for (Map.Entry> entry : groupedMap.entrySet()) { + List groupList = entry.getValue(); + String firstSubject = entry.getKey(); + if ("0D01".equals(firstSubject)) { + //主费用 for (BusinessDocument businessDocument : groupList) { String businessFlow = businessDocument.getBusinessFlow(); List billingStatements = billingStatementService.list(new LambdaQueryWrapper() @@ -704,21 +731,19 @@ public class BillingStatementApplicationService { List billingStatementIdList = new ArrayList<>(); BigDecimal allAmount = BigDecimal.ZERO; BigDecimal allFreeFee = BigDecimal.ZERO; - String settlementCurrency = "MOP"; + String settlementCurrency = "CNY"; for (BillingStatement billingStatement : billingStatements) { settlementCurrency = billingStatement.getSettlementCurrency(); String firstSubjectCode = billingStatement.getFirstSubjectCode(); String firstSubjectName = billingStatement.getFirstSubjectName(); Long organizationId = billingStatement.getOrganizationId(); Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); - //未找到费用科目 if (taxRateMap == null) continue; Double taxRate = (Double) taxRateMap.get("taxRate"); Long billingStatementId = billingStatement.getBillingStatementId(); BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); billingStatementDTO.setAuditOperation(1); - //审核通过 reviewBilling(billingStatementDTO); BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); @@ -747,13 +772,340 @@ public class BillingStatementApplicationService { billingStatementDTO1.setTaxFreeFee(allFreeFee); billingStatementDTO1.setSettlementCurrency(settlementCurrency); billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); - //生成账单 generateBills(billingStatementDTO1); } } - } - } else { + } else { + //附加费用 + List businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList()); + List billingStatementList = billingStatementService.list(new LambdaQueryWrapper() + .in(BillingStatement::getBusinessFlow, businessFlowList) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatementList != null && billingStatementList.size() > 0) { + List billingStatementADDVOS = new ArrayList<>(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingStatementList) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } + } + } + } + + /* + * 按入仓单和收费事项合并计费 + * */ + public void mergeCalcByReceiptAndItem(Long settlementCustomersId) { + List list = businessDocumentService.list(new LambdaQueryWrapper() + .eq(BusinessDocument::getBelongModuleCode, "干仓") + .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) + .eq(BusinessDocument::getBusinessState, 3) + .eq(BusinessDocument::getDelFlag, 1)); + Map> groupedMap = list.stream() + .collect(Collectors.groupingBy(BusinessDocument::getOriginalBusinessNum)); + for (Map.Entry> entry : groupedMap.entrySet()) { + List groupList = entry.getValue(); + String originalBusinessNum = entry.getKey(); + List businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList()); + List billingStatementList = billingStatementService.list(new LambdaQueryWrapper() + .in(BillingStatement::getBusinessFlow, businessFlowList) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatementList != null && billingStatementList.size() > 0) { + List billingStatementADDVOS = new ArrayList<>(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingStatementList) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } + } + } + + /* + * 按合同和收费事项分开计费 + * */ + public void calcContractAndItemSeparately(Long settlementCustomersId) { + List list = businessDocumentService.list(new LambdaQueryWrapper() + .eq(BusinessDocument::getBelongModuleCode, "干仓") + .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) + .eq(BusinessDocument::getBusinessState, 3) + .eq(BusinessDocument::getDelFlag, 1)); + Map> groupedMap = list.stream() + .collect(Collectors.groupingBy(BusinessDocument::getFirstSubjectCode)); + for (Map.Entry> entry : groupedMap.entrySet()) { + List groupList = entry.getValue(); + String firstSubject = entry.getKey(); + if ("0D01".equals(firstSubject)) { + //主费用 + List businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList()); + List billingStatementList = billingStatementService.list(new LambdaQueryWrapper() + .in(BillingStatement::getBusinessFlow, businessFlowList) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatementList != null && billingStatementList.size() > 0) { + Map> contractManageIdMap = billingStatementList.stream() + .collect(Collectors.groupingBy(BillingStatement::getContractManageId)); + for (Map.Entry> contractManageIdEntry : contractManageIdMap.entrySet()) { + Long contractManageId = contractManageIdEntry.getKey(); + List billingContractStatementList = contractManageIdEntry.getValue(); + + List billingStatementADDVOS = new ArrayList<>(); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingContractStatementList) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } + } + } else { + //附加费用 + List businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList()); + List billingStatementList = billingStatementService.list(new LambdaQueryWrapper() + .in(BillingStatement::getBusinessFlow, businessFlowList) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatementList != null && billingStatementList.size() > 0) { + List billingStatementADDVOS = new ArrayList<>(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingStatementList) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } + } + } + } + + /* + * 按合同和收费事项合并计费 + * */ + public void mergeCalcByContractAndItem(Long settlementCustomersId) { + List list = businessDocumentService.list(new LambdaQueryWrapper() + .eq(BusinessDocument::getBelongModuleCode, "干仓") + .eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId) + .eq(BusinessDocument::getBusinessState, 3) + .eq(BusinessDocument::getDelFlag, 1)); + Map> groupedMap = list.stream() + .collect(Collectors.groupingBy(BusinessDocument::getContractManageId)); + for (Map.Entry> entry : groupedMap.entrySet()) { + List groupList = entry.getValue(); + Long contractManageId = entry.getKey(); + List businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList()); + List billingStatementList = billingStatementService.list(new LambdaQueryWrapper() + .in(BillingStatement::getBusinessFlow, businessFlowList) + .eq(BillingStatement::getBillingState, 1) + .eq(BillingStatement::getDelFlag, 1)); + if (billingStatementList != null && billingStatementList.size() > 0) { + List billingStatementADDVOS = new ArrayList<>(); + List billingStatementIdList = new ArrayList<>(); + BigDecimal allAmount = BigDecimal.ZERO; + BigDecimal allFreeFee = BigDecimal.ZERO; + String settlementCurrency = "CNY"; + for (BillingStatement billingStatement : billingStatementList) { + settlementCurrency = billingStatement.getSettlementCurrency(); + String firstSubjectCode = billingStatement.getFirstSubjectCode(); + String firstSubjectName = billingStatement.getFirstSubjectName(); + Long organizationId = billingStatement.getOrganizationId(); + Map taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName); + if (taxRateMap == null) continue; + Double taxRate = (Double) taxRateMap.get("taxRate"); + Long billingStatementId = billingStatement.getBillingStatementId(); + BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); + billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId)); + billingStatementDTO.setAuditOperation(1); + reviewBilling(billingStatementDTO); + + BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO(); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))), 10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + allAmount.add(amount); + allFreeFee.add(taxFreeFee); + billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId)); + billingStatementADDVO.setTaxRate(taxRate); + billingStatementADDVO.setTaxAmount(taxAmount); + billingStatementADDVO.setTaxFreeFee(taxFreeFee); + billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName()); + billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode()); + billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName()); + billingStatementADDVOS.add(billingStatementADDVO); + + billingStatementIdList.add(String.valueOf(billingStatementId)); + } + String ids = String.join(",", billingStatementIdList); + BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO(); + billingStatementDTO1.setBillingStatementIds(ids); + billingStatementDTO1.setBelongModuleCode("wms"); + billingStatementDTO1.setTaxAmount(allAmount); + billingStatementDTO1.setBillingAmount(allAmount); + billingStatementDTO1.setTaxFreeFee(allFreeFee); + billingStatementDTO1.setSettlementCurrency(settlementCurrency); + billingStatementDTO1.setBillingStatementList(billingStatementADDVOS); + generateBills(billingStatementDTO1); + } } } } \ No newline at end of file diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java index ef0fa1a07..f8c74da3e 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/materialInventory/MaterialInventoryApplicationService.java @@ -945,9 +945,9 @@ public class MaterialInventoryApplicationService { BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); //火险保费 BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003")); - buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓"); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"干仓"); buildBusinessDocument(manpowerFee, materialInventoryPO,"0D082","夫力费",contractManageId,"干仓"); - buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓"); + buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"干仓"); } else { //期间付费 不需要夫力费 @@ -959,8 +959,8 @@ public class MaterialInventoryApplicationService { BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); //火险保费 BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003")); - buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"冻仓"); - buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"冻仓"); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓"); + buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"冻仓"); } } else if (warehouseId==20) {//冻仓计费 Map shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置"); @@ -1001,11 +1001,11 @@ public class MaterialInventoryApplicationService { if (daysDiff < 15) { // 不足半月: 收半月仓租 BigDecimal totalWarehouseRent = inventoryQuantity.multiply(halfMonthWhFee).multiply(weightLimit); - buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓"); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓"); } else { // 大于等于半月: 收整月仓租 BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee).multiply(weightLimit); - buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓"); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓"); } //更新最后计费时间 Long id = materialInventoryPO.getMaterialInventoryId(); @@ -1068,9 +1068,9 @@ public class MaterialInventoryApplicationService { BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); //火险保费 BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003")); - buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓"); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"干仓"); buildBusinessDocument(manpowerFee, materialInventoryPO,"0D082","夫力费",contractManageId,"干仓"); - buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓"); + buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"干仓"); } else { //期间付费 不需要夫力费 @@ -1082,8 +1082,8 @@ public class MaterialInventoryApplicationService { BigDecimal unitPrice = materialBaseInfo.getUnitPrice(); //火险保费 BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003")); - buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓"); - buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓"); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"干仓"); + buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"干仓"); } } else if (warehouseId==20) {//冻仓计费 Map shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置"); @@ -1124,11 +1124,11 @@ public class MaterialInventoryApplicationService { if (daysDiff < 15) { // 不足半月: 收半月仓租 BigDecimal totalWarehouseRent = inventoryQuantity.multiply(halfMonthWhFee).multiply(weightLimit); - buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓"); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓"); } else { // 大于等于半月: 收整月仓租 BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee).multiply(weightLimit); - buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓"); + buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓"); } //更新最后计费时间 Long materialInventoryId = materialInventoryPO.getMaterialInventoryId(); From 6c6afe434210053ca2750a72a7cd9d920c4ea7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 10:22:24 +0800 Subject: [PATCH 07/32] =?UTF-8?q?=E8=81=94=E6=9F=A5=E5=90=88=E5=90=8C?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContractManageApplicationService.java | 90 +++++-------------- .../contractManage/ContractManageApi.java | 20 +++-- 2 files changed, 38 insertions(+), 72 deletions(-) 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 2d8034d60..f8d94a9d6 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 @@ -1433,82 +1433,49 @@ public class ContractManageApplicationService { private static final String WEBSERVICE_URL = "http://10.33.0.116:8080/sys/webservice/ngLegalByFindWebserviceService"; - public List getContractNosByCompanyName(String companyName) { - List contractNos = new ArrayList<>(); + public List getContractNosByCompanyName(String companyName, int pageNum, int pageSize) { + List contractList = new ArrayList<>(); try { - log.info("=== 开始查询合同编号 ==="); - log.info("查询公司: {}", companyName); + log.info("=== 开始查询合同列表 ==="); + log.info("查询公司: {}, 页码: {}, 每页数量: {}", companyName, pageNum, pageSize); - // 1. 构建JSON参数 - 使用绝对正确的格式 - String fdRelativePersonJson = "{\"fdName\":\"" + companyName + "\"}"; - log.info("JSON参数: {}", fdRelativePersonJson); - - // 2. 构建XML请求 - 使用和Postman完全相同的格式 - String httpRequest = buildXmlRequest(companyName); + String httpRequest = buildXmlRequest(companyName, pageNum, pageSize); log.info("XML请求: {}", httpRequest); log.info("XML请求生成完成,长度: {} 字符", httpRequest.length()); - // 3. 调用WebService log.info("正在调用WebService..."); String httpResponse = HttpWebServiceUtil.callWebService(httpRequest, WEBSERVICE_URL); - // 4. 提取JSON - 使用更可靠的提取方法 String jsonData = extractJsonFromResponse(httpResponse); log.info("正在解析JSON..."+jsonData); - //jsonData内容 -// { -// "returnState": "2", -// "data": [ -// { -// "contract_Id": "16f830763e15793f5aafab14b309075c", -// "contract_Name": "档案保管服务协议", -// "contract_No": "HT20200108130", -// "contract_Total": 134323.36, -// "contract_Star": "20181101", -// "contract_End": "20231101", -// "contract_relative": [ -// { -// "relativeName": "珠海通宇物流有限公司" -// } -// ], -// "contract_Operator": "蔡振燕", -// "contract_capitalFlows": "支出", -// "contract_SigningName": "南光置业有限公司-本部", -// "contract_pay": [], -// "contract_purchases": [] -// } -// ] -// } if (jsonData == null || jsonData.trim().isEmpty()) { log.warn("未提取到JSON数据,返回空列表"); - return contractNos; + return contractList; } log.info("提取到JSON数据,长度: {} 字符", jsonData.length()); - // 5. 解析JSON - List result = parseContractNosFromJson(jsonData); - contractNos.addAll(result); + List result = parseContractListFromJson(jsonData); + contractList.addAll(result); log.info("=== 查询完成 ==="); - log.info("找到 {} 个合同编号", contractNos.size()); + log.info("找到 {} 个合同", contractList.size()); } catch (Exception e) { - log.error("查询合同编号失败", e); - throw new RuntimeException("查询合同编号失败: " + e.getMessage(), e); + log.error("查询合同列表失败", e); + throw new RuntimeException("查询合同列表失败: " + e.getMessage(), e); } - return contractNos; + return contractList; } /** - * 构建XML请求 - 硬编码确保和Postman完全一致 + * 构建XML请求 - 动态分页 */ - private String buildXmlRequest(String companyName) { - // 使用和Postman完全相同的格式 + private String buildXmlRequest(String companyName, int pageNum, int pageSize) { String jsonParam = "{\"fdName\":\"" + companyName + "\"}"; return "" + @@ -1517,8 +1484,8 @@ public class ContractManageApplicationService { "" + "" + "" + - "1" + - "10" + + "" + pageNum + "" + + "" + pageSize + "" + "" + "" + "NA0301" + @@ -1576,42 +1543,31 @@ public class ContractManageApplicationService { } /** - * 解析JSON获取合同编号 + * 解析JSON获取完整合同列表 */ - private List parseContractNosFromJson(String jsonData) { - List contractNos = new ArrayList<>(); + private List parseContractListFromJson(String jsonData) { + List contractList = new ArrayList<>(); try { com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(jsonData); - // 检查返回状态 String returnState = jsonObject.getString("returnState"); if (!"2".equals(returnState)) { log.warn("返回状态异常: {}", returnState); - return contractNos; + return contractList; } - // 获取data数组 JSONArray dataArray = jsonObject.getJSONArray("data"); if (dataArray == null || dataArray.isEmpty()) { log.info("查询成功,但未找到合同数据"); - return contractNos; + return contractList; } log.info("找到 {} 个合同", dataArray.size()); - // 遍历提取合同编号 for (int i = 0; i < dataArray.size(); i++) { com.alibaba.fastjson.JSONObject contract = dataArray.getJSONObject(i); - String contractNo = contract.getString("contract_No"); - String contractName = contract.getString("contract_Name"); - - if (contractNo != null && !contractNo.trim().isEmpty()) { - contractNos.add(contractNo.trim() + " " + contractName.trim()); - log.info("合同 {}: {}", i + 1, contractNo); - } else { - log.warn("第 {} 个合同没有编号", i + 1); - } + contractList.add(contract); } } catch (Exception e) { @@ -1619,6 +1575,6 @@ public class ContractManageApplicationService { log.error("原始JSON: {}", jsonData); } - return contractNos; + return contractList; } } \ No newline at end of file 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 003ed148f..e1138dd51 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 @@ -1,5 +1,7 @@ package com.mhd.basic.interfaces.facade.contractManage; +import com.alibaba.fastjson.JSONObject; + import java.io.IOException; import java.net.URLEncoder; import java.util.List; @@ -276,14 +278,22 @@ public class ContractManageApi extends BaseController{ /** - * 根据公司名称获取合同编号列表 + * 根据公司名称获取合同列表(完整合同内容,支持分页) * @param companyName 公司名称 - * @return 合同编号列表 + * @param pageNum 页码 + * @param pageSize 每页数量 + * @return 合同列表 */ @GetMapping("/contractNos") - public AjaxResult getContractNosByCompanyName(@RequestParam String companyName) { - contractManageApplicationService.getContractNosByCompanyName(companyName); - return AjaxResult.success(); + public TableDataInfo getContractNosByCompanyName( + @RequestParam String companyName, + @RequestParam(defaultValue = "1") int pageNum, + @RequestParam(defaultValue = "10") int pageSize) { + List list = contractManageApplicationService.getContractNosByCompanyName(companyName, pageNum, pageSize); + TableDataInfo tableDataInfo = new TableDataInfo(list, list.size()); + tableDataInfo.setCode(200); + tableDataInfo.setMsg("查询成功"); + return tableDataInfo; } } \ No newline at end of file From 84558fe2f68ee2b5fd280bbd056b74274018bff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 10:46:24 +0800 Subject: [PATCH 08/32] =?UTF-8?q?xxl=E9=85=8D=E7=BD=AE=E7=B1=BB;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mhd/basic/util/XxlJobConfig.java | 54 +++++++ .../repository/util/XxlJobOpenApiUtil.java | 139 ++++++++++++++++++ .../java/com/mhd/bms/util/XxlJobConfig.java | 54 +++++++ mhd_wms/src/main/resources/bootstrap.yml | 24 +-- 4 files changed, 248 insertions(+), 23 deletions(-) create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/util/XxlJobConfig.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/util/XxlJobConfig.java diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/util/XxlJobConfig.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/util/XxlJobConfig.java new file mode 100644 index 000000000..1ce50c485 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/util/XxlJobConfig.java @@ -0,0 +1,54 @@ +package com.mhd.basic.util; +import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * XXL-JOB 配置类 + */ +@Configuration +public class XxlJobConfig { + private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); + + @Value("${xxl.job.admin.addresses}") + private String adminAddresses; + + @Value("${xxl.job.accessToken}") + private String accessToken; + + @Value("${xxl.job.executor.appname}") + private String appname; + + @Value("${xxl.job.executor.address}") + private String address; + + @Value("${xxl.job.executor.ip}") + private String ip; + + @Value("${xxl.job.executor.port}") + private int port; + + @Value("${xxl.job.executor.logpath}") + private String logPath; + + @Value("${xxl.job.executor.logretentiondays}") + private int logRetentionDays; + + @Bean + public XxlJobSpringExecutor xxlJobExecutor() { + logger.info(">>>>>>>>>>> xxl-job config init."); + XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); + xxlJobSpringExecutor.setAdminAddresses(adminAddresses); + xxlJobSpringExecutor.setAppname(appname); + xxlJobSpringExecutor.setAddress(address); + xxlJobSpringExecutor.setIp(ip); + xxlJobSpringExecutor.setPort(port); + xxlJobSpringExecutor.setAccessToken(accessToken); + xxlJobSpringExecutor.setLogPath(logPath); + xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); + return xxlJobSpringExecutor; + } +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java new file mode 100644 index 000000000..4ebe08220 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -0,0 +1,139 @@ +package com.mhd.bms.domain.settlementCustomers.repository.util; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.core.lang.Assert; +import cn.hutool.json.JSONUtil; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; + +import java.util.Map; + +/** + * XXL‑JOB OpenApi 工具类 + */ +@Slf4j +public class XxlJobOpenApiUtil { + + /** xxl‑job admin地址,例:http://127.0.0.1:8080/xxl‑job‑admin */ + private final String adminUrl; + /** 系统配置里的AccessToken */ + private final String accessToken; + + public XxlJobOpenApiUtil(String adminUrl, String accessToken) { + this.adminUrl = adminUrl.endsWith("/") ? adminUrl.substring(0, adminUrl.length() -1) : adminUrl; + this.accessToken = accessToken; + } + + /** + * 新增定时任务 + * @param addReq 请求参数 + * @return jobId 任务ID,返回null代表调用失败 + */ + public Integer addJob(JobInfoAddReq addReq) { + String url = adminUrl + "/api/jobinfo/add"; + try { + // 实体对象转map,解决form不能传bean的爆红 + Map formMap = BeanUtil.beanToMap(addReq); + + HttpResponse response = HttpRequest.post(url) + .header("XXL-JOB-ACCESS-TOKEN", accessToken) + .form(formMap) //传入map,不再传实体 + .execute(); + + String body = response.body(); + log.info("xxl‑job addJob resp:{}", body); + XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); + if (resp != null && resp.getCode() == 200) { + return Integer.valueOf(resp.getContent().toString()); + } + log.error("新增xxl‑job任务失败,resp:{}", body); + return null; + } catch (Exception e) { + log.error("调用xxl‑job addJob异常", e); + return null; + } + } + + + /** + * 删除任务 + * @param jobId 任务id + * @return true成功 + */ + public boolean removeJob(Integer jobId) { + String url = adminUrl + "/api/jobinfo/remove"; + try (HttpResponse response = HttpRequest.post(url) + .header("XXL‑JOB‑ACCESS‑TOKEN", accessToken) + .form("id", jobId) + .execute()) { + String body = response.body(); + XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); + if (resp != null && resp.getCode() == 200) { + return true; + } + log.error("删除xxl‑job任务失败 jobId:{},resp:{}", jobId, body); + return false; + } catch (Exception e) { + log.error("调用xxl‑job removeJob异常", e); + return false; + } + } + + /** + * 暂停任务 + */ + public boolean pauseJob(Integer jobId) { + String url = adminUrl + "/api/jobinfo/pause"; + try (HttpResponse response = HttpRequest.post(url) + .header("XXL‑JOB‑ACCESS‑TOKEN", accessToken) + .form("id", jobId) + .execute()) { + String body = response.body(); + XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); + return resp != null && resp.getCode() == 200; + } catch (Exception e) { + log.error("pauseJob异常", e); + return false; + } + } + + + //---------------- 实体 ---------------- + + @Data + public static class JobInfoAddReq { + /** 执行器组ID xxl_job_group.id */ + private Integer jobGroup; + /** 任务描述 */ + private String jobDesc; + /** 路由策略 ROUND:轮询 */ + private String executorRouteStrategy = "ROUND"; + /** cron表达式 23点 0 0 23 * * ? */ + private String jobCron; + /** @XxlJob 注解handler名称 */ + private String executorHandler; + /** 任务参数,这里存业务单号 */ + private String executorParam; + /** 阻塞策略 SERIAL_EXECUTION单机串行 */ + private String executorBlockStrategy = "SERIAL_EXECUTION"; + /** 超时时间 0不限制 */ + private Integer executorTimeout = 0; + /** 失败重试次数 */ + private Integer executorFailRetryCount = 0; + /** BEAN模式 */ + private String glueType = "BEAN"; + private String glueSource = ""; + private String glueRemark = ""; + /** 1启用 0停止 */ + private Integer triggerStatus = 1; + } + + @Data + public static class XxlApiResp { + private Integer code; + private Object content; + private String msg; + } +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/util/XxlJobConfig.java b/mhd_bms/src/main/java/com/mhd/bms/util/XxlJobConfig.java new file mode 100644 index 000000000..4278484b2 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/util/XxlJobConfig.java @@ -0,0 +1,54 @@ +package com.mhd.bms.util; +import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * XXL-JOB 配置类 + */ +@Configuration +public class XxlJobConfig { + private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); + + @Value("${xxl.job.admin.addresses}") + private String adminAddresses; + + @Value("${xxl.job.accessToken}") + private String accessToken; + + @Value("${xxl.job.executor.appname}") + private String appname; + + @Value("${xxl.job.executor.address}") + private String address; + + @Value("${xxl.job.executor.ip}") + private String ip; + + @Value("${xxl.job.executor.port}") + private int port; + + @Value("${xxl.job.executor.logpath}") + private String logPath; + + @Value("${xxl.job.executor.logretentiondays}") + private int logRetentionDays; + + @Bean + public XxlJobSpringExecutor xxlJobExecutor() { + logger.info(">>>>>>>>>>> xxl-job config init."); + XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); + xxlJobSpringExecutor.setAdminAddresses(adminAddresses); + xxlJobSpringExecutor.setAppname(appname); + xxlJobSpringExecutor.setAddress(address); + xxlJobSpringExecutor.setIp(ip); + xxlJobSpringExecutor.setPort(port); + xxlJobSpringExecutor.setAccessToken(accessToken); + xxlJobSpringExecutor.setLogPath(logPath); + xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); + return xxlJobSpringExecutor; + } +} \ No newline at end of file diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index 503393ad1..39eb710cb 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -34,26 +34,4 @@ spring: file-extension: yml # 共享配置 shared-configs: - - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} -# XXL-JOB 配置 -xxl: - job: - # 调度中心地址(填你部署的地址) - admin: - addresses: http://192.168.1.6:8020/xxl-job-admin - # 执行器配置 - executor: - # 执行器名称(自定义,后面调度中心要用到) - appname: wms-service-executor - # 执行器注册地址,默认0表示自动获取 - address: - # 执行器IP,默认空自动获取 - ip: - # 执行器端口号(每个微服务不能重复,建议9997/9998/9999) - port: 9997 - # 执行器日志存放路径 - logpath: /data/applogs/xxl-job/jobhandler - # 日志保留天数 - logretentiondays: 30 - # 调度中心通讯令牌(默认空,安全可设置) - accessToken: default_token \ No newline at end of file + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} \ No newline at end of file From 7790850da3b808eaca30bbf30ef0d330999aab75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 14:51:25 +0800 Subject: [PATCH 09/32] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mhd/system/api/BmsServiceFeign.java | 4 + .../RemoteBmsFeignFallbackFactory.java | 5 + .../core/domain/po/SettlementCustomersPO.java | 9 +- .../ContractManageApplicationService.java | 56 +++++++ .../repository/util/XxlJobOpenApiUtil.java | 138 ++++++++++++++++++ ...SettlementCustomersApplicationService.java | 70 +++++++++ .../entity/SettlementCustomers.java | 6 + .../repository/po/SettlementCustomersPO.java | 6 + .../todo/SettlementCustomersDO.java | 6 + .../repository/util/XxlJobOpenApiUtil.java | 6 +- .../SettlementCustomersDTO.java | 6 + .../facadeApi/SettlementCustomersApi.java | 10 +- .../mapper/SettlementCustomersMapper.xml | 6 + 13 files changed, 322 insertions(+), 6 deletions(-) create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index caf732f29..9d7fcfa35 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -78,4 +78,8 @@ public interface BmsServiceFeign { */ @GetMapping("/settlementCustomersParametersApi/getListBySettlementCustomersId") AjaxResult getListBySettlementCustomersId(@RequestParam("settlementCustomersId") Long settlementCustomersId); + + @PostMapping("/settlementCustomersApi/updatePushContractManageJobId") + AjaxResult updatePushContractManageJobId(@RequestParam("settlementCustomersId") Long settlementCustomersId, + @RequestParam("jobId") Integer jobId); } \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java index e6b97690d..a851b12d8 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteBmsFeignFallbackFactory.java @@ -77,6 +77,11 @@ public class RemoteBmsFeignFallbackFactory implements FallbackFactory formMap = BeanUtil.beanToMap(addReq); + + HttpResponse response = HttpRequest.post(url) + .header("Authorization", accessToken) + .form(formMap) //传入map,不再传实体 + .execute(); + + String body = response.body(); + log.info("xxl‑job addJob resp:{}", body); + XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); + if (resp != null && resp.getCode() == 200) { + return Integer.valueOf(resp.getContent().toString()); + } + log.error("新增xxl‑job任务失败,resp:{}", body); + return null; + } catch (Exception e) { + log.error("调用xxl‑job addJob异常", e); + return null; + } + } + + + /** + * 删除任务 + * @param jobId 任务id + * @return true成功 + */ + public boolean removeJob(Integer jobId) { + String url = adminUrl + "/api/jobinfo/remove"; + try (HttpResponse response = HttpRequest.post(url) + .header("Authorization", accessToken) + .form("id", jobId) + .execute()) { + String body = response.body(); + XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); + if (resp != null && resp.getCode() == 200) { + return true; + } + log.error("删除xxl‑job任务失败 jobId:{},resp:{}", jobId, body); + return false; + } catch (Exception e) { + log.error("调用xxl‑job removeJob异常", e); + return false; + } + } + + /** + * 暂停任务 + */ + public boolean pauseJob(Integer jobId) { + String url = adminUrl + "/api/jobinfo/pause"; + try (HttpResponse response = HttpRequest.post(url) + .header("Authorization", accessToken) + .form("id", jobId) + .execute()) { + String body = response.body(); + XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); + return resp != null && resp.getCode() == 200; + } catch (Exception e) { + log.error("pauseJob异常", e); + return false; + } + } + + + //---------------- 实体 ---------------- + + @Data + public static class JobInfoAddReq { + /** 执行器组ID xxl_job_group.id */ + private Integer jobGroup; + /** 任务描述 */ + private String jobDesc; + /** 路由策略 ROUND:轮询 */ + private String executorRouteStrategy = "ROUND"; + /** cron表达式 23点 0 0 23 * * ? */ + private String jobCron; + /** @XxlJob 注解handler名称 */ + private String executorHandler; + /** 任务参数,这里存业务单号 */ + private String executorParam; + /** 阻塞策略 SERIAL_EXECUTION单机串行 */ + private String executorBlockStrategy = "SERIAL_EXECUTION"; + /** 超时时间 0不限制 */ + private Integer executorTimeout = 0; + /** 失败重试次数 */ + private Integer executorFailRetryCount = 0; + /** BEAN模式 */ + private String glueType = "BEAN"; + private String glueSource = ""; + private String glueRemark = ""; + /** 1启用 0停止 */ + private Integer triggerStatus = 1; + } + + @Data + public static class XxlApiResp { + private Integer code; + private Object content; + private String msg; + } +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java index 5b8f83044..5d64df651 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java @@ -10,6 +10,7 @@ import com.mhd.bms.domain.settlementCustomers.repository.mapper.SettlementCustom import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO; import com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO; import com.mhd.bms.domain.settlementCustomers.repository.persistence.SettlementCustomersImpl; +import com.mhd.bms.domain.settlementCustomers.repository.util.XxlJobOpenApiUtil; import com.mhd.bms.domain.settlementCustomers.service.SettlementCustomersDomainService; import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig; import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService; @@ -38,6 +39,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -73,6 +75,9 @@ public class SettlementCustomersApplicationService { private ISettlementCustomersNcConfigService settlementCustomersNcConfigService; private static final int SYNC_BATCH_SIZE = 500; + @Value("${xxl.job.admin.addresses}") + private String adminAddresses; + private static final String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozNTYzLCJ0b3BPcmdhbml6YXRpb25JZCI6MjgyNywidXNlcl9rZXkiOiI0N2MzY2U4My0wMmFjLTQ0NTQtOTdiYS1lYmQwMDc2MzNiNDMiLCJ1c2VybmFtZSI6ImNhbmdtYSJ9.tnZyywwburfBo3Kizdhfk5eYdXbrrZ9976Z0W7GrS6UqSpKwfI2RwdRwfYx7DbD7Ri1Fdj_eOVxBkjvdFF226Q"; /** * 分页查询结算对象列表 @@ -328,6 +333,15 @@ public class SettlementCustomersApplicationService { if (paramResult == null || !"200".equals(String.valueOf(paramResult.get("code")))) { throw new ServiceException("保存合同参数失败"); } + Long settlementEntityId = settlementCustomersDO.getSettlementEntityId(); + if (settlementEntityId != null) { + stopXxlJob(settlementCustomersDO.getPushBillingRecordJobId()); + stopXxlJob(settlementCustomersDO.getPushBillManageJobId()); + Integer jobId = addXxlJob(String.valueOf(settlementEntityId)); + Integer jobId1 = addXxlJob1(String.valueOf(settlementEntityId)); + settlementCustomersDO.setPushBillingRecordJobId(jobId); + settlementCustomersDO.setPushBillManageJobId(jobId1); + } } else { throw new ServiceException("创建临时合同失败"); } @@ -338,6 +352,55 @@ public class SettlementCustomersApplicationService { return settlementCustomersDomainService.update(settlementCustomersDO); } + public Integer addXxlJob(String shipperId) { + //1.实例化工具类,建议交给Spring管理 + XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token); + + //2.构建新增任务参数 + XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq(); + req.setJobGroup(3); //你的执行器组id + req.setJobDesc("散租推送计费单据/流水任务,结算对象id:" + shipperId); + req.setJobCron("0 0 1 * * ?"); + req.setExecutorHandler("pushBillingRecord"); + req.setExecutorParam(shipperId); //传入业务单号 + + //3.调用创建任务接口 ,返回任务ID + Integer xxlJobId = apiUtil.addJob(req); + if(xxlJobId == null){ + // 创建定时任务失败,抛异常/重试,不要让单据直接保存成功 + throw new RuntimeException("创建夜间定时任务失败"); + } + return xxlJobId; + } + + public Integer addXxlJob1(String shipperId) { + //1.实例化工具类,建议交给Spring管理 + XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token); + + //2.构建新增任务参数 + XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq(); + req.setJobGroup(6); //你的执行器组id + req.setJobDesc("计费单据/流水生成发票任务,结算对象id:" + shipperId); + req.setJobCron("0 0 1 * * ?"); + req.setExecutorHandler("pushBillManage"); + req.setExecutorParam(shipperId); //传入业务单号 + + //3.调用创建任务接口 ,返回任务ID + Integer xxlJobId = apiUtil.addJob(req); + if(xxlJobId == null){ + // 创建定时任务失败,抛异常/重试,不要让单据直接保存成功 + throw new RuntimeException("创建夜间定时任务失败"); + } + return xxlJobId; + } + + public void stopXxlJob(Integer shipperId) { + //1.实例化工具类,建议交给Spring管理 + XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token); + //3.调用创建任务接口 ,返回任务ID + apiUtil.pauseJob(shipperId); + } + private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyMMdd"); private static final Random RANDOM = new Random(); @@ -573,6 +636,13 @@ public class SettlementCustomersApplicationService { return saveEntity; } + public Boolean updatePushContractManageToBmsJobId(Long settlementCustomersId, Integer jobId) { + return settlementCustomersImpl.lambdaUpdate() + .eq(SettlementCustomers::getSettlementCustomersId, settlementCustomersId) + .set(SettlementCustomers::getPushContractManageToBmsJobId, jobId) + .update(); + } + private SettlementCustomersDO buildDriverSettlementCustomerDO(UserDriverPo userDriverPo, LoginUser loginUser, Long organizationId) { SettlementCustomersDO saveEntity = new SettlementCustomersDO(); saveEntity.setSettlementEntityId(userDriverPo.getUserId()); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java index 52d80fbcf..3a6780cf5 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/entity/SettlementCustomers.java @@ -96,5 +96,11 @@ public class SettlementCustomers extends BaseVOEntity{ private String settlementCurrency; @ApiModelProperty(name = "组织代码") private String orgCode; + @ApiModelProperty(name = "散租推送计费单据/流水任务id") + private Integer pushBillingRecordJobId; + @ApiModelProperty(name = "整租推送计费单据/流水任务id") + private Integer pushContractManageToBmsJobId; + @ApiModelProperty(name = "生成应收账单任务id") + private Integer pushBillManageJobId; } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/po/SettlementCustomersPO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/po/SettlementCustomersPO.java index e31f35662..75d30689b 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/po/SettlementCustomersPO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/po/SettlementCustomersPO.java @@ -132,6 +132,12 @@ public class SettlementCustomersPO extends BaseVOEntity{ private Date businessCreateTime; @ApiModelProperty(name = "组织代码") private String orgCode; + @ApiModelProperty(name = "散租推送计费单据/流水任务id") + private Integer pushBillingRecordJobId; + @ApiModelProperty(name = "整租推送计费单据/流水任务id") + private Integer pushContractManageToBmsJobId; + @ApiModelProperty(name = "生成应收账单任务id") + private Integer pushBillManageJobId; List settlementCustomersNcConfigs; List settlementCustomersParameters; diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java index f2753742f..02a472756 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/todo/SettlementCustomersDO.java @@ -135,6 +135,12 @@ public class SettlementCustomersDO extends BaseVOEntity{ private String documentTypeCode; @ApiModelProperty(name = "组织代码") private String orgCode; + @ApiModelProperty(name = "散租推送计费单据/流水任务id") + private Integer pushBillingRecordJobId; + @ApiModelProperty(name = "整租推送计费单据/流水任务id") + private Integer pushContractManageToBmsJobId; + @ApiModelProperty(name = "生成应收账单任务id") + private Integer pushBillManageJobId; @ApiModelProperty("结算对象参数") private List settlementCustomersParameters; diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java index 4ebe08220..41953d8c4 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -38,7 +38,7 @@ public class XxlJobOpenApiUtil { Map formMap = BeanUtil.beanToMap(addReq); HttpResponse response = HttpRequest.post(url) - .header("XXL-JOB-ACCESS-TOKEN", accessToken) + .header("Authorization", accessToken) .form(formMap) //传入map,不再传实体 .execute(); @@ -65,7 +65,7 @@ public class XxlJobOpenApiUtil { public boolean removeJob(Integer jobId) { String url = adminUrl + "/api/jobinfo/remove"; try (HttpResponse response = HttpRequest.post(url) - .header("XXL‑JOB‑ACCESS‑TOKEN", accessToken) + .header("Authorization", accessToken) .form("id", jobId) .execute()) { String body = response.body(); @@ -87,7 +87,7 @@ public class XxlJobOpenApiUtil { public boolean pauseJob(Integer jobId) { String url = adminUrl + "/api/jobinfo/pause"; try (HttpResponse response = HttpRequest.post(url) - .header("XXL‑JOB‑ACCESS‑TOKEN", accessToken) + .header("Authorization", accessToken) .form("id", jobId) .execute()) { String body = response.body(); diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java index 7c3c7e22a..ee5ec5d61 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/settlementCustomers/SettlementCustomersDTO.java @@ -135,6 +135,12 @@ public class SettlementCustomersDTO extends BaseVOEntity{ private String documentTypeCode; @ApiModelProperty(name = "组织代码") private String orgCode; + @ApiModelProperty(name = "散租推送计费单据/流水任务id") + private Integer pushBillingRecordJobId; + @ApiModelProperty(name = "整租推送计费单据/流水任务id") + private Integer pushContractManageToBmsJobId; + @ApiModelProperty(name = "生成应收账单任务id") + private Integer pushBillManageJobId; @ApiModelProperty("结算对象参数") private List settlementCustomersParameters; diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersApi.java index ed2fa4bbf..869a33446 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/SettlementCustomersApi.java @@ -137,6 +137,13 @@ public class SettlementCustomersApi extends BaseController{ return AjaxResult.success(settlementCustomersApplicationService.getFirstBySettlementEntityId(settlementEntityId, topOrganizationId)); } + @ApiOperation("根据结算对象ID更新整租推送任务ID") + @PostMapping("/updatePushContractManageJobId") + public AjaxResult updatePushContractManageJobId(@RequestParam("settlementCustomersId") Long settlementCustomersId, + @RequestParam("jobId") Integer jobId) { + Boolean result = settlementCustomersApplicationService.updatePushContractManageToBmsJobId(settlementCustomersId, jobId); + return toAjax(result); + } @@ -145,4 +152,5 @@ public class SettlementCustomersApi extends BaseController{ -} + +} \ No newline at end of file diff --git a/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml b/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml index e3b71ac36..6ec30e44c 100644 --- a/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml +++ b/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml @@ -44,6 +44,9 @@ + + + @@ -117,6 +120,9 @@ bd.document_type, bd.document_type_code, a.org_code, + a.push_billing_record_job_id, + a.push_contract_manage_to_bms_job_id, + a.push_bill_manage_job_id, bd.create_time as business_create_time from settlement_customers a left join "NGWL_TEST_USER"."USER_SHIPPER" b on a.settlement_entity_id = b.user_id From bc09b77695c178b7a352ac9c6d7e4ec59048c682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 16:55:10 +0800 Subject: [PATCH 10/32] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=A1=E8=B4=B9?= =?UTF-8?q?=E5=AD=97=E6=AE=B5;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/ExecutionStockOutOrder.java | 12 ++++++++++++ .../repository/po/ExecutionStockOutOrderPO.java | 12 ++++++++++++ .../repository/todo/ExecutionStockOutOrderDO.java | 12 ++++++++++++ .../repository/todo/ExecutionStockOutOrderDTO.java | 12 ++++++++++++ .../entity/ReservationInMaterialDetail.java | 4 ++++ .../repository/po/ReservationInMaterialDetailPO.java | 4 ++++ .../todo/ReservationInMaterialDetailDO.java | 4 ++++ .../todo/ReservationInMaterialDetailDTO.java | 4 ++++ .../entity/ReservationOutMaterialDetail.java | 3 +++ .../po/ReservationOutMaterialDetailPO.java | 3 +++ .../todo/ReservationOutMaterialDetailDO.java | 2 ++ .../todo/ReservationOutMaterialDetailDTO.java | 2 ++ .../entity/ReservationStockOutOrder.java | 12 ++++++++++++ .../repository/po/ReservationStockOutOrderPO.java | 12 ++++++++++++ .../repository/todo/ReservationStockOutOrderDO.java | 12 ++++++++++++ .../repository/todo/ReservationStockOutOrderDTO.java | 12 ++++++++++++ .../ExecutionStockOutOrderMapper.xml | 7 ++++++- .../ReservationInMaterialDetailMapper.xml | 4 +++- .../ReservationOutMaterialDetailMapper.xml | 2 ++ .../ReservationStockOutOrderMapper.xml | 7 ++++++- 20 files changed, 139 insertions(+), 3 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/entity/ExecutionStockOutOrder.java b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/entity/ExecutionStockOutOrder.java index ed985f9ba..67029be76 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/entity/ExecutionStockOutOrder.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/entity/ExecutionStockOutOrder.java @@ -504,4 +504,16 @@ public class ExecutionStockOutOrder extends BaseVOEntity { @Excel(name = "车次") private String shuttleNo; + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; + + @ApiModelProperty("业务计价类型") + private String businessChargeType; + + @ApiModelProperty("业务计价方式") + private String businessPriceWay; + + @ApiModelProperty("折扣") + private BigDecimal discount; + } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/po/ExecutionStockOutOrderPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/po/ExecutionStockOutOrderPO.java index cedc1b2d4..58f120900 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/po/ExecutionStockOutOrderPO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/po/ExecutionStockOutOrderPO.java @@ -516,4 +516,16 @@ public class ExecutionStockOutOrderPO extends BaseVOEntity { @ApiModelProperty("车次") @Excel(name = "车次") private String shuttleNo; + + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; + + @ApiModelProperty("业务计价类型") + private String businessChargeType; + + @ApiModelProperty("业务计价方式") + private String businessPriceWay; + + @ApiModelProperty("折扣") + private BigDecimal discount; } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/todo/ExecutionStockOutOrderDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/todo/ExecutionStockOutOrderDO.java index 9104aec61..b8317cf1c 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/todo/ExecutionStockOutOrderDO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/todo/ExecutionStockOutOrderDO.java @@ -576,4 +576,16 @@ public class ExecutionStockOutOrderDO extends BaseVOEntity { @ApiModelProperty("车次") private String shuttleNo; + + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; + + @ApiModelProperty("业务计价类型") + private String businessChargeType; + + @ApiModelProperty("业务计价方式") + private String businessPriceWay; + + @ApiModelProperty("折扣") + private BigDecimal discount; } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/todo/ExecutionStockOutOrderDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/todo/ExecutionStockOutOrderDTO.java index 3478f949c..0b2033f43 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/todo/ExecutionStockOutOrderDTO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockOutOrder/repository/todo/ExecutionStockOutOrderDTO.java @@ -564,4 +564,16 @@ public class ExecutionStockOutOrderDTO extends ExecutionStockOutOrderBaseDTO { @ApiModelProperty("车次") private String shuttleNo; + + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; + + @ApiModelProperty("业务计价类型") + private String businessChargeType; + + @ApiModelProperty("业务计价方式") + private String businessPriceWay; + + @ApiModelProperty("折扣") + private BigDecimal discount; } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/entity/ReservationInMaterialDetail.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/entity/ReservationInMaterialDetail.java index 84ffc560f..18701cb6e 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/entity/ReservationInMaterialDetail.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/entity/ReservationInMaterialDetail.java @@ -381,6 +381,10 @@ public class ReservationInMaterialDetail extends BaseVOEntity { private Date drinkDate; @ApiModelProperty("火险保费") private BigDecimal fireInsureFee; + @ApiModelProperty("夫力费") + private BigDecimal manpowerFee; + @ApiModelProperty("仓租费") + private BigDecimal totalWarehouseRent; //订单行号 diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/po/ReservationInMaterialDetailPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/po/ReservationInMaterialDetailPO.java index f6f111ea6..9579650ee 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/po/ReservationInMaterialDetailPO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/po/ReservationInMaterialDetailPO.java @@ -483,6 +483,10 @@ public class ReservationInMaterialDetailPO extends ReservationStockInOrderBasePO private String lotNumber; @ApiModelProperty("火险保费") private BigDecimal fireInsureFee; + @ApiModelProperty("夫力费") + private BigDecimal manpowerFee; + @ApiModelProperty("仓租费") + private BigDecimal totalWarehouseRent; //订单行号 private String lineNumGw; diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDO.java index 9d95286ff..d4d4c3cb8 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDO.java @@ -448,6 +448,10 @@ public class ReservationInMaterialDetailDO extends ReservationStockInOrderBaseDO private BigDecimal unitPrice; @ApiModelProperty("火险保费") private BigDecimal fireInsureFee; + @ApiModelProperty("夫力费") + private BigDecimal manpowerFee; + @ApiModelProperty("仓租费") + private BigDecimal totalWarehouseRent; //订单行号 private String lineNumGw; diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDTO.java index d46d7c2a4..1daea2ee9 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDTO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationInMaterialDetail/repository/todo/ReservationInMaterialDetailDTO.java @@ -455,6 +455,10 @@ public class ReservationInMaterialDetailDTO extends BaseVOEntity { private String productionDate; @ApiModelProperty("火险保费") private BigDecimal fireInsureFee; + @ApiModelProperty("夫力费") + private BigDecimal manpowerFee; + @ApiModelProperty("仓租费") + private BigDecimal totalWarehouseRent; //订单行号 private String lineNumGw; diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/entity/ReservationOutMaterialDetail.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/entity/ReservationOutMaterialDetail.java index 4c5df285d..a5ddd8b71 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/entity/ReservationOutMaterialDetail.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/entity/ReservationOutMaterialDetail.java @@ -501,6 +501,9 @@ public class ReservationOutMaterialDetail extends BaseVOEntity { @Excel(name = "库存数量") private BigDecimal stockQuantity; + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; + //订单行号 private String lineNumGw; diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/po/ReservationOutMaterialDetailPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/po/ReservationOutMaterialDetailPO.java index 8164f2a13..1e19fb7dd 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/po/ReservationOutMaterialDetailPO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/po/ReservationOutMaterialDetailPO.java @@ -519,6 +519,9 @@ public class ReservationOutMaterialDetailPO extends ReservationStockOutOrderBase @Excel(name = "库存数量") private BigDecimal stockQuantity; + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; + @ApiModelProperty("出库异常明细:计划数量(复核异常场景=拣货数量)") @TableField(exist = false) private BigDecimal abnormalPlanQuantity; diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/todo/ReservationOutMaterialDetailDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/todo/ReservationOutMaterialDetailDO.java index ab5e26364..2df55d8d9 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/todo/ReservationOutMaterialDetailDO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/todo/ReservationOutMaterialDetailDO.java @@ -477,6 +477,8 @@ public class ReservationOutMaterialDetailDO extends BaseVOEntity { @Excel(name = "库存数量") private BigDecimal stockQuantity; + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; @ApiModelProperty("调整前库存数量") @Excel(name = "调整前库存数量") diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/todo/ReservationOutMaterialDetailDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/todo/ReservationOutMaterialDetailDTO.java index 46e5cdee6..ec888f1b0 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/todo/ReservationOutMaterialDetailDTO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationOutMaterialDetail/repository/todo/ReservationOutMaterialDetailDTO.java @@ -469,6 +469,8 @@ public class ReservationOutMaterialDetailDTO extends BaseVOEntity { @Excel(name = "库存数量") private BigDecimal stockQuantity; + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; @ApiModelProperty("调整前库存数量") @Excel(name = "调整前库存数量") diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/entity/ReservationStockOutOrder.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/entity/ReservationStockOutOrder.java index 74ade0268..1a8a18599 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/entity/ReservationStockOutOrder.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/entity/ReservationStockOutOrder.java @@ -503,4 +503,16 @@ public class ReservationStockOutOrder extends BaseVOEntity { @Excel(name = "车次") private String shuttleNo; + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; + + @ApiModelProperty("业务计价类型") + private String businessChargeType; + + @ApiModelProperty("业务计价方式") + private String businessPriceWay; + + @ApiModelProperty("折扣") + private BigDecimal discount; + } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/po/ReservationStockOutOrderPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/po/ReservationStockOutOrderPO.java index b890a96f5..7f93ccfa5 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/po/ReservationStockOutOrderPO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/po/ReservationStockOutOrderPO.java @@ -526,4 +526,16 @@ public class ReservationStockOutOrderPO extends BaseVOEntity { @Excel(name = "车次") private String shuttleNo; + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; + + @ApiModelProperty("业务计价类型") + private String businessChargeType; + + @ApiModelProperty("业务计价方式") + private String businessPriceWay; + + @ApiModelProperty("折扣") + private BigDecimal discount; + } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/todo/ReservationStockOutOrderDO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/todo/ReservationStockOutOrderDO.java index fe791b4f5..066e84512 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/todo/ReservationStockOutOrderDO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/todo/ReservationStockOutOrderDO.java @@ -579,4 +579,16 @@ public class ReservationStockOutOrderDO extends BaseVOEntity { @ApiModelProperty("车次") private String shuttleNo; + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; + + @ApiModelProperty("业务计价类型") + private String businessChargeType; + + @ApiModelProperty("业务计价方式") + private String businessPriceWay; + + @ApiModelProperty("折扣") + private BigDecimal discount; + } \ No newline at end of file diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/todo/ReservationStockOutOrderDTO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/todo/ReservationStockOutOrderDTO.java index 8372dce92..f6611d76e 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/todo/ReservationStockOutOrderDTO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockOutOrder/repository/todo/ReservationStockOutOrderDTO.java @@ -568,4 +568,16 @@ public class ReservationStockOutOrderDTO extends ReservationStockOutOrderBaseDTO @ApiModelProperty("车次") private String shuttleNo; + @ApiModelProperty("总仓租") + private BigDecimal totalWarehouseRent; + + @ApiModelProperty("业务计价类型") + private String businessChargeType; + + @ApiModelProperty("业务计价方式") + private String businessPriceWay; + + @ApiModelProperty("折扣") + private BigDecimal discount; + } \ No newline at end of file diff --git a/mhd_oms/src/main/resources/mapper/executionStockOutOrder/ExecutionStockOutOrderMapper.xml b/mhd_oms/src/main/resources/mapper/executionStockOutOrder/ExecutionStockOutOrderMapper.xml index 340755509..631d9f187 100644 --- a/mhd_oms/src/main/resources/mapper/executionStockOutOrder/ExecutionStockOutOrderMapper.xml +++ b/mhd_oms/src/main/resources/mapper/executionStockOutOrder/ExecutionStockOutOrderMapper.xml @@ -112,6 +112,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + @@ -130,7 +134,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.CUSTOMS_INSPECTION_FLAG,a.NEED_DECLARE_FLAG,a.NEED_TRANSPORT_FLAG,a.picture_app,a.reservation_audit_time,a.reservation_audit_name ,a.reservation_audit_id,a.issue_name,a.issue_id,a.issue_time,a.issue_status,a.tms_order_number, a.DIRECTOR_NAME ,a.DIRECTOR_PHONE,a.DIRECTOR_ID,a.RESERVATION_ORDER_SOURCE,a.OUTBOUND_TIME,a.RETURN_QUANTITY,a.DELIVERY_NAME,a.CUSTOMER_NUMBER,a.INVOICE_NUMBER,a.RETURN_ORDER_NUMBER,a.TOTAL_AMOUNT, - a.ROUTE,a.PUSH_TIME,a.PUSH_STATUS,a.PUSH_BY,a.PUSH_BY_NAME,a.LINE_CODE,a.LINE_NAME,a.SHUTTLE_NO + a.ROUTE,a.PUSH_TIME,a.PUSH_STATUS,a.PUSH_BY,a.PUSH_BY_NAME,a.LINE_CODE,a.LINE_NAME,a.SHUTTLE_NO, + a.TOTAL_WAREHOUSE_RENT,a.BUSINESS_CHARGE_TYPE,a.BUSINESS_PRICE_WAY,a.DISCOUNT diff --git a/mhd_oms/src/main/resources/mapper/reservationInMaterialDetail/ReservationInMaterialDetailMapper.xml b/mhd_oms/src/main/resources/mapper/reservationInMaterialDetail/ReservationInMaterialDetailMapper.xml index 0c4473956..2b38b76f2 100644 --- a/mhd_oms/src/main/resources/mapper/reservationInMaterialDetail/ReservationInMaterialDetailMapper.xml +++ b/mhd_oms/src/main/resources/mapper/reservationInMaterialDetail/ReservationInMaterialDetailMapper.xml @@ -90,6 +90,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -110,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.lot_no , a.material_detail_id, a.organization_id, a.organization_name, a.top_organization_id, a.unique_id, a.in_order_number, a.material_base_info_id, a.material_code, a.material_name, a.bar_code, a.quantity, a.receipt_quantity, a.shelves_quantity, - a.receipt_status, a.shelves_status, a.pack_id, a.pack_code, a.pack_name,a.drink_date,a.fire_insure_fee, + a.receipt_status, a.shelves_status, a.pack_id, a.pack_code, a.pack_name,a.drink_date,a.fire_insure_fee,a.manpower_fee,a.total_warehouse_rent, CASE WHEN a.pack_detail_id IS NULL OR TRIM(a.pack_detail_id) = '' THEN NULL ELSE CAST(a.pack_detail_id AS BIGINT) diff --git a/mhd_oms/src/main/resources/mapper/reservationOutMaterialDetail/ReservationOutMaterialDetailMapper.xml b/mhd_oms/src/main/resources/mapper/reservationOutMaterialDetail/ReservationOutMaterialDetailMapper.xml index f63d86c9e..dc571f3fa 100644 --- a/mhd_oms/src/main/resources/mapper/reservationOutMaterialDetail/ReservationOutMaterialDetailMapper.xml +++ b/mhd_oms/src/main/resources/mapper/reservationOutMaterialDetail/ReservationOutMaterialDetailMapper.xml @@ -94,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -115,6 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.single_gross_weight , a.lot_no , a.stock_quantity , + a.total_warehouse_rent , a.stock_unit ,a.in_order_number , a.material_detail_id, a.organization_id, a.organization_name, a.top_organization_id, a.unique_id, a.out_order_number, a.material_base_info_id, a.line_number, a.material_code, a.material_name, a.bar_code, a.weight_limit, a.volume_limit, a.quantity, a.already_allocation_quantity, a.allocation_quantity, a.picking_quantity, a.check_quantity, ROUND(GREATEST(0, IFNULL(a.quantity, 0) - IFNULL(a.check_quantity, 0), IFNULL(a.picking_quantity, 0) - IFNULL(a.check_quantity, 0)), 2) AS wait_check_quantity, diff --git a/mhd_oms/src/main/resources/mapper/reservationStockOutOrder/ReservationStockOutOrderMapper.xml b/mhd_oms/src/main/resources/mapper/reservationStockOutOrder/ReservationStockOutOrderMapper.xml index aec1a3b05..a933ca2bf 100644 --- a/mhd_oms/src/main/resources/mapper/reservationStockOutOrder/ReservationStockOutOrderMapper.xml +++ b/mhd_oms/src/main/resources/mapper/reservationStockOutOrder/ReservationStockOutOrderMapper.xml @@ -112,6 +112,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + @@ -130,7 +134,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.CUSTOMS_INSPECTION_FLAG,a.NEED_DECLARE_FLAG,a.NEED_TRANSPORT_FLAG,a.picture_app,a.reservation_audit_time,a.reservation_audit_name ,a.reservation_audit_id,a.issue_name,a.issue_id,a.issue_time,a.issue_status,a.tms_order_number, a.DIRECTOR_NAME ,a.DIRECTOR_PHONE,a.DIRECTOR_ID,a.RESERVATION_ORDER_SOURCE,a.OUTBOUND_TIME,a.RETURN_QUANTITY,a.DELIVERY_NAME,a.CUSTOMER_NUMBER,a.INVOICE_NUMBER,a.RETURN_ORDER_NUMBER,a.TOTAL_AMOUNT, - a.ROUTE,a.PUSH_TIME,a.PUSH_STATUS,a.PUSH_BY,a.PUSH_BY_NAME,a.execution_out_order_number,a.LINE_CODE,a.LINE_NAME,a.SHUTTLE_NO + a.ROUTE,a.PUSH_TIME,a.PUSH_STATUS,a.PUSH_BY,a.PUSH_BY_NAME,a.execution_out_order_number,a.LINE_CODE,a.LINE_NAME,a.SHUTTLE_NO, + a.TOTAL_WAREHOUSE_RENT,a.BUSINESS_CHARGE_TYPE,a.BUSINESS_PRICE_WAY,a.DISCOUNT From 10bba6fd9efe9535a9d0cbb8c6d91adf0751a47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 16:59:46 +0800 Subject: [PATCH 11/32] =?UTF-8?q?=E7=89=A9=E6=96=99=E4=BB=93=E7=A7=9F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/api/domain/MaterialBaseInfoFeign.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/MaterialBaseInfoFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/MaterialBaseInfoFeign.java index 2d70d66e6..a8ec289af 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/MaterialBaseInfoFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/domain/MaterialBaseInfoFeign.java @@ -250,4 +250,20 @@ public class MaterialBaseInfoFeign extends BaseVOEntity{ @ApiModelProperty(name = "是否正常物料: 0-是 1-否") private Integer isNormalMaterial; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file From d10a81fc42b6f79439539055e57d646dca7f3a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 17:37:33 +0800 Subject: [PATCH 12/32] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=B7=BB=E5=8A=A0xxl?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mhd-modules/mhd-system/pom.xml | 5 + .../ContractManageApplicationService.java | 42 +++- .../repository/util/XxlJobBusinessConfig.java | 20 ++ .../repository/util/XxlJobOpenApiUtil.java | 214 ++++++++++------- mhd_bms/pom.xml | 5 + ...SettlementCustomersApplicationService.java | 82 +++++-- .../repository/util/XxlJobBusinessConfig.java | 20 ++ .../repository/util/XxlJobOpenApiUtil.java | 215 +++++++++++------- 8 files changed, 399 insertions(+), 204 deletions(-) create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobBusinessConfig.java create mode 100644 mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobBusinessConfig.java diff --git a/mhd-modules/mhd-system/pom.xml b/mhd-modules/mhd-system/pom.xml index cb2dcc86f..b88cb5ba2 100644 --- a/mhd-modules/mhd-system/pom.xml +++ b/mhd-modules/mhd-system/pom.xml @@ -116,6 +116,11 @@ xxl-job-core 2.4.0 + + org.jsoup + jsoup + 1.17.2 + 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 a66ed0d6c..cfcd73da3 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 @@ -98,7 +98,8 @@ public class ContractManageApplicationService { private ContractManageParametersMapper contractManageParametersMapper; @Autowired private IContractManageParametersService contractManageParametersService; - + @Resource + private XxlJobOpenApiUtil apiUtil; @Value("${xxl.job.admin.addresses}") private String adminAddresses; private static final String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozNTYzLCJ0b3BPcmdhbml6YXRpb25JZCI6MjgyNywidXNlcl9rZXkiOiI0N2MzY2U4My0wMmFjLTQ0NTQtOTdiYS1lYmQwMDc2MzNiNDMiLCJ1c2VybmFtZSI6ImNhbmdtYSJ9.tnZyywwburfBo3Kizdhfk5eYdXbrrZ9976Z0W7GrS6UqSpKwfI2RwdRwfYx7DbD7Ri1Fdj_eOVxBkjvdFF226Q"; @@ -984,27 +985,44 @@ public class ContractManageApplicationService { } } + /** + * 创建夜间23点定时任务 + * @param shipperId 结算对象id,作为任务参数 + * @return xxlJobId 保存到业务表,后续用于删除/暂停 + */ public Integer addXxlJob(String shipperId) { - //1.实例化工具类,建议交给Spring管理 - XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token); - - //2.构建新增任务参数 XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq(); - req.setJobGroup(5); //你的执行器组id + req.setJobGroup(5); req.setJobDesc("整租推送计费单据/流水任务,结算对象id:" + shipperId); - req.setJobCron("0 0 1 * * ?"); + req.setAuthor("system"); + req.setAlarmEmail(""); + req.setScheduleType("CRON"); + // 每天晚上23点执行 + req.setScheduleConf("0 0 1 * * ?"); + req.setGlueType("BEAN"); req.setExecutorHandler("pushContractManageToBms"); - req.setExecutorParam(shipperId); //传入业务单号 + req.setExecutorParam(shipperId); + req.setGlueRemark(""); + req.setGlueSource(""); + req.setExecutorRouteStrategy("FIRST"); + req.setChildJobId(null); + req.setMisfireStrategy("DO_NOTHING"); + req.setExecutorBlockStrategy("SERIAL_EXECUTION"); + req.setExecutorTimeout(0); + req.setExecutorFailRetryCount(0); - //3.调用创建任务接口 ,返回任务ID - Integer xxlJobId = apiUtil.addJob(req); - if(xxlJobId == null){ - // 创建定时任务失败,抛异常/重试,不要让单据直接保存成功 + boolean addOk = apiUtil.addJob(req); + if (!addOk) { throw new RuntimeException("创建夜间定时任务失败"); } + Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId); + if (xxlJobId == null) { + throw new RuntimeException("定时任务创建成功,但查询jobId失败"); + } return xxlJobId; } + public void stopXxlJob(Integer shipperId) { //1.实例化工具类,建议交给Spring管理 XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token); diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobBusinessConfig.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobBusinessConfig.java new file mode 100644 index 000000000..3e4e6508e --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobBusinessConfig.java @@ -0,0 +1,20 @@ +package com.mhd.basic.domain.contractManage.repository.util; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class XxlJobBusinessConfig { + + @Value("${xxl.job.admin.address}") + private String adminAddress; + + @Value("${xxl.job.admin.cookie}") + private String adminCookie; + + @Bean + public XxlJobOpenApiUtil xxlJobOpenApiUtil() { + return new XxlJobOpenApiUtil(adminAddress, adminCookie); + } +} \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java index 5edcdea53..ffbd10e16 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java @@ -1,138 +1,184 @@ package com.mhd.basic.domain.contractManage.repository.util; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; -import cn.hutool.json.JSONUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; import java.util.Map; /** - * XXL‑JOB OpenApi 工具类 + * 调用XXL‑JOB后台页面接口(抓包获取 /jobinfo/*) + * 鉴权依赖JSESSIONID Cookie,非官方openapi;老版本xxl‑job无新增任务openapi */ @Slf4j public class XxlJobOpenApiUtil { - /** xxl‑job admin地址,例:http://127.0.0.1:8080/xxl‑job‑admin */ private final String adminUrl; - /** 系统配置里的AccessToken */ - private final String accessToken; + private final String cookie; - public XxlJobOpenApiUtil(String adminUrl, String accessToken) { - this.adminUrl = adminUrl.endsWith("/") ? adminUrl.substring(0, adminUrl.length() -1) : adminUrl; - this.accessToken = accessToken; + /** + * @param adminUrl xxl‑job admin地址 示例:http://127.0.0.1:8080/xxl-job-admin + * @param cookie 浏览器登录后的完整Cookie(JSESSIONID=xxx) + */ + public XxlJobOpenApiUtil(String adminUrl, String cookie) { + this.adminUrl = StrUtil.removeSuffix(adminUrl, "/"); + this.cookie = cookie; } /** - * 新增定时任务 - * @param addReq 请求参数 - * @return jobId 任务ID,返回null代表调用失败 + * 新增定时任务 POST /jobinfo/add + * @param addReq 请求实体,与浏览器payload字段完全对齐 + * @return true=新增成功,false=失败 */ - public Integer addJob(JobInfoAddReq addReq) { - String url = adminUrl + "/api/jobinfo/add"; + public boolean addJob(JobInfoAddReq addReq) { + String url = adminUrl + "/jobinfo/add"; try { - // 实体对象转map,解决form不能传bean的爆红 Map formMap = BeanUtil.beanToMap(addReq); - HttpResponse response = HttpRequest.post(url) - .header("Authorization", accessToken) - .form(formMap) //传入map,不再传实体 + .header("Cookie", cookie) + .form(formMap) .execute(); + int status = response.getStatus(); + log.info("[XxlJob] addJob status:{}", status); + // 新增成功302重定向到列表页 + return status == 302; + } catch (Exception e) { + log.error("[XxlJob] addJob异常", e); + return false; + } + } - String body = response.body(); - log.info("xxl‑job addJob resp:{}", body); - XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); - if (resp != null && resp.getCode() == 200) { - return Integer.valueOf(resp.getContent().toString()); + /** + * 根据【任务描述+执行器参数】查询jobId + * @param jobDesc 任务描述 + * @param executorParam 任务参数(业务shipperId) + * @return jobId,查不到返回null + */ + public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam) { + String url = adminUrl + "/jobinfo/pageList"; + try { + HttpResponse response = HttpRequest.post(url) + .header("Cookie", cookie) + .form("jobGroup", "") + .form("jobDesc", jobDesc) + .form("executorHandler", "") + .form("executorParam", executorParam) + .form("triggerStatus", "-1") + .execute(); + String html = response.body(); + if (StrUtil.isBlank(html)) { + return null; + } + Document doc = Jsoup.parse(html); + Elements trList = doc.select("tr"); + for (Element tr : trList) { + String dataId = tr.attr("data-id"); + if (StrUtil.isBlank(dataId)) { + continue; + } + return Integer.parseInt(dataId); } - log.error("新增xxl‑job任务失败,resp:{}", body); return null; } catch (Exception e) { - log.error("调用xxl‑job addJob异常", e); + log.error("[XxlJob] queryJobId异常", e); return null; } } + /** + * 暂停任务 POST /jobinfo/pause + * @param jobId xxl任务id + * @return true成功 + */ + public boolean pauseJob(Integer jobId) { + if (jobId == null) { + return false; + } + String url = adminUrl + "/jobinfo/pause"; + try { + HttpResponse response = HttpRequest.post(url) + .header("Cookie", cookie) + .form("id", jobId) + .execute(); + return response.getStatus() == 302; + } catch (Exception e) { + log.error("[XxlJob] pauseJob jobId:{}异常", jobId, e); + return false; + } + } /** - * 删除任务 - * @param jobId 任务id + * 开启任务 POST /jobinfo/start + * @param jobId xxl任务id + * @return true成功 + */ + public boolean startJob(Integer jobId) { + if (jobId == null) { + return false; + } + String url = adminUrl + "/jobinfo/start"; + try { + HttpResponse response = HttpRequest.post(url) + .header("Cookie", cookie) + .form("id", jobId) + .execute(); + return response.getStatus() == 302; + } catch (Exception e) { + log.error("[XxlJob] startJob jobId:{}异常", jobId, e); + return false; + } + } + + /** + * 删除任务 POST /jobinfo/remove + * @param jobId xxl任务id * @return true成功 */ public boolean removeJob(Integer jobId) { - String url = adminUrl + "/api/jobinfo/remove"; - try (HttpResponse response = HttpRequest.post(url) - .header("Authorization", accessToken) - .form("id", jobId) - .execute()) { - String body = response.body(); - XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); - if (resp != null && resp.getCode() == 200) { - return true; - } - log.error("删除xxl‑job任务失败 jobId:{},resp:{}", jobId, body); + if (jobId == null) { return false; + } + String url = adminUrl + "/jobinfo/remove"; + try { + HttpResponse response = HttpRequest.post(url) + .header("Cookie", cookie) + .form("id", jobId) + .execute(); + return response.getStatus() == 302; } catch (Exception e) { - log.error("调用xxl‑job removeJob异常", e); + log.error("[XxlJob] removeJob jobId:{}异常", jobId, e); return false; } } /** - * 暂停任务 + * 请求实体,与浏览器F12抓包payload字段一一对应 */ - public boolean pauseJob(Integer jobId) { - String url = adminUrl + "/api/jobinfo/pause"; - try (HttpResponse response = HttpRequest.post(url) - .header("Authorization", accessToken) - .form("id", jobId) - .execute()) { - String body = response.body(); - XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); - return resp != null && resp.getCode() == 200; - } catch (Exception e) { - log.error("pauseJob异常", e); - return false; - } - } - - - //---------------- 实体 ---------------- - @Data public static class JobInfoAddReq { - /** 执行器组ID xxl_job_group.id */ private Integer jobGroup; - /** 任务描述 */ private String jobDesc; - /** 路由策略 ROUND:轮询 */ - private String executorRouteStrategy = "ROUND"; - /** cron表达式 23点 0 0 23 * * ? */ - private String jobCron; - /** @XxlJob 注解handler名称 */ + private String author; + private String alarmEmail; + private String scheduleType; + private String scheduleConf; + private String glueType; private String executorHandler; - /** 任务参数,这里存业务单号 */ private String executorParam; - /** 阻塞策略 SERIAL_EXECUTION单机串行 */ - private String executorBlockStrategy = "SERIAL_EXECUTION"; - /** 超时时间 0不限制 */ - private Integer executorTimeout = 0; - /** 失败重试次数 */ - private Integer executorFailRetryCount = 0; - /** BEAN模式 */ - private String glueType = "BEAN"; - private String glueSource = ""; - private String glueRemark = ""; - /** 1启用 0停止 */ - private Integer triggerStatus = 1; - } - - @Data - public static class XxlApiResp { - private Integer code; - private Object content; - private String msg; + private String glueRemark; + private String glueSource; + private String executorRouteStrategy; + private Integer childJobId; + private String misfireStrategy; + private String executorBlockStrategy; + private Integer executorTimeout; + private Integer executorFailRetryCount; } } \ No newline at end of file diff --git a/mhd_bms/pom.xml b/mhd_bms/pom.xml index fa731f470..0ed437df8 100644 --- a/mhd_bms/pom.xml +++ b/mhd_bms/pom.xml @@ -100,6 +100,11 @@ xxl-job-core 2.4.0 + + org.jsoup + jsoup + 1.17.2 + com.alibaba diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java index 5d64df651..51b5077e4 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java @@ -44,6 +44,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.*; @@ -78,7 +79,8 @@ public class SettlementCustomersApplicationService { @Value("${xxl.job.admin.addresses}") private String adminAddresses; private static final String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozNTYzLCJ0b3BPcmdhbml6YXRpb25JZCI6MjgyNywidXNlcl9rZXkiOiI0N2MzY2U4My0wMmFjLTQ0NTQtOTdiYS1lYmQwMDc2MzNiNDMiLCJ1c2VybmFtZSI6ImNhbmdtYSJ9.tnZyywwburfBo3Kizdhfk5eYdXbrrZ9976Z0W7GrS6UqSpKwfI2RwdRwfYx7DbD7Ri1Fdj_eOVxBkjvdFF226Q"; - + @Resource + private XxlJobOpenApiUtil apiUtil; /** * 分页查询结算对象列表 */ @@ -352,48 +354,82 @@ public class SettlementCustomersApplicationService { return settlementCustomersDomainService.update(settlementCustomersDO); } + + /** + * 创建夜间23点定时任务 + * @param shipperId 结算对象id,作为任务参数 + * @return xxlJobId 保存到业务表,后续用于删除/暂停 + */ public Integer addXxlJob(String shipperId) { - //1.实例化工具类,建议交给Spring管理 - XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token); - - //2.构建新增任务参数 XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq(); - req.setJobGroup(3); //你的执行器组id + req.setJobGroup(5); req.setJobDesc("散租推送计费单据/流水任务,结算对象id:" + shipperId); - req.setJobCron("0 0 1 * * ?"); + req.setAuthor("system"); + req.setAlarmEmail(""); + req.setScheduleType("CRON"); + // 每天晚上23点执行 + req.setScheduleConf("0 0 1 * * ?"); + req.setGlueType("BEAN"); req.setExecutorHandler("pushBillingRecord"); - req.setExecutorParam(shipperId); //传入业务单号 + req.setExecutorParam(shipperId); + req.setGlueRemark(""); + req.setGlueSource(""); + req.setExecutorRouteStrategy("FIRST"); + req.setChildJobId(null); + req.setMisfireStrategy("DO_NOTHING"); + req.setExecutorBlockStrategy("SERIAL_EXECUTION"); + req.setExecutorTimeout(0); + req.setExecutorFailRetryCount(0); - //3.调用创建任务接口 ,返回任务ID - Integer xxlJobId = apiUtil.addJob(req); - if(xxlJobId == null){ - // 创建定时任务失败,抛异常/重试,不要让单据直接保存成功 + boolean addOk = apiUtil.addJob(req); + if (!addOk) { throw new RuntimeException("创建夜间定时任务失败"); } + Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId); + if (xxlJobId == null) { + throw new RuntimeException("定时任务创建成功,但查询jobId失败"); + } return xxlJobId; } + /** + * 创建夜间23点定时任务 + * @param shipperId 结算对象id,作为任务参数 + * @return xxlJobId 保存到业务表,后续用于删除/暂停 + */ public Integer addXxlJob1(String shipperId) { - //1.实例化工具类,建议交给Spring管理 - XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token); - - //2.构建新增任务参数 XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq(); - req.setJobGroup(6); //你的执行器组id + req.setJobGroup(5); req.setJobDesc("计费单据/流水生成发票任务,结算对象id:" + shipperId); - req.setJobCron("0 0 1 * * ?"); + req.setAuthor("system"); + req.setAlarmEmail(""); + req.setScheduleType("CRON"); + // 每天晚上23点执行 + req.setScheduleConf("0 0 1 * * ?"); + req.setGlueType("BEAN"); req.setExecutorHandler("pushBillManage"); - req.setExecutorParam(shipperId); //传入业务单号 + req.setExecutorParam(shipperId); + req.setGlueRemark(""); + req.setGlueSource(""); + req.setExecutorRouteStrategy("FIRST"); + req.setChildJobId(null); + req.setMisfireStrategy("DO_NOTHING"); + req.setExecutorBlockStrategy("SERIAL_EXECUTION"); + req.setExecutorTimeout(0); + req.setExecutorFailRetryCount(0); - //3.调用创建任务接口 ,返回任务ID - Integer xxlJobId = apiUtil.addJob(req); - if(xxlJobId == null){ - // 创建定时任务失败,抛异常/重试,不要让单据直接保存成功 + boolean addOk = apiUtil.addJob(req); + if (!addOk) { throw new RuntimeException("创建夜间定时任务失败"); } + Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId); + if (xxlJobId == null) { + throw new RuntimeException("定时任务创建成功,但查询jobId失败"); + } return xxlJobId; } + public void stopXxlJob(Integer shipperId) { //1.实例化工具类,建议交给Spring管理 XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobBusinessConfig.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobBusinessConfig.java new file mode 100644 index 000000000..d66a61ff2 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobBusinessConfig.java @@ -0,0 +1,20 @@ +package com.mhd.bms.domain.settlementCustomers.repository.util; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class XxlJobBusinessConfig { + + @Value("${xxl.job.admin.address}") + private String adminAddress; + + @Value("${xxl.job.admin.cookie}") + private String adminCookie; + + @Bean + public XxlJobOpenApiUtil xxlJobOpenApiUtil() { + return new XxlJobOpenApiUtil(adminAddress, adminCookie); + } +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java index 41953d8c4..791df0538 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -1,139 +1,184 @@ package com.mhd.bms.domain.settlementCustomers.repository.util; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; -import cn.hutool.core.lang.Assert; -import cn.hutool.json.JSONUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; import java.util.Map; /** - * XXL‑JOB OpenApi 工具类 + * 调用XXL‑JOB后台页面接口(抓包获取 /jobinfo/*) + * 鉴权依赖JSESSIONID Cookie,非官方openapi;老版本xxl‑job无新增任务openapi */ @Slf4j public class XxlJobOpenApiUtil { - /** xxl‑job admin地址,例:http://127.0.0.1:8080/xxl‑job‑admin */ private final String adminUrl; - /** 系统配置里的AccessToken */ - private final String accessToken; + private final String cookie; - public XxlJobOpenApiUtil(String adminUrl, String accessToken) { - this.adminUrl = adminUrl.endsWith("/") ? adminUrl.substring(0, adminUrl.length() -1) : adminUrl; - this.accessToken = accessToken; + /** + * @param adminUrl xxl‑job admin地址 示例:http://127.0.0.1:8080/xxl-job-admin + * @param cookie 浏览器登录后的完整Cookie(JSESSIONID=xxx) + */ + public XxlJobOpenApiUtil(String adminUrl, String cookie) { + this.adminUrl = StrUtil.removeSuffix(adminUrl, "/"); + this.cookie = cookie; } /** - * 新增定时任务 - * @param addReq 请求参数 - * @return jobId 任务ID,返回null代表调用失败 + * 新增定时任务 POST /jobinfo/add + * @param addReq 请求实体,与浏览器payload字段完全对齐 + * @return true=新增成功,false=失败 */ - public Integer addJob(JobInfoAddReq addReq) { - String url = adminUrl + "/api/jobinfo/add"; + public boolean addJob(JobInfoAddReq addReq) { + String url = adminUrl + "/jobinfo/add"; try { - // 实体对象转map,解决form不能传bean的爆红 Map formMap = BeanUtil.beanToMap(addReq); - HttpResponse response = HttpRequest.post(url) - .header("Authorization", accessToken) - .form(formMap) //传入map,不再传实体 + .header("Cookie", cookie) + .form(formMap) .execute(); + int status = response.getStatus(); + log.info("[XxlJob] addJob status:{}", status); + // 新增成功302重定向到列表页 + return status == 302; + } catch (Exception e) { + log.error("[XxlJob] addJob异常", e); + return false; + } + } - String body = response.body(); - log.info("xxl‑job addJob resp:{}", body); - XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); - if (resp != null && resp.getCode() == 200) { - return Integer.valueOf(resp.getContent().toString()); + /** + * 根据【任务描述+执行器参数】查询jobId + * @param jobDesc 任务描述 + * @param executorParam 任务参数(业务shipperId) + * @return jobId,查不到返回null + */ + public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam) { + String url = adminUrl + "/jobinfo/pageList"; + try { + HttpResponse response = HttpRequest.post(url) + .header("Cookie", cookie) + .form("jobGroup", "") + .form("jobDesc", jobDesc) + .form("executorHandler", "") + .form("executorParam", executorParam) + .form("triggerStatus", "-1") + .execute(); + String html = response.body(); + if (StrUtil.isBlank(html)) { + return null; + } + Document doc = Jsoup.parse(html); + Elements trList = doc.select("tr"); + for (Element tr : trList) { + String dataId = tr.attr("data-id"); + if (StrUtil.isBlank(dataId)) { + continue; + } + return Integer.parseInt(dataId); } - log.error("新增xxl‑job任务失败,resp:{}", body); return null; } catch (Exception e) { - log.error("调用xxl‑job addJob异常", e); + log.error("[XxlJob] queryJobId异常", e); return null; } } + /** + * 暂停任务 POST /jobinfo/pause + * @param jobId xxl任务id + * @return true成功 + */ + public boolean pauseJob(Integer jobId) { + if (jobId == null) { + return false; + } + String url = adminUrl + "/jobinfo/pause"; + try { + HttpResponse response = HttpRequest.post(url) + .header("Cookie", cookie) + .form("id", jobId) + .execute(); + return response.getStatus() == 302; + } catch (Exception e) { + log.error("[XxlJob] pauseJob jobId:{}异常", jobId, e); + return false; + } + } /** - * 删除任务 - * @param jobId 任务id + * 开启任务 POST /jobinfo/start + * @param jobId xxl任务id + * @return true成功 + */ + public boolean startJob(Integer jobId) { + if (jobId == null) { + return false; + } + String url = adminUrl + "/jobinfo/start"; + try { + HttpResponse response = HttpRequest.post(url) + .header("Cookie", cookie) + .form("id", jobId) + .execute(); + return response.getStatus() == 302; + } catch (Exception e) { + log.error("[XxlJob] startJob jobId:{}异常", jobId, e); + return false; + } + } + + /** + * 删除任务 POST /jobinfo/remove + * @param jobId xxl任务id * @return true成功 */ public boolean removeJob(Integer jobId) { - String url = adminUrl + "/api/jobinfo/remove"; - try (HttpResponse response = HttpRequest.post(url) - .header("Authorization", accessToken) - .form("id", jobId) - .execute()) { - String body = response.body(); - XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); - if (resp != null && resp.getCode() == 200) { - return true; - } - log.error("删除xxl‑job任务失败 jobId:{},resp:{}", jobId, body); + if (jobId == null) { return false; + } + String url = adminUrl + "/jobinfo/remove"; + try { + HttpResponse response = HttpRequest.post(url) + .header("Cookie", cookie) + .form("id", jobId) + .execute(); + return response.getStatus() == 302; } catch (Exception e) { - log.error("调用xxl‑job removeJob异常", e); + log.error("[XxlJob] removeJob jobId:{}异常", jobId, e); return false; } } /** - * 暂停任务 + * 请求实体,与浏览器F12抓包payload字段一一对应 */ - public boolean pauseJob(Integer jobId) { - String url = adminUrl + "/api/jobinfo/pause"; - try (HttpResponse response = HttpRequest.post(url) - .header("Authorization", accessToken) - .form("id", jobId) - .execute()) { - String body = response.body(); - XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class); - return resp != null && resp.getCode() == 200; - } catch (Exception e) { - log.error("pauseJob异常", e); - return false; - } - } - - - //---------------- 实体 ---------------- - @Data public static class JobInfoAddReq { - /** 执行器组ID xxl_job_group.id */ private Integer jobGroup; - /** 任务描述 */ private String jobDesc; - /** 路由策略 ROUND:轮询 */ - private String executorRouteStrategy = "ROUND"; - /** cron表达式 23点 0 0 23 * * ? */ - private String jobCron; - /** @XxlJob 注解handler名称 */ + private String author; + private String alarmEmail; + private String scheduleType; + private String scheduleConf; + private String glueType; private String executorHandler; - /** 任务参数,这里存业务单号 */ private String executorParam; - /** 阻塞策略 SERIAL_EXECUTION单机串行 */ - private String executorBlockStrategy = "SERIAL_EXECUTION"; - /** 超时时间 0不限制 */ - private Integer executorTimeout = 0; - /** 失败重试次数 */ - private Integer executorFailRetryCount = 0; - /** BEAN模式 */ - private String glueType = "BEAN"; - private String glueSource = ""; - private String glueRemark = ""; - /** 1启用 0停止 */ - private Integer triggerStatus = 1; - } - - @Data - public static class XxlApiResp { - private Integer code; - private Object content; - private String msg; + private String glueRemark; + private String glueSource; + private String executorRouteStrategy; + private Integer childJobId; + private String misfireStrategy; + private String executorBlockStrategy; + private Integer executorTimeout; + private Integer executorFailRetryCount; } } \ No newline at end of file From c043da88e44b96ff0f0da270c8123a3534e257d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 17:41:01 +0800 Subject: [PATCH 13/32] groupid --- .../SettlementCustomersApplicationService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java index 51b5077e4..9e2ac4778 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java @@ -362,7 +362,7 @@ public class SettlementCustomersApplicationService { */ public Integer addXxlJob(String shipperId) { XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq(); - req.setJobGroup(5); + req.setJobGroup(3); req.setJobDesc("散租推送计费单据/流水任务,结算对象id:" + shipperId); req.setAuthor("system"); req.setAlarmEmail(""); @@ -399,7 +399,7 @@ public class SettlementCustomersApplicationService { */ public Integer addXxlJob1(String shipperId) { XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq(); - req.setJobGroup(5); + req.setJobGroup(6); req.setJobDesc("计费单据/流水生成发票任务,结算对象id:" + shipperId); req.setAuthor("system"); req.setAlarmEmail(""); From 1689da19113c5c69df3dd3f767201dfc5965c4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 17:51:37 +0800 Subject: [PATCH 14/32] token --- .../repository/util/XxlJobOpenApiUtil.java | 10 +++++----- .../repository/util/XxlJobOpenApiUtil.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java index ffbd10e16..5ae88f9c1 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java @@ -42,7 +42,7 @@ public class XxlJobOpenApiUtil { try { Map formMap = BeanUtil.beanToMap(addReq); HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form(formMap) .execute(); int status = response.getStatus(); @@ -65,7 +65,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/pageList"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("jobGroup", "") .form("jobDesc", jobDesc) .form("executorHandler", "") @@ -104,7 +104,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/pause"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("id", jobId) .execute(); return response.getStatus() == 302; @@ -126,7 +126,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/start"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("id", jobId) .execute(); return response.getStatus() == 302; @@ -148,7 +148,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/remove"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("id", jobId) .execute(); return response.getStatus() == 302; diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java index 791df0538..bb95206e5 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -42,7 +42,7 @@ public class XxlJobOpenApiUtil { try { Map formMap = BeanUtil.beanToMap(addReq); HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form(formMap) .execute(); int status = response.getStatus(); @@ -65,7 +65,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/pageList"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("jobGroup", "") .form("jobDesc", jobDesc) .form("executorHandler", "") @@ -104,7 +104,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/pause"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("id", jobId) .execute(); return response.getStatus() == 302; @@ -126,7 +126,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/start"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("id", jobId) .execute(); return response.getStatus() == 302; @@ -148,7 +148,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/remove"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("id", jobId) .execute(); return response.getStatus() == 302; From d9e5cede10898930f31aa0e38e89cf7d2b7ff7ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 17:59:18 +0800 Subject: [PATCH 15/32] code --- .../contractManage/repository/util/XxlJobOpenApiUtil.java | 8 ++++---- .../repository/util/XxlJobOpenApiUtil.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java index 5ae88f9c1..67aed146e 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java @@ -48,7 +48,7 @@ public class XxlJobOpenApiUtil { int status = response.getStatus(); log.info("[XxlJob] addJob status:{}", status); // 新增成功302重定向到列表页 - return status == 302; + return status == 200; } catch (Exception e) { log.error("[XxlJob] addJob异常", e); return false; @@ -107,7 +107,7 @@ public class XxlJobOpenApiUtil { .header("Authorization", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] pauseJob jobId:{}异常", jobId, e); return false; @@ -129,7 +129,7 @@ public class XxlJobOpenApiUtil { .header("Authorization", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] startJob jobId:{}异常", jobId, e); return false; @@ -151,7 +151,7 @@ public class XxlJobOpenApiUtil { .header("Authorization", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] removeJob jobId:{}异常", jobId, e); return false; diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java index bb95206e5..1886a11c6 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -48,7 +48,7 @@ public class XxlJobOpenApiUtil { int status = response.getStatus(); log.info("[XxlJob] addJob status:{}", status); // 新增成功302重定向到列表页 - return status == 302; + return status == 200; } catch (Exception e) { log.error("[XxlJob] addJob异常", e); return false; @@ -107,7 +107,7 @@ public class XxlJobOpenApiUtil { .header("Authorization", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] pauseJob jobId:{}异常", jobId, e); return false; @@ -129,7 +129,7 @@ public class XxlJobOpenApiUtil { .header("Authorization", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] startJob jobId:{}异常", jobId, e); return false; @@ -151,7 +151,7 @@ public class XxlJobOpenApiUtil { .header("Authorization", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] removeJob jobId:{}异常", jobId, e); return false; From 104fc8bbef80033a69681bb4b0da93b79fb91319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 18:19:25 +0800 Subject: [PATCH 16/32] code --- ...SettlementCustomersApplicationService.java | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java index 9e2ac4778..7c0893de5 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java @@ -46,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; @@ -339,8 +340,10 @@ public class SettlementCustomersApplicationService { if (settlementEntityId != null) { stopXxlJob(settlementCustomersDO.getPushBillingRecordJobId()); stopXxlJob(settlementCustomersDO.getPushBillManageJobId()); - Integer jobId = addXxlJob(String.valueOf(settlementEntityId)); - Integer jobId1 = addXxlJob1(String.valueOf(settlementEntityId)); + //生成唯一业务流水号拼接至JobDesc,保证本次新建任务的JobDesc唯一,据此查询jobId不会命中历史任务 + String xxlJobBizNo = generateXxlJobBizNo(); + Integer jobId = addXxlJob(String.valueOf(settlementEntityId), xxlJobBizNo); + Integer jobId1 = addXxlJob1(String.valueOf(settlementEntityId), xxlJobBizNo); settlementCustomersDO.setPushBillingRecordJobId(jobId); settlementCustomersDO.setPushBillManageJobId(jobId1); } @@ -358,12 +361,13 @@ public class SettlementCustomersApplicationService { /** * 创建夜间23点定时任务 * @param shipperId 结算对象id,作为任务参数 + * @param bizNo 业务流水号,拼接进JobDesc保证每个任务描述唯一,据此精确查询本次新建的xxlJobId * @return xxlJobId 保存到业务表,后续用于删除/暂停 */ - public Integer addXxlJob(String shipperId) { + public Integer addXxlJob(String shipperId, String bizNo) { XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq(); req.setJobGroup(3); - req.setJobDesc("散租推送计费单据/流水任务,结算对象id:" + shipperId); + req.setJobDesc("散租推送计费单据/流水任务,结算对象id:" + shipperId + ",业务流水号:" + bizNo); req.setAuthor("system"); req.setAlarmEmail(""); req.setScheduleType("CRON"); @@ -395,12 +399,13 @@ public class SettlementCustomersApplicationService { /** * 创建夜间23点定时任务 * @param shipperId 结算对象id,作为任务参数 + * @param bizNo 业务流水号,拼接进JobDesc保证每个任务描述唯一,据此精确查询本次新建的xxlJobId * @return xxlJobId 保存到业务表,后续用于删除/暂停 */ - public Integer addXxlJob1(String shipperId) { + public Integer addXxlJob1(String shipperId, String bizNo) { XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq(); req.setJobGroup(6); - req.setJobDesc("计费单据/流水生成发票任务,结算对象id:" + shipperId); + req.setJobDesc("计费单据/流水生成发票任务,结算对象id:" + shipperId + ",业务流水号:" + bizNo); req.setAuthor("system"); req.setAlarmEmail(""); req.setScheduleType("CRON"); @@ -438,6 +443,7 @@ public class SettlementCustomersApplicationService { } private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyMMdd"); + private static final DateTimeFormatter JOB_BIZ_NO_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmssSSS"); private static final Random RANDOM = new Random(); /** @@ -454,6 +460,18 @@ public class SettlementCustomersApplicationService { return "HT" + dateStr + randomStr; } + /** + * 生成xxl-job任务业务流水号:JOB + 当天yyMMddHHmmssSSS + 6位随机数字,保证每次创建的JobDesc唯一 + * 示例:JOB260905102030123123456 + * @return 业务流水号字符串 + */ + public static String generateXxlJobBizNo() { + String dateTimeStr = LocalDateTime.now().format(JOB_BIZ_NO_FORMATTER); + int randomNum = RANDOM.nextInt(1_000_000); + String randomStr = String.format("%06d", randomNum); + return "JOB" + dateTimeStr + randomStr; + } + /** * 批量删除结算对象 */ From cecfe3e777477dd2ff471e35815f22855362ce19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 18:28:34 +0800 Subject: [PATCH 17/32] =?UTF-8?q?jobid=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/util/XxlJobOpenApiUtil.java | 75 ++++++++++++------- .../repository/util/XxlJobOpenApiUtil.java | 75 ++++++++++++------- 2 files changed, 92 insertions(+), 58 deletions(-) diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java index 67aed146e..885fa389c 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java @@ -4,18 +4,18 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import lombok.Data; import lombok.extern.slf4j.Slf4j; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; -import org.jsoup.select.Elements; +import java.util.List; import java.util.Map; /** - * 调用XXL‑JOB后台页面接口(抓包获取 /jobinfo/*) - * 鉴权依赖JSESSIONID Cookie,非官方openapi;老版本xxl‑job无新增任务openapi + * 调用XXL‑JOB后台页面接口 + * 列表接口返回JSON,不再返回HTML */ @Slf4j public class XxlJobOpenApiUtil { @@ -23,10 +23,6 @@ public class XxlJobOpenApiUtil { private final String adminUrl; private final String cookie; - /** - * @param adminUrl xxl‑job admin地址 示例:http://127.0.0.1:8080/xxl-job-admin - * @param cookie 浏览器登录后的完整Cookie(JSESSIONID=xxx) - */ public XxlJobOpenApiUtil(String adminUrl, String cookie) { this.adminUrl = StrUtil.removeSuffix(adminUrl, "/"); this.cookie = cookie; @@ -42,13 +38,13 @@ public class XxlJobOpenApiUtil { try { Map formMap = BeanUtil.beanToMap(addReq); HttpResponse response = HttpRequest.post(url) - .header("Authorization", cookie) + .header("Cookie", cookie) .form(formMap) .execute(); int status = response.getStatus(); log.info("[XxlJob] addJob status:{}", status); // 新增成功302重定向到列表页 - return status == 200; + return status == 302; } catch (Exception e) { log.error("[XxlJob] addJob异常", e); return false; @@ -57,6 +53,7 @@ public class XxlJobOpenApiUtil { /** * 根据【任务描述+执行器参数】查询jobId + * 适配返回JSON格式的pageList接口 * @param jobDesc 任务描述 * @param executorParam 任务参数(业务shipperId) * @return jobId,查不到返回null @@ -65,25 +62,34 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/pageList"; try { HttpResponse response = HttpRequest.post(url) - .header("Authorization", cookie) + .header("Cookie", cookie) .form("jobGroup", "") .form("jobDesc", jobDesc) .form("executorHandler", "") .form("executorParam", executorParam) .form("triggerStatus", "-1") + .form("start", 0) + .form("length", 10) .execute(); - String html = response.body(); - if (StrUtil.isBlank(html)) { + + String jsonStr = response.body(); + if (StrUtil.isBlank(jsonStr)) { return null; } - Document doc = Jsoup.parse(html); - Elements trList = doc.select("tr"); - for (Element tr : trList) { - String dataId = tr.attr("data-id"); - if (StrUtil.isBlank(dataId)) { - continue; + JSONObject jsonObj = JSON.parseObject(jsonStr); + JSONArray jsonArray = jsonObj.getJSONArray("data"); + if(jsonArray == null){ + return null; + } + List dataList = jsonArray.toList(JobPageItem.class); + if (dataList == null || dataList.isEmpty()) { + return null; + } + // 精确匹配jobDesc和executorParam,返回第一条id + for (JobPageItem item : dataList) { + if (StrUtil.equals(item.jobDesc, jobDesc) && StrUtil.equals(item.executorParam, executorParam)) { + return item.id; } - return Integer.parseInt(dataId); } return null; } catch (Exception e) { @@ -92,6 +98,7 @@ public class XxlJobOpenApiUtil { } } + /** * 暂停任务 POST /jobinfo/pause * @param jobId xxl任务id @@ -104,10 +111,10 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/pause"; try { HttpResponse response = HttpRequest.post(url) - .header("Authorization", cookie) + .header("Cookie", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 200; + return response.getStatus() == 302; } catch (Exception e) { log.error("[XxlJob] pauseJob jobId:{}异常", jobId, e); return false; @@ -126,10 +133,10 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/start"; try { HttpResponse response = HttpRequest.post(url) - .header("Authorization", cookie) + .header("Cookie", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 200; + return response.getStatus() == 302; } catch (Exception e) { log.error("[XxlJob] startJob jobId:{}异常", jobId, e); return false; @@ -148,10 +155,10 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/remove"; try { HttpResponse response = HttpRequest.post(url) - .header("Authorization", cookie) + .header("Cookie", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 200; + return response.getStatus() == 302; } catch (Exception e) { log.error("[XxlJob] removeJob jobId:{}异常", jobId, e); return false; @@ -159,7 +166,17 @@ public class XxlJobOpenApiUtil { } /** - * 请求实体,与浏览器F12抓包payload字段一一对应 + * pageList 返回data数组中每一项实体 + */ + @Data + public static class JobPageItem { + private Integer id; + private String jobDesc; + private String executorParam; + } + + /** + * add接口请求实体,与浏览器F12抓包payload字段一一对应 */ @Data public static class JobInfoAddReq { diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java index 1886a11c6..e6255ecaf 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -4,18 +4,18 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import lombok.Data; import lombok.extern.slf4j.Slf4j; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; -import org.jsoup.select.Elements; +import java.util.List; import java.util.Map; /** - * 调用XXL‑JOB后台页面接口(抓包获取 /jobinfo/*) - * 鉴权依赖JSESSIONID Cookie,非官方openapi;老版本xxl‑job无新增任务openapi + * 调用XXL‑JOB后台页面接口 + * 列表接口返回JSON,不再返回HTML */ @Slf4j public class XxlJobOpenApiUtil { @@ -23,10 +23,6 @@ public class XxlJobOpenApiUtil { private final String adminUrl; private final String cookie; - /** - * @param adminUrl xxl‑job admin地址 示例:http://127.0.0.1:8080/xxl-job-admin - * @param cookie 浏览器登录后的完整Cookie(JSESSIONID=xxx) - */ public XxlJobOpenApiUtil(String adminUrl, String cookie) { this.adminUrl = StrUtil.removeSuffix(adminUrl, "/"); this.cookie = cookie; @@ -42,13 +38,13 @@ public class XxlJobOpenApiUtil { try { Map formMap = BeanUtil.beanToMap(addReq); HttpResponse response = HttpRequest.post(url) - .header("Authorization", cookie) + .header("Cookie", cookie) .form(formMap) .execute(); int status = response.getStatus(); log.info("[XxlJob] addJob status:{}", status); // 新增成功302重定向到列表页 - return status == 200; + return status == 302; } catch (Exception e) { log.error("[XxlJob] addJob异常", e); return false; @@ -57,6 +53,7 @@ public class XxlJobOpenApiUtil { /** * 根据【任务描述+执行器参数】查询jobId + * 适配返回JSON格式的pageList接口 * @param jobDesc 任务描述 * @param executorParam 任务参数(业务shipperId) * @return jobId,查不到返回null @@ -65,25 +62,34 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/pageList"; try { HttpResponse response = HttpRequest.post(url) - .header("Authorization", cookie) + .header("Cookie", cookie) .form("jobGroup", "") .form("jobDesc", jobDesc) .form("executorHandler", "") .form("executorParam", executorParam) .form("triggerStatus", "-1") + .form("start", 0) + .form("length", 10) .execute(); - String html = response.body(); - if (StrUtil.isBlank(html)) { + + String jsonStr = response.body(); + if (StrUtil.isBlank(jsonStr)) { return null; } - Document doc = Jsoup.parse(html); - Elements trList = doc.select("tr"); - for (Element tr : trList) { - String dataId = tr.attr("data-id"); - if (StrUtil.isBlank(dataId)) { - continue; + JSONObject jsonObj = JSON.parseObject(jsonStr); + JSONArray jsonArray = jsonObj.getJSONArray("data"); + if(jsonArray == null){ + return null; + } + List dataList = jsonArray.toList(JobPageItem.class); + if (dataList == null || dataList.isEmpty()) { + return null; + } + // 精确匹配jobDesc和executorParam,返回第一条id + for (JobPageItem item : dataList) { + if (StrUtil.equals(item.jobDesc, jobDesc) && StrUtil.equals(item.executorParam, executorParam)) { + return item.id; } - return Integer.parseInt(dataId); } return null; } catch (Exception e) { @@ -92,6 +98,7 @@ public class XxlJobOpenApiUtil { } } + /** * 暂停任务 POST /jobinfo/pause * @param jobId xxl任务id @@ -104,10 +111,10 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/pause"; try { HttpResponse response = HttpRequest.post(url) - .header("Authorization", cookie) + .header("Cookie", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 200; + return response.getStatus() == 302; } catch (Exception e) { log.error("[XxlJob] pauseJob jobId:{}异常", jobId, e); return false; @@ -126,10 +133,10 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/start"; try { HttpResponse response = HttpRequest.post(url) - .header("Authorization", cookie) + .header("Cookie", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 200; + return response.getStatus() == 302; } catch (Exception e) { log.error("[XxlJob] startJob jobId:{}异常", jobId, e); return false; @@ -148,10 +155,10 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/remove"; try { HttpResponse response = HttpRequest.post(url) - .header("Authorization", cookie) + .header("Cookie", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 200; + return response.getStatus() == 302; } catch (Exception e) { log.error("[XxlJob] removeJob jobId:{}异常", jobId, e); return false; @@ -159,7 +166,17 @@ public class XxlJobOpenApiUtil { } /** - * 请求实体,与浏览器F12抓包payload字段一一对应 + * pageList 返回data数组中每一项实体 + */ + @Data + public static class JobPageItem { + private Integer id; + private String jobDesc; + private String executorParam; + } + + /** + * add接口请求实体,与浏览器F12抓包payload字段一一对应 */ @Data public static class JobInfoAddReq { From 3abac7b3d6e30a6a9d6f2ef6521b89026f0d1388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 18:44:25 +0800 Subject: [PATCH 18/32] =?UTF-8?q?jobid=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/util/XxlJobOpenApiUtil.java | 18 +++++------ .../repository/util/XxlJobOpenApiUtil.java | 30 +++++++++---------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java index 885fa389c..e1874c70d 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java @@ -59,21 +59,20 @@ public class XxlJobOpenApiUtil { * @return jobId,查不到返回null */ public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam) { - String url = adminUrl + "/jobinfo/pageList"; + // 手动拼接query参数 + String query = "jobGroup=&jobDesc="+cn.hutool.core.net.URLEncodeUtil.encode(jobDesc) + +"&executorHandler=&executorParam="+cn.hutool.core.net.URLEncodeUtil.encode(executorParam) + +"&triggerStatus=-1&start=0&length=10"; + + String url = adminUrl + "/jobinfo/pageList?" + query; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) - .form("jobGroup", "") - .form("jobDesc", jobDesc) - .form("executorHandler", "") - .form("executorParam", executorParam) - .form("triggerStatus", "-1") - .form("start", 0) - .form("length", 10) + .header("Authorization", cookie) .execute(); String jsonStr = response.body(); if (StrUtil.isBlank(jsonStr)) { + log.warn("[XxlJob] pageList返回空响应"); return null; } JSONObject jsonObj = JSON.parseObject(jsonStr); @@ -85,7 +84,6 @@ public class XxlJobOpenApiUtil { if (dataList == null || dataList.isEmpty()) { return null; } - // 精确匹配jobDesc和executorParam,返回第一条id for (JobPageItem item : dataList) { if (StrUtil.equals(item.jobDesc, jobDesc) && StrUtil.equals(item.executorParam, executorParam)) { return item.id; diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java index e6255ecaf..a85066dc9 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -38,7 +38,7 @@ public class XxlJobOpenApiUtil { try { Map formMap = BeanUtil.beanToMap(addReq); HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form(formMap) .execute(); int status = response.getStatus(); @@ -52,28 +52,27 @@ public class XxlJobOpenApiUtil { } /** - * 根据【任务描述+执行器参数】查询jobId + * 根据【执行器组+任务描述+执行器参数】查询jobId * 适配返回JSON格式的pageList接口 * @param jobDesc 任务描述 * @param executorParam 任务参数(业务shipperId) * @return jobId,查不到返回null */ public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam) { - String url = adminUrl + "/jobinfo/pageList"; + // 手动拼接query参数 + String query = "jobGroup=&jobDesc="+cn.hutool.core.net.URLEncodeUtil.encode(jobDesc) + +"&executorHandler=&executorParam="+cn.hutool.core.net.URLEncodeUtil.encode(executorParam) + +"&triggerStatus=-1&start=0&length=10"; + + String url = adminUrl + "/jobinfo/pageList?" + query; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) - .form("jobGroup", "") - .form("jobDesc", jobDesc) - .form("executorHandler", "") - .form("executorParam", executorParam) - .form("triggerStatus", "-1") - .form("start", 0) - .form("length", 10) + .header("Authorization", cookie) .execute(); String jsonStr = response.body(); if (StrUtil.isBlank(jsonStr)) { + log.warn("[XxlJob] pageList返回空响应"); return null; } JSONObject jsonObj = JSON.parseObject(jsonStr); @@ -85,7 +84,6 @@ public class XxlJobOpenApiUtil { if (dataList == null || dataList.isEmpty()) { return null; } - // 精确匹配jobDesc和executorParam,返回第一条id for (JobPageItem item : dataList) { if (StrUtil.equals(item.jobDesc, jobDesc) && StrUtil.equals(item.executorParam, executorParam)) { return item.id; @@ -99,6 +97,8 @@ public class XxlJobOpenApiUtil { } + + /** * 暂停任务 POST /jobinfo/pause * @param jobId xxl任务id @@ -111,7 +111,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/pause"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("id", jobId) .execute(); return response.getStatus() == 302; @@ -133,7 +133,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/start"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("id", jobId) .execute(); return response.getStatus() == 302; @@ -155,7 +155,7 @@ public class XxlJobOpenApiUtil { String url = adminUrl + "/jobinfo/remove"; try { HttpResponse response = HttpRequest.post(url) - .header("Cookie", cookie) + .header("Authorization", cookie) .form("id", jobId) .execute(); return response.getStatus() == 302; From cb1a1ec9a6269105e734bf961073d0d90e6584ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 18:48:19 +0800 Subject: [PATCH 19/32] =?UTF-8?q?jobid=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/util/XxlJobOpenApiUtil.java | 10 +++++----- .../repository/util/XxlJobOpenApiUtil.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java index e1874c70d..e4a3fba28 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java @@ -43,8 +43,8 @@ public class XxlJobOpenApiUtil { .execute(); int status = response.getStatus(); log.info("[XxlJob] addJob status:{}", status); - // 新增成功302重定向到列表页 - return status == 302; + // 新增成功200重定向到列表页 + return status == 200; } catch (Exception e) { log.error("[XxlJob] addJob异常", e); return false; @@ -112,7 +112,7 @@ public class XxlJobOpenApiUtil { .header("Cookie", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] pauseJob jobId:{}异常", jobId, e); return false; @@ -134,7 +134,7 @@ public class XxlJobOpenApiUtil { .header("Cookie", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] startJob jobId:{}异常", jobId, e); return false; @@ -156,7 +156,7 @@ public class XxlJobOpenApiUtil { .header("Cookie", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] removeJob jobId:{}异常", jobId, e); return false; diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java index a85066dc9..9386caa52 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -43,8 +43,8 @@ public class XxlJobOpenApiUtil { .execute(); int status = response.getStatus(); log.info("[XxlJob] addJob status:{}", status); - // 新增成功302重定向到列表页 - return status == 302; + // 新增成功200重定向到列表页 + return status == 200; } catch (Exception e) { log.error("[XxlJob] addJob异常", e); return false; @@ -114,7 +114,7 @@ public class XxlJobOpenApiUtil { .header("Authorization", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] pauseJob jobId:{}异常", jobId, e); return false; @@ -136,7 +136,7 @@ public class XxlJobOpenApiUtil { .header("Authorization", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] startJob jobId:{}异常", jobId, e); return false; @@ -158,7 +158,7 @@ public class XxlJobOpenApiUtil { .header("Authorization", cookie) .form("id", jobId) .execute(); - return response.getStatus() == 302; + return response.getStatus() == 200; } catch (Exception e) { log.error("[XxlJob] removeJob jobId:{}异常", jobId, e); return false; From fa7db5df0cd42299d1634df461a09fddadf05de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 18:52:30 +0800 Subject: [PATCH 20/32] =?UTF-8?q?jobid=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/util/XxlJobOpenApiUtil.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java index 9386caa52..cc30bc577 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -59,18 +59,20 @@ public class XxlJobOpenApiUtil { * @return jobId,查不到返回null */ public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam) { - // 手动拼接query参数 String query = "jobGroup=&jobDesc="+cn.hutool.core.net.URLEncodeUtil.encode(jobDesc) +"&executorHandler=&executorParam="+cn.hutool.core.net.URLEncodeUtil.encode(executorParam) +"&triggerStatus=-1&start=0&length=10"; String url = adminUrl + "/jobinfo/pageList?" + query; + log.info("[XxlJob] pageList请求url:{}",url); try { - HttpResponse response = HttpRequest.post(url) + // 重点:1. header名称是Cookie;2. 改用get请求 + HttpResponse response = HttpRequest.get(url) .header("Authorization", cookie) .execute(); String jsonStr = response.body(); + log.info("[XxlJob] pageList响应:{}",jsonStr); if (StrUtil.isBlank(jsonStr)) { log.warn("[XxlJob] pageList返回空响应"); return null; @@ -99,6 +101,7 @@ public class XxlJobOpenApiUtil { + /** * 暂停任务 POST /jobinfo/pause * @param jobId xxl任务id From 20d11dc9b2fb086b595b7f1d1c3b14ba26a7db03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 19:00:02 +0800 Subject: [PATCH 21/32] =?UTF-8?q?jobid=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/util/XxlJobOpenApiUtil.java | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java index cc30bc577..7446ad946 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -59,14 +59,29 @@ public class XxlJobOpenApiUtil { * @return jobId,查不到返回null */ public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam) { - String query = "jobGroup=&jobDesc="+cn.hutool.core.net.URLEncodeUtil.encode(jobDesc) - +"&executorHandler=&executorParam="+cn.hutool.core.net.URLEncodeUtil.encode(executorParam) - +"&triggerStatus=-1&start=0&length=10"; + StringBuilder querySb = new StringBuilder(); + // start length必须 + querySb.append("start=0&length=10"); - String url = adminUrl + "/jobinfo/pageList?" + query; + // jobGroup:为空就不拼接这个参数!!不要 jobGroup="" + // 你们业务固定jobGroup=3,直接写死3,不用传空 + querySb.append("&jobGroup=3"); + + // jobDesc + if(StrUtil.isNotBlank(jobDesc)){ + querySb.append("&jobDesc=").append(cn.hutool.core.net.URLEncodeUtil.encode(jobDesc)); + } + // executorParam + if(StrUtil.isNotBlank(executorParam)){ + querySb.append("&executorParam=").append(cn.hutool.core.net.URLEncodeUtil.encode(executorParam)); + } + // executorHandler为空,直接不携带 + // triggerStatus=-1 + querySb.append("&triggerStatus=-1"); + + String url = adminUrl + "/jobinfo/pageList?" + querySb; log.info("[XxlJob] pageList请求url:{}",url); try { - // 重点:1. header名称是Cookie;2. 改用get请求 HttpResponse response = HttpRequest.get(url) .header("Authorization", cookie) .execute(); @@ -102,6 +117,7 @@ public class XxlJobOpenApiUtil { + /** * 暂停任务 POST /jobinfo/pause * @param jobId xxl任务id From 6708353379f02f54a9decbbdbb6fd68937f7c576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 19:08:42 +0800 Subject: [PATCH 22/32] =?UTF-8?q?jobid=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SettlementCustomersApplicationService.java | 4 ++-- .../repository/util/XxlJobOpenApiUtil.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java index 7c0893de5..32bbfa10e 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/settlementCustomers/SettlementCustomersApplicationService.java @@ -389,7 +389,7 @@ public class SettlementCustomersApplicationService { if (!addOk) { throw new RuntimeException("创建夜间定时任务失败"); } - Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId); + Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId,"3"); if (xxlJobId == null) { throw new RuntimeException("定时任务创建成功,但查询jobId失败"); } @@ -427,7 +427,7 @@ public class SettlementCustomersApplicationService { if (!addOk) { throw new RuntimeException("创建夜间定时任务失败"); } - Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId); + Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId,"6"); if (xxlJobId == null) { throw new RuntimeException("定时任务创建成功,但查询jobId失败"); } diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java index 7446ad946..687211894 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/settlementCustomers/repository/util/XxlJobOpenApiUtil.java @@ -58,14 +58,16 @@ public class XxlJobOpenApiUtil { * @param executorParam 任务参数(业务shipperId) * @return jobId,查不到返回null */ - public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam) { + public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam,String jobGroup) { StringBuilder querySb = new StringBuilder(); // start length必须 querySb.append("start=0&length=10"); // jobGroup:为空就不拼接这个参数!!不要 jobGroup="" // 你们业务固定jobGroup=3,直接写死3,不用传空 - querySb.append("&jobGroup=3"); + if(StrUtil.isNotBlank(jobGroup)){ + querySb.append("&jobGroup=").append(jobGroup); + } // jobDesc if(StrUtil.isNotBlank(jobDesc)){ From 25102b520755885b604e087a6edb98a45c35bf2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 19:14:34 +0800 Subject: [PATCH 23/32] =?UTF-8?q?jobid=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContractManageApplicationService.java | 23 +++++++++++-- .../repository/util/XxlJobOpenApiUtil.java | 33 +++++++++++++++---- 2 files changed, 47 insertions(+), 9 deletions(-) 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 cfcd73da3..ddb3e309d 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 @@ -58,6 +58,8 @@ import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.Resource; import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -993,7 +995,9 @@ public class ContractManageApplicationService { public Integer addXxlJob(String shipperId) { XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq(); req.setJobGroup(5); - req.setJobDesc("整租推送计费单据/流水任务,结算对象id:" + shipperId); + //生成唯一业务流水号拼接至JobDesc,保证本次新建任务的JobDesc唯一,据此查询jobId不会命中历史任务 + String xxlJobBizNo = generateXxlJobBizNo(); + req.setJobDesc("整租推送计费单据/流水任务,结算对象id:" + shipperId + ",业务流水号:" + xxlJobBizNo); req.setAuthor("system"); req.setAlarmEmail(""); req.setScheduleType("CRON"); @@ -1015,7 +1019,7 @@ public class ContractManageApplicationService { if (!addOk) { throw new RuntimeException("创建夜间定时任务失败"); } - Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId); + Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId,"5"); if (xxlJobId == null) { throw new RuntimeException("定时任务创建成功,但查询jobId失败"); } @@ -1030,6 +1034,21 @@ public class ContractManageApplicationService { apiUtil.pauseJob(shipperId); } + private static final DateTimeFormatter JOB_BIZ_NO_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmssSSS"); + private static final Random RANDOM = new Random(); + + /** + * 生成xxl-job任务业务流水号:JOB + 当天yyMMddHHmmssSSS + 6位随机数字,保证每次创建的JobDesc唯一 + * 示例:JOB260905102030123123456 + * @return 业务流水号字符串 + */ + private static String generateXxlJobBizNo() { + String dateTimeStr = LocalDateTime.now().format(JOB_BIZ_NO_FORMATTER); + int randomNum = RANDOM.nextInt(1_000_000); + String randomStr = String.format("%06d", randomNum); + return "JOB" + dateTimeStr + randomStr; + } + /** * 修改合同管理 */ diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java index e4a3fba28..1fd942871 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManage/repository/util/XxlJobOpenApiUtil.java @@ -58,19 +58,38 @@ public class XxlJobOpenApiUtil { * @param executorParam 任务参数(业务shipperId) * @return jobId,查不到返回null */ - public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam) { - // 手动拼接query参数 - String query = "jobGroup=&jobDesc="+cn.hutool.core.net.URLEncodeUtil.encode(jobDesc) - +"&executorHandler=&executorParam="+cn.hutool.core.net.URLEncodeUtil.encode(executorParam) - +"&triggerStatus=-1&start=0&length=10"; + public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam,String jobGroup) { + StringBuilder querySb = new StringBuilder(); + // start length必须 + querySb.append("start=0&length=10"); - String url = adminUrl + "/jobinfo/pageList?" + query; + // jobGroup:为空就不拼接这个参数!!不要 jobGroup="" + // 你们业务固定jobGroup=3,直接写死3,不用传空 + if(StrUtil.isNotBlank(jobGroup)){ + querySb.append("&jobGroup=").append(jobGroup); + } + + // jobDesc + if(StrUtil.isNotBlank(jobDesc)){ + querySb.append("&jobDesc=").append(cn.hutool.core.net.URLEncodeUtil.encode(jobDesc)); + } + // executorParam + if(StrUtil.isNotBlank(executorParam)){ + querySb.append("&executorParam=").append(cn.hutool.core.net.URLEncodeUtil.encode(executorParam)); + } + // executorHandler为空,直接不携带 + // triggerStatus=-1 + querySb.append("&triggerStatus=-1"); + + String url = adminUrl + "/jobinfo/pageList?" + querySb; + log.info("[XxlJob] pageList请求url:{}",url); try { - HttpResponse response = HttpRequest.post(url) + HttpResponse response = HttpRequest.get(url) .header("Authorization", cookie) .execute(); String jsonStr = response.body(); + log.info("[XxlJob] pageList响应:{}",jsonStr); if (StrUtil.isBlank(jsonStr)) { log.warn("[XxlJob] pageList返回空响应"); return null; From f6c454765e51c9439d92cee3bd07ec4c99b291f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Sat, 5 Sep 2026 19:21:17 +0800 Subject: [PATCH 24/32] =?UTF-8?q?jobid=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/po/MaterialInventoryPO.java | 16 ++++++++++++++++ .../MaterialInventoryMapper.xml | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryPO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryPO.java index c870cb7dc..0a1007541 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryPO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryPO.java @@ -261,4 +261,20 @@ public class MaterialInventoryPO extends MaterialBasePO { @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date lastBillingTime; + + @ApiModelProperty("每月仓租") + @Excel(name = "每月仓租") + private BigDecimal monthlyWarehouseRent; + + @ApiModelProperty("半月仓租") + @Excel(name = "半月仓租") + private BigDecimal halfMonthWarehouseRent; + + @ApiModelProperty("每月仓租单位") + @Excel(name = "每月仓租单位") + private String monthlyWarehouseRentUnit; + + @ApiModelProperty("半月仓租单位") + @Excel(name = "半月仓租单位") + private String halfMonthWarehouseRentUnit; } \ No newline at end of file diff --git a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml index 99b1f9c96..8004d7413 100644 --- a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml +++ b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml @@ -71,6 +71,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" typeHandler="com.mhd.common.core.handler.ListTypeHandler" /> + + + + @@ -95,6 +99,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.bar_code as inv_bar_code, a.in_order_number,a.lot_number, a.last_billing_time, + b.MONTHLY_WAREHOUSE_RENT_UNIT, + b.HALF_MONTH_WAREHOUSE_RENT_UNIT, + b.HALF_MONTH_WAREHOUSE_RENT, + b.MONTHLY_WAREHOUSE_RENT, CASE WHEN IFNULL(sum(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END as sort_order From 627f63cbd3ab521699d2c2b9d5e438087d045e9c Mon Sep 17 00:00:00 2001 From: rcx <3084692334@qq.com> Date: Mon, 7 Sep 2026 09:20:37 +0800 Subject: [PATCH 25/32] =?UTF-8?q?fix(oms,wms):=20=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E5=8D=95=E5=8F=96=E6=B6=88=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E5=9B=9E=E9=80=80WMS=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E9=87=8D=E5=A4=8D=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=87=B4=E5=8F=96=E6=B6=88=E9=98=BB=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 一、取消下发回退不完整/阻断:原OMS跨库仅软删4张表,收货任务/收货作业单/质检单/电子签名残留;且getWShOrder在重复下发产生多张同号收货单时抛TooManyResultsException,取消下发整体回滚失败。WMS新增/stockInOrderApi/omsCancelInOrder:单事务软删下发链路全部8张表(入库单/明细、收货单/明细、收货任务、收货作业单/明细、质检单),幂等可重试,已开始收货报错拦截;OMS执行单取消下发改调该接口并清理待签名电子签名;预约单取消下发补齐WMS清理 二、下发失败被静默吞掉:omsInOrderAdd/omsInOrderAddDetail原返回void、Feign降级静默,OMS已下发但WMS无数据。改返回AjaxResult、fallback报错,执行单/预约单下发逐一校验返回值,失败回滚下发标记(WMS侧幂等,重下发安全) 三、下发防重原子化:issueOrder下发标记改条件更新(issue_time IS NULL)+影响行数校验,关闭并发/双击重复推送WMS的窗口 --- .../com/mhd/system/api/WmsServiceFeign.java | 16 ++- .../api/factory/RemoteWmsFallbackFactory.java | 15 ++- .../ExecutionStockInOrderDomainService.java | 80 ++++++++++-- .../ReservationStockInOrderDomainService.java | 34 ++++- .../StockInOrderApplicationService.java | 8 ++ .../service/StockInOrderDomainService.java | 123 ++++++++++++++++++ .../stockInOrder/StockInOrderApi.java | 18 ++- 7 files changed, 272 insertions(+), 22 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 22be78474..b25ecbef5 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -92,11 +92,11 @@ public interface WmsServiceFeign { /** - * oms下发单保存 + * oms下发单保存(返回执行结果,失败时OMS据此回滚下发标记,避免"OMS已下发/WMS无数据"的阻断) */ @ApiOperation("oms下发单保存") @PostMapping(value = "/stockInOrderApi/omsInOrderAdd") - public void omsInOrderAdd(@RequestBody StockInOrder stockInOrder); + public AjaxResult omsInOrderAdd(@RequestBody StockInOrder stockInOrder); @ApiOperation("oms取消下发单保存") @PostMapping(value = "/stockOutOrderApi/cancelExecutionOrder") @@ -119,11 +119,19 @@ public interface WmsServiceFeign { public AjaxResult checkOmsAssignInventory(@RequestBody List outMaterialDetails); /** - * oms下发单明细保存 + * oms下发单明细保存(返回执行结果,明细保存含自动审核链路,失败时OMS据此回滚) */ @ApiOperation("oms下发单明细保存") @PostMapping(value = "/stockInOrderApi/omsInOrderAddDetail") - public void omsInOrderAddDetail(@RequestBody List inMaterialDetails); + public AjaxResult omsInOrderAddDetail(@RequestBody List inMaterialDetails); + + /** + * oms取消下发入库执行单:WMS侧一个事务内逻辑删除下发链路产生的全部数据 + * (入库单/明细、收货单/明细、收货任务、收货作业单/明细、质检单),已开始收货则报错拦截 + */ + @ApiOperation("oms取消下发入库单清理") + @PostMapping(value = "/stockInOrderApi/omsCancelInOrder") + public AjaxResult omsCancelInOrder(@RequestBody StockInOrder stockInOrder); @ApiOperation("oms查询物料列表") @GetMapping("/materialBaseInfoApi/queryList") diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWmsFallbackFactory.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWmsFallbackFactory.java index aabf37512..daddb00ab 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWmsFallbackFactory.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWmsFallbackFactory.java @@ -70,7 +70,10 @@ public class RemoteWmsFallbackFactory implements FallbackFactory inMaterialDetails) { + public AjaxResult omsInOrderAddDetail(List inMaterialDetails) { + //返回错误而非静默成功:明细保存(含自动审核)失败必须让OMS感知并回滚下发标记 + return AjaxResult.error("WMS入库单明细保存失败(服务降级):" + cause.getMessage()); + } + + @Override + public AjaxResult omsCancelInOrder(StockInOrder stockInOrder) { + //返回错误而非静默成功,让OMS侧取消下发能感知清理失败并整体回滚(取消下发可重试,WMS清理幂等) + return AjaxResult.error("WMS取消下发清理失败:" + cause.getMessage()); } @Override diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockInOrder/service/ExecutionStockInOrderDomainService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockInOrder/service/ExecutionStockInOrderDomainService.java index 0a18e0d0f..2264a05da 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockInOrder/service/ExecutionStockInOrderDomainService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockInOrder/service/ExecutionStockInOrderDomainService.java @@ -19,6 +19,9 @@ import com.mhd.oms.domain.executionInMaterialDetail.repository.po.ExecutionInMat import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailBaseDO; import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.ExecutionInMaterialDetailDO; import com.mhd.oms.domain.executionInMaterialDetail.repository.todo.InventoryAdjustmentRecordPO; +import com.mhd.oms.domain.electronicSignature.entity.ElectronicSignature; +import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureMaterialDetailService; +import com.mhd.oms.domain.electronicSignature.repository.facade.IElectronicSignatureService; import com.mhd.oms.domain.executionStockInOrder.entity.ExecutionStockInOrder; import com.mhd.oms.domain.executionStockInOrder.repository.facade.IExecutionStockInOrderService; import com.mhd.oms.domain.executionStockInOrder.repository.mapper.ExecutionStockInOrderMapper; @@ -94,6 +97,10 @@ public class ExecutionStockInOrderDomainService { private ReservationStockInOrderMapper stockInOrderMapper; @Autowired private ReserveStockInOrderMapper reserveStockInOrderMapper; + @Autowired + private IElectronicSignatureService electronicSignatureService; + @Autowired + private IElectronicSignatureMaterialDetailService electronicSignatureMaterialDetailService; /** * 分页查询入库单列表 */ @@ -523,25 +530,34 @@ public class ExecutionStockInOrderDomainService { @Transactional(rollbackFor = Exception.class) public Boolean cancelAuditState(ExecutionStockInOrderDO stockInOrderDO) { LoginUser loginUser = SecurityUtils.getLoginUser(); - Integer issueStatus = stockInOrderDO.getIssueStatus(); // 获取用户姓名(优先从UserPo获取,如果为空则使用realname,最后使用username作为兜底) String userRealName = loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null ? loginUser.getUserPo().getUserName() : (loginUser.getRealname() != null ? loginUser.getRealname() : loginUser.getUsername()); - //逻辑删除w入库单信息 + //回退下发在WMS产生的数据:调用WMS清理接口,与下发链路(omsInOrderAdd→omsInOrderAddDetail→自动审核 + //生成收货单/收货任务/收货作业单/质检单/电子签名)对称,WMS侧一个事务内逻辑删除全部数据。 + //此前OMS直接跨库UPDATE仅清理入库单/明细/收货单/收货明细4张表,收货任务、收货作业单、质检单、 + //电子签名记录残留;且按入库单号取收货单号(getWShOrder返回String)在重复下发产生多张同号收货单时 + //抛TooManyResultsException,取消下发整体回滚失败——正是"下发产生2条数据后取消下发阻断"的直接原因。 + //清理失败时抛错整体回滚(OMS保持已下发状态),WMS清理幂等,取消下发可安全重试 List inOrderIds = stockInOrderDO.getInOrderIds(); if (inOrderIds != null && !inOrderIds.isEmpty()) { for (Long inOrderId : inOrderIds) { ExecutionStockInOrder executionStockInOrder = reservationStockInOrderMapper.selectById(inOrderId); - if (executionStockInOrder != null) { - String inOrderNumber = executionStockInOrder.getInOrderNumber(); - reservationStockInOrderMapper.delWOrder(inOrderNumber); - reservationStockInOrderMapper.delWOrderDetail(inOrderNumber); - String wShOrder = reservationStockInOrderMapper.getWShOrder(inOrderNumber); - reservationStockInOrderMapper.delWShOrder(inOrderNumber); - reservationStockInOrderMapper.delWShOrderDetail(wShOrder); + if (executionStockInOrder == null) { + continue; } + String inOrderNumber = executionStockInOrder.getInOrderNumber(); + StockInOrder cancelParam = new StockInOrder(); + cancelParam.setInOrderNumber(inOrderNumber); + AjaxResult cancelResult = wmsServiceFeign.omsCancelInOrder(cancelParam); + if (cancelResult == null || !"200".equals(String.valueOf(cancelResult.get("code")))) { + throw new ServiceException("取消下发失败:入库单[" + inOrderNumber + "]WMS数据清理失败:" + + (cancelResult == null ? "WMS服务不可用或已降级" : cancelResult.get("msg"))); + } + //清理下发自动审核时生成的待签名电子签名记录(已签名记录保留作凭证,不阻断主流程) + cancelPendingSignature(inOrderNumber); } } @@ -556,6 +572,29 @@ public class ExecutionStockInOrderDomainService { .in(ExecutionStockInOrder::getInOrderId, stockInOrderDO.getInOrderIds())); } + /** + * 取消下发时清理下发自动审核生成的待签名电子签名记录(signatureStatus=1)及其明细 + */ + private void cancelPendingSignature(String inOrderNumber) { + try { + List signatures = electronicSignatureService.list( + new LambdaQueryWrapper() + .eq(ElectronicSignature::getOrderNumber, inOrderNumber) + .eq(ElectronicSignature::getOrderType, "IN") + .eq(ElectronicSignature::getSignatureStatus, 1) + .eq(ElectronicSignature::getDelFlag, 1)); + for (ElectronicSignature signature : signatures) { + electronicSignatureMaterialDetailService.deleteBySignatureId(signature.getSignatureId()); + electronicSignatureService.update(new UpdateWrapper().lambda() + .set(ElectronicSignature::getDelFlag, 2) + .eq(ElectronicSignature::getSignatureId, signature.getSignatureId())); + } + } catch (Exception e) { + //WMS数据已清理成功,签名属附属记录,清理失败仅记日志,不回滚取消下发主流程 + log.error("取消下发清理电子签名记录失败,入库单号:{}", inOrderNumber, e); + } + } + /** * @description 审核入库单 * @author ZhouGY @@ -589,6 +628,9 @@ public class ExecutionStockInOrderDomainService { String userRealName = loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null ? loginUser.getUserPo().getUserName() : (loginUser.getRealname() != null ? loginUser.getRealname() : loginUser.getUsername()); + //下发标记改为条件更新(issue_time IS NULL):前置list校验与update之间存在并发窗口, + //双击/并发请求会同时通过校验各自推一遍WMS(WMS侧同号入库单/明细翻倍的根源之一); + //加上条件后,后到的事务影响行数为0,在此拦截,保证同一执行单只会推送WMS一次 boolean update = stockInOrderService.update(null, new UpdateWrapper().lambda() .set(ExecutionStockInOrder::getIssueId, loginUser.getUserid()) .set(ExecutionStockInOrder::getIssueName, userRealName) @@ -597,7 +639,11 @@ public class ExecutionStockInOrderDomainService { .set(ExecutionStockInOrder::getUpdateBy, loginUser.getUserid()) .set(ExecutionStockInOrder::getUpdateByName, userRealName) .set(ExecutionStockInOrder::getUpdateTime, new Date()) - .in(ExecutionStockInOrder::getInOrderId, distinctInOrderIds)); + .in(ExecutionStockInOrder::getInOrderId, distinctInOrderIds) + .isNull(ExecutionStockInOrder::getIssueTime)); + if (!update) { + throw new ServiceException("下发失败:单据已被并发下发,请刷新后查看"); + } //todo下发推送到wms for (Long inOrderId : distinctInOrderIds) { @@ -612,7 +658,13 @@ public class ExecutionStockInOrderDomainService { stockInOrder.setOrganizationId(orgId); stockInOrder.setOrganizationName(orgName); stockInOrder.setTopOrganizationId(topOrgId); - wmsServiceFeign.omsInOrderAdd(stockInOrder); + //WMS保存结果必须校验:此前接口返回void、Feign降级被静默吞掉,OMS标记已下发但WMS无数据/缺明细, + //收货流程无从进行(流程阻断);失败抛错回滚下发标记,WMS侧幂等(主单/明细判重),重下发安全 + AjaxResult addResult = wmsServiceFeign.omsInOrderAdd(stockInOrder); + if (addResult == null || !"200".equals(String.valueOf(addResult.get("code")))) { + throw new ServiceException("下发失败:入库单[" + stockInOrder.getInOrderNumber() + "]推送WMS保存主单失败:" + + (addResult == null ? "WMS服务不可用或已降级" : addResult.get("msg"))); + } String inOrderNumber = stockInOrder.getInOrderNumber(); // 只推有效明细(del_flag=1),软删旧行不推WMS,防止WMS侧计划数量虚高 List materialDetailList = materialDetailService.list(new QueryWrapper().lambda() @@ -633,7 +685,11 @@ public class ExecutionStockInOrderDomainService { } inMaterialDetailList.add(inMaterialDetail); } - wmsServiceFeign.omsInOrderAddDetail(inMaterialDetailList); + AjaxResult detailResult = wmsServiceFeign.omsInOrderAddDetail(inMaterialDetailList); + if (detailResult == null || !"200".equals(String.valueOf(detailResult.get("code")))) { + throw new ServiceException("下发失败:入库单[" + inOrderNumber + "]推送WMS保存明细失败:" + + (detailResult == null ? "WMS服务不可用或已降级" : detailResult.get("msg"))); + } } return update; } diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java index bd8852799..f3c7c3bf3 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java @@ -568,7 +568,13 @@ public class ReservationStockInOrderDomainService { stockInOrder.setOmsStockInOrderId(String.valueOf(byId.getInOrderId())); try { - wmsServiceFeign.omsInOrderAdd(stockInOrder); // 推主单 + //WMS保存结果必须校验:此前接口返回void、Feign降级被静默吞掉,OMS标记已下发但WMS无数据/缺明细, + //收货流程无从进行(流程阻断);失败抛错回滚下发标记,WMS侧幂等(主单/明细判重),重下发安全 + AjaxResult addResult = wmsServiceFeign.omsInOrderAdd(stockInOrder); // 推主单 + if (addResult == null || !"200".equals(String.valueOf(addResult.get("code")))) { + throw new ServiceException("下发到WMS失败:入库单[" + stockInOrder.getInOrderNumber() + "]保存主单失败:" + + (addResult == null ? "WMS服务不可用或已降级" : addResult.get("msg"))); + } String inOrderNumber = stockInOrder.getInOrderNumber(); List materialDetailList = materialDetailService.list( @@ -587,7 +593,11 @@ public class ReservationStockInOrderDomainService { } inMaterialDetailList.add(inMaterialDetail); } - wmsServiceFeign.omsInOrderAddDetail(inMaterialDetailList); // 推明细(会触发WMS自动审核) + AjaxResult detailResult = wmsServiceFeign.omsInOrderAddDetail(inMaterialDetailList); // 推明细(会触发WMS自动审核) + if (detailResult == null || !"200".equals(String.valueOf(detailResult.get("code")))) { + throw new ServiceException("下发到WMS失败:入库单[" + inOrderNumber + "]保存明细失败:" + + (detailResult == null ? "WMS服务不可用或已降级" : detailResult.get("msg"))); + } log.info("下发到WMS成功,单据号:{}", byId.getInOrderNumber()); } catch (Exception e) { log.error("下发到WMS失败,单据号:{}", byId.getInOrderNumber(), e); @@ -741,11 +751,17 @@ public class ReservationStockInOrderDomainService { for (Long inOrderId : inOrderIds) { ReservationStockInOrder byId = stockInOrderService.getById(inOrderId); String inOrderNumber = byId.getInOrderNumber(); + //清理预约单自身下发到WMS的数据(下发时omsInOrderAdd推过主单/明细并自动审核生成收货链路) + cancelWmsInOrder(inOrderNumber); List list = executionStockInOrderService.list(new QueryWrapper().lambda() .eq(ExecutionStockInOrder::getBusinessInOrderNumber, inOrderNumber) .eq(ExecutionStockInOrder::getDelFlag, 1)); for (ExecutionStockInOrder executionStockInOrder : list) { String inOrderNumber1 = executionStockInOrder.getInOrderNumber(); + //已下发的执行单同步清理WMS侧数据(与执行单取消下发同一清理接口,未下发则WMS无数据幂等跳过) + if (executionStockInOrder.getIssueTime() != null) { + cancelWmsInOrder(inOrderNumber1); + } List materialDetails = executionInMaterialDetailService.list(new QueryWrapper().lambda() .eq(ExecutionInMaterialDetail::getInOrderNumber, inOrderNumber1) .eq(ExecutionInMaterialDetail::getDelFlag, 1)); @@ -763,6 +779,20 @@ public class ReservationStockInOrderDomainService { return update; } + /** + * 调用WMS清理接口回退下发产生的数据(入库单/明细、收货单/明细、收货任务、收货作业单/明细、质检单), + * WMS侧已开始收货会返回错误在此抛出,保证不会误删真实收货数据 + */ + private void cancelWmsInOrder(String inOrderNumber) { + StockInOrder cancelParam = new StockInOrder(); + cancelParam.setInOrderNumber(inOrderNumber); + AjaxResult cancelResult = wmsServiceFeign.omsCancelInOrder(cancelParam); + if (cancelResult == null || !"200".equals(String.valueOf(cancelResult.get("code")))) { + throw new ServiceException("取消下发失败:入库单[" + inOrderNumber + "]WMS数据清理失败:" + + (cancelResult == null ? "WMS服务不可用或已降级" : cancelResult.get("msg"))); + } + } + @Transactional(rollbackFor = Exception.class) public Boolean executeAndIssue(ReservationStockInOrderDO stockInOrderDO) { // 防重复执行校验(与 issueOrder 的防重逻辑对齐):issueTime 有值表示已下发/执行过。 diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java index 898f94e6d..03d02de33 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockInOrder/StockInOrderApplicationService.java @@ -947,6 +947,14 @@ public class StockInOrderApplicationService { stockInOrderDomainService.omsOrderAddDetail(inMaterialDetails); } + /** + * OMS取消下发入库执行单:清理WMS侧下发链路产生的全部数据 + * (入库单/明细、收货单/明细、收货任务、收货作业单/明细、质检单),已开始收货则报错拦截 + */ + public void omsCancelInOrder(StockInOrder stockInOrder){ + stockInOrderDomainService.cancelExecutionOrder(stockInOrder); + } + /** * @description 取消入库单 * @author ZhouGY diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/stockInOrder/service/StockInOrderDomainService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/stockInOrder/service/StockInOrderDomainService.java index d18095675..f73870e64 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/stockInOrder/service/StockInOrderDomainService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/stockInOrder/service/StockInOrderDomainService.java @@ -23,6 +23,8 @@ import com.mhd.system.api.domain.ElectronicSignatureSyncDTO; import com.mhd.system.api.domain.PackDetailFeignPO; import com.mhd.system.api.domain.WarehouseFeignPO; import com.mhd.system.api.model.LoginUser; +import com.mhd.wms.domain.deliveTask.entity.DeliveTask; +import com.mhd.wms.domain.deliveTask.repository.facade.IDeliveTaskService; import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail; import com.mhd.wms.domain.inMaterialDetail.repository.facade.IInMaterialDetailService; import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO; @@ -49,6 +51,8 @@ import com.mhd.wms.domain.stockInOrder.repository.facade.IStockInOrderService; import com.mhd.wms.domain.stockInOrder.repository.mapper.StockInOrderMapper; import com.mhd.wms.domain.stockInOrder.repository.po.StockInOrderPO; import com.mhd.wms.domain.stockInOrder.repository.todo.StockInOrderDO; +import com.mhd.wms.domain.stockInTaskOrder.entity.StockInTaskOrder; +import com.mhd.wms.domain.stockInTaskOrder.repository.facade.IStockInTaskOrderService; import com.mhd.wms.domain.stockReceiptOrder.entity.StockReceiptOrder; import com.mhd.wms.domain.stockReceiptOrder.repository.facade.IStockReceiptOrderService; import com.mhd.wms.domain.stockReceiptOrder.repository.po.StockReceiptOrderPO; @@ -59,6 +63,8 @@ import com.mhd.wms.domain.stockShelfOrder.repository.facade.IStockShelfOrderServ import com.mhd.wms.domain.stockShelfOrder.repository.po.StockShelfOrderPO; import com.mhd.wms.domain.stockShelfOrder.repository.todo.StockShelfOrderDO; import com.mhd.wms.domain.stockShelfOrder.service.StockShelfOrderDomainService; +import com.mhd.wms.domain.taskReceiptMaterialDetail.entity.TaskReceiptMaterialDetail; +import com.mhd.wms.domain.taskReceiptMaterialDetail.repository.facade.ITaskReceiptMaterialDetailService; import com.mhd.wms.interfaces.dto.stockInOrder.StockInOrderDTO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -115,6 +121,12 @@ public class StockInOrderDomainService { @Autowired private IStockShelfOrderService stockShelfOrderService; @Autowired + private IDeliveTaskService deliveTaskService; + @Autowired + private IStockInTaskOrderService stockInTaskOrderService; + @Autowired + private ITaskReceiptMaterialDetailService taskReceiptMaterialDetailService; + @Autowired private IdGenerator idGenerator; /** @@ -721,6 +733,117 @@ public class StockInOrderDomainService { autoAuditOmsInOrder(inMaterialDetails.get(0).getInOrderNumber()); } + /** + * OMS取消下发入库执行单:WMS侧补偿清理(与下发链路 omsOrderAdd→omsOrderAddDetail→自动审核→生成收货单/任务 对称) + *

下发链路在WMS落库的表(按清理顺序):

+ *
    + *
  • task_receipt_material_detail 收货作业单明细(按收货作业单号)
  • + *
  • stock_in_task_order 收货作业单(按入库单号)
  • + *
  • delive_task 收货任务(按收货单号 tracking_number)
  • + *
  • quality_inspection 质检单(按入库单号)
  • + *
  • receipt_material_detail 收货单明细(按收货单号)
  • + *
  • stock_receipt_order 收货单(按入库单号)
  • + *
  • in_material_detail 入库单明细(按入库单号)
  • + *
  • stock_in_order 入库单(按入库单号)
  • + *
+ *

历史缺陷:OMS侧只跨库删除4张表,收货任务/收货作业单/质检单残留;且按单号取收货单号 + * 在重复下发产生多张同号收货单时会 TooManyResultsException,取消下发整体失败(流程阻断)。

+ */ + @Transactional(rollbackFor = Exception.class) + public void cancelExecutionOrder(StockInOrder stockInOrder) { + String inOrderNumber = stockInOrder.getInOrderNumber(); + if (StringUtils.isEmpty(inOrderNumber)) { + throw new ServiceException("取消下发失败:入库单号为空"); + } + List stockInOrders = stockInOrderService.list(new LambdaQueryWrapper() + .eq(StockInOrder::getInOrderNumber, inOrderNumber) + .eq(StockInOrder::getDelFlag, 1)); + if (CollectionUtils.isEmpty(stockInOrders)) { + //幂等:WMS无该单数据(从未下发成功或已清理过),直接成功,保证OMS取消下发可重试 + return; + } + //收货进度拦截:已开始收货(3)/上架中(4)/已入库(5)的数据不允许取消,否则会删掉真实收货与库存依据 + for (StockInOrder order : stockInOrders) { + if (order.getStatus() != null && order.getStatus() >= 3) { + throw new ServiceException("入库单[" + inOrderNumber + "]已在WMS开始收货/上架,无法取消下发"); + } + } + //收货单(含历史重复下发产生的多张同号收货单,全部查出统一清理,避免按单号取一条漏删/报错) + List receiptOrders = stockReceiptOrderService.list(new LambdaQueryWrapper() + .eq(StockReceiptOrder::getInOrderNumber, inOrderNumber) + .eq(StockReceiptOrder::getDelFlag, 1)); + List receiptOrderNumbers = receiptOrders.stream() + .map(StockReceiptOrder::getReceiptOrderNumber) + .filter(StringUtils::isNotEmpty) + .distinct() + .collect(Collectors.toList()); + for (StockReceiptOrder receiptOrder : receiptOrders) { + if (receiptOrder.getStatus() != null && receiptOrder.getStatus() > 2) { + throw new ServiceException("入库单[" + inOrderNumber + "]对应收货单已完成收货,无法取消下发"); + } + } + //收货作业单(type=1收货,入库单号关联),先记下任务号用于删作业单明细 + List taskOrders = stockInTaskOrderService.list(new LambdaQueryWrapper() + .eq(StockInTaskOrder::getInOrderNumber, inOrderNumber) + .eq(StockInTaskOrder::getDelFlag, 1)); + List taskNumbers = taskOrders.stream() + .map(StockInTaskOrder::getTaskNumber) + .filter(StringUtils::isNotEmpty) + .distinct() + .collect(Collectors.toList()); + //1.收货作业单明细 + if (!taskNumbers.isEmpty()) { + taskReceiptMaterialDetailService.update(new UpdateWrapper().lambda() + .set(TaskReceiptMaterialDetail::getDelFlag, 2) + .in(TaskReceiptMaterialDetail::getTaskNumber, taskNumbers) + .eq(TaskReceiptMaterialDetail::getDelFlag, 1)); + } + //2.收货作业单 + if (!taskOrders.isEmpty()) { + stockInTaskOrderService.update(new UpdateWrapper().lambda() + .set(StockInTaskOrder::getDelFlag, 2) + .eq(StockInTaskOrder::getInOrderNumber, inOrderNumber) + .eq(StockInTaskOrder::getDelFlag, 1)); + } + //3.收货任务(tracking_number=收货单号;补"RV-"+入库单号兜底历史同号收货单) + if (!receiptOrderNumbers.isEmpty()) { + Set trackingNumbers = new HashSet<>(receiptOrderNumbers); + trackingNumbers.add("RV-" + inOrderNumber); + deliveTaskService.update(new UpdateWrapper().lambda() + .set(DeliveTask::getDelFlag, 2) + .in(DeliveTask::getTrackingNumber, trackingNumbers) + .eq(DeliveTask::getTaskType, 1) + .eq(DeliveTask::getDelFlag, 1)); + } + //4.质检单 + qualityInspectionService.update(new UpdateWrapper().lambda() + .set(com.mhd.wms.domain.qualityInspection.entity.QualityInspection::getDelFlag, 2) + .eq(com.mhd.wms.domain.qualityInspection.entity.QualityInspection::getInOrderNumber, inOrderNumber) + .eq(com.mhd.wms.domain.qualityInspection.entity.QualityInspection::getDelFlag, 1)); + //5.收货单明细 + if (!receiptOrderNumbers.isEmpty()) { + receiptMaterialDetailService.update(new UpdateWrapper().lambda() + .set(ReceiptMaterialDetail::getDelFlag, 2) + .in(ReceiptMaterialDetail::getReceiptOrderNumber, receiptOrderNumbers) + .eq(ReceiptMaterialDetail::getDelFlag, 1)); + } + //6.收货单 + stockReceiptOrderService.update(new UpdateWrapper().lambda() + .set(StockReceiptOrder::getDelFlag, 2) + .eq(StockReceiptOrder::getInOrderNumber, inOrderNumber) + .eq(StockReceiptOrder::getDelFlag, 1)); + //7.入库单明细 + materialDetailService.update(new UpdateWrapper().lambda() + .set(InMaterialDetail::getDelFlag, 2) + .eq(InMaterialDetail::getInOrderNumber, inOrderNumber) + .eq(InMaterialDetail::getDelFlag, 1)); + //8.入库单 + stockInOrderService.update(new UpdateWrapper().lambda() + .set(StockInOrder::getDelFlag, 2) + .eq(StockInOrder::getInOrderNumber, inOrderNumber) + .eq(StockInOrder::getDelFlag, 1)); + } + /** * OMS下发入库单明细保存后自动审核通过(生成收货单并更新审核状态) */ diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/stockInOrder/StockInOrderApi.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/stockInOrder/StockInOrderApi.java index 795e9782e..860c279dd 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/stockInOrder/StockInOrderApi.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/stockInOrder/StockInOrderApi.java @@ -199,8 +199,10 @@ public class StockInOrderApi extends BaseController { */ @ApiOperation("oms下发单保存") @PostMapping(value = "/omsInOrderAdd") - public void omsInOrderAdd(@RequestBody StockInOrder stockInOrder) { + public AjaxResult omsInOrderAdd(@RequestBody StockInOrder stockInOrder) { + //返回执行结果而非void:OMS侧需感知保存失败(此前Feign降级被静默吞掉,OMS显示下发成功但WMS无数据,流程阻断) stockInOrderApplicationService.omsOrderAdd(stockInOrder); + return AjaxResult.success(); } /** @@ -311,8 +313,20 @@ public class StockInOrderApi extends BaseController { */ @ApiOperation("oms下发单明细保存") @PostMapping(value = "/omsInOrderAddDetail") - public void omsInOrderAddDetail(@RequestBody List inMaterialDetails) { + public AjaxResult omsInOrderAddDetail(@RequestBody List inMaterialDetails) { + //返回执行结果而非void:明细保存含自动审核链路,失败必须让OMS感知并回滚下发标记 stockInOrderApplicationService.omsOrderAddDetail(inMaterialDetails); + return AjaxResult.success(); + } + + /** + * oms取消下发入库执行单:清理WMS侧下发生成的入库单及下游收货链路数据(逻辑删除) + */ + @ApiOperation("oms取消下发入库单清理") + @PostMapping(value = "/omsCancelInOrder") + public AjaxResult omsCancelInOrder(@RequestBody StockInOrder stockInOrder) { + stockInOrderApplicationService.omsCancelInOrder(stockInOrder); + return AjaxResult.success(); } @ApiOperation("查询入库信息(通过入库单号)") From a484e81b32b54fe782d5062c63893149de792e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 09:23:22 +0800 Subject: [PATCH 26/32] =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- .../com/mhd/common/core/feign/ThirdPartyServiceFeign.java | 2 +- mhd-modules/mhd-system/src/main/resources/bootstrap.yml | 8 ++++---- .../oms/infrastructure/feign/ThirdPartyServiceFeign.java | 2 +- mhd_wms/src/main/resources/bootstrap.yml | 8 ++++---- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index da05e390a..6889c728b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -19,7 +19,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.31:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index cf92dfb8a..8a7006304 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.32:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..ba9a45148 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 9abf9225f..22be78474 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 750ed853e..beba5b1af 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.33:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.33.0.99:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java index f2e3287de..89a3a6114 100644 --- a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java +++ b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java @@ -26,7 +26,7 @@ import java.io.InputStream; import java.util.List; import java.util.Map; -@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.31:8012",configuration = FeignAutoConfiguration.class) +@FeignClient(value = "mhd-third-party-service",url = "http://10.33.0.129:8012",configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 diff --git a/mhd-modules/mhd-system/src/main/resources/bootstrap.yml b/mhd-modules/mhd-system/src/main/resources/bootstrap.yml index 99aaf5e4c..2bdb0489c 100644 --- a/mhd-modules/mhd-system/src/main/resources/bootstrap.yml +++ b/mhd-modules/mhd-system/src/main/resources/bootstrap.yml @@ -14,16 +14,16 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.33.0.129:6010 +# server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.33.0.129:6010 +# server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 diff --git a/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java b/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java index 8c86ae1ad..376500b1c 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java +++ b/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java @@ -22,7 +22,7 @@ import java.util.Map; /** * 三方服务 Feign */ -@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.102.192.31:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.33.0.129:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index fc7380c20..39eb710cb 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 625b19518333b1a9f26de2bc98bb42add5f15c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 10:21:36 +0800 Subject: [PATCH 27/32] =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- .../com/mhd/common/core/feign/ThirdPartyServiceFeign.java | 2 +- .../oms/infrastructure/feign/ThirdPartyServiceFeign.java | 2 +- mhd_oms/src/main/resources/bootstrap.yml | 8 ++++---- mhd_wms/src/main/resources/bootstrap.yml | 8 ++++---- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 93cb610ff..6889c728b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -19,7 +19,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 4ef3bed80..8a7006304 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..ba9a45148 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 5f0d1245b..b25ecbef5 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 750ed853e..beba5b1af 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.33:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.33.0.99:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java index f2e3287de..89a3a6114 100644 --- a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java +++ b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java @@ -26,7 +26,7 @@ import java.io.InputStream; import java.util.List; import java.util.Map; -@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.31:8012",configuration = FeignAutoConfiguration.class) +@FeignClient(value = "mhd-third-party-service",url = "http://10.33.0.129:8012",configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 diff --git a/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java b/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java index 8c86ae1ad..376500b1c 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java +++ b/mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java @@ -22,7 +22,7 @@ import java.util.Map; /** * 三方服务 Feign */ -@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.102.192.31:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.33.0.129:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 diff --git a/mhd_oms/src/main/resources/bootstrap.yml b/mhd_oms/src/main/resources/bootstrap.yml index ee058f0f6..88471e390 100644 --- a/mhd_oms/src/main/resources/bootstrap.yml +++ b/mhd_oms/src/main/resources/bootstrap.yml @@ -18,15 +18,15 @@ spring: discovery: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.33.0.129:6010 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.33.0.129:6010 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index fc7380c20..39eb710cb 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 -# server-addr: 10.33.0.129:6010 + server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 +# server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 32459fd4430b89b9909e43784cc0bda053ae1f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 7 Sep 2026 11:33:14 +0800 Subject: [PATCH 28/32] =?UTF-8?q?xxl-job=E9=85=8D=E7=BD=AE=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mhd/wms/util/XxlJobConfig.java | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/util/XxlJobConfig.java b/mhd_wms/src/main/java/com/mhd/wms/util/XxlJobConfig.java index e17d38a46..9627d0e7b 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/util/XxlJobConfig.java +++ b/mhd_wms/src/main/java/com/mhd/wms/util/XxlJobConfig.java @@ -9,46 +9,46 @@ import org.springframework.context.annotation.Configuration; /** * XXL-JOB 配置类 */ -//@Configuration +@Configuration public class XxlJobConfig { -// private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); -// -// @Value("${xxl.job.admin.addresses}") -// private String adminAddresses; -// -// @Value("${xxl.job.accessToken}") -// private String accessToken; -// -// @Value("${xxl.job.executor.appname}") -// private String appname; -// -// @Value("${xxl.job.executor.address}") -// private String address; -// -// @Value("${xxl.job.executor.ip}") -// private String ip; -// -// @Value("${xxl.job.executor.port}") -// private int port; -// -// @Value("${xxl.job.executor.logpath}") -// private String logPath; -// -// @Value("${xxl.job.executor.logretentiondays}") -// private int logRetentionDays; -// -// @Bean -// public XxlJobSpringExecutor xxlJobExecutor() { -// logger.info(">>>>>>>>>>> xxl-job config init."); -// XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); -// xxlJobSpringExecutor.setAdminAddresses(adminAddresses); -// xxlJobSpringExecutor.setAppname(appname); -// xxlJobSpringExecutor.setAddress(address); -// xxlJobSpringExecutor.setIp(ip); -// xxlJobSpringExecutor.setPort(port); -// xxlJobSpringExecutor.setAccessToken(accessToken); -// xxlJobSpringExecutor.setLogPath(logPath); -// xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); -// return xxlJobSpringExecutor; -// } + private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); + + @Value("${xxl.job.admin.addresses}") + private String adminAddresses; + + @Value("${xxl.job.accessToken}") + private String accessToken; + + @Value("${xxl.job.executor.appname}") + private String appname; + + @Value("${xxl.job.executor.address}") + private String address; + + @Value("${xxl.job.executor.ip}") + private String ip; + + @Value("${xxl.job.executor.port}") + private int port; + + @Value("${xxl.job.executor.logpath}") + private String logPath; + + @Value("${xxl.job.executor.logretentiondays}") + private int logRetentionDays; + + @Bean + public XxlJobSpringExecutor xxlJobExecutor() { + logger.info(">>>>>>>>>>> xxl-job config init."); + XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); + xxlJobSpringExecutor.setAdminAddresses(adminAddresses); + xxlJobSpringExecutor.setAppname(appname); + xxlJobSpringExecutor.setAddress(address); + xxlJobSpringExecutor.setIp(ip); + xxlJobSpringExecutor.setPort(port); + xxlJobSpringExecutor.setAccessToken(accessToken); + xxlJobSpringExecutor.setLogPath(logPath); + xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); + return xxlJobSpringExecutor; + } } \ No newline at end of file From 34b27eabd2528c70baa5002834a6fd70c250d7e5 Mon Sep 17 00:00:00 2001 From: rcx <3084692334@qq.com> Date: Mon, 7 Sep 2026 14:18:34 +0800 Subject: [PATCH 29/32] =?UTF-8?q?fix(oms):=20=E5=87=BA=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=A1=8C=E7=BA=A7=E5=BF=85=E5=A1=AB=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C+=E9=A1=B5=E7=AD=BE=E8=A7=A3=E6=9E=90=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=AE=8C=E6=95=B4=E5=A0=86=E6=A0=88=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 一、行级必填校验(ReservationStockInOrderImpl) - 入库导入:新增校验空【產品編號】/空【支/件数】的明细行,给出明确提示 - 出库导入:新增校验空【支/件数】的明细行 - 修复原因:明细行件数为空时 new BigDecimal(null) 抛无信息的 NullPointerException,页面只显示 页签[x]:java.lang.NullPointerException 无法定位 二、页签解析失败完整堆栈日志 - 出/入库多页签解析第一阶段捕获异常时,将完整堆栈打入服务端日志(LOGGER.error),便于远程定位页签内具体报错行号 --- .../ReservationStockInOrderImpl.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java index 6a2bc7e5a..837b754b5 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java @@ -336,6 +336,12 @@ public class ReservationStockInOrderImpl extends ServiceImpl Date: Mon, 7 Sep 2026 14:25:29 +0800 Subject: [PATCH 30/32] =?UTF-8?q?=E5=8F=91=20=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index b25ecbef5..ceaf3780b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE,url = "http://10.33.0.109:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java index 89a3a6114..b8db7365f 100644 --- a/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java +++ b/mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java @@ -26,7 +26,7 @@ import java.io.InputStream; import java.util.List; import java.util.Map; -@FeignClient(value = "mhd-third-party-service",url = "http://10.33.0.129:8012",configuration = FeignAutoConfiguration.class) +@FeignClient(value = "mhd-third-party-service",url = "http://10.33.0.129:8012", configuration = FeignAutoConfiguration.class) public interface ThirdPartyServiceFeign { //查询当前组织所有三方接口信息 From 98b5ce81cce700ebb617117e1e00fe1c6f897195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Mon, 7 Sep 2026 14:28:29 +0800 Subject: [PATCH 31/32] =?UTF-8?q?=E5=A7=94=E6=89=98=E6=96=B9=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interfaces/facade/UserShipperAPI.java | 32 ++++++++ .../interfaces/vo/UserShipperExportVO.java | 73 +++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 mhd-user-center/src/main/java/com/mhd/user/interfaces/vo/UserShipperExportVO.java diff --git a/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserShipperAPI.java b/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserShipperAPI.java index 41ae750a4..78b243ee1 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserShipperAPI.java +++ b/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserShipperAPI.java @@ -3,6 +3,7 @@ package com.mhd.user.interfaces.facade; import com.github.pagehelper.PageHelper; import com.mhd.common.core.domain.entity.R; import com.mhd.common.core.utils.bean.BeanUtils; +import com.mhd.common.core.utils.poi.ExcelUtil; import com.mhd.common.log.annotation.Log; import com.mhd.common.log.enums.BusinessType; import com.mhd.common.security.utils.SecurityUtils; @@ -24,6 +25,7 @@ import com.mhd.user.application.service.WechatMiniAppService; import com.mhd.user.interfaces.dto.updateDTO.SettlementInfoUpdateDTO; import com.mhd.user.interfaces.vo.SettlementInfoQueryVo; import com.mhd.user.interfaces.vo.ShipperMasterDataSyncTimeVo; +import com.mhd.user.interfaces.vo.UserShipperExportVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -31,6 +33,9 @@ import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; import java.util.*; @Api(tags = "用户中台管理-托运人管理") @@ -128,6 +133,33 @@ public class UserShipperAPI extends BaseController { return getDataTable(list); } + @Log(title = "托运人管理-导出", description ="导出托运人列表",businessType = BusinessType.EXPORT) + @ApiOperation("导出托运人列表") + @GetMapping(value = "/exportUserShipper", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") + public void exportUserShipper(UserShipperDTO userShipperDTO, HttpServletResponse response) throws IOException { + //转换实体 + UserShipperDO userShipperDO = userShipperAssember.toUserShipperDO(userShipperDTO); + //查询全量(不分页),复用列表查询逻辑(含数据权限过滤) + List list = userShipperApplicationService.userShipperList(userShipperDO); + + List exportList = new ArrayList<>(); + if (list != null) { + for (UserShipperPo po : list) { + UserShipperExportVO vo = new UserShipperExportVO(); + BeanUtils.copyProperties(po, vo); + exportList.add(vo); + } + } + + //设置下载头,防止浏览器乱码 + String fileName = URLEncoder.encode("托运人列表", "UTF-8").replaceAll("\\+", "%20"); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + ExcelUtil util = new ExcelUtil<>(UserShipperExportVO.class); + util.exportExcel(response, exportList, "托运人列表"); + } @ApiOperation("查询托运人列表统计表单") @GetMapping("/userShipperCount") diff --git a/mhd-user-center/src/main/java/com/mhd/user/interfaces/vo/UserShipperExportVO.java b/mhd-user-center/src/main/java/com/mhd/user/interfaces/vo/UserShipperExportVO.java new file mode 100644 index 000000000..dd5f4633a --- /dev/null +++ b/mhd-user-center/src/main/java/com/mhd/user/interfaces/vo/UserShipperExportVO.java @@ -0,0 +1,73 @@ +package com.mhd.user.interfaces.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 托运人(委托方)列表导出对象 + * + * @author gen + */ +@Data +@ApiModel(value = "托运人列表导出对象", description = "托运人列表导出对象") +public class UserShipperExportVO { + + @Excel(name = "登录账号", sort = 1, width = 20) + @ApiModelProperty(value = "登录账号") + private String userAccount; + + @Excel(name = "公司名称", sort = 2, width = 30) + @ApiModelProperty(value = "公司名称") + private String shipperEnterpriseName; + + @Excel(name = "联系人", sort = 3, width = 15) + @ApiModelProperty(value = "联系人") + private String emergencyContactName; + + @Excel(name = "联系电话", sort = 4, width = 18) + @ApiModelProperty(value = "联系电话") + private String emergencyContactPhone; + + @Excel(name = "地址", sort = 5, width = 30) + @ApiModelProperty(value = "企业注册地址") + private String shipperEnterpriseAddress; + + @Excel(name = "详细地址", sort = 6, width = 30) + @ApiModelProperty(value = "详细地址") + private String userAreaAddressShipper; + + @Excel(name = "备注", sort = 7, width = 25) + @ApiModelProperty(value = "备注") + private String remark; + + @Excel(name = "结算币种", sort = 8, width = 12) + @ApiModelProperty(value = "结算币种") + private String settlementCurrency; + + @Excel(name = "信用额度", sort = 9, width = 15) + @ApiModelProperty(value = "信用额度(授权额度)") + private BigDecimal authorizedQuota; + + @Excel(name = "信用占用", sort = 10, width = 15) + @ApiModelProperty(value = "信用占用") + private BigDecimal authorizedUsedAmount; + + @Excel(name = "信用余额", sort = 11, width = 15) + @ApiModelProperty(value = "信用余额") + private BigDecimal creditAmount; + + @Excel(name = "客户协议", sort = 12, width = 12) + @ApiModelProperty(value = "客户协议数量") + private BigDecimal agreementCount; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Excel(name = "最近同步信用时间", sort = 13, width = 22, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "最近同步信用时间") + private Date limitTime; +} From 9e1c5d857009d41cfba1d203db9b93c5868ab778 Mon Sep 17 00:00:00 2001 From: rcx <3084692334@qq.com> Date: Mon, 7 Sep 2026 15:44:44 +0800 Subject: [PATCH 32/32] =?UTF-8?q?fix(oms):=20=E9=A2=84=E7=BA=A6=E5=8D=95?= =?UTF-8?q?=E4=B8=8B=E5=8F=91=E4=B8=8D=E5=86=8D=E6=8E=A8=E9=80=81WMS?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=89=A7=E8=A1=8C=E5=8D=95=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=E5=90=8EWMS=E5=87=BA=E7=8E=B0=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E5=8D=95+=E6=89=A7=E8=A1=8C=E5=8D=95=E4=B8=A4=E5=BC=A0?= =?UTF-8?q?=E5=8D=95=EF=BC=9B=E4=B8=89=E4=B8=AA=E4=B8=8B=E5=8F=91=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E8=A1=A5=E5=85=85=E8=BD=AF=E5=88=A0=E5=8D=95=E6=8B=A6?= =?UTF-8?q?=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExecutionStockInOrderDomainService.java | 8 ++- .../ReservationStockInOrderDomainService.java | 62 +++++-------------- 2 files changed, 24 insertions(+), 46 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockInOrder/service/ExecutionStockInOrderDomainService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockInOrder/service/ExecutionStockInOrderDomainService.java index 2264a05da..20f5c398c 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockInOrder/service/ExecutionStockInOrderDomainService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/executionStockInOrder/service/ExecutionStockInOrderDomainService.java @@ -613,9 +613,15 @@ public class ExecutionStockInOrderDomainService { } // 入参去重:同一请求内重复ID会导致同一执行单被多次推送WMS List distinctInOrderIds = inOrderIds.stream().distinct().collect(Collectors.toList()); + // 只校验有效单据:已删除(软删)执行单混入ID(过期页面提交)时在此拦截, + // 此前list/getById均不过滤del_flag,软删单照样被推到WMS形成"幽灵单" List checkOrders = stockInOrderService.list( new QueryWrapper().lambda() - .in(ExecutionStockInOrder::getInOrderId, distinctInOrderIds)); + .in(ExecutionStockInOrder::getInOrderId, distinctInOrderIds) + .eq(ExecutionStockInOrder::getDelFlag, 1)); + if (checkOrders.size() != distinctInOrderIds.size()) { + throw new ServiceException("下发失败:存在已删除的单据,请刷新后重新选择"); + } for (ExecutionStockInOrder order : checkOrders) { if (order.getIssueTime() != null) { throw new ServiceException("下发失败:单据[" + order.getInOrderNumber() + "]已下发,不可重复下发;如需重新下发请先取消下发"); diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java index e08614aaa..5f30c94c7 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderDomainService.java @@ -525,9 +525,14 @@ public class ReservationStockInOrderDomainService { if (inOrderIds == null || inOrderIds.isEmpty()) { throw new ServiceException("下发失败:未选择单据"); } + // 只校验有效单据:软删单混入ID(过期页面提交)时在此拦截 List checkOrders = stockInOrderService.list( new QueryWrapper().lambda() - .in(ReservationStockInOrder::getInOrderId, inOrderIds)); + .in(ReservationStockInOrder::getInOrderId, inOrderIds) + .eq(ReservationStockInOrder::getDelFlag, 1)); + if (checkOrders.size() != inOrderIds.stream().distinct().count()) { + throw new ServiceException("下发失败:存在已删除的单据,请刷新后重新选择"); + } for (ReservationStockInOrder order : checkOrders) { // 校验1:必须已审核(issueStatus==2 表示审核成功) if (order.getIssueStatus() == null || order.getIssueStatus() != 2) { @@ -560,50 +565,12 @@ public class ReservationStockInOrderDomainService { .set(ReservationStockInOrder::getUpdateTime, new Date()) .in(ReservationStockInOrder::getInOrderId, stockInOrderDO.getInOrderIds())); - //todo下发推送到wms - for (Long inOrderId : inOrderIds) { - ReservationStockInOrder byId = stockInOrderService.getById(inOrderId); - StockInOrder stockInOrder = new StockInOrder(); - BeanUtils.copyProperties(byId, stockInOrder, "inOrderId"); - stockInOrder.setOmsStockInOrderId(String.valueOf(byId.getInOrderId())); + // 业务链路(2026-09与业务确认,生产验证):预约单下发→生成执行单→执行单下发时才推送WMS。 + // 预约单下发此前会先把预约单自身推到WMS(omsInOrderAdd/omsInOrderAddDetail),执行单下发又推一次, + // 导致WMS入库管理出现预约单号(R260907001)+执行单号(RK260907001)两张单、仓库收两道货。 + // 已移除预约单的WMS推送,WMS推送唯一入口收敛到 ExecutionStockInOrderDomainService.issueOrder。 + // 历史已推送的预约单数据由"取消下发"(cancelIssueOrder→omsCancelInOrder,幂等)负责清理。 - try { - //WMS保存结果必须校验:此前接口返回void、Feign降级被静默吞掉,OMS标记已下发但WMS无数据/缺明细, - //收货流程无从进行(流程阻断);失败抛错回滚下发标记,WMS侧幂等(主单/明细判重),重下发安全 - AjaxResult addResult = wmsServiceFeign.omsInOrderAdd(stockInOrder); // 推主单 - if (addResult == null || !"200".equals(String.valueOf(addResult.get("code")))) { - throw new ServiceException("下发到WMS失败:入库单[" + stockInOrder.getInOrderNumber() + "]保存主单失败:" - + (addResult == null ? "WMS服务不可用或已降级" : addResult.get("msg"))); - } - - String inOrderNumber = stockInOrder.getInOrderNumber(); - List materialDetailList = materialDetailService.list( - new QueryWrapper().lambda() - .eq(ReservationInMaterialDetail::getInOrderNumber, inOrderNumber) - .eq(ReservationInMaterialDetail::getDelFlag, 1)); - List inMaterialDetailList = new ArrayList<>(); - for (ReservationInMaterialDetail reservationInMaterialDetail : materialDetailList) { - InMaterialDetail inMaterialDetail = new InMaterialDetail(); - BeanUtils.copyProperties(reservationInMaterialDetail, inMaterialDetail, "materialDetailId"); - inMaterialDetail.setOmsInMaterialDetail(String.valueOf(reservationInMaterialDetail.getMaterialDetailId())); - // 过期日期为空且饮用日期有值时,用饮用日期补齐过期日期(食品业务饮用日期即效期), - // 确保下发WMS后入库/收货/库存链路的过期日期能正常回显 - if (inMaterialDetail.getExpiryDate() == null && inMaterialDetail.getDrinkDate() != null) { - inMaterialDetail.setExpiryDate(inMaterialDetail.getDrinkDate()); - } - inMaterialDetailList.add(inMaterialDetail); - } - AjaxResult detailResult = wmsServiceFeign.omsInOrderAddDetail(inMaterialDetailList); // 推明细(会触发WMS自动审核) - if (detailResult == null || !"200".equals(String.valueOf(detailResult.get("code")))) { - throw new ServiceException("下发到WMS失败:入库单[" + inOrderNumber + "]保存明细失败:" - + (detailResult == null ? "WMS服务不可用或已降级" : detailResult.get("msg"))); - } - log.info("下发到WMS成功,单据号:{}", byId.getInOrderNumber()); - } catch (Exception e) { - log.error("下发到WMS失败,单据号:{}", byId.getInOrderNumber(), e); - throw new ServiceException("下发到WMS失败:" + e.getMessage()); - } - } //todo下发推送到入库业务单 for (Long inOrderId : inOrderIds) { // Long inOrderId = stockInOrderDO.getInOrderId(); @@ -801,9 +768,14 @@ public class ReservationStockInOrderDomainService { if (inOrderIds == null || inOrderIds.isEmpty()) { throw new ServiceException("执行失败:未选择单据"); } + // 只校验有效单据:软删单混入ID(过期页面提交)时在此拦截(与 issueOrder 校验口径一致) List checkOrders = stockInOrderService.list( new QueryWrapper().lambda() - .in(ReservationStockInOrder::getInOrderId, inOrderIds)); + .in(ReservationStockInOrder::getInOrderId, inOrderIds) + .eq(ReservationStockInOrder::getDelFlag, 1)); + if (checkOrders.size() != inOrderIds.stream().distinct().count()) { + throw new ServiceException("执行失败:存在已删除的单据,请刷新后重新选择"); + } for (ReservationStockInOrder order : checkOrders) { if (order.getIssueTime() != null) { throw new ServiceException("执行失败:单据[" + order.getInOrderNumber() + "]已下发,不可重复执行;如需重新下发请先取消下发");