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

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/45
This commit is contained in:
heyu 2025-06-05 14:23:45 +08:00
commit 080defd184
6 changed files with 105 additions and 9 deletions

View File

@ -168,6 +168,9 @@ public class EmisBaseService {
@Autowired
private EmisTempCreditCustomerMapper emisTempCreditCustomerMapper;
@Autowired
private EmisCommissionDtlMapper emisCommissionDtlMapper;
private static SysUser emptySysUser = new SysUser();
static {
@ -2329,6 +2332,9 @@ public class EmisBaseService {
waybillProblemInfo.setDataFrom(WaybillHelper.getDataFrom());
emisWaybillProblemInfoMapper.insertEmisWaybillProblemInfo(waybillProblemInfo);
// 删除员工提成
updateCommission(waybillProblemInfo);
// 记录延迟天数
EmisProblemType emisProblemType =getEmisProblemTypebyTypeId(waybillProblemInfo.getProblemType());
@ -2399,6 +2405,13 @@ public class EmisBaseService {
}
private void updateCommission(EmisWaybillProblemInfo waybillProblemInfo) {
Integer typeId = waybillProblemInfo.getProblemType();
if (typeId == 173 || typeId == 170 || typeId == 151) {
emisCommissionDtlMapper.deleteEmisCommissionDtlByBillCode(waybillProblemInfo.getBillCode());
}
}
/**
* 根据客户编号,获取客户信息

View File

@ -314,6 +314,16 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
// 先删除该运单已经计算的提成
emisCommissionDtlMapper.deleteEmisCommissionDtlByBillCode(billCode);
if ("6".equals(waybill.getPaymentType())) {
return;
}
if (waybill.getProblemType() != null) {
if (173 == waybill.getProblemType() || 170 == waybill.getProblemType()
|| 151 == waybill.getProblemType()) {
return;
}
}
// 计算每个岗位的提成方案
/*
网点客服 1
@ -382,6 +392,40 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
try {
// 获取统计数据
List<EmisCommissionProfit> listProfit=emisCommissionProfitMapper.selectProfitStatList(empName,billMonth);
// 如果指定了empName,需要处理该员工在数据库中存在但listProfit中不存在的月份记录
if(StringUtils.isNotEmpty(empName)) {
// 查询数据库中该员工的所有月份记录
EmisCommissionProfit queryParam = new EmisCommissionProfit();
queryParam.setEmpName(empName);
if(StringUtils.isNotEmpty(billMonth)) {
queryParam.setBillMonth(billMonth);
}
List<EmisCommissionProfit> existingProfits = emisCommissionProfitMapper.selectEmisCommissionProfitList(queryParam);
// 遍历现有记录,检查是否在新统计中存在
for(EmisCommissionProfit existingProfit : existingProfits) {
boolean found = false;
for(EmisCommissionProfit newProfit : listProfit) {
if(existingProfit.getEmpName().equals(newProfit.getEmpName())
&& existingProfit.getBillMonth().equals(newProfit.getBillMonth())) {
found = true;
break;
}
}
// 如果在新统计中不存在,则添加一条金额为0的记录
if(!found) {
EmisCommissionProfit zeroProfit = new EmisCommissionProfit();
zeroProfit.setEmpName(existingProfit.getEmpName());
zeroProfit.setBillMonth(existingProfit.getBillMonth());
zeroProfit.setMoney(BigDecimal.ZERO);
zeroProfit.setMonthMoney(BigDecimal.ZERO);
listProfit.add(zeroProfit);
}
}
}
// 更新或插入提成记录
for (EmisCommissionProfit profitItem:listProfit) {
// 查询是否有数据,没有则插入
int isExists=emisCommissionProfitMapper.checkUnique(profitItem);

View File

@ -20,16 +20,16 @@ import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.enumtype.WaybillOperLogType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.vo.WaybillOrder;
import com.xdadan.erp.emis.service.EmisBaseService;
import com.xdadan.erp.emis.service.IEmisSettleBillService;
import com.xdadan.erp.emis.service.IEmisWaybillService;
import com.xdadan.erp.emis.mapper.EmisCommissionDtlMapper;
import com.xdadan.erp.emis.service.*;
import com.xdadan.erp.emis.utils.WaybillHelper;
import com.xdadan.erp.system.service.ISysFileInfoService;
import com.xdadan.erp.system.service.ISysNoticeService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xdadan.erp.emis.mapper.EmisWaybillAjustApplyMapper;
import com.xdadan.erp.emis.service.IEmisWaybillAjustApplyService;
import org.springframework.transaction.annotation.Transactional;
/**
@ -47,6 +47,12 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
@Autowired
private IEmisWaybillService emisWaybillService;
@Autowired
private IEmisCommissionProfitService emisCommissionProfitService;
@Autowired
private EmisCommissionDtlMapper emisCommissionDtlMapper;
/**
* 查询运单调整申请
@ -313,6 +319,14 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
String title="费用调整已审批通过,单号【"+emisWaybillAjustApply.getBillCode()+"】";
sendNoticeToEmpUser(emisWaybillAjustApply.getApplyManCode(), title, "", "/d24/expenseRecognitionManagemen/WaybillAjustApplyList");
if ("6".equals(emisWaybillOld.getPaymentType()) && !"6".equals(emisWaybillSave.getPaymentType())) {
// 重新计算提成
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
}
if (!"6".equals(emisWaybillOld.getPaymentType()) && "6".equals(emisWaybillSave.getPaymentType())) {
// 删除提成
emisCommissionDtlMapper.deleteEmisCommissionDtlByBillCode(emisWaybillSave.getBillCode());
}
// 审核通过
return emisWaybillAjustApplyMapper.auditCenterPass(emisWaybillAjustApply);

View File

@ -20,6 +20,7 @@ import com.xdadan.erp.emis.domain.enumtype.ScanType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.vo.scan.ScanInfo;
import com.xdadan.erp.emis.service.EmisBaseService;
import com.xdadan.erp.emis.service.IEmisCommissionProfitService;
import com.xdadan.erp.emis.service.IEmisTmsScanRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -39,6 +40,9 @@ public class EmisWaybillProblemInfoServiceImpl extends EmisBaseService implement
@Autowired
private EmisWaybillProblemInfoMapper emisWaybillProblemInfoMapper;
@Autowired
private IEmisCommissionProfitService emisCommissionProfitService;
/**
* 查询问题件
*
@ -119,6 +123,13 @@ public class EmisWaybillProblemInfoServiceImpl extends EmisBaseService implement
// 删除问题件
emisWaybillProblemInfoMapper.deleteEmisWaybillProblemInfoById(id);
// 获取运单信息
EmisWaybill waybill = getWaybillByBillCode(emisWaybillProblemInfo.getBillCode());
if (!"6".equals(waybill.getPaymentType())) {
// 重新计算提成
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillProblemInfo.getBillCode());
}
// 删除运单的问题件记录
EmisWaybill emisWaybill = new EmisWaybill();
emisWaybill.setBillCode(emisWaybillProblemInfo.getMainBillCode());

View File

@ -126,6 +126,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
@Autowired
private ISysNoticeService sysNoticeService;
@Autowired
private EmisCommissionDtlMapper emisCommissionDtlMapper;
/**
* 获取稽核数据
* @param id
@ -1468,6 +1471,15 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 修改运单
reUpdateWayBill(emisWaybillOld, emisWaybillSave,true);
if ("6".equals(emisWaybillOld.getPaymentType()) && !"6".equals(emisWaybillSave.getPaymentType())) {
// 重新计算提成
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
}
if (!"6".equals(emisWaybillOld.getPaymentType()) && "6".equals(emisWaybillSave.getPaymentType())) {
// 删除提成
emisCommissionDtlMapper.deleteEmisCommissionDtlByBillCode(emisWaybillSave.getBillCode());
}
// 信用额度计算
// reCalcUseQuotaCredit(emisWaybillOld,emisWaybillSave);
}
@ -3207,7 +3219,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// reCalcUseQuotaCredit(null, emisWaybillSave);
// 重新计算提成
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
if (!"6".equals(emisWaybillSave.getPaymentType())) {
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
}
}catch (Exception ex){
ex.printStackTrace();

View File

@ -175,7 +175,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
emis_settle_invoice_rel rel
where a.apply_seq_no=rel.apply_seq_no and
rel.del_flag = '0'
and FIND_IN_SET(rel.`bill_no`,#{params.billCode})
and FIND_IN_SET(rel.bill_no, REPLACE(#{params.billCode}, '\n', ','))
)
<!--
AND apply_seq_no IN (
@ -208,7 +208,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select 1 from emis_settle_invoice_bill_rel x3
where x3.del_flag = '0'
and a.apply_seq_no=x3.apply_seq_no
AND FIND_IN_SET(x3.settle_bill_no, #{settleBillNo})
and FIND_IN_SET(x3.settle_bill_no, REPLACE(#{params.settleBillNo}, '\n', ','))
)
</if>
@ -421,7 +421,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
emis_settle_invoice_rel rel
where a.apply_seq_no=rel.apply_seq_no and
rel.del_flag = '0'
and FIND_IN_SET(rel.`bill_no`,#{params.billCode})
and FIND_IN_SET(rel.bill_no, REPLACE(#{params.billCode}, '\n', ','))
)
</if>
@ -431,7 +431,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM emis_settle_invoice_bill_rel x3
WHERE x3.del_flag = '0'
AND a.apply_seq_no = x3.apply_seq_no
AND FIND_IN_SET(x3.settle_bill_no, #{params.settleBillNo})
and FIND_IN_SET(x3.settle_bill_no, REPLACE(#{params.settleBillNo}, '\n', ','))
)
</if>