Commit 7e57865d authored by hongguangwu's avatar hongguangwu

优化

parent af1d7e1c
......@@ -17,7 +17,6 @@
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
......@@ -25,16 +24,11 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.common.dapr.util.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SysMessageSalaryExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SysMessageSalarySearchVo;
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;
......@@ -44,7 +38,6 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.IncomeExportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeVo;
import lombok.extern.log4j.Log4j2;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -89,7 +82,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
String fileName = "收入明细批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<IncomeExportVo> list = new ArrayList<>();
long count = noPageCountDiy(searchVo,null,Common.getList(searchVo.getIds()),"");
long count = noPageCountDiy(searchVo, null, Common.getList(searchVo.getIds()), "");
ServletOutputStream out = null;
try {
out = response.getOutputStream();
......@@ -104,7 +97,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo,null,Common.getList(searchVo.getIds()),"");
list = noPageDiy(searchVo, null, Common.getList(searchVo.getIds()), "");
if (Common.isNotNull(list)) {
ExcelUtil<IncomeExportVo> util = new ExcelUtil<>(IncomeExportVo.class);
for (IncomeExportVo vo : list) {
......@@ -147,14 +140,14 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
List<String> settleDomainIds,
List<String> ids,
String sql) {
return baseMapper.noPageDiy(searchVo,settleDomainIds,ids,sql);
return baseMapper.noPageDiy(searchVo, settleDomainIds, ids, sql);
}
private int noPageCountDiy(TIncomeSearchVo searchVo,
List<String> settleDomainIds,
List<String> ids,
String sql) {
return baseMapper.noPageCountDiy(searchVo,settleDomainIds,ids,sql);
return baseMapper.noPageCountDiy(searchVo, settleDomainIds, ids, sql);
}
@Override
......@@ -253,12 +246,13 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
tIncomeDetail.setCreateTime(new Date());
tIncomeDetail.setDataCreateMonth(DateUtil.addMonth(0));
tIncomeDetailService.save(tIncomeDetail);
// TODO-获取对应信息的统计表,根据项目配置,判断是否可以加一条统计:
// 获取对应信息的统计表,根据项目配置,判断是否可以加一条统计:
TIncome income = new TIncome();
income.setEmpIdcard(tIncomeDetail.getEmpIdcard());
income.setDeptId(tIncomeDetail.getDeptId());
List<TIncome> incomeList = baseMapper.getTIncomeList(income);
TIncomeDetail detail = new TIncomeDetail();
detail.setEmpIdcard(tIncomeDetail.getEmpIdcard());
detail.setDeptId(tIncomeDetail.getDeptId());
......@@ -290,7 +284,6 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
// 商险Map
Map<String, Integer> insureMap = new HashMap<>();
Integer nums;
Integer maxNum;
for (TIncomeDetail detail : detailList) {
nums = numMap.get(detail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + detail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + detail.getFeeType()
......@@ -318,46 +311,37 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
+ CommonConstants.DOWN_LINE_STRING + income.getRedData(), CommonConstants.ZERO_INT);
}
// 金额人数、人次,需要判重
// 1:预估模式(管理费风险金的结算方式:1预估2实缴)
if (CommonConstants.ONE_STRING.equals(tIncomeDetail.getMrSettleType())) {
// 社保、公积金(收入来源: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()
// 社保、公积金(收入来源: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) {
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) {
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) {
return this.saveIncome(tIncomeDetail);
}
} else {
// 各个模式累加逻辑:
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
}
} 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) {
return this.saveIncome(tIncomeDetail);
}
} else {
// 3金额-人次
// 各个模式累加逻辑:
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
}
// 各个模式累加逻辑:
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
}
} else {
// 实缴
// TODO
// 薪资。收费方式: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) {
return this.saveIncome(tIncomeDetail);
}
} else {
// 3金额-人次
// 各个模式累加逻辑:
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
}
}
}
return true;
}
......@@ -369,15 +353,13 @@ 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;
Integer maxNum;
nums = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
Integer nums = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData());
maxNum = incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
Integer maxNum = incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData());
// 当明细的次数大于总次数,才可以新增统计
if (nums > maxNum) {
if (Common.isEmpty(maxNum) || nums > maxNum) {
return this.saveIncome(tIncomeDetail);
}
return false;
......
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