Commit b244adf3 authored by fangxinjiang's avatar fangxinjiang

派单调整

parent eef55806
......@@ -285,15 +285,16 @@ public class TEmployeeProject extends BaseEntity {
private Integer insuranceStatus;
/**
* 社保状态(字典)
* 社保状态(字典): 0 无社保 1 处理中 2.部分购买 3.正常 4.已派减
*/
@Schema(description = "社保状态(字典)")
@Schema(description = "社保状态(字典): 0 无社保 1 处理中 2.部分购买 3.正常 4.已派减")
private Integer socialStatus;
/**
* 公积金状态(字典)
*/
@Schema(description = "公积金状态(字典)")
@Schema(description = "公积金状态(字典): 0 无公积金 1 处理中 2.部分购买 3.正常 4.已派减")
private Integer fundStatus;
/**
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Author fxj
* @Date 2022/8/5
* @Description
* @Version 1.0
*/
@Data
public class UpProjectSocialFundVo implements Serializable {
// 社保状态
String socialStatus;
// 公积金状态
String fundStatus;
// 项目编码
String departNo;
// 身份证
String empIdCard;
}
......@@ -24,6 +24,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDispatchAddVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.UpProjectSocialFundVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.UpdateEmpVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -291,4 +293,16 @@ public class TEmployeeProjectController {
public TEmployeeProject getByEmpIdAndDeptId(@RequestBody TEmployeeProject employeeProject) {
return tEmployeeProjectService.getByEmpIdAndDeptId(employeeProject.getEmpId(), employeeProject.getDeptId());
}
/**
* @Description: 更新社保公积金状态
* @Author: fxj
* @Date: 2022/08/01 18:52
**/
@Operation(summary = "更新社保公积金状态", description = "更新社保公积金状态")
@Inner
@PostMapping("/inner/updateProjectSocialFund")
public Boolean updateProjectSocialFund(@RequestBody UpProjectSocialFundVo vo) {
return tEmployeeProjectService.updateProjectSocialFund(vo);
}
}
......@@ -97,6 +97,8 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
String getCode(boolean isNew);
boolean updateInUseStatusById(String empId, String deptId, String ContractId);
/**
* @param tEmployeeContractInfo
* @Description: 审核
......
......@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeXProjectVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.UpProjectSocialFundVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
......@@ -190,4 +191,6 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
//获取员工编码
String getEmpNo(String deptNo);
Boolean updateProjectSocialFund(UpProjectSocialFundVo vo);
}
......@@ -405,7 +405,10 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
employeeInfo.setContractStatus(CommonConstants.ONE_INT);
}
}
@Override
public boolean updateInUseStatusById(String empId,String deptId,String ContractId){
return baseMapper.updateInUseStatusById(empId, deptId, ContractId, CommonConstants.ONE_STRING) >0;
}
@Override
public R<String> auditContract(TEmployeeContractInfo tEmployeeContractInfo) {
if (tEmployeeContractInfo != null) {
......
......@@ -2094,9 +2094,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
@Override
public Boolean updateEmpInfo(UpdateEmpVo vo) {
if (Common.isNotNull(vo)){
TEmployeeInfo employeeInfo;
TEmployeeProject p = null;
if (Common.isNotNull(vo.getEmpIdCard())){
if (CommonConstants.ZERO_STRING.equals(vo.getType())){
TEmployeeInfo employeeInfo = baseMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
employeeInfo = baseMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeInfo::getEmpIdcard,vo.getEmpIdCard())
.eq(TEmployeeInfo::getStatus,CommonConstants.ZERO_INT)
......@@ -2107,7 +2109,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
if (Common.isNotNull(vo.getProjectNo())){
TEmployeeProject p = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
p = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getEmpIdcard,vo.getEmpIdCard())
.eq(TEmployeeProject::getDeptNo,vo.getProjectNo())
......@@ -2134,6 +2136,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
c.setAuditStatus(CommonConstants.THREE_INT);
c.setInUse(CommonConstants.ONE_STRING);
}
contractServicer.updateInUseStatusById(c.getEmpId(),c.getDeptNo(),c.getSettleDomain());
contractServicer.updateById(c);
}
......
......@@ -1407,4 +1407,56 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
return false;
}
/**
* @Description: 更新社保公积金状态 : 0 无社保|无公积金 1 处理中 2.部分购买 3.正常 4.已派减
* 派增:
* 1、派单处社保或公积金状态为待审核、待办理、办理中,项目档案处社保或公积金状态为处理中1;
* 2、派单处社保或公积金状态为审核不通过或办理失败,项目档案处社保状态为无社保,公积金状态为无公积金0;
* 3、派单处社保状态为部分办理失败,项目档案处社保状态为部分购买 2
* 4、派单处社保或公积金状态为办理成功,项目档案处社保或公积金状态为正常 3
* 派减:
* 1、派减状态为待审核、待办理、审核不通过、办理失败,项目档案处社保或公积金状态不变;
* 2、派减状态为办理成功,项目档案处社保或公积金状态变为已派减 4
* 人员档案处社保或公积金状态根据身份证+项目进行整合:
* 社保状态优先级:正常>部分购买>处理中>已派减>无社保
* 公积金状态优先级:正常>处理中>已派减>无公积金
* @Author: fxj
* @Date: 2022/08/01 18:52
**/
@Override
public Boolean updateProjectSocialFund(UpProjectSocialFundVo vo) {
if (Common.isEmpty(vo) || Common.isEmpty(vo.getEmpIdCard()) || Common.isEmpty(vo.getDepartNo())){
return false;
}
TEmployeeInfo employee = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,vo.getEmpIdCard())
.eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING).last(CommonConstants.LAST_ONE_SQL));
// : 0 无社保|无公积金 1 处理中 2.部分购买 3.正常 4.已派减
if (Common.isNotNull(employee)){
if (Common.isNotNull(vo.getSocialStatus())){
employee.setSocialStatus(Integer.parseInt(vo.getSocialStatus()));
}
if (Common.isNotNull(vo.getFundStatus())){
employee.setFundStatus(Integer.parseInt(vo.getFundStatus()));
}
tEmployeeInfoMapper.updateById(employee);
}
TEmployeeProject project = baseMapper.selectOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getDeptNo,vo.getDepartNo())
.eq(TEmployeeProject::getEmpIdcard,vo.getEmpIdCard())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
// : 0 无社保|无公积金 1 处理中 2.部分购买 3.正常 4.已派减
if (Common.isNotNull(project)){
if (Common.isNotNull(vo.getSocialStatus())){
project.setSocialStatus(Integer.parseInt(vo.getSocialStatus()));
}
if (Common.isNotNull(vo.getFundStatus())){
project.setFundStatus(Integer.parseInt(vo.getFundStatus()));
}
baseMapper.updateById(project);
}
return true;
}
}
......@@ -205,4 +205,27 @@ public class ArchivesDaprUtil {
}
return res;
}
/**
* @Author fxj
* @Description 更新项目档案和人员档案的社保公积金状态
* @Date 19:30 2022/8/1
* @Param type 0 审核通过 1 审核不通过
* @return
**/
public R<Boolean> updateProjectSocialFund(UpProjectSocialFundVo vo){
if (Common.isEmpty(vo.getEmpIdCard())
|| (Common.isEmpty(vo.getSocialStatus())
&& Common.isEmpty(vo.getFundStatus()))
|| Common.isEmpty(vo.getDepartNo())){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
R<Boolean> res = HttpDaprUtil.invokeMethodPost(
daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId()
,"/temployeeproject/inner/updateProjectSocialFund" , JSON.toJSONString(vo), Boolean.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("更新人员档案、项目档案社保公积金状态信息失败!");
}
return res;
}
}
......@@ -520,6 +520,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isNotNull(socialFund) && Common.isNotNull(socialFund.getId())){
forecastLibraryService.updateForecastLibaryByDispatch(socialFund);
}
// 同步更新人员档案和项目档案的社保公积金状态
updateDocSocialFund(social, fund, socialFund);
}catch (Exception e){
log.error("派单新增异常:", e);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "派单新增异常:"+e.getMessage()));
......@@ -533,6 +535,22 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
Common.clear(projectsMap);
}
private void updateDocSocialFund(TSocialInfo social, TProvidentFund fund, TSocialFundInfo socialFund) {
UpProjectSocialFundVo vo = new UpProjectSocialFundVo();
if (Common.isNotNull(social)){
vo.setSocialStatus(CommonConstants.ZERO_STRING);
}
if (Common.isNotNull(fund)){
vo.setFundStatus(CommonConstants.ZERO_STRING);
}
vo.setEmpIdCard(socialFund.getEmpIdcard());
vo.setDepartNo(socialFund.getSettleDomainCode());
R<Boolean> resUp = archivesDaprUtil.updateProjectSocialFund(vo);
if (Common.isEmpty(resUp) || !(CommonConstants.SUCCESS.intValue() == resUp.getCode()) || !resUp.getData().booleanValue()){
ServiceUtil.runTimeExceptionDiy("同步人员档案、项目档案的社保公积金状态失败!");
}
}
private void insertSocial(EmpAddDispatchVo emp, TSocialInfo social) {
if (Common.isNotNull(social)){
if (Common.isNotNull(emp)){
......@@ -592,28 +610,58 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isEmpty(socialFund.getFirstBuyMonthSocial())){
socialFund.setFirstBuyMonthSocial(social.getSocialStartDate());
}
socialFund.setUnitBigailmentMoney(social.getUnitBigailmentMoney());
socialFund.setPersonalBigailmentMoney(social.getPersonalBigailmentMoney());
socialFund.setUnitPensionCardinal(social.getUnitPensionCardinal());
socialFund.setUnitMedicalCardinal(social.getUnitMedicalCardinal());
socialFund.setUnitUnemploymentCardinal(social.getUnitUnemploymentCardinal());
socialFund.setUnitBigailmentCardinal(social.getUnitBigailmentCardinal());
socialFund.setUnitWorkInjuryCardinal(social.getUnitWorkInjuryCardinal());
socialFund.setUnitBirthCardinal(social.getUnitBirthCardinal());
socialFund.setPersonalPensionCardinal(social.getPersonalPensionCardinal());
socialFund.setPersonalMedicalCardinal(social.getPersonalMedicalCardinal());
socialFund.setPersonalBigailmentCardinal(social.getPersonalBigailmentCardinal());
socialFund.setPersonalUnemploymentCardinal(social.getPersonalUnemploymentCardinal());
socialFund.setUnitPensionPer(social.getUnitPensionPer());
socialFund.setUnitMedicalPer(social.getUnitMedicalPer());
socialFund.setUnitUnemploymentPer(social.getUnitUnemploymentPer());
socialFund.setUnitBigailmentPer(social.getUnitBigailmentPer());
socialFund.setUnitWorkUnjuryPer(social.getUnitWorkUnjuryPer());
socialFund.setUnitBirthPer(social.getUnitBirthPer());
socialFund.setPersonalPensionPer(social.getPersonalPensionPer());
socialFund.setPersonalMedicalPer(social.getPersonalMedicalPer());
socialFund.setPersonalUnemploymentPer(social.getPersonalUnemploymentPer());
socialFund.setPersonalBigailmentPer(social.getPersonalBigailmentPer());
socialFund.setUnitPersionMoney(BigDecimal.ZERO);
socialFund.setUnitMedicalMoney(BigDecimal.ZERO);
socialFund.setUnitUnemploymentMoney(BigDecimal.ZERO);
socialFund.setUnitInjuryMoney(BigDecimal.ZERO);
socialFund.setUnitBirthMoney(BigDecimal.ZERO);
if (!CommonConstants.ONE_STRING.equals(socialFund.getBigailmentHandle())){
socialFund.setUnitBigailmentMoney(social.getUnitBigailmentMoney());
socialFund.setPersonalBigailmentMoney(social.getPersonalBigailmentMoney());
}
if (!CommonConstants.ONE_STRING.equals(socialFund.getPensionHandle())){
socialFund.setUnitPensionCardinal(social.getUnitPensionCardinal());
socialFund.setPersonalPensionCardinal(social.getPersonalPensionCardinal());
socialFund.setUnitPensionPer(social.getUnitPensionPer());
socialFund.setPersonalPensionPer(social.getPersonalPensionPer());
socialFund.setUnitPersionMoney(BigDecimalUtils.safeMultiply(social.getUnitPensionCardinal(), social.getUnitPensionPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setPersonalPersionMoney(BigDecimalUtils.safeMultiply(social.getPersonalPensionCardinal(), social.getPersonalPensionPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
}
if (!CommonConstants.ONE_STRING.equals(socialFund.getMedicalHandle())){
socialFund.setUnitMedicalCardinal(social.getUnitMedicalCardinal());
socialFund.setPersonalMedicalCardinal(social.getPersonalMedicalCardinal());
socialFund.setUnitMedicalPer(social.getUnitMedicalPer());
socialFund.setPersonalMedicalPer(social.getPersonalMedicalPer());
socialFund.setUnitMedicalMoney(BigDecimalUtils.safeMultiply(social.getUnitMedicalCardinal(), social.getUnitMedicalPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setPersonalMedicalMoney(BigDecimalUtils.safeMultiply(social.getPersonalMedicalCardinal(), social.getPersonalMedicalPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
}
if (!CommonConstants.ONE_STRING.equals(socialFund.getUnemployHandle())){
socialFund.setUnitUnemploymentCardinal(social.getUnitUnemploymentCardinal());
socialFund.setPersonalUnemploymentCardinal(social.getPersonalUnemploymentCardinal());
socialFund.setPersonalUnemploymentPer(social.getPersonalUnemploymentPer());
socialFund.setUnitUnemploymentPer(social.getUnitUnemploymentPer());
socialFund.setUnitUnemploymentMoney(BigDecimalUtils.safeMultiply(social.getUnitUnemploymentCardinal(), social.getUnitUnemploymentPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setPersonalUnemploymentMoney(BigDecimalUtils.safeMultiply(social.getPersonalUnemploymentCardinal(), social.getPersonalUnemploymentPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
}
if (!CommonConstants.ONE_STRING.equals(socialFund.getBigailmentHandle())){
socialFund.setUnitBigailmentCardinal(social.getUnitBigailmentCardinal());
socialFund.setPersonalBigailmentCardinal(social.getPersonalBigailmentCardinal());
socialFund.setUnitBigailmentPer(social.getUnitBigailmentPer());
socialFund.setPersonalBigailmentPer(social.getPersonalBigailmentPer());
socialFund.setUnitBigailmentMoney(social.getUnitBigailmentMoney());
socialFund.setPersonalBigailmentMoney(social.getPersonalBigailmentMoney());
}
if (!CommonConstants.ONE_STRING.equals(socialFund.getWorkInjuryHandle())){
socialFund.setUnitWorkInjuryCardinal(social.getUnitWorkInjuryCardinal());
socialFund.setUnitWorkUnjuryPer(social.getUnitWorkUnjuryPer());
socialFund.setUnitInjuryMoney(BigDecimalUtils.safeMultiply(social.getUnitWorkInjuryCardinal(), social.getUnitWorkUnjuryPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
}
if (!CommonConstants.ONE_STRING.equals(socialFund.getBirthHandle())){
socialFund.setUnitBirthCardinal(social.getUnitBirthCardinal());
socialFund.setUnitBirthPer(social.getUnitBirthPer());
socialFund.setUnitBirthMoney(BigDecimalUtils.safeMultiply(social.getUnitBirthCardinal(), social.getUnitBirthPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
}
socialFund.setCanOverpay(social.getCanOverpay());
socialFund.setOverpayNumber(social.getOverpayNumber());
socialFund.setHaveThisMonth(social.getHaveThisMonth());
......@@ -644,22 +692,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
socialFund.setBirthHandle(social.getBirthHandle());
socialFund.setBigailmentHandle(social.getBigailmentHandle());
socialFund.setUnitPersionMoney(BigDecimal.ZERO);
socialFund.setUnitMedicalMoney(BigDecimal.ZERO);
socialFund.setUnitUnemploymentMoney(BigDecimal.ZERO);
socialFund.setUnitInjuryMoney(BigDecimal.ZERO);
socialFund.setUnitBirthMoney(BigDecimal.ZERO);
socialFund.setUnitPersionMoney(BigDecimalUtils.safeMultiply(social.getUnitPensionCardinal(), social.getUnitPensionPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setUnitMedicalMoney(BigDecimalUtils.safeMultiply(social.getUnitMedicalCardinal(), social.getUnitMedicalPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setUnitBirthMoney(BigDecimalUtils.safeMultiply(social.getUnitBirthCardinal(), social.getUnitBirthPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setUnitInjuryMoney(BigDecimalUtils.safeMultiply(social.getUnitWorkInjuryCardinal(), social.getUnitWorkUnjuryPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setUnitUnemploymentMoney(BigDecimalUtils.safeMultiply(social.getUnitUnemploymentCardinal(), social.getUnitUnemploymentPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setPersonalPersionMoney(BigDecimalUtils.safeMultiply(social.getPersonalPensionCardinal(), social.getPersonalPensionPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setPersonalMedicalMoney(BigDecimalUtils.safeMultiply(social.getPersonalMedicalCardinal(), social.getPersonalMedicalPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setPersonalUnemploymentMoney(BigDecimalUtils.safeMultiply(social.getPersonalUnemploymentCardinal(), social.getPersonalUnemploymentPer(),BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
socialFund.setUnitSocialSum(BigDecimalUtils.safeAdd(socialFund.getUnitPersionMoney()
, socialFund.getUnitMedicalMoney(), socialFund.getUnitBirthMoney()
, socialFund.getUnitInjuryMoney()
......@@ -1319,7 +1351,10 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
social.setUnemployHandle(null);
social.setUnitUnemploymentCardinal(null);
social.setUnitUnemploymentPer(null);
social.setUnitUnemploymentCardinal(null);
social.setUnitUnemploymentMoney(null);
social.setPersonalUnemploymentPer(null);
social.setPersonalUnemploymentCardinal(null);
social.setPersonalUnemploymentMoney(null);
}
if (Common.isEmpty(social.getWorkInjuryStart())){
social.setWorkInjuryHandle(null);
......@@ -1351,7 +1386,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
socialFund = socialFundMap.get(excel.getEmpIdcard());
if (Common.isNotNull(socialFund)){
if (CommonConstants.ONE_STRING.equals(socialFund.getPensionHandle())){
social.setPensionHandle(socialFund.getPensionHandle());
social.setPensionHandle(null);
social.setUnitPensionCardinal(null);
social.setUnitPensionPer(null);
social.setPersonalPensionCardinal(null);
social.setPersonalPensionPer(null);
social.setUnitPersionMoney(null);
social.setPersonalPersionMoney(null);
social.setPensionStart(null);
}else {
socialFund.setUnitPensionCardinal(social.getUnitPensionCardinal());
socialFund.setUnitPensionPer(social.getUnitPensionPer());
......@@ -1359,7 +1401,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
socialFund.setPersonalPensionPer(social.getPersonalPensionPer());
}
if (CommonConstants.ONE_STRING.equals(socialFund.getMedicalHandle())){
social.setMedicalHandle(socialFund.getMedicalHandle());
social.setMedicalHandle(null);
social.setUnitMedicalCardinal(null);
social.setUnitMedicalPer(null);
social.setPersonalMedicalCardinal(null);
social.setPersonalMedicalPer(null);
social.setUnitMedicalMoney(null);
social.setPersonalMedicalMoney(null);
social.setMedicalStart(null);
}else {
socialFund.setUnitMedicalCardinal(social.getUnitMedicalCardinal());
socialFund.setUnitMedicalPer(social.getUnitMedicalPer());
......@@ -1367,7 +1416,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
socialFund.setPersonalMedicalPer(social.getUnitMedicalPer());
}
if (CommonConstants.ONE_STRING.equals(socialFund.getUnemployHandle())){
social.setUnemployHandle(socialFund.getUnemployHandle());
social.setUnemployHandle(null);
social.setUnitUnemploymentCardinal(null);
social.setUnitUnemploymentPer(null);
social.setPersonalUnemploymentCardinal(null);
social.setPersonalUnemploymentPer(null);
social.setUnitUnemploymentMoney(null);
social.setPersonalUnemploymentMoney(null);
social.setUnemployStart(null);
}else {
socialFund.setUnitUnemploymentCardinal(social.getUnitUnemploymentCardinal());
socialFund.setUnitUnemploymentPer(social.getUnitUnemploymentPer());
......@@ -1375,19 +1431,34 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
socialFund.setPersonalUnemploymentPer(social.getUnitUnemploymentPer());
}
if (CommonConstants.ONE_STRING.equals(socialFund.getWorkInjuryHandle())){
social.setWorkInjuryHandle(socialFund.getWorkInjuryHandle());
social.setWorkInjuryHandle(null);
social.setUnitWorkInjuryCardinal(null);
social.setUnitWorkUnjuryPer(null);
social.setUnitInjuryMoney(null);
social.setWorkInjuryStart(null);
}else {
socialFund.setUnitWorkInjuryCardinal(social.getUnitWorkInjuryCardinal());
socialFund.setPersonalWorkInjuryCardinal(social.getUnitWorkInjuryCardinal());
}
if (CommonConstants.ONE_STRING.equals(socialFund.getBirthHandle())){
social.setBirthHandle(socialFund.getBirthHandle());
social.setBirthHandle(null);
social.setUnitBirthCardinal(null);
social.setUnitBirthPer(null);
social.setUnitBirthMoney(null);
social.setBirthStart(null);
}else {
socialFund.setUnitBirthCardinal(social.getUnitBirthCardinal());
socialFund.setUnitBirthPer(social.getUnitBirthPer());
}
if (CommonConstants.ONE_STRING.equals(socialFund.getBigailmentHandle())){
social.setBigailmentHandle(socialFund.getBigailmentHandle());
social.setBigailmentHandle(null);
social.setUnitBigailmentCardinal(null);
social.setUnitBigailmentPer(null);
social.setPersonalBigailmentCardinal(null);
social.setPersonalBigailmentPer(null);
social.setUnitBigailmentMoney(null);
social.setPersonalBigailmentMoney(null);
social.setBigailmentStart(null);
}else {
socialFund.setUnitBigailmentCardinal(social.getUnitBigailmentCardinal());
socialFund.setUnitBigailmentPer(social.getUnitBigailmentPer());
......@@ -1560,48 +1631,47 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isNotNull(socialFundMap)) {
sf = socialFundMap.get(excel.getEmpIdcard());
if (Common.isNotNull(sf) && Common.isNotNull(excel.getSocialHousehold())) {
// 拒绝新增1:派单待审核、派单待办理、办理成功且未派减成功------ 先排除兼职工伤
// 拒绝新增1:派单待审核、派单待办理、办理中、办理成功且未派减成功------ 先排除兼职工伤
if (CommonConstants.ZERO_STRING.equals(sf.getSocialAddStatus())
|| CommonConstants.ONE_STRING.equals(sf.getSocialAddStatus())
|| CommonConstants.SIX_STRING.equals(sf.getSocialAddStatus())
|| (CommonConstants.TWO_STRING.equals(sf.getSocialAddStatus())
&& !CommonConstants.TWO_STRING.equals(sf.getSocialReduceStatus())
&& BigDecimal.ZERO.compareTo(BigDecimalUtils.isNullToZero(excel.getPensionCardinal())) != 0
&& BigDecimal.ZERO.compareTo(BigDecimalUtils.isNullToZero(sf.getUnitPensionCardinal())) != 0)
&& !CommonConstants.TWO_STRING.equals(sf.getSocialReduceStatus()))
) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_EXISTING)));
return true;
}
// 拒绝新增2:新增兼职工伤---有兼职工伤不可重复增、
if (Common.isEmpty(excel.getPensionCardinal())
|| BigDecimal.ZERO.compareTo(excel.getPensionCardinal()) == 0) {
// 拒绝新增2:新增兼职工伤---全部办理失败或全部派减成功才可以派减兼职工伤
boolean flag = Common.isEmpty(excel.getPensionStart())
&& Common.isEmpty(excel.getMedicalStart())
&& Common.isEmpty(excel.getBirthStart())
&& Common.isEmpty(excel.getUnemployStart())
&& Common.isEmpty(excel.getBigailmentStart())
&& Common.isNotNull(excel.getWorkInjuryStart())
&& Common.isEmpty(BigDecimal.ZERO.compareTo(excel.getWorkInjuryCardinal()) > 0);
if (flag) {
// 有兼职工伤不可重复增 (未派减成功不可新增兼职工伤)
if ((Common.isEmpty(sf.getUnitPensionCardinal())
|| BigDecimal.ZERO.compareTo(sf.getUnitPensionCardinal()) == 0)
&& Common.isNotNull(sf.getSocialReduceStatus())
&& !CommonConstants.TWO_STRING.equals(sf.getSocialReduceStatus())) {
if (CommonConstants.ZERO_STRING.equals(sf.getWorkInjuryHandle())
|| CommonConstants.ONE_STRING.equals(sf.getWorkInjuryHandle())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_INJURY_EXISTING)));
return true;
}
// 有五险未派减不给新增兼职工伤
if (Common.isNotNull(sf.getUnitPensionCardinal())
&& BigDecimal.ZERO.compareTo(sf.getUnitPensionCardinal()) != 0
&& Common.isEmpty(sf.getSocialReduceStatus())) {
flag = CommonConstants.ZERO_STRING.equals(sf.getPensionHandle())
|| CommonConstants.ONE_STRING.equals(sf.getPensionHandle())
|| CommonConstants.ZERO_STRING.equals(sf.getMedicalHandle())
|| CommonConstants.ONE_STRING.equals(sf.getMedicalHandle())
|| CommonConstants.ZERO_STRING.equals(sf.getBirthHandle())
|| CommonConstants.ONE_STRING.equals(sf.getBirthHandle())
|| CommonConstants.ZERO_STRING.equals(sf.getUnemployHandle())
|| CommonConstants.ONE_STRING.equals(sf.getUnemployHandle())
|| CommonConstants.ZERO_STRING.equals(sf.getBigailmentHandle())
|| CommonConstants.ONE_STRING.equals(sf.getBigailmentHandle());
if (flag) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_NOT_REDUCE)));
return true;
}
}
// 拒绝新增3:新增五险对应兼职工伤逻辑---有兼职工伤未派减不给增五险、
if (Common.isNotNull(excel.getPensionCardinal())
&& BigDecimal.ZERO.compareTo(excel.getPensionCardinal()) != 0) {
// 有兼职工伤未派减不给增五险
if (Common.isNotNull(sf.getSocialHousehold())
&& (Common.isEmpty(sf.getUnitPensionCardinal())
|| BigDecimal.ZERO.compareTo(sf.getUnitPensionCardinal()) == 0)
&& Common.isEmpty(sf.getSocialReduceStatus())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_INJURY_NOT_REDUCE)));
return true;
}
}
}
}
return false;
......@@ -2410,6 +2480,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
* @Param
* @return
**/
@GlobalTransactional
@Override
public List<ErrorMessage> addBatchApplyAudit(List<String> idsList, YifuUser user, Integer flag, String auditStatus, String auditRemark, String remark) {
List<ErrorMessage> errorList = new ArrayList<>();
......@@ -2592,6 +2663,19 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 更新预估数据
forecastLibraryService.updateForecastLibaryByDispatch(sf);
}
UpProjectSocialFundVo vo = new UpProjectSocialFundVo();
if (Common.isNotNull(dis.getSocialId())){
vo.setSocialStatus(CommonConstants.ZERO_STRING);
}
if (Common.isNotNull(dis.getFundId())){
vo.setFundStatus(CommonConstants.ZERO_STRING);
}
vo.setEmpIdCard(dis.getEmpIdcard());
vo.setDepartNo(dis.getSettleDomainCode());
R<Boolean> resUp = archivesDaprUtil.updateProjectSocialFund(vo);
if (Common.isEmpty(resUp) || !(CommonConstants.SUCCESS.intValue() == resUp.getCode()) || !resUp.getData().booleanValue()){
ServiceUtil.runTimeExceptionDiy("同步人员档案、项目档案的社保公积金状态失败!");
}
}
} catch (Exception e) {
log.error(DispatchConstants.DISPATCH_AUDIT_ERROR , e);
......@@ -2691,6 +2775,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
* @Author fxj
* @Date 2022-07-26
**/
@GlobalTransactional
public List<ErrorMessage> addBatchApplyHandle(List<String> idsList, String typeSub, YifuUser user
, int flag, String handleStatus, String handleRemark, String socialType, String remark) {
List<ErrorMessage> errorList = new ArrayList<>();
......@@ -2957,15 +3042,45 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
auditInfoMapper.insert(auditInfo);
baseMapper.updateById(dis);
socialFundMapper.updateById(sf);
UpProjectSocialFundVo vo = new UpProjectSocialFundVo();
//1.派增办理失败 刷新预估数据
if (CommonConstants.ZERO_STRING.equals(dis.getType())
&& Common.isNotNull(socialInfo)
&& CommonConstants.TWO_STRING.equals(socialInfo.getHandleStatus())) {
// 派增办理,全部失败,清空社保状态
if (Common.isNotNull(socialInfo)
&& CommonConstants.TWO_STRING.equals(socialInfo.getHandleStatus())) {
// 同步预估库数据
if (CommonConstants.ZERO_STRING.equals(dis.getType())) {
// 办理失败
if (CommonConstants.ONE_INT == flag){
// 派增办理,全部失败 同步预估库数据
forecastLibraryService.updateForecastLibaryByDispatch(sf);
if (Common.isNotNull(socialInfo)){
if (typeSub.equals(CommonConstants.ZERO_STRING)
&& CommonConstants.TWO_STRING.equals(socialInfo.getHandleStatus())){
vo.setSocialStatus(CommonConstants.ZERO_STRING);
}
if (typeSub.equals(CommonConstants.ZERO_STRING)
&& CommonConstants.FIVE_STRING.equals(socialInfo.getHandleStatus())){
vo.setSocialStatus(CommonConstants.TWO_STRING);
}
}
if (typeSub.equals(CommonConstants.ONE_STRING)
&& Common.isNotNull(providentFund)
&& CommonConstants.TWO_STRING.equals(providentFund.getHandleStatus())){
vo.setFundStatus(CommonConstants.ZERO_STRING);
}
}
if (CommonConstants.ZERO_INT == flag){
if (Common.isNotNull(socialInfo)){
if (typeSub.equals(CommonConstants.ZERO_STRING)
&& CommonConstants.ONE_STRING.equals(socialInfo.getHandleStatus())){
vo.setSocialStatus(CommonConstants.THREE_STRING);
}
if (typeSub.equals(CommonConstants.ZERO_STRING)
&& CommonConstants.FIVE_STRING.equals(socialInfo.getHandleStatus())){
vo.setSocialStatus(CommonConstants.TWO_STRING);
}
}
if (typeSub.equals(CommonConstants.ONE_STRING)
&& Common.isNotNull(providentFund)
&& CommonConstants.ONE_STRING.equals(providentFund.getHandleStatus())){
vo.setFundStatus(CommonConstants.THREE_STRING);
}
}
}
// 2.派减办理成功 处理预估
......@@ -2973,6 +3088,20 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&& CommonConstants.ZERO_INT == flag){
// 同步预估库数据
forecastLibraryService.updateForecastLibaryByDispatchReduce(sf);
if (typeSub.equals(CommonConstants.ZERO_STRING)
&& Common.isNotNull(socialInfo)){
vo.setSocialStatus(CommonConstants.FOUR_STRING);
}
if (typeSub.equals(CommonConstants.ONE_STRING)
&& Common.isNotNull(providentFund)){
vo.setFundStatus(CommonConstants.FOUR_STRING);
}
}
vo.setEmpIdCard(dis.getEmpIdcard());
vo.setDepartNo(dis.getSettleDomainCode());
R<Boolean> resUp = archivesDaprUtil.updateProjectSocialFund(vo);
if (Common.isEmpty(resUp) || !(CommonConstants.SUCCESS.intValue() == resUp.getCode()) || !resUp.getData().booleanValue()){
ServiceUtil.runTimeExceptionDiy("同步人员档案、项目档案的社保公积金状态失败!");
}
} else {
errorList.add(new ErrorMessage(-1, "派单数据错误!"));
......
......@@ -217,7 +217,7 @@
</sql>
<sql id="tDispatchInfo_where">
<if test="tDispatchInfo != null">
<if test="tDispatchInfo.idList != null">
<if test="tDispatchInfo.idList != null and tDispatchInfo.idList.size >0">
AND a.ID in
<foreach item="idStr" index="index" collection="tDispatchInfo.idList" open="(" separator="," close=")">
#{idStr}
......@@ -662,7 +662,7 @@
left join t_social_info b on a.SOCIAL_ID = b.id
<where>
1=1 and b.DELETE_FLAG = 0
<if test="idsStr != null">
<if test="idsStr != null and idsStr.size > 0">
AND a.ID in
<foreach item="items" index="index" collection="idsStr" open="(" separator="," close=")">
#{items}
......@@ -764,7 +764,7 @@
left join t_provident_fund c on a.FUND_ID = c.id
<where>
1=1 and a.DELETE_FLAG = 0
<if test="idsStr != null">
<if test="idsStr != null and idsStr.size > 0">
AND a.ID in
<foreach item="items" index="index" collection="idsStr" open="(" separator="," close=")">
#{items}
......
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