Commit d34779c0 authored by fangxinjiang's avatar fangxinjiang

批量办理 50%

parent 0a1387ab
......@@ -422,5 +422,8 @@ public interface CommonConstants {
public static final String SUCCESS_MSG_PREFIX = "success=";
// 社保细分类型 hgw 2021-6-9 17:54:08
public static final String[] SOCIAL_HANDLE_TYPE = {"0","养老", "医疗", "失业", "工伤", "生育", "大病"};
public static final int SIXTY_INT = 60;
}
......@@ -23,9 +23,16 @@ public class DispatchConstants {
public static final String EMP_PHONE_INVALID = "档案手机号无效,请更新档案或模板的手机号码!";
public static final String DISPATCH_PHONE_NOT_EMPTY = "派单手机号不可为空,请更新档案或模板的手机号码!";
public static final String DISPATCH_ADD = "派增";
public static final String DISPATCH_REDUCE = "派减";
public static final String DISPATCH_SOCIAL_ADD = "社保派增";
public static final String DISPATCH_SOCIAL_HANDLE_SUCCESS = "办理成功:";
public static final String DISPATCH_SOCIAL_HANDLE_FAIL = "办理失败:";
public static final String DISPATCH_FUND_ADD_SUCCESS = "公积金派增办理成功:";
public static final String DISPATCH_FUND_ADD_FAIL = "公积金派增办理失败:";
/**
/**
* 社保派单
* '缴纳类型(0最低缴纳、1自定义缴纳、2最高缴纳) PAYMENT_TYPE
*/
......@@ -56,7 +63,6 @@ public class DispatchConstants {
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String SOCIAL_INFO= "tSocialInfo";
/**
......@@ -65,7 +71,6 @@ public class DispatchConstants {
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String PROVIDENT_INFO= "tProvidentFund";
......
......@@ -357,19 +357,19 @@ public class TDispatchInfo extends BaseEntity {
/**
* 社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败) 3已派减(已废弃)
* 社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败) 3 部分办理成功 4 办理中
*/
@Length(max = 1, message = "社保办理状态 不能超过1个字符" )
@ExcelAttribute(name = "社保办理状态", maxLength = 1)
@Schema(description = "社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败) 3 部分办理成功 " )
@Schema(description = "社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败) 3 部分办理成功 4 办理中" )
@ExcelProperty("社保办理状态" )
private String socialHandleStatus;
/**
* 公积金办理状态:0 未办理 1办理成功 2 办理失败
* 公积金办理状态:0 未办理 1办理成功 2 办理失败 3 已派减
*/
@Length(max = 1, message = "公积金办理状态 不能超过1个字符" )
@ExcelAttribute(name = "公积金办理状态", maxLength = 1)
@Schema(description = "公积金办理状态:0 未办理 1办理成功 2 办理失败" )
@Schema(description = "公积金办理状态:0 未办理 1办理成功 2 办理失败 3 已派减" )
@ExcelProperty("公积金办理状态" )
private String fundHandleStatus;
/**
......
......@@ -130,10 +130,10 @@ public class TProvidentFund extends BaseEntity {
* 办理状态(0待办理/1已办理2办理失败3已派减)
*/
@NotBlank(message = "办理状态(0待办理/1已办理)不能为空" )
@Length(max = 32, message = "办理状态(0待办理/1已办理) 不能超过32个字符" )
@ExcelAttribute(name = "办理状态(0待办理/1已办理)", isNotEmpty = true, errorInfo = "办理状态(0待办理/1已办理)不能为空", maxLength = 32)
@Length(max = 32, message = "办理状态不能超过32个字符" )
@ExcelAttribute(name = "办理状态", isNotEmpty = true, errorInfo = "办理状态不能为空", maxLength = 32)
@Schema(description = "办理状态(0待办理/1已办理2办理失败3已派减)" )
@ExcelProperty("办理状态(0待办理/1已办理)" )
@ExcelProperty("办理状态" )
private String handleStatus;
/**
* 废弃状态(0正常/1已废弃)
......
......@@ -17,9 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.social.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
......@@ -249,11 +247,11 @@ public class TSocialFundInfo extends BaseEntity {
@ExcelProperty("公积金缴纳地-县" )
private String fundTown;
/**
* 社保派增状态:0待审核、1待办理、2办理成功、3部分办理失败、4办理失败 5 审核不通过
* 社保派增状态:0待审核、1待办理、2办理成功、3部分办理失败、4办理失败 5 审核不通过 6 办理中
*/
@Length(max = 1, message = "社保派增状态 不能超过1个字符" )
@ExcelAttribute(name = "社保派增状态", maxLength = 1)
@Schema(description = "社保派增状态:0待审核、1待办理、2办理成功、3部分办理失败、4办理失败 、5审核不通过" )
@Schema(description = "社保派增状态:0待审核、1待办理、2办理成功、3部分办理失败、4办理失败 、5审核不通过6 办理中" )
@ExcelProperty("社保派增状态" )
private String socialAddStatus;
/**
......@@ -465,6 +463,7 @@ public class TSocialFundInfo extends BaseEntity {
@ExcelAttribute(name = "社保停缴日期", isDate = true)
@Schema(description = "社保停缴日期" )
@ExcelProperty("社保停缴日期" )
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Date socialReduceDate;
/**
* 是否可补缴 0:是,1:否
......
......@@ -234,12 +234,12 @@ public class TSocialInfo extends BaseEntity {
@ExcelProperty("审核状态" )
private String auditStatus;
/**
* 办理状态
* 办理状态:0待办理/1已办理2办理失败3已派减 4 办理中 5 部分办理失败
*/
@NotBlank(message = "办理状态不能为空" )
@Length(max = 32, message = "办理状态 不能超过32个字符" )
@ExcelAttribute(name = "办理状态", isNotEmpty = true, errorInfo = "办理状态不能为空", maxLength = 32)
@Schema(description = "办理状态:0待办理/1已办理2办理失败3已派减" )
@Schema(description = "办理状态:0待办理/1已办理2办理失败3已派减4 办理中 5 部分办理失败" )
@ExcelProperty("办理状态" )
private String handleStatus;
/**
......
......@@ -244,29 +244,29 @@ public class TDispatchInfoController {
public R<List<ErrorMessage>> addApplyAudit(@RequestParam(name = "ids", required = true) String ids,
@RequestParam(name = "auditStatus", required = true) String auditStatus,
@RequestParam(name = "auditRemark", required = false) String auditRemark) {
YifuUser user = SecurityUtils.getUser();
if (null == user) {
return R.failed(CommonConstants.USER_FAIL);
}
try {
if (!Common.isNotNull(ids)) {
return R.failed(DispatchConstants.DISPATCH_ID_NOT_EMPTY);
}
Integer flag = 1;
if (CommonConstants.ONE_STRING.equals(auditStatus)) {
//审核通过
flag = CommonConstants.ZERO_INT;
} else if (CommonConstants.TWO_STRING.equals(auditStatus)) {
//审核不通过
flag = CommonConstants.ONE_INT;
} else {
return R.failed("派单审核状态参数异常:0待审核 1审核通过 2审核不通过");
}
List<ErrorMessage> errorInfo = tDispatchInfoService.addBatchApplyAudit(Common.initStrToList(ids, CommonConstants.COMMA_STRING), user, flag, auditStatus, null==auditRemark?"":auditRemark);
return R.ok(errorInfo,"派单审核结果:");
} catch (Exception e) {
log.error("派单审核异常:" + e.getMessage());
return R.failed("数据异常,派单审核失败!");
}
return tDispatchInfoService.addApplyAudit(ids,auditStatus,auditRemark);
}
/**
* 派单申请办理
* hgw社保办理
* @param ids
* @param handleStatus 1 办理成功 2 办理失败
* @param handleRemark
* @param typeSub 0 社保 1 公积金
* @param socialType (1养老 2医疗 3失业 4工伤 5生育 6大病)
* @return
* @Author fxj
* @Date 2019-09-27
**/
@Operation(description = "派单批量办理,传参派单ID hasPermission('wxhr:tdispatchinfo_addApplyHandle')")
@PostMapping("/addApplyHandle")
@PreAuthorize("@pms.hasPermission('wxhr:tdispatchinfo_addApplyHandle')")
public R<List<ErrorMessage>> addApplyHandle(@RequestParam(name = "ids", required = true) String ids,
@RequestParam(name = "typeSub", required = true) String typeSub,
@RequestParam(name = "auditStatus", required = true) String handleStatus,
@RequestParam(name = "auditRemark", required = false) String handleRemark,
@RequestParam(name = "socialType", required = false) String socialType) {
return tDispatchInfoService.addApplyHandle(ids,typeSub,handleStatus,handleRemark,socialType);
}
}
......@@ -56,4 +56,8 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
DispatchDetailVo getSocialAndFundInfoById(String id);
List<ErrorMessage> addBatchApplyAudit(List<String> initStrToList, YifuUser user, Integer flag, String auditStatus, String auditRemark);
R<List<ErrorMessage>> addApplyAudit(String ids,String auditStatus,String auditRemark);
R<List<ErrorMessage>> addApplyHandle(String ids,String typeSub,String handleStatus,String handleRemark,String socialType);
}
......@@ -45,6 +45,7 @@ import com.yifu.cloud.plus.v1.yifu.social.constants.DispatchConstants;
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.util.ServiceUtil;
import com.yifu.cloud.plus.v1.yifu.social.vo.DispatchDetailVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchImportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoSearchVo;
......@@ -56,15 +57,15 @@ import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.sql.CommonDataSource;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import static java.time.format.DateTimeFormatter.ofPattern;
/**
* 派单信息记录表
*
......@@ -937,11 +938,11 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
social.setPaymentType(excel.getPaymentType());
social.setRecordBase(excel.getRecordBase());
social.setPensionStart(excel.getPensionStart());
social.setMedicalStart(ifNull(excel.getMedicalStart(), excel.getPensionStart()));
social.setUnemployStart(ifNull(excel.getUnemployStart(), excel.getPensionStart()));
social.setBigailmentStart(ifNull(excel.getBigailmentStart(), excel.getPensionStart()));
social.setWorkInjuryStart(ifNull(excel.getWorkInjuryStart(), excel.getPensionStart()));
social.setBirthStart(ifNull(excel.getBirthStart(), excel.getPensionStart()));
social.setMedicalStart(ServiceUtil.ifNull(excel.getMedicalStart(), excel.getPensionStart()));
social.setUnemployStart(ServiceUtil.ifNull(excel.getUnemployStart(), excel.getPensionStart()));
social.setBigailmentStart(ServiceUtil.ifNull(excel.getBigailmentStart(), excel.getPensionStart()));
social.setWorkInjuryStart(ServiceUtil.ifNull(excel.getWorkInjuryStart(), excel.getPensionStart()));
social.setBirthStart(ServiceUtil.ifNull(excel.getBirthStart(), excel.getPensionStart()));
if (CommonConstants.ONE_STRING.equals(excel.getPaymentType())){
if (Common.isNotNull(socialSet.getProvince())){
social.setSocialProvince(Integer.toString(socialSet.getProvince()));
......@@ -954,16 +955,16 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
// 自定义各个基数起缴时间初试化
social.setPersonalPensionCardinal(excel.getPensionCardinal());
social.setPersonalMedicalCardinal(ifNull(excel.getMedicalCardinal(), excel.getPensionCardinal()));
social.setPersonalUnemploymentCardinal(ifNull(excel.getUnemploymentCardinal(), excel.getPensionCardinal()));
social.setPersonalBigailmentCardinal(ifNull(excel.getBigailmentCardinal(), excel.getPensionCardinal()));
social.setPersonalMedicalCardinal(ServiceUtil.ifNull(excel.getMedicalCardinal(), excel.getPensionCardinal()));
social.setPersonalUnemploymentCardinal(ServiceUtil.ifNull(excel.getUnemploymentCardinal(), excel.getPensionCardinal()));
social.setPersonalBigailmentCardinal(ServiceUtil.ifNull(excel.getBigailmentCardinal(), excel.getPensionCardinal()));
social.setUnitPensionCardinal(excel.getPensionCardinal());
social.setUnitMedicalCardinal(ifNull(excel.getMedicalCardinal(), excel.getPensionCardinal()));
social.setUnitUnemploymentCardinal(ifNull(excel.getUnemploymentCardinal(), excel.getPensionCardinal()));
social.setUnitWorkInjuryCardinal(ifNull(excel.getWorkInjuryCardinal(), excel.getPensionCardinal()));
social.setUnitBigailmentCardinal(ifNull(excel.getBigailmentCardinal(), excel.getPensionCardinal()));
social.setUnitBirthCardinal(ifNull(excel.getBirthCardinal(), excel.getPensionCardinal()));
social.setUnitMedicalCardinal(ServiceUtil.ifNull(excel.getMedicalCardinal(), excel.getPensionCardinal()));
social.setUnitUnemploymentCardinal(ServiceUtil.ifNull(excel.getUnemploymentCardinal(), excel.getPensionCardinal()));
social.setUnitWorkInjuryCardinal(ServiceUtil.ifNull(excel.getWorkInjuryCardinal(), excel.getPensionCardinal()));
social.setUnitBigailmentCardinal(ServiceUtil.ifNull(excel.getBigailmentCardinal(), excel.getPensionCardinal()));
social.setUnitBirthCardinal(ServiceUtil.ifNull(excel.getBirthCardinal(), excel.getPensionCardinal()));
}
// 获取到政策后封装相关数据
if (Common.isNotNull(socialSet)){
......@@ -1107,20 +1108,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
socialFundMap.put(excel.getEmpIdcard(),socialFund);
}
}
private BigDecimal ifNull(BigDecimal old,BigDecimal last){
if (Common.isEmpty(old)){
return last;
}
return old;
}
private Date ifNull(Date old,Date last){
if (Common.isEmpty(old)){
return last;
}
return old;
}
private void initHoldInfo(List<String> socialholds,
List<String> fundHolds,
Map<String, SysBaseSetInfo> socialHoldMap,
......@@ -1717,17 +1704,19 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
List<TDispatchInfo> dispatchs = baseMapper.selectList(Wrappers.<TDispatchInfo>query().lambda().in(TDispatchInfo::getId, idsList));
if (Common.isNotNull(dispatchs)) {
// 获取所有派单查询信息
Map<String,TSocialFundInfo> socialFundMap = new HashMap<>();
initSocialFundMap(dispatchs,socialFundMap);
Map<String,TSocialFundInfo> socialFundMap = initSocialFundMap(dispatchs);
try {
TSocialInfo socialInfo;
TProvidentFund providentFund;
String remark;
TAuditInfo auditInfo = null;
TSocialFundInfo sf;
TSocialFundInfo sf = null;
Date now = new Date();
for (TDispatchInfo dis : dispatchs) {
remark = "";
sf = socialFundMap.get(dis.getEmpIdcard());
if (Common.isNotNull(socialFundMap)){
sf = socialFundMap.get(dis.getEmpIdcard());
}
if (Common.isEmpty(sf)){
errorList.add(new ErrorMessage(-1, "找不到员工社保公积金查询数据:" + dis.getEmpName()));
continue;
......@@ -1757,7 +1746,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
sf.setSocialAddStatus(CommonConstants.FOUR_STRING);
sf.setSocialStatus(CommonConstants.TEN_STRING);
}
socialInfo.setAuditTime(new Date());
socialInfo.setAuditTime(now);
socialInfo.setAuditUser(user.getId());
}
// 派减审核
......@@ -1805,7 +1794,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
sf.setFundAddStatus(CommonConstants.FOUR_STRING);
sf.setFundStatus(CommonConstants.NINE_STRING);
}
providentFund.setAuditTime(new Date());
providentFund.setAuditTime(now);
providentFund.setAuditUser(user.getId());
}
//派减
......@@ -1831,9 +1820,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
//派单类型信息拼接
if (CommonConstants.ZERO_STRING.equals(dis.getType())) {
remark += "派增";
remark += DispatchConstants.DISPATCH_ADD;
} else {
remark += "派减";
remark += DispatchConstants.DISPATCH_REDUCE;
}
// 派单状态信息拼接
if (CommonConstants.ZERO_INT == flag.intValue()) {
......@@ -1842,8 +1831,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
remark += "审核不通过:" + auditRemark;
}
//记录处理意见到派单 最新的意见会覆盖之前的,详情 到流程中查询
dis.setHandleRemark(null == auditRemark ? "" : auditRemark);
dis.setAuditRemark(null == auditRemark ? "" : auditRemark);
dis.setHandleRemark(ServiceUtil.ifNullToEmpty(auditRemark));
dis.setAuditRemark(ServiceUtil.ifNullToEmpty(auditRemark));
initAuditInfo(auditInfo, remark, auditStatus, user,remark);
auditInfo.setDispatchInfoId(dis.getId());
//更新派单状态
......@@ -1859,7 +1848,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
//新增审核记录信息
auditInfoMapper.insert(auditInfo);
dis.setAuditUser(user.getId());
dis.setAuditTime(new Date());
dis.setAuditTime(now);
baseMapper.updateById(dis);
}
} catch (Exception e) {
......@@ -1873,14 +1862,569 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
return errorList;
}
private void initSocialFundMap(List<TDispatchInfo> dispatchs,Map<String, TSocialFundInfo> socialFundMap) {
@Override
public R<List<ErrorMessage>> addApplyAudit(String ids, String auditStatus, String auditRemark) {
YifuUser user = SecurityUtils.getUser();
if (null == user) {
return R.failed(CommonConstants.USER_FAIL);
}
try {
if (!Common.isNotNull(ids)) {
return R.failed(DispatchConstants.DISPATCH_ID_NOT_EMPTY);
}
Integer flag = 1;
if (CommonConstants.ONE_STRING.equals(auditStatus)) {
//审核通过
flag = CommonConstants.ZERO_INT;
} else if (CommonConstants.TWO_STRING.equals(auditStatus)) {
//审核不通过
flag = CommonConstants.ONE_INT;
} else {
return R.failed("派单审核状态参数异常:0待审核 1审核通过 2审核不通过");
}
List<ErrorMessage> errorInfo = addBatchApplyAudit(Common.initStrToList(ids, CommonConstants.COMMA_STRING), user, flag, auditStatus, null==auditRemark?"":auditRemark);
return R.ok(errorInfo,"派单审核结果:");
} catch (Exception e) {
log.error("派单审核异常:" + e.getMessage());
return R.failed("数据异常,派单审核失败!");
}
}
@Override
public R<List<ErrorMessage>> addApplyHandle(String ids, String typeSub, String handleStatus, String handleRemark, String socialType) {
try {
YifuUser user = SecurityUtils.getUser();
if (null == user) {
return R.failed(CommonConstants.USER_FAIL);
}
if (!Common.isNotNull(ids)) {
return R.failed(DispatchConstants.DISPATCH_ID_NOT_EMPTY);
}
int flag = 1;
if (CommonConstants.ONE_STRING.equals(handleStatus)) {
//办理成功
flag = CommonConstants.ZERO_INT;
} else if (CommonConstants.TWO_STRING.equals(handleStatus)) {
//办理失败
flag = CommonConstants.ONE_INT;
} else {
return R.failed("派单办理状态参数异常:0待办理 1办理通过 2办理不通过");
}
List<ErrorMessage> errorInfo = addBatchApplyHandle(Common.initStrToList(ids, CommonConstants.COMMA_STRING)
, typeSub, user, flag, handleStatus, null==handleRemark?"":handleRemark, socialType);
if (errorInfo == null || errorInfo.isEmpty()) {
return R.ok(null,"办理成功!");
} else {
return R.ok(errorInfo,"派单办理结果:");
}
} catch (Exception e) {
log.error("派单办理异常:" + e.getMessage());
return R.failed("数据异常,办理失败!");
}
}
private Map<String, TSocialFundInfo> initSocialFundMap(List<TDispatchInfo> dispatchs) {
List<String> idCards = dispatchs.stream().map(TDispatchInfo::getEmpIdcard).collect(Collectors.toList());
if (Common.isNotNull(idCards)){
List<TSocialFundInfo> socialFunds = socialFundMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda()
.in(TSocialFundInfo::getEmpIdcard,idCards));
if (Common.isNotNull(socialFunds)){
socialFundMap = socialFunds.stream().collect(Collectors.toMap(k->k.getEmpIdcard(),k->k));
return socialFunds.stream().collect(Collectors.toMap(k->k.getEmpIdcard(),k->k));
}
}
return new HashMap<>();
}
/**
* 社保派单批量办理
* @param idsList
* @param user
* @param flag 0审核通过; 1审核不通过
* @param handleStatus 1 办理成功 2 办理失败
* @param handleRemark
* @param socialType 社保拆分的每一项(1养老 2医疗 3失业 4工伤 5生育 6大病)
* @return
* @Author fxj
* @Date 2022-07-26
**/
public List<ErrorMessage> addBatchApplyHandle(List<String> idsList, String typeSub, YifuUser user
, int flag, String handleStatus, String handleRemark, String socialType) {
List<ErrorMessage> errorList = new ArrayList<>();
if (!Common.isNotNull(idsList)) {
errorList.add(new ErrorMessage(-1, CommonConstants.PARAM_IS_NOT_ERROR));
return errorList;
}
List<TDispatchInfo> disList = baseMapper.selectList(Wrappers.<TDispatchInfo>query().lambda().in(TDispatchInfo::getId, idsList));
if (Common.isNotNull(disList)) {
// 获取所有派单查询信息
Map<String,TSocialFundInfo> socialFundMap = initSocialFundMap(disList);
try {
TSocialInfo socialInfo = null;
TProvidentFund providentFund = null;
TAuditInfo auditInfo = null;
StringBuilder socialTypeRemark = null;
TSocialFundInfo sf = null;
Date now = new Date();
StringBuffer temp = new StringBuffer();
for (TDispatchInfo dis : disList) {
if (Common.isNotNull(socialFundMap)){
sf = socialFundMap.get(dis.getEmpIdcard());
}
if (Common.isEmpty(sf)){
errorList.add(new ErrorMessage(-1, "找不到员工社保公积金查询数据:" + dis.getEmpName()));
continue;
}
if (!CommonConstants.TWO_STRING.equals(dis.getStatus())) {
errorList.add(new ErrorMessage(-1, "派单审核通过后才可以办理:" + dis.getEmpName()));
continue;
}
if (Common.isNotNull(dis.getSocialId())) {
// 无更新直接跳过
if (Common.isEmpty(socialTypeRemark.toString())
&& CommonConstants.ZERO_STRING.equals(typeSub)
&& CommonConstants.ZERO_STRING.equals(dis.getType())
&& Common.isNotNull(socialType)) {
continue;
}
socialInfo = socialMapper.selectById(dis.getSocialId());
socialTypeRemark = getHandleRemark(socialType, socialInfo);
} else {
socialInfo = null;
}
if (Common.isNotNull(dis.getFundId())) {
providentFund = fundMapper.selectById(dis.getFundId());
} else {
providentFund = null;
}
//派增处理
if (CommonConstants.ZERO_STRING.equals(dis.getType())) {
//社保派增办理
if (CommonConstants.ZERO_STRING.equals(typeSub)) {
if (Common.isNotNull(socialInfo) && Common.isNotNull(socialInfo.getId())) {
socialInfo.setHandleStatus(handleStatus);
socialInfo.setHandleTime(now);
socialInfo.setHandleUser(user.getId());
// 社保办理状态补充判断:
this.setSocialHandleStatus(handleStatus, socialType, flag, socialInfo, dis,sf);
// 派增办理,全部失败,清空社保状态
if (CommonConstants.TWO_STRING.equals(socialInfo.getHandleStatus())) {
// 同步预估库数据 TODO
}
socialMapper.updateById(socialInfo);
dis.setSocialHandleRemark(ServiceUtil.ifNullToEmpty(handleRemark));
auditInfo = new TAuditInfo();
auditInfo.setType(CommonConstants.ONE_STRING);
if (CommonConstants.ZERO_INT == flag) {
temp.setLength(CommonConstants.ZERO_INT);
temp.append(DispatchConstants.DISPATCH_SOCIAL_ADD);
temp.append(socialTypeRemark.toString());
temp.append(DispatchConstants.DISPATCH_SOCIAL_HANDLE_SUCCESS);
initAuditInfo(auditInfo, ( temp + handleRemark), handleStatus, user, temp.toString());
} else {
temp.setLength(CommonConstants.ZERO_INT);
temp.append(DispatchConstants.DISPATCH_SOCIAL_ADD);
temp.append(socialTypeRemark.toString());
temp.append(DispatchConstants.DISPATCH_SOCIAL_HANDLE_FAIL);
initAuditInfo(auditInfo, ( temp + handleRemark), handleStatus, user, temp.toString());
}
dis.setSocialHandleStatus(socialInfo.getHandleStatus());
auditInfo.setSocialId(dis.getId());
} else {
errorList.add(new ErrorMessage(-1, "找不到对应员工社保派增派单数据:" + dis.getEmpName()));
continue;
}
//公积金办理
} else if (CommonConstants.ONE_STRING.equals(typeSub)) {
if (null != providentFund && Common.isNotNull(providentFund.getId())) {
// 办理状态(0待办理/1已办理2办理失败3已派减)
providentFund.setHandleStatus(handleStatus);
providentFund.setHandleTime(now);
providentFund.setHandleUser(user.getId());
if (CommonConstants.dingleDigitStrArray[0].equals(dis.getType()) && CommonConstants.ZERO_INT == flag) {
//派增办理通过 改成可派减状态
providentFund.setReduceCan(CommonConstants.dingleDigitStrArray[0]);
} else if (CommonConstants.dingleDigitStrArray[0].equals(dis.getType()) && CommonConstants.ONE_INT == flag) {
//派增办理不通过 改成不可派减状态
providentFund.setReduceCan(CommonConstants.dingleDigitStrArray[1]);
// 同步预估库数据 TODO
}
fundMapper.updateById(providentFund);
dis.setFundHandleRemark(ServiceUtil.ifNullToEmpty(handleRemark));
if (CommonConstants.ZERO_INT == flag) {
initAuditInfo(auditInfo, (DispatchConstants.DISPATCH_FUND_ADD_SUCCESS + handleRemark), handleStatus, user, DispatchConstants.DISPATCH_FUND_ADD_SUCCESS);
} else {
initAuditInfo(auditInfo, (DispatchConstants.DISPATCH_FUND_ADD_FAIL + handleRemark), handleStatus, user, DispatchConstants.DISPATCH_FUND_ADD_FAIL);
}
auditInfo.setProvidentId(dis.getId());
} else {
errorList.add(new ErrorMessage(-1, "找不到对应员工公积金派增派单数据:" + dis.getEmpName()));
continue;
}
}
//派减处理
} else if (CommonConstants.ONE_STRING.equals(dis.getType())) {
//社保派减办理
if (CommonConstants.ZERO_STRING.equals(typeSub)) {
if (null != socialInfo && Common.isNotNull(socialInfo.getId())) {
// 社保办理状态补充判断:
this.setSocialHandleStatus(handleStatus, socialType, flag, socialInfo, dis,sf);
//社保派减办理成功才变更社保的办理状态
if (CommonConstants.ZERO_INT == flag) {
socialInfo.setHandleStatus(CommonConstants.THREE_STRING);
socialInfo.setReduceHandleUser(user.getId());
socialInfo.setReduceHandleTime(now);
if (Common.isNotNull(dis.getSocialReduceDate())) {
socialInfo.setSocialReduceDate(dis.getSocialReduceDate());
}
}
socialInfo.setHandleTime(now);
socialInfo.setHandleUser(user.getId().toString());
if (CommonConstants.dingleDigitStrArray[1].equals(dis.getType()) && CommonConstants.ONE_INT == flag) {
//派减办理不通过
socialInfo.setReduceCan(CommonConstants.dingleDigitStrArray[0]);//改成可派减状态
// 同步预估库数据
}
socialMapper.updateById(socialInfo);
dis.setSocialHandleRemark(null == handleRemark ? "" : handleRemark);
auditInfo = new TAuditInfo();
auditInfo.setType(CommonConstants.ONE_STRING);
if (CommonConstants.ZERO_INT == flag) {
initAuditInfo(auditInfo, ("社保派减" + socialTypeRemark.toString() + "办理成功:" + handleRemark), handleStatus, user, "");
} else {
initAuditInfo(auditInfo, ("社保派减" + socialTypeRemark.toString() + "办理失败:" + handleRemark), handleStatus, user, "");
}
dis.setSocialHandleStatus(handleStatus);
auditInfo.setSocialId(dis.getId());
} else {
errorList.add(new ErrorMessage(-1, "找不到对应员工社保数据:" + dis.getEmpName()));
continue;
}
//公积金派减办理
} else if (CommonConstants.ONE_STRING.equals(typeSub)) {
if (null != providentFund && Common.isNotNull(providentFund.getId())) {
//公积金派减办理成功才变更公积金的办理状态
if (CommonConstants.ZERO_INT == flag) {
providentFund.setHandleStatus(CommonConstants.THREE_STRING);
providentFund.setReduceHandleTime(now);
providentFund.setReduceHandleUser(user.getId().toString());
if (Common.isNotNull(dis.getFundReduceDate())) {
providentFund.setFundReduceDate(dis.getFundReduceDate());
}
// 派减办理成功后,同步预估库数据清理
}
providentFund.setHandleTime(now);
providentFund.setHandleUser(user.getId().toString());
if (CommonConstants.dingleDigitStrArray[1].equals(dis.getType()) && CommonConstants.ONE_INT == flag) {
//派减办理不通过
providentFund.setReduceCan(CommonConstants.dingleDigitStrArray[0]);//改成可派减状态
// 同步预估库数据
}
fundMapper.updateById(providentFund);
dis.setFundHandleRemark(ServiceUtil.ifNullToEmpty(handleRemark));
if (CommonConstants.ZERO_INT == flag) {
initAuditInfo(auditInfo, ("公积金派减办理成功:" + handleRemark), handleStatus, user, "");
dis.setFundHandleStatus(CommonConstants.ONE_STRING);
} else {
initAuditInfo(auditInfo, ("公积金派减办理失败:" + handleRemark), handleStatus, user, "");
dis.setFundHandleStatus(CommonConstants.TWO_STRING);
}
auditInfo.setProvidentId(dis.getId());
} else {
errorList.add(new ErrorMessage(-1, "找不到对应员工公积金数据:" + dis.getEmpName()));
continue;
}
}
//更新派单状态
if (null != auditInfo) {
//派增判断
if (CommonConstants.ZERO_STRING.equals(dis.getType())) {
if (null != socialInfo && null != providentFund
&& (
CommonConstants.ZERO_STRING.equals(socialInfo.getHandleStatus())
|| CommonConstants.FOUR_STRING.equals(socialInfo.getHandleStatus())
|| CommonConstants.ZERO_STRING.equals(providentFund.getHandleStatus())
)) {
//同时有社保和公积金的只要有一条没办理就不改派单状态
} else {
if ((CommonConstants.ZERO_INT == flag || CommonConstants.ONE_INT == flag)
&& (socialInfo == null
|| (!CommonConstants.ZERO_STRING.equals(socialInfo.getHandleStatus())
&& !CommonConstants.FOUR_STRING.equals(socialInfo.getHandleStatus())))) {
//办理成功 更新为办理完结 2020-05-26 办理失败 更新为办理完结 2020-05-26
dis.setStatus(CommonConstants.FOUR_STRING);
}
}
//派减判断
} else if (CommonConstants.ONE_STRING.equals(dis.getType())) {
if (null != socialInfo && null != providentFund && (
((CommonConstants.ONE_STRING.equals(socialInfo.getHandleStatus()) || CommonConstants.FIVE_STRING.equals(socialInfo.getHandleStatus())) && CommonConstants.ONE_STRING.equals(socialInfo.getReduceCan()))
|| (CommonConstants.ONE_STRING.equals(providentFund.getHandleStatus()) && CommonConstants.ONE_STRING.equals(providentFund.getReduceCan()))
)) {
//同时有社保和公积金的只要有一条没办理就不改派单状态
} else {
if (CommonConstants.ZERO_INT == flag || CommonConstants.ONE_INT == flag) {
//办理成功或失败 更新为办理完结 2020-05-26
dis.setStatus(CommonConstants.FOUR_STRING);
}
}
}
if (CommonConstants.ZERO_INT == flag) {
auditInfo.setAuditStatus(CommonConstants.SIX_STRING);
} else if (CommonConstants.ONE_INT == flag) {
auditInfo.setAuditStatus(CommonConstants.FIVE_STRING);
}
dis.setHandleRemark(null == handleRemark ? "" : handleRemark);
//新增办理记录信息
auditInfo.setDispatchInfoId(dis.getId());
auditInfo.setEmpIdcard(dis.getEmpIdcard());
auditInfoMapper.insert(auditInfo);
baseMapper.updateById(dis);
} else {
errorList.add(new ErrorMessage(-1, "派单数据错误!"));
}
}
}
} catch(Exception e){
log.error("派单办理异常:", e);
errorList.add(new ErrorMessage(-1, "派单办理异常:" + e.getMessage()));
return errorList;
}
} else{
errorList.add(new ErrorMessage(-1, DispatchConstants.NO_OPERATOR_DATA));
return errorList;
}
return errorList;
}
private StringBuilder getHandleRemark(String socialType, TSocialInfo socialInfo) {
StringBuilder socialTypeRemark;
socialTypeRemark = new StringBuilder();
if (Common.isNotNull(socialType)) {
String[] stArr = socialType.split(",");
for (String st : stArr) {
// socialType (1养老 2医疗 3失业 4工伤 5生育 6大病)
if (Integer.parseInt(st) == CommonConstants.ONE_INT
&& CommonConstants.ZERO_STRING.equals(socialInfo.getPensionHandle())){
socialTypeRemark.append(CommonConstants.SOCIAL_HANDLE_TYPE[Integer.parseInt(st)]).append("、");
}
if (Integer.parseInt(st) == CommonConstants.TWO_INT
&& CommonConstants.ZERO_STRING.equals(socialInfo.getMedicalHandle())){
socialTypeRemark.append(CommonConstants.SOCIAL_HANDLE_TYPE[Integer.parseInt(st)]).append("、");
}
if (Integer.parseInt(st) == CommonConstants.THREE_INT
&& CommonConstants.ZERO_STRING.equals(socialInfo.getUnemployHandle())){
socialTypeRemark.append(CommonConstants.SOCIAL_HANDLE_TYPE[Integer.parseInt(st)]).append("、");
}
if (Integer.parseInt(st) == CommonConstants.FOUR_INT
&& CommonConstants.ZERO_STRING.equals(socialInfo.getWorkInjuryHandle())){
socialTypeRemark.append(CommonConstants.SOCIAL_HANDLE_TYPE[Integer.parseInt(st)]).append("、");
}
if (Integer.parseInt(st) == CommonConstants.FIVE_INT
&& CommonConstants.ZERO_STRING.equals(socialInfo.getBirthHandle())){
socialTypeRemark.append(CommonConstants.SOCIAL_HANDLE_TYPE[Integer.parseInt(st)]).append("、");
}
if (Integer.parseInt(st) == CommonConstants.SIX_INT
&& CommonConstants.ZERO_STRING.equals(socialInfo.getBigailmentHandle())
&& CommonConstants.ZERO_STRING.equals(socialInfo.getIsIllness())){
socialTypeRemark.append(CommonConstants.SOCIAL_HANDLE_TYPE[Integer.parseInt(st)]).append("、");
}
}
if (Common.isNotNull(socialTypeRemark.toString())){
socialTypeRemark.deleteCharAt(socialTypeRemark.length()-1);
}
}
return socialTypeRemark;
}
/**
* @param flag 0审核通过; 1审核不通过
* @param socialInfo
* @param dis
* @param socialType 社保拆分的每一项(1养老 2医疗 3失业 4工伤 5生育 6大病)
* @Description: 判断社保状态并塞值
* @Author: fxj
* @Date: 2022-07-26
* @return: void
**/
private void setSocialHandleStatus(String handleStatus, String socialType, int flag, TSocialInfo socialInfo
, TDispatchInfo dis, TSocialFundInfo sf) {
// 批量办理,或者办理选择对应的类型,修改对应的办理状态
this.setSocialSixStatus(handleStatus, socialType, socialInfo);
// HandleStatus办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败) 3已派减 4办理中 5部分办理失败
// 派减,审核不通过,社保状态不变更
// 1.派减处理
if (CommonConstants.ONE_STRING.equals(dis.getType())){
//办理成功 (办理失败不做处理,预估在另外的地方处理)
if (CommonConstants.ZERO_INT == flag){
// 同步社保分项办理状态
socialInfo.setPensionHandle(CommonConstants.THREE_STRING);
socialInfo.setMedicalHandle(CommonConstants.THREE_STRING);
socialInfo.setUnemployHandle(CommonConstants.THREE_STRING);
socialInfo.setWorkInjuryHandle(CommonConstants.THREE_STRING);
socialInfo.setBirthHandle(CommonConstants.THREE_STRING);
socialInfo.setBigailmentHandle(CommonConstants.THREE_STRING);
socialInfo.setHandleStatus(CommonConstants.THREE_STRING);
socialInfo.setReduceCan(CommonConstants.dingleDigitStrArray[1]);//改成不可派减状态
sf.setSocialReduceStatus(CommonConstants.TWO_STRING);
sf.setSocialStatus(CommonConstants.EIGHT_STRING);
sf.setPensionHandle(CommonConstants.THREE_STRING);
sf.setMedicalHandle(CommonConstants.THREE_STRING);
sf.setUnemployHandle(CommonConstants.THREE_STRING);
sf.setWorkInjuryHandle(CommonConstants.THREE_STRING);
sf.setBirthHandle(CommonConstants.THREE_STRING);
sf.setBigailmentHandle(CommonConstants.THREE_STRING);
sf.setHandleStatus(CommonConstants.THREE_STRING);
}
//办理失败不做处理,只更新社保公积金查询状态
if (CommonConstants.ONE_INT == flag){
sf.setSocialReduceStatus(CommonConstants.THREE_STRING);
sf.setSocialStatus(CommonConstants.NINE_STRING);
}
}
// 2.派增处理 socialType 社保拆分的每一项(1养老 2医疗 3失业 4工伤 5生育 6大病)
if (CommonConstants.ZERO_STRING.equals(dis.getType())){
//办理成功 flag=0 办理失败 flag=1
// 有对应办理项且 对应项为待办理或者空时更新 下同
if (socialType.indexOf(CommonConstants.ONE_STRING) > CommonConstants.ZERO_INT
&& (Common.isEmpty(socialInfo.getPensionHandle())
|| CommonConstants.ONE_STRING.equals(socialInfo.getPensionHandle()))){
socialInfo.setPensionHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
sf.setPensionHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
}
if (socialType.indexOf(CommonConstants.TEN_STRING) > CommonConstants.ZERO_INT
&& (Common.isEmpty(socialInfo.getMedicalHandle())
|| CommonConstants.ONE_STRING.equals(socialInfo.getMedicalHandle()))){
socialInfo.setMedicalHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
sf.setMedicalHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
}
if (socialType.indexOf(CommonConstants.THREE_STRING) > CommonConstants.ZERO_INT
&& (Common.isEmpty(socialInfo.getUnemployHandle())
|| CommonConstants.ONE_STRING.equals(socialInfo.getUnemployHandle()))){
socialInfo.setUnemployHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
sf.setUnemployHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
}
if (socialType.indexOf(CommonConstants.FOUR_STRING) > CommonConstants.ZERO_INT
&& (Common.isEmpty(socialInfo.getWorkInjuryHandle())
|| CommonConstants.ONE_STRING.equals(socialInfo.getWorkInjuryHandle()))){
socialInfo.setWorkInjuryHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
sf.setWorkInjuryHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
}
if (socialType.indexOf(CommonConstants.FIVE_STRING) > CommonConstants.ZERO_INT
&& (Common.isEmpty(socialInfo.getBirthHandle())
|| CommonConstants.ONE_STRING.equals(socialInfo.getBirthHandle()))){
socialInfo.setBirthHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
sf.setBirthHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
}
if (socialType.indexOf(CommonConstants.SIX_STRING) > CommonConstants.ZERO_INT
&& (Common.isEmpty(socialInfo.getBigailmentHandle())
|| CommonConstants.ONE_STRING.equals(socialInfo.getBigailmentHandle()))){
socialInfo.setBigailmentHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
sf.setBigailmentHandle(ifNotEquals(CommonConstants.ZERO_INT,flag,CommonConstants.ONE_STRING,CommonConstants.TWO_STRING));
}
// 派增:
if ((Common.isEmpty(socialInfo.getPensionHandle()) || CommonConstants.ONE_STRING.equals(socialInfo.getPensionHandle()))
&& (Common.isEmpty(socialInfo.getMedicalHandle()) || CommonConstants.ONE_STRING.equals(socialInfo.getMedicalHandle()))
&& (Common.isEmpty(socialInfo.getUnemployHandle()) || CommonConstants.ONE_STRING.equals(socialInfo.getUnemployHandle()))
&& (Common.isEmpty(socialInfo.getWorkInjuryHandle()) || CommonConstants.ONE_STRING.equals(socialInfo.getWorkInjuryHandle()))
&& (Common.isEmpty(socialInfo.getBirthHandle()) || CommonConstants.ONE_STRING.equals(socialInfo.getBirthHandle()))
&& (Common.isEmpty(socialInfo.getBigailmentHandle()) || CommonConstants.ONE_STRING.equals(socialInfo.getBigailmentHandle()))) {
// 全部成功(或者为空--兼容历史数据问题):全部成功
socialInfo.setHandleStatus(CommonConstants.ONE_STRING);
socialInfo.setReduceCan(CommonConstants.dingleDigitStrArray[0]);//改成可派减状态
sf.setSocialStatus(CommonConstants.THREE_STRING);
sf.setSocialAddStatus(CommonConstants.TWO_STRING);
sf.setSocialReduceStatus(CommonConstants.ONE_STRING_NEGATE);
sf.setSocialReduceDate(null);
dis.setSocialHandleStatus(CommonConstants.ONE_STRING);
} else if ((Common.isEmpty(socialInfo.getPensionHandle()) || CommonConstants.TWO_STRING.equals(socialInfo.getPensionHandle()))
&& (Common.isEmpty(socialInfo.getMedicalHandle()) || CommonConstants.TWO_STRING.equals(socialInfo.getMedicalHandle()))
&& (Common.isEmpty(socialInfo.getUnemployHandle()) || CommonConstants.TWO_STRING.equals(socialInfo.getUnemployHandle()))
&& (Common.isEmpty(socialInfo.getWorkInjuryHandle()) || CommonConstants.TWO_STRING.equals(socialInfo.getWorkInjuryHandle()))
&& (Common.isEmpty(socialInfo.getBirthHandle()) || CommonConstants.TWO_STRING.equals(socialInfo.getBirthHandle()))
&& (Common.isEmpty(socialInfo.getBigailmentHandle()) || CommonConstants.TWO_STRING.equals(socialInfo.getBigailmentHandle()))) {
// 全部失败(或者为空):全部失败
socialInfo.setHandleStatus(CommonConstants.TWO_STRING);
socialInfo.setReduceCan(CommonConstants.dingleDigitStrArray[1]);//改成不可派减状态
sf.setSocialStatus(CommonConstants.FIVE_STRING);
sf.setSocialAddStatus(CommonConstants.FOUR_STRING);
dis.setSocialHandleStatus(CommonConstants.TWO_STRING);
} else if ((Common.isEmpty(socialInfo.getPensionHandle()) || CommonConstants.ZERO_STRING.equals(socialInfo.getPensionHandle()))
|| (Common.isEmpty(socialInfo.getMedicalHandle()) || CommonConstants.ZERO_STRING.equals(socialInfo.getMedicalHandle()))
|| (Common.isEmpty(socialInfo.getUnemployHandle()) || CommonConstants.ZERO_STRING.equals(socialInfo.getUnemployHandle()))
|| (Common.isEmpty(socialInfo.getWorkInjuryHandle()) || CommonConstants.ZERO_STRING.equals(socialInfo.getWorkInjuryHandle()))
|| (Common.isEmpty(socialInfo.getBirthHandle()) || CommonConstants.ZERO_STRING.equals(socialInfo.getBirthHandle()))
|| (Common.isNotNull(socialInfo.getBigailmentHandle()) && CommonConstants.ZERO_STRING.equals(socialInfo.getBigailmentHandle()))) {
// 含有办理中的:办理中
socialInfo.setHandleStatus(CommonConstants.FOUR_STRING);
socialInfo.setReduceCan(CommonConstants.dingleDigitStrArray[1]);//改成不可派减状态
sf.setSocialStatus(CommonConstants.TWO_STRING);
sf.setSocialAddStatus(CommonConstants.SIX_STRING);
dis.setSocialHandleStatus(CommonConstants.FOUR_STRING);
} else {
// 其他:部分办理失败
socialInfo.setHandleStatus(CommonConstants.FIVE_STRING);
socialInfo.setReduceCan(CommonConstants.dingleDigitStrArray[0]);//改成可派减状态
sf.setSocialStatus(CommonConstants.FOUR_STRING);
sf.setSocialAddStatus(CommonConstants.THREE_STRING);
dis.setSocialHandleStatus(CommonConstants.THREE_STRING);
}
}
}
/**
* @Author fxj
* @Description if flag=obj return value1 else return value2
* @Date 18:02 2022/7/26
**/
private String ifNotEquals(int flag, int obj, String value1, String value2){
if (flag==obj){
return value1;
}
return value2;
}
/**
* @param handleStatus
* @param socialType
* @param socialInfo
* @Description: 填充社保的新的六个状态字段
* @Author: hgw
* @Date: 2021/6/9 17:12
* @return: void
**/
private void setSocialSixStatus(String handleStatus, String socialType, TSocialInfo socialInfo) {
if ((Common.isEmpty(socialType) || socialType.contains(CommonConstants.ONE_STRING))
&& Common.isNotNull(socialInfo.getPensionHandle())
&& CommonConstants.ZERO_STRING.equals(socialInfo.getPensionHandle())) {
socialInfo.setPensionHandle(handleStatus);
}
if ((Common.isEmpty(socialType) || socialType.contains(CommonConstants.TWO_STRING))
&& Common.isNotNull(socialInfo.getMedicalHandle())
&& CommonConstants.ZERO_STRING.equals(socialInfo.getMedicalHandle())) {
socialInfo.setMedicalHandle(handleStatus);
}
if ((Common.isEmpty(socialType) || socialType.contains(CommonConstants.THREE_STRING))
&& Common.isNotNull(socialInfo.getUnemployHandle())
&& CommonConstants.ZERO_STRING.equals(socialInfo.getUnemployHandle())) {
socialInfo.setUnemployHandle(handleStatus);
}
if ((Common.isEmpty(socialType) || socialType.contains(CommonConstants.FOUR_STRING))
&& Common.isNotNull(socialInfo.getWorkInjuryHandle())
&& CommonConstants.ZERO_STRING.equals(socialInfo.getWorkInjuryHandle())) {
socialInfo.setWorkInjuryHandle(handleStatus);
}
if ((Common.isEmpty(socialType) || socialType.contains(CommonConstants.FIVE_STRING))
&& Common.isNotNull(socialInfo.getBirthHandle())
&& CommonConstants.ZERO_STRING.equals(socialInfo.getBirthHandle())) {
socialInfo.setBirthHandle(handleStatus);
}
if ((Common.isEmpty(socialType) || socialType.contains(CommonConstants.SIX_STRING))
&& Common.isNotNull(socialInfo.getBigailmentHandle())
&& CommonConstants.ZERO_STRING.equals(socialInfo.getBigailmentHandle())) {
socialInfo.setBigailmentHandle(handleStatus);
}
}
}
package com.yifu.cloud.plus.v1.yifu.social.util;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
......@@ -94,4 +96,23 @@ public class ServiceUtil {
}
return false;
}
public static BigDecimal ifNull(BigDecimal old, BigDecimal last){
if (Common.isEmpty(old)){
return last;
}
return old;
}
public static Date ifNull(Date old,Date last){
if (Common.isEmpty(old)){
return last;
}
return old;
}
public static String ifNullToEmpty(String str){
if (Common.isEmpty(str)){
return CommonConstants.EMPTY_STRING;
}
return str;
}
}
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