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;
}
......@@ -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