Commit 7af29fe5 authored by huyuchen's avatar huyuchen

Merge remote-tracking branch 'origin/MVP1.7.17' into MVP1.7.17

parents eaa6b88a cdb5f4c2
......@@ -114,7 +114,7 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac
void updateContractChange(@Param("idCard")String empIdcard, @Param("deptNo")String deptNo, @Param("oldDeptNo")String odlDeptNo);
String getContractByEmpIdCardAndDeptId(@Param("empIdCard") String empIdCard, @Param("deptId") String deptId);
String getContractByEmpIdCardAndDeptNo(@Param("empIdCard") String empIdCard, @Param("deptId") String deptNo);
String getContractByEmpIdCardAndDeptNo(@Param("empIdCard") String empIdCard, @Param("deptNo") String deptNo);
String getMinDateByCardAndDeptId(@Param("vo") IdNameNoVo vo);
......
......@@ -45,8 +45,10 @@ 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.core.vo.BaseSearchListVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseServiceParamListVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.CspDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
......@@ -118,6 +120,8 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
private final TGzEmpInfoMapper tGzEmpInfoMapper;
private final CspDaprUtils cspDaprUtil;
/**
* 员工合同信息表简单分页查询
*
......@@ -1321,7 +1325,8 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
String leaveDate;
String leaveReason;
for (EmployeeContractVO vo : excelVOList) {
vo.setRowIndex(i++);
i++;
vo.setRowIndex(i);
baseSearchVO = paramMap.get(vo.getContractId());
leaveId = null;
if (baseSearchVO != null) {
......@@ -1330,6 +1335,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
leaveReason = baseSearchVO.getResultIdThree();
vo.setLeaveDate(leaveDate);
vo.setReduceReason(leaveReason);
vo.setChangeContractAndEmployee(CommonConstants.ONE_STRING);
}
if (Common.isNotNull(leaveId)) {
rowLeaveMap.put(i, leaveId);
......@@ -1818,6 +1824,25 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
return baseMapper.noPageCountDiy(searchVo);
}
// 审核或办理,更新离职待办
// isSuccess 0:失败;1:成功
private void sendLeave(String id, String doStatus, String isSuccess, String failRemark, YifuUser user) {
BaseServiceParamListVO updateVo = new BaseServiceParamListVO();
List<String> idList = new ArrayList<>();
idList.add(id);
updateVo.setListParam(idList);
updateVo.setDoType(CommonConstants.FOUR_STRING);
updateVo.setDoStatus(doStatus);
updateVo.setIsSuccess(isSuccess);
if (Common.isNotNull(isSuccess) && CommonConstants.ZERO_STRING.equals(isSuccess)) {
updateVo.setRemark(failRemark);
if (user != null && Common.isNotNull(user.getNickname())) {
updateVo.setUserName(user.getNickname());
}
}
cspDaprUtil.reduceHandleToLeave(updateVo);
}
/**
* @Author fxj
* @Description 批量审核合同
......@@ -1846,6 +1871,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(
CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "personnel_type");
String auditRemark = contractAuditVo.getAuditRemark();
for (TEmployeeContractInfo contract : contractInfos) {
i++;
if (contract.getAuditStatus() != CommonConstants.ONE_INT) {
......@@ -2113,6 +2139,10 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
//审核通过瓜子合同状态更新成合同审核通过
updateGzOfferStatus(contract,CommonConstants.THIRTEEN_STRING,CommonConstants.EIGHT_STRING,user.getId(),user.getNickname());
}
if (EmployeeConstants.SITUATION_SEVEN.equals(contract.getSituation())) {
this.sendLeave(contract.getId(), CommonConstants.EIGHT_STRING, CommonConstants.ONE_STRING, auditRemark, user);
}
}
if (tEmployeeContractInfo.getAuditStatus() == CommonConstants.dingleDigitIntArray[3]) {
//更新合同状态为3线下签审核不通过
......@@ -2124,6 +2154,9 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
contractPre.setProcessStatus(CommonConstants.THREE_STRING);
contractPreMapper.updateById(contractPre);
}
if (EmployeeConstants.SITUATION_SEVEN.equals(contract.getSituation())) {
this.sendLeave(contract.getId(), CommonConstants.TEN_STRING, CommonConstants.ZERO_STRING, auditRemark, user);
}
}
// 不是待提交,记录审核记录
this.setAuditInfo(tEmployeeContractInfo);
......
......@@ -68,6 +68,8 @@ import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.http.HttpHeaders;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
......@@ -671,22 +673,35 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
private YifuUser getNewYifuUser(String userId, String userName) {
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
return new YifuUser(userId, 1L, "", userName,
userName, "0", SecurityConstants.BCRYPT + "123456",
"12345678911", true, true, true,
true,
"1", authorities, "1",
null, null,
null, null);
}
// 离职待办减少项目档案
@Override
public BaseSearchListVO leaveToReduceEmp(BaseSearchListVO paramVo) {
List<BaseSearchVO> listParam = paramVo.getListParam();
YifuUser newUser = paramVo.getNewUser();
YifuUser newUser = getNewYifuUser(paramVo.getUserId(), paramVo.getUserName());
// 合同ID,离职待办ID
BaseSearchListVO baseSearchListVO = new BaseSearchListVO();
if (listParam != null && !listParam.isEmpty()) {
List<EmployeeLeaveVO> cachedDataList = new ArrayList<>();
EmployeeLeaveVO vo;
Map<Integer, String> rowLeaveMap = new HashMap<>();
int i=0;
int i=1;// 内部是i+2
for (BaseSearchVO param : listParam) {
i++;
vo = new EmployeeLeaveVO();
vo.setRowIndex(i++);
vo.setRowIndex(i);
vo.setEmpName(param.getEmpName());
vo.setEmpIdcard(param.getEmpIdCard());
vo.setLeaveReason(param.getResultIdThree());
......
......@@ -240,6 +240,8 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
SOCIAL_IGNORE_FIELD.add("expectedCollectionType");
SOCIAL_IGNORE_FIELD.add("upperLimit");
SOCIAL_IGNORE_FIELD.add("lowerLimit");
SOCIAL_IGNORE_FIELD.add("fundUpdateFlag");
}
@Override
......
......@@ -63,6 +63,8 @@ import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -605,11 +607,24 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
private YifuUser getNewYifuUser(String userId, String userName) {
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
return new YifuUser(userId, 1L, "", userName,
userName, "0", SecurityConstants.BCRYPT + "123456",
"12345678911", true, true, true,
true,
"1", authorities, "1",
null, null,
null, null);
}
// 离职待办减少项目档案
@Override
public BaseSearchListVO leaveToReduceProject(BaseSearchListVO paramVo) {
List<BaseSearchVO> listParam = paramVo.getListParam();
YifuUser newUser = paramVo.getNewUser();
YifuUser newUser = getNewYifuUser(paramVo.getUserId(), paramVo.getUserName());
// 合同ID,离职待办ID
BaseSearchListVO baseSearchListVO = new BaseSearchListVO();
if (listParam != null && !listParam.isEmpty()) {
......@@ -618,8 +633,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
Map<Integer, String> rowLeaveMap = new HashMap<>();
int i=0;
for (BaseSearchVO param : listParam) {
i++;
vo = new EmployeeXProjectVO();
vo.setRowIndex(i++);
vo.setRowIndex(i);
vo.setEmpName(param.getEmpName());
vo.setEmpIdcard(param.getEmpIdCard());
vo.setDeptNo(param.getDeptNo());
......
......@@ -1533,7 +1533,7 @@
select
a.id
from t_employee_info a
where a.DELETE_FLAG = '0' and a.file_Status = 0 and a.EMP_IDCARD = {empIdCard}
where a.DELETE_FLAG = '0' and a.file_Status = 0 and a.EMP_IDCARD = #{empIdCard}
limit 1
</select>
......
......@@ -37,6 +37,10 @@ public class ErrorMessage<T> implements Serializable {
*/
private T data;
// 添加默认构造函数
public ErrorMessage() {
}
public ErrorMessage(Integer lineNum, String message) {
this.lineNum = lineNum;
this.color = "red";
......
......@@ -36,7 +36,8 @@ public class BaseSearchListVO implements Serializable {
private static final long serialVersionUID = 1L;
private YifuUser newUser;
private String userId;
private String userName;
// 商险使用
private List<String> listStringParam = new ArrayList<>();
......
......@@ -49,9 +49,11 @@ public class BaseServiceParamListVO implements Serializable {
// @Schema(description = "减档:0空1无需处理2待减档8减档成功9减档失败")
private String doStatus;
// 0:未最终成功;1:最终成功
// 0:失败;1:成功
private String isSuccess;
// 备注
private String remark;
// 操作人
private String userName;
}
......@@ -709,7 +709,7 @@ public class ArchivesDaprUtil {
**/
public R<BaseSearchListVO> leaveToReduceContract(BaseSearchListVO paramVo) {
R<BaseSearchListVO> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId()
,"/temployeeinfo/inner/leaveToReduceContract", paramVo, BaseSearchListVO.class, SecurityConstants.FROM_IN);
,"/temployeecontractinfo/inner/leaveToReduceContract", paramVo, BaseSearchListVO.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("离职待办调用的批量派减合同失败!");
}
......
......@@ -5,6 +5,7 @@ import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationCustomerUserUpdateVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationUpdateVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseServiceParamListVO;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCspProperties;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -45,4 +46,16 @@ public class CspDaprUtils {
public R<Boolean> updateRegistCustomerUserInfo(EmployeeRegistrationCustomerUserUpdateVo updateVo) {
return HttpDaprUtil.invokeMethodPost(daprCspProperties.getAppUrl(),daprCspProperties.getAppId(),"/employeeregistration/inner/updateRegistCustomerUserInfo", JSON.toJSONString(updateVo), Boolean.class, SecurityConstants.FROM_IN);
}
/**
* @Description: 社保、公积金、商险、合同办理成功或失败,更新离职待办
* @Author: hgw
* @Date: 2025/11/24 16:50
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
public R<String> reduceHandleToLeave(BaseServiceParamListVO vo) {
return HttpDaprUtil.invokeMethodPost(daprCspProperties.getAppUrl(),daprCspProperties.getAppId()
,"/employeeregistrationleave/inner/reduceHandleToLeave"
, vo, String.class, SecurityConstants.FROM_IN);
}
}
......@@ -425,7 +425,7 @@ public class SocialDaprUtils {
**/
public R<BaseSearchListVO> leaveToReduceSocialAndFund(TDispatchReduceListVo paramVo) {
R<BaseSearchListVO> res = HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId()
,"/tsocialfundinfo/inner/leaveToReduceSocialAndFund", paramVo, BaseSearchListVO.class, SecurityConstants.FROM_IN);
,"/tdispatchinfo/inner/leaveToReduceSocialAndFund", paramVo, BaseSearchListVO.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("离职待办调用的批量派减社保、公积金失败!");
}
......
......@@ -3,6 +3,11 @@ spring.ldap.username=cn=admin,dc=worfu,dc=com
spring.ldap.password=Yifu123ABC!
spring.ldap.base=dc=worfu,dc=com
#spring.ldap.urls=ldap://192.168.1.65:389
#spring.ldap.username=cn=admin,dc=worfu,dc=com
#spring.ldap.password=yifu123456!
#spring.ldap.base=dc=worfu,dc=com
#ldap\u6D4B\u8BD5\u73AF\u5883\u914D\u7F6E-hgw-2025-04-23
#spring.ldap.urls=ldap://192.168.1.65:389
#spring.ldap.password=yifu123456!
\ No newline at end of file
......@@ -67,22 +67,6 @@ public class EmployeeRegistrationLeave extends BaseEntity {
@ExcelProperty("执行结果0空1未执行2执行中3部分成功4全部失败5全部成功6无需处理")
@Schema(description = "执行结果0空1未执行2执行中3部分成功4全部失败5全部成功6无需处理")
private String doStatus;
/**
* 执行详情
*/
@ExcelAttribute(name = "执行详情", maxLength = 100)
@Length(max = 100, message = "执行详情不能超过100个字符")
@ExcelProperty("执行详情")
@Schema(description = "执行详情")
private String doDetail;
/**
* 原因
*/
@ExcelAttribute(name = "原因", maxLength = 100)
@Length(max = 100, message = "原因不能超过100个字符")
@ExcelProperty("原因")
@Schema(description = "原因")
private String doRemark;
/**
* 合同终止:0空1无需处理2待发起3发起失败4待审核8审核通过10审核不通过
......
......@@ -60,10 +60,6 @@ public class EmployeeRegistrationLeaveConfirmExportVo {
*/
@ExcelProperty("执行结果")
private String doStatus;
@ExcelProperty("执行详情")
private String doDetail;
@ExcelProperty("原因")
private String doRemark;
/**
* 合同终止:0空1无需处理2待发起3发起失败4待审核8审核通过10审核不通过
......
......@@ -50,10 +50,6 @@ public class EmployeeRegistrationLeaveExportVo {
*/
@ExcelProperty("执行结果")
private String doStatus;
@ExcelProperty("执行详情")
private String doDetail;
@ExcelProperty("原因")
private String doRemark;
/**
* 合同终止:0空1无需处理2待发起3发起失败4待审核8审核通过10审核不通过
......
......@@ -62,6 +62,10 @@ public class EmployeeRegistrationLeaveSearchVo extends EmployeeRegistrationLeave
private List<String> idList;
@Schema(description = "状态多个")
@TableField(exist = false)
private String[] processStatusArray;
/**
* @Author fxj
* 查询数据起
......
......@@ -225,7 +225,7 @@ public class EmployeeRegistrationLeaveController {
**/
@Operation(description = "离职待办单个/批量派单")
@PostMapping("/batchDoLeave")
public R<ErrorInfoVo> batchDoLeave(@RequestBody List<String> idList, @RequestParam String isExit
public R<List<EmployeeRegistrationLeave>> batchDoLeave(@RequestBody List<String> idList, @RequestParam String isExit
, @RequestParam(required = false) String doType) {
return employeeRegistrationLeaveService.batchDoLeave(idList, isExit, doType);
}
......
......@@ -80,7 +80,7 @@ public interface EmployeeRegistrationLeaveService extends IService<EmployeeRegis
// 批量派单
// @param isExit: 1仅发起日期为今日及之前的事项 0立即发起(全量)
// @param doType: 需处理项:1社保2公积金3商险4合同5项目档案6人员档案
R<ErrorInfoVo> batchDoLeave(List<String> idList, String isExit, String doType);
R<List<EmployeeRegistrationLeave>> batchDoLeave(List<String> idList, String isExit, String doType);
void reduceHandleToLeave(BaseServiceParamListVO vo);
......
......@@ -611,6 +611,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
}
if (Common.isNotNull(doTypeYi)) {
String closeRemark = "已在其他入口处理";
logInfo.append("已在其他入口处理:");
String socialDispatchId = "";
String fundDispatchId = "";
......@@ -637,6 +638,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
errorInfo.append("社保未派减完结!");
}
leave.setDoStatusSocial(CommonConstants.ONE_STRING);
leave.setCloseRemarkSocial(closeRemark);
} else {
errorInfo.append("社保状态已完结,不可处理!");
}
......@@ -648,7 +650,8 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
if (Common.isEmpty(fundDispatchId)) {
errorInfo.append("公积金未派减完结!");
}
leave.setDoStatusSocial(CommonConstants.ONE_STRING);
leave.setDoStatusFund(CommonConstants.ONE_STRING);
leave.setCloseRemarkFund(closeRemark);
} else {
errorInfo.append("公积金状态已完结,不可处理!");
}
......@@ -670,6 +673,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
errorInfo.append("商险未派减完结!");
}
leave.setDoStatusInsurance(CommonConstants.ONE_STRING);
leave.setCloseRemarkInsurance(closeRemark);
} else {
errorInfo.append("商险状态已完结,不可处理!");
}
......@@ -690,6 +694,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
errorInfo.append("存在可用的合同!");
}
leave.setDoStatusContract(CommonConstants.ONE_STRING);
leave.setCloseRemarkContract(closeRemark);
} else {
errorInfo.append("合同状态已完结,不可处理!");
}
......@@ -740,7 +745,7 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
total++;
if ("1".equals(status)) {
noNeedCount++;
} else if ("0".equals(status) || status.isEmpty()) {
} else if ("0".equals(status) ||"2".equals(status) || status.isEmpty()) {
initialCount++;
} else if (status.endsWith("8")) {
successCount++;
......@@ -796,6 +801,10 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
@Override
public R<String> doSure(EmployeeRegistrationLeave leave) {
YifuUser user = SecurityUtils.getUser();
if (user == null) {
return R.failed("请登录");
}
if (leave != null && Common.isNotNull(leave.getId())) {
EmployeeRegistrationLeave leaveOld = this.getById(leave.getId());
EmployeeRegistration registrationOld = employeeRegistrationMapper.selectById(leave.getId());
......@@ -828,6 +837,9 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
}
this.judgeStatus(leave);
leave.setLeaveStatus(CommonConstants.ONE_STRING);
leave.setConfirmUser(user.getNickname());
leave.setConfirmTime(LocalDateTime.now());
this.updateById(leave);
// 离职待办确认后,更新为商险续签待办为已离职
......@@ -849,6 +861,10 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
@Override
public R<String> doSureBatch(BatchSureLeaveVo vo) {
YifuUser user = SecurityUtils.getUser();
if (user == null) {
return R.failed("请登录");
}
List<String> ids = vo.getIds();
if (Common.isEmpty(ids)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
......@@ -928,6 +944,9 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
paramVo.setDeptNo(registration.getDeptNo());
paramVoList.add(paramVo);
this.judgeStatus(leave);
leave.setLeaveStatus(CommonConstants.ONE_STRING);
leave.setConfirmUser(user.getNickname());
leave.setConfirmTime(LocalDateTime.now());
successList.add(leave);
successNum++;
}
......@@ -975,20 +994,43 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
@Override
public void autoDoLeave() {
List<EmployeeRegistrationLeave> leaveList = baseMapper.selectLeaveListByDispatch(null);
batchDoLeaveCore(leaveList, CommonConstants.ONE_STRING, null);
List<EmployeeRegistrationLeave> saveLeaveList = new ArrayList<>();
String customerUsernameNew;
YifuUser user;
String userName = "自动化自动-";
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
for (int i=0; i<leaveList.size(); i++) {
saveLeaveList.add(leaveList.get(i));
customerUsernameNew = leaveList.get(i).getCustomerUsernameNew();
if (i == leaveList.size()-1 || Common.isEmpty(customerUsernameNew)
|| !customerUsernameNew.equals(leaveList.get(i+1).getCustomerUsernameNew())) {
user = getNewYifuUser(authorities, userName + customerUsernameNew);
batchDoLeaveCore(saveLeaveList, CommonConstants.ONE_STRING, null, user);
saveLeaveList = new ArrayList<>();
}
}
}
// @param isExit: 1仅发起日期为今日及之前的事项 0立即发起(全量)
// * @param doType: 需处理项:1社保2公积金3商险4合同5项目档案6人员档案
@Override
public R<ErrorInfoVo> batchDoLeave(List<String> idList, String isExit, String doType) {
public R<List<EmployeeRegistrationLeave>> batchDoLeave(List<String> idList, String isExit, String doType) {
List<EmployeeRegistrationLeave> leaveList = baseMapper.selectLeaveListByDispatch(idList);
return batchDoLeaveCore(leaveList, isExit, doType);
YifuUser user = SecurityUtils.getUser();
String userName = "自动化手动-";
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
user = getNewYifuUser(authorities, userName + user.getNickname());
return batchDoLeaveCore(leaveList, isExit, doType, user);
}
private YifuUser getNewYifuUser(Collection<? extends GrantedAuthority> authorities, String userName) {
return new YifuUser("7", 1L, "", userName,
return new YifuUser("1", 1L, "", userName,
userName, "0", SecurityConstants.BCRYPT + "123456",
"12345678911", true, true, true,
true,
......@@ -999,23 +1041,11 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
// @param isExit: 1仅发起日期为今日及之前的事项 0立即发起(全量)
// * @param doType: 需处理项:1社保2公积金3商险4合同5项目档案6人员档案
private R<ErrorInfoVo> batchDoLeaveCore(List<EmployeeRegistrationLeave> leaveList, String isExit, String doType) {
YifuUser user = SecurityUtils.getUser();
String userName = "自动化";
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
if (user != null && Common.isNotNull(user.getNickname())) {
userName += "手动-" + user.getNickname();
} else {
userName += "自动";
}
user = getNewYifuUser(authorities, userName);
private R<List<EmployeeRegistrationLeave>> batchDoLeaveCore(List<EmployeeRegistrationLeave> leaveList, String isExit, String doType, YifuUser user) {
if (Common.isEmpty(leaveList)) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
String userName = user.getNickname();
List<TDispatchReduceVo> socialOldList = new ArrayList<>();
TDispatchReduceVo vo;
List<TDispatchReduceVo> fundOldList = new ArrayList<>();
......@@ -1029,20 +1059,25 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
List<BaseSearchVO> listParamEmp = new ArrayList<>();
BaseSearchVO searchVo;
int i = 0;
Map<Integer, String> rowLeaveMap = new HashMap<>();
// 商险id与离职待办的映射
Map<String, String> insuranceLeaveMap = new HashMap<>();
// 离职待办与商险的映射
Map<String, List<String>> leaveInsuranceMap = new HashMap<>();
// 单一离职待办里的商险
List<String> insuranceList;
String[] insuranceArr;
String errorMessage;
for (EmployeeRegistrationLeave leave : leaveList) {
i++;
rowLeaveMap.put(i, leave.getId());
if ((Common.isEmpty(doType) || doType.contains(CommonConstants.ONE_STRING))
&& Common.isNotNull(leave.getSocialDispatchIdOld()) && (CommonConstants.ZERO_STRING.equals(isExit)
|| (CommonConstants.ONE_STRING.equals(isExit) && leave.getSocialExpectedTime().isBefore(nowTime)))) {
|| (CommonConstants.ONE_STRING.equals(isExit) && leave.getSocialExpectedTime().isBefore(nowTime)))
&& Common.isNotNull(leave.getDoStatusSocial())
&& (leave.getDoStatusSocial().equals(CommonConstants.TWO_STRING)
|| leave.getDoStatusSocial().equals(CommonConstants.THREE_STRING)
|| leave.getDoStatusSocial().equals(CommonConstants.SIX_STRING)
|| leave.getDoStatusSocial().equals(CommonConstants.NINE_STRING)
|| leave.getDoStatusSocial().equals(CommonConstants.TEN_STRING)
)
) {
leave.setFailSocialUser(userName);
vo = new TDispatchReduceVo();
vo.setLeaveId(leave.getId());
......@@ -1057,7 +1092,14 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
if ((Common.isEmpty(doType) || doType.contains(CommonConstants.TWO_STRING))
&& Common.isNotNull(leave.getFundDispatchIdOld()) && (CommonConstants.ZERO_STRING.equals(isExit)
|| (CommonConstants.ONE_STRING.equals(isExit) && leave.getFundExpectedTime().isBefore(nowTime)))) {
|| (CommonConstants.ONE_STRING.equals(isExit) && leave.getFundExpectedTime().isBefore(nowTime)))
&& Common.isNotNull(leave.getDoStatusFund())
&& (leave.getDoStatusFund().equals(CommonConstants.TWO_STRING)
|| leave.getDoStatusFund().equals(CommonConstants.THREE_STRING)
|| leave.getDoStatusFund().equals(CommonConstants.NINE_STRING)
|| leave.getDoStatusFund().equals(CommonConstants.TEN_STRING)
)
) {
leave.setFailFundUser(userName);
vo = new TDispatchReduceVo();
vo.setLeaveId(leave.getId());
......@@ -1072,19 +1114,30 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
if ((Common.isEmpty(doType) || doType.contains(CommonConstants.THREE_STRING))
&& Common.isNotNull(leave.getInsuranceIdOld()) && (CommonConstants.ZERO_STRING.equals(isExit)
|| (CommonConstants.ONE_STRING.equals(isExit) && leave.getInsuranceExpectedTime().isBefore(nowTime)))) {
|| (CommonConstants.ONE_STRING.equals(isExit) && leave.getInsuranceExpectedTime().isBefore(nowTime)))
&& Common.isNotNull(leave.getDoStatusInsurance())
&& (leave.getDoStatusInsurance().equals(CommonConstants.TWO_STRING)
|| leave.getDoStatusInsurance().equals(CommonConstants.THREE_STRING)
|| leave.getDoStatusInsurance().equals(CommonConstants.NINE_STRING)
)
) {
insuranceArr = leave.getInsuranceIdOld().split(",");
insuranceList = new ArrayList<>();
for (String id : insuranceArr) {
insuranceList.add(id);
insuranceOldList.add(id);
insuranceLeaveMap.put(id, leave.getId());
}
leaveInsuranceMap.put(leave.getId(), insuranceList);
}
if ((Common.isEmpty(doType) || doType.contains(CommonConstants.FOUR_STRING))
&& Common.isNotNull(leave.getContractIdOld()) && (CommonConstants.ZERO_STRING.equals(isExit)
|| (CommonConstants.ONE_STRING.equals(isExit) && leave.getContractExpectedTime().isBefore(nowTime)))) {
|| (CommonConstants.ONE_STRING.equals(isExit) && leave.getContractExpectedTime().isBefore(nowTime)))
&& Common.isNotNull(leave.getDoStatusContract())
&& (leave.getDoStatusContract().equals(CommonConstants.TWO_STRING)
|| leave.getDoStatusContract().equals(CommonConstants.THREE_STRING)
|| leave.getDoStatusContract().equals(CommonConstants.TEN_STRING)
)
) {
leave.setFailContractUser(userName);
searchVo = new BaseSearchVO();
searchVo.setSearchKey(leave.getContractIdOld());
......@@ -1099,7 +1152,12 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
if ((Common.isEmpty(doType) || doType.contains(CommonConstants.FIVE_STRING))
&& Common.isNotNull(leave.getEmpProjectIdOld())) {
&& Common.isNotNull(leave.getEmpProjectIdOld())
&& Common.isNotNull(leave.getDoStatusProject())
&& (leave.getDoStatusProject().equals(CommonConstants.TWO_STRING)
|| leave.getDoStatusProject().equals(CommonConstants.NINE_STRING)
)
) {
leave.setFailEmpUser(userName);
searchVo = new BaseSearchVO();
searchVo.setSearchKey(leave.getEmpProjectIdOld());
......@@ -1108,14 +1166,19 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
searchVo.setDeptNo(leave.getDeptNo());
searchVo.setResultIdOne(leave.getId());
if (Common.isNotNull(leave.getLeaveReasonName())) {
searchVo.setResultIdThree(leave.getLeaveReasonName());
searchVo.setResultIdThree(leave.getLeaveReasonId());
} else {
searchVo.setResultIdThree(RegistConstants.BASE_REASON_TYPE_NAME);
searchVo.setResultIdThree(RegistConstants.BASE_REASON_TYPE);
}
listParamProject.add(searchVo);
}
if ((Common.isEmpty(doType) || doType.contains(CommonConstants.SIX_STRING))
&& Common.isNotNull(leave.getEmpIdOld())) {
&& Common.isNotNull(leave.getEmpIdOld())
&& Common.isNotNull(leave.getDoStatusEmp())
&& (leave.getDoStatusEmp().equals(CommonConstants.TWO_STRING)
|| leave.getDoStatusEmp().equals(CommonConstants.NINE_STRING)
)
) {
leave.setFailEmpProjectUser(userName);
searchVo = new BaseSearchVO();
searchVo.setSearchKey(leave.getEmpProjectIdOld());
......@@ -1141,7 +1204,8 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
// 社保-完成
if (!socialOldList.isEmpty()) {
TDispatchReduceListVo paramListVo = new TDispatchReduceListVo();
paramListVo.setNewUser(user);
paramListVo.setUserId(user.getId());
paramListVo.setUserName(user.getNickname());
paramListVo.setListParam(socialOldList);
R<BaseSearchListVO> listR = socialDaprUtils.leaveToReduceSocialAndFund(paramListVo);
// 成功+失败
......@@ -1166,7 +1230,11 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
leave.setDoStatusSocial(CommonConstants.FOUR_STRING);
} else if (errorMap.get(leave.getId()) != null) {
// 失败
leave.setFailSocialRemark(errorMap.get(leave.getId()));
errorMessage = errorMap.get(leave.getId());
if (Common.isNotNull(errorMessage) && errorMessage.length() > 300) {
errorMessage = errorMessage.substring(0, 300);
}
leave.setFailSocialRemark(errorMessage);
leave.setFailSocialTime(LocalDateTime.now());
leave.setDoStatusSocial(CommonConstants.THREE_STRING);
}
......@@ -1176,7 +1244,8 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
// 公积金-完成
if (!fundOldList.isEmpty()) {
TDispatchReduceListVo paramListVo = new TDispatchReduceListVo();
paramListVo.setNewUser(user);
paramListVo.setUserId(user.getId());
paramListVo.setUserName(user.getNickname());
paramListVo.setListParam(fundOldList);
R<BaseSearchListVO> listR = socialDaprUtils.leaveToReduceSocialAndFund(paramListVo);
// 成功+失败
......@@ -1201,7 +1270,11 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
leave.setDoStatusFund(CommonConstants.FOUR_STRING);
} else if (errorMap.get(leave.getId()) != null) {
// 失败
leave.setFailFundRemark(errorMap.get(leave.getId()));
errorMessage = errorMap.get(leave.getId());
if (Common.isNotNull(errorMessage) && errorMessage.length() > 300) {
errorMessage = errorMessage.substring(0, 300);
}
leave.setFailFundRemark(errorMessage);
leave.setFailFundTime(LocalDateTime.now());
leave.setDoStatusFund(CommonConstants.THREE_STRING);
}
......@@ -1210,73 +1283,82 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
// 商险-完成
if (!insuranceOldList.isEmpty()) {
// insuranceLeaveMap;
// 查找是 2待派单3发起失败9减员退回 的再去办
List<String> toDoList = leaveInsuranceMapper.getLeaveInsuranceListByIdAndStatus(insuranceOldList);
BaseSearchListVO paramVoInsurance = new BaseSearchListVO();
paramVoInsurance.setNewUser(user);
paramVoInsurance.setListStringParam(toDoList);
R<BaseSearchListVO> listR = insuranceDaprUtil.leaveToReduceInsurance(paramVoInsurance);
if (Common.isNotNull(listR) && Common.isNotNull(listR.getData())) {
// 部分失败
if (!listR.getData().getErrorMessageList().isEmpty()) {
insuranceParamList = listR.getData().getErrorMessageList();
// 商险id与错误原因
Map<String, String> errorMap = new HashMap<>();
for (ErrorMessage message : insuranceParamList) {
errorMap.put(message.getName(), message.getMessage());
}
StringBuilder errorMsg;
// 错误的商险派单
List<String> errorList = new ArrayList<>();
List<String> successList = new ArrayList<>();
for (EmployeeRegistrationLeave leave : leaveList) {
errorMsg = new StringBuilder();
leave.setInsuranceId(leave.getInsuranceIdOld());
insuranceList = leaveInsuranceMap.get(leave.getId());
if (insuranceList != null) {
// 处理每一条商险
for (String insuranceId : insuranceList) {
if (errorMap.get(insuranceId) != null) {
errorMsg.append(errorMap.get(insuranceId)).append(CommonConstants.SEMICOLON_STRING);
errorList.add(insuranceId);
if (toDoList != null && !toDoList.isEmpty()) {
BaseSearchListVO paramVoInsurance = new BaseSearchListVO();
paramVoInsurance.setUserId(user.getId());
paramVoInsurance.setUserName(user.getNickname());
paramVoInsurance.setListStringParam(toDoList);
R<BaseSearchListVO> listR = insuranceDaprUtil.leaveToReduceInsurance(paramVoInsurance);
if (Common.isNotNull(listR) && Common.isNotNull(listR.getData())) {
// 部分失败
if (!listR.getData().getErrorMessageList().isEmpty()) {
insuranceParamList = listR.getData().getErrorMessageList();
// 商险id与错误原因
Map<String, String> errorMap = new HashMap<>();
for (ErrorMessage message : insuranceParamList) {
if (Common.isNotNull(message.getName())) {
errorMap.put(message.getName(), message.getMessage());
}
}
StringBuilder errorMsg;
// 错误的商险派单
List<String> errorList = new ArrayList<>();
List<String> successList = new ArrayList<>();
for (EmployeeRegistrationLeave leave : leaveList) {
errorMsg = new StringBuilder();
leave.setInsuranceId(leave.getInsuranceIdOld());
insuranceList = leaveInsuranceMap.get(leave.getId());
if (insuranceList != null) {
// 处理每一条商险
for (String insuranceId : insuranceList) {
if (errorMap.get(insuranceId) != null) {
errorMsg.append(errorMap.get(insuranceId)).append(CommonConstants.SEMICOLON_STRING);
errorList.add(insuranceId);
} else {
successList.add(insuranceId);
}
}
if (errorMsg.length() > CommonConstants.ZERO_INT) {
leave.setFailInsuranceUser(userName);
errorMessage = errorMsg.toString();
if (Common.isNotNull(errorMessage) && errorMessage.length() > 300) {
errorMessage = errorMessage.substring(0, 300);
}
leave.setFailInsuranceRemark(errorMessage);
leave.setFailInsuranceTime(LocalDateTime.now());
leave.setDoStatusInsurance(CommonConstants.THREE_STRING);
} else {
successList.add(insuranceId);
// 待减员
leave.setDoStatusInsurance(CommonConstants.FOUR_STRING);
}
}
if (errorMsg.length() > CommonConstants.ZERO_INT) {
leave.setFailInsuranceUser(userName);
leave.setFailInsuranceRemark(errorMsg.toString());
leave.setFailInsuranceTime(LocalDateTime.now());
leave.setDoStatusInsurance(CommonConstants.THREE_STRING);
} else {
// 待减员
leave.setDoStatusInsurance(CommonConstants.FOUR_STRING);
}
}
// 批量处理商险明细表的状态为失败:
if (!errorList.isEmpty()) {
leaveInsuranceMapper.updateLeaveInsuranceListByIdAndStatus(CommonConstants.THREE_STRING, errorList);
}
if (!successList.isEmpty()) {
leaveInsuranceMapper.updateLeaveInsuranceListByIdAndStatus(CommonConstants.FOUR_STRING, successList);
}
} else {
// 全部成功
for (EmployeeRegistrationLeave leave : leaveList) {
leave.setInsuranceId(leave.getInsuranceIdOld());
// 待办理
leave.setDoStatusInsurance(CommonConstants.FIVE_STRING);
}
leaveInsuranceMapper.updateLeaveInsuranceListByIdAndStatus(CommonConstants.FOUR_STRING, insuranceOldList);
}
// 批量处理商险明细表的状态为失败:
if (!errorList.isEmpty()) {
leaveInsuranceMapper.updateLeaveInsuranceListByIdAndStatus(CommonConstants.THREE_STRING, errorList);
}
if (!successList.isEmpty()) {
leaveInsuranceMapper.updateLeaveInsuranceListByIdAndStatus(CommonConstants.FOUR_STRING, successList);
}
} else {
// 全部成功
for (EmployeeRegistrationLeave leave : leaveList) {
leave.setInsuranceId(leave.getInsuranceIdOld());
// 待办理
leave.setDoStatusInsurance(CommonConstants.FIVE_STRING);
}
leaveInsuranceMapper.updateLeaveInsuranceListByIdAndStatus(CommonConstants.FOUR_STRING, insuranceOldList);
}
}
}
// 合同-完成
if (!listParamContract.isEmpty()) {
BaseSearchListVO paramVoContract = new BaseSearchListVO();
paramVoContract.setNewUser(user);
paramVoContract.setUserId(user.getId());
paramVoContract.setUserName(user.getNickname());
paramVoContract.setListParam(listParamContract);
R<BaseSearchListVO> listR = archivesDaprUtil.leaveToReduceContract(paramVoContract);
// 成功+失败
......@@ -1301,7 +1383,11 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
leave.setDoStatusContract(CommonConstants.FOUR_STRING);
} else if (errorMap.get(leave.getId()) != null) {
// 失败
leave.setFailContractRemark(errorMap.get(leave.getId()));
errorMessage = errorMap.get(leave.getId());
if (Common.isNotNull(errorMessage) && errorMessage.length() > 300) {
errorMessage = errorMessage.substring(0, 300);
}
leave.setFailContractRemark(errorMessage);
leave.setFailContractTime(LocalDateTime.now());
leave.setDoStatusContract(CommonConstants.THREE_STRING);
}
......@@ -1311,7 +1397,8 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
// 项目-完成
if (!listParamProject.isEmpty()) {
BaseSearchListVO paramVoProject = new BaseSearchListVO();
paramVoProject.setNewUser(user);
paramVoProject.setUserId(user.getId());
paramVoProject.setUserName(user.getNickname());
paramVoProject.setListParam(listParamProject);
R<BaseSearchListVO> listR = archivesDaprUtil.leaveToReduceProject(paramVoProject);
if (Common.isNotNull(listR) && Common.isNotNull(listR.getData())) {
......@@ -1324,12 +1411,13 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
for (EmployeeRegistrationLeave leave : leaveList) {
if (errorMap.get(leave.getId()) != null) {
leave.setFailEmpProjectRemark(errorMap.get(leave.getId()));
errorMessage = errorMap.get(leave.getId());
if (Common.isNotNull(errorMessage) && errorMessage.length() > 300) {
errorMessage = errorMessage.substring(0, 300);
}
leave.setFailEmpProjectRemark(errorMessage);
leave.setFailEmpProjectTime(LocalDateTime.now());
leave.setDoStatusProject(CommonConstants.NINE_STRING);
} else {
leave.setEmpProjectId(leave.getEmpProjectIdOld());
leave.setDoStatusProject(CommonConstants.EIGHT_STRING);
}
}
} else {
......@@ -1344,7 +1432,8 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
// 员工-完成
if (!listParamEmp.isEmpty()) {
BaseSearchListVO paramVoEmp = new BaseSearchListVO();
paramVoEmp.setNewUser(user);
paramVoEmp.setUserId(user.getId());
paramVoEmp.setUserName(user.getNickname());
paramVoEmp.setListParam(listParamEmp);
R<BaseSearchListVO> listR = archivesDaprUtil.leaveToReduceEmp(paramVoEmp);
if (Common.isNotNull(listR) && Common.isNotNull(listR.getData())) {
......@@ -1357,12 +1446,13 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
for (EmployeeRegistrationLeave leave : leaveList) {
if (errorMap.get(leave.getId()) != null) {
leave.setFailEmpRemark(errorMap.get(leave.getId()));
errorMessage = errorMap.get(leave.getId());
if (Common.isNotNull(errorMessage) && errorMessage.length() > 300) {
errorMessage = errorMessage.substring(0, 300);
}
leave.setFailEmpRemark(errorMessage);
leave.setFailEmpTime(LocalDateTime.now());
leave.setDoStatusEmp(CommonConstants.NINE_STRING);
} else {
leave.setEmpId(leave.getEmpIdOld());
leave.setDoStatusEmp(CommonConstants.EIGHT_STRING);
}
}
} else {
......@@ -1397,6 +1487,8 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
preContent += ",且发起全部日期的事项";
}
// 是否返回前端错误信息
boolean isReturn = false;
// 最终更新总状态
for (EmployeeRegistrationLeave leave : leaveList) {
judgeStatus(leave);
......@@ -1407,6 +1499,17 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
leaveLog.setCreateTime(LocalDateTime.now());
leaveLog.setContent(preContent);
logList.add(leaveLog);
if (!isReturn) {
if ((Common.isNotNull(leave.getDoStatusSocial()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusSocial()))
|| (Common.isNotNull(leave.getDoStatusFund()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusFund()))
|| (Common.isNotNull(leave.getDoStatusContract()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusContract()))
|| (Common.isNotNull(leave.getDoStatusInsurance()) && CommonConstants.THREE_STRING.equals(leave.getDoStatusInsurance()))
|| (Common.isNotNull(leave.getDoStatusProject()) && CommonConstants.NINE_STRING.equals(leave.getDoStatusProject()))
|| (Common.isNotNull(leave.getDoStatusEmp()) && CommonConstants.NINE_STRING.equals(leave.getDoStatusEmp()))
) {
isReturn = true;
}
}
}
leaveLogService.saveBatch(logList);
this.updateBatchById(leaveList);
......@@ -1417,7 +1520,11 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
errorVo.setSocialParamList(socialParamList);
errorVo.setFundParamList(fundParamList);
errorVo.setInsuranceParamList(insuranceParamList);
return R.ok(errorVo);
if (isReturn) {
return R.failed(leaveList, "发起失败!");
} else {
return R.ok();
}
}
@Override
......@@ -1427,15 +1534,17 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
String doType = vo.getDoType();
String doStatus = vo.getDoStatus();
// 0:失败;1:成功(失败要记录信息)
String isSuccess = vo.getIsSuccess();
String userName = vo.getUserName();
// 最终成功,才更新执行详情
boolean canUpdateDoDetail = false;
if (Common.isNotNull(isSuccess) && CommonConstants.ONE_STRING.equals(isSuccess)) {
canUpdateDoDetail = true;
boolean canUpdateFail = false;
if (Common.isNotNull(isSuccess) && CommonConstants.ZERO_STRING.equals(isSuccess)) {
canUpdateFail = true;
}
String doRemark = vo.getRemark();
if (doRemark.length()>200) {
doRemark = doRemark.substring(0,200);
if (Common.isNotNull(doRemark) && doRemark.length()>50) {
doRemark = doRemark.substring(0,50);
}
List<String> idList = vo.getListParam();
if (idList != null && !idList.isEmpty() && Common.isNotNull(doType)) {
......@@ -1444,33 +1553,33 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
Map<String, Integer> insuranceMap = new HashMap<>();
if (CommonConstants.THREE_STRING.equals(doType)) {
leaveList = baseMapper.selectLeaveListByHandleAndInsuranceType(idList);
} else {
leaveList = baseMapper.selectLeaveListByHandleAndType(idList, doType);
for (String id:idList) {
insuranceMap.put(id, CommonConstants.ONE_INT);
}
} else {
leaveList = baseMapper.selectLeaveListByHandleAndType(idList, doType);
}
if (leaveList != null && !leaveList.isEmpty()) {
String newDetail;
List<EmployeeRegistrationLeaveInsurance> insuranceList;
String minStatus;
String currentStatus;
for (EmployeeRegistrationLeave leave : leaveList) {
leave.setDoRemark(doRemark);
if (canUpdateDoDetail) {
newDetail = RegistConstants.DO_TYPE_REDUCE_ARR[Integer.parseInt(doType)];
if (Common.isEmpty(leave.getDoDetail())) {
leave.setDoDetail(newDetail);
} else if (!leave.getDoDetail().contains(newDetail)) {
leave.setDoDetail(leave.getDoDetail() + newDetail);
}
}
// 处理社保
if (CommonConstants.ONE_STRING.equals(doType)) {
leave.setDoStatusSocial(doStatus);
if (canUpdateFail) {
leave.setFailSocialUser(userName);
leave.setFailSocialTime(LocalDateTime.now());
leave.setFailSocialRemark(doRemark);
}
}
if (CommonConstants.TWO_STRING.equals(doType)) {
leave.setDoStatusFund(doStatus);
if (canUpdateFail) {
leave.setFailFundUser(userName);
leave.setFailFundTime(LocalDateTime.now());
leave.setFailFundRemark(doRemark);
}
}
if (CommonConstants.THREE_STRING.equals(doType)) {
insuranceList = leaveInsuranceMapper.getLeaveInsuranceList(leave.getId(), null);
......@@ -1489,16 +1598,36 @@ public class EmployeeRegistrationLeaveServiceImpl extends ServiceImpl<EmployeeRe
}
}
}
if (canUpdateFail) {
leave.setFailInsuranceUser(userName);
leave.setFailInsuranceTime(LocalDateTime.now());
leave.setFailInsuranceRemark(doRemark);
}
leave.setDoStatusInsurance(minStatus);
}
if (CommonConstants.FOUR_STRING.equals(doType)) {
leave.setDoStatusContract(doStatus);
if (canUpdateFail) {
leave.setFailContractUser(userName);
leave.setFailContractTime(LocalDateTime.now());
leave.setFailContractRemark(doRemark);
}
}
if (CommonConstants.FIVE_STRING.equals(doType)) {
leave.setDoStatusProject(doStatus);
if (canUpdateFail) {
leave.setFailEmpProjectUser(userName);
leave.setFailEmpProjectTime(LocalDateTime.now());
leave.setFailEmpProjectRemark(doRemark);
}
}
if (CommonConstants.SIX_STRING.equals(doType)) {
leave.setDoStatusEmp(doStatus);
if (canUpdateFail) {
leave.setFailEmpUser(userName);
leave.setFailEmpTime(LocalDateTime.now());
leave.setFailEmpRemark(doRemark);
}
}
judgeStatus( leave);
}
......
......@@ -1457,6 +1457,18 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
socialDaprUtils.saveSocialPreInfo(preVo);
}
//服务类型包含公积金购买时
if (preVo.getServerItem().contains("公积金") && (null != preVo.getExitFundInfoList()
|| null != preVo.getDispatchInfoFundPreVo())) {
if (null != preVo.getExitFundInfoList() && !preVo.getExitFundInfoList().isEmpty()) {
preVo.getExitFundInfoList().forEach(fundPreDetailVo -> fundPreDetailVo.setRegisterId(domainR.getData()));
}
//生成社保待购买或者已购买数据
if (null != preVo.getDispatchInfoFundPreVo()) {
initFundPreInfo(registrationNow, preVo.getDispatchInfoFundPreVo(), user, domainR.getData());
}
socialDaprUtils.saveFundPreInfo(preVo);
}
}
}catch (Exception e) {
log.error("执行异常", e);
......
......@@ -57,7 +57,7 @@
a.insurance_id
FROM employee_registration_leave_insurance a
<where>
do_status_insurance in ('2','3','9')
do_status_insurance in ('0','2','3','9')
<if test="idList != null">
AND a.insurance_id in
<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
......@@ -72,7 +72,7 @@
<set>
do_status_insurance = #{status}
</set>
where do_status_insurance in ('2','3','9') and insurance_id in
where do_status_insurance in ('0','2','3','9') and insurance_id in
<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
#{idStr}
</foreach>
......
......@@ -28,8 +28,6 @@
<id property="id" column="id"/>
<result property="leaveStatus" column="leave_status"/>
<result property="doStatus" column="do_status"/>
<result property="doDetail" column="do_detail"/>
<result property="doRemark" column="do_remark"/>
<result property="doStatusContract" column="do_status_contract"/>
<result property="doStatusSocial" column="do_status_social"/>
<result property="doStatusFund" column="do_status_fund"/>
......@@ -77,8 +75,6 @@
<id property="id" column="id"/>
<result property="leaveStatus" column="leave_status"/>
<result property="doStatus" column="do_status"/>
<result property="doDetail" column="do_detail"/>
<result property="doRemark" column="do_remark"/>
<result property="createBy" column="create_by"/>
<result property="createName" column="create_name"/>
<result property="createTime" column="create_time"/>
......@@ -162,8 +158,6 @@
a.id,
a.leave_status,
a.do_status,
a.do_detail,
a.do_remark,
a.create_by,
a.create_name,
a.create_time,
......@@ -232,8 +226,7 @@
a.close_remark_emp,
a.close_remark_emp_project,
a.leave_reason_name,
a.leave_reason_id,
a.customer_username_new
a.leave_reason_id
</sql>
......@@ -286,12 +279,6 @@
<if test="employeeRegistrationLeave.doStatus != null and employeeRegistrationLeave.doStatus.trim() != ''">
AND a.do_status = #{employeeRegistrationLeave.doStatus}
</if>
<if test="employeeRegistrationLeave.doDetail != null and employeeRegistrationLeave.doDetail.trim() != ''">
AND a.do_detail = #{employeeRegistrationLeave.doDetail}
</if>
<if test="employeeRegistrationLeave.doRemark != null and employeeRegistrationLeave.doRemark.trim() != ''">
AND a.do_remark = #{employeeRegistrationLeave.doRemark}
</if>
<if test="employeeRegistrationLeave.createBy != null and employeeRegistrationLeave.createBy.trim() != ''">
AND a.create_by = #{employeeRegistrationLeave.createBy}
</if>
......@@ -404,8 +391,6 @@
<sql id="Base_Export_List">
case a.leave_status when '0' then '待确认' when '1' then '待处理' when '2' then '处理中' when '3' then '已处理' else '--' end leave_status,
case a.do_status when '0' then '--' when '1' then '未执行' when '2' then '执行中' when '3' then '部分成功' when '4' then '全部失败' when '5' then '全部成功' when '6' then '无需处理' else '--' end do_status,
a.do_detail,
a.do_remark,
case a.do_status_contract when '0' then '--' when '1' then '无需处理' when '2' then '待发起' when '3' then '发起失败'
when '4' then '待审核' when '8' then '审核通过' when '10' then '审核不通过' else '--' end do_status_contract,
case a.do_status_social when '0' then '--' when '1' then '无需处理' when '2' then '待派单' when '3' then '发起失败'
......@@ -465,7 +450,7 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
1=1
<include refid="employeeRegistrationLeave_where"/>
</where>
ORDER BY b.create_time asc,b.id asc
ORDER BY b.create_time desc,b.id asc
</select>
<!-- 离职待办列表2000条-->
......@@ -477,8 +462,17 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
<where>
1=1
<include refid="employeeRegistrationLeave_where"/>
<if test="employeeRegistrationLeave != null">
<if test="employeeRegistrationLeave.processStatusArray != null and employeeRegistrationLeave.processStatusArray.length > 0">
AND a.leave_status in
<foreach item="statusStr" index="index" collection="employeeRegistrationLeave.processStatusArray" open="("
separator="," close=")">
#{statusStr}
</foreach>
</if>
</if>
</where>
ORDER BY b.create_time asc,b.id asc
ORDER BY b.create_time desc,b.id asc
limit 2000
</select>
<!--离职确认列表-->
......@@ -491,7 +485,7 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
a.confirm_user is not null
<include refid="employeeRegistrationLeave_where"/>
</where>
ORDER BY b.create_time asc,b.id asc
ORDER BY b.create_time desc,b.id asc
</select>
<!-- 离职待办导出-->
......@@ -504,7 +498,7 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
1=1
<include refid="employeeRegistrationLeave_where"/>
</where>
ORDER BY b.create_time asc,b.id asc
ORDER BY b.create_time desc,b.id asc
<if test="employeeRegistrationLeave != null">
<if test="employeeRegistrationLeave.limitStart != null">
limit #{employeeRegistrationLeave.limitStart},#{employeeRegistrationLeave.limitEnd}
......@@ -521,7 +515,7 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
a.confirm_user is not null
<include refid="employeeRegistrationLeave_where"/>
</where>
ORDER BY b.create_time asc,b.id asc
ORDER BY b.create_time desc,b.id asc
<if test="employeeRegistrationLeave != null">
<if test="employeeRegistrationLeave.limitStart != null">
limit #{employeeRegistrationLeave.limitStart},#{employeeRegistrationLeave.limitEnd}
......@@ -554,8 +548,7 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
<select id="selectLeaveListBySure" resultMap="employeeRegistrationLeaveMap" >
SELECT
a.ID,
a.leave_status
<include refid="Base_Column_List"/>
FROM employee_registration_leave a
where a.leave_status = '0'
<if test="idList != null">
......@@ -599,7 +592,7 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
</foreach>
</if>
</where>
ORDER BY b.create_time asc,b.id asc
ORDER BY b.customer_username_new asc,b.id asc
</select>
<!-- 查询需要办理的数据 -->
......@@ -610,19 +603,19 @@ when '4' then '待减员' when '5' then '待办理' when '6' then '减员中' wh
<where> 1=1
<if test="idList != null and idList.size() > 0">
<if test="doType != null and doType.trim() != ''">
<if test="doType == '1'">
<if test='doType == "1" '>
and a.social_id in
</if>
<if test="doType == '2'">
<if test='doType == "2" '>
and a.fund_id in
</if>
<if test="doType == '4'">
<if test='doType == "4" '>
and a.contract_id in
</if>
<if test="doType == '5'">
<if test='doType == "5" '>
and a.emp_project_id in
</if>
<if test="doType == '6'">
<if test='doType == "6" '>
and a.emp_id in
</if>
<foreach collection="idList" item="param" index="index" open="(" close=")" separator=",">
......
......@@ -29,6 +29,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.util.equator.HrEquator;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchListVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseServiceParamListVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.*;
......@@ -61,6 +62,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
......@@ -164,6 +167,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Autowired
private WxConfig wxConfig;
@Autowired
private CspDaprUtils cspDaprUtil;
/***********************商险办理********************************/
/**
* 每日定时刷新商险到期数据
......@@ -4835,17 +4841,31 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return list;
}
private YifuUser getNewYifuUser(String userId, String userName) {
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
return new YifuUser(userId, 1L, "", userName,
userName, "0", SecurityConstants.BCRYPT + "123456",
"12345678911", true, true, true,
true,
"1", authorities, "1",
null, null,
null, null);
}
// 离职导致的减员
@Override
public BaseSearchListVO leaveToReduceInsurance(BaseSearchListVO paramVo) {
List<String> insuranceList = paramVo.getListStringParam();
YifuUser newUser = paramVo.getNewUser();
YifuUser newUser = getNewYifuUser(paramVo.getUserId(), paramVo.getUserName());
List<InsuranceExportListVO> oldList = baseMapper.getInsuranceExportListBySelect(insuranceList);
List<InsuranceRefundCheck> insuranceRefundCheckList = new ArrayList<>();
InsuranceRefundCheck refund;
if (oldList != null && !oldList.isEmpty()) {
for (InsuranceExportListVO vo : oldList) {
refund = new InsuranceRefundCheck();
refund.setId(vo.getId());
refund.setEmpName(vo.getEmpName());
// 员工姓名 员工身份证号码 保险公司名称 险种名称 购买标准(元) 保单开始日期 保单结束日期
refund.setEmpIdcardNo(vo.getEmpIdcardNo());
......@@ -5347,11 +5367,15 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//批量更新
if (CollectionUtils.isNotEmpty(detailList)){
List<String> idList = new ArrayList<>();
for (TInsuranceDetail s : detailList) {
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail :: getId,s.getId()).set(TInsuranceDetail :: getReduceHandleStatus,CommonConstants.TWO_INT);
update(updateWrapper);
idList.add(s.getId());
}
// 商险办理,更新离职待办
this.sendLeave(idList, CommonConstants.SIX_STRING, CommonConstants.ONE_STRING, null, user);
}
//批量更新
if (CollectionUtils.isNotEmpty(refundList)){
......@@ -5416,8 +5440,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceDetail.setIsOverdue(null);
tInsuranceDetail.setIsEffect(null);
tInsuranceDetail.setBuyHandleStatus(CommonConstants.FIVE_INT);
// 已减员
this.sendLeaveById(tInsuranceDetail.getId(), CommonConstants.EIGHT_STRING, CommonConstants.ONE_STRING, remark, user);
}else {
tInsuranceDetail.setBuyHandleStatus(CommonConstants.THREE_INT);
// 9减员退回
this.sendLeaveById(tInsuranceDetail.getId(), CommonConstants.NINE_STRING, CommonConstants.ZERO_STRING, remark, user);
}
tInsuranceDetail.setUpdateBy(user.getId());
tInsuranceDetail.setUpdateTime(LocalDateTime.now());
......@@ -5510,13 +5540,22 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
operate.setCreateBy(user.getId());
if(InsurancesConstants.SUCCESS.equals(param.getHandType())){
operate.setOperateDesc(InsurancesConstants.INSURANCE_REFUND_SUCCESS);
// 商险办理,更新离职待办
this.sendLeaveById(param.getId(), CommonConstants.EIGHT_STRING, CommonConstants.ONE_STRING, param.getRemark(), user);
}else{
operate.setOperateDesc(InsurancesConstants.INSURANCE_REFUND_FAILED);
// 商险办理,更新离职待办
this.sendLeaveById(param.getId(), CommonConstants.NINE_STRING, CommonConstants.ONE_STRING, param.getRemark(), user);
}
operateList.add(operate);
sourceIdCardList.add(detail.getEmpIdcardNo());
replaceIdList.add(detail.getId());
}
}
tInsuranceOperateService.saveBatch(operateList);
// 减员失效
......@@ -9155,4 +9194,43 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
return returnVo;
}
// 审核或办理,更新离职待办
// isSuccess 0:失败;1:成功
private void sendLeave(List<String> idList, String doStatus, String isSuccess, String failRemark, YifuUser user) {
BaseServiceParamListVO updateVo = new BaseServiceParamListVO();
updateVo.setListParam(idList);
updateVo.setDoType(CommonConstants.THREE_STRING);
updateVo.setDoStatus(doStatus);
updateVo.setIsSuccess(isSuccess);
if (Common.isNotNull(isSuccess) && CommonConstants.ZERO_STRING.equals(isSuccess)) {
updateVo.setRemark(failRemark);
if (user != null && Common.isNotNull(user.getNickname())) {
updateVo.setUserName(user.getNickname());
}
}
cspDaprUtil.reduceHandleToLeave(updateVo);
}
// 审核或办理,更新离职待办
// isSuccess 0:失败;1:成功
private void sendLeaveById(String id, String doStatus, String isSuccess, String failRemark, YifuUser user) {
BaseServiceParamListVO updateVo = new BaseServiceParamListVO();
List<String> idList = new ArrayList<>();
idList.add(id);
updateVo.setListParam(idList);
updateVo.setDoType(CommonConstants.THREE_STRING);
updateVo.setDoStatus(doStatus);
updateVo.setIsSuccess(isSuccess);
if (Common.isNotNull(isSuccess) && CommonConstants.ZERO_STRING.equals(isSuccess)) {
updateVo.setRemark(failRemark);
if (user != null && Common.isNotNull(user.getNickname())) {
updateVo.setUserName(user.getNickname());
}
}
cspDaprUtil.reduceHandleToLeave(updateVo);
}
}
......@@ -265,6 +265,11 @@
a.EXPIRE_IGNORE_FLAG = '1' and a.DELETE_FLAG=0 and b.is_leave = '0' and a.IS_OVERDUE = 0
<include refid="tInsuranceAlert_where"/>
<if test="tInsuranceAlert != null">
<if test="tInsuranceAlert.isBefore != null and tInsuranceAlert.isBefore.trim() != ''">
<if test='tInsuranceAlert.isBefore.trim() == "1"'>
AND DATE_FORMAT(now(),'%Y-%m-%d') >= DATE_FORMAT(b.expected_collection_time,'%Y-%m-%d')
</if>
</if>
<if test="tInsuranceAlert.processStatusArray != null and tInsuranceAlert.processStatusArray.length > 0">
AND b.PROCESS_STATUS in
<foreach item="statusStr" index="index" collection="tInsuranceAlert.processStatusArray" open="("
......@@ -288,7 +293,7 @@
<include refid="tInsuranceAlert_where"/>
<if test="tInsuranceAlert != null">
<if test="tInsuranceAlert.isBefore != null and tInsuranceAlert.isBefore.trim() != ''">
<if test="tInsuranceAlert.isBefore.trim() == '1'">
<if test='tInsuranceAlert.isBefore.trim() == "1"'>
AND DATE_FORMAT(now(),'%Y-%m-%d') >= DATE_FORMAT(b.expected_collection_time,'%Y-%m-%d')
</if>
</if>
......@@ -315,6 +320,11 @@
a.EXPIRE_IGNORE_FLAG = '1' and a.DELETE_FLAG=0 and b.is_leave = '0' and a.IS_OVERDUE = 0
<include refid="tInsuranceAlert_where"/>
<if test="tInsuranceAlert != null">
<if test="tInsuranceAlert.isBefore != null and tInsuranceAlert.isBefore.trim() != ''">
<if test='tInsuranceAlert.isBefore.trim() == "1"'>
AND DATE_FORMAT(now(),'%Y-%m-%d') >= DATE_FORMAT(b.expected_collection_time,'%Y-%m-%d')
</if>
</if>
<if test="tInsuranceAlert.processStatusArray != null and tInsuranceAlert.processStatusArray.length > 0">
AND b.PROCESS_STATUS in
<foreach item="statusStr" index="index" collection="tInsuranceAlert.processStatusArray" open="("
......@@ -342,6 +352,11 @@
a.EXPIRE_IGNORE_FLAG = '1' and a.DELETE_FLAG=0 and b.is_leave = '0' and a.IS_OVERDUE = 0
<include refid="tInsuranceAlert_where"/>
<if test="tInsuranceAlert != null">
<if test="tInsuranceAlert.isBefore != null and tInsuranceAlert.isBefore.trim() != ''">
<if test='tInsuranceAlert.isBefore.trim() == "1"'>
AND DATE_FORMAT(now(),'%Y-%m-%d') >= DATE_FORMAT(b.expected_collection_time,'%Y-%m-%d')
</if>
</if>
<if test="tInsuranceAlert.processStatusArray != null and tInsuranceAlert.processStatusArray.length > 0">
AND b.PROCESS_STATUS in
<foreach item="statusStr" index="index" collection="tInsuranceAlert.processStatusArray" open="("
......
......@@ -33,8 +33,11 @@ import java.util.List;
@Data
public class TDispatchReduceListVo implements Serializable {
private YifuUser newUser;
private static final long serialVersionUID = 1L;
List<TDispatchReduceVo> listParam;
private String userId;
private String userName;
private List<TDispatchReduceVo> listParam;
}
......@@ -508,8 +508,8 @@ public class TDispatchInfoController {
@SysLog("离职调用的派减社保或公积金")
@PostMapping("/inner/leaveToReduceSocialAndFund")
@Inner
public R<BaseSearchListVO> leaveToReduceSocialAndFund(@RequestBody TDispatchReduceListVo paramVo) {
return new R<>(tDispatchInfoService.leaveToReduceSocialAndFund(paramVo));
public BaseSearchListVO leaveToReduceSocialAndFund(@RequestBody TDispatchReduceListVo paramVo) {
return tDispatchInfoService.leaveToReduceSocialAndFund(paramVo);
}
/**
......
......@@ -53,11 +53,9 @@ import com.yifu.cloud.plus.v1.yifu.common.core.redis.RedisDistributedLock;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchListVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseServiceParamListVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.CheckDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.config.*;
......@@ -125,6 +123,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private final ArchivesDaprUtil archivesDaprUtil;
private final CspDaprUtils cspDaprUtil;
private final TSocialFundInfoMapper socialFundMapper;
private final SysBaseSetInfoMapper baseSetMapper;
......@@ -3133,6 +3133,19 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return this.judgeAllMessage(errorMessageList);
}
private YifuUser getNewYifuUser(String userId, String userName) {
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
return new YifuUser(userId, 1L, "", userName,
userName, "0", SecurityConstants.BCRYPT + "123456",
"12345678911", true, true, true,
true,
"1", authorities, "1",
null, null,
null, null);
}
// 离职待办调用的批量派减社保、公积金
@Override
public BaseSearchListVO leaveToReduceSocialAndFund(TDispatchReduceListVo paramVo) {
......@@ -3153,8 +3166,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
rowLeaveMap.put(i, leaveId);
}
cachedDataList.add(vo);
if (cachedDataList.size() >= batchCount) {
batchReduceDispatch(cachedDataList, errorMessageList, paramVo.getNewUser(), null, null);
if (cachedDataList.size() >= batchCount || i==excelVOList.size()) {
batchReduceDispatch(cachedDataList, errorMessageList, getNewYifuUser(paramVo.getUserId(), paramVo.getUserName()), null, null);
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(batchCount);
}
......@@ -3814,6 +3827,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 各个明细项的可派减项为待办理
initReduceStatus(sf, socialInfo);
}
// 派减审核或办理,更新离职待办
this.sendLeave(dis.getId(), CommonConstants.ONE_STRING, CommonConstants.FIVE_STRING, CommonConstants.ONE_STRING, auditRemark, user);
//派减审核不通过 需要处理预估数据
} else if (CommonConstants.ONE_INT == flag) {
// 作废更新:社保状态、同步预估数据 8 审核不通过直接作废
......@@ -3830,6 +3846,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
sf.setSocialStatus(CommonConstants.THREE_STRING);
}
sf.setSocialReduceDate(null);
// 派减审核或办理,更新离职待办
this.sendLeave(dis.getId(), CommonConstants.ONE_STRING, CommonConstants.TEN_STRING, CommonConstants.ZERO_STRING, auditRemark, user);
}
}
//自动化处理,如果未配置还是人工处理
......@@ -3911,6 +3930,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatchInfoPre.setErrorBackInfo(null);
dispatchInfoPreMapper.updateById(dispatchInfoPre);
}
// 派减审核或办理,更新离职待办
this.sendLeave(dis.getId(), CommonConstants.TWO_STRING, CommonConstants.FIVE_STRING, CommonConstants.ONE_STRING, auditRemark, user);
// 审核不通过
} else if (CommonConstants.ONE_INT == flag) {
// 作废更新:公积金状态、同步档案的公积金状态、同步预估数据
......@@ -3934,6 +3955,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
sendDisFalureMessageToWx(dispatchInfoPre,socialAutoLog.getId());
}
// 派减审核或办理,更新离职待办
this.sendLeave(dis.getId(), CommonConstants.TWO_STRING, CommonConstants.TEN_STRING, CommonConstants.ZERO_STRING, auditRemark, user);
}
providentFund.setAuditTime(now);
providentFund.setAuditUser(user.getId());
......@@ -4705,6 +4728,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
temp.append(DispatchConstants.DISPATCH_HANDLE_SUCCESS);
temp.append(ServiceUtil.ifNullToEmpty(handleRemark));
initAuditInfo(auditInfo, temp.toString(), CommonConstants.THREE_STRING, user, temp.toString(), remark);
// 派减审核或办理,更新离职待办
if (Common.isNotNull(socialInfo.getHandleStatus()) && CommonConstants.SEVEN_STRING.equals(socialInfo.getHandleStatus())) {
// 部分失败是0
this.sendLeave(dis.getId(), CommonConstants.ONE_STRING, CommonConstants.SIX_STRING, CommonConstants.ZERO_STRING, handleRemark, user);
} else {
this.sendLeave(dis.getId(), CommonConstants.ONE_STRING, CommonConstants.EIGHT_STRING, CommonConstants.ONE_STRING, handleRemark, user);
}
} else {
temp.setLength(CommonConstants.ZERO_INT);
temp.append(DispatchConstants.DISPATCH_SOCIAL_REDUCE);
......@@ -4712,8 +4743,19 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
temp.append(DispatchConstants.DISPATCH_HANDLE_FAIL);
temp.append(ServiceUtil.ifNullToEmpty(handleRemark));
initAuditInfo(auditInfo, temp.toString(), CommonConstants.FOUR_STRING, user, temp.toString(), remark);
// 派减审核或办理,更新离职待办
// 7 派减部分办理失败
if (Common.isNotNull(socialInfo.getHandleStatus()) && CommonConstants.SEVEN_STRING.equals(socialInfo.getHandleStatus())) {
this.sendLeave(dis.getId(), CommonConstants.ONE_STRING, CommonConstants.SIX_STRING, CommonConstants.ZERO_STRING, handleRemark, user);
} else {
this.sendLeave(dis.getId(), CommonConstants.ONE_STRING, CommonConstants.NINE_STRING, CommonConstants.ZERO_STRING, handleRemark, user);
}
}
auditInfo.setSocialId(dis.getId());
} else {
errorList.add(new ErrorMessage(-1, "找不到对应员工社保数据:" + dis.getEmpName()));
return true;
......@@ -4750,9 +4792,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (CommonConstants.ZERO_INT == flag) {
initAuditInfo(auditInfo, (DispatchConstants.DISPATCH_FUND_REDUCE_SUCCESS + handleRemark), CommonConstants.SIX_STRING, user, (DispatchConstants.DISPATCH_FUND_REDUCE_SUCCESS + handleRemark), remark);
dis.setFundHandleStatus(CommonConstants.ONE_STRING);
// 派减审核或办理,更新离职待办
this.sendLeave(dis.getId(), CommonConstants.TWO_STRING, CommonConstants.EIGHT_STRING, CommonConstants.ONE_STRING, handleRemark, user);
} else {
initAuditInfo(auditInfo, (DispatchConstants.DISPATCH_FUND_REDUCE_FAIL + handleRemark), CommonConstants.FOUR_STRING, user, (DispatchConstants.DISPATCH_FUND_REDUCE_SUCCESS + handleRemark), remark);
dis.setFundHandleStatus(CommonConstants.TWO_STRING);
this.sendLeave(dis.getId(), CommonConstants.TWO_STRING, CommonConstants.NINE_STRING, CommonConstants.ZERO_STRING, handleRemark, user);
}
auditInfo.setProvidentId(dis.getId());
} else {
......@@ -4923,6 +4970,28 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return false;
}
// 审核或办理,更新离职待办
// isSuccess 0:失败;1:成功
private void sendLeave(String id, String doType, String doStatus, String isSuccess, String failRemark, YifuUser user) {
BaseServiceParamListVO updateVo = new BaseServiceParamListVO();
List<String> idList = new ArrayList<>();
idList.add(id);
updateVo.setListParam(idList);
updateVo.setDoType(doType);
updateVo.setDoStatus(doStatus);
updateVo.setIsSuccess(isSuccess);
if (Common.isNotNull(isSuccess) && CommonConstants.ZERO_STRING.equals(isSuccess)) {
updateVo.setRemark(failRemark);
if (user != null && Common.isNotNull(user.getNickname())) {
updateVo.setUserName(user.getNickname());
}
}
cspDaprUtil.reduceHandleToLeave(updateVo);
}
/**
* @param dis
* @Description: 获取办理/审核时,要变更的预估库的种类
......@@ -7065,6 +7134,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
**/
@Override
public boolean haveRole(YifuUser user, long roleId) {
if (user.getClientRoleMap() == null) {
return false;
}
List<Long> roleList = user.getClientRoleMap().get(ClientNameConstants.CLIENT_MVP);
for (Long role : roleList) {
if (role == roleId) {
......
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