Commit c4601820 authored by fangxinjiang's avatar fangxinjiang

Merge branch 'develop'

parents 28652402 ee5df90e
......@@ -29,6 +29,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.DecimalMax;
import java.math.BigDecimal;
import java.time.LocalDateTime;
......@@ -469,4 +470,14 @@ public class TSettleDomain extends BaseEntity {
@ExcelProperty("风险金的收取服务项目:1社保2公积金3商险4薪酬")
private String riskServerItem;
/**
* 单位大病比例
* hgw 2022-9-8 15:40:18
* 从t_depart_settlement_info表迁移过来的
*/
@ExcelAttribute(name = "单位大病比例")
@DecimalMax(value = "100.00", message = "单位大病比例不能大于100.00")
@Schema(description = "单位大病比例", name = "unitSeriousIllnessProp")
private BigDecimal unitSeriousIllnessProp;
}
......@@ -88,6 +88,7 @@
<result property="riskFundType" column="RISK_FUND_TYPE"/>
<result property="manageServerItem" column="MANAGE_SERVER_ITEM"/>
<result property="riskServerItem" column="RISK_SERVER_ITEM"/>
<result property="unitSeriousIllnessProp" column="UNIT_SERIOUS_ILLNESS_PROP"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -159,7 +160,8 @@
a.RISK_FUND_FEE,
a.RISK_FUND_TYPE,
a.MANAGE_SERVER_ITEM,
a.RISK_SERVER_ITEM
a.RISK_SERVER_ITEM,
a.UNIT_SERIOUS_ILLNESS_PROP
</sql>
<resultMap id="tSettleDomainSelectVoMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo">
......@@ -218,7 +220,7 @@
c.CUSTOMER_NAME as 'customerName',
c.CUSTOMER_CODE as 'customerCode',
c.INDUSTRY_BELONG as 'industryBelong',
t.COVER_NAME as 'businessSubjectName'
a.INVOICE_TITLE_SALARY as 'businessSubjectName'
FROM
t_settle_domain a
LEFT JOIN (
......@@ -227,7 +229,6 @@
INDUSTRY_BELONG,
CUSTOMER_CODE from t_customer_info
) c ON a.CUSTOMER_ID = c.customerId
LEFT JOIN t_table_head_salary_cover t on a.id=t.DEPART_ID and t.type = 0
WHERE a.id=#{id} GROUP BY a.id
</select>
......
......@@ -91,7 +91,15 @@ public interface CommonConstants {
*/
Integer SUCCESS = 200;
/**
* 商险导出最大值
*/
Integer EXPORT_TWENTY_THOUSAND = 20000;
/**
* 商险导入最大值
*/
Integer IMPORT_TWENTY_THOUSAND = 20000;
/**
* 失败标记
......
......@@ -5,6 +5,8 @@ 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;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamManage;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamRisk;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.extern.log4j.Log4j2;
import org.codehaus.jackson.map.ObjectMapper;
......@@ -29,13 +31,12 @@ public class EkpIncomeUtil {
/**
* @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) {
public String sendToEkpManage(EkpIncomeParamManage param) {
log.info("推送EKP开始--收入明细数据");
RestTemplate yourRestTemplate = new RestTemplate();
try {
......@@ -48,13 +49,45 @@ public class EkpIncomeUtil {
wholeForm.add("docSubject", ekpProperties.getDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpProperties.getDocStatus());
if (CommonConstants.ONE_STRING.equals(type)) {
wholeForm.add("fdModelId", ekpProperties.getFdModelIdManage());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowIdManage());
wholeForm.add("formValues", formValues);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword") 是VO,则使用APPLICATION_JSON
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<>(wholeForm, headers);
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpProperties.getUrl(), HttpMethod.POST, entity, String.class);
String body = obj.getBody();
if (StringUtils.isBlank(body)) {
log.error(EkpConstants.SEND_FAILED);
return EkpConstants.SEND_FAILED;
} else {
log.info(EkpConstants.SEND_SUCCESS + body);
return body;
}
} catch (Exception e) {
log.info(e.getMessage());
return e.getMessage();
}
}
public String sendToEkpRisk(EkpIncomeParamRisk param) {
log.info("推送EKP开始--收入明细数据");
RestTemplate yourRestTemplate = new RestTemplate();
try {
String formValues = new ObjectMapper().writeValueAsString(param);
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject loginName = new JSONObject();
loginName.append("LoginName", ekpProperties.getLoginName());
MultiValueMap<String, Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("docSubject", ekpProperties.getDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpProperties.getDocStatus());
wholeForm.add("fdModelId", ekpProperties.getFdModelIdRisk());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowIdRisk());
}
wholeForm.add("formValues", formValues);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
......@@ -67,14 +100,14 @@ public class EkpIncomeUtil {
String body = obj.getBody();
if (StringUtils.isBlank(body)) {
log.error(EkpConstants.SEND_FAILED);
return null;
return EkpConstants.SEND_FAILED;
} else {
log.info(EkpConstants.SEND_SUCCESS + body);
return body;
}
} catch (Exception e) {
log.info(e.getMessage());
return null;
return e.getMessage();
}
}
......
package com.yifu.cloud.plus.v1.yifu.ekp.util;
import cn.hutool.json.JSONObject;
import com.yifu.cloud.plus.v1.yifu.ekp.config.EkpSalaryProperties;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam;
......@@ -12,7 +13,6 @@ import org.springframework.http.*;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import cn.hutool.json.JSONObject;
/**
* @Author fxj
......@@ -35,38 +35,36 @@ public class EkpSalaryUtil {
//把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject loginName = new JSONObject();
loginName.append("LoginName",ekpProperties.getLoginName());
String loginData = new ObjectMapper().writeValueAsString(loginName);
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
//wholeForm.add("docSubject", new String(docSubject.getBytes("UTF-8"),"ISO-8859-1") );
//wholeForm.add("docSubject", new String(docSubject.getBytes("UTF-8"),"ISO-8859-1") )
wholeForm.add("docSubject",ekpProperties.getDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
//wholeForm.add("docCreator", loginData);
//wholeForm.add("docCreator", loginData)
wholeForm.add("docStatus", ekpProperties.getDocStatus());
wholeForm.add("fdModelId", ekpProperties.getFdModelId());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowId());
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"));
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"))
wholeForm.add("formValues", formValues);
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") );
System.out.println("wholeForm:"+wholeForm);
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") )
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers);
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<>(wholeForm,headers);
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpProperties.getUrl(), HttpMethod.POST, entity, String.class);
String body = obj.getBody();
if (StringUtils.isBlank(body)){
log.error(EkpConstants.SEND_FAILED);
return null;
return EkpConstants.SEND_FAILED;
}else{
log.info(EkpConstants.SEND_SUCCESS+body);
return body;
}
}catch (Exception e){
log.info(e.getMessage());
return null;
return e.getMessage();
}
}
......
......@@ -48,14 +48,6 @@ public class EkpIncomeParam implements Serializable {
* 身份证号
**/
private String fd_3adfef94dcdbb4;
/**
* 生成月份
**/
private String fd_3ae0c3032cffc8;
/**
* 结算月份
**/
private String fd_3ae0c3044e5958;
/**
* 管理费、风险金金额
**/
......@@ -72,12 +64,4 @@ public class EkpIncomeParam implements Serializable {
* 收款状态
**/
private String fd_3adfefaaef583e;
/**
* 结算单号
**/
private String fd_3aead7204bb594;
/**
* 收款单号
**/
private String fd_3aeae59b70fe5a;
}
package com.yifu.cloud.plus.v1.yifu.ekp.vo;
import lombok.Data;
/**
* @Author hgw
* @Date 2022-9-6 15:06:24
* @Description 收入明细对应参数
* @Version 1.0
*/
@Data
public class EkpIncomeParamManage extends EkpIncomeParam {
/**
* 生成月份
**/
private String fd_3ae0c23b2e9a92;
/**
* 结算月份
**/
private String fd_3ae0c23cb3fccc;
/**
* 结算单号
**/
private String fd_3aead3c68b1078;
/**
* 收款单号
**/
private String fd_3aeae58b14691c;
}
package com.yifu.cloud.plus.v1.yifu.ekp.vo;
import lombok.Data;
/**
* @Author hgw
* @Date 2022-9-6 15:06:24
* @Description 收入明细对应参数
* @Version 1.0
*/
@Data
public class EkpIncomeParamRisk extends EkpIncomeParam {
/**
* 生成月份
**/
private String fd_3ae0c3032cffc8;
/**
* 结算月份
**/
private String fd_3ae0c3044e5958;
/**
* 结算单号
**/
private String fd_3aead7204bb594;
/**
* 收款单号
**/
private String fd_3aeae59b70fe5a;
}
......@@ -13,6 +13,10 @@ import java.io.Serializable;
@Data
public class EkpSalaryParam implements Serializable {
/**
* 工资id
**/
private String fd_3b10af838eab5c;
/**
* 项目编码
**/
......
package com.yifu.cloud.plus.v1.yifu.ekp.vo;
import lombok.Data;
/**
* @Author fxj
* @Date 2022/8/22
* @Description 薪资明细对应参数
* @Version 1.0
*/
@Data
public class EkpSalaryParamVo extends EkpSalaryParam {
/**
* 报账表id
**/
private String salaryAccountId;
}
income.url=http://119.96.227.251.8080/api/sys-modeling/appModelRestService/addModel
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.fdModelIdRisk=181d76db26e4112e14b9bb4274d06ba1
income.fdFlowIdRisk=182d3bdadab3a52be024e154e99b5f8b
income.docStatus=20
income.loginName=admin
income.docSubject=\u6536\u5165\u660E\u7EC6\u6570\u636E\u63A5\u53E3
......
......@@ -1066,6 +1066,35 @@ public class InsurancesConstants {
public static final String SYSTEM_TRIGGER = "系统触发";
/**
* 一次性导出不可超过20000条,请分批导出
*/
public static final String EXPORT_TOO_LONG = "一次性导出不可超过20000条,请分批导出";
/**
* 一次性导入不可超过20000条,请分批导入
*/
public static final String IMPORT_TOO_LONG = "一次性导入不可超过20000条,请分批导入";
/**
* 结算类型不一致
*/
public static final String SETTLE_TYPE_ATYPISM = "结算类型不一致";
/**
* 预估已推送
*/
public static final String ESTIMATE_IS_PUSH = "预估已推送";
/**
* 实缴已推送,请分批导入
*/
public static final String ACTUAL_IS_PUSH = "实缴已推送";
/**
* 结算id不一致,请分批导入
*/
public static final String SETTLE_ID_ATYPISM = "结算id不一致";
......
......@@ -38,7 +38,7 @@ public class TInsuranceEkp implements Serializable {
/**
* 单据类型 (0、与薪资合并结算 1、单独结算)
*/
private Integer settleType;
private String settleType;
/**
* 项目编码
......@@ -138,7 +138,7 @@ public class TInsuranceEkp implements Serializable {
/**
* 单据状态
*/
private Integer interactiveType;
private String interactiveType;
/**
* 重发标识
......@@ -161,6 +161,12 @@ public class TInsuranceEkp implements Serializable {
@Schema(description = "推送类型(1推送预估费用,2推送实缴费用,3变更结算信息,4推送作废信息,5推送预估红冲信息,6推送实缴红冲信息)")
private Integer pushType;
/**
* 不重发原因
*/
private String notResendMessage;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.Dept;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceDetailService;
......@@ -94,7 +95,7 @@ public class TInsuranceDetailController {
@PostMapping("/getInsuranceList")
@PreAuthorize("@pms.hasPermission('insurance_custserve_insure_export')")
public R<List<InsuranceListVO>> getInsuranceList(@RequestBody InsuranceListParam param) {
return R.ok(tInsuranceDetailService.getInsuranceList(param));
return tInsuranceDetailService.getInsuranceList(param);
}
/**
......@@ -255,6 +256,9 @@ public class TInsuranceDetailController {
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
if(param.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
return tInsuranceDetailService.insuranceHandleImport(user,param);
}
......@@ -355,8 +359,8 @@ public class TInsuranceDetailController {
@Operation(summary = "已投保列表不分页查询", description = "已投保列表不分页查询")
@PostMapping("/getInsuredList")
@PreAuthorize("@pms.hasPermission('insurance_custserve_insured_export')")
public R<List<InsuredListVo>> getInsuredList(@RequestBody InsuredParam param) {
return R.ok(tInsuranceDetailService.getInsuredList(param),"查询成功");
public R getInsuredList(@RequestBody InsuredParam param) {
return tInsuranceDetailService.getInsuredList(param);
}
/**
......@@ -382,8 +386,8 @@ public class TInsuranceDetailController {
@Operation(summary = "已减员列表导出", description = "已减员列表导出")
@PostMapping("/getInsuranceRefundList")
@PreAuthorize("@pms.hasPermission('insurance_custserve_reduction_export')")
public R<List<InsuranceRefundListVo>> getInsuranceRefundList(@RequestBody InsuranceRefundParam param) {
return R.ok(tInsuranceDetailService.getInsuranceRefundList(param));
public R getInsuranceRefundList(@RequestBody InsuranceRefundParam param) {
return tInsuranceDetailService.getInsuranceRefundList(param);
}
......@@ -410,7 +414,7 @@ public class TInsuranceDetailController {
@Operation(summary = "导出减员列表", description = "导出减员列表")
@PostMapping("/getInsuranceRefundHandlingList")
@PreAuthorize("@pms.hasPermission('handle_down_export')")
public R<List<RefundExportListVo>> getInsuranceRefundHandlingList(@RequestBody RefundExportListParam param) {
public R getInsuranceRefundHandlingList(@RequestBody RefundExportListParam param) {
return tInsuranceDetailService.getInsuranceRefundHandlingList(param);
}
......
......@@ -54,9 +54,9 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*
* @author licancan
* @param param
* @return {@link List<InsuranceListVO>}
* @return {@link R<List<InsuranceListVO>>}
*/
List<InsuranceListVO> getInsuranceList(InsuranceListParam param);
R<List<InsuranceListVO>> getInsuranceList(InsuranceListParam param);
/**
* 投保办理分页查询
......@@ -206,7 +206,7 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @param param 查询参数
* @return {@link List< InsuredListVo>}
*/
List<InsuredListVo> getInsuredList(InsuredParam param);
R getInsuredList(InsuredParam param);
/**
* 已减员列表分页查询
......@@ -225,7 +225,7 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* @param param 查询参数
* @return {@link List< InsuranceRefundListVo >}
*/
List<InsuranceRefundListVo> getInsuranceRefundList(InsuranceRefundParam param);
R getInsuranceRefundList(InsuranceRefundParam param);
/**
* 减员办理列表分页查询
......
......@@ -208,16 +208,16 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* 投保不分页查询
*
* @param param
* @return {@link List<InsuranceListVO>}
* @return {@link R<List<InsuranceListVO>>}
* @author licancan
*/
@Override
public List<InsuranceListVO> getInsuranceList(InsuranceListParam param) {
public R<List<InsuranceListVO>> getInsuranceList(InsuranceListParam param) {
YifuUser user = SecurityUtils.getUser();
List<String> deptList = getDeptNoList(user);
List<InsuranceListVO> insuranceList = new ArrayList<>();
if (CollectionUtils.isEmpty(deptList)){
return insuranceList;
return R.ok(insuranceList);
}
param.setDeptNoList(deptList);
insuranceList = baseMapper.getInsuranceList(param);
......@@ -225,11 +225,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
setProjectNameByDeptNo(insuranceList);
// 购买月数
if (CollectionUtils.isNotEmpty(insuranceList)){
if(insuranceList.size() > CommonConstants.EXPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.EXPORT_TOO_LONG);
}
insuranceList.stream().forEach(e ->{
e.setBuyMonth(LocalDateUtil.betweenMonth(e.getPolicyStart().toString(),e.getPolicyEnd().toString()));
});
}
return insuranceList;
return R.ok(insuranceList);
}
/**
* 投保办理分页查询
......@@ -277,6 +280,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
if(paramList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
......@@ -327,6 +333,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
if(paramList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
......@@ -375,6 +384,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
if(paramList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
......@@ -880,6 +892,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceExportList = baseMapper.getInsuranceExportList(param);
}
if (CollectionUtils.isNotEmpty(insuranceExportList)){
if(insuranceExportList.size() > CommonConstants.EXPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.EXPORT_TOO_LONG);
}
List<TInsuranceDetail> detailList = new ArrayList<>();
//根据项目编码获取项目名称
List<String> collect = insuranceExportList.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
......@@ -1079,6 +1094,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
pushResult= pushEstimate(detail, CommonConstants.FIVE_INT);
}else {
//预估结算中已结算,推送预估红冲
detail.setDefaultSettleId(burden.getId());
pushResult = pushEstimate(detail, CommonConstants.THREE_INT);
}
}
......@@ -1089,6 +1105,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
pushResult= pushEstimate(detail, CommonConstants.FIVE_INT);
}else{
//预估结算中,已结算,实缴已推送,推送实缴红冲信息
detail.setDefaultSettleId(burden.getId());
pushResult= pushEstimate(detail, CommonConstants.SIX_INT);
}
}
......@@ -1099,6 +1116,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
pushResult= pushEstimate(detail, CommonConstants.FIVE_INT);
}else{
//实缴结算中,已结算,推送实缴红冲信息
detail.setDefaultSettleId(burden.getId());
pushResult= pushEstimate(detail, CommonConstants.SIX_INT);
}
}
......@@ -1258,6 +1276,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
if (detail.getBuyType() != CommonConstants.FOUR_INT) {
//生成收入数据
createInsuranceInfo(detail);
}
}else {
//按天
//计算起止时间的天数
......@@ -1290,10 +1312,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
}
if (detail.getBuyType() != CommonConstants.FOUR_INT) {
//生成收入数据
createInsuranceInfo(detail);
}
}
}
//实缴
if(detail.getSettleType() == CommonConstants.ONE_INT){
if (detail.getBuyType() == CommonConstants.THREE_INT){
......@@ -1367,6 +1391,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
if(paramList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
......@@ -1409,6 +1436,21 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
detail.setUpdateBy(user.getId());
detail.setUpdateTime(LocalDateTime.now());
//如果当前为合并结算,判断预估是否已发送
if(StringUtils.isNotBlank(detail.getDefaultSettleId()) && detail.getSettleType() == CommonConstants.ZERO_INT){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
Integer isEstimatePush = settle.getIsEstimatePush();
//如果未推送则推送预估新增
if(isEstimatePush == CommonConstants.ZERO_INT){
String s = pushEstimate(detail, CommonConstants.ONE_INT);
if(StringUtils.isNotBlank(s)){
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
}
}
}
if (StringUtils.isNotBlank(success.getPolicyNo())){
detail.setPolicyNo(success.getPolicyNo());
//如果保单号不为空,将替换类型的保单号也全部更新
......@@ -1472,7 +1514,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
});
}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);
......@@ -1545,7 +1586,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
boolean booleanInvoiceNo = StringUtils.isNotBlank(invoiceNo) && !invoiceNo.equals(detail.getInvoiceNo());
boolean booleanPolicyNo = StringUtils.isNotBlank(policyNo) && !policyNo.equals(detail.getPolicyNo());
//如果当前保费为空,且保单号或发票号不一样
if((StringUtils.isBlank(success.getActualPremium()) || new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) == 0) && (!booleanInvoiceNo || !booleanPolicyNo)){
if((StringUtils.isBlank(success.getActualPremium()) || new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) == 0) && (booleanInvoiceNo || booleanPolicyNo)){
if(StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if(Optional.ofNullable(settle).isPresent()){
......@@ -3105,6 +3146,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if(!Common.isNotEmpty(insuranceRefundCheckList)){
return R.failed("当前导入的减员信息为空");
}
if(insuranceRefundCheckList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<InsuranceRefundCheck>> refundMap = checkInsuranceRefundList(insuranceRefundCheckList,user);
List<InsuranceRefundCheck> successList = refundMap.get("successList");
List<TInsuranceOperate> operateList = new ArrayList<>();
......@@ -3193,17 +3237,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @return {@link List< InsuredListVo>}
*/
@Override
public List<InsuredListVo> getInsuredList(InsuredParam param) {
public R getInsuredList(InsuredParam param) {
YifuUser user = SecurityUtils.getUser();
List<String> deptList = getDeptNoList(user);
List<InsuredListVo> insuredList = new ArrayList<>();
if (CollectionUtils.isEmpty(deptList)){
return insuredList;
return R.ok(insuredList);
}
param.setDeptNoList(deptList);
param.setDeptNoList(deptList);
insuredList = this.baseMapper.getInsuredList(param);
if (CollectionUtils.isNotEmpty(insuredList)){
if(insuredList.size() > CommonConstants.EXPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
//根据项目编码获取项目名称
List<String> collect = insuredList.stream().map(InsuredListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
......@@ -3219,7 +3266,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
return insuredList;
return R.ok(insuredList);
}
/**
......@@ -3266,16 +3313,19 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @return {@link List< InsuranceRefundListVo >}
*/
@Override
public List<InsuranceRefundListVo> getInsuranceRefundList(InsuranceRefundParam param) {
public R getInsuranceRefundList(InsuranceRefundParam param) {
YifuUser user = SecurityUtils.getUser();
List<String> deptNoList = getDeptNoList(user);
List<InsuranceRefundListVo> pageList = new ArrayList<>();
if(CollectionUtils.isEmpty(deptNoList)){
return pageList;
return R.ok(pageList);
}
param.setDeptNoList(deptNoList);
List<InsuranceRefundListVo> insuranceRefundList = this.baseMapper.getInsuranceRefundList(param);
if (CollectionUtils.isNotEmpty(insuranceRefundList)){
if(insuranceRefundList.size() > CommonConstants.EXPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.EXPORT_TOO_LONG);
}
//根据项目编码获取项目名称
List<String> collect = insuranceRefundList.stream().map(InsuranceRefundListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
......@@ -3292,7 +3342,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
return insuranceRefundList;
return R.ok(insuranceRefundList);
}
/**
......@@ -3343,7 +3393,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<RefundExportListVo>> getInsuranceRefundHandlingList(RefundExportListParam param){
public R getInsuranceRefundHandlingList(RefundExportListParam param){
YifuUser user = SecurityUtils.getUser();
List<RefundExportListVo> refundExportList;
String regionSQL = getRegionSQL(user);
......@@ -3355,6 +3405,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
refundExportList = baseMapper.getRefundExportList(param);
}
if (CollectionUtils.isNotEmpty(refundExportList)){
if(refundExportList.size() > CommonConstants.EXPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.EXPORT_TOO_LONG);
}
List<TInsuranceDetail> detailList = new ArrayList<>();
List<TInsuranceRefund> refundList = new ArrayList<>();
//根据项目编码获取项目名称
......@@ -3497,9 +3550,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Override
public R insuranceRefundImport(List<InsuranceHandleImportParam> insuranceRefundImportList) {
YifuUser user = SecurityUtils.getUser();
if (!Common.isNotEmpty(insuranceRefundImportList)) {
if (CollectionUtils.isEmpty(insuranceRefundImportList)) {
return R.failed(InsurancesConstants.INSURANCE_REFUND_IMPORT_LIST_IS_EMPTY);
}
if(insuranceRefundImportList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<InsuranceHandleImportParam>> map = insuranceChangeCheck(insuranceRefundImportList, user,true);
List<InsuranceHandleImportParam> successList = map.get("successList");
List<InsuranceHandleImportParam> errorList = map.get("errorList");
......@@ -3562,6 +3618,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (!Common.isNotEmpty(settleMonthCheckList)) {
return R.failed(InsurancesConstants.SETTLE_MONTH_CHANGE_LIST_IS_EMPTY);
}
if(settleMonthCheckList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<SettleMonthChangeCheckParam>> map = settleMonthChangeCheck(settleMonthCheckList, user);
List<SettleMonthChangeCheckParam> successList = map.get("successList");
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
......@@ -3646,6 +3705,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if(!Common.isNotEmpty(deptChangeCheckList)){
return R.failed(InsurancesConstants.OPERATION_LIST_IS_EMPTY);
}
if(deptChangeCheckList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
Map<String, List<DeptChangeCheckParam>> stringListMap = deptChangeCheck(deptChangeCheckList,user);
List<DeptChangeCheckParam> successList = stringListMap.get("successList");
List<TInsuranceOperate> operateList = new ArrayList<>(16);
......@@ -3759,7 +3821,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
//推送预估单
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(null);
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
String estimateBody = eKPInsuranceUtil.sendToEkp(interactiveParam);
if (StringUtils.isNotBlank(estimateBody)) {
......@@ -3769,7 +3831,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.updateById(newInsuranceSettle);
//推送实缴单
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(null);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
String actualBody = eKPInsuranceUtil.sendToEkp(interactiveParam);
if (StringUtils.isNotBlank(actualBody)) {
......@@ -3785,8 +3847,54 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
//推送实缴单
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}
}else{
//保存作废信息
saveInsuranceEkp(interactiveParam,CommonConstants.FOUR_INT);
//保存预估信息
//变更后为单独结算
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);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
//保存实缴信息
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
//变更后为单独结算
if (CommonConstants.ZERO_INT == newSettleType) {
//先推送预估,再推送实际
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
//保存预估信息
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
//保存实缴信息
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}
}else{
//变更后为单独结算
......@@ -3824,7 +3932,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
//推送预估单
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(null);
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
String estimateBody = eKPInsuranceUtil.sendToEkp(interactiveParam);
if (StringUtils.isNotBlank(estimateBody)) {
......@@ -3834,7 +3942,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.updateById(newInsuranceSettle);
//推送实缴单
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(null);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
String actualBody = eKPInsuranceUtil.sendToEkp(interactiveParam);
if (StringUtils.isNotBlank(actualBody)) {
......@@ -3850,6 +3958,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
//推送实缴单
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}
}
......@@ -3984,23 +4097,77 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
String actualBody = eKPInsuranceUtil.sendToEkp(interactiveParam);
String estimateBody = eKPInsuranceUtil.sendToEkp(interactiveParam);
//推送成功,更新预估和实际保费的推送状态
if(StringUtils.isNotBlank(actualBody)){
newInsuranceSettle.setIsEstimatePush(CommonConstants.ONE_INT);
if (StringUtils.isNotBlank(estimateBody)) {
newInsuranceSettle.setEstimatePushTime(LocalDateTime.now());
newInsuranceSettle.setIsActualPush(CommonConstants.ONE_INT);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ONE_INT);
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
//推送实缴单
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
String actualBody = eKPInsuranceUtil.sendToEkp(interactiveParam);
if (StringUtils.isNotBlank(actualBody)) {
//推送成功后更新本地推送状态
newInsuranceSettle.setActualPushTime(LocalDateTime.now());
newInsuranceSettle.setIsActualPush(CommonConstants.ONE_INT);
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
//推送实缴单
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.FOUR_INT);
//变更为单独结算
if (CommonConstants.ONE_INT == newSettleType){
//推送新的结算信息至EKP,推实际保费
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.NOTHING);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
//变更为单独结算
if (CommonConstants.ZERO_INT == newSettleType){
// 推送新的结算信息
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
//推送实缴单
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}
}
//如果预估已推送和实缴未推送
......@@ -4052,7 +4219,30 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
//推送实缴单
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}else{
//保存预估推送失败的数据
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
//保存实缴推送失败的数据
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}
//如果预估和实缴均未推送
......@@ -4093,6 +4283,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}
}
......@@ -4121,7 +4315,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
//新增新的结算信息
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
......@@ -4157,6 +4350,21 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}else{
saveInsuranceEkp(interactiveParam,CommonConstants.FOUR_INT);
//变更为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
//推送新的结算信息至EKP
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
}
}
}else{
//推送新的结算信息至EKP
......@@ -5614,7 +5822,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceSettle byId = tInsuranceSettleService.getById(defaultSettleId);
//冲正取负数
if(null != byId.getEstimatePremium()){
param.setEstimatePremium(byId.getEstimatePremium().negate());
param.setEstimatePremium(byId.getEstimatePremium());
}
param.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
......@@ -5626,17 +5834,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceSettle byId = tInsuranceSettleService.getById(defaultSettleId);
//冲正取负数
if(null != byId.getActualPremium()){
param.setActualPremium(byId.getActualPremium().negate());
param.setActualPremium(byId.getActualPremium());
}
param.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.FIVE_INT;
pushType = CommonConstants.SIX_INT;
}
//4更新实际保费(用于登记保单保费场景推送过实缴保费)
if(CommonConstants.FOUR_INT == type){
param.setInteractiveType(InsurancesConstants.UPDATE_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.SEVEN_INT;
pushType = CommonConstants.THREE_INT;
}
//作废
if(CommonConstants.FIVE_INT == type){
......@@ -5688,6 +5896,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
ekp.setId(null);
ekp.setCreateTime(LocalDateTime.now());
ekp.setPushType(pushType);
TInsuranceDetail byId = getById(param.getDetailId());
ekp.setSettleType(byId.getSettleType().toString());
tInsuranceEkpService.save(ekp);
return Boolean.TRUE;
}
......@@ -5716,7 +5926,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
incomeDetail.setDeptNo(insuranceDetail.getDeptNo());
incomeDetail.setSourceType(CommonConstants.THREE_STRING);
R<TIncomeDetailReturnVo> detailList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if(Common.isNotNull(detailList) && detailList.getCode() == CommonConstants.SUCCESS){
if(Common.isNotNull(detailList) && detailList.getCode() == CommonConstants.SUCCESS
&& detailList.getData().getDetailList().size() > 0){
isExist = true;
}
......@@ -5724,7 +5935,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有商险,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem().contains(CommonConstants.THREE_STRING)) {
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())) {
......@@ -5754,7 +5966,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem().contains(CommonConstants.THREE_STRING)) {
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem()
.contains(CommonConstants.THREE_STRING)) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType()) &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
......@@ -5804,13 +6017,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setSourceId(insuranceDetail.getId());
detail.setSourceType(CommonConstants.THREE_STRING);
detail.setCreateMonth(DateUtil.getYearAndMonth(insuranceDetail.getHandledTime(),0));
detail.setPayMonth(insuranceDetail.getSettleMonth());
detail.setPayMonth(insuranceDetail.getSettleMonth().replace("-",""));
detail.setMoney(money);
detail.setFeeType(feeType);
detail.setFeeMode(feeMode);
detail.setCharges(charges);
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setId(CommonConstants.NULL);
detail.setRedData(CommonConstants.ZERO_STRING);
socialDaprUtils.createTIncomeDetail(detail);
}
......@@ -5823,14 +6037,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
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.setId(CommonConstants.NULL);
detail1.setRedData(CommonConstants.ONE_STRING);
detail1.setMoney(detail1.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1);
}
}
}
}
}
......@@ -6,6 +6,7 @@ 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.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
......@@ -58,183 +59,205 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T
@Override
public R resend() {
List<TInsuranceEkp> ekpRefundList = this.baseMapper.getEkpRefundList();
List<TInsuranceEkp> failList = new ArrayList<>();
List<TInsuranceEkp> successLit = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ekpRefundList)){
for (TInsuranceEkp tInsuranceEkp : ekpRefundList) {
TInsuranceDetail byId = tInsuranceDetailService.getById(tInsuranceEkp.getDetailId());
String defaultSettleId = byId.getDefaultSettleId();
if (tInsuranceEkp.getDefaultSettleId().equals(defaultSettleId)){
//ekp结算信息
SettleVo settleVo = tInsuranceDetailService.getInsuranceDetailSettleStatus(tInsuranceEkp.getDetailId(), tInsuranceEkp.getDefaultSettleId());
String s = null;
String settleType = tInsuranceEkp.getSettleType();
Integer pushType = tInsuranceEkp.getPushType();
//商险结算信息
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;
}
//如果当前需要重发实际保费的数据已发送,则过滤掉执行下一条数据
if(CommonConstants.TWO_INT == pushType && CommonConstants.ONE_INT == isActualPush){
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
continue;
}
//结算id是否一致
boolean settleIdEquals = tInsuranceEkp.getDefaultSettleId().equals(defaultSettleId);
//预估是否已发送
boolean estimatePush = Common.isEmpty(insuranceSettle) || insuranceSettle.getIsEstimatePush() == CommonConstants.ZERO_INT;
//实缴是否已发送
boolean actualPush = Common.isEmpty(insuranceSettle) || insuranceSettle.getIsActualPush() == CommonConstants.ZERO_INT;
//结算类型是否一致
boolean settleTypeEquals = settleType.equals(byId.getSettleType().toString());
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);
LambdaUpdateWrapper<TInsuranceSettle> settleUpdate = new LambdaUpdateWrapper<>();
settleUpdate.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId());
LambdaUpdateWrapper<TInsuranceDetail> detailUpdate = new LambdaUpdateWrapper<>();
detailUpdate.eq(TInsuranceDetail :: getId,tInsuranceEkp.getDetailId());
LambdaUpdateWrapper<TInsuranceEkp> ekpUpdate = new LambdaUpdateWrapper<>();
ekpUpdate.eq(TInsuranceEkp :: getId,tInsuranceEkp.getId());
//ekp结算信息
SettleVo settleVo = tInsuranceDetailService.getInsuranceDetailSettleStatus(tInsuranceEkp.getDetailId(), tInsuranceEkp.getDefaultSettleId());
if(settleType.equals(CommonConstants.ZERO_STRING)){
ekpParam.setEstimateStatus(EkpConstants.HAVE);
}else{
ekpParam.setEstimateStatus(EkpConstants.NOTHING);
}
//预估新增重发
if(CommonConstants.ONE_INT == pushType){
//如果结算类型不一致,预估已推送,结算id不一致,结算信息不为空
if(!settleTypeEquals || !settleIdEquals || !estimatePush){
if(!settleTypeEquals){
ekpUpdate.set(TInsuranceEkp :: getNotResendMessage,CommonConstants.TWO_INT);
}
//如果是新增实缴保费,则推送实缴保费新增
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(!settleIdEquals){
ekpUpdate.set(TInsuranceEkp :: getNotResendMessage,CommonConstants.TWO_INT);
}
if(!estimatePush){
ekpUpdate.set(TInsuranceEkp :: getNotResendMessage,CommonConstants.TWO_INT);
}
//如果是变更结算信息,则推送变更结算信息
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);
ekpUpdate.set(TInsuranceEkp :: getResendFlag,CommonConstants.TWO_INT);
update(ekpUpdate);
if(!Common.isEmpty(settleVo)){
settleUpdate.set(TInsuranceSettle :: getEstimatePushTime,LocalDateTime.now())
.set(TInsuranceSettle ::getIsEstimatePush,CommonConstants.ONE_INT);
tInsuranceSettleService.update(settleUpdate);
}
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{
ekpParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
settleUpdate.set(TInsuranceSettle :: getEstimatePushTime,LocalDateTime.now())
.set(TInsuranceSettle ::getIsEstimatePush,CommonConstants.ONE_INT);
tInsuranceSettleService.update(settleUpdate);
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT)
.set(TInsuranceEkp :: getPushTime ,LocalDateTime.now());
update(ekpUpdate);
}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);
}
//实缴新增重发
if(CommonConstants.TWO_INT == pushType){
//如果结算类型不一致,实缴已推送,结算id不一致,则不再推送
if(!settleTypeEquals || !actualPush || !settleIdEquals){
ekpUpdate.set(TInsuranceEkp :: getResendFlag,CommonConstants.TWO_INT);
update(ekpUpdate);
continue;
}else{
ekpParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
if(StringUtils.isNotBlank(s)){
settleUpdate.set(TInsuranceSettle :: getActualPushTime,LocalDateTime.now())
.set(TInsuranceSettle ::getIsActualPush,CommonConstants.ONE_INT);
tInsuranceSettleService.update(settleUpdate);
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT)
.set(TInsuranceEkp :: getPushTime ,LocalDateTime.now());
update(ekpUpdate);
}else{
break;
}
}
if(CommonConstants.SIX_INT == pushType){
}
//实缴结算状态
String actualStatus = null;
//预缴结算状态
String estimateStatus = null;
if(!Common.isEmpty(settleVo) ){
estimateStatus = settleVo.getEstimateStatus();
actualStatus = settleVo.getActualStatus();
}
boolean eStatus = InsurancesConstants.SETTLE_ZERO.equals(estimateStatus);
boolean aStatus = InsurancesConstants.SETTLE_ZERO.equals(actualStatus);
//变更结算信息
if(CommonConstants.THREE_INT == pushType){
//如果结算类型不一致,结算类型不为空且已发送,结算id不一致
if(!settleIdEquals || !eStatus || !aStatus){
ekpUpdate.set(TInsuranceEkp :: getResendFlag,CommonConstants.TWO_INT);
update(ekpUpdate);
continue;
}else{
ekpParam.setInteractiveType(InsurancesConstants.UPDATE_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
if(StringUtils.isNotBlank(s)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT)
.set(TInsuranceEkp :: getPushTime ,LocalDateTime.now());
update(ekpUpdate);
}else{
break;
}
}else{
//推送预估新增,实缴新增,变更结算信息,作废,则不进行重发
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(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);
//如果结算类型不一致,结算类型不为空且已发送,结算id不一致
if(eStatus && aStatus){
ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
ekpParam.setInteractiveType(InsurancesConstants.ABOLISH_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
if(StringUtils.isNotBlank(s)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT)
.set(TInsuranceEkp :: getPushTime ,LocalDateTime.now());
update(ekpUpdate);
}else{
break;
}
} else if(CommonConstants.FIVE_INT == pushType){
//如果是预估红冲信息,则推送预估红冲信息
}
if(!eStatus || !aStatus){
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
//如果为合并结算,则推送预估红冲
if(settleType.equals(CommonConstants.ZERO_STRING) && actualPush){
BigDecimal estimatePremium = ekpParam.getEstimatePremium();
ekpParam.setEstimatePremium(estimatePremium.negate());
ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
if(StringUtils.isNotBlank(s)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT)
.set(TInsuranceEkp :: getPushTime ,LocalDateTime.now());
update(ekpUpdate);
}else{
break;
}
}else{
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
}
}else{
//如果是实缴红冲信息,则推送实缴红冲信息
if(CommonConstants.SIX_INT == pushType){
//如果为合并结算,则推送实缴红冲
if(!actualPush){
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
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);
if(StringUtils.isNotBlank(s)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT)
.set(TInsuranceEkp :: getPushTime ,LocalDateTime.now());
update(ekpUpdate);
}else{
break;
}
}
}else{
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
ekpUpdate.set(TInsuranceEkp :: getResendFlag,CommonConstants.TWO_INT);
update(ekpUpdate);
continue;
}
}
//推送预估红冲信息
if(CommonConstants.FIVE_INT == pushType){
ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT)
.set(TInsuranceEkp :: getPushTime ,LocalDateTime.now());
update(ekpUpdate);
}else{
break;
}
}
//推送实缴红冲信息
if(CommonConstants.SIX_INT == pushType){
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT)
.set(TInsuranceEkp :: getPushTime ,LocalDateTime.now());
update(ekpUpdate);
}else{
//结算id与当前不一致则不进行重发
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
break;
}
}
}
updateBatchById(failList);
return R.ok("发送成功");
}else{
return R.failed("无需要发送的信息");
......
......@@ -32,7 +32,8 @@
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="pushTime" column="PUSH_TIME" jdbcType="TIMESTAMP"/>
<result property="pushType" column="PUSH_TYPE" jdbcType="TINYINT"/>
<result property="settleType" column="SETTLE_TYPE" jdbcType="VARCHAR"/>
<result property="notResendMessage" column="NOT_RESEND_MESSAGE" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -44,7 +45,7 @@
POLICY_END,BUY_STANDARD,MEDICAL_QUOTA,
DIE_DISABLE_QUOTA,ACTUAL_PREMIUM,ESTIMATE_PREMIUM,
SETTLE_MONTH,INTERACTIVE_TYPE,RESEND_FLAG,
CREATE_TIME,PUSH_TIME,PUSH_TYPE
CREATE_TIME,PUSH_TIME,PUSH_TYPE,SETTLE_TYPE,NOT_RESEND_MESSAGE
</sql>
<select id="getEkpRefundList" resultMap="BaseResultMap">
......@@ -54,6 +55,7 @@
t_insurance_ekp
where
RESEND_FLAG = 0
order by CREATE_TIME asc
</select>
......
......@@ -110,4 +110,8 @@ public class OrderConstants {
* 附件超出上传上限
*/
public static final String ENCLOSURE_SIZE_ERROR = "附件超出上传上限";
/**
* 一次性导出不可超过20000条,请分批导出
*/
public static final String EXPORT_TOO_LONG = "一次性导出不可超过20000条,请分批导出";
}
......@@ -60,7 +60,7 @@ public class OrderController {
@GetMapping("/getOrderList")
@PreAuthorize("@pms.hasPermission('order:order_getOrderList')")
public R<List<OrderListVO>> getOrderList(OrderListParam param) {
return R.ok(tOrderService.getOrderList(param));
return tOrderService.getOrderList(param);
}
/**
......
......@@ -34,9 +34,9 @@ public interface TOrderService extends IService<TOrder> {
*
* @author licancan
* @param param
* @return {@link List<OrderListVO>}
* @return {@link R<List<OrderListVO>>}
*/
List<OrderListVO> getOrderList(OrderListParam param);
R<List<OrderListVO>> getOrderList(OrderListParam param);
/**
* 变更订单状态
......
......@@ -83,7 +83,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
* @author licancan
*/
@Override
public List<OrderListVO> getOrderList(OrderListParam param) {
public R<List<OrderListVO>> getOrderList(OrderListParam param) {
YifuUser user = SecurityUtils.getUser();
List<OrderListVO> list;
if (CollectionUtils.isNotEmpty(param.getIdList())){
......@@ -91,7 +91,12 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
}else {
list = baseMapper.getOrderList(param,user.getUsername());
}
return list;
if (CollectionUtils.isNotEmpty(list)){
if(list.size() > CommonConstants.EXPORT_TWENTY_THOUSAND){
return R.failed(OrderConstants.EXPORT_TOO_LONG);
}
}
return R.ok(list);
}
/**
......
......@@ -21,14 +21,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TApprovalRecord;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
import com.yifu.cloud.plus.v1.yifu.salary.service.TApprovalRecordService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardService;
import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
......@@ -56,9 +53,6 @@ public class TSalaryStandardController {
private final TSalaryStandardService tSalaryStandardService;
private final TApprovalRecordService auditLogService;
/**
* 简单分页查询-申请
*
......@@ -184,15 +178,8 @@ public class TSalaryStandardController {
|| s.getStatus() == SalaryConstants.STATUS[7]) {
YifuUser user = SecurityUtils.getUser();
if (user != null) {
TApprovalRecord tApprovalRecord = new TApprovalRecord();
tApprovalRecord.setApprovalResult(CommonConstants.TWO_STRING);
tApprovalRecord.setApprovalOpinion(tSalaryStandard.getRemark());
tApprovalRecord.setSalaryId(tSalaryStandard.getId());
tApprovalRecord.setNodeId("提交审核");
tApprovalRecord.setApprovalMan(user.getId());
tApprovalRecord.setApprovalManName(user.getNickname());
tApprovalRecord.setApprovalTime(DateUtil.getCurrentDateTime());
auditLogService.save(tApprovalRecord);
// 添加流程进展明细
tSalaryStandardService.saveRecordLog(s, user, CommonConstants.TWO_STRING, "提交审核");
tSalaryStandard.setSubmitTime(new Date());
tSalaryStandard.setStatus(CommonConstants.ONE_INT);
tSalaryStandardService.updateById(tSalaryStandard);
......
......@@ -58,6 +58,16 @@ public interface TSalaryAccountItemMapper extends BaseMapper<TSalaryAccountItem>
**/
List<TSalaryAccountItem> getAllItemVoList(@Param("idCardList") List<String> idCardList, @Param("invoiceTitle") String invoiceTitle);
/**
* @param idCardList
* @param invoiceTitle
* @Description: 获取所有工资报账,组装map,计算年终奖使用
* @Author: hgw
* @Date: 2022/1/27 17:04
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>
**/
List<TSalaryAccountItem> getSalaryItemVoList(@Param("idCardList") List<String> idCardList, @Param("invoiceTitle") String invoiceTitle);
/**
* @param deptId 结算主体id
* @param javaFiedName 属性名
......
......@@ -20,7 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam;
import com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.vo.AccountCheckVo;
......@@ -40,6 +40,7 @@ import java.util.List;
public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
/**
* 工资报账主表(工资条)简单分页查询
*
* @param tSalaryAccount 工资报账主表(工资条)
* @return
*/
......@@ -49,14 +50,14 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
* @param settleId
* @param settleMonth
* @Description: 版本2.6.6判重:对同一“结算主体”、同一“结算月份”、同一“报表类型”、同一“工资月份”、同一“身份证号”、同一“应发金额”进行校验
*
* <p>
* 校验导入数据重复的Map格式:# 身份证号_工资月份_报表类型_应发金额
*
* @Author: hgw
* @Date: 2021/9/17 18:06
* @return: java.util.List<java.lang.String>
**/
List<AccountCheckVo> getAccountCheckList(@Param("settleId") String settleId, @Param("settleMonth") String settleMonth);
List<AccountCheckVo> getAccountSpecialList(@Param("invoiceTitle") String invoiceTitle, @Param("unitId") String unitId, @Param("salaryMonth") String salaryMonth);
List<AccountCheckVo> getAccountCheckListLabor(@Param("settleId") String settleId, @Param("settleMonth") String settleMonth);
......@@ -72,15 +73,15 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
String getMinTaxMonthByNowYear(@Param("empIdCard") String empIdCard, @Param("nowYear") int nowYear);
/**
* @return
* @Author fxj
* @Description 获取有工资无社保数据
* @Date 17:23 2022/8/16
* @Param
* @return
**/
List<THaveSalaryNosocial> getLastMonthTHaveSalaryNosocial(@Param("month")String month,
@Param("month2")String month2,
@Param("month3")String month3);
List<THaveSalaryNosocial> getLastMonthTHaveSalaryNosocial(@Param("month") String month,
@Param("month2") String month2,
@Param("month3") String month3);
/**
* @Description: 薪资类型互斥校验 获取本年度身份证号列表
......@@ -97,10 +98,10 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
* @Date: 2022/8/29 16:52
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam>
**/
List<EkpSalaryParamVo> getEkpSalaryParamList(@Param("salaryId") String salaryId);
List<EkpSalaryParam> getEkpSalaryParamList(@Param("salaryId") String salaryId);
List<TSalaryAccount> noPageDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList")List<String> idList);
@Param("idList") List<String> idList);
/**
* @Description: 根据工资id,返回报账明细(字段较少且有计算,其他地方勿用)
......@@ -111,5 +112,5 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
List<TSalaryAccount> getListByIncome(@Param("salaryId") String salaryId);
int noPageCountDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList")List<String> idList);
@Param("idList") List<String> idList);
}
......@@ -41,6 +41,15 @@ public interface TSalaryAccountItemService extends IService<TSalaryAccountItem>
**/
Map<String, List<TSalaryAccountItem>> getAllItemVoList(List<String> idCardList, String invoiceTitle);
/**
* @param idCardList
* @param invoiceTitle
* @Description: 获取所有工资报账,组装map,计算年终奖使用
* @Author: huyc
* @Date: 2022/1/27 17:25
* @return: java.util.Map<java.lang.String, java.util.List < com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>>
**/
Map<String, List<TSalaryAccountItem>> getSalaryItemVoList(List<String> idCardList, String invoiceTitle);
/**
* 工资报账表附加-工资明细简单分页查询
......
......@@ -20,7 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam;
import com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo;
......@@ -104,5 +104,5 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
* @Date: 2022/8/29 16:54
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam>
**/
List<EkpSalaryParamVo> getEkpSalaryParamList(String salaryId);
List<EkpSalaryParam> getEkpSalaryParamList(String salaryId);
}
......@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
......@@ -79,5 +80,19 @@ public interface TSalaryStandardService extends IService<TSalaryStandard> {
**/
R<String> doSend(String id);
/**
* @Description: 分页查询-申请
* @Author: hgw
* @Date: 2022/9/6 16:02
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard>
**/
IPage<TSalaryStandard> getTSalaryStandardPageApply(Page<TSalaryStandard> page, TSalaryStandardSearchVo tSalaryStandard);
/**
* @Description: 添加流程进展明细
* @Author: hgw
* @Date: 2022/9/6 15:59
* @return: void
**/
void saveRecordLog(TSalaryStandard tSalaryStandard, YifuUser user, String status, String nodeId);
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TDepartSettlementInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
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.constant.SecurityConstants;
......@@ -484,15 +485,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
String checkYearFinalStyle; //薪资和年终奖扣税方案(0:合并;1:单独)
List<TSalaryTaxConfig> personTax = tSalaryTaxConfigService.getTaxConfigByPersonList(new TSalaryTaxConfig());
List<TSalaryTaxConfig> annousTax = tSalaryTaxConfigService.getTaxConfigByAnnualBonusList(new TSalaryTaxConfig());
//结算主体-薪资配置
TDepartSettlementInfo deptSet = null;
R<TDepartSettlementInfo> deptSetR = HttpDaprUtil.invokeMethodPost(archivesProperties.getAppUrl(), archivesProperties.getAppId()
, "/tsettledomain/inner/getInnerBySettlementId", dept.getId(), TDepartSettlementInfo.class, SecurityConstants.FROM_IN);
if (deptSetR == null || deptSetR.getData() == null || Common.isEmpty(deptSetR.getData().getId())) {
return R.failed("请去EKP系统-项目模块编辑结算主体 " + dept.getDepartName() + "(" + dept.getDepartNo() + ")的结算配置!");
} else {
deptSet = deptSetR.getData();
}
int size = savList.size();
TSalaryAccountItem annousSai;
// 自有员工人数
......@@ -608,12 +600,12 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if (modelPersonSocialFlag) {
personalDebt = personalDebt.add(this.saveNewItems(saiList, SalaryConstants.PERSONAL_SOCIAL,
SalaryConstants.PERSONAL_SOCIAL_JAVA,
this.getSocialOrFundMoneyForForecast(socialType, deptSet, a.getEmpIdcard(), socialEstmateList, socialForecastList, true, true, socialList, fundList, forecastSocialList, forecastFundList), CommonConstants.ONE_INT));
this.getSocialOrFundMoneyForForecast(socialType, dept, a.getEmpIdcard(), socialEstmateList, socialForecastList, true, true, socialList, fundList, forecastSocialList, forecastFundList), CommonConstants.ONE_INT));
}
if (modelUnitSocialFlag) {
this.saveNewItems(saiList, SalaryConstants.UNIT_SOCIAL,
SalaryConstants.UNIT_SOCIAL_JAVA,
this.getSocialOrFundMoneyForForecast(socialType, deptSet, a.getEmpIdcard(), socialEstmateList, socialForecastList, true, false, socialList, fundList, forecastSocialList, forecastFundList), CommonConstants.ZERO_INT);
this.getSocialOrFundMoneyForForecast(socialType, dept, a.getEmpIdcard(), socialEstmateList, socialForecastList, true, false, socialList, fundList, forecastSocialList, forecastFundList), CommonConstants.ZERO_INT);
}
}
if (Common.isEmpty(a.getIsDeductFund()) || SalaryConstants.IS_DEDUCT_ONE.equals(a.getIsDeductFund())) {
......@@ -622,12 +614,12 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
if (modelPersonFundFlag) {
personalDebt = personalDebt.add(this.saveNewItems(saiList, SalaryConstants.PERSONAL_FUND,
SalaryConstants.PERSONAL_FUND_JAVA,
this.getSocialOrFundMoneyForForecast(fundType, deptSet, a.getEmpIdcard(), fundEstmateList, fundForecastList, false, true, socialList, fundList, forecastSocialList, forecastFundList), CommonConstants.ONE_INT));
this.getSocialOrFundMoneyForForecast(fundType, dept, a.getEmpIdcard(), fundEstmateList, fundForecastList, false, true, socialList, fundList, forecastSocialList, forecastFundList), CommonConstants.ONE_INT));
}
if (modelUnitFundFlag) {
this.saveNewItems(saiList, SalaryConstants.UNIT_FUND,
SalaryConstants.UNIT_FUND_JAVA,
this.getSocialOrFundMoneyForForecast(fundType, deptSet, a.getEmpIdcard(), fundEstmateList, fundForecastList, false, false, socialList, fundList, forecastSocialList, forecastFundList), CommonConstants.ZERO_INT);
this.getSocialOrFundMoneyForForecast(fundType, dept, a.getEmpIdcard(), fundEstmateList, fundForecastList, false, false, socialList, fundList, forecastSocialList, forecastFundList), CommonConstants.ZERO_INT);
}
}
}
......@@ -1054,14 +1046,14 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
* @Date: 2019/9/26 15:38
* @return: java.math.BigDecimal
**/
public BigDecimal getSocialOrFundMoneyForForecast(String socialFundType, TDepartSettlementInfo deptSet, String idNumber
public BigDecimal getSocialOrFundMoneyForForecast(String socialFundType, TSettleDomain dept, String idNumber
, List<TPaymentBySalaryVo> estmateList, List<TPaymentBySalaryVo> forecastList, boolean isSocial, boolean isPerson
, Set<String> socialList, Set<String> fundList, Set<String> forecastSocialList, Set<String> forecastFundList) {
BigDecimal money = SalaryConstants.B_ZERO;
BigDecimal sub = SalaryConstants.B_ZERO;
if (isSocial && deptSet.getUnitSeriousIllnessProp() != null
&& deptSet.getUnitSeriousIllnessProp().compareTo(SalaryConstants.B_ONEHUNDRED) < SalaryConstants.EQUAL) {
sub = (new BigDecimal("100").subtract(deptSet.getUnitSeriousIllnessProp()))
if (isSocial && dept.getUnitSeriousIllnessProp() != null
&& dept.getUnitSeriousIllnessProp().compareTo(SalaryConstants.B_ONEHUNDRED) < SalaryConstants.EQUAL) {
sub = (new BigDecimal("100").subtract(dept.getUnitSeriousIllnessProp()))
.divide(SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
}
if (CommonConstants.ZERO_STRING.equals(socialFundType) && estmateList != null && !estmateList.isEmpty()) {
......
......@@ -100,6 +100,32 @@ public class TSalaryAccountItemServiceImpl extends ServiceImpl<TSalaryAccountIte
return itemMap;
}
/**
* @param idCardList
* @param invoiceTitle
* @Description: 获取所有工资报账,组装map,计算年终奖使用
* @Author: hgw
* @Date: 2022/1/27 17:25
* @return: java.util.Map<java.lang.String, java.util.List < com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>>
**/
@Override
public Map<String, List<TSalaryAccountItem>> getSalaryItemVoList(List<String> idCardList, String invoiceTitle) {
List<TSalaryAccountItem> list = baseMapper.getSalaryItemVoList(idCardList, invoiceTitle);
Map<String, List<TSalaryAccountItem>> itemMap = new HashMap<>();
if (list != null && !list.isEmpty()) {
List<TSalaryAccountItem> voList;
for (TSalaryAccountItem item : list) {
voList = itemMap.get(item.getEmpIdcard());
if (voList == null) {
voList = new ArrayList<>();
}
voList.add(item);
itemMap.put(item.getEmpIdcard(), voList);
}
}
return itemMap;
}
/**
* @param settleDepartId 结算主体id
* @param javaFiedName 属性名
......
......@@ -26,7 +26,7 @@ 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.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam;
import com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryAccountMapper;
......@@ -212,7 +212,7 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
}
@Override
public List<EkpSalaryParamVo> getEkpSalaryParamList(String salaryId) {
public List<EkpSalaryParam> getEkpSalaryParamList(String salaryId) {
return baseMapper.getEkpSalaryParamList(salaryId);
}
......
......@@ -35,7 +35,6 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpSalaryUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo;
import com.yifu.cloud.plus.v1.yifu.salary.entity.MSalaryEstimate;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TApprovalRecord;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
......@@ -49,9 +48,9 @@ import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeDetailReturnVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service;
......@@ -92,6 +91,9 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
@Autowired
private EkpSalaryUtil ekpSalaryUtil;
@Autowired
private TApprovalRecordService auditLogService;
/**
* 标准薪酬工资表简单分页查询
*
......@@ -311,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()
+ CommonConstants.DOWN_LINE_STRING + incomeDetail.getSourceType());
if (Common.isEmpty(value)) {
value = CommonConstants.ZERO_INT;
......@@ -322,6 +325,7 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
value--;
}
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getDeptId() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getFeeType() + CommonConstants.DOWN_LINE_STRING
+ incomeDetail.getSourceType(), value);
}
......@@ -510,7 +514,7 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
return R.failed("未找到工资表");
} else if (s.getStatus() == SalaryConstants.STATUS[2] || s.getStatus() == SalaryConstants.STATUS[10]) {
//报账表
List<EkpSalaryParamVo> ekpList = salaryAccountService.getEkpSalaryParamList(id);
List<EkpSalaryParam> ekpList = salaryAccountService.getEkpSalaryParamList(id);
YifuUser user = SecurityUtils.getUser();
if (user != null && ekpList != null && !ekpList.isEmpty()) {
boolean sendStatus = true;
......@@ -519,14 +523,14 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
TSalaryAccount account;
Date sendTime = new Date();
String nowMonth = DateUtil.addMonth(0);
EkpSalaryParam sendParam;
for (EkpSalaryParamVo sendParamVo : ekpList) {
for (EkpSalaryParam sendParam : ekpList) {
// 转化报账表的参数
account = new TSalaryAccount();
account.setId(sendParamVo.getSalaryAccountId());
sendParam = new EkpSalaryParam();
BeanUtils.copyProperties(sendParamVo, sendParam);
account.setId(sendParam.getFd_3b10af838eab5c());
sendBack = ekpSalaryUtil.sendToEKP(sendParam);
if (Common.isEmpty(sendBack) || sendBack.length() != 32) {
sendBack = ekpSalaryUtil.sendToEKP(sendParam);
}
account.setSendTime(sendTime);
account.setSendUser(user.getId());
account.setSendUserName(user.getNickname());
......@@ -536,6 +540,16 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
account.setEkpId(sendBack);
} else {
sendStatus = false;
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.ONE_STRING);
error.setCreateUserName(s.getCreateName());
error.setLinkId(account.getId());
error.setTitle(sendBack);
error.setNums(CommonConstants.ONE_INT);
HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tsendekperror/inner/saveError", error, Boolean.class, SecurityConstants.FROM_IN);
}
accountList.add(account);
}
......@@ -545,10 +559,14 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
s.setSendMonth(DateUtil.addMonth(0));
s.setStatus(SalaryConstants.STATUS[3]);
this.updateById(s);
// 添加流程进展明细
this.saveRecordLog(s, user, CommonConstants.ZERO_STRING, "发送数字化平台-成功");
return R.ok("发送成功!");
} else {
s.setStatus(SalaryConstants.STATUS[10]);
this.updateById(s);
// 添加流程进展明细
this.saveRecordLog(s, user, CommonConstants.ONE_STRING, "发送数字化平台-失败");
return R.ok("发送失败!");
}
} else {
......@@ -559,4 +577,23 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
}
}
/**
* @Description: 添加流程进展明细
* @Author: hgw
* @Date: 2022/9/6 16:02
* @return: void
**/
@Override
public void saveRecordLog(TSalaryStandard tSalaryStandard, YifuUser user, String status, String nodeId) {
TApprovalRecord tApprovalRecord = new TApprovalRecord();
tApprovalRecord.setApprovalResult(status);
tApprovalRecord.setApprovalOpinion(tSalaryStandard.getRemark());
tApprovalRecord.setSalaryId(tSalaryStandard.getId());
tApprovalRecord.setNodeId(nodeId);
tApprovalRecord.setApprovalMan(user.getId());
tApprovalRecord.setApprovalManName(user.getNickname());
tApprovalRecord.setApprovalTime(DateUtil.getCurrentDateTime());
auditLogService.save(tApprovalRecord);
}
}
......@@ -32,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.SocialDaprUtils;
import com.yifu.cloud.plus.v1.yifu.salary.constants.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryTaxConfig;
......@@ -41,8 +42,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsBonusMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountItemService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryTaxConfigService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsBonusService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusImportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
......@@ -76,6 +79,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
private final TSalaryAccountMapper accountMapper;
private final SocialDaprUtils socialDaprUtils;
/**
* 全年一次性奖金申报表简单分页查询
* @param tStatisticsBonus 全年一次性奖金申报表
......@@ -184,6 +189,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
BigDecimal finalSalaryWithSalary;
//12月已发工资税费
BigDecimal twlSalaryTax;
//12月社保公积金扣费
BigDecimal socialFundTax;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
......@@ -216,7 +223,7 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
idCardList.add(vo.getEmpIdcard());
}
}
Map<String, List<TSalaryAccountItem>> itemMap = tSalaryAccountItemService.getAllItemVoList(idCardList, invoiceTitle);
Map<String, List<TSalaryAccountItem>> itemMap = tSalaryAccountItemService.getSalaryItemVoList(idCardList, invoiceTitle);
for (TStatisticsBonusImportVo infoVo: list) {
//本次纳税额
res = BigDecimal.ZERO;
......@@ -243,23 +250,51 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
finalSalaryWithSalary = BigDecimal.ZERO;
//12月份应纳税所得额扣除费用
BigDecimal deductTaxSalary = infoVo.getDeductTaxSalary();
//12月社保公积金扣费
socialFundTax = BigDecimal.ZERO;
//专项扣除列表
List<BigDecimal> sdSumList = new ArrayList<>();
//减除费用列表
List<BigDecimal> costReductionList = new ArrayList<>();
//查询缴费库获取生成月为12月的社保公积金扣费
List<TPaymentInfo> paymentInfoList = new ArrayList<>();
TPaymentInfo paymentInfo = new TPaymentInfo();
paymentInfo.setEmpIdcard(infoVo.getEmpIdcard());
paymentInfo.setSettleDomainId(deptId);
R<TPaymentVo> paymentVo = socialDaprUtils.getPaymentSocialAndFound(paymentInfo);
if (paymentVo != null && paymentVo.getData() != null && paymentVo.getData().getPaymentInfoList() != null) {
paymentInfoList = paymentVo.getData().getPaymentInfoList();
}
for (TPaymentInfo infoPayment: paymentInfoList) {
socialFundTax = BigDecimalUtils.safeAdd(infoPayment.getSocialSecurityPersonalSum(),
infoPayment.getPersonalProvidentSum());
}
List<TSalaryAccountItem> list1 = itemMap.get(infoVo.getEmpIdcard());
if (Common.isNotNull(list1)) {
for (TSalaryAccountItem item: list1) {
if (SalaryConstants.RELAY_SALARY_JAVA.equals(item.getJavaFiedName())) {
ySalary = ySalary.add(item.getSalaryMoney());
}
if (item.getSettlementMonth().contains(CommonConstants.TWELVE_STRING)) {
//减除费用
if (SalaryConstants.COST_REDUCTION_JAVA.equals(item.getJavaFiedName())) {
costReductionList.add(item.getSalaryMoney());
}
//专项扣除
if (SalaryConstants.SPECIAL_DEDU_MONEY_SUM_JAVA.equals(item.getJavaFiedName())) {
sdSumList.add(item.getSalaryMoney());
}
if (SalaryConstants.RELAY_SALARY_JAVA.equals(item.getJavaFiedName())) {
ySalary.add(item.getSalaryMoney());
}
if (SalaryConstants.SALARY_TAX_JAVA.equals(item.getJavaFiedName())) {
//12月份个税
if (item.getSettlementMonth().contains(CommonConstants.TWELVE_STRING)) {
twlSalaryTax = twlSalaryTax.add(item.getSalaryMoney());
} else {
//1-11月份个税
sumTax = sumTax.add(item.getSalaryMoney());
}
//减除费用
if (SalaryConstants.COST_REDUCTION_JAVA.equals(item.getJavaFiedName())) {
costReduction = costReduction.add(item.getSalaryMoney());
}
if (SalaryConstants.PERSONAL_SOCIAL_JAVA.equals(item.getJavaFiedName())) {
isTax = isTax.add(item.getSalaryMoney());
......@@ -282,11 +317,6 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (SalaryConstants.ONLY_CHILD_JAVA.equals(item.getJavaFiedName())) {
isTax = isTax.add(item.getSalaryMoney());
}
if (item.getSettlementMonth().contains(CommonConstants.TWELVE_STRING)) {
if (SalaryConstants.SALARY_TAX.equals(item.getJavaFiedName())) {
twlSalaryTax.add(item.getSalaryMoney());
}
}
}
}
if (CommonConstants.IS_TRUE.equals(infoVo.getIsTSend())) {
......@@ -295,20 +325,30 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (Common.isNotNull(sdSumList)) {
sdSum = Collections.max(sdSumList);
}
sumDeductSalary = BigDecimalUtils.safeAdd(sdSum,isTax,costReduction);
//年终奖合并扣税
if (Common.isNotNull(costReductionList)) {
costReduction = Collections.max(costReductionList);
}
//当月工资已发
if (isSend) {
//年终奖单独扣税
finalSalaryNoSalary = BigDecimalUtils.safeAdd(calculationSalary(annousTax,infoVo.getAnnualBonus()),twlSalaryTax);
wSalary = infoVo.getAnnualBonus();
finalSalaryWithSalary = finalSalaryNoSalary;
finalSalaryWithSalary = BigDecimalUtils.safeSubtract(calculationSalaryT(personTax,
BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary,infoVo.getAnnualBonus()),
BigDecimalUtils.safeAdd(sdSum,isTax,costReduction))),sumTax);
//12月薪资扣除额合计
sumDeductSalary = BigDecimalUtils.safeAdd(sdSum,isTax,costReduction);
} else {
//当月工资未发
//年终奖单独扣税
BigDecimal annualTSalary = calculationSalaryT(personTax,infoVo.getAnnualTSalary());
finalSalaryNoSalary = BigDecimalUtils.safeAdd(calculationSalary(annousTax,infoVo.getAnnualBonus()),annualTSalary);
wSalary = BigDecimalUtils.safeAdd(infoVo.getAnnualBonus(), infoVo.getAnnualTSalary());
finalSalaryWithSalary = calculationSalary(annousTax, wSalary);
finalSalaryNoSalary = calculationSalary(annousTax,wSalary);
//年终奖合并扣税
finalSalaryWithSalary = BigDecimalUtils.safeSubtract(calculationSalaryT(personTax,BigDecimalUtils.safeSubtract(
BigDecimalUtils.safeAdd(wSalary,ySalary),BigDecimalUtils.safeAdd(
infoVo.getDeductTaxSalary(),isTax))),sumTax);
//12月薪资扣除额合计
sumDeductSalary = BigDecimalUtils.safeAdd(isTax,infoVo.getDeductTaxSalary());
}
if (BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(ySalary, wSalary), sumDeductSalary).
......@@ -317,8 +357,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = deductTaxSalary;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary);
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
......@@ -330,8 +370,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = deductTaxSalary;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary);
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
......@@ -343,8 +383,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = deductTaxSalary;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary);
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
......@@ -356,8 +396,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = deductTaxSalary;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary);
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("144000"));
......@@ -369,8 +409,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = deductTaxSalary;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary);
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("36000"));
......@@ -382,8 +422,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = deductTaxSalary;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary);
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("300000"));
......@@ -395,8 +435,8 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = deductTaxSalary;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary);
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("420000"));
......@@ -408,28 +448,32 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (isSend) {
maxAnualSalary = wSalary;
} else {
minSalary = deductTaxSalary;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,deductTaxSalary);
minSalary = socialFundTax;
maxAnualSalary = BigDecimalUtils.safeSubtract(wSalary,socialFundTax);
}
}else {
minSalary = BigDecimalUtils.safeSubtract(wSalary,new BigDecimal("660000"));
maxAnualSalary = new BigDecimal("660000");
}
}
JSONObject jsonObject = calculationPersonSalary(personTax, annousTax,minSalary, maxAnualSalary, wSalary, sumTax);
JSONObject jsonObject = calculationPersonSalary(personTax, annousTax, minSalary, maxAnualSalary,
wSalary, sumTax, ySalary, sumDeductSalary, twlSalaryTax);
res = jsonObject.getBigDecimal("zySalary");
Map<String,BigDecimal> map = jsonObject.getObject("anRes",Map.class);
BigDecimal anRes = BigDecimal.ZERO;
if (Common.isNotNull(jsonObject.getBigDecimal("anRes"))) {
anRes = jsonObject.getBigDecimal("anRes");
}
infoVo.setBestPlanTax(res);
infoVo.setAnnualATax(finalSalaryNoSalary);
infoVo.setAnnualSTax(finalSalaryWithSalary);
infoVo.setBestPlanTSalary(map.get(res.toString()));
infoVo.setBestPlanBonus(BigDecimalUtils.safeSubtract(wSalary,map.get(res.toString())));
infoVo.setBestPlanTSalary(anRes);
infoVo.setBestPlanBonus(BigDecimalUtils.safeSubtract(wSalary,anRes));
}
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("全年一次性奖金测算").build();
excelWriter.write(list, writeSheet);
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("全年一次性奖金测算").build();
excelWriter.write(list,writeSheet);
......@@ -466,29 +510,48 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
**/
private static JSONObject calculationPersonSalary(List<TSalaryTaxConfig> personTax, List<TSalaryTaxConfig> annousTax,
BigDecimal minSalary, BigDecimal maxAnualSalary,
BigDecimal wSalary, BigDecimal sumTax) {
BigDecimal wSalary, BigDecimal sumTax, BigDecimal ySalary,
BigDecimal sumDeductSalary, BigDecimal twlSalaryTax) {
JSONObject jsonObject = new JSONObject();
BigDecimal anRes;
BigDecimal res;
List<BigDecimal> zySalary = new ArrayList<>();
Map<String,BigDecimal> map = new HashMap<>();
for (BigDecimal i = minSalary; i.compareTo(maxAnualSalary) <= 0; i = BigDecimalUtils.safeAdd(i,new BigDecimal(100)) ) {
//本次薪资纳税额
BigDecimal res = BigDecimal.ZERO;
res = BigDecimal.ZERO;
//本次年终奖纳税额
anRes = BigDecimal.ZERO;;
//年终奖金额
BigDecimal annous = BigDecimalUtils.safeSubtract(wSalary,i);
//计算个税
if (i.compareTo(BigDecimal.ZERO) == SalaryConstants.MORE_THAN ) {
BigDecimal sumI = BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(i,ySalary),
BigDecimalUtils.safeAdd(sumDeductSalary));
for (TSalaryTaxConfig sub : personTax) {
if (i.compareTo(sub.getMinIncome()) == SalaryConstants.MORE_THAN
&& i.compareTo(sub.getMaxIncome()) != SalaryConstants.MORE_THAN) {
//i = realDeduSalary * ((double) ((i.getTaxRate() * 1.0) / 100)) - sumTax - sub.getQuick();
res = i.multiply(new BigDecimal(sub.getWithholdingRate()).divide(
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP))
.subtract(sumTax).subtract(sub.getQuickDeducation());// 应纳税额
if (sumI.compareTo(sub.getMinIncome()) == SalaryConstants.MORE_THAN
&& sumI.compareTo(sub.getMaxIncome()) != SalaryConstants.MORE_THAN) {
//sumI = realDeduSalary * ((double) ((i.getTaxRate() * 1.0) / 100)) - sumTax - sub.getQuick();
//累计个税
res = BigDecimalUtils.safeSubtract(sumI.multiply(new BigDecimal(sub.getWithholdingRate()).divide(
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP)), sub.getQuickDeducation());
//本次个税
BigDecimal bcTax = res.subtract(BigDecimalUtils.safeAdd(sumTax,twlSalaryTax));
if (bcTax.compareTo(BigDecimal.ZERO) == SalaryConstants.MORE_THAN ||
bcTax.compareTo(BigDecimal.ZERO) == SalaryConstants.EQUAL) {
res = BigDecimalUtils.safeAdd(bcTax,twlSalaryTax);
} else {
res = BigDecimalUtils.safeAdd(twlSalaryTax,sumTax);
}
res = BigDecimalUtils.safeSubtract(sumI.multiply(new BigDecimal(sub.getWithholdingRate()).divide(
SalaryConstants.B_ONEHUNDRED, SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP)),
BigDecimalUtils.safeAdd(sumTax,sub.getQuickDeducation()));
break;
}
}
} else {
res = twlSalaryTax;
}
//计算年终奖税
//年终奖
if (annous != null && annous.compareTo(SalaryConstants.B_ZERO) == SalaryConstants.MORE_THAN
......@@ -512,7 +575,7 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
if (Common.isNotNull(zySalary)) {
salary = Collections.min(zySalary);
}
jsonObject.put("anRes",map);
jsonObject.put("anRes",map.get(salary.toString()));
jsonObject.put("zySalary",salary);
map.clear();
zySalary.clear();
......
......@@ -434,6 +434,36 @@
AND a.DELETE_FLAG = 0 and a.FORM_TYPE != 7
</where>
</select>
<!-- 获取所有数据,组装map,工资导入使用 -->
<select id="getSalaryItemVoList" resultMap="itemVoMap">
SELECT
i.ID,
i.SALARY_ACCOUNT_ID,
i.CN_NAME,
i.JAVA_FIED_NAME,
i.SALARY_MONEY,
i.TEXT_VALUE,
i.IS_TAX,
a.EMP_IDCARD,
a.SETTLEMENT_MONTH,
a.FORM_TYPE
FROM
t_salary_account_item i left join t_salary_account a on i.SALARY_ACCOUNT_ID = a.ID
<where>
a.SETTLEMENT_MONTH like DATE_FORMAT(now(),"%Y%")
<if test="idCardList != null">
AND a.EMP_IDCARD in
<foreach item="item" index="index" collection="idCardList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="invoiceTitle != null and invoiceTitle.trim() != ''">
AND a.INVOICE_TITLE = #{invoiceTitle}
</if>
AND a.DELETE_FLAG = 0 and a.FORM_TYPE = 0
</where>
</select>
<select id="getSumByAccountId" resultType="java.util.Map">
SELECT
a.SALARY_ACCOUNT_ID as 'key',
......
......@@ -81,8 +81,8 @@
</resultMap>
<!-- 对接EKP的参数 -->
<resultMap id="ekpSalaryParamVoMap" type="com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo">
<id property="salaryAccountId" column="id"/>
<resultMap id="ekpSalaryParamVoMap" type="com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParam">
<result property="fd_3b10af838eab5c" column="fd_3b10af838eab5c"/>
<result property="fd_3adfedf98ccba2" column="fd_3adfedf98ccba2"/>
<result property="fd_3adfedf9d2bf1c" column="fd_3adfedf9d2bf1c"/>
<result property="fd_3adfedfacd65d6" column="fd_3adfedfacd65d6"/>
......@@ -444,7 +444,7 @@
<!-- 获取薪资明细 -->
<select id="getEkpSalaryParamList" resultMap="ekpSalaryParamVoMap">
select
a.id fd_id
ifnull(a.id,'') fd_3b10af838eab5c
,ifnull(a.DEPT_NO,'') fd_3adfedf98ccba2
,ifnull(a.DEPT_NAME,'') fd_3adfedf9d2bf1c
,'' fd_3adfedfa4410aa
......@@ -462,16 +462,16 @@
,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(a.RELAY_SALARY,'0') fd_3adfee12cb8840
,ifnull(pdeduction.SALARY_MONEY,'0') fd_3adfee1374ed7a
,ifnull(ifnull(withholidingUnitSocial.SALARY_MONEY,unitSocial.SALARY_MONEY),'') fd_3adfee1e2b2f78
,ifnull(ifnull(withholidingPersonSocial.SALARY_MONEY,personalSocial.SALARY_MONEY),'') fd_3adfee1e88723e
,ifnull(ifnull(withholidingUnitFund.SALARY_MONEY,unitFund.SALARY_MONEY),'') fd_3adfee1ee24680
,ifnull(ifnull(withholidingPersonFund.SALARY_MONEY,personalFund.SALARY_MONEY),'') fd_3adfee1f32fa24
,ifnull(a.SALARY_TAX,'') fd_3adfee1f901c46
,ifnull(a.SALARY_TAX,'0') fd_3adfee1f901c46
,'' fd_3adfee1ff1ca6a
,'' fd_3adfee203f86b2
,ifnull(a.ACTUAL_SALARY,'') fd_3adfee20fe5ba4
,ifnull(a.ACTUAL_SALARY,'0') fd_3adfee20fe5ba4
,'' fd_3adfee21802434
,'' fd_3adfee4ba5ad36
,'' fd_3adfee4c0c59ee
......@@ -548,7 +548,7 @@
a.DEPT_ID,
a.DEPT_NO,
a.DEPT_NAME,
ifnull(if(a.FORM_TYPE='4',a.RELAY_SALARY_UNIT,a.RELAY_SALARY),0)
ifnull(if(a.FORM_TYPE='3',a.RELAY_SALARY_UNIT,a.RELAY_SALARY),0)
-ifnull(personalSocial.SALARY_MONEY,0)
-ifnull(personalFund.SALARY_MONEY,0) RELAY_SALARY
FROM t_salary_account a
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.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;
import java.util.Date;
/**
* 推送ekp报错的记录表
*
* @author hgw
* @date 2022-9-7 16:11:24
*/
@Data
@TableName("t_send_ekp_error")
@Schema(description = "推送ekp报错的记录表(同类型仅1条记录,更新计数器)")
public class TSendEkpError {
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
private String id;
@ExcelAttribute(name = "内容")
@ExcelProperty("内容")
private String title;
@ExcelAttribute(name = "类型")
@ExcelProperty("类型(1薪资明细2预估明细3缴费明细4实时收入5定时收入)")
private String type;
@ExcelAttribute(name = "创建日")
@ExcelProperty("创建日")
private String createDay;
@ExcelAttribute(name = "关联ID")
@ExcelProperty("关联ID")
private String linkId;
@ExcelAttribute(name = "创建时间")
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ExcelAttribute(name = "创建人姓名")
@ExcelProperty("创建人姓名")
private String createUserName;
@ExcelAttribute(name = "计数器")
@ExcelProperty("计数器")
private Integer nums;
}
......@@ -288,4 +288,13 @@ public class TForecastLibraryController {
tForecastLibraryService.createForecastFundInfo();
}
@PostMapping("/createFundInfo")
public void createFundInfo() {
tForecastLibraryService.createForecastFundInfo();
}
@PostMapping("/createSocialInfo")
public void createSocialInfo() {
tForecastLibraryService.createForecastInfo();
}
}
......@@ -341,6 +341,16 @@ public class TPaymentInfoController {
tPaymentInfoService.createPaymentFundInfo();
}
@PostMapping("/createFundInfo")
public void createFundInfo() {
tPaymentInfoService.createPaymentFundInfo();
}
@PostMapping("/createSocialInfo")
public void createSocialInfo() {
tPaymentInfoService.createPaymentSocialInfo();
}
/**
* @Description: 定时生成缴费库的收入数据
* @Author: huyc
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.service.TSendEkpErrorService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 推送ekp报错的记录表
*
* @author hgw
* @date 2022-08-30 17:34:58
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tsendekperror")
@Tag(name = "推送ekp报错的记录表")
public class TSendEkpErrorController {
private final TSendEkpErrorService tSendEkpErrorService;
/**
* @Description: 新增-推送ekp报错的记录表
* @Author: hgw
* @Date: 2022/8/31 16:34
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Inner
@PostMapping("/inner/saveError")
public Boolean saveError(@RequestBody TSendEkpError tSendEkpError) {
return tSendEkpErrorService.saveError(tSendEkpError);
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* error存储
*
* @author hgw
* @date 2022-9-7 16:28:46
*/
@Mapper
public interface TSendEkpErrorMapper extends BaseMapper<TSendEkpError> {
/**
* @param tSendEkpError
* @Description: 查找对应类型的1条数据来更新
* @Author: hgw
* @Date: 2022/9/7 16:56
* @return: com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError
**/
TSendEkpError getByTitleTypeDay( @Param("tSendEkpError") TSendEkpError tSendEkpError);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
/**
* 收入明细表
*
* @author hgw
* @date 2022-08-30 17:34:58
*/
public interface TSendEkpErrorService extends IService<TSendEkpError> {
/**
* @Description: 新增-推送ekp报错的记录表;
* @Author: hgw
* @Date: 2022/8/31 16:31
* @return: boolean
**/
boolean saveError(TSendEkpError tSendEkpError);
}
......@@ -49,6 +49,8 @@ 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.TDispatchInfoService;
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.*;
import lombok.RequiredArgsConstructor;
......@@ -104,7 +106,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private final TForecastLibraryService forecastLibraryService;
private final TIncomeDetailMapper detailMapper;
private final TIncomeDetailService detailService;
private final TIncomeService incomeService;
/**
* 派单信息记录表简单分页查询
......@@ -3138,6 +3142,30 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
sf.setFundStatus(CommonConstants.FOUR_STRING);
}
fundMapper.updateById(providentFund);
//公积金办理成功增加收入
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++) {
//获取所有的预估数据
List<TForecastLibrary> libraryFundInfoList = null;
libraryFundInfoList = forecastLibraryService.list(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, sf.getEmpIdcard())
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.eq(TForecastLibrary::getSettleDomainId,sf.getSettleDomainFund())
.eq(TForecastLibrary::getProvidentPayMonth, DateUtil.addMonth(1 - i)));
if (Common.isNotNull(libraryFundInfoList)) {
for (TForecastLibrary library :libraryFundInfoList) {
//办理成功生成收入
createIncomeInfo(library);
}
}
}
}
dis.setFundHandleRemark(ServiceUtil.ifNullToEmpty(handleRemark));
if (CommonConstants.ZERO_INT == flag) {
initAuditInfo(auditInfo, (DispatchConstants.DISPATCH_FUND_ADD_SUCCESS + handleRemark), CommonConstants.THREE_STRING, user, DispatchConstants.DISPATCH_FUND_ADD_SUCCESS, remark);
......@@ -3318,20 +3346,6 @@ 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.派减办理成功 处理预估 (不管社保还是公积金办理失败)
if (CommonConstants.ONE_STRING.equals(dis.getType())
......@@ -3999,12 +4013,12 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return minStartDate;
}
public void createIncomeInfo(TSocialFundInfo library, String createMonth) {
public void createIncomeInfo(TForecastLibrary library) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(library.getSettleDomain());
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(library.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
......@@ -4014,44 +4028,109 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
}
//判断是否存在当月的社保或公积金收入数据
Boolean isExist = false;
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setEmpIdcard(library.getEmpIdcard());
incomeDetail.setPayMonth(library.getProvidentPayMonth());
incomeDetail.setDeptNo(library.getDeptNo());
incomeDetail.setSourceType(CommonConstants.TWO_STRING);
List<TIncomeDetail> detailList = detailService.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailList)) {
BigDecimal sumMoney = BigDecimal.ZERO;
for (TIncomeDetail income : detailList) {
sumMoney = BigDecimalUtils.safeAdd(income.getMoney(),sumMoney);
}
if (sumMoney.compareTo(BigDecimal.ZERO) == CommonConstants.ONE_INT) {
isExist = true;
}
}
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem()
.contains(CommonConstants.TWO_STRING)) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
//预估模式只有按人次和人数收费
if (!isExist) {
createIncomeInsurance(library, 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();
} else {
gMoney = BigDecimalUtils.safeMultiply(library.getSumAll(),settleDomain.getManagementFee());
}
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(), gMoney);
}
}
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem()
.contains(CommonConstants.TWO_STRING)) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType()) &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (!isExist) {
createIncomeInsurance(library, 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();
} else {
money = BigDecimalUtils.safeMultiply(library.getSumAll(), settleDomain.getRiskFundFee());
}
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(), money);
}
}
}
}
}
}
public void createIncomeInsurance(TForecastLibrary library, TSettleDomain settleDomain, String feeType,
String charges, String feeMode, BigDecimal money) {
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
detail.setDeptName(library.getSettleDomainName());
detail.setDeptNo(library.getSettleDomainCode());
detail.setDeptId(library.getSettleDomain());
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(library.getUnitId());
detail.setUnitName(library.getUnitName());
detail.setUnitId(settleDomain.getCustomerId());
detail.setUnitName(settleDomain.getCustomerName());
detail.setDataCreateMonth(DateUtil.addMonth(0));
detail.setSourceId(library.getId());
detail.setSourceType(CommonConstants.TWO_STRING);
detail.setCreateMonth(createMonth);
detail.setPayMonth(createMonth);
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.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.setRedData(CommonConstants.ZERO_STRING);
detail.setId(CommonConstants.NULL);
detailMapper.insert(detail);
incomeService.saveDetail(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);
}
}
}
......@@ -17,7 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -37,12 +37,16 @@ import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpFundUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpSocialUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpPushFundParam;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpPushSocialParam;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils;
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.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.*;
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.service.TForecastLibraryService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
......@@ -119,10 +123,10 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("预估费用").doWrite(list)
ExcelWriter excelWriter = EasyExcel.write(out, TForecastLibraryExportVo.class).includeColumnFiledNames(searchVo.getExportFields()).build();
ExcelWriter excelWriter = EasyExcelFactory.write(out, TForecastLibraryExportVo.class).includeColumnFiledNames(searchVo.getExportFields()).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; ) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
......@@ -134,17 +138,16 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("预估费用" + index).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet("预估费用" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)) {
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("预估费用" + index).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet("预估费用" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
......@@ -177,7 +180,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return baseMapper.selectCount(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(TForecastLibrary entity) {
private LambdaQueryWrapper<TForecastLibrary> buildQueryWrapper(TForecastLibrary entity) {
LambdaQueryWrapper<TForecastLibrary> wrapper = Wrappers.lambdaQuery();
if (Common.isNotNull(entity.getCreateTimeStart())) {
wrapper.ge(TForecastLibrary::getCreateTime, entity.getCreateTimeStart());
......@@ -237,7 +240,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ONE_STRING)));
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
......@@ -249,7 +252,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ONE_STRING)));
socialInfoList = socialFundInfoMapper.getSocialList(empIdCard, null);
fundList = socialFundInfoMapper.getFundList(empIdCard, null);
......@@ -264,7 +267,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.in(TForecastLibrary::getSettleDomainId, settleDomainIdList)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ONE_STRING)));
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
......@@ -277,7 +280,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.in(TForecastLibrary::getSettleDomainId, settleDomainIdList)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ONE_STRING)));
socialInfoList = socialFundInfoMapper.getSocialList(null, settleDomainIdList);
fundList = socialFundInfoMapper.getFundList(null, settleDomainIdList);
......@@ -445,26 +448,26 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
private void getChangeReduceData(TForecastLibrary libraryNew, TForecastLibrary libraryOld) {
//单位社保
libraryNew.setUnitPensionFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitPensionFee(), libraryOld.getUnitPensionFee()));
libraryNew.setUnitMedicalFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitMedicalFee(), libraryOld.getUnitMedicalFee()));
libraryNew.setUnitBirthFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitBirthFee(), libraryOld.getUnitBirthFee()));
libraryNew.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitWorkInjuryFee(), libraryOld.getUnitWorkInjuryFee()));
libraryNew.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitUnemploymentFee(), libraryOld.getUnitUnemploymentFee()));
libraryNew.setUnitBitailmentFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitBitailmentFee(), libraryOld.getUnitBitailmentFee()));
libraryNew.setUnitInterestFee(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitInterestFee(), libraryOld.getUnitInterestFee()));
libraryNew.setUnitSocialSum(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitSocialSum(), libraryOld.getUnitSocialSum()));
libraryNew.setUnitPensionFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitPensionFee(), libraryOld.getUnitPensionFee()));
libraryNew.setUnitMedicalFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitMedicalFee(), libraryOld.getUnitMedicalFee()));
libraryNew.setUnitBirthFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitBirthFee(), libraryOld.getUnitBirthFee()));
libraryNew.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitWorkInjuryFee(), libraryOld.getUnitWorkInjuryFee()));
libraryNew.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitUnemploymentFee(), libraryOld.getUnitUnemploymentFee()));
libraryNew.setUnitBitailmentFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitBitailmentFee(), libraryOld.getUnitBitailmentFee()));
libraryNew.setUnitInterestFee(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitInterestFee(), libraryOld.getUnitInterestFee()));
libraryNew.setUnitSocialSum(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitSocialSum(), libraryOld.getUnitSocialSum()));
// 个人社保
libraryNew.setPersonalPensionFee(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalPensionFee(), libraryOld.getPersonalPensionFee()));
libraryNew.setPersonalMedicalFee(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalMedicalFee(), libraryOld.getPersonalMedicalFee()));
libraryNew.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalUnemploymentFee(), libraryOld.getPersonalUnemploymentFee()));
libraryNew.setPersonalInterestFee(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalInterestFee(), libraryOld.getPersonalInterestFee()));
libraryNew.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalBigailmentFee(), libraryOld.getPersonalBigailmentFee()));
libraryNew.setPersonalSocialSum(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalSocialSum(), libraryOld.getPersonalSocialSum()));
libraryNew.setPersonalPensionFee(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalPensionFee(), libraryOld.getPersonalPensionFee()));
libraryNew.setPersonalMedicalFee(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalMedicalFee(), libraryOld.getPersonalMedicalFee()));
libraryNew.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalUnemploymentFee(), libraryOld.getPersonalUnemploymentFee()));
libraryNew.setPersonalInterestFee(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalInterestFee(), libraryOld.getPersonalInterestFee()));
libraryNew.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalBigailmentFee(), libraryOld.getPersonalBigailmentFee()));
libraryNew.setPersonalSocialSum(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalSocialSum(), libraryOld.getPersonalSocialSum()));
// 单位公积金
libraryNew.setUnitFundSum(BigDecimalUtils.safeSubtract( false, libraryNew.getUnitFundSum(), libraryOld.getUnitFundSum()));
libraryNew.setUnitFundSum(BigDecimalUtils.safeSubtract(false, libraryNew.getUnitFundSum(), libraryOld.getUnitFundSum()));
// 个人公积金
libraryNew.setPersonalFundSum(BigDecimalUtils.safeSubtract( false, libraryNew.getPersonalFundSum(), libraryOld.getPersonalFundSum()));
libraryNew.setSumAll(BigDecimalUtils.safeSubtract( false, libraryNew.getSumAll(), libraryOld.getSumAll()));
libraryNew.setPersonalFundSum(BigDecimalUtils.safeSubtract(false, libraryNew.getPersonalFundSum(), libraryOld.getPersonalFundSum()));
libraryNew.setSumAll(BigDecimalUtils.safeSubtract(false, libraryNew.getSumAll(), libraryOld.getSumAll()));
}
......@@ -1530,22 +1533,22 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
negateLib.setId(null);
negateLib.setDataPush(CommonConstants.ZERO_INT);
negateLib.setSalarySocialFlag(CommonConstants.ZERO_STRING);
negateLib.setUnitPensionFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitPensionFee()));
negateLib.setUnitMedicalFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitMedicalFee()));
negateLib.setUnitBirthFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitBirthFee()));
negateLib.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitWorkInjuryFee()));
negateLib.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitUnemploymentFee()));
negateLib.setUnitBitailmentFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitBitailmentFee()));
negateLib.setUnitInterestFee(BigDecimalUtils.safeSubtract( false, zero, library.getUnitInterestFee()));
negateLib.setUnitSocialSum(BigDecimalUtils.safeSubtract( false, zero, library.getUnitSocialSum()));
negateLib.setUnitPensionFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitPensionFee()));
negateLib.setUnitMedicalFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitMedicalFee()));
negateLib.setUnitBirthFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitBirthFee()));
negateLib.setUnitWorkInjuryFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitWorkInjuryFee()));
negateLib.setUnitUnemploymentFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitUnemploymentFee()));
negateLib.setUnitBitailmentFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitBitailmentFee()));
negateLib.setUnitInterestFee(BigDecimalUtils.safeSubtract(false, zero, library.getUnitInterestFee()));
negateLib.setUnitSocialSum(BigDecimalUtils.safeSubtract(false, zero, library.getUnitSocialSum()));
// 个人社保
negateLib.setPersonalPensionFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalPensionFee()));
negateLib.setPersonalMedicalFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalMedicalFee()));
negateLib.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalUnemploymentFee()));
negateLib.setPersonalInterestFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalInterestFee()));
negateLib.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalBigailmentFee()));
negateLib.setPersonalSocialSum(BigDecimalUtils.safeSubtract( false, zero, library.getPersonalSocialSum()));
negateLib.setSumAll(BigDecimalUtils.safeSubtract( false, zero, library.getSumAll()));
negateLib.setPersonalPensionFee(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalPensionFee()));
negateLib.setPersonalMedicalFee(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalMedicalFee()));
negateLib.setPersonalUnemploymentFee(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalUnemploymentFee()));
negateLib.setPersonalInterestFee(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalInterestFee()));
negateLib.setPersonalBigailmentFee(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalBigailmentFee()));
negateLib.setPersonalSocialSum(BigDecimalUtils.safeSubtract(false, zero, library.getPersonalSocialSum()));
negateLib.setSumAll(BigDecimalUtils.safeSubtract(false, zero, library.getSumAll()));
negateLib.setDiffType(SocialConstants.DIFF_TYPE_TWO);
baseMapper.insert(negateLib);
} else {
......@@ -1553,11 +1556,21 @@ 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()));
List<TIncomeDetail> updateList = detailService.list(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()));
if (Common.isNotNull(updateList)) {
for (TIncomeDetail upd : updateList) {
TIncomeDetail detail = new TIncomeDetail();
BeanCopyUtils.copyProperties(upd, detail);
detail.setId(CommonConstants.NULL);
detail.setRedData(CommonConstants.ONE_STRING);
detail.setMoney(detail.getMoney().negate());
incomeService.saveDetail(detail);
}
}
}
private void calculateFundType(BigDecimal zero, TForecastLibrary library) {
......@@ -1581,10 +1594,21 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
//删除停缴月以后的收入数据
detailService.remove(Wrappers.<TIncomeDetail>query().lambda().eq(TIncomeDetail::getEmpIdcard,library.getEmpIdcard())
List<TIncomeDetail> updateList = detailService.list(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()));
.eq(TIncomeDetail::getPayMonth,library.getProvidentPayMonth()));
if (Common.isNotNull(updateList)) {
for (TIncomeDetail upd : updateList) {
TIncomeDetail detail = new TIncomeDetail();
BeanCopyUtils.copyProperties(upd, detail);
detail.setId(CommonConstants.NULL);
detail.setRedData(CommonConstants.ONE_STRING);
detail.setMoney(detail.getMoney().negate());
incomeService.saveDetail(detail);
}
}
}
/**
......@@ -1643,10 +1667,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
initConfigByPayMonths(configList, payMonthList, agentConfigHashMap);
}
//查询出所有对应条件的预估数、社保数据、公积金数据据用于重新生成
List<String> detailMonthList;
if (Common.isNotNull(empIdCard)) {
if (isDispatch) {
if (socialFundInfo.getSocialStartDate() != null) {
payMonthList = new ArrayList<>();
detailMonthList = new ArrayList<>();
// 获取最小的起缴月
Date minStartDate = this.getMinSocialDate(socialFundInfo);
// 再计算月份
......@@ -1655,19 +1680,19 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return R.failed("派单同步预估库,社保起缴月份无法生成,monthDiff=" + monthDiff);
}
for (int i = 0; i < monthDiff; i++) {
payMonthList.add(DateUtil.addMonth(1 - i));
detailMonthList.add(DateUtil.addMonth(1 - i));
}
librarySocialList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.in(TForecastLibrary::getSocialPayMonth, detailMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ZERO_STRING));
librarySocialListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.in(TForecastLibrary::getSocialPayMonth, detailMonthList)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ONE_STRING)));
}
} else {
......@@ -1681,12 +1706,12 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.in(TForecastLibrary::getSocialPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ONE_STRING)));
}
if (isDispatch) {
if (socialFundInfo.getProvidentStart() != null) {
payMonthList = new ArrayList<>();
detailMonthList = new ArrayList<>();
// 获取最小的起缴月
Date minStartDate = socialFundInfo.getProvidentStart();
// 再计算月份
......@@ -1695,19 +1720,19 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return R.failed("派单同步预估库,公积金起缴月份无法生成,monthDiff=" + monthDiff);
}
for (int i = 0; i < monthDiff; i++) {
payMonthList.add(DateUtil.addMonth(1 - i));
detailMonthList.add(DateUtil.addMonth(1 - i));
}
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.in(TForecastLibrary::getProvidentPayMonth, detailMonthList)
.eq(TForecastLibrary::getDataPush, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ZERO_STRING));
libraryFundListTemp = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, detailMonthList)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ONE_STRING)));
}
} else {
......@@ -1721,7 +1746,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.in(TForecastLibrary::getProvidentPayMonth, payMonthList)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ONE_STRING)));
}
if (isOnly) {
......@@ -1790,7 +1815,22 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
library.setCreateTime(LocalDateTime.now());
baseMapper.insert(library);
isSaveAndUpdate = true;
}
}
}
if (Common.isNotNull(socialFundInfo.getSocialId())
&& CommonConstants.FOUR_STRING.equals(socialFundInfo.getSocialStatus())
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus())) {
//获取所有的预估数据
List<TForecastLibrary> librarySocialInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
.in(TForecastLibrary::getSocialPayMonth, payMonthList));
if (Common.isNotNull(librarySocialInfoList)) {
for (TForecastLibrary library : librarySocialInfoList) {
//办理成功生成收入
createIncomeInfo(library);
}
......@@ -2012,11 +2052,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
List<TSocialFundInfo> socialFundInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda());
if (socialFundInfoList != null && !socialFundInfoList.isEmpty()) {
String payMonth = DateUtil.addMonth(1);
int all = socialFundInfoList.size();
int i=1;
for (TSocialFundInfo socialFundInfo : socialFundInfoList) {
System.out.println("预估生成,当前第:"+ i + "条,总数:" + all + "条。当前身份证:"+ socialFundInfo.getEmpIdcard());
i++;
everyMonthCreateForecastLibaryCore(payMonth, socialFundInfo);
}
}
......@@ -2056,7 +2092,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSocialPayMonth, payMonth)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalarySocialFlag, CommonConstants.ONE_STRING)));
libraryFundList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
......@@ -2068,7 +2104,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ONE_INT)
.eq(TForecastLibrary::getProvidentPayMonth, payMonth)
.and(obj->obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.and(obj -> obj.eq(TForecastLibrary::getDataPush, CommonConstants.ONE_INT)
.or().eq(TForecastLibrary::getSalaryFundFlag, CommonConstants.ONE_STRING)));
socialInfoList = socialFundInfoMapper.getSocialList(empIdCard, null);
fundList = socialFundInfoMapper.getFundList(empIdCard, null);
......@@ -2114,11 +2150,27 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
library.setCreateName("定时生成");
library.setCreateTime(LocalDateTime.now());
baseMapper.insert(library);
}
isSaveAndUpdate = true;
}
if (Common.isNotNull(socialFundInfo.getSocialId())
&& CommonConstants.FOUR_STRING.equals(socialFundInfo.getSocialStatus())
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus())) {
//获取所有的预估数据
List<TForecastLibrary> librarySocialInfoList = null;
librarySocialInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
.in(TForecastLibrary::getSocialPayMonth, payMonthList));
if (Common.isNotNull(librarySocialInfoList)) {
for (TForecastLibrary library : librarySocialInfoList) {
//办理成功生成收入
createIncomeInfo(library);
}
isSaveAndUpdate = true;
}
}
if (isSaveAndUpdate) {
return R.ok(null, "执行成功!");
......@@ -2208,7 +2260,24 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
public List<String> initEkpPushSocialParam(List<TForecastLibrary> unPushInfo) {
List<String> pushList = new ArrayList<>();
for (TForecastLibrary library:unPushInfo) {
for (TForecastLibrary library : unPushInfo) {
//获取项目信息
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);
}
}
}
if (CommonConstants.ZERO_STRING.equals(settleDomain.getSocialType())) {
continue;
}
EkpPushSocialParam socialParam = new EkpPushSocialParam();
//员工姓名
socialParam.setFd_3adfe8c79989d4(library.getEmpName());
......@@ -2298,13 +2367,13 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
//社保缴纳月份
if (Common.isNotNull(library.getSocialPayMonth())) {
socialParam.setFd_3adfe8cf632700(library.getSocialPayMonth());
socialParam.setFd_3adfe8cf632700(dateStringInsert(library.getSocialPayMonth()));
} else {
socialParam.setFd_3adfe8cf632700(CommonConstants.EMPTY_STRING);
}
//社保生成月份
if (Common.isNotNull(library.getSocialCreateMonth())) {
socialParam.setFd_3adfe8cb96c41e(library.getSocialCreateMonth());
socialParam.setFd_3adfe8cb96c41e(dateStringInsert(library.getSocialCreateMonth()));
} else {
socialParam.setFd_3adfe8cb96c41e(CommonConstants.EMPTY_STRING);
}
......@@ -2313,7 +2382,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//是否有预估
socialParam.setFd_3add9de0be85e4(CommonConstants.IS_TRUE);
//与工资合并结算
socialParam.setFd_3add9e1a670144(CommonConstants.EMPTY_STRING);
socialParam.setFd_3add9e1a670144(CommonConstants.IS_FALSE);
//项目编码
socialParam.setFd_3adfe8c70d3fd4(library.getDeptNo());
//项目名称
......@@ -2321,7 +2390,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//单号
socialParam.setFd_3adfe95c169c48(CommonConstants.EMPTY_STRING);
//客户编码
if (Common.isNotNull(settleDomain.getCustomerNo())) {
socialParam.setFd_3adfe8c73cb5a4(settleDomain.getCustomerNo());
} else {
socialParam.setFd_3adfe8c73cb5a4(CommonConstants.EMPTY_STRING);
}
//客户名称
socialParam.setFd_3adfe8c81a0e42(library.getUnitName());
//社保户
......@@ -2418,7 +2491,24 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
public List<String> initEkpPushFundParam(List<TForecastLibrary> unPushInfo) {
List<String> pushList = new ArrayList<>();
for (TForecastLibrary library:unPushInfo) {
for (TForecastLibrary library : unPushInfo) {
//获取项目信息
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);
}
}
}
if (CommonConstants.ZERO_STRING.equals(settleDomain.getFundType())) {
continue;
}
EkpPushFundParam fundParam = new EkpPushFundParam();
//员工姓名
fundParam.setFd_3adfe8c79989d4(library.getEmpName());
......@@ -2437,14 +2527,14 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
fundParam.setFd_3adfeb52a4d2e2(CommonConstants.EMPTY_STRING);
}
//缴纳月份
if (Common.isNotNull(library.getSocialPayMonth())) {
fundParam.setFd_3adfe8cf632700(library.getSocialPayMonth());
if (Common.isNotNull(library.getProvidentPayMonth())) {
fundParam.setFd_3adfe8cf632700(dateStringInsert(library.getProvidentPayMonth()));
} else {
fundParam.setFd_3adfe8cf632700(CommonConstants.EMPTY_STRING);
}
//生成月份
if (Common.isNotNull(library.getSocialCreateMonth())) {
fundParam.setFd_3adfe8cb96c41e(library.getSocialCreateMonth());
if (Common.isNotNull(library.getProvidentCreateMonth())) {
fundParam.setFd_3adfe8cb96c41e(dateStringInsert(library.getProvidentCreateMonth()));
} else {
fundParam.setFd_3adfe8cb96c41e(CommonConstants.EMPTY_STRING);
}
......@@ -2463,7 +2553,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//是否有预估
fundParam.setFd_3add9de0be85e4(CommonConstants.IS_TRUE);
//与工资合并结算
fundParam.setFd_3add9e1a670144(CommonConstants.EMPTY_STRING);
fundParam.setFd_3add9e1a670144(CommonConstants.IS_FALSE);
//项目编码
fundParam.setFd_3adfe8c70d3fd4(library.getDeptNo());
//项目名称
......@@ -2471,7 +2561,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//单号
fundParam.setFd_3adfe95c169c48(CommonConstants.EMPTY_STRING);
//客户编码
if (Common.isNotNull(settleDomain.getCustomerNo())) {
fundParam.setFd_3adfe8c73cb5a4(settleDomain.getCustomerNo());
} else {
fundParam.setFd_3adfe8c73cb5a4(CommonConstants.EMPTY_STRING);
}
//单位代缴
fundParam.setFd_3adfeb52fbe966(CommonConstants.EMPTY_STRING);
//个人代缴
......@@ -2532,18 +2626,18 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
//判断是否存在当月的社保或公积金收入数据
Boolean isExist = false;
boolean isExist = false;
String sourceType = "";
if (Common.isNotNull(library.getProvidentId())) {
sourceType = CommonConstants.TWO_STRING;
} else {
} else if (Common.isNotNull(library.getSocialId())) {
sourceType = CommonConstants.ONE_STRING;
}
......@@ -2558,70 +2652,67 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
incomeDetail.setSourceType(sourceType);
List<TIncomeDetail> detailList = detailService.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailList)) {
BigDecimal sumMoney = BigDecimal.ZERO;
for (TIncomeDetail income : detailList) {
sumMoney = BigDecimalUtils.safeAdd(income.getMoney(), sumMoney);
}
if (sumMoney.compareTo(BigDecimal.ZERO) > CommonConstants.ZERO_INT) {
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 (Common.isNotNull(settleDomain.getManageServerItem()) && ((settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
&& CommonConstants.ONE_STRING.equals(sourceType)) || (settleDomain.getManageServerItem().contains(CommonConstants.TWO_STRING)
&& CommonConstants.TWO_STRING.equals(sourceType)))) {
//预估模式
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) {
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee(), sourceType);
}
}
} else {
BigDecimal gMoney = BigDecimal.ZERO;
BigDecimal gMoney;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
isSum = 2;
} else {
gMoney = BigDecimalUtils.safeMultiply(library.getSumAll(),settleDomain.getManagementFee());
gMoney = BigDecimalUtils.safeMultiply(library.getSumAll(), settleDomain.getManagementFee());
}
if (!isExist || isSum ==2) {
if (!isExist) {
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 (Common.isNotNull(settleDomain.getRiskServerItem()) && ((settleDomain.getRiskServerItem().contains(CommonConstants.ONE_STRING)
&& CommonConstants.ONE_STRING.equals(sourceType)) || (settleDomain.getRiskServerItem().contains(CommonConstants.TWO_STRING)
&& CommonConstants.TWO_STRING.equals(sourceType)))) {
//预估模式
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) {
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee(),sourceType);
settleDomain.getRiskFundFee(), sourceType);
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
BigDecimal money;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
money = settleDomain.getRiskFundFee();
isSum = 4;
} else {
money = BigDecimalUtils.safeMultiply(library.getSumAll(), settleDomain.getRiskFundFee());
}
if (!isExist || isSum == 4) {
if (!isExist) {
createIncomeInsurance(library, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
money, sourceType);
......@@ -2633,7 +2724,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
public void createIncomeInsurance(TForecastLibrary library, TSettleDomain settleDomain, String feeType,
String charges, String feeMode, BigDecimal money,String sourceType) {
String charges, String feeMode, BigDecimal money, String sourceType) {
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
......@@ -2651,7 +2742,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
if (CommonConstants.ONE_STRING.equals(sourceType)) {
detail.setCreateMonth(library.getSocialCreateMonth());
detail.setPayMonth(library.getSocialPayMonth());
} else {
} else if (CommonConstants.TWO_STRING.equals(sourceType)) {
detail.setCreateMonth(library.getProvidentCreateMonth());
detail.setPayMonth(library.getProvidentPayMonth());
}
......@@ -2660,8 +2751,15 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
detail.setFeeMode(feeMode);
detail.setCharges(charges);
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setRedData(CommonConstants.ZERO_STRING);
detail.setId(CommonConstants.NULL);
incomeService.saveDetail(detail);
}
public String dateStringInsert(String month) {
StringBuilder sb = new StringBuilder(month);
sb.insert(4, "-");
return sb.toString();
}
}
......@@ -31,12 +31,15 @@ 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.ekp.vo.EkpIncomeParamManage;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamRisk;
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.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TIncomeMapper;
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.service.TSendEkpErrorService;
import com.yifu.cloud.plus.v1.yifu.social.vo.IncomeExportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeVo;
......@@ -64,6 +67,9 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
@Autowired
private TIncomeDetailService tIncomeDetailService;
@Autowired
private TSendEkpErrorService tSendEkpErrorService;
@Autowired
private EkpIncomeUtil ekpIncomeUtil;
......@@ -272,10 +278,9 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
public void pushDetail() {
List<TIncome> list = baseMapper.selectList(Wrappers.<TIncome>query().lambda()
.eq(TIncome::getSendStatus, CommonConstants.ZERO_STRING));
String sendBack;
for (TIncome income : list) {
EkpIncomeParam sendParam = new EkpIncomeParam();
this.copyToEkp(income, sendParam);
String sendBack = ekpIncomeUtil.sendToEKP(sendParam, income.getFeeType());
sendBack = this.getSendBack(income);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
......@@ -286,20 +291,52 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
}
}
/**
* @param income
* @Description: 判断类型发送
* @Author: hgw
* @Date: 2022/9/6 15:15
* @return: java.lang.String
**/
private String getSendBack(TIncome income) {
String sendBack;
if (CommonConstants.ONE_STRING.equals(income.getFeeType())) {
EkpIncomeParamManage sendParam = new EkpIncomeParamManage();
this.copyToEkpManage(income, sendParam);
sendBack = ekpIncomeUtil.sendToEkpManage(sendParam);
} else {
EkpIncomeParamRisk sendParam = new EkpIncomeParamRisk();
this.copyToEkpRisk(income, sendParam);
sendBack = ekpIncomeUtil.sendToEkpRisk(sendParam);
}
return sendBack;
}
// 复制并保存
private boolean saveIncome(TIncomeDetail tIncomeDetail) {
TIncome income = new TIncome();
BeanUtil.copyProperties(tIncomeDetail, income);
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
EkpIncomeParam sendParam = new EkpIncomeParam();
this.copyToEkp(income, sendParam);
String sendBack = ekpIncomeUtil.sendToEKP(sendParam, income.getFeeType());
String sendBack = this.getSendBack(income);
if (Common.isEmpty(sendBack) || sendBack.length() != 32) {
sendBack = this.getSendBack(income);
}
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
} else {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FOUR_STRING);
error.setCreateUserName("收入表推送");
error.setLinkId(income.getId());
error.setTitle(sendBack);
error.setNums(CommonConstants.ONE_INT);
tSendEkpErrorService.saveError(error);
}
return this.updateById(income);
}
......@@ -312,7 +349,68 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
* @Date: 2022/9/5 16:57
* @return: void
**/
private void copyToEkp(TIncome income, EkpIncomeParam sendParam) {
private void copyToEkpManage(TIncome income, EkpIncomeParamManage 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_3ae0c23b2e9a92("1970-02");
} else {
sendParam.setFd_3ae0c23b2e9a92(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_3ae0c23cb3fccc("1970-02");
} else {
sendParam.setFd_3ae0c23cb3fccc(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_3aead3c68b1078("");
// 收款单号
sendParam.setFd_3aeae58b14691c("");
}
private void copyToEkpRisk(TIncome income, EkpIncomeParamRisk sendParam) {
// 项目编码
sendParam.setFd_3adfef5e5b9d34(income.getDeptNo());
// 项目名称
......@@ -437,21 +535,8 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return this.saveIncome(tIncomeDetail);
}
} else {
Integer myNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer socialNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.ONE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer fundNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.TWO_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer insureNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.THREE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer salaryNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.FOUR_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
// 红冲判断:当本类型是最大值,才可以红冲
if (myNum != null && myNum > ifNullToZero(socialNum) && myNum > ifNullToZero(fundNum)
&& myNum > ifNullToZero(insureNum) && myNum > ifNullToZero(salaryNum)) {
return this.saveIncome(tIncomeDetail);
}
if (this.redDateJudge(tIncomeDetail, numMap)) return this.saveIncome(tIncomeDetail);
}
} else if (CommonConstants.THREE_STRING.equals(tIncomeDetail.getSourceType())) {
// 商险。收费方式:2金额-人数
......@@ -462,21 +547,7 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return this.saveIncome(tIncomeDetail);
}
} else {
Integer myNum = numMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer socialNum = numMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.ONE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer fundNum = numMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.TWO_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer insureNum = numMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.THREE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer salaryNum = numMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.FOUR_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
// 红冲判断:当本类型是最大值,才可以红冲
if (myNum != null && myNum > ifNullToZero(socialNum) && myNum > ifNullToZero(fundNum)
&& myNum > ifNullToZero(insureNum) && myNum > ifNullToZero(salaryNum)) {
return this.saveIncome(tIncomeDetail);
}
if (this.redDateJudge(tIncomeDetail, numMap)) return this.saveIncome(tIncomeDetail);
}
} else {
// 各个模式累加逻辑:
......@@ -499,6 +570,43 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return true;
}
/**
* @Description: 红冲判断
* @Author: hgw
* @Date: 2022/9/7 17:27
* @return: boolean
**/
private boolean redDateJudge(TIncomeDetail tIncomeDetail, Map<String, Integer> numMap) {
Integer socialNum = CommonConstants.ZERO_INT;
Integer fundNum = CommonConstants.ZERO_INT;
Integer insureNum = CommonConstants.ZERO_INT;
Integer salaryNum = CommonConstants.ZERO_INT;
Integer myNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
if (!CommonConstants.ONE_STRING.equals(tIncomeDetail.getSourceType())) {
socialNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.ONE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
}
if (!CommonConstants.TWO_STRING.equals(tIncomeDetail.getSourceType())) {
fundNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.TWO_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
}
if (!CommonConstants.THREE_STRING.equals(tIncomeDetail.getSourceType())) {
insureNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.THREE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
}
if (!CommonConstants.FOUR_STRING.equals(tIncomeDetail.getSourceType())) {
salaryNum = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + CommonConstants.FOUR_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
}
// 红冲判断:当本类型是最大值,才可以红冲
if (myNum != null && myNum > ifNullToZero(socialNum) && myNum > ifNullToZero(fundNum)
&& myNum > ifNullToZero(insureNum) && myNum > ifNullToZero(salaryNum)) {
return true;
}
return false;
}
private int ifNullToZero(Integer num) {
if (num == null) {
return CommonConstants.ZERO_INT;
......@@ -526,21 +634,8 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return this.saveIncome(tIncomeDetail);
}
} else {
Integer myNum = numMap.get(month + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer socialNum = numMap.get(month + CommonConstants.DOWN_LINE_STRING + CommonConstants.ONE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer fundNum = numMap.get(month + CommonConstants.DOWN_LINE_STRING + CommonConstants.TWO_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer insureNum = numMap.get(month + CommonConstants.DOWN_LINE_STRING + CommonConstants.THREE_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
Integer salaryNum = numMap.get(month + CommonConstants.DOWN_LINE_STRING + CommonConstants.FOUR_STRING
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType());
// 红冲判断:当本类型是最大值,才可以红冲
if (myNum != null && myNum > ifNullToZero(socialNum) && myNum > ifNullToZero(fundNum)
&& myNum > ifNullToZero(insureNum) && myNum > ifNullToZero(salaryNum)) {
return this.saveIncome(tIncomeDetail);
}
if (this.redDateJudge(tIncomeDetail, numMap)) return this.saveIncome(tIncomeDetail);
}
return false;
}
......
......@@ -28,12 +28,9 @@ 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.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
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.CommonConstants;
......@@ -48,8 +45,6 @@ import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpFundUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpSocialUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpPushFundParam;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpPushSocialParam;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsDeclarer;
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;
......@@ -2311,6 +2306,21 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
public List<String> initEkpPushSocialParam(List<TPaymentInfo> unPushInfo) {
List<String> pushList = new ArrayList<>();
for (TPaymentInfo library:unPushInfo) {
//获取项目信息
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);
}
}
}
EkpPushSocialParam socialParam = new EkpPushSocialParam();
//员工姓名
socialParam.setFd_3adfe8c79989d4(library.getEmpName());
......@@ -2352,22 +2362,27 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
//社保缴纳月份
if (Common.isNotNull(library.getSocialPayMonth())) {
socialParam.setFd_3adfe8cf632700(library.getSocialPayMonth());
socialParam.setFd_3adfe8cf632700(dateStringInsert(library.getSocialPayMonth()));
} else {
socialParam.setFd_3adfe8cf632700(CommonConstants.EMPTY_STRING);
}
//社保生成月份
if (Common.isNotNull(library.getSocialCreateMonth())) {
socialParam.setFd_3adfe8cb96c41e(library.getSocialCreateMonth());
socialParam.setFd_3adfe8cb96c41e(dateStringInsert(library.getSocialCreateMonth()));
} else {
socialParam.setFd_3adfe8cb96c41e(CommonConstants.EMPTY_STRING);
}
//订单类型
socialParam.setFd_3add9dd7833db8(SocialConstants.DIFF_TYPE_THR);
//是否有预估
socialParam.setFd_3add9de0be85e4(CommonConstants.EMPTY_STRING);
if (Common.isNotNull(settleDomain.getSocialType()) &&
CommonConstants.ONE_STRING.equals(settleDomain.getSocialType())) {
socialParam.setFd_3add9de0be85e4(CommonConstants.IS_TRUE);
} else {
socialParam.setFd_3add9de0be85e4(CommonConstants.IS_FALSE);
}
//与工资合并结算
socialParam.setFd_3add9e1a670144(CommonConstants.EMPTY_STRING);
socialParam.setFd_3add9e1a670144(CommonConstants.IS_FALSE);
//项目编码
socialParam.setFd_3adfe8c70d3fd4(library.getSettleDomainCode());
//项目名称
......@@ -2375,9 +2390,17 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//单号
socialParam.setFd_3adfe95c169c48(CommonConstants.EMPTY_STRING);
//客户编码
if (Common.isNotNull(settleDomain.getCustomerNo())) {
socialParam.setFd_3adfe8c73cb5a4(settleDomain.getCustomerNo());
} else {
socialParam.setFd_3adfe8c73cb5a4(CommonConstants.EMPTY_STRING);
}
//客户名称
if (Common.isNotNull(library.getUnitName())) {
socialParam.setFd_3adfe8c81a0e42(library.getUnitName());
} else {
socialParam.setFd_3adfe8c81a0e42(CommonConstants.EMPTY_STRING);
}
//社保户
if (Common.isNotNull(library.getSocialHousehold())) {
socialParam.setFd_3aeafa25916e82(library.getSocialHousehold());
......@@ -2521,6 +2544,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
public List<String> initEkpPushFundParam(List<TPaymentInfo> unPushInfo) {
List<String> pushList = new ArrayList<>();
for (TPaymentInfo library:unPushInfo) {
//获取项目信息
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);
}
}
}
EkpPushFundParam fundParam = new EkpPushFundParam();
//员工姓名
fundParam.setFd_3adfe8c79989d4(library.getEmpName());
......@@ -2532,13 +2569,13 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
fundParam.setFd_3adfeb52a4d2e2(CommonConstants.EMPTY_STRING);
//缴纳月份
if (Common.isNotNull(library.getProvidentPayMonth())) {
fundParam.setFd_3adfe8cf632700(library.getProvidentPayMonth());
fundParam.setFd_3adfe8cf632700(dateStringInsert(library.getProvidentPayMonth()));
} else {
fundParam.setFd_3adfe8cf632700(CommonConstants.EMPTY_STRING);
}
//生成月份
if (Common.isNotNull(library.getProvidentCreateMonth())) {
fundParam.setFd_3adfe8cb96c41e(library.getProvidentCreateMonth());
fundParam.setFd_3adfe8cb96c41e(dateStringInsert(library.getProvidentCreateMonth()));
} else {
fundParam.setFd_3adfe8cb96c41e(CommonConstants.EMPTY_STRING);
}
......@@ -2555,9 +2592,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//订单类型
fundParam.setFd_3add9dd7833db8(SocialConstants.DIFF_TYPE_THR);
//是否有预估
fundParam.setFd_3add9de0be85e4(CommonConstants.EMPTY_STRING);
if (Common.isNotNull(settleDomain.getFundType()) &&
CommonConstants.ONE_STRING.equals(settleDomain.getFundType())) {
fundParam.setFd_3add9de0be85e4(CommonConstants.IS_TRUE);
} else {
fundParam.setFd_3add9de0be85e4(CommonConstants.IS_FALSE);
}
//与工资合并结算
fundParam.setFd_3add9e1a670144(CommonConstants.EMPTY_STRING);
fundParam.setFd_3add9e1a670144(CommonConstants.IS_FALSE);
//项目编码
fundParam.setFd_3adfe8c70d3fd4(library.getSettleDomainCode());
//项目名称
......@@ -2565,7 +2607,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//单号
fundParam.setFd_3adfe95c169c48(CommonConstants.EMPTY_STRING);
//客户编码
if (Common.isNotNull(settleDomain.getCustomerNo())) {
fundParam.setFd_3adfe8c73cb5a4(settleDomain.getCustomerNo());
} else {
fundParam.setFd_3adfe8c73cb5a4(CommonConstants.EMPTY_STRING);
}
//单位代缴
if (Common.isNotNull(library.getUnitProvidentSum())) {
fundParam.setFd_3adfeb52fbe966(library.getUnitProvidentSum().toString());
......@@ -2641,40 +2687,40 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
Boolean exitFlag = false;
TIncomeDetail exitIncome = new TIncomeDetail();
List<TIncomeDetail> exitIncome = new ArrayList<>();
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
exitIncome = detailMapper.selectOne(Wrappers.<TIncomeDetail>query().lambda()
exitIncome = detailMapper.selectList(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TIncomeDetail::getPayMonth, paymentInfo.getSocialPayMonth())
.eq(TIncomeDetail::getDeptId, paymentInfo.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.ONE_STRING)
.last(CommonConstants.LAST_ONE_SQL));
.eq(TIncomeDetail::getSourceType, CommonConstants.ONE_STRING));
} else {
exitIncome = detailMapper.selectOne(Wrappers.<TIncomeDetail>query().lambda()
exitIncome = detailMapper.selectList(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TIncomeDetail::getPayMonth, paymentInfo.getSocialPayMonth())
.eq(TIncomeDetail::getPayMonth, paymentInfo.getProvidentPayMonth())
.eq(TIncomeDetail::getDeptId, paymentInfo.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.TWO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
.eq(TIncomeDetail::getSourceType, CommonConstants.TWO_STRING));
}
if (Common.isNotNull(exitIncome)) {
BigDecimal sumMoney = BigDecimal.ZERO;
for (TIncomeDetail income : exitIncome) {
sumMoney = BigDecimalUtils.safeAdd(income.getMoney(),sumMoney);
}
if (sumMoney.compareTo(BigDecimal.ZERO) == CommonConstants.ONE_INT) {
exitFlag = true;
}
}
//判断是否为按人次收费
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
// 含有社保,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && (settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
|| settleDomain.getManageServerItem().contains(CommonConstants.TWO_STRING))) {
if (Common.isNotNull(settleDomain.getManageServerItem()) && ((settleDomain.getManageServerItem().contains(CommonConstants.ONE_STRING)
&& CommonConstants.ONE_STRING.equals(socialFundFlag)) || (settleDomain.getManageServerItem().contains(CommonConstants.TWO_STRING)
&& CommonConstants.TWO_STRING.equals(socialFundFlag)))) {
//预估模式
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) {
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee(), socialFundFlag);
......@@ -2686,7 +2732,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
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());
......@@ -2694,22 +2739,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(), settleDomain.getManagementFee());
}
}
if (!exitFlag || isSum == 2) {
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
gMoney, socialFundFlag);
}
}
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && (settleDomain.getRiskServerItem().contains(CommonConstants.ONE_STRING)
|| settleDomain.getRiskServerItem().contains(CommonConstants.TWO_STRING))) {
if (Common.isNotNull(settleDomain.getRiskServerItem()) && ((settleDomain.getRiskServerItem().contains(CommonConstants.ONE_STRING)
&& CommonConstants.ONE_STRING.equals(socialFundFlag)) || (settleDomain.getRiskServerItem().contains(CommonConstants.TWO_STRING)
&& CommonConstants.TWO_STRING.equals(socialFundFlag)))) {
//预估模式
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) {
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee(), socialFundFlag);
......@@ -2721,7 +2764,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
money = settleDomain.getRiskFundFee();
isSum = 4;
} else {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
money = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(), settleDomain.getRiskFundFee());
......@@ -2729,7 +2771,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
money = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(), settleDomain.getRiskFundFee());
}
}
if (!exitFlag || isSum == 4) {
if (!exitFlag) {
createIncomeInsurance(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
money, socialFundFlag);
......@@ -2769,6 +2811,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
detail.setCharges(charges);
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setId(CommonConstants.NULL);
detail.setRedData(CommonConstants.ZERO_STRING);
incomeService.saveDetail(detail);
}
public String dateStringInsert(String month) {
StringBuilder sb = new StringBuilder(month);
sb.insert(4, "-");
String replaceMonth = sb.toString();
return replaceMonth;
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
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.social.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSendEkpErrorMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSendEkpErrorService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
/**
* 收入明细表
*
* @author hgw
* @date 2022-08-30 17:34:58
*/
@Log4j2
@Service
public class TSendEkpErrorServiceImpl extends ServiceImpl<TSendEkpErrorMapper, TSendEkpError> implements TSendEkpErrorService {
/**
* @Description: 新增-推送ekp报错的记录表;
* @Author: hgw
* @Date: 2022/8/31 16:34
* @return: boolean
**/
@Override
public boolean saveError(TSendEkpError tSendEkpError) {
// 类型、创建日不可为空
if (Common.isEmpty(tSendEkpError.getType()) || Common.isEmpty(tSendEkpError.getCreateDay())) {
return false;
}
TSendEkpError error = baseMapper.getByTitleTypeDay(tSendEkpError);
if (error == null) {
return this.save(tSendEkpError);
} else {
error.setNums(error.getNums()+ CommonConstants.ONE_INT);
return this.updateById(error);
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TSendEkpErrorMapper">
<resultMap id="tSendEkpErrorMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError">
<id property="id" column="ID"/>
<result property="title" column="title"/>
<result property="type" column="TYPE"/>
<result property="createDay" column="CREATE_DAY"/>
<result property="linkId" column="LINK_ID"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="createUserName" column="CREATE_USER_NAME"/>
<result property="nums" column="NUMS"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.TITLE,
a.TYPE,
a.CREATE_DAY,
a.LINK_ID,
a.CREATE_TIME,
a.CREATE_USER_NAME,
a.NUMS
</sql>
<sql id="tSendEkpError_where">
<if test="tSendEkpError != null">
<if test="tSendEkpError.id != null and tSendEkpError.id.trim() != ''">
AND a.ID = #{tSendEkpError.id}
</if>
<if test="tSendEkpError.title != null and tSendEkpError.title.trim() != ''">
AND a.TITLE = #{tSendEkpError.title}
</if>
<if test="tSendEkpError.title == null or tSendEkpError.title.trim() == ''">
AND a.TITLE is null
</if>
<if test="tSendEkpError.type != null and tSendEkpError.type.trim() != ''">
AND a.TYPE = #{tSendEkpError.type}
</if>
<if test="tSendEkpError.createDay != null and tSendEkpError.createDay.trim() != ''">
AND a.CREATE_DAY = #{tSendEkpError.createDay}
</if>
</if>
</sql>
<!-- 查找对应类型的1条数据来更新 -->
<select id="getByTitleTypeDay" resultMap="tSendEkpErrorMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_provident_fund a
<where>
1=1
<include refid="tSendEkpError_where"/>
</where>
limit 1
</select>
</mapper>
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