Commit 92e8b945 authored by fangxinjiang's avatar fangxinjiang

批量审核

parent 4b48583b
......@@ -40,6 +40,12 @@ public class YifuUser extends User {
@Getter
private final Long deptId;
/**
* 部门名称
*/
@Getter
private final String deptName;
/**
* 用户名称
*/
......@@ -64,12 +70,13 @@ public class YifuUser extends User {
@Getter
private final String userGroup;
public YifuUser(String id, Long deptId, String username, String nickname,String systemFlag, String password, String phone, boolean enabled,
public YifuUser(String id, Long deptId,String deptName, String username, String nickname,String systemFlag, String password, String phone, boolean enabled,
boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked,String userGroup,
Collection<? extends GrantedAuthority> authorities) {
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
this.id = id;
this.deptId = deptId;
this.deptName = deptName;
this.phone = phone;
this.nickname = nickname;
this.systemFlag = systemFlag;
......
......@@ -23,6 +23,12 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-check-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
......
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
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.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author fxj
* @Date 2022/7/11
* @Description
* @Version 1.0
*/
@Log4j2
@EnableConfigurationProperties(DaprCheckProperties.class)
public class CheckDaprUtil {
@Autowired
private DaprCheckProperties daprCheckProperties;
/**
* @Author fxj
* @Description 身份证&姓名一致性校验
* @Date 21:15 2022/7/18
* @Param
* @return
**/
public R<TCheckIdCard> checkIdCardSingle(TCheckIdCard tCheckIdCard){
R<TCheckIdCard> res = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(),daprCheckProperties.getAppId(),"/tcheckidcard/inner/checkIdCardSingle",JSON.toJSONString(tCheckIdCard), TCheckIdCard.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("校验身份证信息失败!");
}
return res;
}
}
......@@ -69,7 +69,7 @@ public interface YifuUserDetailsService extends UserDetailsService, Ordered {
SysUser user = info.getSysUser();
// 构造security用户
return new YifuUser(user.getUserId(), user.getDeptId(), user.getUsername(),user.getNickname(),user.getSystemFlag(),
return new YifuUser(user.getUserId(), user.getDeptId(),user.getDeptName(), user.getUsername(),user.getNickname(),user.getSystemFlag(),
SecurityConstants.BCRYPT + user.getPassword(), user.getPhone(), true, true,
true, StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL), user.getUserGroup(),authorities);
}
......
package com.yifu.cloud.plus.v1.yifu.social.constants;
public class DispatchConstants {
public static final String UPDATE_SOCIAL_AND_FUND_FAIL = "更新社保或公积金办理状态失败!";
public static final String NO_CONTRACT_INFO = "无合同数据,请补充合同信息后导入(合同名称、合同类型等信息)!";
public static final String ADD_EMP_CONTRACTOR_FAIL = "新增员工合同失败:";
public static final String ADD_EMP_FAIL = "新增员工失败:";
public static final String PARAM_ERROR = "传参有误!";
public static final String DISPATCH_AUDIT_ERROR = "派单审核异常:";
public static final String NO_OPERATOR_DATA = "无数据可操作";
public static final String EMP_CONTRACTOR_SERVER_ERROR = "员工合同新增服务异常!";
public static final String FUND_REDUCE_FAIL= "公积金派减失败:";
public static final String EMP_PHONE_INVALID = "档案手机号无效,请更新档案或模板的手机号码!";
public static final String DISPATCH_PHONE_NOT_EMPTY = "派单手机号不可为空,请更新档案或模板的手机号码!";
/**
* 社保派单
* '缴纳类型(0最低缴纳、1自定义缴纳、2最高缴纳) PAYMENT_TYPE
*/
enum PaymentType {
LATEST("0", "最低"),
SHORT("1", "自定义"),
BATCHADD("2", "最高");
private String code;
private String desc;
PaymentType(String code, String desc) {
this.code = code;
this.desc = desc;
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
}
/**
* 社保
* @Author fxj
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String SOCIAL_INFO= "tSocialInfo";
/**
* 公积金
* @Author fxj
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String PROVIDENT_INFO= "tProvidentFund";
/**
* 员工ID传参有误
* @Author fxj
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String PARAM_EMPLOYEE_ID_EMPTY = "传参有误:员工ID不可为空";
/**
* 无对应员工ID的员工数据
* @Author fxj
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String NO_EMPLOYEE_OF_ID = "无对应员工ID的员工信息";
/**
* 员工、社保、公积金信息
* @Author fxj
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String EMPLOYEE_SOCIAL_FUND_INFO ="员工、社保、公积金信息";
/**
* 派单ID不可为空,多个ID请用逗号分割
* @Author fxj
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String DISPATCH_ID_NOT_EMPTY ="派单ID不可为空,多个ID请用逗号分割!";
/**
* offical
* @Author fxj
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String OFFICE = "offical";
/**
* add
* @Author fxj
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String ADD = "add";
/**
* minus
* @Author fxj
* @Date 2020-10-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String MINUS = "minus";
/**
* 更新缴费库薪资结算状态失败
* @Author fxj
* @Date 2022-01-13
* @param null
* @return
* @see com.yifu.cloud.v1.common.core.constant
**/
public static final String UPDATE_RELATION_FROM_SALARY_FAILED = "更新缴费库薪资结算状态失败,请重新尝试或联系管理人员!";
public static final String UNIT_PENSION_CARDINAL_NOT_NULL= "单位养老基数不能为空!";
public static final String UNIT_MEDICAL_CARDINAL_NOT_NULL= "单位医疗基数不能为空!";
public static final String UNIT_UNEMPLOYMENT_CARDINAL_NOT_NULL= "单位失业基数不能为空!";
public static final String UNIT_INJURY_CARDINAL_NOT_NULL= "单位工伤基数不能为空!";
public static final String UNIT_BIRTH_CARDINAL_NOT_NULL= "单位生育基数不能为空!";
public static final String PERSONAL_PENSION_CARDINAL_NOT_NULL= "个人养老基数不能为空!";
public static final String PERSONAL_MEDICAL_CARDINAL_NOT_NULL= "个人医疗基数不能为空!";
public static final String PERSONAL_UNEMPLOYMENT_CARDINAL_NOT_NULL= "个人失业基数不能为空!";
public static final String UNIT_PENSION_CARDINAL_LIMIT_ERROR= "单位养老基数不可大于上限或小于下限!";
public static final String UNIT_MEDICAL_CARDINAL_LIMIT_ERROR= "单位医疗基数不可大于上限或小于下限!";
public static final String UNIT_UNEMPLOYMENT_CARDINAL_LIMIT_ERROR= "单位失业基数不可大于上限或小于下限!";
public static final String UNIT_INJURY_CARDINAL_LIMIT_ERROR= "单位工伤基数不可大于上限或小于下限!";
public static final String UNIT_BIRTH_CARDINAL_LIMIT_ERROR= "单位生育基数不可大于上限或小于下限!";
public static final String PERSONAL_PENSION_CARDINAL_LIMIT_ERROR= "个人养老基数不可大于上限或小于下限!";
public static final String PERSONAL_MEDICAL_CARDINAL_LIMIT_ERROR= "个人医疗基数不可大于上限或小于下限!";
public static final String PERSONAL_UNEMPLOYMENT_CARDINAL_LIMIT_ERROR= "个人失业基数不可大于上限或小于下限!";
public static final String UNIT_FUND_CARDINAL_LIMIT_ERROR= "公积金基数不可大于上限或小于下限!";
public static final String EMPLOYEE= "员工:";
}
......@@ -388,6 +388,7 @@ public class TDispatchInfo extends BaseEntity {
@Schema(description = "审核意见" )
@ExcelProperty("审核意见" )
private String auditRemark;
/**
* 公积金办理备注
*/
......
......@@ -26,16 +26,16 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.constants.DispatchConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.TDispatchInfo;
import com.yifu.cloud.plus.v1.yifu.social.service.TDispatchInfoService;
import com.yifu.cloud.plus.v1.yifu.social.vo.DispatchDetailVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.http.HttpHeaders;
import lombok.extern.log4j.Log4j2;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -43,13 +43,13 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 派单信息记录表
*
* @author fxj
* @date 2022-07-15 11:38:05
*/
@Log4j2
@RestController
@RequiredArgsConstructor
@RequestMapping("/tdispatchinfo" )
......@@ -230,4 +230,43 @@ public class TDispatchInfoController {
public R<List<ErrorMessage>> importListReduce(@RequestBody MultipartFile file){
return tDispatchInfoService.importReduceDiy(file.getInputStream());
}
/**
* @Author fxj
* @Description 派单申请批量审核
* @Date 16:54 2022/7/25
* @Param
* @return
**/
@Operation(description = "派单申请批量审核,传参派单ID hasPermission('wxhr:tdispatchinfo_addApplyAudit')")
@PostMapping("/addApplyAudit")
@PreAuthorize("@pms.hasPermission('wxhr:tdispatchinfo_addApplyAudit')")
public R<List<ErrorMessage>> addApplyAudit(@RequestParam(name = "ids", required = true) String ids,
@RequestParam(name = "auditStatus", required = true) String auditStatus,
@RequestParam(name = "auditRemark", required = false) String auditRemark) {
YifuUser user = SecurityUtils.getUser();
if (null == user) {
return R.failed(CommonConstants.USER_FAIL);
}
try {
if (!Common.isNotNull(ids)) {
return R.failed(DispatchConstants.DISPATCH_ID_NOT_EMPTY);
}
Integer flag = 1;
if (CommonConstants.ONE_STRING.equals(auditStatus)) {
//审核通过
flag = CommonConstants.ZERO_INT;
} else if (CommonConstants.TWO_STRING.equals(auditStatus)) {
//审核不通过
flag = CommonConstants.ONE_INT;
} else {
return R.failed("派单审核状态参数异常:0待审核 1审核通过 2审核不通过");
}
List<ErrorMessage> errorInfo = tDispatchInfoService.addBatchApplyAudit(Common.initStrToList(ids, CommonConstants.COMMA_STRING), user, flag, auditStatus, null==auditRemark?"":auditRemark);
return R.ok(errorInfo,"派单审核结果:");
} catch (Exception e) {
log.error("派单审核异常:" + e.getMessage());
return R.failed("数据异常,派单审核失败!");
}
}
}
......@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.social.entity.TDispatchInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.DispatchDetailVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoSearchVo;
......@@ -53,4 +54,6 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
R<Boolean> removeByIdDiy(String id);
DispatchDetailVo getSocialAndFundInfoById(String id);
List<ErrorMessage> addBatchApplyAudit(List<String> initStrToList, YifuUser user, Integer flag, String auditStatus, String auditRemark);
}
......@@ -41,6 +41,7 @@ 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.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.constants.DispatchConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.*;
import com.yifu.cloud.plus.v1.yifu.social.service.TDispatchInfoService;
......@@ -61,6 +62,8 @@ import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.*;
import static java.time.format.DateTimeFormatter.ofPattern;
/**
* 派单信息记录表
*
......@@ -82,13 +85,12 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private final TProvidentFundMapper fundMapper;
private final TAuditInfoMapper auditInfoMapper;
/**
* 派单信息记录表简单分页查询
*
* @param tDispatchInfo 派单信息记录表
* @return
*/
@Override
public IPage<TDispatchInfo> getTDispatchInfoPage(Page<TDispatchInfo> page, TDispatchInfo tDispatchInfo) {
......@@ -98,7 +100,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
/**
* 派单信息记录表批量导出
*
* @return
*/
@Override
public void listExport(HttpServletResponse response, TDispatchInfoSearchVo searchVo) {
......@@ -113,7 +114,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, TDispatchInfo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
......@@ -204,8 +204,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TDispatchImportVo> util1 = new ExcelUtil<>(TDispatchImportVo.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
......@@ -344,7 +342,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 新增社保
initSocialAddInfo(socialsMap, empVo, socialSet, excel,socialFundMap);
// 新增公积金
if (initFundAddInfo(errorMessageList, fundsMap, empVo, fundSet, excel,socialFundMap)){
if (initFundAddInfo(errorMessageList, fundsMap, empVo, fundSet, excel)){
excelVOTemp.put(excel.getEmpIdcard(),excel.getEmpIdcard());
continue;
}
......@@ -404,7 +402,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
EmpAddDispatchVo emp = null;
TSocialInfo social = null;
TProvidentFund fund = null;
TSocialFundInfo socialFund = null;
TSocialFundInfo socialFund;
TDispatchInfo dispatch = null;
if (Common.isNotNull(res) && Common.isNotNull(res.getData())){
empAddsMap = res.getData().getEmpAddsMap();
......@@ -806,7 +804,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private boolean initFundAddInfo(List<ErrorMessage> errorMessageList,
Map<String, TProvidentFund> funds,
DispatchEmpVo empVo, SysBaseSetInfo fundSet,
TDispatchImportVo excel, Map<String, TSocialFundInfo> socialFundMap) {
TDispatchImportVo excel) {
TProvidentFund fund;
if (Common.isNotNull(excel.getProvidentHousehold())){
fund = new TProvidentFund();
......@@ -854,8 +852,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
/**
* @Author fxj
* @Description 对比公积金比例,对应上true false
* @author fxj
* @deprecated 对比公积金比例,对应上true false
**/
private boolean checkFundPer(List<SysPayProportion> pays,TDispatchImportVo excel){
if (Common.isNotNull(excel.getProvidentPer()) && Common.isNotNull(pays)){
......@@ -1396,7 +1394,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TDispatchReduceVo> util1 = new ExcelUtil<>(TDispatchReduceVo.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
......@@ -1439,7 +1436,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
batchReduceDispatch(cachedDataList, errorMessageList,user);
batchReduceDispatch(cachedDataList, errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
......@@ -1450,7 +1447,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return R.ok(errorMessageList);
}
private void batchReduceDispatch(List<TDispatchReduceVo> excelVOList, List<ErrorMessage> errorMessageList, YifuUser user) {
private void batchReduceDispatch(List<TDispatchReduceVo> excelVOList, List<ErrorMessage> errorMessageList) {
if (!Common.isNotNull(excelVOList)){
return;
}
......@@ -1463,10 +1460,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
initIdcard(excelVOList, idcards);
// 通过身份证查询社保&公积金&社保公积金查询信息: 身份证维度唯一
Map<String, TSocialFundInfo> socialFundMap = getSocialFundMap(idcards);
//新增派单信息
Map<String,TDispatchInfo> dispatchMap = new HashMap<>();
// 新增社保公积金查询
Map<String,TSocialFundInfo> socialFundAddMap = new HashMap<>();
DispatchEmpVo empVo = null;
TDispatchInfo dispatch;
TDispatchReduceVo excel;
......@@ -1658,4 +1651,187 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
return detailVo;
}
/**
* 初始化派单审核信息
* @Author fxj
* @date 2020-10-27
* @return
**/
private void initAuditInfo(TAuditInfo auditInfo,
String remark,
String handleStatus,
YifuUser user,
String tile){
if (null == auditInfo){
auditInfo = new TAuditInfo();
}
auditInfo.setId(null);
auditInfo.setAuditStatus(handleStatus);
if (Common.isNotNull(remark)){
auditInfo.setAuditRemark(remark);
}
auditInfo.setTitle(tile);
auditInfo.setOrganName(user.getDeptName());
auditInfo.setAuditUser(user.getNickname());
auditInfo.setAuditTime(new Date());
auditInfo.setIsCommision(CommonConstants.ONE_STRING);
}
/**
* @Author fxj
* @Description 派单申请批量审核
* @Date 16:54 2022/7/25
* @Param
* @return
**/
@Override
public List<ErrorMessage> addBatchApplyAudit(List<String> idsList, YifuUser user, Integer flag, String auditStatus, String auditRemark) {
List<ErrorMessage> errorList = new ArrayList<>();
if (!Common.isNotNull(idsList)) {
errorList.add(new ErrorMessage(-1, CommonConstants.PARAM_IS_NOT_ERROR));
return errorList;
}
List<TDispatchInfo> dispatchInfoList = baseMapper.selectList(Wrappers.<TDispatchInfo>query().lambda().in(TDispatchInfo::getId, idsList));
if (Common.isNotNull(dispatchInfoList)) {
try {
TSocialInfo socialInfo = null;
TProvidentFund providentFund = null;
String remark = "";
TAuditInfo auditInfo = null;
R<Boolean> resR = null;
boolean booleanFlag;
TEmployeeInfo employee = null;
boolean repeatFlag = false;
for (TDispatchInfo dispatchInfo : dispatchInfoList) {
remark = "";
employee = new TEmployeeInfo();
//社保状态处理
if (Common.isNotNull(dispatchInfo.getSocialId())) {
remark = "社保";
socialInfo = socialMapper.selectById(dispatchInfo.getSocialId());
if (null == socialInfo && Common.isNotNull(dispatchInfo.getSocialId())) {
errorList.add(new ErrorMessage(-1, "找不到员工社保派单数据:" + dispatchInfo.getEmpName()));
continue;
}
if (null != socialInfo && Common.isNotNull(dispatchInfo.getSocialId())) {
//审核通过
if (CommonConstants.ZERO_INT == flag.intValue() && CommonConstants.dingleDigitStrArray[0].equals(dispatchInfo.getType())) {
socialInfo.setAuditStatus(CommonConstants.ONE_STRING);
//审核不通过
} else if (CommonConstants.ONE_INT == flag.intValue()) {
// 作废更新:社保状态、同步预估数据 8 审核不通过直接作废 TODO
if (CommonConstants.dingleDigitStrArray[0].equals(dispatchInfo.getType())){
socialInfo.setAuditStatus(CommonConstants.TWO_STRING);
}
//派增作废同时删除社保或公积金,派减对应社保公积金状态修改 TODO
initSocialDestroy(dispatchInfo, socialInfo);
}
socialInfo.setAuditTime(new Date());
socialInfo.setAuditUser(user.getId());
socialMapper.updateById(socialInfo);
}
}
//公积金状态处理
if (Common.isNotNull(dispatchInfo.getFundId())) {
if (!"".equals(remark)) {
remark += "、公积金";
} else {
remark += "公积金";
}
providentFund = fundMapper.selectById(dispatchInfo.getFundId());
if (null == providentFund && Common.isNotNull(dispatchInfo.getFundId())) {
errorList.add(new ErrorMessage(-1, "找不到员工公积金派单数据:" + dispatchInfo.getEmpName()));
continue;
}
if (null != providentFund && Common.isNotNull(dispatchInfo.getFundId())) {
// 审核通过
if (CommonConstants.ZERO_INT == flag.intValue()) {
if (CommonConstants.dingleDigitStrArray[0].equals(dispatchInfo.getType())){
providentFund.setAuditStatus(CommonConstants.ONE_STRING);
}
// 审核不通过
} else if (CommonConstants.ONE_INT == flag.intValue()) {
// 作废更新:公积金状态、同步档案的公积金状态、同步预估数据 fxj 20200928 审核不通过直接作废
if (CommonConstants.dingleDigitStrArray[0].equals(dispatchInfo.getType())){
providentFund.setAuditStatus(CommonConstants.TWO_STRING);
}
}
providentFund.setAuditTime(new Date());
providentFund.setAuditUser(user.getId());
fundMapper.updateById(providentFund);
}
}
// 审核不通过 直接作废 要考虑 部分派增的情况
if (CommonConstants.ONE_INT == flag.intValue()) {
dispatchInfo.setDeleteFlag(CommonConstants.ONE_STRING);
}
//派单类型信息拼接
if (CommonConstants.ZERO_STRING.equals(dispatchInfo.getType())) {
remark += "派增";
} else {
remark += "派减";
}
// 派单状态信息拼接
if (CommonConstants.ZERO_INT == flag.intValue()) {
remark += "审核通过:" + auditRemark;
} else {
remark += "审核不通过:" + auditRemark;
}
//记录处理意见到派单 最新的意见会覆盖之前的,详情 到流程中查询
dispatchInfo.setHandleRemark(null == auditRemark ? "" : auditRemark);
dispatchInfo.setAuditRemark(null == auditRemark ? "" : auditRemark);
initAuditInfo(auditInfo, remark, auditStatus, user,remark);
auditInfo.setDispatchInfoId(dispatchInfo.getId());
//更新派单状态
if (CommonConstants.ZERO_INT == flag.intValue()) {
//审核通过
dispatchInfo.setStatus(CommonConstants.TWO_STRING);
auditInfo.setAuditStatus(CommonConstants.TWO_STRING);
} else if (CommonConstants.ONE_INT == flag.intValue()) {
//审核不通过
dispatchInfo.setStatus(CommonConstants.THREE_STRING);
auditInfo.setAuditStatus(CommonConstants.THREE_STRING);
}
//新增审核记录信息
auditInfoMapper.insert(auditInfo);
dispatchInfo.setAuditUser(user.getId());
dispatchInfo.setAuditTime(new Date());
baseMapper.updateById(dispatchInfo);
}
} catch (Exception e) {
log.error(DispatchConstants.DISPATCH_AUDIT_ERROR , e);
errorList.add(new ErrorMessage(-1, DispatchConstants.DISPATCH_AUDIT_ERROR + e.getMessage()));
return errorList;
}
} else {
errorList.add(new ErrorMessage(-1, DispatchConstants.NO_OPERATOR_DATA));
return errorList;
}
return errorList;
}
/**
* 派增作废同时删除社保或公积金,派减对应社保公积金状态修改 TODO 更新社保公积金查询列表
* @Author fxj
* @Date 2020-09-28
* @param dispatchInfo
* @param socialInfo
* @return
**/
private void initSocialDestroy(TDispatchInfo dispatchInfo,
TSocialInfo socialInfo) {
//派减作废 同步处理 社保公积金查询状态
if (CommonConstants.dingleDigitStrArray[1].equals(dispatchInfo.getType())) {
socialInfo.setReduceCan(CommonConstants.dingleDigitStrArray[0]);//改成可派减状态
// 派增-同步预估库数据 TODO
//forecastLibraryService.createForecastSocialOrFund(dispatchInfo.getEmpIdcard(), socialInfo, null);
} else {
socialInfo.setDeleteFlag(CommonConstants.ONE_STRING);
// 派减-同步预估库数据
// 获取社保派减信息-仅含有id、社保减少日期,公积金减少日期 TODO
//forecastLibraryService.reduceForecastSocialOrFund(dispatchInfo.getEmpIdcard(), socialReduceDate, null);
}
}
}
......@@ -20,9 +20,7 @@ public class ServiceUtil {
/**
* @Description: 返回字符串对应的int值
* @Author: hgw
* @Date: 2022/7/18 17:29
* @return: int
**/
public static int convertStringToInt(String num1) {
if (Common.isEmpty(num1) || !Common.isNumber(num1)) {
......
......@@ -97,6 +97,12 @@ public class SysUser extends BaseEntity {
@Schema(description = "用户所属部门id")
private Long deptId;
/**
* 部门名称
*/
@Schema(description = "部门名称")
private String deptName;
/**
* 用户分组
*/
......
......@@ -40,6 +40,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.enums.MenuTypeEnum;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.ldap.entity.PersonVo;
......@@ -96,6 +97,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
BeanUtils.copyProperties(userDto, sysUser);
sysUser.setDelFlag(CommonConstants.STATUS_NORMAL);
sysUser.setPassword(ENCODER.encode(userDto.getPassword()));
initDeptName(sysUser);
baseMapper.insert(sysUser);
userDto.getRole().stream().map(roleId -> {
SysUserRole userRole = new SysUserRole();
......@@ -106,6 +108,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return Boolean.TRUE;
}
private void initDeptName(SysUser sysUser) {
if (Common.isNotNull(sysUser.getDeptId())){
SysDept sysDept = sysDeptMapper.selectById(sysUser.getDeptId());
if (Common.isNotNull(sysDept)) {
sysUser.setDeptName(sysDept.getName());
}
}
}
/**
* 通过查用户的全部信息
* @param sysUser 用户
......@@ -198,6 +209,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
sysUser.setPhone(userDto.getPhone());
sysUser.setUserId(userVO.getUserId());
sysUser.setAvatar(userDto.getAvatar());
sysUser.setDeptId(userDto.getDeptId());
initDeptName(sysUser);
return this.updateById(sysUser);
}
......@@ -214,7 +227,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
SysUser sysUser = new SysUser();
BeanUtils.copyProperties(userDto, sysUser);
sysUser.setUpdateTime(LocalDateTime.now());
initDeptName(sysUser);
/*if (StrUtil.isNotBlank(userDto.getPassword())) {
sysUser.setPassword(ENCODER.encode(userDto.getPassword()));
}*/
......
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