Commit 340a3375 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent d5b0fb68
......@@ -20,12 +20,15 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
......@@ -52,66 +55,79 @@ public class FddContractAttachInfo extends BaseEntity {
* 合同id
*/
@Schema(description ="合同id")
@ExcelAttribute(name = "合同id", errorInfo = "员工合同id主键不能为空", maxLength = 32)
private String contractId;
/**
* 合同试用期开始时间
*/
@Schema(description ="合同试用期开始时间")
private Date periodStart;
@ExcelAttribute(name = "合同试用期开始时间")
private LocalDate periodStart;
/**
* 合同试用期结束时间
*/
@Schema(description ="合同试用期结束时间")
private Date periodEnd;
@ExcelAttribute(name = "合同试用期结束时间")
private LocalDate periodEnd;
/**
* 合同起始时间
*/
@Schema(description ="合同起始时间")
private Date contractStart;
@ExcelAttribute(name = "合同起始时间", isNotEmpty = true, errorInfo = "合同起始时间不能为空")
private Date contractStart;
/**
* 合同到期时间
*/
@Schema(description ="合同到期时间")
private Date contractEnd;
@ExcelAttribute(name = "合同到期时间",needExport = true)
private Date contractEnd;
/**
* 试用期工资 元/月
*/
@Schema(description ="试用期工资 元/月")
private BigDecimal periodSalaryPerMonth;
@ExcelAttribute(name = "试用期工资")
private BigDecimal periodSalaryPerMonth;
/**
* 工资形式 1.计时工资 2.计件工资 3.其他
*/
@Schema(description ="工资形式 1.计时工资 2.计件工资 3.其他")
@ExcelAttribute(name = "工资形式", isDataId = true, dataType = "salary_type")
private String salaryType;
/**
* 计时工资 工资标准 元/月
*/
@Schema(description ="计时工资 工资标准 元/月")
@ExcelAttribute(name = "计时工资")
private BigDecimal salaryStandardPerHour;
/**
* 计件工资 工资标准单价/元
*/
@Schema(description ="计件工资 工资标准单价/元")
@ExcelAttribute(name = "计件工资")
private BigDecimal salaryStandardPerPiece;
/**
* 工作地点
*/
@Schema(description ="工作地点")
@Length(max=200,message = "工作地点不能超过200个字符")
@ExcelAttribute(name = "工作地点" , maxLength = 200 )
private String workSpace;
/**
* 岗位
*/
@Schema(description ="岗位")
@Length(max = 200, message = "岗位不能超过200个字符")
@ExcelAttribute(name = "岗位", isNotEmpty = true, errorInfo = "岗位不能为空", maxLength = 200, needExport = true)
private String post;
/**
......@@ -142,13 +158,15 @@ public class FddContractAttachInfo extends BaseEntity {
* 员工姓名
*/
@Schema(description ="员工姓名")
@ExcelAttribute(name = "员工姓名", isNotEmpty = true, errorInfo = "员工合同id姓名不能为空", maxLength = 32, needExport = true)
private String empName;
/**
* 身份证号码
*/
@Schema(description ="身份证号码")
private String empIdcard;
@ExcelAttribute(name = "身份证号码", isNotEmpty = true, errorInfo = "身份证号码不能为空", maxLength = 32, needExport = true)
private String empIdcard;
/**
* 手机号码
......
......@@ -139,25 +139,25 @@ public class FddContractAttachInfoController {
@PostMapping("/batchAddFddEmpInfo")
public R batchAddFddEmpInfo(@RequestBody String jsonString) {
R<List<SysDictItem>> res = null;
R<Map<String,List<SysDictItem>>> res = null;
ExcelUtil<FddContractAttachInfo> util1 = null;
try {
// 调用字典服务,渲染字典值
res = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dict/inner/getDictList", null, Map.class, SecurityConstants.FROM_IN);
Map<String, String> dicMap = new HashMap<>();
if (null != res.getData()) {
for (SysDictItem dict : res.getData()) {
dicMap.put(dict.getType() + CommonConstants.DOWN_LINE_STRING + dict.getLabel(), dict.getValue());
}
}
// // 调用字典服务,渲染字典值
// res = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
// , "/dict/inner/getDictList", null, Map.class, SecurityConstants.FROM_IN);
//
// Map<String, String> dicMap = new HashMap<>();
// if (null != res.getData().get("data")) {
// for (SysDictItem dict : res.getData().get("data")) {
// dicMap.put(dict.getType() + CommonConstants.DOWN_LINE_STRING + dict.getLabel(), dict.getValue());
// }
// }
jsonString = URLDecoder.decode(jsonString, CommonConstants.UTF8).replace("=", "");
util1 = new ExcelUtil<>(FddContractAttachInfo.class);
//传参字典数据MAP具体见方法实现
util1.getJsonStringToList(jsonString, dicMap);
util1.getJsonStringToList(jsonString, null);
if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) {
return R.failed(util1.getErrorInfo(),"数据异常");
} else {
......@@ -172,8 +172,9 @@ public class FddContractAttachInfoController {
map.put(errorMessage.getLineNum(),util1.getEntityList().get(errorMessage.getLineNum()-2));
}
variableMap.put("data",map);
return R.ok(variableMap);
}
return R.ok(variableMap);
return new R<>(CommonConstants.dingleDigitIntArray[1], "", errorInfo);
} else {
return R.ok(null,"无数据可导入");
}
......
......@@ -71,6 +71,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.stream.Collectors;
......@@ -668,17 +671,17 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
if (attachInfo.getPeriodStart() == null) {
return R.failed("新签试用期开始时间为空");
}
paramter.put("fPeriodStartY", DateUtil.format(attachInfo.getPeriodStart(), "yyyy"));
paramter.put("fPeriodStartM", DateUtil.format(attachInfo.getPeriodStart(), "MM"));
paramter.put("fPeriodStartD", DateUtil.format(attachInfo.getPeriodStart(), "dd"));
paramter.put("fPeriodStartY", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "yyyy"));
paramter.put("fPeriodStartM", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "MM"));
paramter.put("fPeriodStartD", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "dd"));
}
if (Common.isNotNull(companyFieldMap.get("fPeriodEndY"))){
if (attachInfo.getPeriodEnd() == null) {
return R.failed("新签试用期结束时间为空");
}
paramter.put("fPeriodEndY", DateUtil.format(attachInfo.getPeriodEnd(), "yyyy"));
paramter.put("fPeriodEndM", DateUtil.format(attachInfo.getPeriodEnd(), "MM"));
paramter.put("fPeriodEndD", DateUtil.format(attachInfo.getPeriodEnd(), "dd"));
paramter.put("fPeriodEndY", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "yyyy"));
paramter.put("fPeriodEndM", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "MM"));
paramter.put("fPeriodEndD", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "dd"));
}
if (Common.isNotNull(companyFieldMap.get("periodSalaryPerMonth"))){
if (attachInfo.getPeriodSalaryPerMonth() == null) {
......@@ -807,15 +810,15 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
if (attachInfo.getPeriodStart() == null) {
return R.failed("新签试用期开始时间为空");
}
paramter.put("fPeriodStartY", DateUtil.format(attachInfo.getPeriodStart(), "yyyy"));
paramter.put("fPeriodStartM", DateUtil.format(attachInfo.getPeriodStart(), "MM"));
paramter.put("fPeriodStartD", DateUtil.format(attachInfo.getPeriodStart(), "dd"));
paramter.put("fPeriodStartY", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "yyyy"));
paramter.put("fPeriodStartM", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "MM"));
paramter.put("fPeriodStartD", DateUtil.format(localDate2Date(attachInfo.getPeriodStart()), "dd"));
if (attachInfo.getPeriodEnd() == null) {
return R.failed("新签试用期结束时间为空");
}
paramter.put("fPeriodEndY", DateUtil.format(attachInfo.getPeriodEnd(), "yyyy"));
paramter.put("fPeriodEndM", DateUtil.format(attachInfo.getPeriodEnd(), "MM"));
paramter.put("fPeriodEndD", DateUtil.format(attachInfo.getPeriodEnd(), "dd"));
paramter.put("fPeriodEndY", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "yyyy"));
paramter.put("fPeriodEndM", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "MM"));
paramter.put("fPeriodEndD", DateUtil.format(localDate2Date(attachInfo.getPeriodEnd()), "dd"));
if (attachInfo.getPeriodSalaryPerMonth() == null) {
return R.failed("新签试用期工资为空");
}
......@@ -859,6 +862,14 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
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
* @Author: huyc
......
......@@ -47,6 +47,7 @@ public class TEmployeeLogServiceImpl extends ServiceImpl<TEmployeeLogMapper, TEm
String differenceKey = HrEquator.comparisonValue(oldInfo, newInfo);
//如果有差异保存差异
if(!Common.isEmpty(differenceKey)){
YifuUser user = SecurityUtils.getUser();
TEmployeeLog record = new TEmployeeLog();
record.setProjectId(projectId);
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