Commit 4f4298c5 authored by fangxinjiang's avatar fangxinjiang

测试环境校验服务

parent 191f3bb5
......@@ -327,5 +327,12 @@ public interface ErrorCodes {
* 该人员项目档案已减项,不允许划转
*/
String PROJECT_PERSON_DELETE_EXIT = "project.person.delete.exit";
/**
* 派单员工合同相关信息不可为空
*/
String EMP_DISPATCH_CONTRACT_NOT_EMPTY = "emp.dispatch.contract.not.empty";
/**
* 派单员工社保相关信息不可为空
*/
String EMP_DISPATCH_SOCIAL_NOT_EMPTY = "emp.dispatch.social.not.empty";
}
......@@ -106,8 +106,15 @@ change.strat.month.exit=\u5212\u8F6C\u8D77\u59CB\u6708\u4E0D\u80FD\u4E3A\u7A7A
change.less.month.exit=\u5212\u8F6C\u8D77\u59CB\u6708\u8981\u5C0F\u4E8E\u7B49\u4E8E\u5F53\u524D\u6708
project.person.search.exit=\u672A\u627E\u5230\u8BE5\u4EBA\u5458\u7684\u9879\u76EE\u6863\u6848\uFF0C\u8BF7\u6838\u5B9E
project.person.delete.exit=\u8BE5\u4EBA\u5458\u9879\u76EE\u6863\u6848\u5DF2\u51CF\u9879\uFF0C\u4E0D\u5141\u8BB8\u5212\u8F6C
emp.dispatch.contract.not.empty=\u6D3E\u5355\u5458\u5DE5\u5408\u540C\u76F8\u5173\u4FE1\u606F\u4E0D\u53EF\u4E3A\u7A7A
emp.dispatch.social.not.empty=\u6D3E\u5355\u5458\u5DE5\u793E\u4FDD\u76F8\u5173\u4FE1\u606F\u4E0D\u53EF\u4E3A\u7A7A
......
/*
* 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.social.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 派单信息记录表
*
* @author fxj
* @date 2022-07-15 11:38:05
*/
@Data
public class TDispatchImportVo extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@Length(max = 50, message = "员工姓名 不能超过50 个字符" )
@ExcelAttribute(name = "员工姓名", maxLength = 50, isNotEmpty = true)
@Schema(description = "员工姓名" )
@ExcelProperty("员工姓名" )
private String empName;
/**
* 身份证号
*/
@Length(max = 20, message = "身份证号 不能超过20 个字符" )
@ExcelAttribute(name = "身份证号", maxLength = 20, isNotEmpty = true)
@Schema(description = "身份证号" )
@ExcelProperty("身份证号" )
private String empIdcard;
/**
* 员工类型
*/
@Length(max = 32, message = "员工类型 不能超过32 个字符" )
@ExcelAttribute(name = "员工类型", maxLength = 32, isDataId = true,dataType = ExcelAttributeConstants.EMP_NATRUE, isNotEmpty = true)
@Schema(description = "员工类型" )
@ExcelProperty("员工类型" )
private String empType;
/**
* 手机号码
*/
@Length(max = 32, message = "手机号码 不能超过32 个字符" )
@ExcelAttribute(name = "手机号码", maxLength = 32, isNotEmpty = true)
@Schema(description = "手机号码" )
@ExcelProperty("手机号码" )
private String empMobile;
/**
* 项目编码
*/
@Length(max = 32, message = "项目编码 不能超过32 个字符" )
@ExcelAttribute(name = "项目编码", maxLength = 32, isNotEmpty = true)
@Schema(description = "项目编码" )
@ExcelProperty("项目编码" )
private String settleDomainCode;
/**
* 身份证省
*/
@ExcelAttribute(name = "身份证省" ,isArea = true)
@Schema(description = "身份证省" )
@ExcelProperty("身份证省" )
private Integer idCardProvince;
/**
* 身份证市
*/
@ExcelAttribute(name = "身份证市" ,isArea = true,parentField = "idCardProvince")
@Schema(description = "身份证市" )
@ExcelProperty("身份证市" )
private Integer idCardCity;
/**
* 身份证县
*/
@ExcelAttribute(name = "身份证县",isArea = true,parentField = "idCardCity")
@Schema(description = "身份证县" )
@ExcelProperty("身份证县" )
private Integer idCardTown;
/**
* 身份证所在地
*/
@ExcelAttribute(name = "身份证所在地")
@Schema(description = "身份证所在地" )
@ExcelProperty("身份证所在地" )
private Integer idCardAddress;
/**
* 档案-省
*/
@ExcelAttribute(name = "档案-省" ,isArea = true)
@Schema(description = "档案-省" )
@ExcelProperty("档案-省" )
private Integer fileProvince;
/**
* 档案-市
*/
@ExcelAttribute(name = "档案-市" ,isArea = true,parentField = "fileProvince", isNotEmpty = true)
@Schema(description = "档案-市" )
@ExcelProperty("档案-市" )
private Integer fileCity;
/**
* 档案-县
*/
@ExcelAttribute(name = "档案-县" ,isArea = true,parentField = "fileCity", isNotEmpty = true)
@Schema(description = "档案-县" )
@ExcelProperty("档案-县" )
private Integer fileTown;
/**
* 就职班组
*/
@Length(max = 50, message = "就职班组 不能超过50 个字符" )
@ExcelAttribute(name = "就职班组", maxLength = 50)
@Schema(description = "就职班组" )
@ExcelProperty("就职班组" )
private String inauguralTeam;
/**
* 就职岗位
*/
@Length(max = 30, message = "就职岗位 不能超过30 个字符" )
@ExcelAttribute(name = "就职岗位", maxLength = 30, isNotEmpty = true)
@Schema(description = "就职岗位" )
@ExcelProperty("就职岗位" )
private String post;
/**
* 试用期(单位月)
*/
@Length(max = 2, message = "试用期 不能超过2 个字符" )
@ExcelAttribute(name = "试用期", maxLength = 32)
@Schema(description = "试用期" )
@ExcelProperty("试用期" )
private String tryPeriod;
/**
* 工时制:1标准工时 2 综合工时 3不定时工时制
*/
@Length(max = 1, message = "工时制 不能超过1 个字符" )
@ExcelAttribute(name = "工时制", maxLength = 1, isDataId = true,dataType = ExcelAttributeConstants.WORKING_HOURS, isNotEmpty = true)
@Schema(description = "工时制:1标准工时 2 综合工时 3不定时工时制" )
@ExcelProperty("工时制" )
private String workingHours;
/**
* 民族
*/
@Length(max = 32, message = "民族 不能超过32 个字符" )
@ExcelAttribute(name = "民族", maxLength = 32, isDataId = true,dataType = ExcelAttributeConstants.EMP_NATIONAL, isNotEmpty = true)
@Schema(description = "民族" )
@ExcelProperty("民族" )
private String empNational;
/**
* 户口性质
*/
@Length(max = 32, message = "户口性质 不能超过32 个字符" )
@ExcelAttribute(name = "户口性质", maxLength = 32, isDataId = true,dataType = ExcelAttributeConstants.EMP_REGISTYPE)
@Schema(description = "户口性质" )
@ExcelProperty("户口性质" )
private String empRegisType;
/**
* 合同类型
*/
@Length(max = 32, message = "合同类型 不能超过32 个字符" )
@ExcelAttribute(name = "合同类型", maxLength = 32, isDataId = true,dataType = ExcelAttributeConstants.PERSONNEL_TYPE)
@Schema(description = "合同类型" )
@ExcelProperty("合同类型" )
private String contractName;
/**
* 业务细分 personnel_type_sub
*/
@ExcelAttribute(name = "业务细分", maxLength = 32, isDataId = true,dataType = ExcelAttributeConstants.PERSONNEL_TYPE_SUB)
@Schema(description = "业务细分", name = "contractName")
private String contractSubName;
/**
* 签订期限
* 0 已完成一定工作任务为期限
* 1 固定期限
* 2 无固定期限
*/
@NotBlank(message = "签订期限不能为空")
@Length(max = 32, message = "签订期限不能超过32个字符")
@ExcelAttribute(name = "签订期限", maxLength = 32, isDataId = true, dataType = ExcelAttributeConstants.EMPLOYEE_CONTRACT_TYPE)
@Schema(description = "签订期限", name = "contractType")
private String contractType;
/**
* 合同起始时间
*/
@ExcelAttribute(name = "合同起始时间", isDate = true)
@Schema(description = "合同起始时间" )
@ExcelProperty("合同起始时间" )
private Date contractStart;
/**
* 合同到期时间
*/
@ExcelAttribute(name = "合同到期时间", isDate = true)
@Schema(description = "合同到期时间" )
@ExcelProperty("合同到期时间" )
private Date contractEnd;
/**
* 合同期限
*/
@ExcelAttribute(name = "合同期限", isInteger = true )
@Schema(description = "合同期限" )
@ExcelProperty("合同期限" )
private Integer contractTerm;
/**
* 学历名称
*/
@ExcelAttribute(name = "学历",isDataId = true,dataType = ExcelAttributeConstants.EDUCATION)
@NotNull(message = "学历不可为空")
@Schema(description = "学历:无档案的时候 新增档案时同步新增学历" )
@ExcelProperty(value ="学历")
private String educationName;
/**
* 备案基数
*/
@Length(max = 255, message = "备案基数 不能超过255 个字符" )
@ExcelAttribute(name = "备案基数", maxLength = 255)
@Schema(description = "备案基数:购买社保时必填" )
@ExcelProperty("备案基数" )
private String recordBase;
/**
* 社保户
*/
@Length(max = 32, message = "社保户 不能超过32个字符" )
@ExcelAttribute(name = "社保户", maxLength = 32)
@Schema(description = "社保户" )
@ExcelProperty("社保户" )
private String socialHousehold;
/**
* 养老起缴日期
*/
@ExcelAttribute(name = "养老起缴日期", isDate = true)
@Schema(description = "养老起缴日期:购买社保时必填" )
@ExcelProperty("养老起缴日期" )
private Date pensionStart;
/**
* 医疗起缴日期
*/
@ExcelAttribute(name = "医疗起缴日期", isDate = true)
@Schema(description = "医疗起缴日期" )
@ExcelProperty("医疗起缴日期" )
private Date medicalStart;
/**
* 失业起缴日期
*/
@ExcelAttribute(name = "失业起缴日期", isDate = true)
@Schema(description = "失业起缴日期" )
@ExcelProperty("失业起缴日期" )
private Date unemployStart;
/**
* 工伤起缴日期
*/
@ExcelAttribute(name = "工伤起缴日期", isDate = true)
@Schema(description = "工伤起缴日期" )
@ExcelProperty("工伤起缴日期" )
private Date workInjuryStart;
/**
* 生育起缴日期
*/
@ExcelAttribute(name = "生育起缴日期", isDate = true)
@Schema(description = "生育起缴日期" )
@ExcelProperty("生育起缴日期" )
private Date birthStart;
/**
* 大病起缴日期
*/
@ExcelAttribute(name = "大病起缴日期", isDate = true)
@Schema(description = "大病起缴日期" )
@ExcelProperty("大病起缴日期" )
private Date bigailmentStart;
/**
* 缴纳类型(0最低缴纳、1自定义缴纳、2最高缴纳)
*/
@Length(max = 1, message = "缴纳类型 不能超过1 个字符" )
@ExcelAttribute(name = "缴纳类型", maxLength = 1, isDataId = true, readConverterExp = "0=最低缴纳,1=自定义缴纳,2=最高缴纳")
@Schema(description = "缴纳类型:(0最低缴纳、1自定义缴纳、2最高缴纳)" )
@ExcelProperty("缴纳类型" )
private String paymentType;
/**
* 养老基数
*/
@ExcelAttribute(name = "养老基数" )
@Schema(description = "养老基数" )
@ExcelProperty("养老基数" )
private BigDecimal pensionCardinal;
/**
* 医疗基数
*/
@ExcelAttribute(name = "医疗基数" )
@Schema(description = "医疗基数" )
@ExcelProperty("医疗基数" )
private BigDecimal medicalCardinal;
/**
* 失业基数
*/
@ExcelAttribute(name = "失业基数" )
@Schema(description = "失业基数" )
@ExcelProperty("失业基数" )
private BigDecimal unemploymentCardinal;
/**
* 工伤基数
*/
@ExcelAttribute(name = "工伤基数" )
@Schema(description = "工伤基数" )
@ExcelProperty("工伤基数" )
private BigDecimal workInjuryCardinal;
/**
* 生育基数
*/
@ExcelAttribute(name = "生育基数" )
@Schema(description = "生育基数" )
@ExcelProperty("生育基数" )
private BigDecimal birthCardinal;
/**
* 大病基数
*/
@ExcelAttribute(name = "大病基数" )
@Schema(description = "大病基数" )
@ExcelProperty("大病基数" )
private BigDecimal bigailmentCardinal;
/**
* 公积金户
*/
@Length(max = 32, message = "公积金户 不能超过32 个字符" )
@ExcelAttribute(name = "公积金户", maxLength = 32)
@Schema(description = "公积金户" )
@ExcelProperty("公积金户" )
private String providentHousehold;
/**
* 公积金起缴日期
*/
@ExcelAttribute(name = "公积金起缴日期", isDate = true)
@Schema(description = "公积金起缴日期" )
@ExcelProperty("公积金起缴日期" )
private Date providentStart;
/**
* 公积金基数
*/
@ExcelAttribute(name = "公积金基数" )
@Schema(description = "公积金基数" )
@ExcelProperty("公积金基数" )
private BigDecimal providentCardinal;
/**
* 公积金缴纳比例
*/
@ExcelAttribute(name = "公积金缴纳比例" )
@Schema(description = "公积金缴纳比例" )
@ExcelProperty("公积金缴纳比例" )
private BigDecimal providentPer;
/**
* 委托备注
*/
@Length(max = 100, message = "委托备注 不能超过100 个字符" )
@ExcelAttribute(name = "委托备注", maxLength = 100)
@Schema(description = "委托备注" )
@ExcelProperty("委托备注" )
private String trustRemark;
}
......@@ -31,13 +31,15 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.social.entity.TDispatchInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TDispatchInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TDispatchInfoService;
import com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchImportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoVo;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
......@@ -48,6 +50,7 @@ import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* 派单信息记录表
*
......@@ -59,20 +62,22 @@ import java.util.List;
public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, TDispatchInfo> implements TDispatchInfoService {
/**
* 派单信息记录表简单分页查询
*
* @param tDispatchInfo 派单信息记录表
* @return
*/
@Override
public IPage<TDispatchInfo> getTDispatchInfoPage(Page<TDispatchInfo> page, TDispatchInfo tDispatchInfo){
return baseMapper.getTDispatchInfoPage(page,tDispatchInfo);
public IPage<TDispatchInfo> getTDispatchInfoPage(Page<TDispatchInfo> page, TDispatchInfo tDispatchInfo) {
return baseMapper.getTDispatchInfoPage(page, tDispatchInfo);
}
/**
* 派单信息记录表批量导出
*
* @return
*/
@Override
public void listExport(HttpServletResponse response, TDispatchInfoSearchVo searchVo){
public void listExport(HttpServletResponse response, TDispatchInfoSearchVo searchVo) {
String fileName = "不良记录批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TDispatchInfo> list = new ArrayList<>();
......@@ -82,45 +87,45 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
out = response.getOutputStream();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName , "UTF-8"));
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, TDispatchInfo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
if (Common.isNotNull(list)){
if (Common.isNotNull(list)) {
ExcelUtil<TDispatchInfo> util = new ExcelUtil<>(TDispatchInfo.class);
for (TDispatchInfo vo:list){
util.convertEntity(vo,null,null,null);
for (TDispatchInfo vo : list) {
util.convertEntity(vo, null, null, null);
}
}
if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet("派单信息记录表"+index).build();
excelWriter.write(list,writeSheet);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("派单信息记录表" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)){
if (Common.isNotNull(list)) {
list.clear();
}
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("派单信息记录表"+index).build();
excelWriter.write(list,writeSheet);
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("派单信息记录表" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)){
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
}catch (Exception e){
log.error("执行异常" ,e);
}finally {
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
......@@ -135,11 +140,11 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
public List<TDispatchInfo> noPageDiy(TDispatchInfoSearchVo searchVo) {
LambdaQueryWrapper<TDispatchInfo> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)){
wrapper.in(TDispatchInfo::getId,idList);
if (Common.isNotNull(idList)) {
wrapper.in(TDispatchInfo::getId, idList);
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0){
wrapper.last(" limit "+ searchVo.getLimitStart() +","+ searchVo.getLimitEnd());
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
}
wrapper.orderByDesc(BaseEntity::getCreateTime);
return baseMapper.selectList(wrapper);
......@@ -148,21 +153,21 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private Long noPageCountDiy(TDispatchInfoSearchVo searchVo) {
LambdaQueryWrapper<TDispatchInfo> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)){
wrapper.in(TDispatchInfo::getId,idList);
if (Common.isNotNull(idList)) {
wrapper.in(TDispatchInfo::getId, idList);
}
return baseMapper.selectCount(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(TDispatchInfoSearchVo entity){
private LambdaQueryWrapper buildQueryWrapper(TDispatchInfoSearchVo entity) {
LambdaQueryWrapper<TDispatchInfo> wrapper = Wrappers.lambdaQuery();
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(TDispatchInfo::getCreateTime, entity.getCreateTimes()[0])
.le(TDispatchInfo::getCreateTime,
entity.getCreateTimes()[1]);
}
if (Common.isNotNull(entity.getCreateName())){
wrapper.eq(TDispatchInfo::getCreateName,entity.getCreateName());
if (Common.isNotNull(entity.getCreateName())) {
wrapper.eq(TDispatchInfo::getCreateName, entity.getCreateName());
}
return wrapper;
}
......@@ -170,12 +175,13 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TDispatchInfoVo> util1 = new ExcelUtil<>(TDispatchInfoVo.class);;
ExcelUtil<TDispatchImportVo> util1 = new ExcelUtil<>(TDispatchImportVo.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, TDispatchInfoVo.class, new ReadListener<TDispatchInfoVo>() {
EasyExcel.read(inputStream, TDispatchImportVo.class, new ReadListener<TDispatchImportVo>() {
/**
* 单次缓存的数据量
*/
......@@ -183,17 +189,17 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
/**
*临时存储
*/
private List<TDispatchInfoVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
private List<TDispatchImportVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(TDispatchInfoVo data, AnalysisContext context) {
public void invoke(TDispatchImportVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage);
}else {
} else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
......@@ -202,6 +208,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
......@@ -212,33 +219,66 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTDispatchInfo(cachedDataList,errorMessageList);
importTDispatchInfo(cachedDataList, errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
} catch (Exception e) {
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private void importTDispatchInfo(List<TDispatchInfoVo> excelVOList, List<ErrorMessage> errorMessageList) {
@GlobalTransactional
private void importTDispatchInfo(List<TDispatchImportVo> excelVOList, List<ErrorMessage> errorMessageList) {
// 个性化校验逻辑
ErrorMessage errorMsg;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
TDispatchInfoVo excel = excelVOList.get(i);
// 数据合法情况 TODO
TDispatchImportVo excel = excelVOList.get(i);
// 数据合法情况
if (Common.isNotNull(excel.getContractName()) && (
Common.isEmpty(excel.getContractSubName())
|| Common.isEmpty(excel.getContractType())
|| Common.isEmpty(excel.getContractStart())
|| Common.isEmpty(excel.getContractEnd())
)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_CONTRACT_NOT_EMPTY)));
continue;
}
if (Common.isNotNull(excel.getSocialHousehold()) && (
Common.isEmpty(excel.getRecordBase())
|| Common.isEmpty(excel.getPensionStart())
|| Common.isEmpty(excel.getPaymentType())
|| Common.isEmpty(excel.getPensionCardinal())
)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SOCIAL_NOT_EMPTY)));
continue;
}
// 无档案无项目档案无合同无学历
// 有档案无项目档案无合同
// 有档案有项目档案无合同
// 新增社保
// 新增公积金
// 变更社保公积金查询
// 插入
insertExcel(excel);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),CommonConstants.SAVE_SUCCESS));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS));
}
}
/**
* 插入excel bad record
*/
private void insertExcel(TDispatchInfoVo excel) {
private void insertExcel(TDispatchImportVo excel) {
TDispatchInfo insert = new TDispatchInfo();
BeanUtil.copyProperties(excel, insert);
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