Merge pull request 'demand: tms-提成管理-提成统计-运单提成明细数据与提成统计不匹配问题解决' (#260) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/260
This commit is contained in:
commit
bd4a617bca
@ -443,36 +443,36 @@ public class EmisCommissionProfitServiceImpl extends EmisBaseService implements
|
||||
// 获取统计数据
|
||||
List<EmisCommissionProfit> listProfit=emisCommissionProfitMapper.selectProfitStatList(empName,billMonth);
|
||||
|
||||
// 如果指定了empName,需要处理该员工在数据库中存在但listProfit中不存在的月份记录
|
||||
// 需要处理数据库中存在但listProfit中不存在的月份记录(无论是否指定empName)
|
||||
// 查询数据库中符合条件的记录
|
||||
EmisCommissionProfit queryParam = new EmisCommissionProfit();
|
||||
if(StringUtils.isNotEmpty(empName)) {
|
||||
// 查询数据库中该员工的所有月份记录
|
||||
EmisCommissionProfit queryParam = new EmisCommissionProfit();
|
||||
queryParam.setEmpName(empName);
|
||||
if(StringUtils.isNotEmpty(billMonth)) {
|
||||
queryParam.setBillMonth(billMonth);
|
||||
}
|
||||
List<EmisCommissionProfit> existingProfits = emisCommissionProfitMapper.selectEmisCommissionProfitList(queryParam);
|
||||
}
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新或插入提成记录
|
||||
|
||||
Loading…
Reference in New Issue
Block a user