Commit 404c4ce1 authored by fangxinjiang's avatar fangxinjiang

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

parents 1ccc81f8 69151690
......@@ -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("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 null;
} else {
wholeForm.add("fdModelId", ekpProperties.getFdModelIdRisk());
wholeForm.add("fdFlowId", ekpProperties.getFdFlowIdRisk());
log.info(EkpConstants.SEND_SUCCESS + body);
return body;
}
} catch (Exception e) {
log.info(e.getMessage());
return null;
}
}
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认证,那么客户端需要加入
......
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,25 +35,23 @@ 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();
......
......@@ -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;
}
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,17 @@ 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条,请分批导入";
......
......@@ -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;
/**
* 重发标识
......
......@@ -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,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
//生成收入数据
createInsuranceInfo(detail);
}else {
//按天
//计算起止时间的天数
......@@ -1290,9 +1310,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
//生成收入数据
createInsuranceInfo(detail);
}
//生成收入数据
createInsuranceInfo(detail);
}
//实缴
if(detail.getSettleType() == CommonConstants.ONE_INT){
......@@ -1367,6 +1387,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);
......@@ -3105,6 +3128,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 +3219,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 +3248,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
return insuredList;
return R.ok(insuredList);
}
/**
......@@ -3266,16 +3295,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 +3324,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
return insuranceRefundList;
return R.ok(insuranceRefundList);
}
/**
......@@ -3343,7 +3375,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 +3387,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 +3532,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 +3600,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 +3687,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 +3803,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 +3813,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)) {
......@@ -3824,7 +3868,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 +3878,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)) {
......@@ -3984,15 +4028,28 @@ 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.setActualPushTime(LocalDateTime.now());
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);
......@@ -5614,7 +5671,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 +5683,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){
......@@ -5716,7 +5773,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;
}
......@@ -5804,7 +5862,7 @@ 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);
......
......@@ -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,191 @@ 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());
//商险结算信息
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);
String s = null;
String settleType = tInsuranceEkp.getSettleType();
if(InsurancesConstants.ACTUAL_SETTLE_BILL.equals(settleType)){
settleType = CommonConstants.ONE_STRING;
}
if(InsurancesConstants.ESTIMATE_SETTLE_BILL.equals(settleType)){
settleType = CommonConstants.ZERO_STRING;
}
Integer pushType = tInsuranceEkp.getPushType();
//商险结算信息
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getById(tInsuranceEkp.getDefaultSettleId());
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> 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());
if(settleType.equals(CommonConstants.ZERO_STRING)){
ekpParam.setEstimateStatus(EkpConstants.HAVE);
}else{
ekpParam.setEstimateStatus(EkpConstants.NOTHING);
}
//预估新增重发
if(CommonConstants.ONE_INT == pushType){
//如果结算类型不一致,结算类型不为空且已预估发送,结算id不一致
if(!settleTypeEquals || !estimatePush || !settleIdEquals){
ekpUpdate.set(TInsuranceEkp :: getResendFlag,CommonConstants.TWO_INT);
update(ekpUpdate);
continue;
}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);
update(ekpUpdate);
}else{
break;
}
}
//如果当前需要重发实际保费的数据已发送,则过滤掉执行下一条数据
if(CommonConstants.TWO_INT == pushType && CommonConstants.ONE_INT == isActualPush){
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
}
//实缴新增重发
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)){
settleUpdate.set(TInsuranceSettle :: getActualPushTime,LocalDateTime.now())
.set(TInsuranceSettle ::getIsActualPush,CommonConstants.ONE_INT);
tInsuranceSettleService.update(settleUpdate);
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
update(ekpUpdate);
}else{
break;
}
}
EkpInteractiveParam ekpParam = new EkpInteractiveParam();
BeanCopyUtils.copyProperties(tInsuranceEkp,ekpParam);
//如果预估未结算
LambdaUpdateWrapper<TInsuranceSettle> updateWrapper = new LambdaUpdateWrapper<>();
String s = null;
if(InsurancesConstants.SETTLE_ZERO.equals(estimateStatus)){
//实缴未结算
if(InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){
//如果是新增预估保费,则推送预估保费新增
if(CommonConstants.ONE_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
updateWrapper.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle :: getIsEstimatePush,CommonConstants.ONE_INT)
.set(TInsuranceSettle :: getEstimatePushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
}
}
//如果是新增实缴保费,则推送实缴保费新增
if(CommonConstants.TWO_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
updateWrapper.eq(TInsuranceSettle::getId, tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle::getIsActualPush, CommonConstants.ONE_INT)
.set(TInsuranceSettle::getActualPushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
}
}
//如果是变更结算信息,则推送变更结算信息
if(CommonConstants.THREE_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
updateWrapper.eq(TInsuranceSettle::getId, tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle::getIsActualPush, CommonConstants.ONE_INT)
.set(TInsuranceSettle::getActualPushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
LambdaUpdateWrapper<TInsuranceDetail> detailLambdaUpdate = new LambdaUpdateWrapper<>();
detailLambdaUpdate.eq(TInsuranceDetail::getId, tInsuranceEkp.getDetailId())
.set(TInsuranceDetail::getSettleMonth, CommonConstants.ONE_INT);
tInsuranceSettleService.update(updateWrapper);
}
}
//如果是作废信息,则推送作废信息
if(CommonConstants.FOUR_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
}
if(CommonConstants.FIVE_INT == pushType || CommonConstants.SIX_INT == pushType){
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
failList.add(tInsuranceEkp);
continue;
}
//成功则更新,不成功则跳出循环
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}
//ekp结算信息
SettleVo settleVo = tInsuranceDetailService.getInsuranceDetailSettleStatus(tInsuranceEkp.getDetailId(), tInsuranceEkp.getDefaultSettleId());
//实缴结算状态
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(!settleTypeEquals || !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)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
update(ekpUpdate);
}else{
break;
}
}
}
//推送作废信息
if(CommonConstants.FOUR_INT == pushType){
//如果结算类型不一致,结算类型不为空且已发送,结算id不一致
if(eStatus && aStatus){
ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
ekpParam.setInteractiveType(InsurancesConstants.ABOLISH_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
detailUpdate.set(TInsuranceDetail :: getDefaultSettleId,null);
tInsuranceDetailService.update(detailUpdate);
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
update(ekpUpdate);
}else{
break;
}
}
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)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
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);
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}
if(CommonConstants.SIX_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
//如果为合并结算,则推送实缴红冲
if(!actualPush){
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
BigDecimal actualPremium = ekpParam.getActualPremium();
ekpParam.setActualPremium(actualPremium.negate());
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
update(ekpUpdate);
}else{
//推送预估新增,实缴新增,变更结算信息,作废,则不进行重发
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
break;
}
}
}else{
//如果实缴未结算
if(InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){
//如果是作废信息,则推送预估红冲信息
if(CommonConstants.FOUR_INT == pushType){
BigDecimal estimatePremium = ekpParam.getEstimatePremium();
ekpParam.setActualPremium(estimatePremium.negate());
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
} else if(CommonConstants.FIVE_INT == pushType){
//如果是预估红冲信息,则推送预估红冲信息
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}else{
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
}
}else{
//如果是实缴红冲信息,则推送实缴红冲信息
if(CommonConstants.SIX_INT == pushType){
BigDecimal actualPremium = ekpParam.getActualPremium();
ekpParam.setActualPremium(actualPremium.negate());
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}else{
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
}
}
ekpUpdate.set(TInsuranceEkp :: getResendFlag,CommonConstants.TWO_INT);
update(ekpUpdate);
continue;
}
}else{
//结算id与当前不一致则不进行重发
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
}
//推送预估红冲信息
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);
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);
update(ekpUpdate);
}else{
break;
}
}
}
updateBatchById(failList);
return R.ok("发送成功");
}else{
return R.failed("无需要发送的信息");
......
......@@ -32,6 +32,7 @@
<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="TINYINT"/>
</resultMap>
......@@ -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
</sql>
<select id="getEkpRefundList" resultMap="BaseResultMap">
......
......@@ -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 属性名
......
......@@ -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);
/**
* 工资报账表附加-工资明细简单分页查询
......
......@@ -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);
}
......@@ -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 属性名
......
......@@ -92,6 +92,9 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
@Autowired
private EkpSalaryUtil ekpSalaryUtil;
@Autowired
private TApprovalRecordService auditLogService;
/**
* 标准薪酬工资表简单分页查询
*
......@@ -545,10 +548,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 +566,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.SPECIAL_DEDU_MONEY_SUM_JAVA.equals(item.getJavaFiedName())) {
sdSumList.add(item.getSalaryMoney());
}
if (SalaryConstants.RELAY_SALARY_JAVA.equals(item.getJavaFiedName())) {
ySalary.add(item.getSalaryMoney());
ySalary = ySalary.add(item.getSalaryMoney());
}
if (SalaryConstants.SALARY_TAX_JAVA.equals(item.getJavaFiedName())) {
sumTax = sumTax.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.COST_REDUCTION_JAVA.equals(item.getJavaFiedName())) {
costReduction = costReduction.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.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,28 +510,47 @@ 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);
//计算个税
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());// 应纳税额
break;
if (i.compareTo(BigDecimal.ZERO) == SalaryConstants.MORE_THAN ) {
BigDecimal sumI = BigDecimalUtils.safeSubtract(BigDecimalUtils.safeAdd(i,ySalary),
BigDecimalUtils.safeAdd(sumDeductSalary));
for (TSalaryTaxConfig sub : personTax) {
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;
}
//计算年终奖税
//年终奖
......@@ -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',
......
......@@ -444,7 +444,7 @@
<!-- 获取薪资明细 -->
<select id="getEkpSalaryParamList" resultMap="ekpSalaryParamVoMap">
select
a.id fd_id
a.id
,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
......
......@@ -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
......
......@@ -2209,6 +2209,23 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
public List<String> initEkpPushSocialParam(List<TForecastLibrary> unPushInfo) {
List<String> pushList = new ArrayList<>();
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 +2315,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 +2330,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 +2338,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//单号
socialParam.setFd_3adfe95c169c48(CommonConstants.EMPTY_STRING);
//客户编码
socialParam.setFd_3adfe8c73cb5a4(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());
//社保户
......@@ -2419,6 +2440,23 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
public List<String> initEkpPushFundParam(List<TForecastLibrary> unPushInfo) {
List<String> pushList = new ArrayList<>();
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());
......@@ -2438,13 +2476,13 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
//缴纳月份
if (Common.isNotNull(library.getSocialPayMonth())) {
fundParam.setFd_3adfe8cf632700(library.getSocialPayMonth());
fundParam.setFd_3adfe8cf632700(dateStringInsert(library.getSocialPayMonth()));
} else {
fundParam.setFd_3adfe8cf632700(CommonConstants.EMPTY_STRING);
}
//生成月份
if (Common.isNotNull(library.getSocialCreateMonth())) {
fundParam.setFd_3adfe8cb96c41e(library.getSocialCreateMonth());
fundParam.setFd_3adfe8cb96c41e(dateStringInsert(library.getSocialCreateMonth()));
} else {
fundParam.setFd_3adfe8cb96c41e(CommonConstants.EMPTY_STRING);
}
......@@ -2463,7 +2501,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 +2509,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//单号
fundParam.setFd_3adfe95c169c48(CommonConstants.EMPTY_STRING);
//客户编码
fundParam.setFd_3adfe8c73cb5a4(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);
//个人代缴
......@@ -2543,7 +2585,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
String sourceType = "";
if (Common.isNotNull(library.getProvidentId())) {
sourceType = CommonConstants.TWO_STRING;
} else {
}else if (Common.isNotNull(library.getSocialId())) {
sourceType = CommonConstants.ONE_STRING;
}
......@@ -2565,8 +2607,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
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.ONE_STRING.equals(sourceType))) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
......@@ -2597,8 +2640,9 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
}
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.ONE_STRING.equals(sourceType))) {
//预估模式
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType()) &&
CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
......@@ -2651,7 +2695,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());
}
......@@ -2664,4 +2708,11 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
incomeService.saveDetail(detail);
}
public String dateStringInsert(String month) {
StringBuilder sb = new StringBuilder(month);
sb.insert(4, "-");
String replaceMonth = sb.toString();
return replaceMonth;
}
}
......@@ -32,6 +32,8 @@ 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.mapper.TIncomeMapper;
......@@ -272,10 +274,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,15 +287,34 @@ 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);
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
......@@ -312,7 +332,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());
// 项目名称
......
......@@ -64,6 +64,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentHeFeiVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo;
import lombok.extern.log4j.Log4j2;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -2311,6 +2312,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 +2368,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 +2396,17 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//单号
socialParam.setFd_3adfe95c169c48(CommonConstants.EMPTY_STRING);
//客户编码
socialParam.setFd_3adfe8c73cb5a4(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());
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 +2550,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 +2575,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 +2598,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 +2613,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//单号
fundParam.setFd_3adfe95c169c48(CommonConstants.EMPTY_STRING);
//客户编码
fundParam.setFd_3adfe8c73cb5a4(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());
......@@ -2771,4 +2823,11 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
detail.setId(CommonConstants.NULL);
incomeService.saveDetail(detail);
}
public String dateStringInsert(String month) {
StringBuilder sb = new StringBuilder(month);
sb.insert(4, "-");
String replaceMonth = sb.toString();
return replaceMonth;
}
}
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