Commit 03bf4f27 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/CommonConstants.java
parents c7c5d29a c2d0fe5b
package com.yifu.cloud.plus.v1.yifu.archives.constants;
/**
* @author huyc
* @date 2022年06月21日
* <p>
* 档案服务常量
*/
public class ArchivesConstants {
/**
* 复档
*/
public static final String EMP_CONTENT = "复档";
/**
* 复项
*/
public static final String PROJECT_CONTENT = "复项";
/**
* 复档复项
*/
public static final String EMP_PROJECT_CONTENT = "复档复项";
/**
* 减档减项
*/
public static final String REDUCE_EMP_PROJECT_CONTENT = "减档减项";
}
...@@ -243,36 +243,6 @@ public class TEmployeeProject extends BaseEntity { ...@@ -243,36 +243,6 @@ public class TEmployeeProject extends BaseEntity {
@Schema(description ="是否删除 0否/1是") @Schema(description ="是否删除 0否/1是")
private String deleteFlag; private String deleteFlag;
/**
* 创建人id
*/
@Schema(description ="创建人id")
private String createBy;
/**
* 创建人姓名
*/
@Schema(description ="创建人姓名")
private String createName;
/**
* 创建时间
*/
@Schema(description ="创建时间")
private LocalDateTime createTime;
/**
* 更新人id
*/
@Schema(description ="更新人id")
private String updateBy;
/**
* 更新时间
*/
@Schema(description ="更新时间")
private LocalDateTime updateTime;
/** /**
* 备注 * 备注
*/ */
......
...@@ -86,7 +86,6 @@ public class EmployeeProjectVO implements Serializable { ...@@ -86,7 +86,6 @@ public class EmployeeProjectVO implements Serializable {
/** /**
* 合同类型(字典值) * 合同类型(字典值)
*/ */
@NotNull(message = "合同类型不能为空")
@ExcelProperty(value ="合同类型") @ExcelProperty(value ="合同类型")
private String contractType; private String contractType;
......
...@@ -198,24 +198,40 @@ public class TEmployeeInfoController { ...@@ -198,24 +198,40 @@ public class TEmployeeInfoController {
*/ */
@Operation(summary = "修改人员档案表", description = "修改人员档案表") @Operation(summary = "修改人员档案表", description = "修改人员档案表")
@SysLog("修改人员档案表") @SysLog("修改人员档案表")
@PutMapping @PostMapping("/updateEmployee")
@PreAuthorize("@pms.hasPermission('demo_temployeeinfo_edit')") @PreAuthorize("@pms.hasPermission('temployeeinfo_edit')")
public R<Boolean> updateById(@RequestBody TEmployeeInfo tEmployeeInfo) { public R<Boolean> updateEmployee(@RequestBody TEmployeeInfo tEmployeeInfo) {
return R.ok(tEmployeeInfoService.updateById(tEmployeeInfo)); return tEmployeeInfoService.updateEmployee(tEmployeeInfo);
} }
/** /**
* 通过id删除人员档案表 * @param id
* * @Description: 通过id删除人员档案表
* @param id id * @Author: hgw
* @return R * @Date: 2022/6/21 19:42
*/ * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "通过id删除人员档案表", description = "通过id删除人员档案表") @Operation(summary = "通过id删除人员档案表", description = "通过id删除人员档案表")
@SysLog("通过id删除人员档案表") @SysLog("通过id删除人员档案表")
@DeleteMapping("/{id}") @GetMapping("/deleteEmployee")
@PreAuthorize("@pms.hasPermission('demo_temployeeinfo_del')") @PreAuthorize("@pms.hasPermission('temployeeinfo_del')")
public R<Boolean> removeById(@PathVariable String id) { public R<String> deleteEmployee(@RequestParam String id) {
return R.ok(tEmployeeInfoService.removeById(id)); return tEmployeeInfoService.deleteEmployee(id);
}
/**
* @param id
* @Description: 通过id减档人员档案表
* @Author: hgw
* @Date: 2022/6/21 19:42
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "通过id减档人员档案表", description = "通过id减档人员档案表")
@SysLog("通过id减档人员档案表")
@GetMapping("/minusEmployee")
@PreAuthorize("@pms.hasPermission('temployeeinfo_minus')")
public R<String> minusEmployee(@RequestParam String id) {
return tEmployeeInfoService.minusEmployee(id);
} }
} }
...@@ -62,11 +62,7 @@ public class TEmployeeProjectController { ...@@ -62,11 +62,7 @@ public class TEmployeeProjectController {
@Operation(summary = "根据人员档案id获取项目list", description = "根据人员档案id获取项目list") @Operation(summary = "根据人员档案id获取项目list", description = "根据人员档案id获取项目list")
@GetMapping("/getListByEmpId" ) @GetMapping("/getListByEmpId" )
public R<List<TEmployeeProject>> getListByEmpId(@RequestParam String empId) { public R<List<TEmployeeProject>> getListByEmpId(@RequestParam String empId) {
TEmployeeProject project = new TEmployeeProject(); return R.ok(tEmployeeProjectService.getListByEmpId(empId, CommonConstants.ZERO_INT));
project.setEmpId(empId);
project.setProjectStatus(CommonConstants.ZERO_INT);
project.setDeleteFlag(CommonConstants.STATUS_NORMAL);
return R.ok(tEmployeeProjectService.list(Wrappers.query(project)));
} }
/** /**
...@@ -194,4 +190,19 @@ public class TEmployeeProjectController { ...@@ -194,4 +190,19 @@ public class TEmployeeProjectController {
return tEmployeeProjectService.importListAdd(excelVOList, bindingResult, idAdd); return tEmployeeProjectService.importListAdd(excelVOList, bindingResult, idAdd);
} }
/**
* 批量更新项目档案信息
*
* @param excelVOList
* @return R<List>
* @Author huyc
* @Date 2022-06-21
**/
@Operation(description = "批量更新项目档案信息 hasPermission('archives_project_importListUpdate')")
@SysLog("批量更新项目档案信息")
@PostMapping("/importListUpate")
@PreAuthorize("@pms.hasPermission('archives_project_importListUpdate')")
public R<List<ErrorMessage>> importListUpate(@RequestExcel List<EmployeeProjectVO> excelVOList, BindingResult bindingResult) {
return tEmployeeProjectService.importEmpProjectUpdate(excelVOList, bindingResult);
}
} }
...@@ -41,4 +41,8 @@ public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> { ...@@ -41,4 +41,8 @@ public interface TEmployeeInfoMapper extends BaseMapper<TEmployeeInfo> {
List<TEmployeeInfo> getList(@Param("employeeInfo") TEmployeeInfo employeeInfo); List<TEmployeeInfo> getList(@Param("employeeInfo") TEmployeeInfo employeeInfo);
int updateEducationOfEmp(@Param("education") EmpEducationUpdateVo education); int updateEducationOfEmp(@Param("education") EmpEducationUpdateVo education);
void updateExcelEmployeeInfo(@Param("list") List<TEmployeeInfo> list);
int insertExcelEmployeeInfo(@Param("list") List<TEmployeeInfo> list);
} }
...@@ -18,8 +18,12 @@ ...@@ -18,8 +18,12 @@
package com.yifu.cloud.plus.v1.yifu.archives.mapper; package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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.entity.TEmployeeProject;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 项目档案表 * 项目档案表
...@@ -30,4 +34,17 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -30,4 +34,17 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface TEmployeeProjectMapper extends BaseMapper<TEmployeeProject> { public interface TEmployeeProjectMapper extends BaseMapper<TEmployeeProject> {
void updateExcelEmpProject(@Param("list") List<TEmployeeProject> list);
int insertExcelEmpProject(@Param("list") List<TEmployeeProject> list);
void updateEmpIdById(@Param("list") List<TEmployeeInfo> list);
/**
* 通过部门编码获取最大员工编码
* @param deptNo
* @return
*/
String findEmployeeMaxOnlyNoByDepId(@Param("deptNo") String deptNo);
} }
...@@ -72,6 +72,33 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> { ...@@ -72,6 +72,33 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
**/ **/
R<String> addNewEmployee(TEmployeeInfo employeeInfo); R<String> addNewEmployee(TEmployeeInfo employeeInfo);
/**
* @param employeeInfo
* @Description: 更新档案信息
* @Author: hgw
* @Date: 2022/6/21 19:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
R<Boolean> updateEmployee(TEmployeeInfo employeeInfo);
/**
* @param id
* @Description: 删除
* @Author: hgw
* @Date: 2022/6/21 19:50
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> deleteEmployee(String id);
/**
* @param id
* @Description: 减项
* @Author: hgw
* @Date: 2022/6/21 19:50
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> minusEmployee(String id);
/** /**
* @param employeeInfo 档案信息 * @param employeeInfo 档案信息
* @param fileSource 人员档案来源(4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬) * @param fileSource 人员档案来源(4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)
......
...@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.plugin.excel.vo.ErrorMessage; import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
...@@ -42,4 +43,16 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> { ...@@ -42,4 +43,16 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
R deleteEmpPro(TEmployeeProject tEmployeeProject); R deleteEmpPro(TEmployeeProject tEmployeeProject);
R<List<ErrorMessage>> importListAdd(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, String isAdd); R<List<ErrorMessage>> importListAdd(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, String isAdd);
/**
* @param projectStatus 传0才过滤
* @param empId
* @Description: 根据员工id获取项目list
* @Author: hgw
* @Date: 2022/6/21 19:33
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject>>
**/
List<TEmployeeProject> getListByEmpId(String empId, int projectStatus);
R<List<ErrorMessage>> importEmpProjectUpdate(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult);
} }
...@@ -20,8 +20,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -20,8 +20,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; 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.mapper.TEmployeeInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; 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.CommonConstants;
...@@ -47,6 +49,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -47,6 +49,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 缓存信息 // 缓存信息
private final CacheManager cacheManager; private final CacheManager cacheManager;
private final TEmployeeProjectService tEmployeeProjectService;
@Override @Override
public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) { public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) {
...@@ -91,6 +94,53 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -91,6 +94,53 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return zeroArr[num] + nowNums; return zeroArr[num] + nowNums;
} }
@Override
public R<Boolean> updateEmployee(TEmployeeInfo employeeInfo) {
// TODO-更新学历-房
return R.ok(this.updateById(employeeInfo));
}
@Override
public R<String> deleteEmployee(String id) {
TEmployeeInfo employee = this.getById(id);
if (employee != null) {
if (employee.getStatus() != CommonConstants.ZERO_INT) {
return R.failed("非草稿状态,无法删除!");
}
employee.setDeleteFlag(CommonConstants.STATUS_DEL);
// 获取项目档案,传参1,不过滤项目状态
List<TEmployeeProject> projectList = tEmployeeProjectService.getListByEmpId(id, CommonConstants.ONE_INT);
if (projectList != null && !projectList.isEmpty()) {
for (TEmployeeProject project : projectList) {
project.setDeleteFlag(CommonConstants.STATUS_DEL);
}
tEmployeeProjectService.updateBatchById(projectList);
}
this.updateById(employee);
return R.ok("已删除");
} else {
return R.failed("未找到人员档案信息");
}
}
@Override
public R<String> minusEmployee(String id) {
TEmployeeInfo employee = this.getById(id);
if (employee != null) {
// 获取项目档案,传参0,过滤项目状态
List<TEmployeeProject> projectList = tEmployeeProjectService.getListByEmpId(id, CommonConstants.ZERO_INT);
if (projectList != null && !projectList.isEmpty()) {
return R.failed("还有["+projectList+"]条项目未减项,请先去减项!");
}
employee.setFileStatus(CommonConstants.ONE_INT);
this.updateById(employee);
return R.ok("已减档");
} else {
return R.failed("未找到人员档案信息");
}
}
@Override @Override
//@GlobalTransactional // 分布式事务注解 //@GlobalTransactional // 分布式事务注解
//@Transactional(rollbackFor = Exception) //@Transactional(rollbackFor = Exception)
......
...@@ -22,25 +22,28 @@ import com.alibaba.fastjson.JSONObject; ...@@ -22,25 +22,28 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage; import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpDisabilityInfo; import com.yifu.cloud.plus.v1.yifu.archives.constants.ArchivesConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDisabilityExcelVO; import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes; 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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils; import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.NoUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; 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.security.util.SecurityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 项目档案表 * 项目档案表
...@@ -55,13 +58,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -55,13 +58,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
private TEmployeeLogService tEmployeeLogService; private TEmployeeLogService tEmployeeLogService;
private final String content1 = "复档"; private TEmployeeInfoMapper tEmployeeInfoMapper;
private final String content2 = "复项"; private TEmployeeProjectMapper tEmployeeProjectMapper;
private final String content3 = "复档复项"; private TSettleDomainService tSettleDomainService;
private final String content4 = "减档减项";
@Override @Override
public R addCheck(TEmployeeProject tEmployeeProject) { public R addCheck(TEmployeeProject tEmployeeProject) {
...@@ -124,13 +125,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -124,13 +125,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(empId); TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(empId);
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]); tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]);
tEmployeeInfoService.updateById(tEmployeeInfo); tEmployeeInfoService.updateById(tEmployeeInfo);
addEmpLog(CommonConstants.dingleDigitIntArray[0],empId,"",content1); addEmpLog(CommonConstants.dingleDigitIntArray[0],empId,"", ArchivesConstants.EMP_CONTENT);
} else if (Common.isEmpty(empId) && !Common.isEmpty(empProId)) { } else if (Common.isEmpty(empId) && !Common.isEmpty(empProId)) {
//复项 //复项
TEmployeeProject tEmployeeProject = this.getById(empProId); TEmployeeProject tEmployeeProject = this.getById(empProId);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]); tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]);
this.updateById(tEmployeeProject); this.updateById(tEmployeeProject);
addEmpLog(CommonConstants.dingleDigitIntArray[1],"",empProId,content2); addEmpLog(CommonConstants.dingleDigitIntArray[1],"",empProId,ArchivesConstants.PROJECT_CONTENT);
} else { } else {
//复档复项 //复档复项
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(empId); TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(empId);
...@@ -139,7 +140,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -139,7 +140,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeInfoService.updateById(tEmployeeInfo); tEmployeeInfoService.updateById(tEmployeeInfo);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]); tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]);
this.updateById(tEmployeeProject); this.updateById(tEmployeeProject);
addEmpLog(CommonConstants.dingleDigitIntArray[2],empId,empProId,content3); addEmpLog(CommonConstants.dingleDigitIntArray[2],empId,empProId,ArchivesConstants.EMP_PROJECT_CONTENT);
} }
} else { } else {
return R.failed("传参为空!"); return R.failed("传参为空!");
...@@ -163,7 +164,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -163,7 +164,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} }
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]); tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
this.updateById(tEmployeeProject); this.updateById(tEmployeeProject);
addEmpLog(CommonConstants.dingleDigitIntArray[2],tEmployeeInfo.getId(),tEmployeeProject.getId(),content4); addEmpLog(CommonConstants.dingleDigitIntArray[2],tEmployeeInfo.getId(),tEmployeeProject.getId(),ArchivesConstants.REDUCE_EMP_PROJECT_CONTENT);
return R.ok(); return R.ok();
} }
return R.failed("传参为空!"); return R.failed("传参为空!");
...@@ -199,18 +200,170 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -199,18 +200,170 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
public R<List<ErrorMessage>> importListAdd(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, String idAdd) { public R<List<ErrorMessage>> importListAdd(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, String idAdd) {
// 通用校验获取失败的数据 // 通用校验获取失败的数据
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget(); 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<TEmployeeInfo> insertList = new ArrayList();
List<TEmployeeInfo> updateList = new ArrayList();
List<TEmployeeProject> proInsList = new ArrayList();
List<TEmployeeProject> proupdateList = new ArrayList();
// 执行数据插入操作 组装 PostDto
for (int i = 0; i < excelVOList.size(); i++) {
EmployeeProjectVO excel = excelVOList.get(i);
Set<String> errorMsg = new HashSet<>();
// 已有验证报错直接下一个
if (Common.isNotNull(errorMsgMap.get(i+2))){
continue;
}
//根据身份证获取人员档案
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
//根据身份证和项目编码获取项目档案
TEmployeeProject tEmployeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo, excel.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
//不存在复档或复项的情况
//档案无(在档人员、离职库皆无),项目无
if (Common.isEmpty(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)) {
insertExcelPost(excel, insertList);
insertExcelPro(excel, proInsList);
//档案有(在档人员),项目无
} else if (Common.isNotNull(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)
&& CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo);
insertExcelPro(excel, proInsList);
//档案有(在档人员),项目有(草稿/已审核);
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[0] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo);
updateExcelPro(excel, proupdateList, tEmployeeProject);
}
//存在复档或复项的情况,允许复档复项
if (CommonConstants.ZERO_STRING.equals(idAdd)) {
//档案有(离职库),项目(已减档)
if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo);
updateExcelPro(excel, proupdateList, tEmployeeProject);
//档案有(离职库),项目无;
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject) ) {
updateExcelPost(excel, updateList, tEmployeeInfo);
insertExcelPro(excel, proInsList);
//档案有(在档人员),项目(已减档)
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo);
updateExcelPro(excel, proupdateList, tEmployeeProject);
}
//不允许复档复项
} else {
//档案有(离职库),项目(已减档)
if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_PROJECT_ERROR));
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_EMP_ERROR));
//档案有(在档人员),项目(已减档)
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()){
errorMsg.add(MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_PROJECT_ERROR));
}
}
if (!CollUtil.isEmpty(errorMsg)) {
errorMessageList.add(new ErrorMessage((long) (i + 2), errorMsg));
}
}
try {
if (insertList.size() > CommonConstants.dingleDigitIntArray[0]) {
tEmployeeInfoMapper.insertExcelEmployeeInfo(insertList);
}
if (updateList.size() > CommonConstants.dingleDigitIntArray[0]) {
tEmployeeInfoMapper.updateExcelEmployeeInfo(updateList);
}
if (proInsList.size() > CommonConstants.dingleDigitIntArray[0]) {
tEmployeeProjectMapper.insertExcelEmpProject(proInsList);
List<String> idList = proInsList.stream().map(TEmployeeProject::getEmpIdcard).collect(Collectors.toList());
List<TEmployeeInfo> updList = tEmployeeInfoMapper.selectList(Wrappers.<TEmployeeInfo>query().lambda().in(TEmployeeInfo::getEmpIdcard,idList));
tEmployeeProjectMapper.updateEmpIdById(updList);
}
if (proupdateList.size() > CommonConstants.dingleDigitIntArray[0]) {
tEmployeeProjectMapper.updateExcelEmpProject(proupdateList);
}
} catch (Exception e) {
log.error("数据更新异常",e);
}
if (CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList);
}
return R.ok();
}
/**
* @Author huyc
* @Description 批量更新项目档案信息
* @Date 19:25 2022/6/21
**/
@Override
public R<List<ErrorMessage>> importEmpProjectUpdate(List<EmployeeProjectVO> 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<TEmployeeProject> updateList = new ArrayList<>();
// 个性化校验逻辑 // 个性化校验逻辑
List<TEmployeeProject> list = this.list(); List<TEmployeeProject> list = this.list();
// 执行数据插入操作 组装 PostDto Set<String> errorMsg;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
if (Common.isNotNull(errorMsgMap.get(i + 2))) {
continue;
}
errorMsg = new HashSet<>();
EmployeeProjectVO excel = excelVOList.get(i); EmployeeProjectVO excel = excelVOList.get(i);
Set<String> errorMsg = new HashSet<>();
//根据身份证和项目编码获取项目档案
TEmployeeProject tEmployeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo, excel.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (Common.isEmpty(tEmployeeProject)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_EXIT_ERROR, excel.getEmpName()));
}
// 数据合法情况
if (CollUtil.isEmpty(errorMsg)) {
updateExcelPro(excel,updateList,tEmployeeProject);
} else {
// 数据不合法
errorMessageList.add(new ErrorMessage((long) (i + 2), errorMsg)); errorMessageList.add(new ErrorMessage((long) (i + 2), errorMsg));
} }
}
try {
if (updateList.size() > CommonConstants.dingleDigitIntArray[0]) {
tEmployeeProjectMapper.updateExcelEmpProject(updateList);
}
} catch (Exception e) {
log.error("数据更新异常",e);
}
if (CollUtil.isNotEmpty(errorMessageList)) { if (CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList); return R.failed(errorMessageList);
} }
...@@ -220,9 +373,76 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -220,9 +373,76 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/** /**
* 插入excel Post * 插入excel Post
*/ */
private void insertExcelPost(EmployeeProjectVO excel) { private void insertExcelPost(EmployeeProjectVO excel,List<TEmployeeInfo> insertList) {
TEmployeeProject insert = new TEmployeeProject(); TEmployeeInfo insTEmployeeInfo = new TEmployeeInfo();
BeanUtil.copyProperties(excel, insert); BeanUtil.copyProperties(excel, insTEmployeeInfo);
this.save(insert); insTEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]);
insTEmployeeInfo.setDeleteFlag(CommonConstants.STATUS_NORMAL);
insTEmployeeInfo.setStatus(CommonConstants.dingleDigitIntArray[0]);
//TODO HUYC 员工编码生成规则
insTEmployeeInfo.setEmpCode("");
YifuUser user = SecurityUtils.getUser();
insTEmployeeInfo.setCreateBy(user.getId());
insTEmployeeInfo.setCreateName(user.getNickname());
insertList.add(insTEmployeeInfo);
}
/**
* 插入excel Pro
*/
private void insertExcelPro(EmployeeProjectVO excel,List<TEmployeeProject> proInsList) {
TEmployeeProject insTEmployeePro = new TEmployeeProject();
BeanUtil.copyProperties(excel, insTEmployeePro);
insTEmployeePro.setId(String.valueOf(UUID.randomUUID()).replaceAll("-",""));
insTEmployeePro.setDeleteFlag(CommonConstants.STATUS_NORMAL);
insTEmployeePro.setStatus(CommonConstants.dingleDigitIntArray[0]);
//人员档案主表id先设置成空,后面更新id
insTEmployeePro.setEmpId(CommonConstants.EMPTY_STRING);
String str = "";
String EmpNo = tEmployeeProjectMapper.findEmployeeMaxOnlyNoByDepId(insTEmployeePro.getDeptNo());
if (!Common.isEmpty(EmpNo)) {
str = NoUtil.productionNo(EmpNo, CommonConstants.EMPLOYEE_INIT_NO_START);
} else {
str = insTEmployeePro.getDeptNo() + CommonConstants.EMPLOYEE_INIT_NO;
}
insTEmployeePro.setEmpNo(str);
//TODO HUYC 员工编码生成规则
insTEmployeePro.setEmpCode("");
YifuUser user = SecurityUtils.getUser();
insTEmployeePro.setCreateBy(user.getId());
insTEmployeePro.setCreateName(user.getNickname());
proInsList.add(insTEmployeePro);
}
/**
* 更新人员档案
*/
private void updateExcelPost(EmployeeProjectVO excel,List<TEmployeeInfo> updateList,TEmployeeInfo tEmployeeInfo) {
BeanUtil.copyProperties(excel, tEmployeeInfo);
YifuUser user = SecurityUtils.getUser();
tEmployeeInfo.setUpdateBy(user.getId());
updateList.add(tEmployeeInfo);
}
/**
* 更新项目档案
*/
private void updateExcelPro(EmployeeProjectVO excel,List<TEmployeeProject> proupdateList,TEmployeeProject tEmployeeProject) {
BeanUtil.copyProperties(excel, tEmployeeProject);
YifuUser user = SecurityUtils.getUser();
tEmployeeProject.setUpdateBy(user.getId());
proupdateList.add(tEmployeeProject);
}
@Override
public List<TEmployeeProject> getListByEmpId(String empId, int projectStatus) {
TEmployeeProject project = new TEmployeeProject();
project.setEmpId(empId);
if (projectStatus == 0) {
project.setProjectStatus(CommonConstants.ZERO_INT);
}
project.setDeleteFlag(CommonConstants.STATUS_NORMAL);
return this.list(Wrappers.query(project));
} }
} }
...@@ -173,4 +173,72 @@ ...@@ -173,4 +173,72 @@
order by a.CREATE_TIME desc order by a.CREATE_TIME desc
</select> </select>
<update id="updateExcelEmployeeInfo" parameterType="java.util.List">
update t_employee_info
<trim prefix="set" suffixOverrides=",">
<trim prefix="EMP_NATRUE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empNatrue!=null">
when ID=#{i.id} then #{i.empNatrue}
</if>
</foreach>
</trim>
<trim prefix="EMP_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empName!=null">
when ID=#{i.id} then #{i.empName}
</if>
</foreach>
</trim>
<trim prefix="EMP_IDCARD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empIdcard!=null">
when ID=#{i.id} then #{i.empIdcard}
</if>
</foreach>
</trim>
<trim prefix="FILE_STATUS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then 0
</foreach>
</trim>
<trim prefix="UPDATE_TIME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then now()
</foreach>
</trim>
<trim prefix="UPDATE_BY =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.updateBy!=null">
when ID=#{i.id} then #{i.updateBy}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
ID=#{i.id}
</foreach>
</update>
<insert id="insertExcelEmployeeInfo" parameterType="java.util.List">
insert into t_employee_info
(ID,EMP_NATRUE,EMP_NAME,EMP_IDCARD,STATUS,FILE_STATUS,EMP_CODE,DELETE_FLAG,CREATE_BY,CREATE_NAME,CREATE_TIME)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
REPLACE(UUID(),"-",""),
#{item.empNatrue,jdbcType=VARCHAR},
#{item.empName,jdbcType=VARCHAR},
#{item.empIdcard,jdbcType=VARCHAR},
#{item.status,jdbcType=VARCHAR},
0,
#{item.empCode,jdbcType=VARCHAR},
#{item.deleteFlag,jdbcType=VARCHAR},
#{item.createBy,jdbcType=VARCHAR},
#{item.createName,jdbcType=VARCHAR},
now()
)
</foreach>
</insert>
</mapper> </mapper>
...@@ -45,4 +45,295 @@ ...@@ -45,4 +45,295 @@
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
<result property="remark" column="REMARK"/> <result property="remark" column="REMARK"/>
</resultMap> </resultMap>
<update id="updateExcelEmpProject" parameterType="java.util.List">
update t_employee_project
<trim prefix="set" suffixOverrides=",">
<trim prefix="EMP_NATRUE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empNatrue!=null">
when ID=#{i.id} then #{i.empNatrue}
</if>
</foreach>
</trim>
<trim prefix="EMP_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empName!=null">
when ID=#{i.id} then #{i.empName}
</if>
</foreach>
</trim>
<trim prefix="EMP_IDCARD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empIdcard!=null">
when ID=#{i.id} then #{i.empIdcard}
</if>
</foreach>
</trim>
<trim prefix="PROJECT_STATUS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then 0
</foreach>
</trim>
<trim prefix="UPDATE_TIME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then now()
</foreach>
</trim>
<trim prefix="UPDATE_BY =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.updateBy!=null">
when ID=#{i.id} then #{i.updateBy}
</if>
</foreach>
</trim>
<trim prefix="DEPT_NO =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.deptNo!=null">
when ID=#{i.id} then #{i.deptNo}
</if>
</foreach>
</trim>
<trim prefix="CONTRACT_TYPE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.contractType!=null">
when ID=#{i.id} then #{i.contractType}
</if>
</foreach>
</trim>
<trim prefix="WORKING_HOURS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.workingHours!=null">
when ID=#{i.id} then #{i.workingHours}
</if>
</foreach>
</trim>
<trim prefix="POST =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.post!=null">
when ID=#{i.id} then #{i.post}
</if>
</foreach>
</trim>
<trim prefix="TRY_PERIOD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.tryPeriod!=null">
when ID=#{i.id} then #{i.tryPeriod}
</if>
</foreach>
</trim>
<trim prefix="ENJOIN_DATE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.enjoinDate!=null">
when ID=#{i.id} then #{i.enjoinDate}
</if>
</foreach>
</trim>
<trim prefix="BANK_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankName!=null">
when ID=#{i.id} then #{i.bankName}
</if>
</foreach>
</trim>
<trim prefix="BANK_NO =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankNo!=null">
when ID=#{i.id} then #{i.bankNo}
</if>
</foreach>
</trim>
<trim prefix="BANK_SUB_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankSubName!=null">
when ID=#{i.id} then #{i.bankSubName}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
ID=#{i.id}
</foreach>
</update>
<update id="updateExcelEmpProject" parameterType="java.util.List">
update t_employee_project
<trim prefix="set" suffixOverrides=",">
<trim prefix="EMP_NATRUE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empNatrue!=null">
when ID=#{i.id} then #{i.empNatrue}
</if>
</foreach>
</trim>
<trim prefix="EMP_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empName!=null">
when ID=#{i.id} then #{i.empName}
</if>
</foreach>
</trim>
<trim prefix="EMP_IDCARD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empIdcard!=null">
when ID=#{i.id} then #{i.empIdcard}
</if>
</foreach>
</trim>
<trim prefix="PROJECT_STATUS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then 0
</foreach>
</trim>
<trim prefix="UPDATE_TIME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then now()
</foreach>
</trim>
<trim prefix="UPDATE_BY =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.updateBy!=null">
when ID=#{i.id} then #{i.updateBy}
</if>
</foreach>
</trim>
<trim prefix="DEPT_NO =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.deptNo!=null">
when ID=#{i.id} then #{i.deptNo}
</if>
</foreach>
</trim>
<trim prefix="CONTRACT_TYPE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.contractType!=null">
when ID=#{i.id} then #{i.contractType}
</if>
</foreach>
</trim>
<trim prefix="WORKING_HOURS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.workingHours!=null">
when ID=#{i.id} then #{i.workingHours}
</if>
</foreach>
</trim>
<trim prefix="POST =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.post!=null">
when ID=#{i.id} then #{i.post}
</if>
</foreach>
</trim>
<trim prefix="TRY_PERIOD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.tryPeriod!=null">
when ID=#{i.id} then #{i.tryPeriod}
</if>
</foreach>
</trim>
<trim prefix="ENJOIN_DATE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.enjoinDate!=null">
when ID=#{i.id} then #{i.enjoinDate}
</if>
</foreach>
</trim>
<trim prefix="BANK_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankName!=null">
when ID=#{i.id} then #{i.bankName}
</if>
</foreach>
</trim>
<trim prefix="BANK_NO =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankNo!=null">
when ID=#{i.id} then #{i.bankNo}
</if>
</foreach>
</trim>
<trim prefix="BANK_SUB_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankSubName!=null">
when ID=#{i.id} then #{i.bankSubName}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
ID=#{i.id}
</foreach>
</update>
<insert id="insertExcelEmpProject" parameterType="java.util.List">
insert into t_employee_project
(ID,EMP_ID,EMP_NATRUE,EMP_NAME,EMP_IDCARD,STATUS,PROJECT_STATUS,EMP_CODE,DEPT_NO,CONTRACT_TYPE,POST,EMP_NO,
TRY_PERIOD,ENJOIN_DATE,BANK_NAME,BANK_NO,BANK_SUB_NAME,DELETE_FLAG,CREATE_BY,CREATE_NAME,CREATE_TIME)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id,jdbcType=VARCHAR},
#{item.empId,jdbcType=VARCHAR},
#{item.empNatrue,jdbcType=VARCHAR},
#{item.empName,jdbcType=VARCHAR},
#{item.empIdcard,jdbcType=VARCHAR},
#{item.status,jdbcType=VARCHAR},
0,
#{item.empCode,jdbcType=VARCHAR},
#{item.deptNo,jdbcType=VARCHAR},
#{item.contractType,jdbcType=VARCHAR},
#{item.post,jdbcType=VARCHAR},
#{item.empNo,jdbcType=VARCHAR},
#{item.tryPeriod,jdbcType=VARCHAR},
#{item.enjoinDate,jdbcType=DATE},
#{item.bankName,jdbcType=VARCHAR},
#{item.bankNo,jdbcType=VARCHAR},
#{item.bankSubName,jdbcType=VARCHAR},
#{item.deleteFlag,jdbcType=VARCHAR},
#{item.createBy,jdbcType=VARCHAR},
#{item.createName,jdbcType=VARCHAR},
now()
)
</foreach>
</insert>
<!--查询部门编码和最大员工数-->
<select id="findEmployeeMaxOnlyNoByDepId" resultMap="EmployeeNoResultMap">
SELECT
(
SELECT
MAX(EMP_NO)
FROM
t_employee_project
WHERE
DELETE_FLAG = 0
and id not like '%abc'
and
EMP_NO LIKE CONCAT(
(
SELECT
DEPART_NO
FROM
t_settle_domain
WHERE
DEPT_NO = #{deptNo}
),
'%'
)
) AS 'empNo'
FROM
DUAL
</select>
<update id="updateEmpIdById" parameterType="java.util.List">
update t_employee_project
SET EMP_ID = #{i.id}
where
<foreach collection="list" separator="or" item="i" index="index" >
EMP_IDCARD=#{i.empIdcard} AND DEPT_NO =#{i.deptNo}
</foreach>
</update>
</mapper> </mapper>
...@@ -198,5 +198,21 @@ public interface CommonConstants { ...@@ -198,5 +198,21 @@ public interface CommonConstants {
//int 4 //int 4
int FOUR_INT = 4; int FOUR_INT = 4;
String TEN_STRING = "10"; String TEN_STRING = "10";
/**
* 员工初始序列
* @Author pwang
* @Date 2020-05-14 11:13
* @param null
* @return
**/
public static final String EMPLOYEE_INIT_NO = "0001";
/**
* 员工的的前缀位数
* @Author pwang
* @Date 2020-05-14 14:10
**/
public static final int EMPLOYEE_INIT_NO_START = 7;
String SAVE_FAILED = "保存失败!"; String SAVE_FAILED = "保存失败!";
} }
...@@ -205,4 +205,20 @@ public interface ErrorCodes { ...@@ -205,4 +205,20 @@ public interface ErrorCodes {
* 银行卡号校验传参有误:姓名、身份证号、银行卡号 必填 * 银行卡号校验传参有误:姓名、身份证号、银行卡号 必填
*/ */
String CHECKS_BANK_NO_REQUEST_PARAM_ERROR = "checks.bank.no.request.param.error"; String CHECKS_BANK_NO_REQUEST_PARAM_ERROR = "checks.bank.no.request.param.error";
/**
* 存在已减档的档案和已减项的项目,禁止导入
*/
String CHECKS_EMP_PROJECT_ERROR = "checks.emp.project.error";
/**
* 存在已减档的档案,禁止导入
*/
String CHECKS_REDUCE_EMP_ERROR = "checks.reduce.emp.error";
/**
* 存在已减项的项目,禁止导入
*/
String CHECKS_REDUCE_PROJECT_ERROR = "checks.reduce.project.error";
/**
* 人员不在该项目,无法更新
*/
String CHECKS_EMP_EXIT_ERROR = "checks.emp.exit.error";
} }
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
/**
* @program: master
* @description: 序号生成工具
* @description: 例如三位数的全部序号如下 000~999、A01~A99 ……Z01~Z99,ZA1~ZA9……ZZ1~ZZ9,ZZA~ZZZ
* @author: pwang
* @create: 2020-05-12 09:55
**/
@Slf4j
public class NoUtil {
private static char[] alphatableb = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z'};
/**
* 数字加一规则
*
* @Author pwang
* @Date 2020-05-12 14:29
* @param null
* @return
**/
private static Map<String, String> numberMap = new HashMap() {
{
put("0", "1");
put("1", "2");
put("2", "3");
put("3", "4");
put("4", "5");
put("5", "6");
put("6", "7");
put("7", "8");
put("8", "9");
}
};
/**
* 字符加一规则
*
* @Author pwang
* @Date 2020-05-12 14:28
* @param null
* @return
**/
private static Map<String, String> charMap = new HashMap() {
{
put("A", "B");
put("B", "C");
put("C", "D");
put("D", "E");
put("E", "F");
put("F", "G");
put("G", "H");
put("H", "I");
put("I", "J");
put("J", "K");
put("K", "L");
put("L", "M");
put("M", "N");
put("N", "O");
put("O", "P");
put("P", "Q");
put("Q", "R");
put("R", "S");
put("S", "T");
put("T", "U");
put("U", "V");
put("V", "W");
put("W", "X");
put("X", "Y");
put("Y", "Z");
}
};
/**
* @param args
*/
public static void main(String[] args) {
//打印所有流水号
String initStr = "皖A0000";
int maxIntStr = 9999;
String maxStr = "ZZZZ";
NoUtil noUtil = new NoUtil();
long d3 = System.currentTimeMillis();
long i = 0L;
while (!initStr.equals("皖AZZZZ")) {
i++;
initStr = NoUtil.productionNo(initStr,2);
/*log.info(initStr);*/
// 测试断点
if (initStr.equals("皖AZZZZ")) {
break;
}
}
long d4 = System.currentTimeMillis();
long d1 = System.currentTimeMillis();
//重新初始化
long j = 0L;
initStr = "0000";
while (!initStr.equals(maxStr)) {
j++;
initStr = noUtil.algorithm4Code(5, initStr, maxIntStr, maxStr);;
/*log.info(initStr);*/
// 测试断点
if (initStr.equals(maxStr)) {
break;
}
}
long d2 = System.currentTimeMillis();
log.info("2位最大编码数:" + numberCount(2));
log.info("3位最大编码数:" + numberCount(3));
log.info("原方法耗时:" + (d2 - d1));
log.info("原方法编码数:" + String.valueOf(j));
log.info("新方法耗时:" + (d4 - d3));
log.info("新方法编码数:" + String.valueOf(i));
}
/**
* 生成编码算法
*
* @param digit 位数
* @param currentStr 当前流水号
* @param maxIntStr 最大流水号(数字部分)
* @param maxStr 最大流水号
* @return
*/
public String algorithm4Code(int digit, String currentStr, int maxIntStr, String maxStr) {
//流水序号,默认4位
String formatStr1 = "00000";
int maxNum = maxIntStr;
StringBuffer tmpBuff = new StringBuffer();
StringBuffer tmpBuff1 = new StringBuffer();
for (int i = 1; i < digit; i++) {
tmpBuff.append(0);
tmpBuff1.append(9);
}
formatStr1 = tmpBuff.toString() + "0";
maxNum = Integer.parseInt(tmpBuff1.append(9).toString());
String initStr = "";
if (currentStr == null) {
initStr = maxNum + "";
} else {
initStr = currentStr;
}
//找出字符串最后一位字母
int sign = 0;
boolean isfind = false;
for (int i = initStr.length() - 1; i >= 0; i--) {
if (initStr.charAt(i) >= 'A' && initStr.charAt(i) <= 'Z') {
sign = i;
isfind = true;
break;
}
}
//分隔字母和数字
String letterStr = "";
String numStr = "";
if (isfind) {
letterStr = initStr.substring(0, sign + 1);
numStr = initStr.substring(sign + 1);
} else {
numStr = initStr;
}
//如果数字部分不全为9,则直接加一,返回
boolean isAllNine = false;
for (int i = 0; i < numStr.length(); i++) {
if (numStr.charAt(i) == '9') {
isAllNine = true;
} else {
isAllNine = false;
break;
}
}
if (!isAllNine && !"".equals(numStr)) {
int nextNum = Integer.parseInt(numStr) + 1;
return letterStr + supplementNumPrefix(nextNum, numStr.length());
} else {
//数字部分全为9或者数字部分为空,需要分情况分析
String nextNum = "";
if ("".equals(letterStr) && !numStr.equals(String.valueOf(maxIntStr))) {
//字母部分为空
String nineStr = numStr.substring(1);
// nextNum = "A"+restNumberFunc(nineStr);
nextNum = restNumberFunc(nineStr);
} else if (numStr.equals(String.valueOf(maxIntStr))) {
String nineStr = numStr.substring(1);
nextNum = "A" + restNumberFunc(nineStr);
} else {
//字母部分不为空
//判断字母部分的最后一位字母是否有下一位,比如A,则有下一位B,Z则没有。
char lastLetter = letterStr.charAt(letterStr.length() - 1);
int pos = -1;
//顺序查找
for (int i = 0; i < alphatableb.length; i++) {
if (alphatableb[i] == lastLetter) {
pos = i;
break;
}
}
if (pos == -1) {
System.out.println("查找字母出错");
return "error";
}
if ('Z' == alphatableb[pos]) {
//最后一位字母为'Z'
if (!"".equals(numStr)) {
//Z9999
nextNum = letterStr.substring(0, letterStr.length())
+ 'A' + restNumberFunc(numStr.substring(1));
} else {
//ZZZZZ
System.out.println("商户序号已达到最大值,请联系管理员");
return "error";
}
} else {
//最后一位字母不为'Z'
if (!"".equals(numStr)) {
//ZA99
nextNum = letterStr.substring(0, letterStr.length() - 1)
+ alphatableb[pos + 1] + restNumberFunc(numStr);
} else {
//ZZZA
nextNum = letterStr.substring(0, letterStr.length() - 1)
+ alphatableb[pos + 1];
}
}
}
return nextNum;
}
}
/**
* 补充数字前缀
*
* @param nextNum
* @param numLen
* @return
*/
private String supplementNumPrefix(int nextNum, int numLen) {
StringBuffer tmpBuff = new StringBuffer();
for (int i = 0; i < numLen; i++) {
tmpBuff.append(0);
}
DecimalFormat format = new DecimalFormat(tmpBuff.toString());
return format.format(nextNum);
}
/**
* 数据重置函数
*
* @param nineStr
* @return
*/
public String restNumberFunc(String nineStr) {
if ("".equals(nineStr)) return nineStr;
String zeroStr = nineStr.replace('9', '0');
DecimalFormat format = new DecimalFormat(zeroStr);
int firstNum = Integer.parseInt(zeroStr) + 1;
return format.format(firstNum);
}
/**
* 最大序号数量
*
* @param digit 位数
* @return
* @Author pwang
* @Date 2020-05-11 18:17
**/
public static double numberCount(int digit) {
//计算规律 (10^digit-1) + (26*(10^(digit-1)-1)+……+26*(10-1))+ 26
double maxIntStr = Math.pow(10, digit) - 1;
double reuslt = maxIntStr;
for (int i = digit - 1; i > 0; i--) {
reuslt += 26 * (Math.pow(10, i) - 1);
}
return reuslt + 26;
}
/**
* 类似35进制找下一个序号
**/
public String nextNoByMapFor35(String currentStr) throws RuntimeException {
char result[] = currentStr.toCharArray();
boolean resultInfo = false;
String temp = null;
for (int i = result.length - 1; i >= 0; i--) {
if ('Z' != result[i]) {
temp = charMap.get(String.valueOf(result[i]));
Assert.notNull(temp, currentStr.concat("含有非法字符!"));
result[i] = temp.charAt(0);
resultInfo = true;
break;
} else {
temp = charMap.get(String.valueOf(result[i]));
Assert.notNull(temp, currentStr.concat("含有非法字符!"));
result[i] = temp.charAt(0);
}
}
Assert.isTrue(resultInfo, "序号已达到最大值,请联系管理员");
return String.valueOf(result);
}
/**
* 找下一个序号
**/
public static String nextNoByMap(String currentStr) throws RuntimeException {
Assert.isTrue(null != currentStr,"当前串不能为空!");
char result[] = currentStr.toUpperCase().toCharArray();
String temp = null;
for (int i = result.length - 1; i >= 0; i--) {
if ('Z' != result[i]) {
if ('9' == result[i]) {
//进位处理
if (0 == i || 'Z' == result[i - 1]) {
//计算到最高位为9或者下高位是Z本为进位成A
result[i] = 'A';
if (result.length - 1 != i) {
//若本位不是最低位则最低置1
result[result.length - 1] = '1';
}
break;
} else {
result[i] = '0';
}
} else {
temp = numberMap.get(String.valueOf(result[i]));
if (null == temp) {
//查看是不是字符加一
temp = charMap.get(String.valueOf(result[i]));
//字符加一也找不到抛出异常
Assert.isTrue(null != temp, currentStr.concat("含有非法字符!"));
if (result.length - 1 != i) {
//字符加一,若本位不是最低位则最低置1
result[result.length - 1] = '1';
}
}
result[i] = temp.charAt(0);
break;
}
} else {
Assert.isTrue(i != result.length - 1, "序号已达到最大值,请联系管理员");
}
}
return String.valueOf(result);
}
/**
* 开始到starPos保留 + 从第starPos+1开始截取至结尾生产序号
* @Author pwang
* @Date 2020-05-14 9:53
* @param currentStr 当前串
* @param starPos 从第starPos+1开始有效
* @return
**/
public static String productionNo(String currentStr,int starPos){
Assert.isTrue(null != currentStr,"当前串不能为空!");
Assert.isTrue(starPos<currentStr.length(),"当前串共".concat(String.valueOf(currentStr.length())).concat("位,不能从第").concat(String.valueOf(starPos+1)).concat("位截取!"));
return currentStr.substring(0,starPos).concat(NoUtil.nextNoByMap(currentStr.substring(starPos,currentStr.length())));
}
}
...@@ -54,6 +54,12 @@ checks.mobile.request.error=\u6821\u9A8C\u8BF7\u6C42\u5F02\u5E38 ...@@ -54,6 +54,12 @@ checks.mobile.request.error=\u6821\u9A8C\u8BF7\u6C42\u5F02\u5E38
checks.mobile.request.limit.hundred=\u5355\u6B21\u53F7\u7801\u72B6\u6001\u6821\u9A8C\u8BF7\u6C42\u4E0A\u9650100 checks.mobile.request.limit.hundred=\u5355\u6B21\u53F7\u7801\u72B6\u6001\u6821\u9A8C\u8BF7\u6C42\u4E0A\u9650100
checks.bank.no.request.param.error=\u94F6\u884C\u5361\u53F7\u6821\u9A8C\u4F20\u53C2\u6709\u8BEF\uFF1A\u59D3\u540D\u3001\u8EAB\u4EFD\u8BC1\u53F7\u3001\u94F6\u884C\u5361\u53F7 \u5FC5\u586B checks.bank.no.request.param.error=\u94F6\u884C\u5361\u53F7\u6821\u9A8C\u4F20\u53C2\u6709\u8BEF\uFF1A\u59D3\u540D\u3001\u8EAB\u4EFD\u8BC1\u53F7\u3001\u94F6\u884C\u5361\u53F7 \u5FC5\u586B
checks.emp.project.error=\u5B58\u5728\u5DF2\u51CF\u6863\u7684\u6863\u6848\u548C\u5DF2\u51CF\u9879\u7684\u9879\u76EE\uFF0C\u7981\u6B62\u5BFC\u5165
checks.reduce.emp.error=\u5B58\u5728\u5DF2\u51CF\u6863\u7684\u6863\u6848\uFF0C\u7981\u6B62\u5BFC\u5165
checks.reduce.project.error=\u5B58\u5728\u5DF2\u51CF\u9879\u7684\u9879\u76EE\uFF0C\u7981\u6B62\u5BFC\u5165
checks.emp.exit.error=\u4EBA\u5458\u4E0D\u5728\u8BE5\u9879\u76EE\uFF0C\u65E0\u6CD5\u66F4\u65B0
......
dapr.upms.appUrl=http://yifu-upms.qas-mvp.svc.cluster.local:3500/v1.0/invoke/ dapr.upms.appUrl=http://localhost:3500/v1.0/invoke/
dapr.upms.appId=yifu-upms dapr.upms.appId=yifu-upms
dapr.upms.appPort=4000 dapr.upms.appPort=4000
dapr.upms.httpPort=3500 dapr.upms.httpPort=3500
dapr.upms.grpcPort=52000 dapr.upms.grpcPort=52000
dapr.upms.metricsPort=9094 dapr.upms.metricsPort=9094
...@@ -241,7 +241,7 @@ public class UserController { ...@@ -241,7 +241,7 @@ public class UserController {
* @return R * @return R
*/ */
@SysLog("从ldap中获取用户") @SysLog("从ldap中获取用户")
@PostMapping("inner/updateUser") @PostMapping("/inner/updateUser")
@Inner @Inner
public R innerUpdateByLdap() { public R innerUpdateByLdap() {
return R.ok(userService.updateByLdap()); return R.ok(userService.updateByLdap());
......
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