Commit 71ef381e authored by huyuchen's avatar huyuchen

生成收入接口修改

parent bf195c6c
......@@ -57,6 +57,14 @@ public interface TIncomeService extends IService<TIncome> {
**/
boolean saveDetail(TIncomeDetail tIncomeDetail);
/**
* @Description: 新增收入明细-详情表,同时统计;
* @Author: huyc
* @Date: 2022/9/9 11:42
* @return:
**/
void saveBathDetail(List<TIncomeDetail> tIncomeDetail);
void pushDetail();
}
......@@ -4029,7 +4029,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
//判断是否存在当月的社保或公积金收入数据
//判断是否存在当月的公积金收入数据
Boolean isExist = false;
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setEmpIdcard(library.getEmpIdcard());
......@@ -4047,6 +4047,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem()
......@@ -4067,11 +4068,12 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else {
isSum = 1;
gMoney = BigDecimalUtils.safeMultiply(library.getSumAll(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
if (!isExist) {
if (!isExist || isSum == 1) {
createIncomeInsurance(library, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(), gMoney);
}
......@@ -4093,14 +4095,15 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
BigDecimal money = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else {
isSum = 2;
money = BigDecimalUtils.safeMultiply(library.getSumAll(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
if (!isExist) {
if (!isExist || isSum == 2) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(), money);
}
......
......@@ -2183,22 +2183,17 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
isSaveAndUpdate = true;
}
if ((Common.isNotNull(socialFundInfo.getSocialId())
//社保收入
if (Common.isNotNull(socialFundInfo.getSocialId())
&& CommonConstants.FOUR_STRING.equals(socialFundInfo.getSocialStatus())
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus()))
|| (Common.isNotNull(socialFundInfo.getFundId())
&& CommonConstants.THREE_STRING.equals(socialFundInfo.getFundStatus()))) {
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus())) {
//获取所有的预估数据
List<TForecastLibrary> librarySocialInfoList = null;
librarySocialInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
.and(obj -> obj
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.or()
.in(TForecastLibrary::getProvidentPayMonth, payMonthList))
);
.in(TForecastLibrary::getSocialPayMonth, payMonthList));
if (Common.isNotNull(librarySocialInfoList)) {
for (TForecastLibrary library : librarySocialInfoList) {
......@@ -2207,6 +2202,25 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
}
//公积金收入
if (Common.isNotNull(socialFundInfo.getFundId())
&& CommonConstants.THREE_STRING.equals(socialFundInfo.getFundStatus())) {
//获取所有的预估数据
List<TForecastLibrary> libraryFundInfoList = null;
libraryFundInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
.in(TForecastLibrary::getProvidentPayMonth, payMonthList));
if (Common.isNotNull(libraryFundInfoList)) {
for (TForecastLibrary library : libraryFundInfoList) {
//办理成功生成收入
createIncomeInfo(library);
}
}
}
if (isSaveAndUpdate) {
return R.ok(null, "执行成功!");
} else {
......@@ -2288,6 +2302,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
public void initEkpPushSocialParam(List<TForecastLibrary> unPushInfo) {
List<String> pushList = new ArrayList<>();
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
for (TForecastLibrary library : unPushInfo) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
......@@ -2520,6 +2535,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (map.get(body) > 0) {
int i = map.get(body) + 1;
map.put(body,i);
idMap.put(body,library.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updatePushStatus(pushList);
......@@ -2531,30 +2547,25 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
error.setLinkId(library.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.saveError(error);
tSendEkpErrorService.save(error);
}
break;
}
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(i);
tSendEkpErrorService.saveError(error);
} else {
map.put(body,1);
idMap.put(body,library.getId());
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(1);
tSendEkpErrorService.saveError(error);
}
}
error.setTitle(key);
error.setLinkId(idMap.get(key));
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
//更新推送状态
if (Common.isNotNull(pushList)) {
......@@ -2565,6 +2576,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
public void initEkpPushFundParam(List<TForecastLibrary> unPushInfo) {
List<String> pushList = new ArrayList<>();
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
for (TForecastLibrary library : unPushInfo) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
......@@ -2693,6 +2705,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (map.get(body) > 0) {
int i = map.get(body) + 1;
map.put(body,i);
idMap.put(body,library.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updatePushStatus(pushList);
......@@ -2704,30 +2717,25 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
error.setLinkId(library.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.saveError(error);
tSendEkpErrorService.save(error);
}
break;
}
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(i);
tSendEkpErrorService.saveError(error);
} else {
map.put(body,1);
idMap.put(body,library.getId());
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.TWO_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(1);
tSendEkpErrorService.saveError(error);
}
}
error.setLinkId(idMap.get(key));
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
//更新推送状态
if (Common.isNotNull(pushList)) {
......@@ -2780,6 +2788,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && ((settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
......@@ -2800,11 +2809,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else {
isSum = 1;
gMoney = BigDecimalUtils.safeMultiply(library.getSumAll(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
if (!isExist) {
if (!isExist || isSum == 1) {
createIncomeInsurance(library, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
gMoney, sourceType);
......@@ -2828,14 +2838,15 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
BigDecimal money;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else {
isSum = 2;
money = BigDecimalUtils.safeMultiply(library.getSumAll(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
if (!isExist) {
if (!isExist || isSum == 2) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
money, sourceType);
......
......@@ -275,12 +275,344 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
}
/**
* @Description: 新增收入明细-详情表,同时统计;
* @Author: hgw
* @Date: 2022/8/31 16:34
* @return: boolean
**/
@Override
public void saveBathDetail(List<TIncomeDetail> tIncomeDetailList) {
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
for (TIncomeDetail tIncomeDetail : tIncomeDetailList) {
// 获取对应信息的统计表,根据项目配置,判断是否可以加一条统计:
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());
List<TIncomeDetail> detailList = tIncomeDetailService.getTIncomeDetailList(detail);
// 不存在,直接新增
if (incomeList == null || incomeList.isEmpty()) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
income.setId(CommonConstants.NULL);
tIncomeDetailService.save(tIncomeDetail);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
} else {
// 判断,比例,直接加
if (CommonConstants.ONE_STRING.equals(tIncomeDetail.getFeeMode())) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
tIncomeDetailService.save(tIncomeDetail);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
} else {
Map<String, Integer> numMap = new HashMap<>();
Map<String, Integer> incomeMap = new HashMap<>();
// 商险Map
Map<String, Integer> insureMap = new HashMap<>();
Integer nums;
Integer insureNums;
for (TIncomeDetail detail1 : detailList) {
nums = numMap.get(detail1.getPayMonth() + CommonConstants.DOWN_LINE_STRING + detail1.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + detail1.getFeeType());
if (Common.isEmpty(nums)) {
nums = CommonConstants.ZERO_INT;
}
if (CommonConstants.ONE_STRING.equals(detail1.getRedData())) {
nums--;
} else {
nums++;
}
numMap.put(detail1.getPayMonth() + CommonConstants.DOWN_LINE_STRING + detail1.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + detail1.getFeeType(), nums);
}
for (TIncome income1 : incomeList) {
nums = incomeMap.get(income1.getPayMonth() + CommonConstants.DOWN_LINE_STRING + income1.getFeeType());
if (Common.isEmpty(nums)) {
nums = CommonConstants.ZERO_INT;
}
if (CommonConstants.ONE_STRING.equals(income1.getRedData())) {
nums--;
} else {
nums++;
}
incomeMap.put(income1.getPayMonth() + CommonConstants.DOWN_LINE_STRING + income1.getFeeType(), nums);
insureNums = insureMap.get(income1.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + income1.getFeeType());
if (Common.isEmpty(insureNums)) {
insureNums = CommonConstants.ZERO_INT;
}
if (CommonConstants.ONE_STRING.equals(income1.getRedData())) {
insureNums--;
} else {
insureNums++;
}
insureMap.put(income1.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + income1.getFeeType(), insureNums);
}
// 金额人数、人次,需要判重
// 社保、公积金(收入来源:1社保2公积金3商险4薪资)
if (CommonConstants.ONE_STRING.equals(tIncomeDetail.getSourceType())
|| CommonConstants.TWO_STRING.equals(tIncomeDetail.getSourceType())) {
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) {
this.saveIncome(tIncomeDetail);
}
} else {
// 红冲判断:当本类型是最大值,才可以红冲
if (this.redDateJudge(tIncomeDetail, numMap)) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
tIncomeDetailService.save(tIncomeDetail);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
}
}
} else if (CommonConstants.THREE_STRING.equals(tIncomeDetail.getSourceType())) {
// 商险。收费方式:2金额-人数
if (CommonConstants.TWO_STRING.equals(tIncomeDetail.getFeeMode())) {
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) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
tIncomeDetailService.save(tIncomeDetail);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
}
} else {
if (this.redDateJudge(tIncomeDetail, numMap)) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
tIncomeDetailService.save(tIncomeDetail);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
}
}
} else {
// 各个模式累加逻辑:
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()) == null
|| incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()) <= CommonConstants.ZERO_INT) {
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
tIncomeDetailService.save(tIncomeDetail);
} else {
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
break;
}
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
}
} else {
// 3金额-人次
// 各个模式累加逻辑:
this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
}
}
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(idMap.get(key));
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
}
@Override
public void pushDetail() {
List<TIncome> list = baseMapper.selectList(Wrappers.<TIncome>query().lambda()
.eq(TIncome::getSendStatus, CommonConstants.ZERO_STRING));
String sendBack;
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
//收入更新
List<TIncome> updateList = new ArrayList<>();
for (TIncome income : list) {
......@@ -299,6 +631,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
if (map.get(sendBack) > 0) {
int i = map.get(sendBack) + 1;
map.put(sendBack,i);
idMap.put(sendBack,income.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updateIncomeById(updateList);
......@@ -310,30 +643,25 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
error.setLinkId(income.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.saveError(error);
tSendEkpErrorService.save(error);
}
break;
}
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(income.getId());
error.setTitle(sendBack);
error.setNums(i);
tSendEkpErrorService.saveError(error);
} else {
map.put(sendBack,1);
idMap.put(sendBack,income.getId());
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(income.getId());
error.setTitle(sendBack);
error.setNums(1);
tSendEkpErrorService.saveError(error);
}
}
error.setType(CommonConstants.FIVE_STRING);
error.setLinkId(idMap.get(key));
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
baseMapper.updateIncomeById(updateList);
}
......@@ -687,5 +1015,4 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return true;
}
}
......@@ -2257,6 +2257,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
LocalDateTimeUtils.getDayStart(LocalDateTime.now()))
.isNotNull(TPaymentInfo::getSocialId));
if (Common.isNotNull(sumList)) {
List<TPaymentInfo> updateList = new ArrayList<>();
for (TPaymentInfo paymentInfo: sumList) {
//获取员工当前缴纳月总合计
List<TPaymentInfo> payInfoList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
......@@ -2270,9 +2271,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (sumSocial.compareTo(BigDecimal.ZERO) == CommonConstants.ZERO_INT) {
continue;
}
//生成收入
createIncomeInfo(paymentInfo,CommonConstants.ONE_STRING);
updateList.add(paymentInfo);
}
//生成收入
createIncomeInfo(updateList,CommonConstants.ONE_STRING);
}
}
......@@ -2283,10 +2285,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
LocalDateTimeUtils.getDayStart(LocalDateTime.now()))
.isNotNull(TPaymentInfo::getFundId));
if (Common.isNotNull(sumList)) {
for (TPaymentInfo paymentInfo: sumList) {
//生成公积金收入
createIncomeInfo(paymentInfo,CommonConstants.TWO_STRING);
}
createIncomeInfo(sumList,CommonConstants.TWO_STRING);
}
}
......@@ -2304,6 +2304,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
public void initEkpPushSocialParam(List<TPaymentInfo> unPushInfo) {
List<String> pushList = new ArrayList<>();
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
for (TPaymentInfo library:unPushInfo) {
//获取项目信息
......@@ -2542,6 +2543,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}else {
if (map.get(body) > 0) {
int i = map.get(body) + 1;
idMap.put(body,library.getId());
map.put(body,i);
//单个异常超过十次,保存异常内容
if (i >= 10) {
......@@ -2554,30 +2556,25 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
error.setLinkId(library.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.saveError(error);
tSendEkpErrorService.save(error);
}
break;
}
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(i);
tSendEkpErrorService.saveError(error);
} else {
map.put(body,1);
idMap.put(body,library.getId());
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(1);
tSendEkpErrorService.saveError(error);
}
}
error.setLinkId(idMap.get(key));
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
//更新推送状态
if (Common.isNotNull(pushList)) {
......@@ -2588,6 +2585,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
public void initEkpPushFundParam(List<TPaymentInfo> unPushInfo) {
List<String> pushList = new ArrayList<>();
Map<String,Integer> map = new HashMap<>();
Map<String,String> idMap = new HashMap<>();
for (TPaymentInfo library:unPushInfo) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
......@@ -2718,6 +2716,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (map.get(body) > 0) {
int i = map.get(body) + 1;
map.put(body,i);
idMap.put(body,library.getId());
//单个异常超过十次,保存异常内容
if (i >= 10) {
baseMapper.updatePushStatus(pushList);
......@@ -2729,30 +2728,25 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
error.setLinkId(library.getId());
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.saveError(error);
tSendEkpErrorService.save(error);
}
break;
}
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(i);
tSendEkpErrorService.saveError(error);
} else {
map.put(body,1);
idMap.put(body,library.getId());
}
}
}
for (String key: map.keySet()) {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.THREE_STRING);
error.setLinkId(library.getId());
error.setTitle(body);
error.setNums(1);
tSendEkpErrorService.saveError(error);
}
}
error.setLinkId(idMap.get(key));
error.setTitle(key);
error.setNums(map.get(key));
tSendEkpErrorService.save(error);
}
//更新推送状态
if (Common.isNotNull(pushList)) {
......@@ -2760,7 +2754,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
public void createIncomeInfo(TPaymentInfo paymentInfo,String socialFundFlag) {
public void createIncomeInfo(List<TPaymentInfo> updateList,String socialFundFlag) {
List<TIncomeDetail> detailList = new ArrayList<>();
for (TPaymentInfo paymentInfo : updateList) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
......@@ -2770,8 +2766,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
......@@ -2794,13 +2790,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (Common.isNotNull(exitIncome)) {
BigDecimal sumMoney = BigDecimal.ZERO;
for (TIncomeDetail income : exitIncome) {
sumMoney = BigDecimalUtils.safeAdd(income.getMoney(),sumMoney);
sumMoney = BigDecimalUtils.safeAdd(income.getMoney(), sumMoney);
}
if (sumMoney.compareTo(BigDecimal.ZERO) == CommonConstants.ONE_INT) {
exitFlag = true;
}
}
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && ((settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
......@@ -2813,29 +2810,30 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee(), socialFundFlag);
settleDomain.getManagementFee(), socialFundFlag, detailList);
}
} else {
BigDecimal gMoney = BigDecimal.ZERO;
BigDecimal gMoney;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else {
isSum = 1;
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
} else {
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
}
if (!exitFlag) {
if (!exitFlag || isSum == 1) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
gMoney, socialFundFlag);
gMoney, socialFundFlag, detailList);
}
}
}
......@@ -2849,39 +2847,43 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee(), socialFundFlag);
settleDomain.getRiskFundFee(), socialFundFlag, detailList);
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
BigDecimal money;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else {
isSum = 2;
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
money = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
} else {
money = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
}
if (!exitFlag) {
if (!exitFlag || isSum == 2) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
money, socialFundFlag);
money, socialFundFlag, detailList);
}
}
}
}
}
}
incomeService.saveBathDetail(detailList);
}
public void createIncomeInsurance(TPaymentInfo library, TSettleDomain settleDomain, String feeType,
String charges, String feeMode, BigDecimal money,String sourceType) {
String charges, String feeMode, BigDecimal money,String sourceType,
List<TIncomeDetail> detailList) {
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
......@@ -2910,7 +2912,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setId(CommonConstants.NULL);
detail.setRedData(CommonConstants.ZERO_STRING);
incomeService.saveDetail(detail);
detailList.add(detail);
}
public String dateStringInsert(String month) {
......
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