Merge pull request 'develop' (#182) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/182
This commit is contained in:
heyu 2025-09-09 18:32:40 +08:00
commit f421fecbd2
7 changed files with 309 additions and 115 deletions

View File

@ -138,6 +138,18 @@ public class EmisTmsSiteBatchMiss extends BaseEntity {
/** 人工审核备注 */
private String manualRemark;
/* 完成状态 1:系统审核完成,2:人工审核完成,3:无需组批次 默认为1*/
/* 完成状态 1:系统审核完成,2:人工审核完成,3:无需组批次 默认为1 */
private String blManual;
/* 收款人 */
@TableField(exist = false)
private String payee;
/* 销售员 */
@TableField(exist = false)
private String salesmen;
/* 录单人姓名 */
@TableField(exist = false)
private String registerManName;
}

View File

@ -20,15 +20,18 @@ import org.apache.ibatis.annotations.Param;
/**
* @ClassName EmisSettlePayRecordMapper
* @Description <p> 账单收退款记录 Mapper 接口 </p>
* @Description
* <p>
* 账单收退款记录 Mapper 接口
* </p>
* @author linfso
* @date 2024-07-21 13:31:24
*/
public interface EmisSettlePayRecordMapper extends BaseMapper<EmisSettlePayRecord>
{
public interface EmisSettlePayRecordMapper extends BaseMapper<EmisSettlePayRecord> {
/**
* 主键查询
* @param id
*
* @param id
* @return
*/
public EmisSettlePayRecord selectEmisSettlePayRecordById(Long id);
@ -57,7 +60,6 @@ public interface EmisSettlePayRecordMapper extends BaseMapper<EmisSettlePayRecor
*/
public int checkUnique(EmisSettlePayRecord emisSettlePayRecord);
/**
* 新增
*
@ -139,4 +141,12 @@ public interface EmisSettlePayRecordMapper extends BaseMapper<EmisSettlePayRecor
* @return 发票申请备注映射
*/
List<Map<String, Object>> getInvoiceRemarksByPayIds(@Param("list") List<String> payIds);
/**
* 根据支付ID列表获取账单开票状态
*
* @param payIds 支付ID列表
* @return 账单开票状态映射
*/
List<Map<String, Object>> getBillOpenStatusByPayIds(@Param("list") List<String> payIds);
}

View File

@ -5134,7 +5134,7 @@ public class EmisBaseService {
// 检查第一级是否至少有一个节点匹配
boolean hasFirstLevelMatch = false;
// 收集所有第一级节点的子节点(第二级)
// 收集第一级节点的子节点(第二级)
Set<EmisTransPlanRule> secondLevelRules = new HashSet<>();
for (EmisTransPlanRule firstLevelRule : firstLevelRules) {
@ -5148,18 +5148,26 @@ public class EmisBaseService {
&& !batch.getEtd().before(firstLevelRule.getStartDate())) {
firstLevelMatch = true;
list.add(firstLevelRule);
// 收集当前第一级节点的所有子节点到第二级集合中
if (!CollectionUtil.isEmpty(firstLevelRule.getChildren())) {
secondLevelRules.addAll(firstLevelRule.getChildren());
}
break;
}
}
if (firstLevelMatch) {
hasFirstLevelMatch = true;
// 如果当前节点匹配,则只收集该节点的子节点
if (!CollectionUtil.isEmpty(firstLevelRule.getChildren())) {
secondLevelRules.addAll(firstLevelRule.getChildren());
}
}
}
// 如果第一级都不满足,则收集所有第一级节点的子节点
if (!hasFirstLevelMatch) {
for (EmisTransPlanRule firstLevelRule : firstLevelRules) {
if (!CollectionUtil.isEmpty(firstLevelRule.getChildren())) {
secondLevelRules.addAll(firstLevelRule.getChildren());
}
}
}
// 如果第二级为空,说明已经到底了,返回当前节点匹配且第一级至少有一个匹配的结果
@ -5183,18 +5191,26 @@ public class EmisBaseService {
&& !batch.getEtd().before(secondLevelRule.getStartDate())) {
secondLevelMatch = true;
list.add(secondLevelRule);
// 收集当前第二级节点的所有子节点到第三级集合中
if (!CollectionUtil.isEmpty(secondLevelRule.getChildren())) {
thirdLevelRules.addAll(secondLevelRule.getChildren());
}
break;
}
}
if (secondLevelMatch) {
hasSecondLevelMatch = true;
// 如果当前节点匹配,则只收集该节点的子节点
if (!CollectionUtil.isEmpty(secondLevelRule.getChildren())) {
thirdLevelRules.addAll(secondLevelRule.getChildren());
}
}
}
// 如果第二级都不满足,则收集所有第二级节点的子节点
if (!hasSecondLevelMatch) {
for (EmisTransPlanRule secondLevelRule : secondLevelRules) {
if (!CollectionUtil.isEmpty(secondLevelRule.getChildren())) {
thirdLevelRules.addAll(secondLevelRule.getChildren());
}
}
}
// 递归处理下一级,并收集结果
@ -5236,14 +5252,19 @@ public class EmisBaseService {
if (currentLevelMatch) {
hasCurrentLevelMatch = true;
if (CollectionUtil.isEmpty(currentLevelRule.getChildren())) {
return true;
// 如果当前节点匹配,则只收集该节点的子节点
if (!CollectionUtil.isEmpty(currentLevelRule.getChildren())) {
nextLevelRules.addAll(currentLevelRule.getChildren());
}
}
}
// 收集当前级节点的所有子节点到下一级集合中
if (!CollectionUtil.isEmpty(currentLevelRule.getChildren())) {
nextLevelRules.addAll(currentLevelRule.getChildren());
// 如果当前级都不满足,则收集所有当前级节点的子节点
if (!hasCurrentLevelMatch) {
for (EmisTransPlanRule currentLevelRule : currentLevelRules) {
if (!CollectionUtil.isEmpty(currentLevelRule.getChildren())) {
nextLevelRules.addAll(currentLevelRule.getChildren());
}
}
}

View File

@ -21,9 +21,9 @@ import java.util.List;
public class EmisSettlePayRecordCustomExcelUtil {
private static final String[] HEADERS = {
"交易时间", "收款来源", "收款账户", "支付类型", "缴款客户", "微信昵称", "运单号", "开票状态",
"交易时间", "收款来源", "收款账户", "支付类型", "缴款客户", "微信昵称", "运单号",
"账单金额", "开票金额", "支付金额", "理赔金额", "折让金额", "抵扣金额", "其他收费",
"理赔原因", "折让原因", "抵扣原因", "其他原因", "备注"
"理赔原因", "折让原因", "抵扣原因", "其他原因", "开票状态", "备注"
};
private static final int[] COLUMN_WIDTHS = {
@ -94,58 +94,57 @@ public class EmisSettlePayRecordCustomExcelUtil {
// 运单号
createCell(row, 6, data.getBillCodes() != null ? data.getBillCodes() : "", dataStyle);
// 开票状态
// String invoiceStatusDesc = getInvoiceStatusDesc(data.getInvoiceStatus());
createCell(row, 7, data.getInvoiceStatus(), dataStyle);
// 账单金额
BigDecimal billAmount = data.getBillAmount() != null ? data.getBillAmount() : BigDecimal.ZERO;
createCell(row, 8, billAmount, numberStyle);
createCell(row, 7, billAmount, numberStyle);
totalBillAmount = totalBillAmount.add(billAmount);
// 开票金额
BigDecimal invoiceAmount = data.getInvoiceAmount() != null ? data.getInvoiceAmount() : BigDecimal.ZERO;
createCell(row, 9, invoiceAmount, numberStyle);
createCell(row, 8, invoiceAmount, numberStyle);
totalInvoiceAmount = totalInvoiceAmount.add(invoiceAmount);
// 支付金额
BigDecimal payMoney = data.getPayMoney() != null ? data.getPayMoney() : BigDecimal.ZERO;
createCell(row, 10, payMoney, numberStyle);
createCell(row, 9, payMoney, numberStyle);
totalPayMoney = totalPayMoney.add(payMoney);
// 理赔金额
BigDecimal satisfyMoney = data.getSatisfyMoney() != null ? data.getSatisfyMoney() : BigDecimal.ZERO;
createCell(row, 11, satisfyMoney, numberStyle);
createCell(row, 10, satisfyMoney, numberStyle);
totalSatisfyMoney = totalSatisfyMoney.add(satisfyMoney);
// 折让金额
BigDecimal allowanceMoney = data.getAllowanceMoney() != null ? data.getAllowanceMoney()
: BigDecimal.ZERO;
createCell(row, 12, allowanceMoney, numberStyle);
createCell(row, 11, allowanceMoney, numberStyle);
totalAllowanceMoney = totalAllowanceMoney.add(allowanceMoney);
// 抵扣金额
BigDecimal deductionMoney = data.getDeductionMoney() != null ? data.getDeductionMoney()
: BigDecimal.ZERO;
createCell(row, 13, deductionMoney, numberStyle);
createCell(row, 12, deductionMoney, numberStyle);
totalDeductionMoney = totalDeductionMoney.add(deductionMoney);
// 其他收费
BigDecimal otherMoney = data.getOtherMoney() != null ? data.getOtherMoney() : BigDecimal.ZERO;
createCell(row, 14, otherMoney, numberStyle);
createCell(row, 13, otherMoney, numberStyle);
totalOtherMoney = totalOtherMoney.add(otherMoney);
// 理赔原因
createCell(row, 15, data.getSatisfyReason() != null ? data.getSatisfyReason() : "", dataStyle);
createCell(row, 14, data.getSatisfyReason() != null ? data.getSatisfyReason() : "", dataStyle);
// 折让原因
createCell(row, 16, data.getAllowanceReason() != null ? data.getAllowanceReason() : "", dataStyle);
createCell(row, 15, data.getAllowanceReason() != null ? data.getAllowanceReason() : "", dataStyle);
// 抵扣原因
createCell(row, 17, data.getDeductionReason() != null ? data.getDeductionReason() : "", dataStyle);
createCell(row, 16, data.getDeductionReason() != null ? data.getDeductionReason() : "", dataStyle);
// 其他原因
createCell(row, 18, data.getOtherReason() != null ? data.getOtherReason() : "", dataStyle);
createCell(row, 17, data.getOtherReason() != null ? data.getOtherReason() : "", dataStyle);
// 开票状态
createCell(row, 18, data.getInvoiceStatus() != null ? data.getInvoiceStatus() : "", dataStyle);
// 备注
createCell(row, 19, data.getRemark() != null ? data.getRemark() : "", dataStyle);
@ -208,24 +207,6 @@ public class EmisSettlePayRecordCustomExcelUtil {
}
}
/**
* 获取开票状态描述
*/
private static String getInvoiceStatusDesc(String invoiceStatus) {
if (invoiceStatus == null)
return "未开票";
switch (invoiceStatus) {
case "0":
return "待开票";
case "1":
return "已开票";
case "2":
return "已开票";
default:
return "未开票";
}
}
/**
* 创建表头样式
*/
@ -365,12 +346,30 @@ public class EmisSettlePayRecordCustomExcelUtil {
cell.setCellStyle(style);
}
/**
* 格式化BigDecimal,去除尾部多余的0,避免科学计数法
*/
private static BigDecimal formatBigDecimal(BigDecimal value) {
if (value == null) {
return BigDecimal.ZERO;
}
// 使用stripTrailingZeros()去除尾部0,然后使用toPlainString()避免科学计数法
BigDecimal stripped = value.stripTrailingZeros();
// 如果scale为负数,说明有尾随0被移除,需要重新构造
if (stripped.scale() < 0) {
stripped = stripped.setScale(0);
}
return stripped;
}
/**
* 创建数字单元格
*/
private static void createCell(Row row, int columnIndex, BigDecimal value, CellStyle style) {
Cell cell = row.createCell(columnIndex);
cell.setCellValue(value != null ? value.doubleValue() : 0.0);
BigDecimal formattedValue = formatBigDecimal(value);
// 使用toPlainString()避免科学计数法,然后转换为double
cell.setCellValue(formattedValue.toPlainString());
cell.setCellStyle(style);
}
@ -404,13 +403,13 @@ public class EmisSettlePayRecordCustomExcelUtil {
sumLabelCell.setCellStyle(labelStyle);
// 合计金额
createCell(sumRow, 8, totalBillAmount, sumStyle);
createCell(sumRow, 9, totalInvoiceAmount, sumStyle);
createCell(sumRow, 10, totalPayMoney, sumStyle);
createCell(sumRow, 11, totalSatisfyMoney, sumStyle);
createCell(sumRow, 12, totalAllowanceMoney, sumStyle);
createCell(sumRow, 13, totalDeductionMoney, sumStyle);
createCell(sumRow, 14, totalOtherMoney, sumStyle);
createCell(sumRow, 7, formatBigDecimal(totalBillAmount), sumStyle);
createCell(sumRow, 8, formatBigDecimal(totalInvoiceAmount), sumStyle);
createCell(sumRow, 9, formatBigDecimal(totalPayMoney), sumStyle);
createCell(sumRow, 10, formatBigDecimal(totalSatisfyMoney), sumStyle);
createCell(sumRow, 11, formatBigDecimal(totalAllowanceMoney), sumStyle);
createCell(sumRow, 12, formatBigDecimal(totalDeductionMoney), sumStyle);
createCell(sumRow, 13, formatBigDecimal(totalOtherMoney), sumStyle);
}
/**

View File

@ -101,6 +101,11 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
return baseList;
}
// 格式化基础数据中的所有BigDecimal字段
for (EmisSettlePayRecord record : baseList) {
formatAllBigDecimalFields(record);
}
// 提取支付ID列表
List<String> payIds = baseList.stream()
.map(EmisSettlePayRecord::getPayId)
@ -143,12 +148,21 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
// 设置账单金额
if (billAmountsMap.containsKey(payId)) {
record.setBillAmount((BigDecimal) billAmountsMap.get(payId));
BigDecimal billAmount = (BigDecimal) billAmountsMap.get(payId);
if (billAmount != null) {
record.setBillAmount(formatBigDecimal(billAmount));
}
}
// 设置开票金额
if (invoiceAmountsMap.containsKey(payId)) {
record.setInvoiceAmount((BigDecimal) invoiceAmountsMap.get(payId));
BigDecimal invoiceAmount = (BigDecimal) invoiceAmountsMap.get(payId);
if (invoiceAmount != null) {
record.setInvoiceAmount(formatBigDecimal(invoiceAmount));
}
} else {
// 如果开票金额为空,设置为0
record.setInvoiceAmount(BigDecimal.ZERO);
}
// 设置开票状态
@ -160,6 +174,15 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
if (invoiceRemarksMap.containsKey(payId)) {
record.setRemark((String) invoiceRemarksMap.get(payId));
}
// 设置createSite,如果为空则设置为88888
if (StringUtils.isBlank(record.getCreateSite())) {
record.setCreateSite("88888");
record.setCreateSiteName("总部");
}
// 格式化所有BigDecimal字段,去除多余的0
formatAllBigDecimalFields(record);
}
} catch (Exception e) {
log.error("并行查询扩展信息时发生异常", e);
@ -181,12 +204,21 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
// 设置账单金额
if (billAmountsMap.containsKey(payId)) {
record.setBillAmount((BigDecimal) billAmountsMap.get(payId));
BigDecimal billAmount = (BigDecimal) billAmountsMap.get(payId);
if (billAmount != null) {
record.setBillAmount(formatBigDecimal(billAmount));
}
}
// 设置开票金额
if (invoiceAmountsMap.containsKey(payId)) {
record.setInvoiceAmount((BigDecimal) invoiceAmountsMap.get(payId));
BigDecimal invoiceAmount = (BigDecimal) invoiceAmountsMap.get(payId);
if (invoiceAmount != null) {
record.setInvoiceAmount(formatBigDecimal(invoiceAmount));
}
} else {
// 如果开票金额为空,设置为0
record.setInvoiceAmount(BigDecimal.ZERO);
}
// 设置开票状态
@ -198,12 +230,71 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
if (invoiceRemarksMap.containsKey(payId)) {
record.setRemark((String) invoiceRemarksMap.get(payId));
}
// 设置createSite,如果为空则设置为88888
if (StringUtils.isBlank(record.getCreateSite())) {
record.setCreateSite("88888");
}
// 格式化所有BigDecimal字段,去除多余的0
formatAllBigDecimalFields(record);
}
}
return baseList;
}
/**
* 格式化BigDecimal,去除尾部多余的0,避免科学计数法
*/
private BigDecimal formatBigDecimal(BigDecimal value) {
if (value == null) {
return BigDecimal.ZERO;
}
// 使用stripTrailingZeros()去除尾部0,然后使用toPlainString()避免科学计数法
BigDecimal stripped = value.stripTrailingZeros();
// 如果scale为负数,说明有尾随0被移除,需要重新构造
if (stripped.scale() < 0) {
stripped = stripped.setScale(0);
}
return stripped;
}
/**
* 格式化EmisSettlePayRecord中所有BigDecimal字段,去除多余的0
*/
private void formatAllBigDecimalFields(EmisSettlePayRecord record) {
if (record == null) {
return;
}
// 格式化所有BigDecimal字段
if (record.getPayMoney() != null) {
record.setPayMoney(formatBigDecimal(record.getPayMoney()));
}
if (record.getRefundMoney() != null) {
record.setRefundMoney(formatBigDecimal(record.getRefundMoney()));
}
if (record.getSatisfyMoney() != null) {
record.setSatisfyMoney(formatBigDecimal(record.getSatisfyMoney()));
}
if (record.getAllowanceMoney() != null) {
record.setAllowanceMoney(formatBigDecimal(record.getAllowanceMoney()));
}
if (record.getDeductionMoney() != null) {
record.setDeductionMoney(formatBigDecimal(record.getDeductionMoney()));
}
if (record.getOtherMoney() != null) {
record.setOtherMoney(formatBigDecimal(record.getOtherMoney()));
}
if (record.getBillAmount() != null) {
record.setBillAmount(formatBigDecimal(record.getBillAmount()));
}
if (record.getInvoiceAmount() != null) {
record.setInvoiceAmount(formatBigDecimal(record.getInvoiceAmount()));
}
}
/**
* 获取运单号映射
*/
@ -255,12 +346,43 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
private Map<String, Object> getInvoiceStatusMap(List<String> payIds) {
List<Map<String, Object>> invoiceStatusList = emisSettlePayRecordMapper.getInvoiceStatusByPayIds(payIds);
Map<String, Object> result = new java.util.HashMap<>();
// 先处理查询到的开票状态
for (Map<String, Object> map : invoiceStatusList) {
String payId = (String) map.get("pay_id");
if (payId != null) {
result.put(payId, map.get("status"));
}
}
// 对于没有开票状态记录的payId,需要检查emis_settle_bill的open_bill_status
List<String> missingPayIds = payIds.stream()
.filter(payId -> !result.containsKey(payId))
.collect(java.util.stream.Collectors.toList());
if (!CollectionUtils.isEmpty(missingPayIds)) {
List<Map<String, Object>> billStatusList = emisSettlePayRecordMapper
.getBillOpenStatusByPayIds(missingPayIds);
for (Map<String, Object> map : billStatusList) {
String payId = (String) map.get("pay_id");
String openBillStatus = (String) map.get("open_bill_status");
if (payId != null) {
if ("3".equals(openBillStatus)) {
result.put(payId, "不开票");
} else {
result.put(payId, "未开票");
}
}
}
// 对于仍然没有状态的payId,设置为"未开票"
for (String payId : missingPayIds) {
if (!result.containsKey(payId)) {
result.put(payId, "未开票");
}
}
}
return result;
}
@ -285,18 +407,15 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
}
@Override
public List<PayBackRecordDtl> queryPayBackRecordList(EmisSettlePayRecord emisSettlePayRecord)
{
public List<PayBackRecordDtl> queryPayBackRecordList(EmisSettlePayRecord emisSettlePayRecord) {
return emisSettlePayRecordMapper.queryPayBackRecordList(emisSettlePayRecord);
}
@Override
public List<PayBackRecordDtl> queryNoPayBackRecordList(EmisSettlePayRecord emisSettlePayRecord)
{
public List<PayBackRecordDtl> queryNoPayBackRecordList(EmisSettlePayRecord emisSettlePayRecord) {
return emisSettlePayRecordMapper.queryNoPayBackRecordList(emisSettlePayRecord);
}
/**
* 检查是否重复
*
@ -304,9 +423,8 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
* @return 数量
*/
@Override
public int checkUnique(EmisSettlePayRecord emisSettlePayRecord)
{
return emisSettlePayRecordMapper.checkUnique(emisSettlePayRecord);
public int checkUnique(EmisSettlePayRecord emisSettlePayRecord) {
return emisSettlePayRecordMapper.checkUnique(emisSettlePayRecord);
}
/**
@ -316,7 +434,7 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
* @return 结果
*/
@Override
public int insertEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord,String payId) throws EmisBizError {
public int insertEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord, String payId) throws EmisBizError {
// 非空校验
checkParam(emisSettlePayRecord);
@ -326,40 +444,38 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
emisSettlePayRecord.setSettleBillNo(WaybillHelper.formatQueryValue(emisSettlePayRecord.getSettleBillNo()));
// 多账单合并收款
String [] settleBillNoArr = emisSettlePayRecord.getSettleBillNo().split(",");
String[] settleBillNoArr = emisSettlePayRecord.getSettleBillNo().split(",");
for(int i=0;i<settleBillNoArr.length;i++) {
for (int i = 0; i < settleBillNoArr.length; i++) {
String settleBillNo = settleBillNoArr[i];
if(!StringUtils.isEmpty(settleBillNo)) {
EmisSettleBill emisSettleBill=emisSettleBillMapper.selectSettleBillBySettleBillNo(settleBillNo);
if(
!"1".equals(emisSettleBill.getBlConfirmSite())
&& !"7".equals(emisSettlePayRecord.getPayType()) ){
throw new EmisBizError(EmisBizErrorType.FAIL,"业务账单未确认,不允许收款!");
if (!StringUtils.isEmpty(settleBillNo)) {
EmisSettleBill emisSettleBill = emisSettleBillMapper.selectSettleBillBySettleBillNo(settleBillNo);
if (!"1".equals(emisSettleBill.getBlConfirmSite())
&& !"7".equals(emisSettlePayRecord.getPayType())) {
throw new EmisBizError(EmisBizErrorType.FAIL, "业务账单未确认,不允许收款!");
}
}
}
// 不重复的 id流水号
// 如果支付单是空的则生成新的支付单
if(StringUtils.isEmpty(payId)) {
if (StringUtils.isEmpty(payId)) {
payId = WaybillHelper.genPayId();
}
emisSettlePayRecord.setPayId(payId);
// 退款时支付金额记录负值
if("2".equals(emisSettlePayRecord.getRecType())){
if ("2".equals(emisSettlePayRecord.getRecType())) {
emisSettlePayRecord.setPayMoney(BigDecimal.ZERO.subtract(emisSettlePayRecord.getRefundMoney()));
emisSettlePayRecord.setTradeDate(emisSettlePayRecord.getRefundDate());
// emisSettlePayRecord.setPayType("1");
// emisSettlePayRecord.setPayType("1");
}
// 插入账单和支付单关联关系
for(int i=0;i<settleBillNoArr.length;i++) {
for (int i = 0; i < settleBillNoArr.length; i++) {
String settleBillNo = settleBillNoArr[i];
if(!StringUtils.isEmpty(settleBillNo)) {
if (!StringUtils.isEmpty(settleBillNo)) {
EmisSettlePayBillRel emisSettlePayBillRel = new EmisSettlePayBillRel();
emisSettlePayBillRel.setPayId(payId);
@ -369,8 +485,8 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
}
// 插入发票和收款的关系
if(!CollectionUtils.isEmpty(emisSettlePayRecord.getPayInvoiceRelList())){
for (EmisSettlePayInvoiceRel itemSettlePayInvoiceRel:emisSettlePayRecord.getPayInvoiceRelList()) {
if (!CollectionUtils.isEmpty(emisSettlePayRecord.getPayInvoiceRelList())) {
for (EmisSettlePayInvoiceRel itemSettlePayInvoiceRel : emisSettlePayRecord.getPayInvoiceRelList()) {
itemSettlePayInvoiceRel.setPayId(payId);
emisSettlePayInvoiceRelMapper.insertEmisSettlePayInvoiceRel(itemSettlePayInvoiceRel);
// 更新收款状态
@ -378,15 +494,13 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
}
}
// 记录收退款运单号
List<EmisSettlePayRel> listRel=emisSettlePayRecord.getPayRelList();
if(!CollectionUtils.isEmpty(listRel)){
for (EmisSettlePayRel payRel:listRel
) {
List<EmisSettlePayRel> listRel = emisSettlePayRecord.getPayRelList();
if (!CollectionUtils.isEmpty(listRel)) {
for (EmisSettlePayRel payRel : listRel) {
payRel.setId(null);
payRel.setPayId(payId);
if("2".equals(emisSettlePayRecord.getRecType())){
if ("2".equals(emisSettlePayRecord.getRecType())) {
payRel.setPayMoney(BigDecimal.ZERO.subtract(payRel.getPayMoney()));
}
emisSettlePayRelMapper.insertEmisSettlePayRel(payRel);
@ -399,9 +513,9 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
emisSettlePayRecordMapper.insertEmisSettlePayRecord(emisSettlePayRecord);
// 重新计算账单收款信息
for(int i=0;i<settleBillNoArr.length;i++) {
for (int i = 0; i < settleBillNoArr.length; i++) {
String settleBillNo = settleBillNoArr[i];
if(!StringUtils.isEmpty(settleBillNo)) {
if (!StringUtils.isEmpty(settleBillNo)) {
emisSettleBillService.reCalcSettleBillPayStatus(settleBillNo);
}
}
@ -409,11 +523,11 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
}
private static void checkParam(EmisSettlePayRecord emisSettlePayRecord) throws EmisBizError {
if(StringUtils.isEmpty(emisSettlePayRecord.getSettleBillNo())){
throw new EmisBizError(EmisBizErrorType.FAIL,"账单编号不能为空");
if (StringUtils.isEmpty(emisSettlePayRecord.getSettleBillNo())) {
throw new EmisBizError(EmisBizErrorType.FAIL, "账单编号不能为空");
}
if("1".equals(emisSettlePayRecord.getRecType())) {
if ("1".equals(emisSettlePayRecord.getRecType())) {
if (emisSettlePayRecord.getPayMoney() == null) {
throw new EmisBizError(EmisBizErrorType.FAIL, "收款金额不能为空");
}
@ -426,7 +540,7 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
if (emisSettlePayRecord.getTradeDate() == null) {
throw new EmisBizError(EmisBizErrorType.FAIL, "交易日期不能为空");
}
} else if("2".equals(emisSettlePayRecord.getRecType())) {
} else if ("2".equals(emisSettlePayRecord.getRecType())) {
if (emisSettlePayRecord.getRefundMoney() == null) {
throw new EmisBizError(EmisBizErrorType.FAIL, "退款金额不能为空");
}
@ -476,9 +590,9 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
@Override
public int payRecordReturn(Long id) throws EmisBizError {
EmisSettlePayRecord payRecordOld=emisSettlePayRecordMapper.selectEmisSettlePayRecordById(id);
if(payRecordOld==null){
throw new EmisBizError(EmisBizErrorType.FAIL,"收款单不存在!");
EmisSettlePayRecord payRecordOld = emisSettlePayRecordMapper.selectEmisSettlePayRecordById(id);
if (payRecordOld == null) {
throw new EmisBizError(EmisBizErrorType.FAIL, "收款单不存在!");
}
// 删除收款记录
@ -497,8 +611,7 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
* @return 结果
*/
@Override
public int updateEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord)
{
public int updateEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord) {
return emisSettlePayRecordMapper.updateEmisSettlePayRecord(emisSettlePayRecord);
}
@ -509,8 +622,7 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
* @return 结果
*/
@Override
public int deleteEmisSettlePayRecordByIds(Long[] ids)
{
public int deleteEmisSettlePayRecordByIds(Long[] ids) {
return emisSettlePayRecordMapper.deleteEmisSettlePayRecordByIds(ids);
}
@ -521,8 +633,7 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
* @return 结果
*/
@Override
public int deleteEmisSettlePayRecordById(Long id)
{
public int deleteEmisSettlePayRecordById(Long id) {
return emisSettlePayRecordMapper.deleteEmisSettlePayRecordById(id);
}
@ -539,7 +650,8 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
List<EmisSettlePayRecord> exportList = selectEmisSettlePayRecordList(emisSettlePayRecord);
// 使用定制Excel工具类导出
EmisSettlePayRecordCustomExcelUtil.exportCustomExcel(response, exportList, "收款明细定制导出_" + System.currentTimeMillis());
EmisSettlePayRecordCustomExcelUtil.exportCustomExcel(response, exportList,
"收款明细定制导出_" + System.currentTimeMillis());
} catch (Exception e) {
log.error("定制导出收款明细失败", e);

View File

@ -684,7 +684,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHEN invoice_amount = FLOOR(invoice_amount) THEN CAST(FLOOR(invoice_amount) AS CHAR)
ELSE TRIM(TRAILING '0' FROM TRIM(TRAILING '.' FROM CAST(invoice_amount AS CHAR)))
END,
' ',
'元 ',
company_name
)
END
@ -770,4 +770,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by espr.pay_id
</select>
<!-- 根据支付ID列表获取账单开票状态 -->
<select id="getBillOpenStatusByPayIds" parameterType="java.util.List" resultType="map">
select
espbr.pay_id,
esb.open_bill_status
from emis_settle_pay_bill_rel espbr
left join emis_settle_bill esb on espbr.settle_bill_no = esb.settle_bill_no
where espbr.del_flag = '0' and esb.del_flag = '0'
and espbr.pay_id in
<foreach collection="list" item="payId" open="(" separator="," close=")">
#{payId}
</foreach>
group by espbr.pay_id
</select>
</mapper>

View File

@ -50,6 +50,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dispatchUnderlingSiteName" column="dispatch_underling_site_name" />
<result property="manual_remark" column="manualRemark" />
<result property="bl_manual" column="blManual" />
<result property="payee" column="payee" />
<result property="salesmen" column="salesmen" />
<result property="registerManName" column="registerManName" />
</resultMap>
<sql id="selectEmisTmsSiteBatchMissVo">
@ -62,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
w.product_type,w.problem_type,w.virtual_remark,w.dispatch_underling_site_code,
w.payment_type, w.parcel_qty, w.bill_weight, w.total_volume, w.volume_weight,
w.settlement_weight, w.freight, w.remark as waybill_remark, w.fee_remark, m.manager, k.trans_manager,
w.payee, w.salesmen, u.emp_name as registerManName,
(SELECT GROUP_CONCAT(s.name)
FROM emis_supplier s
WHERE FIND_IN_SET(s.code, m.supplier_code)
@ -81,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join emis_trans_line k on w.trans_line_type=k.line_code and k.del_flag='0'
left join emis_trans_plan_rule r on m.trans_plan_rule_id=r.id and r.del_flag='0'
left join emis_trans_line l on m.line_code=l.line_code and l.del_flag='0'
left join sys_user u on w.register_man_code=u.emp_code and u.del_flag='0'
</sql>
<!-- <select id="selectEmisTmsSiteBatchMissList" parameterType="EmisTmsSiteBatchMiss" resultMap="EmisTmsSiteBatchMissResult">-->
@ -149,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
w.payment_type, w.parcel_qty, w.bill_weight, w.total_volume, w.volume_weight,
w.settlement_weight, w.freight, w.remark as waybill_remark, w.fee_remark,
null as manager, null as trans_manager,
w.payee, w.salesmen, u.emp_name as registerManName,
(SELECT GROUP_CONCAT(s.site_name ORDER BY FIND_IN_SET(s.site_code, w.start_site_code))
FROM emis_site s
WHERE FIND_IN_SET(s.site_code, w.start_site_code) AND s.del_flag = 0) as start_site_name,
@ -168,6 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join emis_site s2 on w.dispatch_underling_site_code=s2.site_code and s2.del_flag=0
left join emis_trans_line l on w.trans_line_type=l.line_code and l.del_flag=0
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag=0
left join sys_user u on w.register_man_code=u.emp_code and u.del_flag='0'
<where>
b.site_batch_status = '1'
<if test="billCode != null and billCode != '' and ( params.billCodeSortList == null or (params.billCodeSortList != null and params.billCodeSortList.size() == 1 ) )">
@ -213,6 +220,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (w.start_site_code=#{params.privSiteCode} or w.send_site_code=#{params.privSiteCode})
</if>
<if test="payee != null and payee != ''">
AND w.payee like concat('%', #{payee}, '%')
</if>
<if test="salesmen != null and salesmen != ''">
AND w.salesmen like concat('%', #{salesmen}, '%')
</if>
<if test="registerManName != null and registerManName != ''">
AND u.emp_name like concat('%', #{registerManName}, '%')
</if>
</where>
</when>
<otherwise>
@ -314,6 +330,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.endSendDate != null and params.endSendDate != ''">
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="payee != null and payee != ''">
AND w.payee like concat('%', #{payee}, '%')
</if>
<if test="salesmen != null and salesmen != ''">
AND w.salesmen like concat('%', #{salesmen}, '%')
</if>
<if test="registerManName != null and registerManName != ''">
AND u.emp_name like concat('%', #{registerManName}, '%')
</if>
</where>
order by m.bill_code desc
</otherwise>