Commit 351d13cd authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent ac2bf347
......@@ -25,6 +25,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
/**
......@@ -50,30 +52,40 @@ public class TEmployeeProject extends BaseEntity {
* 人员档案主表id
*/
@Schema(description ="人员档案主表id")
@NotNull(message = "人员档案主表id不能为空")
@Size(max = 32, message = "人员档案主表id不可超过32位")
private String empId;
/**
* 员工主码(系统自动生成:ZM+年月日+5位数字)
*/
@Schema(description ="员工主码(系统自动生成:ZM+年月日+5位数字)")
@NotNull(message = "员工主码不能为空")
@Size(max = 16, message = "员工主码不可超过16位")
private String empCode;
/**
* 员工类型(字典值,0外包1派遣2代理)
*/
@Schema(description ="员工类型(字典值,0外包1派遣2代理)")
@NotNull(message = "员工类型不能为空")
@Size(max = 1, message = "员工类型不可超过1位")
private String empNatrue;
/**
* 员工姓名
*/
@Schema(description ="员工姓名")
@NotNull(message = "员工姓名不能为空")
@Size(max = 20, message = "员工姓名不可超过20位")
private String empName;
/**
* 身份证号码
*/
@Schema(description ="身份证号码")
@NotNull(message = "身份证号码不能为空")
@Size(max = 20, message = "身份证号码不可超过20位")
private String empIdcard;
/**
......@@ -128,6 +140,8 @@ public class TEmployeeProject extends BaseEntity {
* 员工编码
*/
@Schema(description ="员工编码")
@NotNull(message = "员工编码不能为空")
@Size(max = 20, message = "员工编码不可超过20位")
private String empNo;
/**
......@@ -188,6 +202,8 @@ public class TEmployeeProject extends BaseEntity {
* 合同类型(字典值)
*/
@Schema(description ="合同类型(字典值)")
@NotNull(message = "合同类型不能为空")
@Size(max = 1, message = "合同类型不可超过1位")
private String contractType;
/**
......
......@@ -20,9 +20,9 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;
......@@ -42,7 +42,7 @@ public class EmployeeProjectVO implements Serializable {
* 员工类型(字典值,0外包1派遣2代理)
*/
@NotNull(message = "员工类型不能为空")
@Max(value = 1,message = "员工类型不可超过1位")
@Size(max = 1, message = "员工类型不可超过1位")
@ExcelProperty(value ="员工类型")
private String empNatrue;
......@@ -50,7 +50,7 @@ public class EmployeeProjectVO implements Serializable {
* 员工姓名
*/
@NotNull(message = "员工姓名不能为空")
@Max(value = 32,message = "员工姓名不可超过32位")
@Size(max = 20,message = "员工姓名不可超过20位")
@ExcelProperty(value ="员工姓名")
private String empName;
......@@ -58,7 +58,7 @@ public class EmployeeProjectVO implements Serializable {
* 身份证号码
*/
@NotNull(message = "身份证号不能为空")
@Max(value = 32,message = "身份证号不可超过32位")
@Size(max = 20,message = "身份证号不可超过20位")
@ExcelProperty(value ="身份证号")
private String empIdcard;
......
......@@ -19,15 +19,23 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
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.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCustomerInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
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.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
......@@ -37,7 +45,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -54,6 +65,12 @@ public class TEmployeeProjectController {
private final TEmployeeProjectService tEmployeeProjectService;
private final TSettleDomainService tSettleDomainService;
private final TEmployeeInfoMapper tEmployeeInfoMapper;
private final TCustomerInfoMapper tCustomerInfoMapper;
/**
* @param empId 人员档案id
* @Description: 根据人员档案id获取项目list
......@@ -75,7 +92,6 @@ public class TEmployeeProjectController {
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page" )
// @PreAuthorize("@pms.hasPermission('archives_temployeeproject_get')" )
public R<IPage<TEmployeeProject>> getTEmployeeProjectPage(Page page, TEmployeeProject tEmployeeProject) {
return R.ok(tEmployeeProjectService.getTEmployeeProjectInfoPage(page,tEmployeeProject));
}
......@@ -102,7 +118,7 @@ public class TEmployeeProjectController {
@SysLog("新增项目档案表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('archives_temployeeproject_add')" )
public R save(@RequestBody TEmployeeProject tEmployeeProject) {
public R save(@Valid @RequestBody TEmployeeProject tEmployeeProject) {
return R.ok(tEmployeeProjectService.save(tEmployeeProject));
}
......@@ -143,7 +159,7 @@ public class TEmployeeProjectController {
@SysLog("新增项目档案校验" )
@PostMapping("/check")
@PreAuthorize("@pms.hasPermission('archives_temployeeproject_addcheck')" )
public R addCheck(@RequestBody TEmployeeProject tEmployeeProject) {
public R addCheck(@Valid @RequestBody TEmployeeProject tEmployeeProject) {
return R.ok(tEmployeeProjectService.addCheck(tEmployeeProject));
}
......@@ -237,4 +253,34 @@ public class TEmployeeProjectController {
tEmployeeProjectService.listExportProject(projectDTO,idstr,exportFields);
}
/**
* 通过项目编码查询项目信息
* @param empNo
* @return R
*/
@Operation(summary = "通过项目编码查询项目信息", description = "通过项目编码查询项目信息")
@PostMapping("/getItemInfo" )
public R getItemByEmpNo(@RequestParam String empIdcard,@RequestParam String empNo) {
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,empNo));
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,empIdcard));
Map<String,Object> map = new HashMap<>();
String empCode = "";
if (Common.isNotNull(tEmployeeInfo)) {
empCode = tEmployeeInfo.getEmpCode();
}
String customerName = "";
if (Common.isNotNull(tSettleDomain)) {
TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectOne(Wrappers.<TCustomerInfo>query().lambda()
.eq(TCustomerInfo::getId,tSettleDomain.getCustomerId()));
if (Common.isNotNull(tCustomerInfo)) {
customerName = tCustomerInfo.getCustomerName();
}
}
map.put("empCode",empCode);
map.put("itemInfo",tSettleDomain);
map.put("customerName",customerName);
return R.ok(map);
}
}
......@@ -22,12 +22,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
......@@ -108,4 +108,11 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
**/
void listExportProject(EmployeeProjectExportVO projectDTO,String idstr,
List<String> exportFields);
/**
* @param employeeInfo
* @Description: 新增项目档案
* @Author: huyc
* @Date: 2022/6/23 18:06
**/
void saveEmployeeProjectInfo(TEmployeeInfo employeeInfo);
}
......@@ -33,15 +33,15 @@ 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.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
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.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.NoUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult;
......@@ -66,6 +66,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
private final TEmployeeProjectMapper tEmployeeProjectMapper;
// 缓存信息
private final CacheManager cacheManager;
@Override
public R addCheck(TEmployeeProject tEmployeeProject) {
......@@ -116,7 +119,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (CommonConstants.ONE_STRING.equals(tEmployeeInfo.getFileStatus())) {
map.put("employeeId", tEmployeeInfo.getId());
map.put("code","203");
return R.ok(null,"该人员在离职库已存在,是否“恢复档案”");
return R.ok(map,"该人员在离职库已存在,是否“恢复档案”");
}
}
return R.ok();
......@@ -408,14 +411,49 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
str = insTEmployeePro.getDeptNo() + CommonConstants.EMPLOYEE_INIT_NO;
}
insTEmployeePro.setEmpNo(str);
//TODO HUYC 员工编码生成规则
insTEmployeePro.setEmpCode("");
//员工编码生成规则
insTEmployeePro.setEmpCode(this.getCode());
YifuUser user = SecurityUtils.getUser();
insTEmployeePro.setCreateBy(user.getId());
insTEmployeePro.setCreateName(user.getNickname());
proInsList.add(insTEmployeePro);
}
/**
* @param
* @Description: 获取员工主码
* @Author: hgw
* @Date: 2022/6/22 17:52
* @return: java.lang.String
**/
private synchronized String getCode() {
String nowDay = DateUtil.getThisDay();
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CODE);
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (!Common.isEmpty(nowNumObj)) {
nowNums = (Integer) nowNumObj + 1;
}
cache.put(nowDay, nowNums);
return this.getFiveNum(String.valueOf(nowNums));
}
/**
* @param nowNums 数字
* @Description: 获取五位字符型数字
* @Author: hgw
* @Date: 2022/6/21 17:35
* @return: 五位字符型数字
**/
private String getFiveNum(String nowNums) {
if (nowNums.length() >= 5) {
return nowNums.substring(0, 5);
}
String[] zeroArr = {"0", "00", "000", "0000"};
int num = 4 - nowNums.length();
return zeroArr[num] + nowNums;
}
@Override
public R<List<ErrorMessage>> batchRemoveByIds(String ids) {
List<ErrorMessage> errorList = new ArrayList<ErrorMessage>();
......@@ -492,6 +530,32 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
}
/**
* @param employeeInfo
* @Description: 新增项目档案
* @Author: huyc
* @Date: 2022/6/23 18:06
**/
@Override
public void saveEmployeeProjectInfo(TEmployeeInfo employeeInfo) {
TEmployeeProject tEmployeeProject = new TEmployeeProject();
tEmployeeProject.setEmpId(employeeInfo.getId());
tEmployeeProject.setEmpCode(this.getCode());
tEmployeeProject.setEmpNatrue(employeeInfo.getEmpNatrue());
tEmployeeProject.setEmpName(employeeInfo.getEmpName());
tEmployeeProject.setEmpIdcard(employeeInfo.getEmpIdcard());
tEmployeeProject.setPost(employeeInfo.getPost());
String str = "";
String EmpNo = tEmployeeProjectMapper.findEmployeeMaxOnlyNoByDepId(employeeInfo.getDeptNo());
if (!Common.isEmpty(EmpNo)) {
str = NoUtil.productionNo(EmpNo, CommonConstants.EMPLOYEE_INIT_NO_START);
} else {
str = employeeInfo.getDeptNo() + CommonConstants.EMPLOYEE_INIT_NO;
}
tEmployeeProject.setEmpNo(str);
tEmployeeProjectMapper.insert(tEmployeeProject);
}
/**
* 获取导出的项目档案列表
*/
......@@ -543,4 +607,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
project.setDeleteFlag(CommonConstants.STATUS_NORMAL);
return this.list(Wrappers.query(project));
}
}
......@@ -181,7 +181,7 @@
a.DEPT_ID,
a.DEPT_NAME,
a.DEPT_NO,
concat(a.BUSINESS_PRIMARY_TYPE,'-',BUSINESS_SECOND_TYPE,'-',a.BUSINESS_THIRD_TYPE) AS BUSINESS_TYPE,
concat(a.BUSINESS_PRIMARY_TYPE,'/',BUSINESS_SECOND_TYPE,'/',a.BUSINESS_THIRD_TYPE) AS BUSINESS_TYPE,
a.CONTRACT_TYPE,
a.WORKING_HOURS,
a.POST,
......
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