Commit 75b0d3f2 authored by fangxinjiang's avatar fangxinjiang

VO调整

parent 4ab2e911
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 java.io.Serializable;
/**
* @Author fxj
* @Date 2022/6/22
* @value
* @Version 1.0
*/
@Data
@ColumnWidth(30)
public class EmpCertificateExcelVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工姓名
*/
@NotNull(message = "员工姓名不可为空")
@ExcelProperty(value ="员工姓名")
private String empName;
/**
* 员工身份证
*/
@NotNull(message = "员工身份证不可为空")
@ExcelProperty(value ="员工身份证")
private String empIdcard;
/**
* 资格类型
*/
@NotNull(message = "资格类型不可为空")
@ExcelProperty(value ="资格类型")
private String qualificationType;
/**
* 资格等级
*/
@NotNull(message = "资格等级不可为空")
@ExcelProperty(value ="资格等级")
private String qualificationLevel;
/**
* 证书编号
*/
@ExcelProperty(value ="证书编号")
private String certificationNo;
/**
* 获取方式
*/
@ExcelProperty(value ="获取方式")
private String obtainType;
/**
* 评定机构
*/
@ExcelProperty(value ="评定机构")
private String assessmentUnit;
/**
* 申报年度
*/
@ExcelProperty(value ="申报年度")
private String declareYear;
/**
* 是否最高资格0是/1否
*/
@NotNull(message = "是否最高资格不可为空")
@ExcelProperty(value ="是否最高资格")
private String heightIdentification;
/**
* 备注
*/
@ExcelProperty(value ="备注")
private String remark;
}
......@@ -27,10 +27,10 @@ public class EmpDisabilityExcelVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工编码
* 员工身份证
*/
@NotNull(message = "员工编码不能为空")
@ExcelProperty(value ="员工编码")
@NotNull(message = "员工身份证不能为空")
@ExcelProperty(value ="员工身份证")
private String empCode;
/**
* 员工姓名
......
......@@ -3,8 +3,6 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
......@@ -26,75 +24,88 @@ public class EmpEducationExcelVO implements Serializable {
/**
* 员工姓名
*/
@Schema(description ="员工姓名")
@NotNull(message = "员工姓名不可为空")
@ExcelProperty(value ="员工姓名")
private String empName;
/**
* 身份证号
*/
@Schema(description ="身份证号")
@NotNull(message = "员工身份证不可为空")
@ExcelProperty(value ="员工身份证")
private String empIdcard;
/**
* 入学时间
*/
@NotNull(message = "入学时间不可为空")
@DateTimeFormat("YYYY-MM-dd")
@Schema(description ="入学时间")
@ExcelProperty(value ="入学时间")
private LocalDateTime entryDate;
/**
* 结业日期
*/
@NotNull(message = "毕业时间不可为空")
@DateTimeFormat("YYYY-MM-dd")
@Schema(description ="毕业时间")
@ExcelProperty(value ="毕业时间")
private LocalDateTime gradutionDate;
/**
* 学历名称
*/
@Schema(description ="学历")
@NotNull(message = "学历不可为空")
@ExcelProperty(value ="学历")
private String educationName;
/**
* 学校名称
*/
@Schema(description ="学校名")
@NotNull(message = "学校不可为空")
@ExcelProperty(value ="学校")
private String school;
/**
* 专业
*/
@ExcelProperty(value ="专业")
private String major;
/**
* 学制类型:四年、三年、五年、二年
*/
@Schema(description ="学制")
@ExcelProperty(value ="学制")
private String educationSystem;
/**
* 最高学历标识0是/1否
*/
@Schema(description ="最高学历标识")
@NotNull(message = "最高学历标识不可为空")
@ExcelProperty(value ="最高学历标识")
private String highIdentification;
/**
* 学历类型:全日制、自考、函授等
*/
@Schema(description ="学历类型")
@ExcelProperty(value ="学历类型")
private String type;
/**
* 院系名称
*/
@Schema(description ="院系")
@ExcelProperty(value ="院系")
private String collageSystem;
/**
* 证书名称
*/
@Schema(description ="证书名称")
@ExcelProperty(value ="证书名称")
private String certificationName;
/**
* 备注
*/
@Schema(description ="备注")
@ExcelProperty(value ="备注")
private String remark;
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* @Author fxj
* @Date 2022/6/20
......@@ -14,5 +19,79 @@ public class EmpEducationUpdateExcelVo extends EmpEducationExcelVO{
* @Author fxj
* @Description 主键
**/
@NotNull(message = "主键不可为空")
@ExcelProperty(value ="主键")
private String id;
/**
* 入学时间
*/
@NotNull(message = "入学时间不可为空")
@DateTimeFormat("YYYY-MM-dd")
@ExcelProperty(value ="入学时间")
private LocalDateTime entryDate;
/**
* 结业日期
*/
@NotNull(message = "毕业时间不可为空")
@DateTimeFormat("YYYY-MM-dd")
@ExcelProperty(value ="毕业时间")
private LocalDateTime gradutionDate;
/**
* 学历名称
*/
@NotNull(message = "学历不可为空")
@ExcelProperty(value ="学历")
private String educationName;
/**
* 学校名称
*/
@NotNull(message = "学校不可为空")
@ExcelProperty(value ="学校")
private String school;
/**
* 专业
*/
@ExcelProperty(value ="专业")
private String major;
/**
* 学制类型:四年、三年、五年、二年
*/
@ExcelProperty(value ="学制")
private String educationSystem;
/**
* 最高学历标识0是/1否
*/
@NotNull(message = "最高学历标识不可为空")
@ExcelProperty(value ="最高学历标识")
private String highIdentification;
/**
* 学历类型:全日制、自考、函授等
*/
@ExcelProperty(value ="学历类型")
private String type;
/**
* 院系名称
*/
@ExcelProperty(value ="院系")
private String collageSystem;
/**
* 证书名称
*/
@ExcelProperty(value ="证书名称")
private String certificationName;
/**
* 备注
*/
@ExcelProperty(value ="备注")
private String remark;
}
......@@ -17,6 +17,11 @@
<dependencies>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-check-api</artifactId>
<version>1.0.0</version>
</dependency>
<!-- seata 依赖 -->
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
......
......@@ -20,14 +20,18 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpProfessionalQualification;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpProfessionalQualificationService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpCertificateExcelVO;
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;
......@@ -45,7 +49,7 @@ import java.util.List;
@Tag(name = "员工职业资格信息表管理")
public class TEmpProfessionalQualificationController {
private final TEmpProfessionalQualificationService tEmpProfessionalQualificationService;
private final TEmpProfessionalQualificationService qualificationService;
/**
* 分页查询
......@@ -56,7 +60,7 @@ public class TEmpProfessionalQualificationController {
@Operation(description = "分页查询")
@GetMapping("/page" )
public R<IPage<TEmpProfessionalQualification>> getTEmpProfessionalQualificationPage(Page page, TEmpProfessionalQualification tEmpProfessionalQualification) {
return R.ok(tEmpProfessionalQualificationService.page(page, Wrappers.query(tEmpProfessionalQualification)));
return R.ok(qualificationService.page(page, Wrappers.query(tEmpProfessionalQualification)));
}
/**
* 不分页查询
......@@ -66,7 +70,7 @@ public class TEmpProfessionalQualificationController {
@Operation(description = "不分页查询")
@GetMapping("/noPage" )
public R<List<TEmpProfessionalQualification>> getTEmpProfessionalQualificationNoPage(TEmpProfessionalQualification tEmpProfessionalQualification) {
return R.ok(tEmpProfessionalQualificationService.list(Wrappers.query(tEmpProfessionalQualification)));
return R.ok(qualificationService.list(Wrappers.query(tEmpProfessionalQualification)));
}
/**
......@@ -78,7 +82,7 @@ public class TEmpProfessionalQualificationController {
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('archives_tempprofessionalqualification_get')" )
public R getById(@PathVariable("id" ) String id) {
return R.ok(tEmpProfessionalQualificationService.getById(id));
return R.ok(qualificationService.getById(id));
}
/**
......@@ -91,7 +95,7 @@ public class TEmpProfessionalQualificationController {
@PostMapping
@PreAuthorize("@pms.hasPermission('archives_tempprofessionalqualification_add')" )
public R<Boolean> save(@RequestBody TEmpProfessionalQualification tEmpProfessionalQualification) {
return tEmpProfessionalQualificationService.saveDiy(tEmpProfessionalQualification);
return qualificationService.saveDiy(tEmpProfessionalQualification);
}
/**
......@@ -104,7 +108,7 @@ public class TEmpProfessionalQualificationController {
@PutMapping
@PreAuthorize("@pms.hasPermission('archives_tempprofessionalqualification_edit')" )
public R updateById(@RequestBody TEmpProfessionalQualification tEmpProfessionalQualification) {
return R.ok(tEmpProfessionalQualificationService.updateById(tEmpProfessionalQualification));
return R.ok(qualificationService.updateById(tEmpProfessionalQualification));
}
/**
......@@ -117,7 +121,21 @@ public class TEmpProfessionalQualificationController {
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('archives_tempprofessionalqualification_del')" )
public R removeById(@PathVariable String id) {
return R.ok(tEmpProfessionalQualificationService.removeById(id));
return R.ok(qualificationService.removeById(id));
}
/**
* 批量新增员工证书信息
*
* @param excelVOList
* @return
* @Author fxj
* @Date 2019-08-16
**/
@Operation(description = "批量新增员工证书信息 hasPermission('archives-professionalqualification-batch-import')")
@SysLog("批量新增员工证书信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('archives-professionalqualification-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestExcel List<EmpCertificateExcelVO> excelVOList, BindingResult bindingResult) {
return qualificationService.importEmpCertificate(excelVOList, bindingResult);
}
}
......@@ -18,8 +18,13 @@
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpProfessionalQualification;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpCertificateExcelVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
import java.util.List;
/**
* 员工职业资格信息表
......@@ -30,4 +35,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
public interface TEmpProfessionalQualificationService extends IService<TEmpProfessionalQualification> {
R<Boolean> saveDiy(TEmpProfessionalQualification tEmpProfessionalQualification);
R<List<ErrorMessage>> importEmpCertificate(List<EmpCertificateExcelVO> excelVOList, BindingResult bindingResult);
}
......@@ -253,7 +253,6 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
insert.setDeleteFlag(CommonConstants.ZERO_STRING);
insert.setEmpCode(emp.getEmpCode());
insert.setEmpId(emp.getId());
insert.setEmpCode(emp.getEmpCode());
// 更新档案学历信息
updateEducationOfEmp(insert);
this.save(insert);
......
......@@ -156,7 +156,6 @@ public class TEmpFamilyServiceImpl extends ServiceImpl<TEmpFamilyMapper, TEmpFam
insert.setDeleteFlag(CommonConstants.ZERO_STRING);
insert.setEmpCode(emp.getEmpCode());
insert.setEmpId(emp.getId());
insert.setEmpCode(emp.getEmpCode());
this.save(insert);
}
}
......@@ -16,18 +16,28 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpProfessionalQualification;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TAttaInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpProfessionalQualificationMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpProfessionalQualificationService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpCertificateExcelVO;
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 lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult;
import java.util.List;
import java.util.*;
/**
* 员工职业资格信息表
......@@ -41,6 +51,8 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr
private final TAttaInfoMapper attaInfoMapper;
private final TEmployeeInfoMapper employeeInfoMapper;
@Override
public R<Boolean> saveDiy(TEmpProfessionalQualification qualification) {
qualification.setDeleteFlag(CommonConstants.ZERO_STRING);
......@@ -56,4 +68,87 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr
}
return R.ok();
}
@Override
public R<List<ErrorMessage>> importEmpCertificate(List<EmpCertificateExcelVO> excelVOList, BindingResult bindingResult) {
// 通用校验获取失败的数据
List<ErrorMessage> errorList = (List<ErrorMessage>) bindingResult.getTarget();
Map<Long,ErrorMessage> errorMsgMap = new HashMap<>();
if (Common.isNotNull(errorList)){
errorList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(),errorMessage));
}
// 个性化校验逻辑
List<TEmpProfessionalQualification> list = this.list();
TEmployeeInfo emp;
TEmpProfessionalQualification exist;
Set<String> errorMsg;
List<ErrorMessage> temp = new ArrayList<>();
ErrorMessage errorMessage = null;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
errorMessage = errorMsgMap.get(i+2);
if (Common.isNotNull(errorMessage)){
temp.add(errorMessage);
continue;
}
errorMsg = new HashSet<>();
EmpCertificateExcelVO excel = excelVOList.get(i);
emp = employeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
checkRes(list, emp, errorMsg, excel);
exist = baseMapper.selectOne(Wrappers.<TEmpProfessionalQualification>query().lambda()
.eq(TEmpProfessionalQualification::getQualificationLevel,excel.getQualificationLevel())
.eq(TEmpProfessionalQualification::getQualificationType,excel.getQualificationType())
.eq(TEmpProfessionalQualification::getDeleteFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(exist)){
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_FAMILY_NAME_EXISTING, excel.getEmpName()));
}
// 数据合法情况
if (CollUtil.isEmpty(errorMsg)) {
insertExcelPost(excel,emp);
errorMsg.add(CommonConstants.SAVE_SUCCESS);
temp.add(new ErrorMessage((long) (i + 2), errorMsg));
} else {
// 数据不合法
temp.add(new ErrorMessage((long) (i + 2), errorMsg));
}
}
return R.ok(temp);
}
/**
* 插入excel family
*/
private void insertExcelPost(EmpCertificateExcelVO excel,TEmployeeInfo emp) {
TEmpProfessionalQualification insert = new TEmpProfessionalQualification();
BeanUtil.copyProperties(excel, insert);
insert.setDeleteFlag(CommonConstants.ZERO_STRING);
insert.setEmpCode(emp.getEmpCode());
insert.setEmpId(emp.getId());
this.save(insert);
}
private void checkRes(List<TEmpProfessionalQualification> list, TEmployeeInfo emp, Set<String> errorMsg, EmpCertificateExcelVO excel) {
if (Common.isEmpty(emp)){
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_NOT_EXIST, excel.getEmpIdcard()));
return;
}
if (CommonConstants.ONE_STRING.equals(emp.getFileStatus())){
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_REDUCED, excel.getEmpIdcard()));
return;
}
// 检查添加人员是否已经存在
boolean match = list.stream().anyMatch(info -> excel.getQualificationLevel()
.equals(info.getQualificationLevel())
&& excel.getEmpIdcard().equals(info.getEmpIdcard())
&& excel.getQualificationType().equals(info.getQualificationType()));
if (match) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_FAMILY_NAME_EXISTING, excel.getEmpName()));
return;
}
}
}
......@@ -184,7 +184,6 @@ public class TEmpWorkRecordingServiceImpl extends ServiceImpl<TEmpWorkRecordingM
insert.setDeleteFlag(CommonConstants.ZERO_STRING);
insert.setEmpCode(emp.getEmpCode());
insert.setEmpId(emp.getId());
insert.setEmpCode(emp.getEmpCode());
this.save(insert);
}
}
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