bms改造;
This commit is contained in:
@@ -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);
|
||||
}
|
||||
+6
@@ -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;
|
||||
}
|
||||
@@ -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>-->
|
||||
|
||||
+99
@@ -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调用异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-4
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
+16
@@ -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;
|
||||
}
|
||||
+16
@@ -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;
|
||||
}
|
||||
+16
@@ -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;
|
||||
}
|
||||
+16
@@ -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;
|
||||
|
||||
}
|
||||
+16
@@ -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;
|
||||
|
||||
}
|
||||
+16
@@ -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;
|
||||
}
|
||||
+15
@@ -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;
|
||||
}
|
||||
+16
@@ -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;
|
||||
}
|
||||
+21
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+6
-1
@@ -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>
|
||||
|
||||
|
||||
@@ -94,6 +94,12 @@
|
||||
<artifactId>DmJdbcDriver18</artifactId>
|
||||
<version>8.1.1.193</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</dependency>
|
||||
<!--添加druid连接池 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
|
||||
+125
@@ -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<SettlementCustomers>()
|
||||
.eq(SettlementCustomers::getSettlementEntityId, shipperId)
|
||||
.eq(SettlementCustomers::getDelFlag, 1));
|
||||
if (ObjectUtil.isNull(settlementCustomers)) {
|
||||
//未找到结算对象
|
||||
return;
|
||||
}
|
||||
Long settlementCustomersId = settlementCustomers.getSettlementCustomersId();
|
||||
SettlementCustomersParameters settlementCustomersParameters = settlementCustomersParametersMapper.selectOne(new LambdaQueryWrapper<SettlementCustomersParameters>()
|
||||
.eq(SettlementCustomersParameters::getSettlementEntityId, settlementCustomersId));
|
||||
if (ObjectUtil.isNull(settlementCustomersParameters)) {
|
||||
//结算对象未配置参数
|
||||
return;
|
||||
}
|
||||
String content = settlementCustomersParameters.getContent();
|
||||
Map<String, Object> 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<BusinessDocument> list = businessDocumentService.list(new LambdaQueryWrapper<BusinessDocument>()
|
||||
.eq(BusinessDocument::getIsPush, 1)
|
||||
.eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId)
|
||||
.eq(BusinessDocument::getBusinessState, 3)
|
||||
.eq(BusinessDocument::getDelFlag, 1));
|
||||
Map<String, List<BusinessDocument>> groupedMap = list.stream()
|
||||
.collect(Collectors.groupingBy(BusinessDocument::getOriginalBusinessNum));
|
||||
for (Map.Entry<String, List<BusinessDocument>> entry : groupedMap.entrySet()) {
|
||||
List<BusinessDocument> groupList = entry.getValue();
|
||||
String originalBusinessNum = entry.getKey();
|
||||
for (BusinessDocument businessDocument : groupList) {
|
||||
String businessFlow = businessDocument.getBusinessFlow();
|
||||
List<BillingStatement> billingStatements = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
|
||||
.eq(BillingStatement::getBusinessFlow, businessFlow)
|
||||
.eq(BillingStatement::getBillingState, 1)
|
||||
.eq(BillingStatement::getDelFlag, 1));
|
||||
if (billingStatements != null && billingStatements.size() > 0) {
|
||||
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
|
||||
List<String> 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<String, Object> 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 {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -151,7 +151,7 @@ public class SettlementCustomersApplicationService {
|
||||
settlementCustomersDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
Boolean insert = settlementCustomersDomainService.insert(settlementCustomersDO);
|
||||
if (insert) {
|
||||
List<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigDTOList();
|
||||
List<SettlementCustomersNcConfigDTO> 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<SettlementCustomersParametersDTO> settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParametersDTOList();
|
||||
List<SettlementCustomersParametersDTO> 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<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigDTOList();
|
||||
List<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigs();
|
||||
if (CollectionUtil.isNotEmpty(settlementCustomersNcConfigDTOList)) {
|
||||
settlementCustomersNcConfigService.remove(new LambdaQueryWrapper<SettlementCustomersNcConfig>()
|
||||
.eq(SettlementCustomersNcConfig::getSettlementCustomersId, settlementCustomersDO.getSettlementCustomersId()));
|
||||
@@ -274,7 +274,7 @@ public class SettlementCustomersApplicationService {
|
||||
settlementCustomersNcConfigService.save(settlementCustomersNcConfig);
|
||||
}
|
||||
}
|
||||
List<SettlementCustomersParametersDTO> settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParametersDTOList();
|
||||
List<SettlementCustomersParametersDTO> settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParameters();
|
||||
if (CollectionUtil.isNotEmpty(settlementCustomersParametersDTOList)) {
|
||||
settlementCustomersParametersService.remove(new LambdaQueryWrapper<SettlementCustomersParameters>()
|
||||
.eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersDO.getSettlementCustomersId()));
|
||||
|
||||
@@ -222,4 +222,7 @@ public class BillingStatement extends BaseVOEntity{
|
||||
private BigDecimal billingUnitPrice;
|
||||
@ApiModelProperty("nc科目编码")
|
||||
private String ncSubjectCode;
|
||||
|
||||
@ApiModelProperty("仓储单号")
|
||||
private String wmsNumber;
|
||||
}
|
||||
+8
-1
@@ -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<BillingStatement>
|
||||
* 根据账单id,查询流水明细列表
|
||||
*/
|
||||
List<BillingStatementPO> getDetailsByManageId(@Param("billManageId") Long billManageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询税率
|
||||
*/
|
||||
Map<String,Object> getTaxRate(@Param("organizationId") Long organizationId, @Param("subjectCode") String subjectCode, @Param("subjectName") String subjectName);
|
||||
}
|
||||
+2
@@ -236,4 +236,6 @@ public class BillingStatementPO extends BaseVOEntity{
|
||||
private BigDecimal billingUnitPrice;
|
||||
@ApiModelProperty("nc科目编码")
|
||||
private String ncSubjectCode;
|
||||
@ApiModelProperty("仓储单号")
|
||||
private String wmsNumber;
|
||||
}
|
||||
+2
@@ -254,4 +254,6 @@ public class BillingStatementDO extends BaseVOEntity{
|
||||
private BigDecimal billingUnitPrice;
|
||||
@ApiModelProperty("nc科目编码")
|
||||
private String ncSubjectCode;
|
||||
@ApiModelProperty("仓储单号")
|
||||
private String wmsNumber;
|
||||
}
|
||||
+19
-8
@@ -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()); //收款帐户名称
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
+5
@@ -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;
|
||||
}
|
||||
+4
-1
@@ -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;
|
||||
}
|
||||
+21
-2
@@ -121,7 +121,13 @@ public class BusinessDocumentDomainService {
|
||||
public Boolean takeEffectByIds(List<Long> businessDocumentIdLongList) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
LambdaUpdateWrapper<BusinessDocument> 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<BusinessDocument> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
@@ -160,7 +166,20 @@ public class BusinessDocumentDomainService {
|
||||
public Boolean auditByIds(List<Long> businessDocumentIdLongList, BusinessDocumentDTO businessDocumentDTO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
LambdaUpdateWrapper<BusinessDocument> 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<BusinessDocument> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
|
||||
+2
-2
@@ -136,9 +136,9 @@ public class SettlementCustomersDO extends BaseVOEntity{
|
||||
@ApiModelProperty(name = "组织代码")
|
||||
private String orgCode;
|
||||
@ApiModelProperty("结算对象参数")
|
||||
private List<SettlementCustomersParametersDTO> settlementCustomersParametersDTOList;
|
||||
private List<SettlementCustomersParametersDTO> settlementCustomersParameters;
|
||||
|
||||
@ApiModelProperty("结算对象nc配置")
|
||||
private List<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigDTOList;
|
||||
private List<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigs;
|
||||
|
||||
}
|
||||
+2
-1
@@ -264,5 +264,6 @@ public class BillingStatementDTO extends BaseVOEntity{
|
||||
private BigDecimal billingUnitPrice;
|
||||
@ApiModelProperty("nc科目编码")
|
||||
private String ncSubjectCode;
|
||||
|
||||
@ApiModelProperty("仓储单号")
|
||||
private String wmsNumber;
|
||||
}
|
||||
+4
@@ -215,4 +215,8 @@ public class BusinessDocumentDTO extends BaseVOEntity{
|
||||
private String paymentAccountName;
|
||||
|
||||
private Long billManageId;
|
||||
@ApiModelProperty("仓库类型")
|
||||
private String warehouseType;
|
||||
@ApiModelProperty("是否推送")
|
||||
private Integer isPush;
|
||||
}
|
||||
+2
-2
@@ -137,7 +137,7 @@ public class SettlementCustomersDTO extends BaseVOEntity{
|
||||
private String orgCode;
|
||||
|
||||
@ApiModelProperty("结算对象参数")
|
||||
private List<SettlementCustomersParametersDTO> settlementCustomersParametersDTOList;
|
||||
private List<SettlementCustomersParametersDTO> settlementCustomersParameters;
|
||||
@ApiModelProperty("结算对象nc配置")
|
||||
private List<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigDTOList;
|
||||
private List<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigs;
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存业务单据
|
||||
*/
|
||||
|
||||
@@ -271,4 +271,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getTaxRate" resultType="java.util.Map">
|
||||
SELECT
|
||||
RATE as "taxRate"
|
||||
FROM
|
||||
EXPENSE_ACCOUNT
|
||||
WHERE
|
||||
SUBJECT_CODE = #{subjectCode}
|
||||
AND SUBJECT_NAME = #{subjectName}
|
||||
AND DEL_FLAG = 1
|
||||
AND ORGANIZATION_ID = #{organizationId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+16
-1
@@ -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<MaterialInventoryParamDO> 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<MaterialInventoryParamDO> clearoutParamDOs = handoverTaskOrderDomainService.getLastClearoutParamDOs();
|
||||
for (MaterialInventoryParamDO paramDO : clearoutParamDOs) {
|
||||
materialInventoryApplicationService.pushBillingRecordClearout(paramDO.getMaterialInventoryId(), paramDO.getQuantity());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+226
-21
@@ -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<MaterialInventoryPO> 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<String,Object> 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<String, Object> 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<Map<String, Object>> monthFee = materialInventoryDomainService.getMonthFee(inOrderNumber, materialBaseInfoId,lotNumber);
|
||||
//入库业务单未设置每月仓租
|
||||
if (monthFee == null || monthFee.size()==0) return;
|
||||
Map<String, Object> 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<String,Object> 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<String, Object> 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<String,Object> 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<MaterialInventoryPO> 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<String,Object> 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<String, Object> 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<Map<String, Object>> monthFee = materialInventoryDomainService.getMonthFee(inOrderNumber, materialBaseInfoId,lotNumber);
|
||||
//入库业务单未设置每月仓租
|
||||
if (monthFee == null || monthFee.size()==0) continue;
|
||||
Map<String, Object> 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<String,Object> 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<String, Object> 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<String,Object> 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<String, Object> 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<String, Object> contract = materialInventoryDomainService.queryContract(materialInventoryPO.getShipperId());
|
||||
businessDocumentFeign.setOriginalBusinessNum(materialInventoryPO.getInOrderNumber());
|
||||
businessDocumentFeign.setWarehouseType(warehouseType);
|
||||
businessDocumentFeign.setOriginalBusinessNum(materialInventoryPO.getInOrderNumber());
|
||||
Map<String, Object> 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调用异常");
|
||||
|
||||
+18
-7
@@ -351,7 +351,7 @@ public class HandoverTaskOrderDomainService {
|
||||
}
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//修改库存
|
||||
xgkc(handoverTaskOrderIds,loginUser);
|
||||
List<MaterialInventoryParamDO> 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<StockOutOrder>().lambda().set(StockOutOrder::getBillingJson,handoverTaskOrderDO.getBillingJson()).eq(StockOutOrder::getOutOrderNumber,handoverTaskOrder.getOrderNumber()));
|
||||
this.lastClearoutParamDOs = clearoutParamDOs;
|
||||
return handoverTaskOrderService.update(null, new UpdateWrapper<HandoverTaskOrder>().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<Long> handoverTaskOrderIds,LoginUser loginUser) {
|
||||
private List<MaterialInventoryParamDO> lastClearoutParamDOs = new ArrayList<>();
|
||||
|
||||
public List<MaterialInventoryParamDO> getLastClearoutParamDOs() {
|
||||
return lastClearoutParamDOs;
|
||||
}
|
||||
|
||||
public synchronized List<MaterialInventoryParamDO> xgkc(List<Long> handoverTaskOrderIds,LoginUser loginUser) {
|
||||
List<MaterialInventoryParamDO> 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<MaterialInventoryParamDO> doStockOutDeduct(String orderNumber, StockOutOrder stockOutOrder, LoginUser loginUser) {
|
||||
List<MaterialInventoryParamDO> clearoutParamDOs = new ArrayList<>();
|
||||
List<OutMaterialDetail> outMaterialDetailList = outMaterialDetailMapper.selectList(new QueryWrapper<OutMaterialDetail>().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 表配置。
|
||||
// */
|
||||
|
||||
+16
@@ -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;
|
||||
|
||||
}
|
||||
+16
@@ -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;
|
||||
}
|
||||
+16
@@ -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;
|
||||
}
|
||||
+6
@@ -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;
|
||||
|
||||
}
|
||||
+7
-2
@@ -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<MaterialInventory>
|
||||
* type 类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
|
||||
* materialInventoryId 物料库存ID
|
||||
* */
|
||||
public void xgkc(MaterialInventoryParamDO materialInventoryParamDO);
|
||||
public List<MaterialInventoryParamDO> xgkc(MaterialInventoryParamDO materialInventoryParamDO);
|
||||
|
||||
public void kctzjl(MaterialInventoryParamDO materialInventoryParamDO,String adjustAction,LoginUser loginUser);
|
||||
|
||||
@@ -130,5 +131,9 @@ public interface IMaterialInventoryService extends IService<MaterialInventory>
|
||||
|
||||
public Map<String,Object> querySetlleByShipperId(Long ShipperId);
|
||||
|
||||
public Map<String,Object> queryContract(Long shipperId);
|
||||
public Map<String,Object> queryContract(Long contractManageId);
|
||||
|
||||
public Map<String,Object> queryShipperParameters(Long shipperId,String parametersName);
|
||||
|
||||
Map<String, Object> queryMaterialClassify(Long id);
|
||||
}
|
||||
+5
-1
@@ -135,5 +135,9 @@ public interface MaterialInventoryMapper extends BaseMapper<MaterialInventory>
|
||||
|
||||
public Map<String,Object> querySetlleByShipperId(@Param("shipperId") Long shipperId);
|
||||
|
||||
public Map<String,Object> queryContract(@Param("shipperId") Long shipperId);
|
||||
public Map<String,Object> queryContract(@Param("contractManageId") Long contractManageId);
|
||||
|
||||
public Map<String,Object> queryShipperParameters(@Param("shipperId") Long shipperId,@Param("parametersName") String parametersName);
|
||||
|
||||
public Map<String, Object> queryMaterialClassify(@Param("id") Long id);
|
||||
}
|
||||
+34
-5
@@ -544,7 +544,7 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void xgkc(MaterialInventoryParamDO materialInventoryParamDO) {
|
||||
public List<MaterialInventoryParamDO> 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<MaterialInventoryMapper,
|
||||
BigDecimal quantity = materialInventoryParamDO.getQuantity() != null ? materialInventoryParamDO.getQuantity() : BigDecimal.ZERO;
|
||||
String type = materialInventoryParamDO.getType();
|
||||
Long materialInventoryId = materialInventoryParamDO.getMaterialInventoryId();
|
||||
List<MaterialInventoryParamDO> clearoutList = new ArrayList<>();
|
||||
|
||||
//类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
|
||||
switch (type) {
|
||||
@@ -569,7 +570,10 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
break;
|
||||
case "4":
|
||||
// 出库交接
|
||||
ckjj(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||
MaterialInventoryPO po = ckjj(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||
if (po != null) {
|
||||
clearoutList.add(materialInventoryParamDO);
|
||||
}
|
||||
break;
|
||||
case "5":
|
||||
// 移位
|
||||
@@ -586,6 +590,7 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
default:
|
||||
throw new ServiceException("错误的类型");
|
||||
}
|
||||
return clearoutList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1040,7 +1045,7 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
}
|
||||
}
|
||||
private void ckjj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||
private MaterialInventoryPO ckjj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
//库存数量
|
||||
@@ -1087,7 +1092,22 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
|
||||
Long warehouseId = materialInventoryPO.getWarehouseId();
|
||||
boolean needPush = false;
|
||||
if (warehouseId != null && warehouseId == 20) {
|
||||
needPush = true;
|
||||
} else if (warehouseId != null && warehouseId == 19 && newInventoryQuantity.compareTo(BigDecimal.ZERO) == 0) {
|
||||
needPush = true;
|
||||
}
|
||||
if (needPush) {
|
||||
MaterialInventoryPO resultPO = new MaterialInventoryPO();
|
||||
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, resultPO);
|
||||
resultPO.setMaterialInventoryId(materialInventoryId);
|
||||
return resultPO;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private void yw(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
@@ -1253,7 +1273,16 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
return materialInventoryMapper.querySetlleByShipperId(shipperId);
|
||||
}
|
||||
|
||||
public Map<String,Object> queryContract(Long shipperId) {
|
||||
return materialInventoryMapper.queryContract(shipperId);
|
||||
public Map<String,Object> queryContract(Long contractManageId) {
|
||||
return materialInventoryMapper.queryContract(contractManageId);
|
||||
}
|
||||
|
||||
public Map<String,Object> queryShipperParameters(Long shipperId,String parametersName) {
|
||||
return materialInventoryMapper.queryShipperParameters(shipperId,parametersName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryMaterialClassify(Long id) {
|
||||
return materialInventoryMapper.queryMaterialClassify(id);
|
||||
}
|
||||
}
|
||||
+6
@@ -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;
|
||||
}
|
||||
+6
@@ -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;
|
||||
}
|
||||
+9
@@ -271,4 +271,13 @@ public class MaterialInventoryDO extends MaterialBaseDO {
|
||||
|
||||
@ApiModelProperty("库存分配匹配:Batch Ref NO's token 列表(默认不启用,仅显式赋值时参与匹配)")
|
||||
private List<String> 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;
|
||||
}
|
||||
+9
@@ -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;
|
||||
}
|
||||
+10
-2
@@ -138,7 +138,15 @@ public class MaterialInventoryDomainService {
|
||||
return materialInventoryService.querySetlleByShipperId(shipperId);
|
||||
}
|
||||
|
||||
public Map<String,Object> queryContract(Long shipperId) {
|
||||
return materialInventoryService.queryContract(shipperId);
|
||||
public Map<String,Object> queryContract(Long contractManageId) {
|
||||
return materialInventoryService.queryContract(contractManageId);
|
||||
}
|
||||
|
||||
public Map<String,Object> queryShipperParameters(Long shipperId,String parametersName) {
|
||||
return materialInventoryService.queryShipperParameters(shipperId,parametersName);
|
||||
}
|
||||
|
||||
public Map<String,Object> queryMaterialClassify(Long id) {
|
||||
return materialInventoryService.queryMaterialClassify(id);
|
||||
}
|
||||
}
|
||||
+16
@@ -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;
|
||||
}
|
||||
+7
@@ -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;
|
||||
|
||||
}
|
||||
+7
@@ -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;
|
||||
}
|
||||
@@ -69,6 +69,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="chargeStandard" column="charge_standard" />
|
||||
<result property="chargeStandardClass" column="charge_standard_class" />
|
||||
<result property="isNormalMaterial" column="is_normal_material" />
|
||||
<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>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="inOrderNumber" column="in_order_number" />
|
||||
<result property="lotNumber" column="lot_number" />
|
||||
<result property="specificationModel" column="specification_model" />
|
||||
<result property="lastBillingTime" column="last_billing_time" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
@@ -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
|
||||
</sql>
|
||||
|
||||
@@ -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
|
||||
</sql>
|
||||
|
||||
@@ -263,6 +266,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="expiryDateEnd != null and expiryDateEnd != ''">
|
||||
and a.expiry_date <![CDATA[ < ]]> DATEADD(DAY, 1, #{expiryDateEnd})
|
||||
</if>
|
||||
<if test="lastBillingTimeStart != null and lastBillingTimeStart != ''">
|
||||
and a.last_billing_time >= #{lastBillingTimeStart}
|
||||
</if>
|
||||
<if test="lastBillingTimeEnd != null and lastBillingTimeEnd != ''">
|
||||
and a.last_billing_time <![CDATA[ < ]]> DATEADD(DAY, 1, #{lastBillingTimeEnd})
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!-- 与 selectMaterialInventoryPo1 相同条件,表别名为 mi(用于 queryListByWl 最新明细子查询) -->
|
||||
@@ -381,6 +390,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="boxPalletNo != null and boxPalletNo != ''">
|
||||
and mi.BOX_PALLET_NO like concat('%', #{boxPalletNo}, '%')
|
||||
</if>
|
||||
<if test="lastBillingTimeStart != null and lastBillingTimeStart != ''">
|
||||
and mi.last_billing_time >= #{lastBillingTimeStart}
|
||||
</if>
|
||||
<if test="lastBillingTimeEnd != null and lastBillingTimeEnd != ''">
|
||||
and mi.last_billing_time <![CDATA[ < ]]> DATEADD(DAY, 1, #{lastBillingTimeEnd})
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
|
||||
@@ -537,6 +552,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
MAX(a.batch_ref_no) AS batch_ref_no, MAX(a.sheet_ref_no) AS sheet_ref_no, MAX(a.box_pallet_no) AS box_pallet_no,
|
||||
MAX(a.bar_code) AS inv_bar_code,
|
||||
MAX(a.in_order_number) AS in_order_number, MAX(a.lot_number) AS lot_number,
|
||||
MAX(a.last_billing_time) AS last_billing_time,
|
||||
MAX(b.specification_model) AS specification_model,
|
||||
MAX(b.material_code) AS material_code, MAX(b.material_name) AS material_name,
|
||||
CASE WHEN IFNULL(SUM(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END AS sort_order
|
||||
@@ -629,6 +645,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
IFNULL(SUM(a.VOLUME), 0) AS VOLUME,
|
||||
MIN(a.create_time) AS create_time,
|
||||
MAX(a.update_time) AS update_time,
|
||||
MAX(a.last_billing_time) AS last_billing_time,
|
||||
CASE WHEN IFNULL(SUM(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END AS sort_order
|
||||
</sql>
|
||||
|
||||
@@ -728,6 +745,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="lastBillingTime" column="last_billing_time" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 1-按货主 2-按物料 3-按批次 4-按库位 5-按物料/库位 6-按容器 0-全部 -->
|
||||
@@ -1705,7 +1723,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
SELECT *
|
||||
FROM MATERIAL_INVENTORY
|
||||
WHERE EXTRACT(DAY FROM CREATE_TIME) = EXTRACT(DAY FROM SYSDATE - 1) AND INVENTORY_QUANTITY > 0
|
||||
AND DEL_FLAG = 1 AND SHIIPER_ID = #{shipperId}
|
||||
AND DEL_FLAG = 1 AND SHIPPER_ID = #{shipperId}
|
||||
</select>
|
||||
|
||||
|
||||
@@ -1725,21 +1743,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="querySetlleByShipperId" parameterType="java.lang.Long" resultType="java.util.Map">
|
||||
SELECT
|
||||
SETTLEMENT_ENTITY as settlementEntity,
|
||||
SETTLEMENT_ENTITY_ID as settlementEntityId,
|
||||
SETTLEMENT_CUSTOMERS_CODE as settlementCustomersCode,
|
||||
SETTLEMENT_CUSTOMERS_ID as settlementCustomersId
|
||||
FROM NGWL_TEST_OMS.SETTLEMENT_CUSTOMERS where 1=1 and
|
||||
SETTLEMENT_ENTITY_ID = #{settlementEntityId}
|
||||
SETTLEMENT_ENTITY as "settlementEntity",
|
||||
SETTLEMENT_ENTITY_ID as "settlementEntityId",
|
||||
SETTLEMENT_CUSTOMERS_CODE as "settlementCustomersCode",
|
||||
SETTLEMENT_CUSTOMERS_ID as "settlementCustomersId"
|
||||
FROM NGWL_TEST_BMS.SETTLEMENT_CUSTOMERS where 1=1 and
|
||||
SETTLEMENT_ENTITY_ID = #{shipperId} AND DEL_FLAG = 1
|
||||
</select>
|
||||
|
||||
<select id="queryContract" parameterType="java.lang.Long" resultType="java.util.Map">
|
||||
SELECT
|
||||
CONTRACT_MANAGE_ID as contractManageId,
|
||||
ORIGINAL_CONTRACT_NUMBER as originalContractNumber,
|
||||
CONTRACT_NUMBER as contractNumber,
|
||||
CONTRACT_NAME as contractName
|
||||
FROM NGWL_TEST_SYSTEM.CONTRACT_MANAGE where 1=1 and
|
||||
SETTLEMENT_CUSTOMERS_ID = #{shipperId}
|
||||
CONTRACT_MANAGE_ID AS "contractManageId",
|
||||
ORIGINAL_CONTRACT_NUMBER AS "originalContractNumber",
|
||||
CONTRACT_NUMBER AS "contractNumber",
|
||||
CONTRACT_NAME AS "contractName"
|
||||
FROM
|
||||
NGWL_TEST_SYSTEM.CONTRACT_MANAGE sys
|
||||
LEFT JOIN NGWL_TEST_BMS.SETTLEMENT_CUSTOMERS bms ON sys.SETTLEMENT_CUSTOMERS_ID = bms.SETTLEMENT_CUSTOMERS_ID
|
||||
WHERE
|
||||
1 = 1
|
||||
AND CONTRACT_MANAGE_ID = #{contractManageId} AND DEL_FLAG = 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryShipperParameters" resultType="java.util.Map">
|
||||
SELECT
|
||||
PARAMETERS_NAME AS "parametersName",
|
||||
CONTENT AS "content",
|
||||
CONTRACT_NUMBER AS "contractNumber",
|
||||
SETTLEMENT_CUSTOMERS_ID AS "settlementCustomersId",
|
||||
CONTRACT_MANAGE_ID AS "contractManageId"
|
||||
FROM
|
||||
NGWL_TEST_BMS.SETTLEMENT_CUSTOMERS_PARAMETERS
|
||||
WHERE
|
||||
1 = 1
|
||||
AND SETTLEMENT_ENTITY_ID = #{shipperId} and PARAMETERS_NAME = #{parametersName}
|
||||
</select>
|
||||
|
||||
<select id="queryMaterialClassify" resultType="java.util.Map">
|
||||
SELECT
|
||||
MONTHLY_WAREHOUSE_RENT AS "monthlyWarehouseRent",
|
||||
HALF_MONTH_WAREHOUSE_RENT AS "halfMonthWarehouseRent",
|
||||
MONTHLY_WAREHOUSE_RENT_UNIT AS "monthlyWarehouseRentUnit",
|
||||
HALF_MONTH_WAREHOUSE_RENT_UNIT AS "halfMonthWarehouseRentUnit"
|
||||
FROM
|
||||
NGWL_TEST_SYSTEM.MATERIAL_CLASSIFY
|
||||
WHERE
|
||||
1 = 1
|
||||
AND MATERIAL_CLASSIFY_ID = #{id} AND DEL_FLAG = 1
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user