Commit 7434fe68 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents ccc5651d 8cf9ae89
......@@ -7,8 +7,10 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties;
import com.yifu.cloud.plus.v1.yifu.salary.vo.HaveSalaryNoSocialSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.HaveSalaryNoSocialVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.UpdateSocialFoundVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeDetailReturnVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -71,7 +73,7 @@ public class SocialDaprUtils {
/**
* @Author huyc
* @Description 更新缴费库
* @Description 更新社保公积金明细
* @Date 2022/8/15
* @Param
* @return
......@@ -82,13 +84,17 @@ public class SocialDaprUtils {
/**
* @Author huyc
* @Description 生成收入数据
* @Description 查询人员收入数据
* @Date 2022/9/2
* @Param
* @return
**/
public void createTIncomeDetail(TIncomeDetail infoVo) {
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincomedetail/inner/createTIncomeDetail", JSON.toJSONString(infoVo), TIncomeDetail.class, SecurityConstants.FROM_IN);
public R<TIncomeDetailReturnVo> getTIncomeDetailList(TIncomeDetail infoVo) {
R<TIncomeDetailReturnVo> listVo = HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincomedetail/inner/getTIncomeDetailList", JSON.toJSONString(infoVo), TIncomeDetail.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(listVo)){
return R.failed("查询人员收入数据失败!");
}
return listVo;
}
/**
......@@ -98,11 +104,33 @@ public class SocialDaprUtils {
* @Param
* @return
**/
public R<TIncomeDetailReturnVo> getTIncomeDetailList(TIncomeDetail infoVo) {
R<TIncomeDetailReturnVo> listVo = HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincomedetail/inner/getTIncomeDetailList", JSON.toJSONString(infoVo), TIncomeDetail.class, SecurityConstants.FROM_IN);
public R<Boolean> createTIncomeDetail(TIncomeDetail infoVo) {
return HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincome/inner/saveDetail", JSON.toJSONString(infoVo), Boolean.class, SecurityConstants.FROM_IN);
}
/**
* @Author huyc
* @Description 查询人员缴费库数据
* @Date 2022/9/2
* @Param
* @return
**/
public R<TPaymentVo> getPaymentSocialAndFound(TPaymentInfo infoVo) {
R<TPaymentVo> listVo = HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincomedetail/inner/getPaymentSocialAndFound", JSON.toJSONString(infoVo), TPaymentInfo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(listVo)){
return R.failed("查询人员收入数据失败!");
return R.failed("查询人员缴费库数据失败!");
}
return listVo;
}
/**
* @Author huyc
* @Description 通过收入id删除收入数据
* @Date 2022/9/2
* @Param
* @return
**/
public void deleteById(TIncomeDetail infoVo) {
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincomedetail/inner/deleteById", JSON.toJSONString(infoVo), TIncomeDetail.class, SecurityConstants.FROM_IN);
}
}
......@@ -20,13 +20,17 @@ public class EkpIncomeProperties {
String url;
String fdModelId;
String fdModelIdManage;
String fdFlowId;
String fdFlowIdManage;
String fdModelIdRisk;
String fdFlowIdRisk;
String docStatus;
String LoginName;
String loginName;
String docSubject;
......
package com.yifu.cloud.plus.v1.yifu.ekp.util;
import cn.hutool.json.JSONObject;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.config.EkpIncomeProperties;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParam;
......@@ -26,7 +27,15 @@ public class EkpIncomeUtil {
@Autowired
private EkpIncomeProperties ekpProperties;
public String sendToEKP(EkpIncomeParam param) {
/**
* @param param 内容传参
* @param type 1:管理费2:风险金
* @Description:
* @Author: hgw
* @Date: 2022/9/5 16:12
* @return: java.lang.String
**/
public String sendToEKP(EkpIncomeParam param, String type) {
log.info("推送EKP开始--收入明细数据");
RestTemplate yourRestTemplate = new RestTemplate();
try {
......@@ -39,8 +48,13 @@ public class EkpIncomeUtil {
wholeForm.add("docSubject", ekpProperties.getDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpProperties.getDocStatus());
wholeForm.add("fdModelId", ekpProperties.getFdModelId());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowId());
if (CommonConstants.ONE_STRING.equals(type)) {
wholeForm.add("fdModelId", ekpProperties.getFdModelIdManage());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowIdManage());
} else {
wholeForm.add("fdModelId", ekpProperties.getFdModelIdRisk());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowIdRisk());
}
wholeForm.add("formValues", formValues);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
......
......@@ -12,241 +12,72 @@ import java.io.Serializable;
*/
@Data
public class EkpIncomeParam implements Serializable {
/**
* 项目编码
**/
private String fd_3adfedf98ccba2;
private String fd_3adfef5e5b9d34;
/**
* 项目名称
**/
private String fd_3adfedf9d2bf1c;
private String fd_3adfef5eb6691c;
/**
* 单号
**/
private String fd_3adfedfa4410aa;
private String fd_3adfef7f5d2b52;
/**
* 客户编码
**/
private String fd_3adfedfacd65d6;
private String fd_3adfef80202ab2;
/**
* 客户名称
**/
private String fd_3adfedfb174068;
/**
* 姓名
**/
private String fd_3adfedfb5a68a2;
private String fd_3adfef7fc1c886;
/**
* 身份证号
* 类型:单选(人,人次,比例,固定值,总额)
**/
private String fd_3adfedfb8f76d4;
private String fd_3adda3037e3bda;
/**
* 手机号
* 产生来源:单选(社保,工资,商险)
**/
private String fd_3adfedfbd23ab8;
private String fd_3adda320daef5a;
/**
* 银行卡号
* 姓名
**/
private String fd_3adfedfcb17f1e;
private String fd_3adfef948da848;
/**
* 开户行
* 身份证号
**/
private String fd_3adfedfc453cc4;
private String fd_3adfef94dcdbb4;
/**
* 工资月份
* 生成月份
**/
private String fd_3adfee063acff0;
private String fd_3ae0c3032cffc8;
/**
* 结算月份
**/
private String fd_3adfee0690737c;
/**
* 是否薪资扣税
**/
private String fd_3adfee01668666;
/**
* 社保优先级
**/
private String fd_3adfedfed8bb28;
/**
* 公积金优先级
**/
private String fd_3adfedff3a7430;
/**
* 是否自有员工
**/
private String fd_3adfee0009d070;
/**
* 年终奖扣税方案
**/
private String fd_3adfee01dea2fa;
/**
* 应发工资
**/
private String fd_3adfee12cb8840;
/**
* 个人代扣
**/
private String fd_3adfee1374ed7a;
/**
* 单位社保
**/
private String fd_3adfee1e2b2f78;
private String fd_3ae0c3044e5958;
/**
* 个人社保
* 管理费、风险金金额
**/
private String fd_3adfee1e88723e;
/**
* 单位公积金
**/
private String fd_3adfee1ee24680;
/**
* 个人公积金
**/
private String fd_3adfee1f32fa24;
/**
* 个税
**/
private String fd_3adfee1f901c46;
/**
* 企业年金单位
**/
private String fd_3adfee1ff1ca6a;
/**
* 企业年金个人
**/
private String fd_3adfee203f86b2;
/**
* 实发合计
**/
private String fd_3adfee20fe5ba4;
private String fd_3adfef963bae28;
/**
* 应收
**/
private String fd_3adfee21802434;
private String fd_3adfefa3daae72;
/**
* 收入结算状态
* 结算状态
**/
private String fd_3adfee4ba5ad36;
private String fd_3adfefaaa3bbd0;
/**
* 收款状态
**/
private String fd_3adfee4c0c59ee;
private String fd_3adfefaaef583e;
/**
* 收入结算单号
* 结算单号
**/
private String fd_3adfee5dd14866;
private String fd_3aead7204bb594;
/**
* 收款单号
**/
private String fd_3adfee5e3d1638;
/**
* 代扣费用应支出
**/
private String fd_3adfeeb34ea0ea;
/**
* 代扣费用结算状态
**/
private String fd_3adfeededfb5a6;
/**
* 代扣费用付款状态
**/
private String fd_3adfeed3a20598;
/**
* 代扣费用结算单号
**/
private String fd_3aea30866d0c30;
/**
* 代扣费用付款单号
**/
private String fd_3aea309696d32e;
/**
* 个税应支出
**/
private String fd_3adfeec6db8766;
/**
* 个税结算状态
**/
private String fd_3adfeef8ef38fc;
/**
* 个税付款状态
**/
private String fd_3adfeedd08222c;
/**
* 个税支出结算单号
**/
private String fd_3aeadede4cea84;
/**
* 个税支出付款单号
**/
private String fd_3aeadee1cf1266;
/**
* 实发合计应支出
**/
private String fd_3adfeec730ec44;
/**
* 工资实发结算状态
**/
private String fd_3adfeef9440ab2;
/**
* 实发合计付款状态
**/
private String fd_3adfeedd5f3cb2;
/**
* 实发结算单号
**/
private String fd_3aeadf17522642;
/**
* 实发付款单号
**/
private String fd_3aeadf17b7d03a;
/**
* 企业年金单位应支出
**/
private String fd_3adfeec782070a;
/**
* 企业年金单位应结算状态
**/
private String fd_3adfeef9b9fb3e;
/**
* 企业年金单位付款状态
**/
private String fd_3adfeeddacf6d4;
/**
* 年金单位结算单号
**/
private String fd_3aeadf182ef6a2;
/**
* 年金单位付款单号
**/
private String fd_3aeadf1892fdb2;
/**
* 企业年金个人应支出
**/
private String fd_3adfeec7ccdd1c;
/**
* 企业年金个人结算状态
**/
private String fd_3adfeefa1eba32;
/**
* 企业年金个人付款状态
**/
private String fd_3adfeede08d430;
/**
* 年金个人结算单号
**/
private String fd_3aeadf191c62a0;
/**
* 年金个人付款单号
**/
private String fd_3aeadf1992544c;
/**
* 暂停发
**/
private String fd_3af9d49d165e90;
/**
* 税务主体
**/
private String fd_3afab1895feea2;
private String fd_3aeae59b70fe5a;
}
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.ekp.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.Map;
/**
* @author licancan
......@@ -19,7 +20,7 @@ public class EkpOrderReplyParam implements Serializable {
/**
* 回复人 (人员账号)
**/
private String fd_3ac904badcaa06;
private Map<String,Object> fd_3ac904badcaa06;
/**
* 回复时间
**/
......
......@@ -2,5 +2,6 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.ekp.util.EkpOrderUtil,\
com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil,\
com.yifu.cloud.plus.v1.yifu.ekp.util.EkpSalaryUtil,\
com.yifu.cloud.plus.v1.yifu.ekp.util.EkpIncomeUtil,\
com.yifu.cloud.plus.v1.yifu.ekp.util.EkpSocialUtil,\
com.yifu.cloud.plus.v1.yifu.ekp.util.EkpFundUtil
\ No newline at end of file
ekp.url=http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel
ekp.fdModelId=181d7633ff8bc797276d0d3a54e80ad6
ekp.fdFlowId=182b40249c1bc940d7226b941c7a4183
ekp.docStatus=20
ekp.LoginName=admin
ekp.docSubject=\u6536\u5165\u660E\u7EC6\u6570\u636E\u63A5\u53E3
income.url=http://119.96.227.251.8080/api/sys-modeling/appModelRestService/addModel
income.fdModelIdManage=181d76db26e419a88dba97b0c406689e
income.fdFlowIdManage=182d3b6e522b2690119e70d4ff082136
income.fdModelIdRisk=181d76db26e419a88dba97b0c406689e
income.fdFlowIdRisk=182d3b6e522b2690119e70d4ff082136
income.docStatus=20
income.loginName=admin
income.docSubject=\u6536\u5165\u660E\u7EC6\u6570\u636E\u63A5\u53E3
......@@ -28,7 +28,9 @@ public class PersonAttributesMapper implements AttributesMapper<PersonVo> {
if (null != attributes.get("ou")) {
personVo.setDeptName((String) attributes.get("ou").get());
}
personVo.setPassword((String) attributes.get("uid").get());
if (null != attributes.get("userPassword")) {
personVo.setPassword((String) attributes.get("userPassword").get());
}
return personVo;
}
}
......@@ -158,7 +158,7 @@ public class TInsuranceEkp implements Serializable {
/**
* EKP推送类型
*/
@Schema(description = "1推送预估费用,2推送实缴费用,3变更结算月,4推送作废信息,5推送红冲信息,6投保退回红冲,7变更保单保费")
@Schema(description = "推送类型(1推送预估费用,2推送实缴费用,3变更结算信息,4推送作废信息,5推送预估红冲信息,6推送实缴红冲信息)")
private Integer pushType;
private static final long serialVersionUID = 1L;
......
......@@ -168,7 +168,7 @@ public class EkpInteractiveParam implements Serializable {
/**
* EKP推送类型
*/
@Schema(description = "1推送预估费用,2推送实缴费用,3变更结算月,4推送作废信息,5推送红冲信息,6投保退回红冲,7变更保单保费")
@Schema(description = "1推送预估费用,2推送实缴费用,3变更结算月,4推送作废信息,5推送预估红冲信息,6投保退回红冲,7变更保单保费,8推送实缴红冲信息")
private Integer pushType;
/**
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
......@@ -179,10 +181,16 @@ public class InsuranceDetailVO implements Serializable {
private Integer reduceHandleStatus;
/**
* 结算办理状态 1待结算 2结算中 3已结算
* 预估结算办理状态 1待结算 2结算中 3已结算
*/
@Schema(description = "结算办理状态 1待结算 2结算中 3已结算")
private Integer settleHandleStatus;
@Schema(description = "预估结算办理状态 1待结算 2结算中 3已结算")
private String estimateSettleStatus;
/**
* 实缴结算办理状态 1待结算 2结算中 3已结算
*/
@Schema(description = "实缴结算办理状态 1待结算 2结算中 3已结算")
private String actualSettleStatus;
/**
* 是否出险 0未出险 1已出险
......@@ -342,4 +350,11 @@ public class InsuranceDetailVO implements Serializable {
*/
@Schema(description = "退保结算状态 :预留字段,暂时都是空(减员类型专用)")
private String surrenderSettleStatus;
/**
* 默认结算信息id
*/
@Schema(description = "默认结算信息id")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String defaultSettleId;
}
......@@ -7,18 +7,17 @@ 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.google.common.collect.Sets;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ProjectSetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.SetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.IdCardUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.SocialDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil;
......@@ -28,11 +27,15 @@ import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceDetail
import com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.EkpSettleService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.*;
import com.yifu.cloud.plus.v1.yifu.insurances.util.*;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BigDecimalUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeDetailReturnVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -88,10 +91,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Resource
private EkpSettleService ekpSettleService;
@Resource
private TInsuranceSettleCancelService tInsuranceSettleCancelService;
@Resource
private SocialDaprUtils socialDaprUtils;
/***********************商险办理********************************/
......@@ -181,7 +185,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public IPage<InsuranceListVO> getInsuranceListPage(Page<InsuranceListVO> page, InsuranceListParam param) {
//todo 根据登录人获取数据权限
YifuUser user = SecurityUtils.getUser();
List<String> deptNoList = getDeptNoList(user);
IPage<InsuranceListVO> insuranceList = new Page<>();
......@@ -210,7 +213,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public List<InsuranceListVO> getInsuranceList(InsuranceListParam param) {
//todo 根据登录人获取数据权限
YifuUser user = SecurityUtils.getUser();
List<String> deptList = getDeptNoList(user);
List<InsuranceListVO> insuranceList = new ArrayList<>();
......@@ -239,7 +241,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public IPage<InsuranceListVO> getInsuranceHandleListPage(Page<InsuranceListVO> page, InsuranceListParam param) {
//todo 根据登录人获取数据权限
IPage<InsuranceListVO> iPage = new Page<>();
YifuUser user = SecurityUtils.getUser();
String regionSQL = getRegionSQL(user);
......@@ -766,6 +767,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (null != insuranceDetailVO){
long day = LocalDateUtil.betweenDay(insuranceDetailVO.getPolicyStart().toString(),insuranceDetailVO.getPolicyEnd().toString());
long month = LocalDateUtil.betweenMonth(insuranceDetailVO.getPolicyStart().toString(),insuranceDetailVO.getPolicyEnd().toString());
String defaultSettleId = insuranceDetailVO.getDefaultSettleId();
if(StringUtils.isNotBlank(defaultSettleId)){
SettleVo settleVo = getInsuranceDetailSettleStatus(id, defaultSettleId);
if(!Common.isEmpty(settleVo)){
insuranceDetailVO.setEstimateSettleStatus(settleVo.getEstimateStatus());
insuranceDetailVO.setActualSettleStatus(settleVo.getActualStatus());
}
}
//购买周期
String buyCycle = month + "个月/" + day + "天";
insuranceDetailVO.setBuyCycle(buyCycle);
......@@ -851,7 +860,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public R<List<InsuranceExportListVO>> getInsuranceExportList(InsuranceExportListParam param) {
YifuUser user = SecurityUtils.getUser();
List<InsuranceExportListVO> insuranceExportList = new ArrayList<>();
//todo 根据登录人获取数据权限
String regionSQL = getRegionSQL(user);
param.setRegionSql(regionSQL);
if(StringUtils.isBlank(regionSQL)){
......@@ -882,6 +890,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
ProjectSetInfoVo jsonObject = data.get(record.getDeptNo());
if (null != jsonObject){
record.setProjectName(Optional.ofNullable(jsonObject.getDepartName()).orElse(""));
record.setInvoiceTitle(Optional.ofNullable(jsonObject.getInvoiceTitle()).orElse(""));
}
//购买月数
record.setBuyMonth(LocalDateUtil.betweenMonth(record.getPolicyStart().toString(),record.getPolicyEnd().toString()));
......@@ -1096,6 +1105,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if(StringUtils.isNotBlank(pushResult)){
detail.setDefaultSettleId(null);
}
//已投保退回,收入数据同步处理
updateInsuranceInfo(detail,settle);
}
}
}
......@@ -1274,6 +1285,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
}
//生成收入数据
createInsuranceInfo(detail);
}
//实缴
if(detail.getSettleType() == CommonConstants.ONE_INT){
......@@ -1289,6 +1302,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setIsUse(CommonConstants.ZERO_INT);
detail.setUpdateTime(LocalDateTime.now());
successList.add(detail);
//生成收入数据
createInsuranceInfo(detail);
}
}
}
......@@ -1373,7 +1388,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
);
if (StringUtils.isNotBlank(success.getInvoiceNo())){
detail.setInvoiceNo(success.getInvoiceNo());
//如果发票号不为空,将替换类型的发票号也全部更新
List<TInsuranceReplace> list = tInsuranceReplaceService.list(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getOriginInsuranceDetailId, detail.getId()));
......@@ -1404,15 +1418,38 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
//如果保费不为空
if (StringUtils.isNotBlank(success.getActualPremium())){
//判断推送金额是否一致,不一致才推送ekp
if (detail.getActualPremium() == null || (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) != 0)){
// todo 判断是否推送过ekp,没推送过调新增接口,推送过调更新接口
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
SettleVo settleVo = getInsuranceDetailSettleStatus(detail.getId(), detail.getDefaultSettleId());
if(!Common.isEmpty(settleVo) && InsurancesConstants.SETTLE_ZERO.equals(settleVo.getActualStatus())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
Integer settleType = detail.getSettleType();
String defaultSettleId = detail.getDefaultSettleId();
//如果当前保单为合并结算
if(settleType == CommonConstants.ZERO_INT){
if(StringUtils.isNotBlank(defaultSettleId)){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if(Optional.ofNullable(settle).isPresent()){
//如果当前实缴信息未推送,则新增实缴单推送
if(settle.getIsActualPush() == CommonConstants.ZERO_INT){
//保费存储
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP新增实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
threadPool.execute(() ->{
String s = pushEstimate(detail, CommonConstants.TWO_INT);
//如果推送成功则更改推送状态
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
}
//如果当前实缴信息已推送,且金额与本次不一致,则推送实缴更新
if(settle.getIsActualPush() == CommonConstants.ONE_INT
&& (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) != 0)){
//推送保费更新
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
......@@ -1427,9 +1464,51 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.updateById(settle);
}
});
}else if(settle.getIsActualPush() == CommonConstants.ONE_INT
&& (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) == 0)){
//推送保费更新
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP更新实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
threadPool.execute(() ->{
String s = pushEstimate(detail,CommonConstants.FOUR_INT);
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
}
}
}else {
}
}
//如果当前保单为单独结算
if(settleType == CommonConstants.ONE_INT){
//推送过实缴信息且金额与本次不一致,则推送更新
if(StringUtils.isNotBlank(defaultSettleId) && (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) != 0)){
//推送保费更新
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP更新实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
threadPool.execute(() ->{
String s = pushEstimate(detail,CommonConstants.FOUR_INT);
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
}
//未推送过实缴信息,则推送新增
if(StringUtils.isBlank(defaultSettleId)){
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
......@@ -1455,6 +1534,34 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
String invoiceNo = success.getInvoiceNo();
String policyNo = success.getPolicyNo();
boolean booleanInvoiceNo = StringUtils.isNotBlank(invoiceNo) && !invoiceNo.equals(detail.getInvoiceNo());
boolean booleanPolicyNo = StringUtils.isNotBlank(policyNo) && !policyNo.equals(detail.getPolicyNo());
//如果当前保费为空,且保单号或发票号不一样
if(StringUtils.isBlank(success.getActualPremium()) && (!booleanInvoiceNo || !booleanPolicyNo)){
if(StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if(Optional.ofNullable(settle).isPresent()){
//如果当前实缴信息未推送,则新增实缴单推送
threadPool.execute(() ->{
if(StringUtils.isNotBlank(invoiceNo)){
detail.setInvoiceNo(invoiceNo);
}
if(StringUtils.isNotBlank(policyNo)){
detail.setPolicyNo(policyNo);
}
String s = pushEstimate(detail, CommonConstants.FOUR_INT);
//如果推送成功则更改推送状态
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
}
}
}
//可以改成批量更新
this.updateById(detail);
detailList.add(detail);
......@@ -2615,7 +2722,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
listResult.add(param);
......@@ -2753,22 +2859,72 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
//保单号是否更新
boolean booleanPolicyNo = StringUtils.isNotBlank(param.getPolicyNo()) && !param.getPolicyNo().equals(detail.getPolicyNo());
//发票号是否更新
boolean booleanInvoiceNo = StringUtils.isNotBlank(param.getInvoiceNo()) && !param.getInvoiceNo().equals(detail.getInvoiceNo());
//保费是否更新
boolean booleanActualPremium = StringUtils.isNotBlank(param.getActualPremium()) && detail.getActualPremium().compareTo(new BigDecimal(param.getActualPremium())) != 0;
//如果当前为合并结算
if (CommonConstants.ZERO_INT == detail.getSettleType() && StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
SettleVo settleVo = getInsuranceDetailSettleStatus(detail.getId(), detail.getDefaultSettleId());
if(!Common.isEmpty(settleVo)){
if (InsurancesConstants.SETTLE_ONE.equals(settleVo.getActualStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
listResult.add(param);
continue;
String estimateStatus = settleVo.getEstimateStatus();
String actualStatus = settleVo.getActualStatus();
//保费更新,保单号,发票号不更新
if(booleanActualPremium && !booleanPolicyNo && !booleanInvoiceNo){
if ( InsurancesConstants.SETTLE_TWO.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (InsurancesConstants.SETTLE_ONE.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
listResult.add(param);
continue;
}
}
if (InsurancesConstants.SETTLE_TWO.equals(settleVo.getActualStatus())){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
listResult.add(param);
continue;
//
if(!booleanPolicyNo || !booleanInvoiceNo){
if (InsurancesConstants.SETTLE_TWO.equals(estimateStatus) || InsurancesConstants.SETTLE_TWO.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (InsurancesConstants.SETTLE_ONE.equals(estimateStatus) || InsurancesConstants.SETTLE_ONE.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
listResult.add(param);
continue;
}
}
}
}
}
//如果当前为单独结算,判断实缴有没有结算
if (CommonConstants.ONE_INT == detail.getSettleType() && StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
SettleVo settleVo = getInsuranceDetailSettleStatus(detail.getId(), detail.getDefaultSettleId());
if(!Common.isEmpty(settleVo)){
String actualStatus = settleVo.getActualStatus();
//判断实缴是否结算中
if(booleanActualPremium && !booleanPolicyNo && !booleanInvoiceNo){
if ( InsurancesConstants.SETTLE_TWO.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (InsurancesConstants.SETTLE_ONE.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
listResult.add(param);
continue;
}
}
}
}
}
}
......@@ -2996,7 +3152,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public IPage<InsuredListVo> getInsuredListPage(Page<InsuredListVo> page, InsuredParam param) {
//todo 根据登录人获取其项目权限列表
YifuUser user = SecurityUtils.getUser();
List<String> deptList = getDeptNoList(user);
IPage<InsuredListVo> insuranceList = new Page<>();
......@@ -3033,7 +3188,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public List<InsuredListVo> getInsuredList(InsuredParam param) {
//todo 根据登录人获取其项目权限列表
YifuUser user = SecurityUtils.getUser();
List<String> deptList = getDeptNoList(user);
List<InsuredListVo> insuredList = new ArrayList<>();
......@@ -3072,7 +3226,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public R getInsuranceRefundPageList(Page<InsuranceRefundParam> page, InsuranceRefundParam param) {
//todo 根据登录人获取其项目权限列表
YifuUser user = SecurityUtils.getUser();
List<String> deptList = getDeptNoList(user);
if (CollectionUtils.isEmpty(deptList)){
......@@ -3110,6 +3263,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public List<InsuranceRefundListVo> getInsuranceRefundList(InsuranceRefundParam param) {
YifuUser user = SecurityUtils.getUser();
List<String> deptNoList = getDeptNoList(user);
List<InsuranceRefundListVo> pageList = new ArrayList<>();
if(CollectionUtils.isEmpty(deptNoList)){
return pageList;
}
param.setDeptNoList(deptNoList);
List<InsuranceRefundListVo> insuranceRefundList = this.baseMapper.getInsuranceRefundList(param);
if (CollectionUtils.isNotEmpty(insuranceRefundList)){
......@@ -3183,7 +3340,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public R<List<RefundExportListVo>> getInsuranceRefundHandlingList(RefundExportListParam param){
YifuUser user = SecurityUtils.getUser();
List<RefundExportListVo> refundExportList;
//todo 根据登录人获取数据权限
String regionSQL = getRegionSQL(user);
param.setRegionSql(regionSQL);
//如勾选项不为空,则导出勾选记录;否则导出当前筛选条件下 && 「待减员」的结果集
......@@ -3437,6 +3593,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceDetail byId = getById(ekpInteractiveParam.getDetailId());
BeanCopyUtils.copyProperties(byId,ekpInteractiveParam);
ekpInteractiveParam.setInteractiveType(InsurancesConstants.UPDATE_SETTLE_BILL);
if (byId.getSettleType() == CommonConstants.ZERO_INT){
ekpInteractiveParam.setEstimateStatus(EkpConstants.HAVE);
}else{
ekpInteractiveParam.setEstimateStatus(EkpConstants.NOTHING);
}
String body = eKPInsuranceUtil.sendToEkp(ekpInteractiveParam);
if (!StringUtils.isBlank(body)){
TInsuranceOperate insuranceOperate = new TInsuranceOperate();
......@@ -3559,6 +3720,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更后为单独结算
if (CommonConstants.ONE_INT == newSettleType) {
//推送新的结算信息至EKP
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.NOTHING);
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
......@@ -3567,6 +3729,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
String pushResult = eKPInsuranceUtil.sendToEkp(interactiveParam);
if (StringUtils.isNotBlank(pushResult)){
newInsuranceSettle.setActualPushTime(LocalDateTime.now());
......@@ -3581,6 +3744,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更后为合并结算
if (CommonConstants.ZERO_INT == newSettleType) {
//先推送预估,再推送实际
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3622,6 +3786,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更后为单独结算
if (CommonConstants.ONE_INT == newSettleType) {
//推送新的结算信息至EKP
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.NOTHING);
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
......@@ -3644,6 +3809,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更后为合并结算
if (CommonConstants.ZERO_INT == newSettleType) {
//先推送预估,再推送实际
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3704,6 +3870,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,tInsuranceSettle.getId());
update(updateWrapper);
//推送结算信息至EKP
interactiveParam.setDefaultSettleId(tInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3776,6 +3943,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,new BigDecimal("0.00"));
update(updateWrapper);
//推送新的结算信息至EKP,推实际保费
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.NOTHING);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3800,6 +3968,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
// 推送新的结算信息
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3842,6 +4011,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
String deleteBody = eKPInsuranceUtil.sendToEkp(interactiveParam);
if(StringUtils.isNotBlank(deleteBody)){
//先推送预估,再推送实际
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3882,6 +4052,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//如果预估和实缴均未推送
if(byId.getIsActualPush() == CommonConstants.ZERO_INT && byId.getIsEstimatePush() == CommonConstants.ONE_INT){
//先推送预估,再推送实际
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3944,6 +4115,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
//新增新的结算信息
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
......@@ -3956,6 +4128,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送新的结算信息至EKP
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3981,6 +4154,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}else{
//推送新的结算信息至EKP
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -5146,7 +5320,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public R getDeptListByUser(){
YifuUser user = SecurityUtils.getUser();
//根据当前登录人获取其拥有的项目列表权限
// TODO: 2022/8/5
List<String> deptNoList = getDeptNoList(user);
List<Dept> deptList = new ArrayList<>(16);
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(deptNoList);
......@@ -5298,6 +5471,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @return {@link List< String>}
*/
public List<String> getDeptNoList(YifuUser user){
//todo 根据登录人获取其项目权限列表
List<String> deptList = new ArrayList<>(16);
String id = user.getId();
//周日琴12,徐燕13
......@@ -5336,6 +5510,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @return {@link String}
*/
public String getRegionSQL(YifuUser user){
//todo 根据登录人获取其办理地SQL
String id = user.getId();
String sql ;
//user_id=14, 合肥办理1
......@@ -5501,5 +5676,145 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return Boolean.TRUE;
}
//商险预估
public void createInsuranceInfo(TInsuranceDetail insuranceDetail) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
listVo = archivesDaprUtil.selectSettleDomainSelectVoByNo(insuranceDetail.getDeptNo());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
}
}
}
//判断是否存在当月的商险收入数据
Boolean isExist = false;
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setEmpIdcard(insuranceDetail.getEmpIdcardNo());
incomeDetail.setCreateMonth(DateUtil.getYearAndMonth(insuranceDetail.getHandledTime(),0));
incomeDetail.setDeptNo(insuranceDetail.getDeptNo());
incomeDetail.setSourceType(CommonConstants.THREE_STRING);
R<TIncomeDetailReturnVo> detailList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if(Common.isNotNull(detailList) && detailList.getCode() == CommonConstants.SUCCESS){
isExist = true;
}
//判断是否为按人次收费
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有商险,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem().contains(CommonConstants.THREE_STRING)) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
//预估模式只有按人次和人数收费
if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
isSum = 1;
}
if (!isExist || isSum == 1) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee());
}
}
} else {
BigDecimal gMoney = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
isSum = 2;
} else {
gMoney = BigDecimalUtils.safeMultiply(insuranceDetail.getActualPremium(),settleDomain.getManagementFee());
}
if (!isExist || isSum ==2) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(), gMoney);
}
}
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem().contains(CommonConstants.THREE_STRING)) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType()) &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
isSum = 3;
}
if (!isExist || isSum == 3) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee());
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
money = settleDomain.getRiskFundFee();
isSum = 4;
} else {
money = BigDecimalUtils.safeMultiply(insuranceDetail.getActualPremium(), settleDomain.getRiskFundFee());
}
if (!isExist || isSum == 4) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(), money);
}
}
}
}
}
}
public void createIncomeInsurance(TInsuranceDetail insuranceDetail, TSettleDomain settleDomain, String feeType,
String charges, String feeMode, BigDecimal money) {
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
detail.setDeptName(settleDomain.getDepartName());
detail.setDeptNo(settleDomain.getDepartNo());
detail.setDeptId(settleDomain.getId());
detail.setEmpIdcard(insuranceDetail.getEmpIdcardNo());
detail.setEmpName(insuranceDetail.getEmpName());
detail.setUnitNo(settleDomain.getCustomerNo());
detail.setUnitId(settleDomain.getCustomerId());
detail.setUnitName(settleDomain.getCustomerName());
detail.setDataCreateMonth(DateUtil.addMonth(0));
detail.setSourceId(insuranceDetail.getId());
detail.setSourceType(CommonConstants.THREE_STRING);
detail.setCreateMonth(DateUtil.getYearAndMonth(insuranceDetail.getHandledTime(),0));
detail.setPayMonth(insuranceDetail.getSettleMonth());
detail.setMoney(money);
detail.setFeeType(feeType);
detail.setFeeMode(feeMode);
detail.setCharges(charges);
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setId(CommonConstants.NULL);
socialDaprUtils.createTIncomeDetail(detail);
}
//更新收入信息
public void updateInsuranceInfo(TInsuranceDetail insuranceDetail,TInsuranceSettle settle) {
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(insuranceDetail.getId());
R<TIncomeDetailReturnVo> detailList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailList) && detailList.getCode() == CommonConstants.SUCCESS) {
for (TIncomeDetail detail : detailList.getData().getDetailList()) {
TIncomeDetail detail1 = new TIncomeDetail();
BeanCopyUtils.copyProperties(detail, detail1);
socialDaprUtils.deleteById(detail);
//已推送的数据生成红冲数据
if (settle.getIsEstimatePush() == CommonConstants.ONE_INT ||
settle.getIsActualPush() == CommonConstants.ONE_INT) {
detail1.setMoney(detail1.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1);
}
}
}
}
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
......@@ -61,101 +62,178 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T
List<TInsuranceEkp> successLit = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ekpRefundList)){
for (TInsuranceEkp tInsuranceEkp : ekpRefundList) {
//结算信息
SettleVo settleVo = tInsuranceDetailService.getInsuranceDetailSettleStatus(tInsuranceEkp.getDetailId(), tInsuranceEkp.getDefaultSettleId());
//实缴结算状态
String actualStatus = settleVo.getActualStatus();
//预缴结算状态
String estimateStatus = settleVo.getEstimateStatus();
Integer pushType = tInsuranceEkp.getPushType();
LambdaQueryWrapper<TInsuranceSettle> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId());
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getOne(queryWrapper);
//如果当前需要重发预估保费的数据已发送,则过滤掉执行下一条数据
if(CommonConstants.ONE_INT == pushType && CommonConstants.ONE_INT == insuranceSettle.getIsEstimatePush()){
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
continue;
}
//如果当前需要重发实际保费的数据已发送,则过滤掉执行下一条数据
if(CommonConstants.TWO_INT == pushType && CommonConstants.ONE_INT == insuranceSettle.getIsActualPush()){
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
continue;
}
EkpInteractiveParam ekpParam = new EkpInteractiveParam();
BeanCopyUtils.copyProperties(tInsuranceEkp,ekpParam);
if(actualStatus.equals(InsurancesConstants.SETTLE_ZERO)){
String s = ekpInsuranceUtil.sendToEkp(ekpParam);
//如果发送成功
if (StringUtils.isNotBlank(s)){
//预估则更新预估保费
if(CommonConstants.ONE_INT == pushType){
LambdaUpdateWrapper<TInsuranceSettle> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle :: getIsEstimatePush,CommonConstants.ONE_INT)
.set(TInsuranceSettle :: getEstimatePushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
}
//预估则更新预估保费
if(CommonConstants.TWO_INT == pushType){
LambdaUpdateWrapper<TInsuranceSettle> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle :: getIsActualPush,CommonConstants.ONE_INT)
.set(TInsuranceSettle :: getActualPushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
}
//结算月则变更结算月
if(CommonConstants.THREE_INT == pushType){
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail :: getId,tInsuranceEkp.getDetailId())
.set(TInsuranceDetail :: getSettleMonth,tInsuranceEkp.getSettleMonth())
.set(TInsuranceDetail :: getUpdateTime, LocalDateTime.now());
tInsuranceDetailService.update(updateWrapper);
}
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
successLit.add(tInsuranceEkp);
}else{
break;
TInsuranceDetail byId = tInsuranceDetailService.getById(tInsuranceEkp.getDetailId());
String defaultSettleId = byId.getDefaultSettleId();
if (tInsuranceEkp.getDefaultSettleId().equals(defaultSettleId)){
//ekp结算信息
SettleVo settleVo = tInsuranceDetailService.getInsuranceDetailSettleStatus(tInsuranceEkp.getDetailId(), tInsuranceEkp.getDefaultSettleId());
//商险结算信息
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getById(tInsuranceEkp.getDefaultSettleId());
//预估推送状态
Integer isEstimatePush = insuranceSettle.getIsEstimatePush();
//实缴推送状态
Integer isActualPush = insuranceSettle.getIsActualPush();
//实缴结算状态
String actualStatus = settleVo.getActualStatus();
//预缴结算状态
String estimateStatus = settleVo.getEstimateStatus();
Integer pushType = tInsuranceEkp.getPushType();
//如果当前需要重发预估保费的数据已发送,则过滤掉执行下一条数据
if(CommonConstants.ONE_INT == pushType && CommonConstants.ONE_INT == isEstimatePush){
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
continue;
}
}else{
//如果为作废信息,已结算和结算中发送红冲数据
if(CommonConstants.FOUR_INT == pushType){
//预估保费
BigDecimal estimatePremium = ekpParam.getEstimatePremium();
//实际保费
BigDecimal actualPremium = ekpParam.getActualPremium();
if(!BigDecimalUtils.isNullOrZero(estimatePremium)){
ekpParam.setEstimatePremium(estimatePremium.negate());
}
if(!BigDecimalUtils.isNullOrZero(actualPremium)){
ekpParam.setActualPremium(actualPremium.negate());
//如果当前需要重发实际保费的数据已发送,则过滤掉执行下一条数据
if(CommonConstants.TWO_INT == pushType && CommonConstants.ONE_INT == isActualPush){
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
continue;
}
EkpInteractiveParam ekpParam = new EkpInteractiveParam();
BeanCopyUtils.copyProperties(tInsuranceEkp,ekpParam);
//如果预估未结算
LambdaUpdateWrapper<TInsuranceSettle> updateWrapper = new LambdaUpdateWrapper<>();
String s = null;
if(InsurancesConstants.SETTLE_ZERO.equals(estimateStatus)){
//实缴未结算
if(InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){
//如果是新增预估保费,则推送预估保费新增
if(CommonConstants.ONE_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
updateWrapper.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle :: getIsEstimatePush,CommonConstants.ONE_INT)
.set(TInsuranceSettle :: getEstimatePushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
}
}
//如果是新增实缴保费,则推送实缴保费新增
if(CommonConstants.TWO_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
updateWrapper.eq(TInsuranceSettle::getId, tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle::getIsActualPush, CommonConstants.ONE_INT)
.set(TInsuranceSettle::getActualPushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
}
}
//如果是变更结算信息,则推送变更结算信息
if(CommonConstants.THREE_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
updateWrapper.eq(TInsuranceSettle::getId, tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle::getIsActualPush, CommonConstants.ONE_INT)
.set(TInsuranceSettle::getActualPushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
LambdaUpdateWrapper<TInsuranceDetail> detailLambdaUpdate = new LambdaUpdateWrapper<>();
detailLambdaUpdate.eq(TInsuranceDetail::getId, tInsuranceEkp.getDetailId())
.set(TInsuranceDetail::getSettleMonth, CommonConstants.ONE_INT);
tInsuranceSettleService.update(updateWrapper);
}
}
//如果是作废信息,则推送作废信息
if(CommonConstants.FOUR_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
}
if(CommonConstants.FIVE_INT == pushType || CommonConstants.SIX_INT == pushType){
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
failList.add(tInsuranceEkp);
continue;
}
//成功则更新,不成功则跳出循环
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}
ekpParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
String s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
successLit.add(tInsuranceEkp);
}else{
break;
//实缴结算中,已结算
if(InsurancesConstants.SETTLE_ONE.equals(actualStatus) || InsurancesConstants.SETTLE_TWO.equals(actualStatus)){
//如果是作废,则推送实缴红冲
if(CommonConstants.FOUR_INT == pushType){
BigDecimal actualPremium = ekpParam.getActualPremium();
ekpParam.setActualPremium(actualPremium.negate());
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}
if(CommonConstants.SIX_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}else{
//推送预估新增,实缴新增,变更结算信息,作废,则不进行重发
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
}
}
//如果为红冲数据则正常发送
}else if(CommonConstants.FIVE_INT == pushType || CommonConstants.SIX_INT == pushType){
String s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
successLit.add(tInsuranceEkp);
}else{
//如果实缴未结算
if(InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){
//如果是作废信息,则推送预估红冲信息
if(CommonConstants.FOUR_INT == pushType){
BigDecimal estimatePremium = ekpParam.getEstimatePremium();
ekpParam.setActualPremium(estimatePremium.negate());
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
} else if(CommonConstants.FIVE_INT == pushType){
//如果是预估红冲信息,则推送预估红冲信息
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}else{
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
}
}else{
break;
//如果是实缴红冲信息,则推送实缴红冲信息
if(CommonConstants.SIX_INT == pushType){
BigDecimal actualPremium = ekpParam.getActualPremium();
ekpParam.setActualPremium(actualPremium.negate());
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}else{
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
}
}
}else{
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
failList.add(tInsuranceEkp);
}
}else{
//结算id与当前不一致则不进行重发
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
}
}
updateBatchById(successLit);
updateBatchById(failList);
return R.ok("发送成功");
}else{
......
......@@ -285,7 +285,6 @@
detail.SETTLE_MONTH as settleMonth,
detail.BUY_HANDLE_STATUS as buyHandleStatus,
detail.REDUCE_HANDLE_STATUS as reduceHandleStatus,
tis.SETTLE_HANDLE_STATUS as settleHandleStatus,
detail.IS_USE as isUse,
detail.IS_EFFECT as isEffect,
detail.IS_OVERDUE as isOverdue,
......@@ -301,7 +300,8 @@
detail.CREATE_TIME as createTime,
detail.REMARK as remark,
detail.BILLING_TYPE as billingType,
detail.RATE as rate
detail.DEFAULT_SETTLE_ID as defaultSettleId,
detail.RATE as rate
from t_insurance_detail detail
left join t_insurance_settle tis on detail.DEFAULT_SETTLE_ID = tis.ID
where detail.ID = #{id}
......
......@@ -105,9 +105,9 @@ public class SocialTask {
* @return: void
**/
public void createPaymentInfoIncome() {
log.info("------------定时生成缴费库的收入数据-定时任务开始------------");
log.info("------------定时生成缴费库社保的收入数据-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tpaymentinfo/inner/createPaymentInfoIncome","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时生成缴费库的收入数据-定时任务结束------------");
log.info("------------定时生成缴费库社保的收入数据-定时任务结束------------");
}
/**
......@@ -117,8 +117,20 @@ public class SocialTask {
* @return: void
**/
public void createPaymentFundIncome() {
log.info("------------定时生成缴费库的收入数据-定时任务开始------------");
log.info("------------定时生成缴费库公积金的收入数据-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tpaymentinfo/inner/createPaymentFundIncome","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时生成缴费库的收入数据-定时任务结束------------");
log.info("------------定时生成缴费库公积金的收入数据-定时任务结束------------");
}
/**
* @Description: 定时任务生成统计表数据
* @Author: huyc
* @Date: 2022/8/30
* @return: void
**/
public void pushDetail() {
log.info("------------定时任务生成统计表数据-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincome/inner/pushDetail","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时任务生成统计表数据-定时任务结束------------");
}
}
......@@ -39,9 +39,7 @@ import javax.annotation.Resource;
import java.io.IOException;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.*;
/**
* @author licancan
......@@ -272,7 +270,9 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
//同步推送ekp
EkpOrderReplyParam param = new EkpOrderReplyParam();
param.setFd_3ac904bbaf972a(orderNo);
param.setFd_3ac904badcaa06(user.getUsername());
Map<String,Object> map = new HashMap<>();
map.put("LoginName",user.getUsername());
param.setFd_3ac904badcaa06(map);
param.setFd_3ac904b8590598(reply.getCreateTime().toString());
param.setFd_3ac904c7798e5c(replyContent);
ekpOrderUtil.sendReplyToEKP(param,file);
......
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import lombok.Data;
import java.util.List;
......@@ -12,4 +13,6 @@ import java.util.List;
@Data
public class TPaymentVo {
List<TPaymentBySalaryVo> paymentList;
List<TPaymentInfo> paymentInfoList;
}
......@@ -242,7 +242,7 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
, "/tsettledomain/inner/getSettleDomainVoById", tSalaryStandard.getDeptId()
, TSettleDomainSelectVo.class, SecurityConstants.FROM_IN);
// 结算主体
TSettleDomainSelectVo dept = null;
TSettleDomainSelectVo dept;
if (sdr != null && sdr.getData() != null) {
dept = sdr.getData();
} else {
......@@ -258,7 +258,7 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
TIncomeDetail detail = new TIncomeDetail();
detail.setPayMonth(tSalaryStandard.getSalaryMonth());
R<TIncomeDetailReturnVo> detailR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincomedetail/inner/getTIncomeDetailExist", detail
, "/tincomedetail/inner/getTIncomeDetailList", detail
, TIncomeDetailReturnVo.class, SecurityConstants.FROM_IN);
Map<String, Integer> detailMap = new HashMap<>();
Integer value;
......@@ -267,7 +267,8 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
TIncomeDetailReturnVo vo = detailR.getData();
List<TIncomeDetail> detailList = vo.getDetailList();
for (TIncomeDetail incomeDetail : detailList) {
value = detailMap.get(incomeDetail.getEmpIdcard() + 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;
}
......@@ -276,7 +277,9 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
} else {
value--;
}
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType(), value);
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getFeeType() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getSourceType(), value);
}
}
} else {
......@@ -301,7 +304,7 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
TIncomeDetail detail = new TIncomeDetail();
detail.setPayMonth(tSalaryStandard.getSalaryMonth());
R<TIncomeDetailReturnVo> detailR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincomedetail/inner/getTIncomeDetailExist", detail
, "/tincomedetail/inner/getTIncomeDetailList", detail
, TIncomeDetailReturnVo.class, SecurityConstants.FROM_IN);
Map<String, Integer> detailMap = new HashMap<>();
Integer value;
......@@ -310,7 +313,8 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
TIncomeDetailReturnVo vo = detailR.getData();
List<TIncomeDetail> detailList = vo.getDetailList();
for (TIncomeDetail incomeDetail : detailList) {
value = detailMap.get(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType());
value = detailMap.get(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getDeptId() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType());
if (Common.isEmpty(value)) {
value = CommonConstants.ZERO_INT;
}
......@@ -319,7 +323,8 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
} else {
value--;
}
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType(), value);
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getDeptId() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType(), value);
}
}
} else {
......@@ -354,11 +359,13 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
if (salaryAccountList != null && !salaryAccountList.isEmpty()) {
BigDecimal money;
for (TSalaryAccount account : salaryAccountList) {
value = detailMap.get(account.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + isManage);
value = detailMap.get(account.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ account.getDeptId() + CommonConstants.DOWN_LINE_STRING + isManage
+ CommonConstants.DOWN_LINE_STRING
+ CommonConstants.FOUR_STRING);
if (Common.isEmpty(value) || value == 0) {
detail = new TIncomeDetail();
detail.setPayMonth(account.getSalaryMonth());
detail.setCharges(String.valueOf(dept.getManagementFee()));
detail.setDeptId(account.getDeptId());
detail.setDeptName(account.getDeptName());
detail.setDeptNo(account.getDeptNo());
......@@ -370,9 +377,11 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
detail.setEmpName(account.getEmpName());
detail.setFeeMode(dept.getManagementType());
detail.setFeeType(isManage);
detail.setCharges(String.valueOf(dept.getManagementFee()));
money = dept.getManagementFee();
if (CommonConstants.TWO_STRING.equals(isManage)) {
money = dept.getRiskFundFee();
detail.setCharges(String.valueOf(dept.getRiskFundFee()));
}
if (CommonConstants.ONE_STRING.equals(feeType)) {
money = BigDecimalUtils.safeMultiply(account.getRelaySalary(), money, CommonConstants.ONE_OF_PERCENT);
......@@ -384,7 +393,7 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
detail.setSourceType(CommonConstants.FOUR_STRING);
R<Boolean> saveR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincome/inner/saveDetail", detail, Boolean.class, SecurityConstants.FROM_IN);
if (saveR == null || saveR.getData() == null || Boolean.FALSE.equals(saveR.getData())) {
if (saveR == null || saveR.getCode() == CommonConstants.ONE_INT || Boolean.FALSE.equals(saveR.getData())) {
return R.failed("保存收入明细以及统计出错!");
}
}
......
......@@ -455,13 +455,13 @@
,ifnull(a.EMP_PHONE,'') fd_3adfedfbd23ab8
,ifnull(a.BANK_NO,'') fd_3adfedfcb17f1e
,ifnull(a.BANK_NAME,'') fd_3adfedfc453cc4
,ifnull(a.SALARY_MONTH,'') fd_3adfee063acff0
,ifnull(a.SETTLEMENT_MONTH,'') fd_3adfee0690737c
,'1' fd_3adfee01668666
,ifnull(a.SOCIAL_PRIORITY,'') fd_3adfedfed8bb28
,ifnull(a.FUND_PRIORITY,'') fd_3adfedff3a7430
,ifnull(a.OWN_FLAG,'') fd_3adfee0009d070
,ifnull(a.ANNUAL_BONUS_TYPE,'') fd_3adfee01dea2fa
,concat(left(ifnull(a.SALARY_MONTH,'1970'),4),'-',right(ifnull(a.SALARY_MONTH,'02'),2)) fd_3adfee063acff0
,concat(left(ifnull(a.SETTLEMENT_MONTH,'1970'),4),'-',right(ifnull(a.SETTLEMENT_MONTH,'02'),2)) fd_3adfee0690737c
,'' fd_3adfee01668666
,if(a.SOCIAL_PRIORITY='1','缴纳月','生成月') fd_3adfedfed8bb28
,if(a.FUND_PRIORITY='1','缴纳月','生成月') fd_3adfedff3a7430
,if(a.OWN_FLAG='1','是','否') fd_3adfee0009d070
,if(a.ANNUAL_BONUS_TYPE='1','单独','合并') fd_3adfee01dea2fa
,ifnull(a.RELAY_SALARY,'') fd_3adfee12cb8840
,ifnull(pdeduction.SALARY_MONEY,'') fd_3adfee1374ed7a
,ifnull(ifnull(withholidingUnitSocial.SALARY_MONEY,unitSocial.SALARY_MONEY),'') fd_3adfee1e2b2f78
......@@ -502,7 +502,7 @@
,'' fd_3adfeede08d430
,'' fd_3aeadf191c62a0
,'' fd_3aeadf1992544c
,ifnull(a.SALARY_GIVE_TIME,'') fd_3af9d49d165e90
,if(a.SALARY_GIVE_TIME='1','是','否') fd_3af9d49d165e90
,ifnull(a.INVOICE_TITLE,'') fd_3afab1895feea2
from t_salary_account a
LEFT JOIN t_salary_standard s on a.SALARY_FORM_ID=s.ID
......
......@@ -183,6 +183,18 @@ public class TIncome {
@ExcelAttribute(name = "推送状态:0未推送1已推送", maxLength = 1)
@Length(max = 1, message = "推送状态:0未推送1已推送不能超过1个字符")
@ExcelProperty("推送状态:0未推送1已推送")
private String pushStatus;
private String sendStatus;
@ExcelAttribute(name = "发送月份")
@ExcelProperty("发送月份")
private String sendMonth;
@ExcelAttribute(name = "发送时间")
@ExcelProperty("发送时间")
private Date sendTime;
@ExcelAttribute(name = "发送返回的EKPID")
@ExcelProperty("发送返回的EKPID")
private String ekpId;
}
......@@ -21,6 +21,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -161,6 +162,7 @@ public class TIncomeDetail {
@ExcelAttribute(name = "数据生成时间", isNotEmpty = true, errorInfo = "数据生成时间不能为空", isDate = true)
@NotBlank(message = "数据生成时间不能为空")
@ExcelProperty("数据生成时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 数据生成月份
......
......@@ -144,6 +144,6 @@ public class IncomeExportVo implements Serializable {
@ExcelAttribute(name = "推送状态", isDataId = true, readConverterExp = "0=未推送,1=已推送")
@Schema(description = "推送状态:0未推送1已推送")
@ExcelProperty("推送状态")
private String pushStatus;
private String sendStatus;
}
......@@ -158,8 +158,19 @@ public class TIncomeController {
**/
@Inner
@PostMapping("/inner/saveDetail")
public R<Boolean> saveDetail(@RequestBody TIncomeDetail tIncomeDetail) {
return R.ok(tIncomeService.saveDetail(tIncomeDetail));
public Boolean saveDetail(@RequestBody TIncomeDetail tIncomeDetail) {
return tIncomeService.saveDetail(tIncomeDetail);
}
/**
* @Description: 定时任务统计表未推送数据推送;
* @Author: huyc
* @Date: 2022/9/5 16:34
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Inner
@PostMapping("/inner/pushDetail")
public void pushDetail() {
tIncomeService.pushDetail();
}
}
......@@ -56,4 +56,26 @@ public class TIncomeDetailController {
return vo;
}
/**
* @Description: 生成收入数据
* @Author: huyc
* @Date: 2022-9-2
**/
@Inner
@PostMapping("/inner/createTIncomeDetail")
public void createTIncomeDetail(@RequestBody TIncomeDetail detail) {
tIncomeDetailService.save(detail);
}
/**
* 通过id删除收入明细表
*
* @param tIncomeDetail
* @return R
*/
@Inner
@PostMapping("/deleteById")
public void deleteById(@RequestBody TIncomeDetail tIncomeDetail) {
tIncomeDetailService.removeById(tIncomeDetail.getId());
}
}
......@@ -368,4 +368,17 @@ public class TPaymentInfoController {
public void createPaymentFundIncome() {
tPaymentInfoService.createPaymentFundIncome();
}
/**
* @param info
* @Description: 查询缴费库
* @Author: huyc
* @Date: 2022/8/25
* @return: int
**/
@Inner
@PostMapping("/inner/getPaymentSocialAndFound")
public TPaymentVo getPaymentSocialAndFound(@RequestBody TPaymentInfo info) {
return tPaymentInfoService.getPaymentSocialAndFound(info);
}
}
......@@ -57,4 +57,6 @@ public interface TIncomeService extends IService<TIncome> {
**/
boolean saveDetail(TIncomeDetail tIncomeDetail);
void pushDetail();
}
......@@ -137,4 +137,7 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
void createPaymentInfoIncome();
void createPaymentFundIncome();
TPaymentVo getPaymentSocialAndFound(TPaymentInfo info);
}
......@@ -33,6 +33,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.constants.ArchivesConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
......@@ -54,6 +55,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.shardingsphere.transaction.annotation.ShardingTransactionType;
import org.apache.shardingsphere.transaction.core.TransactionType;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
......@@ -102,6 +104,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private final TForecastLibraryService forecastLibraryService;
private final TIncomeDetailMapper detailMapper;
/**
* 派单信息记录表简单分页查询
*
......@@ -3313,6 +3317,19 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
|| CommonConstants.THREE_STRING.equals(sf.getSocialStatus())){
forecastLibraryService.updateForecastLibaryByDispatch(sf);
}
//公积金办理成功增加收入
if (Common.isNotNull(dis.getFundId()) &&
CommonConstants.THREE_STRING.equals(sf.getFundStatus())){
int monthDiff;
// 获取最小的起缴月
Date minStartDate = this.getMinDate(sf);
// 再计算月份
monthDiff = DateUtil.getMonthDiff(minStartDate, new Date()) + 2;
for (int i = 0; i < monthDiff; i++) {
//生成收入
createIncomeInfo(sf,DateUtil.addMonth(1 - i));
}
}
}
// 2.派减办理成功 处理预估 (不管社保还是公积金办理失败)
......@@ -3944,4 +3961,96 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return baseMapper.getFundRecordCount(searchVo,settleDomains,Common.getList(idStr),sql);
}
/**
* @param socialFundInfo
* @Description: 获取最小起缴日
* @Author: hgw
* @Date: 2022/7/29 11:06
* @return: java.util.Date
**/
private Date getMinDate(TSocialFundInfo socialFundInfo) {
Date minStartDate = null;
if (socialFundInfo.getSocialStartDate() != null) {
minStartDate = socialFundInfo.getSocialStartDate();
if (socialFundInfo.getUnitPersionMoney() != null && socialFundInfo.getPensionStart() != null && socialFundInfo.getPensionStart().before(minStartDate)) {
minStartDate = socialFundInfo.getPensionStart();
}
if (socialFundInfo.getUnitMedicalMoney() != null && socialFundInfo.getMedicalStart() != null && socialFundInfo.getMedicalStart().before(minStartDate)) {
minStartDate = socialFundInfo.getMedicalStart();
}
if (socialFundInfo.getUnitUnemploymentMoney() != null && socialFundInfo.getUnemployStart() != null && socialFundInfo.getUnemployStart().before(minStartDate)) {
minStartDate = socialFundInfo.getUnemployStart();
}
if (socialFundInfo.getUnitInjuryMoney() != null && socialFundInfo.getWorkInjuryStart() != null && socialFundInfo.getWorkInjuryStart().before(minStartDate)) {
minStartDate = socialFundInfo.getWorkInjuryStart();
}
if (socialFundInfo.getUnitBirthMoney() != null && socialFundInfo.getBirthStart() != null && socialFundInfo.getBirthStart().before(minStartDate)) {
minStartDate = socialFundInfo.getBirthStart();
}
}
if (socialFundInfo.getProvidentStart() != null
&& (null == minStartDate || socialFundInfo.getProvidentStart().before(minStartDate))) {
minStartDate = socialFundInfo.getProvidentStart();
}
if (null == minStartDate) {
minStartDate = new Date();
}
return minStartDate;
}
public void createIncomeInfo(TSocialFundInfo library, String createMonth) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(library.getSettleDomain());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
}
}
}
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
detail.setDeptName(library.getSettleDomainName());
detail.setDeptNo(library.getSettleDomainCode());
detail.setDeptId(library.getSettleDomain());
detail.setEmpIdcard(library.getEmpIdcard());
detail.setEmpName(library.getEmpName());
detail.setUnitNo(settleDomain.getCustomerNo());
detail.setUnitId(library.getUnitId());
detail.setUnitName(library.getUnitName());
detail.setDataCreateMonth(DateUtil.addMonth(0));
detail.setSourceId(library.getId());
detail.setSourceType(CommonConstants.TWO_STRING);
detail.setCreateMonth(createMonth);
detail.setPayMonth(createMonth);
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setMoney(BigDecimalUtils.safeAdd(library.getUnitFundSum(),library.getPersonalFundSum()));
//管理费和风险金收取
managemeRisk(settleDomain,detail);
}
public void managemeRisk(TSettleDomain settleDomain,TIncomeDetail detail) {
//管理费和风险金是否收取
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
detail.setFeeType(CommonConstants.ONE_STRING);
detail.setFeeMode(settleDomain.getManagementType());
detail.setCharges(settleDomain.getManagementFee().toString());
detail.setId(CommonConstants.NULL);
detailMapper.insert(detail);
}
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
detail.setFeeType(CommonConstants.TWO_STRING);
detail.setFeeMode(settleDomain.getRiskFundType());
detail.setCharges(settleDomain.getRiskFundFee().toString());
detail.setId(CommonConstants.NULL);
detailMapper.insert(detail);
}
}
}
......@@ -25,9 +25,13 @@ 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.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
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.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpFundUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpSocialUtil;
......@@ -37,19 +41,16 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.UpdateSocialFoundVo;
import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TAgentConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TAgentConfigMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TForecastLibraryMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFundInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.entity.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.*;
import com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
import com.yifu.cloud.plus.v1.yifu.social.util.ServiceUtil;
import com.yifu.cloud.plus.v1.yifu.social.vo.TForecastLibraryExportVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
......@@ -81,6 +82,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
private final EkpSocialUtil ekpSocialUtil;
private final TIncomeDetailService detailService;
private final TIncomeService incomeService;
private final ArchivesDaprUtil archivesDaprUtil;
/**
* 预估费用简单分页查询
*
......@@ -476,6 +483,26 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
/**
* @Description: 获取可补缴的最大月份
* @Author: hgw
* @Date: 2020/10/10 15:26
* @return: java.lang.Integer
**/
private Integer getOverpayMonth(TSocialFundInfo tSocialInfo) {
Integer overpayMonth = null;
if (CommonConstants.ZERO_STRING.equals(tSocialInfo.getCanOverpay())) {
//补缴是否含当月: 含当月
if (CommonConstants.ZERO_STRING.equals(tSocialInfo.getHaveThisMonth())) {
overpayMonth = Integer.parseInt(DateUtil.getYearAndMonth(tSocialInfo.getCreateTime(), 0));
//补缴是否含当月: 不含含当月
} else {
overpayMonth = Integer.parseInt(DateUtil.getYearAndMonth(tSocialInfo.getCreateTime(), CommonConstants.ONE_INT_NEGATE));
}
}
return overpayMonth;
}
private void initSocialLibary(String diffType, String payMonth, Map<String, TForecastLibrary> saveLibraryMap
, TSocialFundInfo tSocialInfo, boolean isReduceFund, HashMap<String, TAgentConfig> agentConfigMap
, String sfMapKey, TForecastLibrary historyLibrary, boolean isOnly) {
......@@ -520,26 +547,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
saveLibraryMap.put(sfMapKey, lib);
}
/**
* @Description: 获取可补缴的最大月份
* @Author: hgw
* @Date: 2020/10/10 15:26
* @return: java.lang.Integer
**/
private Integer getOverpayMonth(TSocialFundInfo tSocialInfo) {
Integer overpayMonth = null;
if (CommonConstants.ZERO_STRING.equals(tSocialInfo.getCanOverpay())) {
//补缴是否含当月: 含当月
if (CommonConstants.ZERO_STRING.equals(tSocialInfo.getHaveThisMonth())) {
overpayMonth = Integer.parseInt(DateUtil.getYearAndMonth(tSocialInfo.getCreateTime(), 0));
//补缴是否含当月: 不含含当月
} else {
overpayMonth = Integer.parseInt(DateUtil.getYearAndMonth(tSocialInfo.getCreateTime(), CommonConstants.ONE_INT_NEGATE));
}
}
return overpayMonth;
}
// historyLibrary_历史比例(暂时未用到)
private TForecastLibrary initForecastLibrary(TForecastLibrary library
, TSocialFundInfo socialInfo, TSocialFundInfo fund, Integer month, boolean isReduceFund
......@@ -1545,6 +1552,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
// 删除
baseMapper.deleteById(library.getId());
}
//删除停缴月以后的收入数据
detailService.remove(Wrappers.<TIncomeDetail>query().lambda().eq(TIncomeDetail::getEmpIdcard,library.getEmpIdcard())
.eq(TIncomeDetail::getDeptId,library.getSettleDomainId())
.eq(TIncomeDetail::getSourceType,CommonConstants.ONE_STRING)
.eq(TIncomeDetail::getPayMonth,library.getSocialPayMonth()));
}
private void calculateFundType(BigDecimal zero, TForecastLibrary library) {
......@@ -1566,6 +1579,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
// 删除
baseMapper.deleteById(library.getId());
}
//删除停缴月以后的收入数据
detailService.remove(Wrappers.<TIncomeDetail>query().lambda().eq(TIncomeDetail::getEmpIdcard,library.getEmpIdcard())
.eq(TIncomeDetail::getDeptId,library.getSettleDomainId())
.eq(TIncomeDetail::getSourceType,CommonConstants.TWO_STRING)
.eq(TIncomeDetail::getPayMonth,library.getSocialPayMonth()));
}
/**
......@@ -1771,6 +1790,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
library.setCreateTime(LocalDateTime.now());
baseMapper.insert(library);
isSaveAndUpdate = true;
//办理成功生成收入
createIncomeInfo(library);
}
}
}
......@@ -2092,6 +2114,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
library.setCreateName("定时生成");
library.setCreateTime(LocalDateTime.now());
baseMapper.insert(library);
//办理成功生成收入
createIncomeInfo(library);
}
isSaveAndUpdate = true;
}
......@@ -2102,14 +2127,6 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
@Override
public TPaymentVo selectTForecastBySalaryVo(TPaymentBySalaryVo tPaymentBySalaryVo) {
List<TPaymentBySalaryVo> list = baseMapper.selectTForecastBySalaryVo(tPaymentBySalaryVo);
TPaymentVo vo = new TPaymentVo();
vo.setPaymentList(list);
return vo;
}
@Override
public int updateForecastSocialStatusToSettle(List<String> idList) {
if (idList != null && !idList.isEmpty()) {
......@@ -2118,6 +2135,14 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return 0;
}
@Override
public TPaymentVo selectTForecastBySalaryVo(TPaymentBySalaryVo tPaymentBySalaryVo) {
List<TPaymentBySalaryVo> list = baseMapper.selectTForecastBySalaryVo(tPaymentBySalaryVo);
TPaymentVo vo = new TPaymentVo();
vo.setPaymentList(list);
return vo;
}
@Override
public int updateForecastSocialStatusToNoSettle(List<String> idList) {
if (idList != null && !idList.isEmpty()) {
......@@ -2497,4 +2522,146 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return pushList;
}
public void createIncomeInfo(TForecastLibrary library) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(library.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
}
}
}
//判断是否存在当月的社保或公积金收入数据
Boolean isExist = false;
String sourceType = "";
if (Common.isNotNull(library.getProvidentId())) {
sourceType = CommonConstants.TWO_STRING;
} else {
sourceType = CommonConstants.ONE_STRING;
}
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setEmpIdcard(library.getEmpIdcard());
if (CommonConstants.ONE_STRING.equals(sourceType)) {
incomeDetail.setPayMonth(library.getSocialPayMonth());
} else {
incomeDetail.setPayMonth(library.getProvidentPayMonth());
}
incomeDetail.setDeptNo(library.getDeptNo());
incomeDetail.setSourceType(sourceType);
List<TIncomeDetail> detailList = detailService.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailList)) {
isExist = true;
}
//判断是否为按人次收费
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && (settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
|| settleDomain.getManageServerItem().contains(CommonConstants.TWO_STRING))) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
//预估模式只有按人次和人数收费
if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
isSum = 1;
}
if (!isExist || isSum == 1) {
createIncomeInsurance(library, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee(), sourceType);
}
}
} else {
BigDecimal gMoney = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
isSum = 2;
} else {
gMoney = BigDecimalUtils.safeMultiply(library.getSumAll(),settleDomain.getManagementFee());
}
if (!isExist || isSum ==2) {
createIncomeInsurance(library, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
gMoney, sourceType);
}
}
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && (settleDomain.getRiskServerItem().contains(CommonConstants.ONE_STRING)
|| settleDomain.getRiskServerItem().contains(CommonConstants.TWO_STRING))) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType()) &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
isSum = 3;
}
if (!isExist || isSum == 3) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee(),sourceType);
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
money = settleDomain.getRiskFundFee();
isSum = 4;
} else {
money = BigDecimalUtils.safeMultiply(library.getSumAll(), settleDomain.getRiskFundFee());
}
if (!isExist || isSum == 4) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
money, sourceType);
}
}
}
}
}
}
public void createIncomeInsurance(TForecastLibrary library, TSettleDomain settleDomain, String feeType,
String charges, String feeMode, BigDecimal money,String sourceType) {
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
detail.setDeptName(settleDomain.getDepartName());
detail.setDeptNo(settleDomain.getDepartNo());
detail.setDeptId(settleDomain.getId());
detail.setEmpIdcard(library.getEmpIdcard());
detail.setEmpName(library.getEmpName());
detail.setUnitNo(settleDomain.getCustomerNo());
detail.setUnitId(settleDomain.getCustomerId());
detail.setUnitName(settleDomain.getCustomerName());
detail.setDataCreateMonth(DateUtil.addMonth(0));
detail.setSourceId(library.getId());
detail.setSourceType(sourceType);
if (CommonConstants.ONE_STRING.equals(sourceType)) {
detail.setCreateMonth(library.getSocialCreateMonth());
detail.setPayMonth(library.getSocialPayMonth());
} else {
detail.setCreateMonth(library.getProvidentCreateMonth());
detail.setPayMonth(library.getProvidentPayMonth());
}
detail.setMoney(money);
detail.setFeeType(feeType);
detail.setFeeMode(feeMode);
detail.setCharges(charges);
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setId(CommonConstants.NULL);
incomeService.saveDetail(detail);
}
}
......@@ -25,10 +25,14 @@ 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.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.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;
......@@ -61,6 +65,9 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
@Autowired
private TIncomeDetailService tIncomeDetailService;
@Autowired
private EkpIncomeUtil ekpIncomeUtil;
/**
* 收入明细表简单分页查询
*
......@@ -265,12 +272,109 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
}
@Override
public void pushDetail() {
List<TIncome> list = baseMapper.selectList(Wrappers.<TIncome>query().lambda()
.eq(TIncome::getSendStatus, CommonConstants.ZERO_STRING));
for (TIncome income : list) {
EkpIncomeParam sendParam = new EkpIncomeParam();
this.copyToEkp(income, sendParam);
String sendBack = ekpIncomeUtil.sendToEKP(sendParam, income.getFeeType());
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
}
this.updateById(income);
}
}
// 复制并保存
private boolean saveIncome(TIncomeDetail tIncomeDetail) {
TIncome income = new TIncome();
BeanUtil.copyProperties(tIncomeDetail, income);
income.setPushStatus(CommonConstants.ZERO_STRING);
return this.save(income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
EkpIncomeParam sendParam = new EkpIncomeParam();
this.copyToEkp(income, sendParam);
String sendBack = ekpIncomeUtil.sendToEKP(sendParam, income.getFeeType());
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
}
return this.updateById(income);
}
/**
* @param income 收入
* @param sendParam 目标格式
* @Description: 转化格式,传到EKP
* @Author: hgw
* @Date: 2022/9/5 16:57
* @return: void
**/
private void copyToEkp(TIncome income, EkpIncomeParam sendParam) {
// 项目编码
sendParam.setFd_3adfef5e5b9d34(income.getDeptNo());
// 项目名称
sendParam.setFd_3adfef5eb6691c(income.getDeptName());
// 单号
sendParam.setFd_3adfef7f5d2b52("");
// 客户编码
sendParam.setFd_3adfef80202ab2(income.getUnitNo());
// 客户名称
sendParam.setFd_3adfef7fc1c886(income.getUnitName());
// 类型:单选(人,人次,比例,固定值,总额)
// feeMode收费方式:1按比例2金额-人数3金额-人次
if (CommonConstants.ONE_STRING.equals(income.getFeeMode())) {
sendParam.setFd_3adda3037e3bda("比例");
} else if (CommonConstants.TWO_STRING.equals(income.getFeeMode())) {
sendParam.setFd_3adda3037e3bda("人");
} else {
sendParam.setFd_3adda3037e3bda("人次");
}
// 产生来源:单选(社保,工资,商险)
// sourceType1社保2公积金3商险4薪资
if (CommonConstants.THREE_STRING.equals(income.getSourceType())) {
sendParam.setFd_3adda320daef5a("商险");
} else if (CommonConstants.FOUR_STRING.equals(income.getSourceType())) {
sendParam.setFd_3adda320daef5a("工资");
} else {
sendParam.setFd_3adda320daef5a("社保");
}
// 姓名
sendParam.setFd_3adfef948da848(income.getEmpName());
// 身份证号
sendParam.setFd_3adfef94dcdbb4(income.getEmpIdcard());
// 生成月份
if (Common.isEmpty(income.getCreateMonth()) || income.getCreateMonth().length() != 6) {
sendParam.setFd_3ae0c3032cffc8("1970-02");
} else {
sendParam.setFd_3ae0c3032cffc8(income.getCreateMonth().substring(0, 4)
+ CommonConstants.CENTER_SPLIT_LINE_STRING + income.getCreateMonth().substring(4, 6));
}
// 结算月份
if (Common.isEmpty(income.getPayMonth()) || income.getPayMonth().length() != 6) {
sendParam.setFd_3ae0c3044e5958("1970-02");
} else {
sendParam.setFd_3ae0c3044e5958(income.getPayMonth().substring(0, 4)
+ CommonConstants.CENTER_SPLIT_LINE_STRING + income.getPayMonth().substring(4, 6));
}
// 管理费、风险金金额
sendParam.setFd_3adfef963bae28(String.valueOf(income.getMoney()));
// 应收
sendParam.setFd_3adfefa3daae72(String.valueOf(income.getMoney()));
// 结算状态
sendParam.setFd_3adfefaaa3bbd0("未结算");
// 收款状态
sendParam.setFd_3adfefaaef583e("未收");
// 结算单号
sendParam.setFd_3aead7204bb594("");
// 收款单号
sendParam.setFd_3aeae59b70fe5a("");
}
/**
......
......@@ -58,6 +58,7 @@ import com.yifu.cloud.plus.v1.yifu.social.constants.PaymentConstants;
import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.*;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
import com.yifu.cloud.plus.v1.yifu.social.service.TPaymentInfoService;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentHeFeiVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoSearchVo;
......@@ -123,6 +124,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Autowired
private TIncomeDetailMapper detailMapper;
@Autowired
private TIncomeService incomeService;
@Autowired
private ArchivesDaprUtil archivesDaprUtil;
......@@ -2293,6 +2297,17 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
@Override
public TPaymentVo getPaymentSocialAndFound(TPaymentInfo info) {
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getEmpIdcard, info.getEmpIdcard())
.eq(TPaymentInfo::getSettleDomainId, info.getSettleDomainId())
.eq(TPaymentInfo::getSocialCreateMonth, "202212"));
TPaymentVo paymentVo = new TPaymentVo();
paymentVo.setPaymentInfoList(sumList);
return paymentVo;
}
public List<String> initEkpPushSocialParam(List<TPaymentInfo> unPushInfo) {
List<String> pushList = new ArrayList<>();
for (TPaymentInfo library:unPushInfo) {
......@@ -2646,73 +2661,114 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
exitFlag = true;
}
//判断是否为按人次收费
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
//按金额计算的话要看缴纳月有没有收入数据
if (!exitFlag) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && (settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
|| settleDomain.getManageServerItem().contains(CommonConstants.TWO_STRING))) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
//预估模式只有按人次和人数收费
if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
isSum = 1;
}
if (!exitFlag || isSum == 1) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee(), socialFundFlag);
}
}
} else {
BigDecimal gMoney = BigDecimal.ZERO;
if (CommonConstants.ONE_STRING.equals(settleDomain.getManagementType())) {
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
isSum = 2;
} else {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(), settleDomain.getManagementFee());
} else {
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(), settleDomain.getManagementFee());
}
} else {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
gMoney = paymentInfo.getSocialSum();
} else {
gMoney = paymentInfo.getProvidentSum();
}
createIncomeRiskInfo(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(), gMoney, socialFundFlag);
}
if (!exitFlag || isSum == 2) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
gMoney, socialFundFlag);
}
}
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
if (CommonConstants.ONE_STRING.equals(settleDomain.getRiskFundType())) {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
money = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(), settleDomain.getRiskFundFee());
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && (settleDomain.getRiskServerItem().contains(CommonConstants.ONE_STRING)
|| settleDomain.getRiskServerItem().contains(CommonConstants.TWO_STRING))) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType()) &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
isSum = 3;
}
if (!exitFlag || isSum == 3) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee(), socialFundFlag);
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
money = settleDomain.getRiskFundFee();
isSum = 4;
} else {
money = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(), settleDomain.getRiskFundFee());
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
money = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(), settleDomain.getRiskFundFee());
} else {
money = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(), settleDomain.getRiskFundFee());
}
}
} else {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
money = paymentInfo.getSocialSum();
} else {
money = paymentInfo.getProvidentSum();
if (!exitFlag || isSum == 4) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
money, socialFundFlag);
}
}
createIncomeRiskInfo(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(), money, socialFundFlag);
}
}
}
}
public void createIncomeRiskInfo(TPaymentInfo paymentInfo,TSettleDomain settleDomain,String feeType,
String charges, String feeMode,BigDecimal money,String sourceType) {
public void createIncomeInsurance(TPaymentInfo library, TSettleDomain settleDomain, String feeType,
String charges, String feeMode, BigDecimal money,String sourceType) {
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
detail.setDeptName(paymentInfo.getSettleDomainName());
detail.setDeptNo(paymentInfo.getSettleDomainCode());
detail.setDeptId(paymentInfo.getSettleDomainId());
detail.setEmpIdcard(paymentInfo.getEmpIdcard());
detail.setEmpName(paymentInfo.getEmpName());
detail.setDeptName(settleDomain.getDepartName());
detail.setDeptNo(settleDomain.getDepartNo());
detail.setDeptId(settleDomain.getId());
detail.setEmpIdcard(library.getEmpIdcard());
detail.setEmpName(library.getEmpName());
detail.setUnitNo(settleDomain.getCustomerNo());
detail.setUnitId(paymentInfo.getUnitId());
detail.setUnitName(paymentInfo.getUnitName());
detail.setUnitId(settleDomain.getCustomerId());
detail.setUnitName(settleDomain.getCustomerName());
detail.setDataCreateMonth(DateUtil.addMonth(0));
detail.setSourceId(paymentInfo.getId());
detail.setSourceId(library.getId());
detail.setSourceType(sourceType);
detail.setCreateMonth(paymentInfo.getSocialCreateMonth());
detail.setPayMonth(paymentInfo.getSocialPayMonth());
if (CommonConstants.ONE_STRING.equals(sourceType)) {
detail.setCreateMonth(library.getSocialCreateMonth());
detail.setPayMonth(library.getSocialPayMonth());
} else {
detail.setCreateMonth(library.getProvidentCreateMonth());
detail.setPayMonth(library.getProvidentPayMonth());
}
detail.setMoney(money);
detail.setFeeType(feeType);
detail.setFeeMode(feeMode);
detail.setCharges(charges);
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setId(CommonConstants.NULL);
detailMapper.insert(detail);
incomeService.saveDetail(detail);
}
}
......@@ -42,8 +42,11 @@
<result property="payMonth" column="PAY_MONTH"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="dataCreateMonth" column="DATA_CREATE_MONTH"/>
<result property="pushStatus" column="PUSH_STATUS"/>
<result property="sendStatus" column="SEND_STATUS"/>
<result property="redData" column="RED_DATA"/>
<result property="sendStatus" column="SEND_STATUS"/>
<result property="sendTime" column="SEND_TIME"/>
<result property="sendMonth" column="SEND_MONTH"/>
</resultMap>
<resultMap id="incomeExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.IncomeExportVo">
<result property="empName" column="EMP_NAME"/>
......@@ -60,7 +63,7 @@
<result property="payMonth" column="PAY_MONTH"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="dataCreateMonth" column="DATA_CREATE_MONTH"/>
<result property="pushStatus" column="PUSH_STATUS"/>
<result property="sendStatus" column="SEND_STATUS"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -81,8 +84,10 @@
a.PAY_MONTH,
a.CREATE_TIME,
a.DATA_CREATE_MONTH,
a.PUSH_STATUS,
a.RED_DATA
a.RED_DATA,
a.SEND_STATUS,
a.SEND_TIME,
a.SEND_MONTH
</sql>
<sql id="tIncome_where">
<if test="tIncome != null">
......@@ -140,8 +145,8 @@
<if test="tIncome.dataCreateMonth != null and tIncome.dataCreateMonth.trim() != ''">
AND a.DATA_CREATE_MONTH = #{tIncome.dataCreateMonth}
</if>
<if test="tIncome.pushStatus != null and tIncome.pushStatus.trim() != ''">
AND a.PUSH_STATUS = #{tIncome.pushStatus}
<if test="tIncome.sendStatus != null and tIncome.sendStatus.trim() != ''">
AND a.SEND_STATUS = #{tIncome.sendStatus}
</if>
<if test="tIncome.redData != null and tIncome.redData.trim() != ''">
AND a.RED_DATA = #{tIncome.redData}
......
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