Commit 2f7724c6 authored by fangxinjiang's avatar fangxinjiang

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

parents 387284ed 5979f248
...@@ -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 ="合同起始时间")
@ExcelAttribute(name = "合同起始时间", isNotEmpty = true, errorInfo = "合同起始时间不能为空")
private Date contractStart; private Date contractStart;
/** /**
* 合同到期时间 * 合同到期时间
*/ */
@Schema(description ="合同到期时间") @Schema(description ="合同到期时间")
@ExcelAttribute(name = "合同到期时间",needExport = true)
private Date contractEnd; private Date contractEnd;
/** /**
* 试用期工资 元/月 * 试用期工资 元/月
*/ */
@Schema(description ="试用期工资 元/月") @Schema(description ="试用期工资 元/月")
@ExcelAttribute(name = "试用期工资")
private BigDecimal periodSalaryPerMonth; 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,12 +158,14 @@ public class FddContractAttachInfo extends BaseEntity { ...@@ -142,12 +158,14 @@ 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 ="身份证号码")
@ExcelAttribute(name = "身份证号码", isNotEmpty = true, errorInfo = "身份证号码不能为空", maxLength = 32, needExport = true)
private String empIdcard; private String empIdcard;
/** /**
......
...@@ -27,8 +27,7 @@ import lombok.EqualsAndHashCode; ...@@ -27,8 +27,7 @@ import lombok.EqualsAndHashCode;
import javax.validation.constraints.Max; import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.time.LocalDate; import java.util.Date;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -60,7 +59,7 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -60,7 +59,7 @@ public class TEmployeeInfo extends BaseEntity {
/** /**
* 员工类型(字典值,0外包1派遣2代理) * 员工类型(字典值,0外包1派遣2代理)
*/ */
@ExcelAttribute(name = "员工类型", isDataId = true,dataType = ExcelAttributeConstants.EMP_NATRUE) @ExcelAttribute(name = "员工类型", isDataId = true, dataType = ExcelAttributeConstants.EMP_NATRUE)
@Schema(description = "员工类型(字典值,0外包1派遣2代理)") @Schema(description = "员工类型(字典值,0外包1派遣2代理)")
@NotNull(message = "员工类型不可为空") @NotNull(message = "员工类型不可为空")
@Size(max = 1, message = "员工类型不可超过1位") @Size(max = 1, message = "员工类型不可超过1位")
...@@ -87,14 +86,14 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -87,14 +86,14 @@ public class TEmployeeInfo extends BaseEntity {
*/ */
@Schema(description = "身份证有效期起") @Schema(description = "身份证有效期起")
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDate validityStart; private Date validityStart;
/** /**
* 身份证有效期止 * 身份证有效期止
*/ */
@Schema(description = "身份证有效期止") @Schema(description = "身份证有效期止")
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDate validityEnd; private Date validityEnd;
/** /**
* 性别 * 性别
...@@ -106,7 +105,7 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -106,7 +105,7 @@ public class TEmployeeInfo extends BaseEntity {
* 出生日期 * 出生日期
*/ */
@Schema(description = "出生日期") @Schema(description = "出生日期")
private LocalDate empBirthday; private Date empBirthday;
/** /**
* 年龄 * 年龄
...@@ -227,14 +226,14 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -227,14 +226,14 @@ public class TEmployeeInfo extends BaseEntity {
*/ */
@Schema(description = "入学时间") @Schema(description = "入学时间")
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDate admissionDate; private Date admissionDate;
/** /**
* 毕业时间 * 毕业时间
*/ */
@Schema(description = "毕业时间") @Schema(description = "毕业时间")
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDate gradutionDate; private Date gradutionDate;
/** /**
* 备注 * 备注
...@@ -321,7 +320,7 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -321,7 +320,7 @@ public class TEmployeeInfo extends BaseEntity {
*/ */
@Schema(description = "离职时间") @Schema(description = "离职时间")
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDateTime leaveTime; private Date leaveTime;
/** /**
* 离职原因 * 离职原因
......
...@@ -319,6 +319,24 @@ public class TEmployeeProject extends BaseEntity { ...@@ -319,6 +319,24 @@ public class TEmployeeProject extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private Integer fileTown; private Integer fileTown;
/**
* 社保-省
*/
@Schema(description = "社保-省")
private Integer socialProvince;
/**
* 社保-市
*/
@Schema(description = "社保-市")
private Integer socialCity;
/**
* 社保-县
*/
@Schema(description = "社保-县")
private Integer socialTown;
/** /**
* 员工合同状态(字典) * 员工合同状态(字典)
*/ */
......
...@@ -17,14 +17,15 @@ ...@@ -17,14 +17,15 @@
package com.yifu.cloud.plus.v1.yifu.archives.vo; package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate; import java.util.Date;
/** /**
* 项目档案表excel对应的实体 * 项目档案表excel对应的实体
...@@ -34,7 +35,7 @@ import java.time.LocalDate; ...@@ -34,7 +35,7 @@ import java.time.LocalDate;
*/ */
@Data @Data
@ColumnWidth(30) @ColumnWidth(30)
public class EmployeeVO implements Serializable { public class EmployeeVO extends RowIndex implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -48,6 +49,7 @@ public class EmployeeVO implements Serializable { ...@@ -48,6 +49,7 @@ public class EmployeeVO implements Serializable {
* 员工姓名 * 员工姓名
*/ */
@ExcelProperty(value = "员工姓名") @ExcelProperty(value = "员工姓名")
@ExcelAttribute(name = "员工姓名", isNotEmpty = true, maxLength = 20, needExport = true, errorInfo = "员工姓名必填且不可超过20位")
@Size(max = 20, message = "员工姓名不可超过20位") @Size(max = 20, message = "员工姓名不可超过20位")
private String empName; private String empName;
...@@ -55,6 +57,7 @@ public class EmployeeVO implements Serializable { ...@@ -55,6 +57,7 @@ public class EmployeeVO implements Serializable {
* 身份证号 * 身份证号
*/ */
@ExcelProperty(value = "身份证号") @ExcelProperty(value = "身份证号")
@ExcelAttribute(name = "身份证号", isNotEmpty = true, maxLength = 20, needExport = true, errorInfo = "身份证号必填且不可超过20位")
@Size(max = 20, message = "身份证号不可超过20位") @Size(max = 20, message = "身份证号不可超过20位")
private String empIdcard; private String empIdcard;
...@@ -62,6 +65,7 @@ public class EmployeeVO implements Serializable { ...@@ -62,6 +65,7 @@ public class EmployeeVO implements Serializable {
* 项目编码 * 项目编码
*/ */
@ExcelProperty(value = "项目编码") @ExcelProperty(value = "项目编码")
@ExcelAttribute(name = "项目编码", maxLength = 32, needExport = true, errorInfo = "身份证号必填且不可超过20位")
@Size(max = 32, message = "项目编码不可超过32位") @Size(max = 32, message = "项目编码不可超过32位")
private String deptNo; private String deptNo;
...@@ -75,14 +79,16 @@ public class EmployeeVO implements Serializable { ...@@ -75,14 +79,16 @@ public class EmployeeVO implements Serializable {
/** /**
* 身份证有效期起 * 身份证有效期起
*/ */
@DateTimeFormat("yyyy-MM-dd")
@ExcelProperty(value = "身份证开始日期") @ExcelProperty(value = "身份证开始日期")
private LocalDate validityStart; private Date validityStart;
/** /**
* 身份证有效期止 * 身份证有效期止
*/ */
@DateTimeFormat("yyyy-MM-dd")
@ExcelProperty(value = "身份证截止日期") @ExcelProperty(value = "身份证截止日期")
private LocalDate validityEnd; private Date validityEnd;
/** /**
* 婚姻状况 * 婚姻状况
...@@ -188,14 +194,16 @@ public class EmployeeVO implements Serializable { ...@@ -188,14 +194,16 @@ public class EmployeeVO implements Serializable {
/** /**
* 入学时间 * 入学时间
*/ */
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
@ExcelProperty(value = "入学时间") @ExcelProperty(value = "入学时间")
private LocalDate admissionDate; private Date admissionDate;
/** /**
* 毕业时间 * 毕业时间
*/ */
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
@ExcelProperty(value = "毕业时间") @ExcelProperty(value = "毕业时间")
private LocalDate gradutionDate; private Date gradutionDate;
/** /**
* 备注 * 备注
......
...@@ -6,6 +6,7 @@ import lombok.Data; ...@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* @Author fxj * @Author fxj
...@@ -133,7 +134,7 @@ public class TCertRecordVo implements Serializable { ...@@ -133,7 +134,7 @@ public class TCertRecordVo implements Serializable {
*/ */
@ExcelAttribute(name = "离职时间" ) @ExcelAttribute(name = "离职时间" )
@Schema(description ="离职时间") @Schema(description ="离职时间")
private LocalDateTime leaveTime; private Date leaveTime;
/** /**
* 派减原因 * 派减原因
......
...@@ -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,"无数据可导入");
} }
......
...@@ -40,6 +40,7 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; ...@@ -40,6 +40,7 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.Cache; import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
...@@ -47,6 +48,7 @@ import org.springframework.cache.support.SimpleValueWrapper; ...@@ -47,6 +48,7 @@ import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
...@@ -364,35 +366,33 @@ public class TEmployeeInfoController { ...@@ -364,35 +366,33 @@ public class TEmployeeInfoController {
} }
/** /**
* @param excelList
* @param bindingResult
* @Description: 批量导入人员档案 * @Description: 批量导入人员档案
* @Author: hgw * @Author: hgw
* @Date: 2022/6/22 11:57 * @Date: 2022/6/22 11:57
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>>
**/ **/
@SneakyThrows
@Operation(summary = "批量导入人员档案", description = "批量导入人员档案 hasPermission('employee_batch_import') 额外属性:isCanAdd:0不可以复档复项;1允许复档复项") @Operation(summary = "批量导入人员档案", description = "批量导入人员档案 hasPermission('employee_batch_import') 额外属性:isCanAdd:0不可以复档复项;1允许复档复项")
@SysLog("批量导入人员档案") @SysLog("批量导入人员档案")
@PostMapping("/batchImportEmployee") @PostMapping("/batchImportEmployee")
@PreAuthorize("@pms.hasPermission('employee_batch_import')") @PreAuthorize("@pms.hasPermission('employee_batch_import')")
public R<List<ErrorMessage>> batchImportEmployee(@RequestExcel List<EmployeeVO> excelList, BindingResult bindingResult, @RequestParam Integer isCanAdd) { public R<List<ErrorMessage>> batchImportEmployee(@RequestBody MultipartFile file, @RequestParam Integer isCanAdd) {
return tEmployeeInfoService.batchImportEmployee(excelList, bindingResult, isCanAdd); return tEmployeeInfoService.batchImportEmployee(file.getInputStream(), isCanAdd);
} }
/** /**
* @param excelList
* @param bindingResult
* @Description: 批量更新人员档案 * @Description: 批量更新人员档案
* @Author: hgw * @Author: hgw
* @Date: 2022/6/22 20:29 * @Date: 2022/6/22 20:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>>
**/ **/
@SneakyThrows
@Operation(summary = "批量更新人员档案", description = "批量更新人员档案 hasPermission('employee_batch_update')") @Operation(summary = "批量更新人员档案", description = "批量更新人员档案 hasPermission('employee_batch_update')")
@SysLog("批量更新人员档案") @SysLog("批量更新人员档案")
@PostMapping("/batchUpdateEmployee") @PostMapping("/batchUpdateEmployee")
@PreAuthorize("@pms.hasPermission('employee_batch_update')") @PreAuthorize("@pms.hasPermission('employee_batch_update')")
public R<List<ErrorMessage>> batchUpdateEmployee(@RequestExcel List<EmployeeVO> excelList, BindingResult bindingResult) { public R<List<ErrorMessage>> batchUpdateEmployee(@RequestBody MultipartFile file) {
return tEmployeeInfoService.batchUpdateEmployee(excelList, bindingResult); return tEmployeeInfoService.batchUpdateEmployee(file.getInputStream());
} }
/** /**
......
...@@ -30,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R; ...@@ -30,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List; import java.util.List;
/** /**
...@@ -154,17 +155,15 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> { ...@@ -154,17 +155,15 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
* @Date: 2022/6/22 11:58 * @Date: 2022/6/22 11:58
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>>
**/ **/
R<List<ErrorMessage>> batchImportEmployee(List<EmployeeVO> excelVOList, BindingResult bindingResult, int isCanAdd); R<List<ErrorMessage>> batchImportEmployee(InputStream inputStream, int isCanAdd);
/** /**
* @param excelVOList
* @param bindingResult
* @Description: 批量更新人员档案 * @Description: 批量更新人员档案
* @Author: hgw * @Author: hgw
* @Date: 2022/6/22 20:30 * @Date: 2022/6/22 20:30
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>>
**/ **/
R<List<ErrorMessage>> batchUpdateEmployee(List<EmployeeVO> excelVOList, BindingResult bindingResult); R<List<ErrorMessage>> batchUpdateEmployee(InputStream inputStream);
void updateEducationOfEmp(EmpEducationUpdateVO education); void updateEducationOfEmp(EmpEducationUpdateVO education);
......
...@@ -304,7 +304,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -304,7 +304,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
if (null != date) { if (null != date) {
//初始化年龄 //初始化年龄
newEmployeeInfo.setEmpAge(IdCardUtil.IdNOToAge(fddContractAttachInfo.getEmpIdcard())); newEmployeeInfo.setEmpAge(IdCardUtil.IdNOToAge(fddContractAttachInfo.getEmpIdcard()));
newEmployeeInfo.setEmpBirthday(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); newEmployeeInfo.setEmpBirthday(date);
} }
newEmployeeInfo.setEmpSex(IdCardUtil.getSex(fddContractAttachInfo.getEmpIdcard())); newEmployeeInfo.setEmpSex(IdCardUtil.getSex(fddContractAttachInfo.getEmpIdcard()));
tEmployeeInfoMapper.insert(newEmployeeInfo); tEmployeeInfoMapper.insert(newEmployeeInfo);
......
...@@ -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
......
...@@ -96,13 +96,12 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper, ...@@ -96,13 +96,12 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
updateTEmployeeProject.setUnitName(tEmpChangeInfo.getNewDept()); updateTEmployeeProject.setUnitName(tEmpChangeInfo.getNewDept());
tEmployeeProjectService.updateById(updateTEmployeeProject); tEmployeeProjectService.updateById(updateTEmployeeProject);
tEmpChangeInfo.setProId(updateTEmployeeProject.getId()); tEmpChangeInfo.setProId(updateTEmployeeProject.getId());
// 记录变更日志
TEmployeeProject tEmployeeProjectOld = tEmployeeProjectService.getById(updateTEmployeeProject.getId());
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", updateTEmployeeProject.getId(), tEmployeeProjectOld, updateTEmployeeProject);
} }
//保存档案划转记录 //保存档案划转记录
this.save(tEmpChangeInfo); this.save(tEmpChangeInfo);
// 记录变更日志
TEmployeeProject tEmployeeProjectOld = tEmployeeProjectService.getById(tEmpChangeInfo.getProId());
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", updateTEmployeeProject.getId(), tEmployeeProjectOld, updateTEmployeeProject);
return R.ok(); return R.ok();
} }
...@@ -154,7 +153,8 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper, ...@@ -154,7 +153,8 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
//待划转员工已在目标结算主体下不可划转 //待划转员工已在目标结算主体下不可划转
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda() TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard()).eq(TEmployeeProject::getDeptNo,excel.getNewSettleCode()) .eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard()).eq(TEmployeeProject::getDeptNo,excel.getNewSettleCode())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL)); .eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus,CommonConstants.ZERO_INT));
if (Common.isNotNull(tEmployeeProject)) { if (Common.isNotNull(tEmployeeProject)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.CHECKS_CHANGE_EMP_PROJECT, excel.getNewSettleCode())); errorMsg.add(MsgUtils.getMessage(ErrorCodes.CHECKS_CHANGE_EMP_PROJECT, excel.getNewSettleCode()));
} }
...@@ -165,7 +165,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper, ...@@ -165,7 +165,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard()).eq(TEmployeeProject::getDeptNo,excel.getOldSettleCode()) .eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard()).eq(TEmployeeProject::getDeptNo,excel.getOldSettleCode())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL)); .eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(updateTEmployeePro)) { if (Common.isNotNull(updateTEmployeePro)) {
if (CommonConstants.ONE_STRING.equals(updateTEmployeePro.getProjectStatus())) { if (CommonConstants.ONE_INT == updateTEmployeePro.getProjectStatus()) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.PROJECT_PERSON_DELETE_EXIT, excel.getOldSettleCode())); errorMsg.add(MsgUtils.getMessage(ErrorCodes.PROJECT_PERSON_DELETE_EXIT, excel.getOldSettleCode()));
} else if (Common.isNotNull(tSettleDomain)) { } else if (Common.isNotNull(tSettleDomain)) {
updateTEmployeePro.setDeptNo(tSettleDomain.getDepartNo()); updateTEmployeePro.setDeptNo(tSettleDomain.getDepartNo());
......
...@@ -38,6 +38,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper; ...@@ -38,6 +38,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
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.service.TSettleDomainService; import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.archives.utils.DoJointTask;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*; import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
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;
...@@ -46,6 +47,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; ...@@ -46,6 +47,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
...@@ -70,13 +73,21 @@ import java.util.stream.Collectors; ...@@ -70,13 +73,21 @@ import java.util.stream.Collectors;
@Log4j2 @Log4j2
public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMapper, TEmployeeProject> implements TEmployeeProjectService { public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMapper, TEmployeeProject> implements TEmployeeProjectService {
private final TEmployeeLogService tEmployeeLogService; @Autowired
private TEmployeeLogService tEmployeeLogService;
private final TEmployeeInfoMapper tEmployeeInfoMapper; @Autowired
private TEmployeeInfoMapper tEmployeeInfoMapper;
private final TSettleDomainService tSettleDomainService; @Autowired
private TSettleDomainService tSettleDomainService;
private final TCustomerInfoMapper tCustomerInfoMapper; @Autowired
private TCustomerInfoMapper tCustomerInfoMapper;
@Autowired
@Lazy
private DoJointTask doJointTask;
@Override @Override
public R addCheck(TEmployeeProject tEmployeeProject) { public R addCheck(TEmployeeProject tEmployeeProject) {
...@@ -334,7 +345,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -334,7 +345,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard()) .eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo, excel.getDeptNo()) .eq(TEmployeeProject::getDeptNo, excel.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL) .eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.STATUS_NORMAL)); .eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
if (Common.isNotNull(tEmployeeProject)) { if (Common.isNotNull(tEmployeeProject)) {
if (tEmployeeProject.getInsuranceStatus() != CommonConstants.dingleDigitIntArray[0] || tEmployeeProject.getSocialStatus() != CommonConstants.dingleDigitIntArray[0] || if (tEmployeeProject.getInsuranceStatus() != CommonConstants.dingleDigitIntArray[0] || tEmployeeProject.getSocialStatus() != CommonConstants.dingleDigitIntArray[0] ||
...@@ -368,11 +379,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -368,11 +379,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} }
} }
} }
}
} else {
idList.add(tEmployeeProject);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.PROJECT_PERSON_SEARCH_EXIT)));
}
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId()); TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId()); TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
List<String> projectIdList = idList.stream().map(TEmployeeProject::getId).collect(Collectors.toList()); List<String> projectIdList = idList.stream().map(TEmployeeProject::getId).collect(Collectors.toList());
...@@ -384,6 +390,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -384,6 +390,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
newOld.setNewEmployee(tEmployeeInfo); newOld.setNewEmployee(tEmployeeInfo);
updateList.add(newOld); updateList.add(newOld);
} }
} else {
idList.add(tEmployeeProject);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.PROJECT_PERSON_SEARCH_EXIT)));
}
}
if (errorMessageList.size() > CommonConstants.ZERO_INT) { if (errorMessageList.size() > CommonConstants.ZERO_INT) {
return R.failed(errorMessageList); return R.failed(errorMessageList);
} else { } else {
...@@ -408,7 +419,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -408,7 +419,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (updateProjectList.size() > CommonConstants.dingleDigitIntArray[0]) { if (updateProjectList.size() > CommonConstants.dingleDigitIntArray[0]) {
for (EmployeeProjectNewOldVO newOldVO : updateProjectList) { for (EmployeeProjectNewOldVO newOldVO : updateProjectList) {
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1] tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1]
,"", newOldVO.getNewProjectEmployee().getId() , "", newOldVO.getNewProjectEmployee().getId()
, newOldVO.getOldProjectEmployee(), newOldVO.getNewProjectEmployee()); , newOldVO.getOldProjectEmployee(), newOldVO.getNewProjectEmployee());
} }
} }
...@@ -679,9 +690,22 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -679,9 +690,22 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
// 通用校验获取失败的数据 // 通用校验获取失败的数据
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>(); Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
// 项目档案更新List
List<TEmployeeProject> updateList = new ArrayList<>(); List<TEmployeeProject> updateList = new ArrayList<>();
// 人员档案更新List
List<TEmployeeInfo> updTEmployeeList = new ArrayList();
Map<String, Integer> checkCountMap = new HashMap<>(); Map<String, Integer> checkCountMap = new HashMap<>();
// 新老档案List
List<EmployeeNewOldVO> updateInfoList = new ArrayList<>();
// 新老档案vo
EmployeeNewOldVO newOld;
// 新老项目档案vo
EmployeeProjectNewOldVO newOldProject;
// 新老项目档案List
List<EmployeeProjectNewOldVO> updateProjectList = new ArrayList<>();
// 执行数据插入操作 组装 // 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个 // 已有验证报错直接下一个
...@@ -707,41 +731,46 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -707,41 +731,46 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} else { } else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_EXIT_ERROR))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_EXIT_ERROR)));
} }
} } else {
// 数据合法情况
if (CollUtil.isEmpty(errorMessageList)) {
updateExcelProj(excel, updateList, tEmployeeProject); updateExcelProj(excel, updateList, tEmployeeProject);
if (Common.isNotNull(excel.getEmpNatrue())) { TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
if (!excel.getEmpNatrue().equals(tEmployeeProject.getEmpNatrue())) { newOldProject = new EmployeeProjectNewOldVO();
newOldProject.setOldProjectEmployee(tEmployeeProjectOld);
newOldProject.setNewProjectEmployee(tEmployeeProject);
updateProjectList.add(newOldProject);
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda() TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard()) .eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT) .eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL)); .eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tEmployeeInfo)) { updTEmployeeList.add(tEmployeeInfo);
TEmployeeInfo tEmployeeInfoCof = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
String empNature = tEmployeeInfo.getEmpNatrue();
if (CommonConstants.ZERO_STRING.equals(excel.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (CommonConstants.ONE_STRING.equals(excel.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(empNature)) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeInfoCof, tEmployeeInfo);
}
}
}
} }
} }
// 数据合法情况
if (CollUtil.isEmpty(errorMessageList)) {
try { try {
if (updateList.size() > CommonConstants.dingleDigitIntArray[0]) { if (updateList.size() > CommonConstants.dingleDigitIntArray[0]) {
baseMapper.updateExcelEmpProject(updateList); baseMapper.updateExcelEmpProject(updateList);
} }
if (updTEmployeeList.size()> CommonConstants.dingleDigitIntArray[0]) {
List<TEmployeeInfo> updEmpInfoList = updTEmployeeList.stream().distinct().collect(Collectors.toList());
doJointTask.doUpdateEmployeeInfo(updEmpInfoList);
}
// 记录变更日志
if (updateInfoList.size() > CommonConstants.dingleDigitIntArray[0]) {
for (EmployeeNewOldVO newOldInfo : updateInfoList) {
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0]
, newOldInfo.getOldEmployee().getId(), ""
, newOldInfo.getOldEmployee(), newOldInfo.getNewEmployee());
}
}
} catch (Exception e) { } catch (Exception e) {
log.error("数据更新异常", e); log.error("数据更新异常", e);
} }
} }
}
/** /**
* 插入excel Pro * 插入excel Pro
...@@ -971,9 +1000,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -971,9 +1000,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
tEmployeeProject.setUpdateBy(user.getId()); tEmployeeProject.setUpdateBy(user.getId());
proupdateList.add(tEmployeeProject); proupdateList.add(tEmployeeProject);
// 记录变更日志
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeProjectOld, tEmployeeProject);
} }
@Override @Override
...@@ -1025,7 +1051,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -1025,7 +1051,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
public R<Map<String, String>> getProjectByIdCard(String empIdCard) { public R<Map<String, String>> getProjectByIdCard(String empIdCard) {
List<TEmployeeProject> projects = baseMapper.selectList(Wrappers.<TEmployeeProject>query().lambda() List<TEmployeeProject> projects = baseMapper.selectList(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.ZERO_STRING) .eq(TEmployeeProject::getDeleteFlag, CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_STRING) .eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getEmpIdcard, empIdCard)); .eq(TEmployeeProject::getEmpIdcard, empIdCard));
Map<String, String> projectMap = new HashMap<>(); Map<String, String> projectMap = new HashMap<>();
if (Common.isNotNull(projects)) { if (Common.isNotNull(projects)) {
...@@ -1050,6 +1076,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -1050,6 +1076,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//从剩下的项目档案中查找员工类型 //从剩下的项目档案中查找员工类型
public void setEmpNature(String empIdcard, TEmployeeInfo tEmployeeInfo, List<String> idlist) { public void setEmpNature(String empIdcard, TEmployeeInfo tEmployeeInfo, List<String> idlist) {
if (Common.isNotNull(idlist)) {
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda() List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.in(TEmployeeProject::getId, idlist) .in(TEmployeeProject::getId, idlist)
.eq(TEmployeeProject::getEmpIdcard, empIdcard) .eq(TEmployeeProject::getEmpIdcard, empIdcard)
...@@ -1069,6 +1096,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -1069,6 +1096,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} }
} }
} }
}
public boolean saveCheck(EmployeeXProjectVO employeeXProjectVO, TEmployeeProject tEmployeeProject) { public boolean saveCheck(EmployeeXProjectVO employeeXProjectVO, TEmployeeProject tEmployeeProject) {
if (employeeXProjectVO.getDeptNo().equals(tEmployeeProject.getDeptNo()) && if (employeeXProjectVO.getDeptNo().equals(tEmployeeProject.getDeptNo()) &&
......
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("档案-批量更新人员档案结束");
}
}
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
<result property="fileProvince" column="FILE_PROVINCE"/> <result property="fileProvince" column="FILE_PROVINCE"/>
<result property="fileCity" column="FILE_CITY"/> <result property="fileCity" column="FILE_CITY"/>
<result property="fileTown" column="FILE_TOWN"/> <result property="fileTown" column="FILE_TOWN"/>
<result property="socialProvince" column="SOCIAL_PROVINCE"/>
<result property="socialCity" column="SOCIAL_CITY"/>
<result property="socialTown" column="SOCIAL_TOWN"/>
<result property="empPhone" column="EMP_PHONE"/> <result property="empPhone" column="EMP_PHONE"/>
<result property="salaryStatus" column="SALARY_STATUS"/> <result property="salaryStatus" column="SALARY_STATUS"/>
<result property="insuranceStatus" column="INSURANCE_STATUS"/> <result property="insuranceStatus" column="INSURANCE_STATUS"/>
...@@ -162,6 +165,9 @@ ...@@ -162,6 +165,9 @@
b.FILE_PROVINCE, b.FILE_PROVINCE,
b.FILE_CITY, b.FILE_CITY,
b.FILE_TOWN, b.FILE_TOWN,
a.SOCIAL_PROVINCE,
a.SOCIAL_CITY,
a.SOCIAL_TOWN,
a.SALARY_STATUS a.SALARY_STATUS
</sql> </sql>
...@@ -198,6 +204,9 @@ ...@@ -198,6 +204,9 @@
b.FILE_PROVINCE, b.FILE_PROVINCE,
b.FILE_CITY, b.FILE_CITY,
b.FILE_TOWN, b.FILE_TOWN,
a.SOCIAL_PROVINCE,
a.SOCIAL_CITY,
a.SOCIAL_TOWN,
a.SALARY_STATUS, a.SALARY_STATUS,
b.VALIDITY_START, b.VALIDITY_START,
b.VALIDITY_END, b.VALIDITY_END,
...@@ -365,6 +374,15 @@ ...@@ -365,6 +374,15 @@
<if test="tEmployeeProject.fileTown != null"> <if test="tEmployeeProject.fileTown != null">
AND b.FILE_TOWN = #{tEmployeeProject.fileTown} AND b.FILE_TOWN = #{tEmployeeProject.fileTown}
</if> </if>
<if test="tEmployeeProject.socialProvince != null">
AND a.SOCIAL_PROVINCE = #{tEmployeeProject.socialProvince}
</if>
<if test="tEmployeeProject.fileCity != null">
AND a.SOCIAL_CITY = #{tEmployeeProject.socialCity}
</if>
<if test="tEmployeeProject.fileTown != null">
AND a.SOCIAL_TOWN = #{tEmployeeProject.socialTown}
</if>
</if> </if>
</sql> </sql>
...@@ -472,6 +490,15 @@ ...@@ -472,6 +490,15 @@
<if test="tEmployeeProject.fileTown != null"> <if test="tEmployeeProject.fileTown != null">
AND b.FILE_TOWN = #{tEmployeeProject.fileTown} AND b.FILE_TOWN = #{tEmployeeProject.fileTown}
</if> </if>
<if test="tEmployeeProject.socialProvince != null">
AND a.SOCIAL_PROVINCE = #{tEmployeeProject.socialProvince}
</if>
<if test="tEmployeeProject.fileCity != null">
AND a.SOCIAL_CITY = #{tEmployeeProject.socialCity}
</if>
<if test="tEmployeeProject.fileTown != null">
AND a.SOCIAL_TOWN = #{tEmployeeProject.socialTown}
</if>
<if test="tEmployeeProject.idList != null"> <if test="tEmployeeProject.idList != null">
AND a.id in AND a.id in
<foreach item="idStr" index="index" collection="tEmployeeProject.idList" open="(" separator="," close=")"> <foreach item="idStr" index="index" collection="tEmployeeProject.idList" open="(" separator="," close=")">
......
package com.yifu.cloud.plus.v1.yifu.common.core.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 异步线程池
* @Author fxj
* @Date 2021-05-20
* @return
**/
@Configuration
@EnableAsync
@Slf4j
public class AsyncConfig implements AsyncConfigurer {
// todo 幂等性如何保证
@Override
public Executor getAsyncExecutor() {
//定义线程池
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
/**
* <!-- 设置allowCoreThreadTimeout=true(默认false)时,核心线程会超时关闭 -->
*/
taskExecutor.setAllowCoreThreadTimeOut(true);
/**
* 核心线程数
* 1)<!-- 线程池维护线程的最少数量,即使没有任务需要执行,也会一直存活 -->
* 2)<!-- 设置allowCoreThreadTimeout=true(默认false)时,核心线程会超时关闭 -->
*/
taskExecutor.setCorePoolSize(2);
/**
* <!-- 允许的空闲时间,当线程空闲时间达到keepAliveTime时,线程会退出,直到线程数量=corePoolSize -->
* <!-- 如果allowCoreThreadTimeout=true,则会直到线程数量=0 -->
*/
taskExecutor.setKeepAliveSeconds(200);
/**
* <!-- 线程池维护线程的最大数量 -->
* <!-- 当线程数>=corePoolSize,且任务队列已满时。线程池会创建新线程来处理任务 -->
* <!-- 当线程数=maxPoolSize,且任务队列已满时,线程池会拒绝处理任务而抛出异常,异常见下
*/
taskExecutor.setMaxPoolSize(8);
/**
* <!-- 缓存队列(阻塞队列)当核心线程数达到最大时,新任务会放在队列中排队等待执行 -->
*/
taskExecutor.setQueueCapacity(100);
/**
* 建议配置threadNamePrefix属性,出问题时可以更方便的进行排查。
**/
taskExecutor.setThreadNamePrefix("CRM_TO_HRO_EXECUTOR");
// 捕捉线程队列满的 拒绝处理
taskExecutor.setRejectedExecutionHandler((Runnable r, ThreadPoolExecutor exe) -> {
log.info("当前任务线程池队列已满.");
});
//初始化
taskExecutor.initialize();
return taskExecutor;
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return null;
}
}
...@@ -343,6 +343,18 @@ public class DateUtil { ...@@ -343,6 +343,18 @@ public class DateUtil {
return stringToDate2(dateString, ISO_EXPANDED_DATE_FORMAT); return stringToDate2(dateString, ISO_EXPANDED_DATE_FORMAT);
} }
/**
* @param dateString
* @param patten 格式
* @Description:
* @Author: hgw
* @Date: 2022/7/8 12:02
* @return: java.util.Date
**/
public static Date stringToDateByPatten(String dateString, String patten) {
return stringToDate2(dateString, patten);
}
/** /**
* @param pattern * @param pattern
* @param date * @param date
......
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.common.core.config.JacksonConfiguration,\ com.yifu.cloud.plus.v1.yifu.common.core.config.JacksonConfiguration,\
com.yifu.cloud.plus.v1.yifu.common.core.config.AsyncConfig,\
com.yifu.cloud.plus.v1.yifu.common.core.config.RedisTemplateConfiguration,\ com.yifu.cloud.plus.v1.yifu.common.core.config.RedisTemplateConfiguration,\
com.yifu.cloud.plus.v1.yifu.common.core.config.RestTemplateConfiguration,\ com.yifu.cloud.plus.v1.yifu.common.core.config.RestTemplateConfiguration,\
com.yifu.cloud.plus.v1.yifu.common.core.util.SpringContextHolder,\ com.yifu.cloud.plus.v1.yifu.common.core.util.SpringContextHolder,\
......
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