Commit 7a7ecfa0 authored by hongguangwu's avatar hongguangwu

收入优化

parent 08cbd5ea
...@@ -248,73 +248,71 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe ...@@ -248,73 +248,71 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
} else { } else {
return R.failed("获取项目信息失败,请联管理员!"); 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())) { if (CommonConstants.TWO_STRING.equals(dept.getManagementType())) {
// 收入相关 // 保存明细
TIncomeDetail detail = new TIncomeDetail(); R<String> failed = saveIncomeDetail(salaryAccountList, tSalaryStandard, dept, detailMap, dept.getManagementType(), CommonConstants.ONE_STRING);
detail.setPayMonth(tSalaryStandard.getSalaryMonth()); if (failed != null) return failed;
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++;
} else { } else {
value--; // 保存明细
} R<String> failed = saveIncomeDetail(salaryAccountList, tSalaryStandard, dept, new HashMap<>(), dept.getManagementType(), CommonConstants.ONE_STRING);
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING if (failed != null) return failed;
+ incomeDetail.getFeeType() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getSourceType(), value);
}
} }
} 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; if (failed != null) return failed;
} else { } 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 (failed != null) return failed;
} }
} }
} }
if (Common.isNotNull(dept.getRiskServerItem()) && dept.getRiskServerItem().contains(CommonConstants.FOUR_STRING)) { return null;
// 风险金 }
if (CommonConstants.ZERO_STRING.equals(dept.getRiskFundTag())) {
// 金额-人数 /**
if (CommonConstants.TWO_STRING.equals(dept.getRiskFundType())) { * @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(); TIncomeDetail detail = new TIncomeDetail();
detail.setPayMonth(tSalaryStandard.getSalaryMonth()); detail.setPayMonth(tSalaryStandard.getSalaryMonth());
detail.setIdCardList(idCardList);
detail.setDeptId(dept.getId());
R<TIncomeDetailReturnVo> detailR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId() R<TIncomeDetailReturnVo> detailR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincomedetail/inner/getTIncomeDetailList", detail , "/tincomedetail/inner/getTIncomeDetailList", detail
, TIncomeDetailReturnVo.class, SecurityConstants.FROM_IN); , TIncomeDetailReturnVo.class, SecurityConstants.FROM_IN);
Map<String, Integer> detailMap = new HashMap<>();
Integer value; Integer value;
if (detailR != null) { if (detailR != null) {
if (detailR.getData() != null && detailR.getData().getDetailList() != null && !detailR.getData().getDetailList().isEmpty()) { if (detailR.getData() != null && detailR.getData().getDetailList() != null && !detailR.getData().getDetailList().isEmpty()) {
TIncomeDetailReturnVo vo = detailR.getData(); TIncomeDetailReturnVo vo = detailR.getData();
List<TIncomeDetail> detailList = vo.getDetailList(); List<TIncomeDetail> detailList = vo.getDetailList();
for (TIncomeDetail incomeDetail : detailList) { for (TIncomeDetail incomeDetail : detailList) {
value = detailMap.get(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING value = detailMap.get(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType()
+ incomeDetail.getDeptId() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType()); + CommonConstants.DOWN_LINE_STRING + incomeDetail.getSourceType());
if (Common.isEmpty(value)) { if (Common.isEmpty(value)) {
value = CommonConstants.ZERO_INT; value = CommonConstants.ZERO_INT;
} }
...@@ -324,22 +322,13 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe ...@@ -324,22 +322,13 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
value--; value--;
} }
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING 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 { } else {
return R.failed("获取收入明细的详情出错,请联系管理员!"); 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; return null;
} }
...@@ -351,12 +340,10 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe ...@@ -351,12 +340,10 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
* @Date: 2022/9/2 17:25 * @Date: 2022/9/2 17:25
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
private R<String> saveIncomeDetail(String id, TSalaryStandard tSalaryStandard, TSettleDomainSelectVo dept private R<String> saveIncomeDetail(List<TSalaryAccount> salaryAccountList, TSalaryStandard tSalaryStandard
, Map<String, Integer> detailMap, String feeType, String isManage) { , TSettleDomainSelectVo dept, Map<String, Integer> detailMap, String feeType, String isManage) {
TIncomeDetail detail; TIncomeDetail detail;
Integer value; Integer value;
List<TSalaryAccount> salaryAccountList = salaryAccountService.getListByIncome(id);
if (salaryAccountList != null && !salaryAccountList.isEmpty()) {
BigDecimal money; BigDecimal money;
for (TSalaryAccount account : salaryAccountList) { for (TSalaryAccount account : salaryAccountList) {
value = detailMap.get(account.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING value = detailMap.get(account.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
...@@ -398,7 +385,6 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe ...@@ -398,7 +385,6 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
} }
} }
} }
}
return null; return null;
} }
......
...@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.social.entity; ...@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.social.entity;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
...@@ -30,6 +31,7 @@ import org.hibernate.validator.constraints.Length; ...@@ -30,6 +31,7 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 收入明细表-全部明细 * 收入明细表-全部明细
...@@ -194,4 +196,7 @@ public class TIncomeDetail { ...@@ -194,4 +196,7 @@ public class TIncomeDetail {
@ExcelProperty("管理费风险金的结算方式:1预估2实缴") @ExcelProperty("管理费风险金的结算方式:1预估2实缴")
private String mrSettleType; private String mrSettleType;
// 查询时框定范围使用
@TableField(exist = false)
private List<String> idCardList;
} }
...@@ -131,6 +131,12 @@ ...@@ -131,6 +131,12 @@
<if test="tIncomeDetail.redData != null and tIncomeDetail.redData.trim() != ''"> <if test="tIncomeDetail.redData != null and tIncomeDetail.redData.trim() != ''">
AND a.RED_DATA = #{tIncomeDetail.redData} AND a.RED_DATA = #{tIncomeDetail.redData}
</if> </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> </if>
</sql> </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