Commit 7a7ecfa0 authored by hongguangwu's avatar hongguangwu

收入优化

parent 08cbd5ea
......@@ -248,73 +248,71 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
} else {
return R.failed("获取项目信息失败,请联管理员!");
}
List<TSalaryAccount> salaryAccountList = salaryAccountService.getListByIncome(id);
if (salaryAccountList != null && !salaryAccountList.isEmpty()) {
List<String> idCardList = new ArrayList<>();
for (TSalaryAccount account : salaryAccountList) {
idCardList.add(account.getEmpIdcard());
}
Map<String, Integer> detailMap = new HashMap<>();
// 收入相关
R<String> failed1 = getIncomeDetailMap(tSalaryStandard, dept, idCardList, detailMap);
if (failed1 != null) return failed1;
// 含有薪资,则计算收入
if (Common.isNotNull(dept.getManageServerItem()) && dept.getManageServerItem().contains(CommonConstants.FOUR_STRING)) {
// 管理费
if (CommonConstants.ZERO_STRING.equals(dept.getManagementTag())) {
if (Common.isNotNull(dept.getManageServerItem()) && dept.getManageServerItem().contains(CommonConstants.FOUR_STRING)
&& CommonConstants.ZERO_STRING.equals(dept.getManagementTag())) {
// 金额-人数
if (CommonConstants.TWO_STRING.equals(dept.getManagementType())) {
// 收入相关
TIncomeDetail detail = new TIncomeDetail();
detail.setPayMonth(tSalaryStandard.getSalaryMonth());
R<TIncomeDetailReturnVo> detailR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincomedetail/inner/getTIncomeDetailList", detail
, TIncomeDetailReturnVo.class, SecurityConstants.FROM_IN);
Map<String, Integer> detailMap = new HashMap<>();
Integer value;
if (detailR != null) {
if (detailR.getData() != null && detailR.getData().getDetailList() != null && !detailR.getData().getDetailList().isEmpty()) {
TIncomeDetailReturnVo vo = detailR.getData();
List<TIncomeDetail> detailList = vo.getDetailList();
for (TIncomeDetail incomeDetail : detailList) {
value = detailMap.get(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + incomeDetail.getSourceType());
if (Common.isEmpty(value)) {
value = CommonConstants.ZERO_INT;
}
if (CommonConstants.ZERO_STRING.equals(incomeDetail.getRedData())) {
value++;
// 保存明细
R<String> failed = saveIncomeDetail(salaryAccountList, tSalaryStandard, dept, detailMap, dept.getManagementType(), CommonConstants.ONE_STRING);
if (failed != null) return failed;
} else {
value--;
}
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getFeeType() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getSourceType(), value);
}
// 保存明细
R<String> failed = saveIncomeDetail(salaryAccountList, tSalaryStandard, dept, new HashMap<>(), dept.getManagementType(), CommonConstants.ONE_STRING);
if (failed != null) return failed;
}
} else {
return R.failed("获取收入明细的详情出错,请联系管理员!");
}
// 风险金
if (Common.isNotNull(dept.getRiskServerItem()) && dept.getRiskServerItem().contains(CommonConstants.FOUR_STRING)
&& CommonConstants.ZERO_STRING.equals(dept.getRiskFundTag())) {
// 金额-人数
if (CommonConstants.TWO_STRING.equals(dept.getRiskFundType())) {
// 保存明细
R<String> failed = saveIncomeDetail(id, tSalaryStandard, dept, detailMap, dept.getManagementType(), CommonConstants.ONE_STRING);
R<String> failed = saveIncomeDetail(salaryAccountList, tSalaryStandard, dept, detailMap, dept.getRiskFundType(), CommonConstants.TWO_STRING);
if (failed != null) return failed;
} else {
// 保存明细
R<String> failed = saveIncomeDetail(id, tSalaryStandard, dept, new HashMap<>(), dept.getManagementType(), CommonConstants.ONE_STRING);
R<String> failed = saveIncomeDetail(salaryAccountList, tSalaryStandard, dept, new HashMap<>(), dept.getRiskFundType(), CommonConstants.TWO_STRING);
if (failed != null) return failed;
}
}
}
if (Common.isNotNull(dept.getRiskServerItem()) && dept.getRiskServerItem().contains(CommonConstants.FOUR_STRING)) {
// 风险金
if (CommonConstants.ZERO_STRING.equals(dept.getRiskFundTag())) {
// 金额-人数
if (CommonConstants.TWO_STRING.equals(dept.getRiskFundType())) {
// 收入相关
return null;
}
/**
* @Description: 获取收入信息
* @Author: hgw
* @Date: 2022/9/6 10:39
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private R<String> getIncomeDetailMap(TSalaryStandard tSalaryStandard, TSettleDomainSelectVo dept, List<String> idCardList, Map<String, Integer> detailMap) {
TIncomeDetail detail = new TIncomeDetail();
detail.setPayMonth(tSalaryStandard.getSalaryMonth());
detail.setIdCardList(idCardList);
detail.setDeptId(dept.getId());
R<TIncomeDetailReturnVo> detailR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincomedetail/inner/getTIncomeDetailList", detail
, TIncomeDetailReturnVo.class, SecurityConstants.FROM_IN);
Map<String, Integer> detailMap = new HashMap<>();
Integer value;
if (detailR != null) {
if (detailR.getData() != null && detailR.getData().getDetailList() != null && !detailR.getData().getDetailList().isEmpty()) {
TIncomeDetailReturnVo vo = detailR.getData();
List<TIncomeDetail> detailList = vo.getDetailList();
for (TIncomeDetail incomeDetail : detailList) {
value = detailMap.get(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getDeptId() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType());
value = detailMap.get(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + incomeDetail.getSourceType());
if (Common.isEmpty(value)) {
value = CommonConstants.ZERO_INT;
}
......@@ -324,22 +322,13 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
value--;
}
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getDeptId() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType(), value);
+ incomeDetail.getFeeType() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getSourceType(), value);
}
}
} else {
return R.failed("获取收入明细的详情出错,请联系管理员!");
}
// 保存明细
R<String> failed = saveIncomeDetail(id, tSalaryStandard, dept, detailMap, dept.getRiskFundType(), CommonConstants.TWO_STRING);
if (failed != null) return failed;
} else {
// 保存明细
R<String> failed = saveIncomeDetail(id, tSalaryStandard, dept, new HashMap<>(), dept.getRiskFundType(), CommonConstants.TWO_STRING);
if (failed != null) return failed;
}
}
}
return null;
}
......@@ -351,12 +340,10 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
* @Date: 2022/9/2 17:25
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private R<String> saveIncomeDetail(String id, TSalaryStandard tSalaryStandard, TSettleDomainSelectVo dept
, Map<String, Integer> detailMap, String feeType, String isManage) {
private R<String> saveIncomeDetail(List<TSalaryAccount> salaryAccountList, TSalaryStandard tSalaryStandard
, TSettleDomainSelectVo dept, Map<String, Integer> detailMap, String feeType, String isManage) {
TIncomeDetail detail;
Integer value;
List<TSalaryAccount> salaryAccountList = salaryAccountService.getListByIncome(id);
if (salaryAccountList != null && !salaryAccountList.isEmpty()) {
BigDecimal money;
for (TSalaryAccount account : salaryAccountList) {
value = detailMap.get(account.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
......@@ -398,7 +385,6 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
}
}
}
}
return null;
}
......
......@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.social.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -30,6 +31,7 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 收入明细表-全部明细
......@@ -194,4 +196,7 @@ public class TIncomeDetail {
@ExcelProperty("管理费风险金的结算方式:1预估2实缴")
private String mrSettleType;
// 查询时框定范围使用
@TableField(exist = false)
private List<String> idCardList;
}
......@@ -17,7 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
......@@ -32,7 +32,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpIncomeUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParam;
import com.yifu.cloud.plus.v1.yifu.social.entity.TAgentConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TIncomeMapper;
......@@ -97,10 +96,10 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
response.setCharacterEncoding(CommonConstants.UTF8);
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, IncomeExportVo.class).build();
ExcelWriter excelWriter = EasyExcelFactory.write(out, IncomeExportVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; ) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
......@@ -112,17 +111,16 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
}
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("收入明细表" + index).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet("收入明细表" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)) {
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("收入明细表" + index).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet("收入明细表" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
......@@ -165,7 +163,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, TIncomeVo.class, new ReadListener<TIncomeVo>() {
EasyExcelFactory.read(inputStream, TIncomeVo.class, new ReadListener<TIncomeVo>() {
/**
* 单次缓存的数据量
*/
......@@ -219,8 +217,6 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
TIncomeVo excel = excelVOList.get(i);
// 数据合法情况 TODO
// 插入
insertExcel(excel);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS));
......@@ -249,10 +245,6 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
|| Common.isEmpty(tIncomeDetail.getPayMonth())) {
return false;
}
tIncomeDetail.setCreateTime(new Date());
tIncomeDetail.setDataCreateMonth(DateUtil.addMonth(0));
tIncomeDetailService.save(tIncomeDetail);
// 获取对应信息的统计表,根据项目配置,判断是否可以加一条统计:
TIncome income = new TIncome();
income.setEmpIdcard(tIncomeDetail.getEmpIdcard());
......@@ -263,6 +255,10 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
detail.setEmpIdcard(tIncomeDetail.getEmpIdcard());
detail.setDeptId(tIncomeDetail.getDeptId());
List<TIncomeDetail> detailList = tIncomeDetailService.getTIncomeDetailList(detail);
tIncomeDetail.setCreateTime(new Date());
tIncomeDetail.setDataCreateMonth(DateUtil.addMonth(0));
tIncomeDetailService.save(tIncomeDetail);
// 不存在,直接新增
if (incomeList == null || incomeList.isEmpty()) {
return this.saveIncome(tIncomeDetail);
......@@ -393,47 +389,95 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
// 商险Map
Map<String, Integer> insureMap = new HashMap<>();
Integer nums;
Integer insureNums;
for (TIncomeDetail detail : detailList) {
nums = numMap.get(detail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + detail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + detail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + detail.getRedData());
+ CommonConstants.DOWN_LINE_STRING + detail.getFeeType());
if (Common.isEmpty(nums)) {
nums = CommonConstants.ONE_INT;
nums = CommonConstants.ZERO_INT;
}
if (CommonConstants.ONE_STRING.equals(detail.getRedData())) {
nums--;
} else {
nums++;
}
numMap.put(detail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + detail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + detail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + detail.getRedData(), nums);
+ CommonConstants.DOWN_LINE_STRING + detail.getFeeType(), nums);
}
for (TIncome income : incomeList) {
nums = incomeMap.get(income.getPayMonth() + CommonConstants.DOWN_LINE_STRING + income.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + income.getRedData());
nums = incomeMap.get(income.getPayMonth() + CommonConstants.DOWN_LINE_STRING + income.getFeeType());
if (Common.isEmpty(nums)) {
nums = CommonConstants.ONE_INT;
nums = CommonConstants.ZERO_INT;
}
if (CommonConstants.ONE_STRING.equals(income.getRedData())) {
nums--;
} else {
nums++;
}
incomeMap.put(income.getPayMonth() + CommonConstants.DOWN_LINE_STRING + income.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + income.getRedData(), nums);
insureMap.put(income.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + income.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + income.getRedData(), CommonConstants.ZERO_INT);
incomeMap.put(income.getPayMonth() + CommonConstants.DOWN_LINE_STRING + income.getFeeType(), nums);
insureNums = insureMap.get(income.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + income.getFeeType());
if (Common.isEmpty(insureNums)) {
insureNums = CommonConstants.ZERO_INT;
}
if (CommonConstants.ONE_STRING.equals(income.getRedData())) {
insureNums--;
} else {
insureNums++;
}
insureMap.put(income.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + income.getFeeType(), insureNums);
}
// 金额人数、人次,需要判重
// 社保、公积金(收入来源:1社保2公积金3商险4薪资)
if (CommonConstants.ONE_STRING.equals(tIncomeDetail.getSourceType())
|| CommonConstants.TWO_STRING.equals(tIncomeDetail.getSourceType())) {
if (incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData()) == null) {
if (CommonConstants.ZERO_STRING.equals(tIncomeDetail.getRedData())) {
if (incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) == null
|| incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) <= CommonConstants.ZERO_INT) {
return this.saveIncome(tIncomeDetail);
}
} else {
Integer myNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer socialNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.ONE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer fundNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.TWO_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer insureNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.THREE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer salaryNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.FOUR_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
// 红冲判断:当本类型是最大值,才可以红冲
if (myNum != null && myNum > ifNullToZero(socialNum) && myNum > ifNullToZero(fundNum)
&& myNum > ifNullToZero(insureNum) && myNum > ifNullToZero(salaryNum)) {
return this.saveIncome(tIncomeDetail);
}
}
} else if (CommonConstants.THREE_STRING.equals(tIncomeDetail.getSourceType())) {
// 商险。收费方式:2金额-人数
if (CommonConstants.TWO_STRING.equals(tIncomeDetail.getFeeMode())) {
if (insureMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData()) == null) {
if (CommonConstants.ZERO_STRING.equals(tIncomeDetail.getRedData())) {
if (insureMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) == null
|| insureMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) <= CommonConstants.ZERO_INT) {
return this.saveIncome(tIncomeDetail);
}
} else {
Integer myNum = numMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer socialNum = numMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.ONE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer fundNum = numMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.TWO_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer insureNum = numMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.THREE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer salaryNum = numMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.FOUR_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
// 红冲判断:当本类型是最大值,才可以红冲
if (myNum != null && myNum > ifNullToZero(socialNum) && myNum > ifNullToZero(fundNum)
&& myNum > ifNullToZero(insureNum) && myNum > ifNullToZero(salaryNum)) {
return this.saveIncome(tIncomeDetail);
}
}
} else {
// 各个模式累加逻辑:
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
......@@ -441,8 +485,8 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
} else {
// 薪资。收费方式:2金额-人数
if (CommonConstants.TWO_STRING.equals(tIncomeDetail.getFeeMode())) {
if (incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData()) == null) {
if (incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) == null
|| incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) <= CommonConstants.ZERO_INT) {
return this.saveIncome(tIncomeDetail);
}
} else {
......@@ -455,6 +499,13 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return true;
}
private int ifNullToZero(Integer num) {
if (num == null) {
return CommonConstants.ZERO_INT;
}
return num;
}
/**
* @Description: 人次:各个模式累加逻辑
* @Author: hgw
......@@ -462,15 +513,35 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
* @return: boolean
**/
private boolean judgeMixModel(TIncomeDetail tIncomeDetail, Map<String, Integer> numMap, Map<String, Integer> incomeMap) {
Integer nums = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData());
Integer maxNum = incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData());
String month = tIncomeDetail.getPayMonth();
if (CommonConstants.THREE_STRING.equals(tIncomeDetail.getSourceType())) {
month = tIncomeDetail.getDataCreateMonth();
}
if (CommonConstants.ZERO_STRING.equals(tIncomeDetail.getRedData())) {
Integer nums = numMap.get(month + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer maxNum = incomeMap.get(month + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
// 当明细的次数大于总次数,才可以新增统计
if (Common.isEmpty(maxNum) || nums > maxNum) {
if (Common.isEmpty(maxNum) || nums >= maxNum) {
return this.saveIncome(tIncomeDetail);
}
} else {
Integer myNum = numMap.get(month + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer socialNum = numMap.get(month + CommonConstants.DOWN_LINE_STRING + CommonConstants.ONE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer fundNum = numMap.get(month + CommonConstants.DOWN_LINE_STRING + CommonConstants.TWO_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer insureNum = numMap.get(month + CommonConstants.DOWN_LINE_STRING + CommonConstants.THREE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer salaryNum = numMap.get(month + CommonConstants.DOWN_LINE_STRING + CommonConstants.FOUR_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
// 红冲判断:当本类型是最大值,才可以红冲
if (myNum != null && myNum > ifNullToZero(socialNum) && myNum > ifNullToZero(fundNum)
&& myNum > ifNullToZero(insureNum) && myNum > ifNullToZero(salaryNum)) {
return this.saveIncome(tIncomeDetail);
}
}
return false;
}
......
......@@ -131,6 +131,12 @@
<if test="tIncomeDetail.redData != null and tIncomeDetail.redData.trim() != ''">
AND a.RED_DATA = #{tIncomeDetail.redData}
</if>
<if test="tIncomeDetail.idCardList != null and tIncomeDetail.idCardList.size() > 0">
AND a.EMP_IDCARD in
<foreach item="item" index="index" collection="tIncomeDetail.idCardList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
</sql>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment