Commit 723aab68 authored by fangxinjiang's avatar fangxinjiang

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

parents 3dd3bdf0 528b3acd
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 项目档案表excel对应的实体
*
* @author huyc
* @date 2022-06-20 17:54:40
*/
@Data
@ColumnWidth(30)
public class EmployeeProjectVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工类型(字典值,0外包1派遣2代理)
*/
@NotNull(message = "员工类型不能为空")
@ExcelProperty(value ="员工类型")
private String empNatrue;
/**
* 员工姓名
*/
@NotNull(message = "员工姓名不能为空")
@ExcelProperty(value ="员工姓名")
private String empName;
/**
* 身份证号码
*/
@NotNull(message = "身份证号不能为空")
@ExcelProperty(value ="身份证号")
private String empIdcard;
/**
* 开户行
*/
@ExcelProperty(value ="开户行")
private String bankName;
/**
* 支行
*/
@ExcelProperty(value ="支行")
private String bankSubName;
/**
* 银行卡号
*/
@ExcelProperty(value ="银行卡号")
private String bankNo;
/**
* 项目编码
*/
@NotNull(message = "项目编码不能为空")
@ExcelProperty(value ="项目编码")
private String deptNo;
/**
* 合同类型(字典值)
*/
@NotNull(message = "合同类型不能为空")
@ExcelProperty(value ="合同类型")
private String contractType;
/**
* 工时制
*/
@ExcelProperty(value ="工时制")
private String workingHours;
/**
* 就职岗位
*/
@ExcelProperty(value ="就职岗位")
private String post;
/**
* 入职日期
*/
@ExcelProperty(value ="入职日期")
@Past
private LocalDateTime enjoinDate;
/**
* 试用期(单位月)
*/
@ExcelProperty(value ="试用期")
private String tryPeriod;
}
......@@ -20,16 +20,22 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.alibaba.fastjson.JSONObject;
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.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 项目档案表
......@@ -113,6 +119,8 @@ public class TEmployeeProjectController {
/**
* 新增项目档案校验
* @param tEmployeeProject 项目档案表
* @Author huyc
* @Date 2022-06-20
* @return R
*/
@Operation(summary = "新增项目档案校验", description = "新增项目档案校验")
......@@ -126,6 +134,8 @@ public class TEmployeeProjectController {
/**
* 复档复项相关操作
* @param jsonObject
* @Author huyc
* @Date 2022-06-20
* @return R
*/
@Operation(summary = "复档复项相关操作", description = "复档复项相关操作")
......@@ -139,7 +149,8 @@ public class TEmployeeProjectController {
/**
* 减项
* @param tEmployeeProject
* @return R
* @Author huyc
* @Date 2022-06-20
*/
@Operation(summary = "减项", description = "减项")
@SysLog("减项" )
......@@ -148,4 +159,21 @@ public class TEmployeeProjectController {
public R deleteEmpPro(@RequestBody TEmployeeProject tEmployeeProject) {
return R.ok(tEmployeeProjectService.deleteEmpPro(tEmployeeProject));
}
/**
* 批量新增项目档案信息
*
* @param excelVOList
* @return R<List>
* @Author huyc
* @Date 2022-06-20
**/
@Operation(description = "批量新增项目档案信息 hasPermission('wxhr:employeeProjectinfo_importListAdd')")
@SysLog("批量新增项目档案信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('wxhr:employeeProjectinfo_importListAdd')")
public R<List<ErrorMessage>> importListAdd(@RequestExcel List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, @RequestParam("idAdd") String idAdd) {
return tEmployeeProjectService.importListAdd(excelVOList, bindingResult, idAdd);
}
}
......@@ -19,8 +19,13 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
import java.util.List;
/**
* 项目档案表
......@@ -35,4 +40,6 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
R reEmpInfo(JSONObject jsonObject);
R deleteEmpPro(TEmployeeProject tEmployeeProject);
R<List<ErrorMessage>> importListAdd(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, String isAdd);
}
......@@ -16,10 +16,13 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDict;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpDisabilityInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
......@@ -27,13 +30,17 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDisabilityExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
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.R;
import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
/**
* 项目档案表
......@@ -48,11 +55,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
private TEmployeeLogService tEmployeeLogService;
private final String content1 = "档";
private final String content1 = "档";
private final String content2 = "项";
private final String content2 = "项";
private final String content3 = "减档减项";
private final String content3 = "复档复项";
private final String content4 = "减档减项";
@Override
public R addCheck(TEmployeeProject tEmployeeProject) {
......@@ -141,6 +150,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override
public R deleteEmpPro(TEmployeeProject tEmployeeProject) {
if (Common.isNotNull(tEmployeeProject)) {
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(tEmployeeProject.getEmpId());
if (tEmployeeProject.getIsLeaveEmployee()== CommonConstants.dingleDigitIntArray[1]) {
Long count = this.count(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpId,tEmployeeProject.getEmpId())
......@@ -148,12 +158,12 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (count.compareTo(CommonConstants.DEPT_TREE_ROOT_ID) >0) {
return R.failed("该人员存在其他进行中的项目,禁止同步减档!");
}
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(tEmployeeProject.getEmpId());
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfoService.updateById(tEmployeeInfo);
}
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
this.updateById(tEmployeeProject);
addEmpLog(CommonConstants.dingleDigitIntArray[2],tEmployeeInfo.getId(),tEmployeeProject.getId(),content4);
return R.ok();
}
return R.failed("传参为空!");
......@@ -176,4 +186,43 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeLog.setContent(content);
tEmployeeLogService.save(tEmployeeLog);
}
/**
* 新增档案操作记录
* @param excelVOList
* @param bindingResult
* @param
* @author huyc
* @date 2022-06-20 18:52:16
*/
@Override
public R<List<ErrorMessage>> importListAdd(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, String idAdd) {
// 通用校验获取失败的数据
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
// 个性化校验逻辑
List<TEmployeeProject> list = this.list();
// 执行数据插入操作 组装 PostDto
for (int i = 0; i < excelVOList.size(); i++) {
EmployeeProjectVO excel = excelVOList.get(i);
Set<String> errorMsg = new HashSet<>();
errorMessageList.add(new ErrorMessage((long) (i + 2), errorMsg));
}
if (CollUtil.isNotEmpty(errorMessageList)) {
return R.failed(errorMessageList);
}
return R.ok();
}
/**
* 插入excel Post
*/
private void insertExcelPost(EmployeeProjectVO excel) {
TEmployeeProject insert = new TEmployeeProject();
BeanUtil.copyProperties(excel, insert);
this.save(insert);
}
}
......@@ -210,7 +210,7 @@
<insert id="batchInsertUser" parameterType="java.util.List">
insert into sys_user
(user_id,username,phone,email,password,nickname)
(user_id,username,phone,email,password,nickname,create_time)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
......@@ -219,7 +219,8 @@
#{item.telephoneNumber,jdbcType=VARCHAR},
#{item.email,jdbcType=VARCHAR},
#{item.password,jdbcType=VARCHAR},
#{item.personName,jdbcType=VARCHAR}
#{item.personName,jdbcType=VARCHAR},
now()
)
</foreach>
</insert>
......@@ -255,6 +256,11 @@
</if>
</foreach>
</trim>
<trim prefix="update_time =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when username=#{i.uid} then now()
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
......@@ -272,6 +278,11 @@
</if>
</foreach>
</trim>
<trim prefix="update_time =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when username=#{i.userId} then now()
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
......
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