Commit 0c755ff3 authored by fangxinjiang's avatar fangxinjiang

用户信息新增 系统内置标识 0 是 1 否

parent c7cd69d4
package com.yifu.cloud.plus.v1.yifu.archives.vo;
/**
* @Author fxj
* @Date 2022/6/20
* @Description
* @Version 1.0
*/
public class EmpEducationUpdateExcelVo extends EmpEducationExcelVO{
/**
* @Author fxj
* @Description 主键
**/
private String id;
}
......@@ -129,7 +129,7 @@ public class TEmpDisabilityInfoController {
@SysLog("批量新增员工伤残信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('wxhr:tempdisabilityinfo_importListAdd')")
public R<List<ErrorMessage>> batchAddByJsonString(@RequestExcel List<EmpDisabilityExcelVO> excelVOList, BindingResult bindingResult) {
public R<List<ErrorMessage>> importListAdd(@RequestExcel List<EmpDisabilityExcelVO> excelVOList, BindingResult bindingResult) {
return tEmpDisabilityInfoService.importTmpDisability(excelVOList, bindingResult);
}
......
......@@ -25,6 +25,7 @@ import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpEducationService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -147,7 +148,23 @@ public class TEmpEducationController {
@SysLog("批量新增员工学历信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('archives_education_importListAdd')")
public R<List<ErrorMessage>> batchAddByJsonString(@RequestExcel List<EmpEducationExcelVO> excelVOList, BindingResult bindingResult) {
public R<List<ErrorMessage>> importListAdd(@RequestExcel List<EmpEducationExcelVO> excelVOList, BindingResult bindingResult) {
return tEmpEducationService.importEmpEducation(excelVOList, bindingResult);
}
/**
* 批量更新员工学历信息
*
* @param excelVOList
* @return
* @Author fxj
* @Date 2019-08-16
**/
@Operation(description = "批量更新员工学历信息 hasPermission('archives_education_importListUpdate')")
@SysLog("批量更新员工学历信息")
@PostMapping("/importListUpate")
@PreAuthorize("@pms.hasPermission('archives_education_importListUpdate')")
public R<List<ErrorMessage>> importListUpate(@RequestExcel List<EmpEducationUpdateExcelVo> excelVOList, BindingResult bindingResult) {
return tEmpEducationService.importEmpEducationUpdate(excelVOList, bindingResult);
}
}
......@@ -157,7 +157,7 @@ public class TEmpFamilyController {
@SysLog("批量新增员工家庭信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('archives_tempfamily_importListAdd')")
public R<List<ErrorMessage>> batchAddByJsonString(@RequestExcel List<EmpFamilyExcelVO> excelVOList, BindingResult bindingResult) {
public R<List<ErrorMessage>> importListAdd(@RequestExcel List<EmpFamilyExcelVO> excelVOList, BindingResult bindingResult) {
return tEmpFamilyService.importEmpFamilys(excelVOList, bindingResult);
}
}
......@@ -147,7 +147,7 @@ public class TEmpWorkRecordingController {
@SysLog("批量新增员工工作信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('archives_tempworkrecording_importListAdd')")
public R<List<ErrorMessage>> batchAddByJsonString(@RequestExcel List<EmpWorkRecordExcelVO> excelVOList, BindingResult bindingResult) {
public R<List<ErrorMessage>> importListAdd(@RequestExcel List<EmpWorkRecordExcelVO> excelVOList, BindingResult bindingResult) {
return tEmpWorkRecordingService.importEmpWorkRecord(excelVOList, bindingResult);
}
}
......@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
......@@ -39,4 +40,6 @@ public interface TEmpEducationService extends IService<TEmpEducation> {
R<Boolean> updateByIdDiy(TEmpEducation tEmpEducation);
R<Boolean> saveDiy(TEmpEducation tEmpEducation);
R<List<ErrorMessage>> importEmpEducationUpdate(List<EmpEducationUpdateExcelVo> excelVOList, BindingResult bindingResult);
}
......@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpEducationMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpEducationService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
......@@ -159,6 +160,71 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
return R.ok();
}
/**
* @Author fxj
* @Description 批量更新学历
* @Date 16:25 2022/6/20
**/
@Override
public R<List<ErrorMessage>> importEmpEducationUpdate(List<EmpEducationUpdateExcelVo> excelVOList, BindingResult bindingResult) {
// 通用校验获取失败的数据
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
Map<Long,ErrorMessage> errorMsgMap = new HashMap<>();
if (Common.isNotNull(errorMessageList)){
errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(),errorMessage));
}
// 个性化校验逻辑
List<TEmpEducation> list = this.list();
TEmployeeInfo emp;
TEmpEducation exist;
Set<String> errorMsg;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
if (Common.isNotNull(errorMsgMap.get(i+2))){
continue;
}
errorMsg = new HashSet<>();
EmpEducationExcelVO excel = excelVOList.get(i);
emp = employeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(emp)){
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_NOT_EXIST, excel.getEmpIdcard()));
}
if (CommonConstants.ONE_STRING.equals(emp.getFileStatus())){
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_REDUCED, excel.getEmpIdcard()));
}
// 检查添加人员是否已经存在
boolean match = list.stream().anyMatch(info -> excel.getEducationName().equals(info.getEducationName())
&& excel.getEmpIdcard().equals(info.getEmpIdcard()));
if (match) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_EDUCATION_EXISTING, excel.getEmpName()));
}
exist = baseMapper.selectOne(Wrappers.<TEmpEducation>query().lambda()
.eq(TEmpEducation::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmpEducation::getEducationName,excel.getEducationName())
.eq(TEmpEducation::getDeleteFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(exist)){
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_EDUCATION_EXISTING, excel.getEducationName()));
}
// 数据合法情况
if (CollUtil.isEmpty(errorMsg)) {
insertExcelPost(excel,emp);
} else {
// 数据不合法
errorMessageList.add(new ErrorMessage((long) (i + 2), errorMsg));
}
}
if (CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList);
}
return R.ok();
}
private void updateEducationOfEmp(TEmpEducation education) {
if (CommonConstants.ZERO_STRING.equals(education.getHighIdentification())){
EmpEducationUpdateVo updateVo = new EmpEducationUpdateVo();
......
......@@ -52,7 +52,13 @@ public class YifuUser extends User {
@Getter
private final String phone;
public YifuUser(String id, Long deptId, String username, String nickname, String password, String phone, boolean enabled,
/**
* 系统内置标识 0 是 1 否
*/
@Getter
private String systemFlag;
public YifuUser(String id, Long deptId, String username, String nickname,String systemFlag, String password, String phone, boolean enabled,
boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked,
Collection<? extends GrantedAuthority> authorities) {
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
......@@ -60,6 +66,7 @@ public class YifuUser extends User {
this.deptId = deptId;
this.phone = phone;
this.nickname = nickname;
this.systemFlag = systemFlag;
}
}
......@@ -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(),
return new YifuUser(user.getUserId(), user.getDeptId(), user.getUsername(),user.getNickname(),user.getSystemFlag(),
SecurityConstants.BCRYPT + user.getPassword(), user.getPhone(), true, true, true,
StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL), authorities);
}
......
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