bms改造;

This commit is contained in:
王奎兴
2026-09-04 11:11:39 +08:00
parent 2c60dc8f84
commit 6108606daa
54 changed files with 1052 additions and 81 deletions
+5
View File
@@ -111,6 +111,11 @@
<version>2.24</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.4.0</version>
</dependency>
<!-- JPush推送 -->
<!-- jpush极光推送导入start -->
<!-- <dependency>-->
@@ -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<ContractManage> contractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
.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<ContractManageParameters>()
.eq(ContractManageParameters::getContractManageId, contractManageId),false);
if (contractManageParameters == null) {
continue;
}
String parametersJson = contractManageParameters.getParametersJson();
Map<String, Object> parametersMap = JSON.parseObject(parametersJson, new TypeReference<Map<String, Object>>() {});
//合约价
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调用异常");
}
}
}
@@ -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<String,Object> getSettlementCustomers(String shipperId) {
}
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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());
}
}
}
@@ -27,13 +27,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag" />
<result property="chargeStandard" column="charge_standard" />
<result property="unit" column="unit" />
<result property="monthlyWarehouseRent" column="monthly_warehouse_rent" />
<result property="halfMonthWarehouseRent" column="half_month_warehouse_rent" />
<result property="monthlyWarehouseRentUnit" column="monthly_warehouse_rent_unit" />
<result property="halfMonthWarehouseRentUnit" column="half_month_warehouse_rent_unit" />
</resultMap>
<sql id="selectMaterialClassifyPo">
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
</sql>