Commit fefe49f2 authored by fangxinjiang's avatar fangxinjiang

不良记录导入

parent f8f39414
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
......@@ -22,36 +21,32 @@ public class EmpBadRecordVo extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名" ,maxLength = 20, isNotEmpty = true)
@ExcelAttribute(name = "员工姓名" ,maxLength = 20)
@Schema(description ="员工姓名")
@ExcelProperty("员工姓名")
private String empName;
/**
* 员工ID
*/
@ExcelAttribute(name = "员工ID")
@Schema(description ="员工ID")
private String empId;
/**
* 身份证号
*/
@ExcelAttribute(name = "身份证号" ,maxLength = 20, isNotEmpty = true)
@Schema(description ="身份证号")
@ExcelProperty("身份证号")
private String empIdcard;
/**
* 产生项目
*/
@ExcelAttribute(name = "产生项目" ,maxLength = 50, isNotEmpty = true)
@Schema(description ="产生项目")
@ExcelIgnore
private String project;
/**
* 项目编码
*/
@ExcelAttribute(name = "项目编码" ,maxLength = 50, isNotEmpty = true)
@Schema(description ="项目编码")
@ExcelAttribute(name = "产生项目编码" ,maxLength = 50, isNotEmpty = true)
@Schema(description ="产生项目编码")
@ExcelProperty("产生项目编码")
private String projectCode;
/**
......@@ -59,13 +54,15 @@ public class EmpBadRecordVo extends RowIndex implements Serializable {
*/
@ExcelAttribute(name = "发生时间" , isNotEmpty = true)
@Schema(description ="发生时间")
@ExcelProperty("发生时间")
private Date happenTime;
/**
* 备注
*/
@ExcelAttribute(name = "备注", maxLength = 200, isNotEmpty = true)
@Schema(description ="备注")
@ExcelAttribute(name = "不良记录描述", maxLength = 200, isNotEmpty = true)
@Schema(description ="不良记录描述")
@ExcelProperty("不良记录描述")
private String remark;
/**
......@@ -73,6 +70,7 @@ public class EmpBadRecordVo extends RowIndex implements Serializable {
*/
@ExcelAttribute(name = "费用损失 " )
@Schema(description ="费用损失 (费用损失与其他费用损失其一必填)")
@ExcelProperty("费用损失")
private BigDecimal loseFee;
/**
......@@ -80,5 +78,6 @@ public class EmpBadRecordVo extends RowIndex implements Serializable {
*/
@ExcelAttribute(name = "其他损失" )
@Schema(description ="其他损失 (费用损失与其他费用损失其一必填)")
@ExcelProperty("其他损失")
private BigDecimal loseFeeOther;
}
......@@ -152,6 +152,10 @@ public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, T
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
EmpBadRecordVo excel = excelVOList.get(i);
if (Common.isEmpty(excel.getLoseFee()) && Common.isEmpty(excel.getLoseFeeOther())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_EMP_LOSE_FEE_NOT_EMPTY)));
continue;
}
emp = employeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
......@@ -171,6 +175,8 @@ public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, T
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_EMP_NOT_EXIST)));
continue;
}
excel.setProjectCode(exist.getDeptNo());
excel.setProject(exist.getDeptName());
// 数据合法情况
insertExcel(excel,emp);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),CommonConstants.SAVE_SUCCESS));
......
......@@ -287,4 +287,8 @@ public interface ErrorCodes {
* 人员在该项目下存在进行中/未完结的服务
*/
String ARCHIVES_PROJECT_CHANGE_NOT_EXIST = "archives.project.change.not.exist";
/**
* 不良记录费用损失和其他损失不可同时为空
*/
String ARCHIVES_PROJECT_EMP_LOSE_FEE_NOT_EMPTY = "archives.project.emp.lose.fee.not.empty";
}
......@@ -257,6 +257,7 @@ public class ExcelUtil <T> implements Serializable {
tempStr= reverseByExp( c, attr.readConverterExp());
if (Common.isEmpty(tempStr)){
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的字典数据"), errorTemp);
continue;
}else {
c = tempStr;
}
......@@ -280,12 +281,9 @@ public class ExcelUtil <T> implements Serializable {
// TODO
tempStr = getAreaValue("area_"+c.trim()+ "_" + getFieldValueByName(attr.parentField(), data, DateUtil.ISO_EXPANDED_DATE_FORMAT), tempStr, attr,rowNum,errorTemp);
}
} else {
//直接按值去找数据 TODO
tempStr = getDicValue(c.trim() , tempStr, attr,rowNum,errorTemp);
}
}
if (!StringUtils.isNotBlank(tempStr)) {
if (StringUtils.isEmpty(tempStr) && (attr.isArea() || attr.isDataId())) {
if (attr.isOrgan()) {
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的单位或结算主体数据,请确认存在结算主体权限"), errorTemp);
}
......
......@@ -89,6 +89,8 @@ archives.project.emp.not.exist=\u5BF9\u5E94\u9879\u76EE\u7F16\u7801\u65E0\u9879\
archives.project.change.not.exist=\u4EBA\u5458\u5728\u8BE5\u9879\u76EE\u4E0B\u5B58\u5728\u8FDB\u884C\u4E2D/\u672A\u5B8C\u7ED3\u7684\u670D\u52A1
archives.project.emp.lose.fee.not.empty=\u4E0D\u826F\u8BB0\u5F55\u8D39\u7528\u635F\u5931\u548C\u5176\u4ED6\u635F\u5931\u4E0D\u53EF\u540C\u65F6\u4E3A\u7A7A
......
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