Merge branch 'master' of http://git.xdadan.loc/tanex/emis-service
This commit is contained in:
commit
6a7b78424f
@ -120,6 +120,7 @@ public class EmisSettleInvoiceChRecordController extends BaseController
|
||||
vo.setInvoiceCompany(InvoiceExportHelper.mapInvoiceCompany(record.getSalerCompanyName()));
|
||||
// 备注
|
||||
vo.setRemark(InvoiceExportHelper.processRemark(record));
|
||||
vo.setCustomRemark(InvoiceExportHelper.processCustomRemark(record));
|
||||
// 付款日期
|
||||
vo.setPayDate(InvoiceExportHelper.processPayDate(record.getExportPayDays()));
|
||||
// 业务员
|
||||
|
||||
@ -25,6 +25,8 @@ public class EmisSettleInvoiceChRecordExportVO {
|
||||
private String invoiceCompany;
|
||||
// 备注
|
||||
private String remark;
|
||||
// 定制备注
|
||||
private String customRemark;
|
||||
// 付款日期
|
||||
private String payDate;
|
||||
// 业务员
|
||||
|
||||
@ -33,6 +33,7 @@ package com.xdadan.erp.emis.service;
|
||||
import com.xdadan.erp.system.service.ISysConfigService;
|
||||
import com.xdadan.erp.system.service.ISysNoticeService;
|
||||
import com.xdadan.erp.system.service.ISysUserService;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -46,6 +47,9 @@ package com.xdadan.erp.emis.service;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -4050,6 +4054,40 @@ public class EmisBaseService {
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查月结客户首次签约日期,首次签约之前开的不允许修改
|
||||
*
|
||||
* @param emisWaybillOld
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
protected void checkFirstSigningDay(EmisWaybill emisWaybillOld) throws EmisBizError {
|
||||
if (emisWaybillOld == null || emisWaybillOld.getOrderDate() == null || StringUtil.isBlank(emisWaybillOld.getCustNo())) {
|
||||
return;
|
||||
}
|
||||
|
||||
EmisCustomerUser emisCustomerUser = emisCustomerUserMapper
|
||||
.selectMonthCustomerByMonthlyPayCode(emisWaybillOld.getCustNo());
|
||||
if (emisCustomerUser == null || StringUtil.isBlank(emisCustomerUser.getFirstSigningDay())) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
LocalDate firstSigningDate = LocalDate.parse(emisCustomerUser.getFirstSigningDay());
|
||||
LocalDate orderDate = emisWaybillOld.getOrderDate().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
|
||||
if (orderDate.isBefore(firstSigningDate)) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR,
|
||||
String.format("运单日期(%s)不能早于客户首次签约日期(%s)",
|
||||
orderDate, firstSigningDate));
|
||||
}
|
||||
} catch (DateTimeParseException e) {
|
||||
log.error("客户首次签约日期格式错误: {}", emisCustomerUser.getFirstSigningDay(), e);
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "客户首次签约日期格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws ParseException {
|
||||
// Date startDate = new Date("202");
|
||||
Date startDate= new SimpleDateFormat("yyyy-MM-dd").parse("2025-05-11");
|
||||
|
||||
@ -19,7 +19,7 @@ public class InvoiceExportHelper {
|
||||
"(?i)[,,\u3001.。;\\s]*(co\\.?|ltd\\.?|co|ltd)[,,\u3001.。;\\s]*(co\\.?|ltd\\.?|co|ltd)?[,,\u3001.。;\\s]*$",
|
||||
"").trim();
|
||||
// 去除有限公司和有限责任公司
|
||||
result = result.replaceAll("(有限公司|有限责任公司)$", "").trim();
|
||||
result = result.replaceAll("(有限公司|有限责任公司)", "").trim();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -71,10 +71,10 @@ public class InvoiceExportHelper {
|
||||
COMPANY_TYPE_MAP.put("探路供应链(上海)有限公司", tls);
|
||||
// 探路供应链(江苏)有限公司
|
||||
Map<Integer, String> tlj = new HashMap<>();
|
||||
tlj.put(1, "探路供应链(江苏)电子专用发票");
|
||||
tlj.put(2, "探路供应链(江苏)电子发票");
|
||||
tlj.put(3, "探路供应链(江苏)纸质发票");
|
||||
tlj.put(4, "探路供应链(江苏)纸质专用发票");
|
||||
tlj.put(1, "探路供应链电子专用发票");
|
||||
tlj.put(2, "探路供应链电子发票");
|
||||
tlj.put(3, "探路供应链纸质发票");
|
||||
tlj.put(4, "探路供应链纸质专用发票");
|
||||
COMPANY_TYPE_MAP.put("探路供应链(江苏)有限公司", tlj);
|
||||
}
|
||||
|
||||
@ -119,9 +119,9 @@ public class InvoiceExportHelper {
|
||||
"").trim();
|
||||
// 处理 CO., LTD 这样的组合
|
||||
finalResult = finalResult.replaceAll("(?i)(CO\\.?\\s*,\\s*LTD\\.?)", "").trim();
|
||||
finalResult = finalResult.replaceAll("(有限公司|有限责任公司)$", "").trim();
|
||||
finalResult = finalResult.replaceAll("(有限公司|有限责任公司)", "").trim();
|
||||
|
||||
if("2".equals(record.getSettleType())){
|
||||
if ("2".equals(record.getSettleType())) {
|
||||
return finalResult.replaceAll("-", ",").replaceAll("(\\d+)\\s+", "$1").trim();
|
||||
}
|
||||
|
||||
@ -141,6 +141,37 @@ public class InvoiceExportHelper {
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
// 处理备注
|
||||
public static String processCustomRemark(EmisSettleInvoiceChRecord record) {
|
||||
String remark = record.getOpenBillRemark();
|
||||
if (remark == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 只去除与 LTD 直接相邻的符号
|
||||
String finalResult = remark.replaceAll(
|
||||
"(?i)([,,\u3001.。;\\s]*(co\\.?|ltd\\.?|co|ltd)(?![,,\u3001.。;\\s]*$)[,,\u3001.。;\\s]*(co\\.?|ltd\\.?|co|ltd)?[,,\u3001.。;\\s]*)|(?i)\\s+(co\\.?|ltd\\.?|co|ltd)(?![,,\u3001.。;\\s]*$)[,,\u3001.。;\\s]*(co\\.?|ltd\\.?|co|ltd)?[,,\u3001.。;\\s]*|(?i)\\s+(co\\.?|ltd\\.?|co|ltd)$",
|
||||
"").trim();
|
||||
// 处理 CO., LTD 这样的组合
|
||||
finalResult = finalResult.replaceAll("(?i)(CO\\.?\\s*,\\s*LTD\\.?)", "").trim();
|
||||
finalResult = finalResult.replaceAll("(有限公司|有限责任公司)", "").trim();
|
||||
|
||||
if ("2".equals(record.getSettleType())) {
|
||||
return finalResult.replaceAll("-", ",").replaceAll("(\\d+)\\s+", "$1").trim();
|
||||
}
|
||||
|
||||
// 处理多个日期的情况
|
||||
String[] dateParts = finalResult.split("-");
|
||||
if (dateParts.length > 0) {
|
||||
String lastPart = dateParts[dateParts.length - 1].trim();
|
||||
// 去除日期和公司名之间的空格
|
||||
lastPart = lastPart.replaceAll("(\\d+)\\s+", "$1");
|
||||
finalResult = "现金-" + lastPart;
|
||||
}
|
||||
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
// 处理付款日期
|
||||
public static String processPayDate(String payDate) {
|
||||
if (payDate == null) {
|
||||
|
||||
@ -27,7 +27,7 @@ public class InvoicePoiExportUtil {
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
|
||||
// 表头
|
||||
String[] headers = { "开票日期", "公司抬头", "发票号", "时间", "开票金额", "开票公司", "备注", "付款日期", "业务员", "快递公司", "面单单号" };
|
||||
String[] headers = { "开票日期", "公司抬头", "发票号", "时间", "开票金额", "开票公司", "备注", "定制备注", "付款日期", "业务员", "快递公司", "面单单号" };
|
||||
Row headRow = sheet.createRow(0);
|
||||
headRow.setHeightInPoints(30);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
@ -37,7 +37,7 @@ public class InvoicePoiExportUtil {
|
||||
}
|
||||
|
||||
// 设置列宽
|
||||
double[] columnWidths = { 8.38, 31, 34.5, 9.13, 8.75, 22.75, 90.5, 29.13, 8.38, 8.38, 41.5 };
|
||||
double[] columnWidths = { 8.38, 31, 34.5, 9.13, 8.75, 22.75, 90.5, 29.13, 29.13, 8.38, 8.38, 41.5 };
|
||||
for (int i = 0; i < columnWidths.length; i++) {
|
||||
sheet.setColumnWidth(i, (int) (columnWidths[i] * 256));
|
||||
}
|
||||
@ -55,6 +55,7 @@ public class InvoicePoiExportUtil {
|
||||
row.createCell(col++).setCellValue(vo.getOpenMoney() == null ? "" : vo.getOpenMoney().toString());
|
||||
row.createCell(col++).setCellValue(vo.getInvoiceCompany());
|
||||
row.createCell(col++).setCellValue(vo.getRemark());
|
||||
row.createCell(col++).setCellValue(vo.getCustomRemark());
|
||||
row.createCell(col++).setCellValue(vo.getPayDate());
|
||||
row.createCell(col++).setCellValue(vo.getSalesmen());
|
||||
row.createCell(col++).setCellValue(vo.getExpressCompany());
|
||||
|
||||
@ -109,6 +109,9 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"有申请单审核中,待审核后再提交!");
|
||||
}
|
||||
|
||||
// 检查月结客户首次签约日期,首次签约之前开的不允许修改
|
||||
checkFirstSigningDay(emisWaybillOld);
|
||||
|
||||
// 插入数据
|
||||
emisWaybillAjustApplyMapper.insertEmisWaybillAjustApply(emisWaybillAjustApply);
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ package com.xdadan.erp.emis.service.impl;
|
||||
import com.xdadan.erp.system.domain.SysFileInfo;
|
||||
import com.xdadan.erp.system.service.ISysFileInfoService;
|
||||
import com.xdadan.erp.system.service.ISysNoticeService;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@ -60,6 +61,9 @@ package com.xdadan.erp.emis.service.impl;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -1455,6 +1459,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// 检查信用额度
|
||||
checkUseQuotaCredit(emisWaybillOld,emisWaybillSave);
|
||||
|
||||
// 检查月结客户首次签约日期,首次签约之前开的不允许修改
|
||||
checkFirstSigningDay(emisWaybillOld);
|
||||
|
||||
// 修改运单
|
||||
reUpdateWayBill(emisWaybillOld, emisWaybillSave,true);
|
||||
|
||||
|
||||
@ -47,7 +47,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="settleType" column="settle_type" />
|
||||
<result property="openBillRemark" column="open_bill_remark" />
|
||||
<result property="payDays" column="pay_days" />
|
||||
<result property="exportPayDays" column="export_pay_days" />
|
||||
|
||||
<association property="billMonth" column="apply_seq_no" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectBillMonthByApplySeqNo"/>
|
||||
<association property="billCode" column="apply_seq_no" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectBillCodeByApplySeqNo"/>
|
||||
@ -127,46 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
FROM emis_settle_pay_record pr
|
||||
INNER JOIN emis_settle_pay_bill_rel pbr ON pr.pay_id = pbr.pay_id
|
||||
INNER JOIN emis_settle_invoice_bill_rel ibr ON ibr.settle_bill_no = pbr.settle_bill_no
|
||||
WHERE ibr.apply_seq_no = a.apply_seq_no) as pay_days,
|
||||
(SELECT
|
||||
CASE
|
||||
WHEN COUNT(*) = 1 THEN
|
||||
CONCAT(
|
||||
DATE_FORMAT(pr.trade_date, '%m/%d'),
|
||||
'已付',
|
||||
CASE pr.pay_type
|
||||
WHEN '1' THEN '企业微信'
|
||||
WHEN '2' THEN '对公'
|
||||
WHEN '3' THEN '微信支付'
|
||||
WHEN '4' THEN '支付宝'
|
||||
WHEN '5' THEN '其他'
|
||||
WHEN '6' THEN '招行付款'
|
||||
ELSE pr.pay_type
|
||||
END
|
||||
)
|
||||
ELSE
|
||||
GROUP_CONCAT(DISTINCT
|
||||
CONCAT(
|
||||
DATE_FORMAT(pr.trade_date, '%m/%d'),
|
||||
'已付',
|
||||
CASE pr.pay_type
|
||||
WHEN '1' THEN '企业微信'
|
||||
WHEN '2' THEN '对公'
|
||||
WHEN '3' THEN '微信支付'
|
||||
WHEN '4' THEN '支付宝'
|
||||
WHEN '5' THEN '其他'
|
||||
WHEN '6' THEN '招行付款'
|
||||
ELSE pr.pay_type
|
||||
END,
|
||||
'-',
|
||||
pr.pay_money
|
||||
)
|
||||
)
|
||||
END
|
||||
FROM emis_settle_pay_record pr
|
||||
INNER JOIN emis_settle_pay_bill_rel pbr ON pr.pay_id = pbr.pay_id
|
||||
INNER JOIN emis_settle_invoice_bill_rel ibr ON ibr.settle_bill_no = pbr.settle_bill_no
|
||||
WHERE ibr.apply_seq_no = a.apply_seq_no) as export_pay_days
|
||||
WHERE ibr.apply_seq_no = a.apply_seq_no) as pay_days
|
||||
FROM emis_settle_invoice_ch_record a
|
||||
<where>
|
||||
del_flag='0'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user