联查合同接口开发;
This commit is contained in:
+197
-1
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -11,6 +12,7 @@ import com.mhd.basic.domain.contractManage.entity.ContractManage;
|
||||
import com.mhd.basic.domain.contractManage.repository.mapper.ContractManageMapper;
|
||||
import com.mhd.basic.domain.contractManage.repository.po.ContractManagePO;
|
||||
import com.mhd.basic.domain.contractManage.repository.todo.ContractManageDO;
|
||||
import com.mhd.basic.domain.contractManage.repository.util.HttpWebServiceUtil;
|
||||
import com.mhd.basic.domain.contractManage.service.ContractManageDomainService;
|
||||
import com.mhd.basic.domain.contractManageDetail.entity.ContractManageDetail;
|
||||
import com.mhd.basic.domain.contractManageDetail.repository.mapper.ContractManageDetailMapper;
|
||||
@@ -1348,12 +1350,14 @@ public class ContractManageApplicationService {
|
||||
|
||||
String warehouseTempLayerType;
|
||||
String serviceItemsName;
|
||||
Boolean isGc = false;
|
||||
if ("冻仓计费配置".equals(parametersName)) {
|
||||
warehouseTempLayerType = "DC";
|
||||
serviceItemsName = "冻仓仓租费用";
|
||||
} else if ("干仓计费配置".equals(parametersName)) {
|
||||
warehouseTempLayerType = "GC";
|
||||
serviceItemsName = "干仓仓租费用";
|
||||
isGc=true;
|
||||
} else {
|
||||
log.warn("未知的结算对象参数类型,parametersName={}", parametersName);
|
||||
continue;
|
||||
@@ -1379,7 +1383,7 @@ public class ContractManageApplicationService {
|
||||
String parametersJson = contractManageParameters.getParametersJson();
|
||||
Map<String, Object> parametersMap = JSON.parseObject(parametersJson, new TypeReference<Map<String, Object>>() {});
|
||||
BigDecimal hyj = (BigDecimal) parametersMap.get("hyj");
|
||||
buildBusinessDocument(hyj, settlementCustomers, contractManage, "0D081", "干仓仓租费用", warehouseTempLayerType, serviceItemsName);
|
||||
buildBusinessDocument(hyj, settlementCustomers, contractManage, "0D01", "租金(固定租)", warehouseTempLayerType, serviceItemsName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1425,4 +1429,196 @@ public class ContractManageApplicationService {
|
||||
log.error("保存业务单据失败: {}", ajaxResult != null ? ajaxResult.get("msg") : "feign调用异常");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static final String WEBSERVICE_URL = "http://10.33.0.116:8080/sys/webservice/ngLegalByFindWebserviceService";
|
||||
|
||||
public List<String> getContractNosByCompanyName(String companyName) {
|
||||
List<String> contractNos = new ArrayList<>();
|
||||
|
||||
try {
|
||||
log.info("=== 开始查询合同编号 ===");
|
||||
log.info("查询公司: {}", companyName);
|
||||
|
||||
// 1. 构建JSON参数 - 使用绝对正确的格式
|
||||
String fdRelativePersonJson = "{\"fdName\":\"" + companyName + "\"}";
|
||||
log.info("JSON参数: {}", fdRelativePersonJson);
|
||||
|
||||
// 2. 构建XML请求 - 使用和Postman完全相同的格式
|
||||
String httpRequest = buildXmlRequest(companyName);
|
||||
log.info("XML请求: {}", httpRequest);
|
||||
log.info("XML请求生成完成,长度: {} 字符", httpRequest.length());
|
||||
|
||||
// 3. 调用WebService
|
||||
log.info("正在调用WebService...");
|
||||
String httpResponse = HttpWebServiceUtil.callWebService(httpRequest, WEBSERVICE_URL);
|
||||
|
||||
// 4. 提取JSON - 使用更可靠的提取方法
|
||||
String jsonData = extractJsonFromResponse(httpResponse);
|
||||
|
||||
log.info("正在解析JSON..."+jsonData);
|
||||
//jsonData内容
|
||||
// {
|
||||
// "returnState": "2",
|
||||
// "data": [
|
||||
// {
|
||||
// "contract_Id": "16f830763e15793f5aafab14b309075c",
|
||||
// "contract_Name": "档案保管服务协议",
|
||||
// "contract_No": "HT20200108130",
|
||||
// "contract_Total": 134323.36,
|
||||
// "contract_Star": "20181101",
|
||||
// "contract_End": "20231101",
|
||||
// "contract_relative": [
|
||||
// {
|
||||
// "relativeName": "珠海通宇物流有限公司"
|
||||
// }
|
||||
// ],
|
||||
// "contract_Operator": "蔡振燕",
|
||||
// "contract_capitalFlows": "支出",
|
||||
// "contract_SigningName": "南光置业有限公司-本部",
|
||||
// "contract_pay": [],
|
||||
// "contract_purchases": []
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
if (jsonData == null || jsonData.trim().isEmpty()) {
|
||||
log.warn("未提取到JSON数据,返回空列表");
|
||||
return contractNos;
|
||||
}
|
||||
|
||||
log.info("提取到JSON数据,长度: {} 字符", jsonData.length());
|
||||
|
||||
// 5. 解析JSON
|
||||
List<String> result = parseContractNosFromJson(jsonData);
|
||||
contractNos.addAll(result);
|
||||
|
||||
log.info("=== 查询完成 ===");
|
||||
log.info("找到 {} 个合同编号", contractNos.size());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("查询合同编号失败", e);
|
||||
throw new RuntimeException("查询合同编号失败: " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
return contractNos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建XML请求 - 硬编码确保和Postman完全一致
|
||||
*/
|
||||
private String buildXmlRequest(String companyName) {
|
||||
// 使用和Postman完全相同的格式
|
||||
String jsonParam = "{\"fdName\":\"" + companyName + "\"}";
|
||||
|
||||
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
|
||||
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" +
|
||||
" xmlns:web=\"http://webservice.legal.ng.kmss.landray.com/\">" +
|
||||
"<soapenv:Body>" +
|
||||
"<web:findNgLegal>" +
|
||||
"<arg0 xmlns=\"\">" +
|
||||
"<fdPageNo>1</fdPageNo>" +
|
||||
"<fdRowSize>10</fdRowSize>" +
|
||||
"<fdRelativePerson><![CDATA[" + jsonParam + "]]></fdRelativePerson>" +
|
||||
"<fdContractNo></fdContractNo>" +
|
||||
"<fdPersonNo>NA0301</fdPersonNo>" +
|
||||
"<fdSponsor></fdSponsor>" +
|
||||
"<docCreateTimeStar></docCreateTimeStar>" +
|
||||
"<docCreateTimeEnd></docCreateTimeEnd>" +
|
||||
"</arg0>" +
|
||||
"</web:findNgLegal>" +
|
||||
"</soapenv:Body>" +
|
||||
"</soapenv:Envelope>";
|
||||
}
|
||||
|
||||
/**
|
||||
* 从SOAP响应中提取JSON
|
||||
*/
|
||||
private String extractJsonFromResponse(String soapResponse) {
|
||||
if (soapResponse == null || soapResponse.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 直接查找JSON部分
|
||||
int jsonStart = soapResponse.indexOf("{\"returnState\":");
|
||||
int jsonEnd = soapResponse.indexOf("}</return>");
|
||||
|
||||
if (jsonStart != -1 && jsonEnd != -1) {
|
||||
// 找到JSON结束位置
|
||||
jsonEnd = jsonEnd + 1; // 包含右大括号
|
||||
|
||||
String json = soapResponse.substring(jsonStart, jsonEnd);
|
||||
log.info("直接提取JSON成功");
|
||||
return json;
|
||||
}
|
||||
|
||||
// 备用方法:查找<return>标签
|
||||
int start = soapResponse.indexOf("<return>");
|
||||
int end = soapResponse.indexOf("</return>");
|
||||
|
||||
if (start != -1 && end != -1) {
|
||||
start += "<return>".length();
|
||||
String json = soapResponse.substring(start, end);
|
||||
|
||||
// 解码XML实体
|
||||
json = json.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
.replace("&", "&")
|
||||
.replace(""", "\"")
|
||||
.replace("'", "'");
|
||||
|
||||
log.info("从<return>标签提取JSON成功");
|
||||
return json.trim();
|
||||
}
|
||||
|
||||
log.warn("无法从响应中提取JSON");
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析JSON获取合同编号
|
||||
*/
|
||||
private List<String> parseContractNosFromJson(String jsonData) {
|
||||
List<String> contractNos = new ArrayList<>();
|
||||
|
||||
try {
|
||||
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(jsonData);
|
||||
|
||||
// 检查返回状态
|
||||
String returnState = jsonObject.getString("returnState");
|
||||
if (!"2".equals(returnState)) {
|
||||
log.warn("返回状态异常: {}", returnState);
|
||||
return contractNos;
|
||||
}
|
||||
|
||||
// 获取data数组
|
||||
JSONArray dataArray = jsonObject.getJSONArray("data");
|
||||
if (dataArray == null || dataArray.isEmpty()) {
|
||||
log.info("查询成功,但未找到合同数据");
|
||||
return contractNos;
|
||||
}
|
||||
|
||||
log.info("找到 {} 个合同", dataArray.size());
|
||||
|
||||
// 遍历提取合同编号
|
||||
for (int i = 0; i < dataArray.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject contract = dataArray.getJSONObject(i);
|
||||
String contractNo = contract.getString("contract_No");
|
||||
String contractName = contract.getString("contract_Name");
|
||||
|
||||
if (contractNo != null && !contractNo.trim().isEmpty()) {
|
||||
contractNos.add(contractNo.trim() + " " + contractName.trim());
|
||||
log.info("合同 {}: {}", i + 1, contractNo);
|
||||
} else {
|
||||
log.warn("第 {} 个合同没有编号", i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("JSON解析失败", e);
|
||||
log.error("原始JSON: {}", jsonData);
|
||||
}
|
||||
|
||||
return contractNos;
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.mhd.basic.domain.contractManage.repository.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class HttpWebServiceUtil {
|
||||
|
||||
/**
|
||||
* 调用HTTP WebService
|
||||
*/
|
||||
public static String callWebService(String requestBody, String endpointUrl) {
|
||||
try {
|
||||
// 创建RestTemplate
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
// 设置请求头
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
// headers.setContentType(MediaType.TEXT_XML);
|
||||
// headers.setAccept(Collections.singletonList(MediaType.TEXT_XML));
|
||||
headers.setContentType(MediaType.parseMediaType("text/xml; charset=UTF-8")); // 核心修复
|
||||
headers.setAccept(Collections.singletonList(MediaType.ALL));
|
||||
headers.set("SOAPAction", "");
|
||||
headers.set("User-Agent", "PostmanRuntime/7.26.10");
|
||||
headers.set("Cache-Control", "no-cache");
|
||||
headers.set("Accept-Encoding", "gzip, deflate");
|
||||
headers.set("Connection", "keep-alive");
|
||||
|
||||
// 创建请求实体
|
||||
HttpEntity<String> entity = new HttpEntity<>(requestBody, headers);
|
||||
|
||||
log.info("发送请求到: {}", endpointUrl);
|
||||
|
||||
// 发送请求
|
||||
ResponseEntity<byte[]> response = restTemplate.exchange(
|
||||
endpointUrl,
|
||||
HttpMethod.POST,
|
||||
entity,
|
||||
byte[].class
|
||||
);
|
||||
|
||||
log.info("响应状态: {}", response.getStatusCode());
|
||||
|
||||
// 处理响应
|
||||
byte[] rawResponse = response.getBody();
|
||||
if (rawResponse == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 检查是否gzip压缩
|
||||
String contentEncoding = response.getHeaders().getFirst("Content-Encoding");
|
||||
String responseBody;
|
||||
|
||||
if ("gzip".equalsIgnoreCase(contentEncoding)) {
|
||||
responseBody = decompressGzip(rawResponse);
|
||||
log.info("已解压gzip响应,长度: {} 字符", responseBody.length());
|
||||
} else {
|
||||
responseBody = new String(rawResponse, StandardCharsets.UTF_8);
|
||||
log.info("响应长度: {} 字符", responseBody.length());
|
||||
}
|
||||
|
||||
return responseBody;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("WebService调用失败", e);
|
||||
throw new RuntimeException("WebService调用失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压缩GZIP内容
|
||||
*/
|
||||
private static String decompressGzip(byte[] compressedData) throws IOException {
|
||||
try (GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(compressedData));
|
||||
InputStreamReader reader = new InputStreamReader(gis, StandardCharsets.UTF_8)) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
char[] buffer = new char[1024];
|
||||
int len;
|
||||
while ((len = reader.read(buffer)) != -1) {
|
||||
sb.append(buffer, 0, len);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -8,6 +8,7 @@ import com.mhd.basic.interfaces.assember.contractManage.ContractManageAssembler;
|
||||
import com.mhd.basic.interfaces.dto.contractManage.ContractManageExportVO;
|
||||
import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceDTO;
|
||||
import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceReturn;
|
||||
import com.mhd.common.core.utils.sms.Result;
|
||||
import com.mhd.system.api.domain.ContractManageFeignDTO;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
@@ -272,4 +273,17 @@ public class ContractManageApi extends BaseController{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据公司名称获取合同编号列表
|
||||
* @param companyName 公司名称
|
||||
* @return 合同编号列表
|
||||
*/
|
||||
@GetMapping("/contractNos")
|
||||
public AjaxResult getContractNosByCompanyName(@RequestParam String companyName) {
|
||||
contractManageApplicationService.getContractNosByCompanyName(companyName);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
+361
-9
@@ -663,7 +663,8 @@ public class BillingStatementApplicationService {
|
||||
}
|
||||
Long settlementCustomersId = settlementCustomers.getSettlementCustomersId();
|
||||
SettlementCustomersParameters settlementCustomersParameters = settlementCustomersParametersMapper.selectOne(new LambdaQueryWrapper<SettlementCustomersParameters>()
|
||||
.eq(SettlementCustomersParameters::getSettlementEntityId, settlementCustomersId));
|
||||
.eq(SettlementCustomersParameters::getSettlementEntityId, settlementCustomersId)
|
||||
.eq(SettlementCustomersParameters::getParametersName, "干仓计费配置"));
|
||||
if (ObjectUtil.isNull(settlementCustomersParameters)) {
|
||||
//结算对象未配置参数
|
||||
return;
|
||||
@@ -683,16 +684,42 @@ public class BillingStatementApplicationService {
|
||||
}
|
||||
|
||||
if (!isMerge) {
|
||||
//按入仓单和收费事项分开计费
|
||||
if ("warehouse_receipt".equals(zfycl) && "fee_item".equals(fjfykpcl)) {
|
||||
calcReceiptAndItemSeparately(settlementCustomersId);
|
||||
}
|
||||
//按合同和收费事项分开计费
|
||||
else if ("project_monthly".equals(zfycl) && "fee_item".equals(fjfykpcl)) {
|
||||
calcContractAndItemSeparately(settlementCustomersId);
|
||||
}
|
||||
} else {
|
||||
//按入仓单和收费事项合并计费
|
||||
if ("warehouse_receipt".equals(zfycl) && "fee_item".equals(fjfykpcl)) {
|
||||
mergeCalcByReceiptAndItem(settlementCustomersId);
|
||||
}
|
||||
//按合同和收费事项合并计费
|
||||
else if ("project_monthly".equals(zfycl) && "fee_item".equals(fjfykpcl)) {
|
||||
mergeCalcByContractAndItem(settlementCustomersId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 按入仓单和收费事项分开计费
|
||||
* */
|
||||
public void calcReceiptAndItemSeparately(Long settlementCustomersId) {
|
||||
List<BusinessDocument> list = businessDocumentService.list(new LambdaQueryWrapper<BusinessDocument>()
|
||||
.eq(BusinessDocument::getIsPush, 1)
|
||||
.eq(BusinessDocument::getBelongModuleCode, "干仓")
|
||||
.eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId)
|
||||
.eq(BusinessDocument::getBusinessState, 3)
|
||||
.eq(BusinessDocument::getDelFlag, 1));
|
||||
Map<String, List<BusinessDocument>> groupedMap = list.stream()
|
||||
.collect(Collectors.groupingBy(BusinessDocument::getOriginalBusinessNum));
|
||||
.collect(Collectors.groupingBy(BusinessDocument::getFirstSubjectCode));
|
||||
for (Map.Entry<String, List<BusinessDocument>> entry : groupedMap.entrySet()) {
|
||||
List<BusinessDocument> groupList = entry.getValue();
|
||||
String originalBusinessNum = entry.getKey();
|
||||
String firstSubject = entry.getKey();
|
||||
if ("0D01".equals(firstSubject)) {
|
||||
//主费用
|
||||
for (BusinessDocument businessDocument : groupList) {
|
||||
String businessFlow = businessDocument.getBusinessFlow();
|
||||
List<BillingStatement> billingStatements = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
|
||||
@@ -704,21 +731,19 @@ public class BillingStatementApplicationService {
|
||||
List<String> billingStatementIdList = new ArrayList<>();
|
||||
BigDecimal allAmount = BigDecimal.ZERO;
|
||||
BigDecimal allFreeFee = BigDecimal.ZERO;
|
||||
String settlementCurrency = "MOP";
|
||||
String settlementCurrency = "CNY";
|
||||
for (BillingStatement billingStatement : billingStatements) {
|
||||
settlementCurrency = billingStatement.getSettlementCurrency();
|
||||
String firstSubjectCode = billingStatement.getFirstSubjectCode();
|
||||
String firstSubjectName = billingStatement.getFirstSubjectName();
|
||||
Long organizationId = billingStatement.getOrganizationId();
|
||||
Map<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();
|
||||
@@ -747,13 +772,340 @@ public class BillingStatementApplicationService {
|
||||
billingStatementDTO1.setTaxFreeFee(allFreeFee);
|
||||
billingStatementDTO1.setSettlementCurrency(settlementCurrency);
|
||||
billingStatementDTO1.setBillingStatementList(billingStatementADDVOS);
|
||||
//生成账单
|
||||
generateBills(billingStatementDTO1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//附加费用
|
||||
List<String> businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList());
|
||||
List<BillingStatement> billingStatementList = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
|
||||
.in(BillingStatement::getBusinessFlow, businessFlowList)
|
||||
.eq(BillingStatement::getBillingState, 1)
|
||||
.eq(BillingStatement::getDelFlag, 1));
|
||||
if (billingStatementList != null && billingStatementList.size() > 0) {
|
||||
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
|
||||
List<String> billingStatementIdList = new ArrayList<>();
|
||||
BigDecimal allAmount = BigDecimal.ZERO;
|
||||
BigDecimal allFreeFee = BigDecimal.ZERO;
|
||||
String settlementCurrency = "CNY";
|
||||
for (BillingStatement billingStatement : billingStatementList) {
|
||||
settlementCurrency = billingStatement.getSettlementCurrency();
|
||||
String firstSubjectCode = billingStatement.getFirstSubjectCode();
|
||||
String firstSubjectName = billingStatement.getFirstSubjectName();
|
||||
Long organizationId = billingStatement.getOrganizationId();
|
||||
Map<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 {
|
||||
}
|
||||
|
||||
/*
|
||||
* 按入仓单和收费事项合并计费
|
||||
* */
|
||||
public void mergeCalcByReceiptAndItem(Long settlementCustomersId) {
|
||||
List<BusinessDocument> list = businessDocumentService.list(new LambdaQueryWrapper<BusinessDocument>()
|
||||
.eq(BusinessDocument::getBelongModuleCode, "干仓")
|
||||
.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();
|
||||
List<String> businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList());
|
||||
List<BillingStatement> billingStatementList = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
|
||||
.in(BillingStatement::getBusinessFlow, businessFlowList)
|
||||
.eq(BillingStatement::getBillingState, 1)
|
||||
.eq(BillingStatement::getDelFlag, 1));
|
||||
if (billingStatementList != null && billingStatementList.size() > 0) {
|
||||
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
|
||||
List<String> billingStatementIdList = new ArrayList<>();
|
||||
BigDecimal allAmount = BigDecimal.ZERO;
|
||||
BigDecimal allFreeFee = BigDecimal.ZERO;
|
||||
String settlementCurrency = "CNY";
|
||||
for (BillingStatement billingStatement : billingStatementList) {
|
||||
settlementCurrency = billingStatement.getSettlementCurrency();
|
||||
String firstSubjectCode = billingStatement.getFirstSubjectCode();
|
||||
String firstSubjectName = billingStatement.getFirstSubjectName();
|
||||
Long organizationId = billingStatement.getOrganizationId();
|
||||
Map<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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 按合同和收费事项分开计费
|
||||
* */
|
||||
public void calcContractAndItemSeparately(Long settlementCustomersId) {
|
||||
List<BusinessDocument> list = businessDocumentService.list(new LambdaQueryWrapper<BusinessDocument>()
|
||||
.eq(BusinessDocument::getBelongModuleCode, "干仓")
|
||||
.eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId)
|
||||
.eq(BusinessDocument::getBusinessState, 3)
|
||||
.eq(BusinessDocument::getDelFlag, 1));
|
||||
Map<String, List<BusinessDocument>> groupedMap = list.stream()
|
||||
.collect(Collectors.groupingBy(BusinessDocument::getFirstSubjectCode));
|
||||
for (Map.Entry<String, List<BusinessDocument>> entry : groupedMap.entrySet()) {
|
||||
List<BusinessDocument> groupList = entry.getValue();
|
||||
String firstSubject = entry.getKey();
|
||||
if ("0D01".equals(firstSubject)) {
|
||||
//主费用
|
||||
List<String> businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList());
|
||||
List<BillingStatement> billingStatementList = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
|
||||
.in(BillingStatement::getBusinessFlow, businessFlowList)
|
||||
.eq(BillingStatement::getBillingState, 1)
|
||||
.eq(BillingStatement::getDelFlag, 1));
|
||||
if (billingStatementList != null && billingStatementList.size() > 0) {
|
||||
Map<Long, List<BillingStatement>> contractManageIdMap = billingStatementList.stream()
|
||||
.collect(Collectors.groupingBy(BillingStatement::getContractManageId));
|
||||
for (Map.Entry<Long, List<BillingStatement>> contractManageIdEntry : contractManageIdMap.entrySet()) {
|
||||
Long contractManageId = contractManageIdEntry.getKey();
|
||||
List<BillingStatement> billingContractStatementList = contractManageIdEntry.getValue();
|
||||
|
||||
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
|
||||
BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO();
|
||||
List<String> billingStatementIdList = new ArrayList<>();
|
||||
BigDecimal allAmount = BigDecimal.ZERO;
|
||||
BigDecimal allFreeFee = BigDecimal.ZERO;
|
||||
String settlementCurrency = "CNY";
|
||||
for (BillingStatement billingStatement : billingContractStatementList) {
|
||||
settlementCurrency = billingStatement.getSettlementCurrency();
|
||||
String firstSubjectCode = billingStatement.getFirstSubjectCode();
|
||||
String firstSubjectName = billingStatement.getFirstSubjectName();
|
||||
Long organizationId = billingStatement.getOrganizationId();
|
||||
Map<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);
|
||||
billingStatementDTO1.setBillingStatementIds(ids);
|
||||
billingStatementDTO1.setBelongModuleCode("wms");
|
||||
billingStatementDTO1.setTaxAmount(allAmount);
|
||||
billingStatementDTO1.setBillingAmount(allAmount);
|
||||
billingStatementDTO1.setTaxFreeFee(allFreeFee);
|
||||
billingStatementDTO1.setSettlementCurrency(settlementCurrency);
|
||||
billingStatementDTO1.setBillingStatementList(billingStatementADDVOS);
|
||||
generateBills(billingStatementDTO1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//附加费用
|
||||
List<String> businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList());
|
||||
List<BillingStatement> billingStatementList = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
|
||||
.in(BillingStatement::getBusinessFlow, businessFlowList)
|
||||
.eq(BillingStatement::getBillingState, 1)
|
||||
.eq(BillingStatement::getDelFlag, 1));
|
||||
if (billingStatementList != null && billingStatementList.size() > 0) {
|
||||
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
|
||||
List<String> billingStatementIdList = new ArrayList<>();
|
||||
BigDecimal allAmount = BigDecimal.ZERO;
|
||||
BigDecimal allFreeFee = BigDecimal.ZERO;
|
||||
String settlementCurrency = "CNY";
|
||||
for (BillingStatement billingStatement : billingStatementList) {
|
||||
settlementCurrency = billingStatement.getSettlementCurrency();
|
||||
String firstSubjectCode = billingStatement.getFirstSubjectCode();
|
||||
String firstSubjectName = billingStatement.getFirstSubjectName();
|
||||
Long organizationId = billingStatement.getOrganizationId();
|
||||
Map<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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 按合同和收费事项合并计费
|
||||
* */
|
||||
public void mergeCalcByContractAndItem(Long settlementCustomersId) {
|
||||
List<BusinessDocument> list = businessDocumentService.list(new LambdaQueryWrapper<BusinessDocument>()
|
||||
.eq(BusinessDocument::getBelongModuleCode, "干仓")
|
||||
.eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId)
|
||||
.eq(BusinessDocument::getBusinessState, 3)
|
||||
.eq(BusinessDocument::getDelFlag, 1));
|
||||
Map<Long, List<BusinessDocument>> groupedMap = list.stream()
|
||||
.collect(Collectors.groupingBy(BusinessDocument::getContractManageId));
|
||||
for (Map.Entry<Long, List<BusinessDocument>> entry : groupedMap.entrySet()) {
|
||||
List<BusinessDocument> groupList = entry.getValue();
|
||||
Long contractManageId = entry.getKey();
|
||||
List<String> businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList());
|
||||
List<BillingStatement> billingStatementList = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
|
||||
.in(BillingStatement::getBusinessFlow, businessFlowList)
|
||||
.eq(BillingStatement::getBillingState, 1)
|
||||
.eq(BillingStatement::getDelFlag, 1));
|
||||
if (billingStatementList != null && billingStatementList.size() > 0) {
|
||||
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
|
||||
List<String> billingStatementIdList = new ArrayList<>();
|
||||
BigDecimal allAmount = BigDecimal.ZERO;
|
||||
BigDecimal allFreeFee = BigDecimal.ZERO;
|
||||
String settlementCurrency = "CNY";
|
||||
for (BillingStatement billingStatement : billingStatementList) {
|
||||
settlementCurrency = billingStatement.getSettlementCurrency();
|
||||
String firstSubjectCode = billingStatement.getFirstSubjectCode();
|
||||
String firstSubjectName = billingStatement.getFirstSubjectName();
|
||||
Long organizationId = billingStatement.getOrganizationId();
|
||||
Map<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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
-12
@@ -945,9 +945,9 @@ public class MaterialInventoryApplicationService {
|
||||
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
|
||||
//火险保费
|
||||
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓");
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"干仓");
|
||||
buildBusinessDocument(manpowerFee, materialInventoryPO,"0D082","夫力费",contractManageId,"干仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"干仓");
|
||||
|
||||
} else {
|
||||
//期间付费 不需要夫力费
|
||||
@@ -959,8 +959,8 @@ public class MaterialInventoryApplicationService {
|
||||
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
|
||||
//火险保费
|
||||
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"冻仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"冻仓");
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"冻仓");
|
||||
}
|
||||
} else if (warehouseId==20) {//冻仓计费
|
||||
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置");
|
||||
@@ -1001,11 +1001,11 @@ public class MaterialInventoryApplicationService {
|
||||
if (daysDiff < 15) {
|
||||
// 不足半月: 收半月仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(halfMonthWhFee).multiply(weightLimit);
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓");
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓");
|
||||
} else {
|
||||
// 大于等于半月: 收整月仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee).multiply(weightLimit);
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓");
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓");
|
||||
}
|
||||
//更新最后计费时间
|
||||
Long id = materialInventoryPO.getMaterialInventoryId();
|
||||
@@ -1068,9 +1068,9 @@ public class MaterialInventoryApplicationService {
|
||||
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
|
||||
//火险保费
|
||||
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓");
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"干仓");
|
||||
buildBusinessDocument(manpowerFee, materialInventoryPO,"0D082","夫力费",contractManageId,"干仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"干仓");
|
||||
|
||||
} else {
|
||||
//期间付费 不需要夫力费
|
||||
@@ -1082,8 +1082,8 @@ public class MaterialInventoryApplicationService {
|
||||
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
|
||||
//火险保费
|
||||
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓");
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"干仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"干仓");
|
||||
}
|
||||
} else if (warehouseId==20) {//冻仓计费
|
||||
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置");
|
||||
@@ -1124,11 +1124,11 @@ public class MaterialInventoryApplicationService {
|
||||
if (daysDiff < 15) {
|
||||
// 不足半月: 收半月仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(halfMonthWhFee).multiply(weightLimit);
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓");
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓");
|
||||
} else {
|
||||
// 大于等于半月: 收整月仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee).multiply(weightLimit);
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓");
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓");
|
||||
}
|
||||
//更新最后计费时间
|
||||
Long materialInventoryId = materialInventoryPO.getMaterialInventoryId();
|
||||
|
||||
Reference in New Issue
Block a user