Commit 340a3375 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent d5b0fb68
...@@ -20,12 +20,15 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -20,12 +20,15 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
...@@ -52,66 +55,79 @@ public class FddContractAttachInfo extends BaseEntity { ...@@ -52,66 +55,79 @@ public class FddContractAttachInfo extends BaseEntity {
* 合同id * 合同id
*/ */
@Schema(description ="合同id") @Schema(description ="合同id")
@ExcelAttribute(name = "合同id", errorInfo = "员工合同id主键不能为空", maxLength = 32)
private String contractId; private String contractId;
/** /**
* 合同试用期开始时间 * 合同试用期开始时间
*/ */
@Schema(description ="合同试用期开始时间") @Schema(description ="合同试用期开始时间")
private Date periodStart; @ExcelAttribute(name = "合同试用期开始时间")
private LocalDate periodStart;
/** /**
* 合同试用期结束时间 * 合同试用期结束时间
*/ */
@Schema(description ="合同试用期结束时间") @Schema(description ="合同试用期结束时间")
private Date periodEnd; @ExcelAttribute(name = "合同试用期结束时间")
private LocalDate periodEnd;
/** /**
* 合同起始时间 * 合同起始时间
*/ */
@Schema(description ="合同起始时间") @Schema(description ="合同起始时间")
private Date contractStart; @ExcelAttribute(name = "合同起始时间", isNotEmpty = true, errorInfo = "合同起始时间不能为空")
private Date contractStart;
/** /**
* 合同到期时间 * 合同到期时间
*/ */
@Schema(description ="合同到期时间") @Schema(description ="合同到期时间")
private Date contractEnd; @ExcelAttribute(name = "合同到期时间",needExport = true)
private Date contractEnd;
/** /**
* 试用期工资 元/月 * 试用期工资 元/月
*/ */
@Schema(description ="试用期工资 元/月") @Schema(description ="试用期工资 元/月")
private BigDecimal periodSalaryPerMonth; @ExcelAttribute(name = "试用期工资")
private BigDecimal periodSalaryPerMonth;
/** /**
* 工资形式 1.计时工资 2.计件工资 3.其他 * 工资形式 1.计时工资 2.计件工资 3.其他
*/ */
@Schema(description ="工资形式 1.计时工资 2.计件工资 3.其他") @Schema(description ="工资形式 1.计时工资 2.计件工资 3.其他")
@ExcelAttribute(name = "工资形式", isDataId = true, dataType = "salary_type")
private String salaryType; private String salaryType;
/** /**
* 计时工资 工资标准 元/月 * 计时工资 工资标准 元/月
*/ */
@Schema(description ="计时工资 工资标准 元/月") @Schema(description ="计时工资 工资标准 元/月")
@ExcelAttribute(name = "计时工资")
private BigDecimal salaryStandardPerHour; private BigDecimal salaryStandardPerHour;
/** /**
* 计件工资 工资标准单价/元 * 计件工资 工资标准单价/元
*/ */
@Schema(description ="计件工资 工资标准单价/元") @Schema(description ="计件工资 工资标准单价/元")
@ExcelAttribute(name = "计件工资")
private BigDecimal salaryStandardPerPiece; private BigDecimal salaryStandardPerPiece;
/** /**
* 工作地点 * 工作地点
*/ */
@Schema(description ="工作地点") @Schema(description ="工作地点")
@Length(max=200,message = "工作地点不能超过200个字符")
@ExcelAttribute(name = "工作地点" , maxLength = 200 )
private String workSpace; private String workSpace;
/** /**
* 岗位 * 岗位
*/ */
@Schema(description ="岗位") @Schema(description ="岗位")
@Length(max = 200, message = "岗位不能超过200个字符")
@ExcelAttribute(name = "岗位", isNotEmpty = true, errorInfo = "岗位不能为空", maxLength = 200, needExport = true)
private String post; private String post;
/** /**
...@@ -142,13 +158,15 @@ public class FddContractAttachInfo extends BaseEntity { ...@@ -142,13 +158,15 @@ public class FddContractAttachInfo extends BaseEntity {
* 员工姓名 * 员工姓名
*/ */
@Schema(description ="员工姓名") @Schema(description ="员工姓名")
@ExcelAttribute(name = "员工姓名", isNotEmpty = true, errorInfo = "员工合同id姓名不能为空", maxLength = 32, needExport = true)
private String empName; private String empName;
/** /**
* 身份证号码 * 身份证号码
*/ */
@Schema(description ="身份证号码") @Schema(description ="身份证号码")
private String empIdcard; @ExcelAttribute(name = "身份证号码", isNotEmpty = true, errorInfo = "身份证号码不能为空", maxLength = 32, needExport = true)
private String empIdcard;
/** /**
* 手机号码 * 手机号码
......
...@@ -139,25 +139,25 @@ public class FddContractAttachInfoController { ...@@ -139,25 +139,25 @@ public class FddContractAttachInfoController {
@PostMapping("/batchAddFddEmpInfo") @PostMapping("/batchAddFddEmpInfo")
public R batchAddFddEmpInfo(@RequestBody String jsonString) { public R batchAddFddEmpInfo(@RequestBody String jsonString) {
R<List<SysDictItem>> res = null; R<Map<String,List<SysDictItem>>> res = null;
ExcelUtil<FddContractAttachInfo> util1 = null; ExcelUtil<FddContractAttachInfo> util1 = null;
try { try {
// 调用字典服务,渲染字典值 // // 调用字典服务,渲染字典值
res = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId() // res = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dict/inner/getDictList", null, Map.class, SecurityConstants.FROM_IN); // , "/dict/inner/getDictList", null, Map.class, SecurityConstants.FROM_IN);
//
Map<String, String> dicMap = new HashMap<>(); // Map<String, String> dicMap = new HashMap<>();
if (null != res.getData()) { // if (null != res.getData().get("data")) {
for (SysDictItem dict : res.getData()) { // for (SysDictItem dict : res.getData().get("data")) {
dicMap.put(dict.getType() + CommonConstants.DOWN_LINE_STRING + dict.getLabel(), dict.getValue()); // dicMap.put(dict.getType() + CommonConstants.DOWN_LINE_STRING + dict.getLabel(), dict.getValue());
} // }
} // }
jsonString = URLDecoder.decode(jsonString, CommonConstants.UTF8).replace("=", ""); jsonString = URLDecoder.decode(jsonString, CommonConstants.UTF8).replace("=", "");
util1 = new ExcelUtil<>(FddContractAttachInfo.class); util1 = new ExcelUtil<>(FddContractAttachInfo.class);
//传参字典数据MAP具体见方法实现 //传参字典数据MAP具体见方法实现
util1.getJsonStringToList(jsonString, dicMap); util1.getJsonStringToList(jsonString, null);
if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) { if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) {
return R.failed(util1.getErrorInfo(),"数据异常"); return R.failed(util1.getErrorInfo(),"数据异常");
} else { } else {
...@@ -172,8 +172,9 @@ public class FddContractAttachInfoController { ...@@ -172,8 +172,9 @@ public class FddContractAttachInfoController {
map.put(errorMessage.getLineNum(),util1.getEntityList().get(errorMessage.getLineNum()-2)); map.put(errorMessage.getLineNum(),util1.getEntityList().get(errorMessage.getLineNum()-2));
} }
variableMap.put("data",map); variableMap.put("data",map);
return R.ok(variableMap);
} }
return R.ok(variableMap); return new R<>(CommonConstants.dingleDigitIntArray[1], "", errorInfo);
} else { } else {
return R.ok(null,"无数据可导入"); return R.ok(null,"无数据可导入");
} }
......
...@@ -71,6 +71,9 @@ import javax.servlet.http.HttpServletResponse; ...@@ -71,6 +71,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -668,17 +671,17 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe ...@@ -668,17 +671,17 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
if (attachInfo.getPeriodStart() == null) { if (attachInfo.getPeriodStart() == null) {
return R.failed("新签试用期开始时间为空"); return R.failed("新签试用期开始时间为空");
} }
paramter.put("fPeriodStartY", DateUtil.format(attachInfo.getPeriodStart(), "yyyy")); paramter.put("fPeriodStartY", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "yyyy"));
paramter.put("fPeriodStartM", DateUtil.format(attachInfo.getPeriodStart(), "MM")); paramter.put("fPeriodStartM", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "MM"));
paramter.put("fPeriodStartD", DateUtil.format(attachInfo.getPeriodStart(), "dd")); paramter.put("fPeriodStartD", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "dd"));
} }
if (Common.isNotNull(companyFieldMap.get("fPeriodEndY"))){ if (Common.isNotNull(companyFieldMap.get("fPeriodEndY"))){
if (attachInfo.getPeriodEnd() == null) { if (attachInfo.getPeriodEnd() == null) {
return R.failed("新签试用期结束时间为空"); return R.failed("新签试用期结束时间为空");
} }
paramter.put("fPeriodEndY", DateUtil.format(attachInfo.getPeriodEnd(), "yyyy")); paramter.put("fPeriodEndY", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "yyyy"));
paramter.put("fPeriodEndM", DateUtil.format(attachInfo.getPeriodEnd(), "MM")); paramter.put("fPeriodEndM", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "MM"));
paramter.put("fPeriodEndD", DateUtil.format(attachInfo.getPeriodEnd(), "dd")); paramter.put("fPeriodEndD", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "dd"));
} }
if (Common.isNotNull(companyFieldMap.get("periodSalaryPerMonth"))){ if (Common.isNotNull(companyFieldMap.get("periodSalaryPerMonth"))){
if (attachInfo.getPeriodSalaryPerMonth() == null) { if (attachInfo.getPeriodSalaryPerMonth() == null) {
...@@ -807,15 +810,15 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe ...@@ -807,15 +810,15 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
if (attachInfo.getPeriodStart() == null) { if (attachInfo.getPeriodStart() == null) {
return R.failed("新签试用期开始时间为空"); return R.failed("新签试用期开始时间为空");
} }
paramter.put("fPeriodStartY", DateUtil.format(attachInfo.getPeriodStart(), "yyyy")); paramter.put("fPeriodStartY", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "yyyy"));
paramter.put("fPeriodStartM", DateUtil.format(attachInfo.getPeriodStart(), "MM")); paramter.put("fPeriodStartM", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "MM"));
paramter.put("fPeriodStartD", DateUtil.format(attachInfo.getPeriodStart(), "dd")); paramter.put("fPeriodStartD", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "dd"));
if (attachInfo.getPeriodEnd() == null) { if (attachInfo.getPeriodEnd() == null) {
return R.failed("新签试用期结束时间为空"); return R.failed("新签试用期结束时间为空");
} }
paramter.put("fPeriodEndY", DateUtil.format(attachInfo.getPeriodEnd(), "yyyy")); paramter.put("fPeriodEndY", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "yyyy"));
paramter.put("fPeriodEndM", DateUtil.format(attachInfo.getPeriodEnd(), "MM")); paramter.put("fPeriodEndM", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "MM"));
paramter.put("fPeriodEndD", DateUtil.format(attachInfo.getPeriodEnd(), "dd")); paramter.put("fPeriodEndD", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "dd"));
if (attachInfo.getPeriodSalaryPerMonth() == null) { if (attachInfo.getPeriodSalaryPerMonth() == null) {
return R.failed("新签试用期工资为空"); return R.failed("新签试用期工资为空");
} }
...@@ -859,6 +862,14 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe ...@@ -859,6 +862,14 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
return new R<>(paramter.toJSONString()); return new R<>(paramter.toJSONString());
} }
public static Date localDate2Date(LocalDate localDate) {
if (null == localDate) {
return null;
}
ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
return Date.from(zonedDateTime.toInstant());
}
/** /**
* @param entity * @param entity
* @Author: huyc * @Author: huyc
......
...@@ -47,6 +47,7 @@ public class TEmployeeLogServiceImpl extends ServiceImpl<TEmployeeLogMapper, TEm ...@@ -47,6 +47,7 @@ public class TEmployeeLogServiceImpl extends ServiceImpl<TEmployeeLogMapper, TEm
String differenceKey = HrEquator.comparisonValue(oldInfo, newInfo); String differenceKey = HrEquator.comparisonValue(oldInfo, newInfo);
//如果有差异保存差异 //如果有差异保存差异
if(!Common.isEmpty(differenceKey)){ if(!Common.isEmpty(differenceKey)){
YifuUser user = SecurityUtils.getUser();
TEmployeeLog record = new TEmployeeLog(); TEmployeeLog record = new TEmployeeLog();
record.setProjectId(projectId); record.setProjectId(projectId);
record.setType(type); record.setType(type);
......
package com.yifu.cloud.plus.v1.yifu.archives.utils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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.service.TEmployeeInfoService;
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.common.core.constant.CommonConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 主要执行人员档案的员工类型同步更新
* @author huyc
* @Date 2022-07-08
* @Description 多线程的执行demo
*/
@Slf4j
@Component
public class DoJointTask {
@Autowired
private TEmployeeInfoService tEmployeeInfoService;
@Autowired
private TEmployeeProjectService tEmployeeProjectService;
@Autowired
private TEmployeeLogService tEmployeeLogService;
/**
* @Description: 合同-批量更换负责人
* @Author: huyc
* @Date: 2022-7-8
* @return: void
**/
@Async
public void doUpdateEmployeeInfo(List<TEmployeeInfo> tEmployeeInfoList) {
log.info("档案-批量更新人员档案-线程开始");
try {
for(TEmployeeInfo tEmployeeInfo:tEmployeeInfoList) {
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoService.getById(tEmployeeInfo.getId());
//查询该人员所有的项目档案
List<TEmployeeProject> list = tEmployeeProjectService.list(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmployeeInfo.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
for (TEmployeeProject tEmployeeProject:list) {
if (CommonConstants.ZERO_STRING.equals(tEmployeeProject.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
break;
} else if (CommonConstants.ONE_STRING.equals(tEmployeeProject.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break;
}
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
}
tEmployeeInfoService.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0]
, tEmployeeInfo.getId(), "", tEmployeeInfoOld, tEmployeeInfo);
}
} catch (Exception e) {
log.error("档案-批量更新人员档案错误", e);
}
log.info("档案-批量更新人员档案结束");
}
}
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