Commit 45e23745 authored by hongguangwu's avatar hongguangwu

合同-导出

parent 350e7a65
......@@ -20,7 +20,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Set;
/**
* 封装-返回给前端的错误信息-简化版
......@@ -36,11 +35,8 @@ public class ErrorVO implements Serializable {
@Schema(description = "行号")
private int lineNum;
@Schema(description = "员工姓名")
private String empName;
@Schema(description = "身份证号")
private String empIdCard;
@Schema(description = "唯一的名称(例如:合同的申请编码)")
private String mainName;
@Schema(description = "结果:0错误;1正确(例如:是否允许删除:0否;1是)")
private int result;
......
......@@ -72,4 +72,13 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac
**/
String getMaxContractCode();
/**
* @param applyNo
* @Description: 查询编码是否已存在
* @Author: hgw
* @Date: 2022/7/5 9:37
* @return: java.lang.String
**/
String getContractByApplyNo(@Param("applyNo") String applyNo);
}
......@@ -54,9 +54,7 @@ import java.io.InputStream;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 员工合同
......@@ -308,6 +306,16 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
if (Common.isEmpty(tEmployeeContractInfo.getId())) {
// 针对编码再做一次重复性校验
String isCur = baseMapper.getContractByApplyNo(tEmployeeContractInfo.getApplyNo());
if (Common.isNotNull(isCur)) {
String code = this.getCode();
isCur = baseMapper.getContractByApplyNo(tEmployeeContractInfo.getApplyNo());
if (Common.isNotNull(isCur)) {
return false;
}
tEmployeeContractInfo.setApplyNo(code);
}
baseMapper.insert(tEmployeeContractInfo);
if (Common.isNotNull(tEmployeeContractInfo.getAttaList()) && Common.isNotNull(tEmployeeContractInfo.getId())) {
List<String> attaList = tEmployeeContractInfo.getAttaList();
......@@ -434,8 +442,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
if (contractInfo == null) {
errorVo.setErrorInfo(EmployeeContractConstants.NO_INFO);
} else {
errorVo.setEmpName(contractInfo.getEmpName());
errorVo.setEmpIdCard(contractInfo.getEmpIdcard());
errorVo.setMainName(contractInfo.getApplyNo());
if (!user.getId().equals(contractInfo.getCreateBy())) {
errorVo.setErrorInfo(EmployeeContractConstants.NOT_CREATE_USER);
} else if (contractInfo.getAuditStatus() != CommonConstants.ZERO_INT
......@@ -571,7 +578,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeContractConstants.NO_INFO));
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeContractConstants.NO_INFO));
errorMessageList.add(new ErrorMessage(CommonConstants.ZERO_INT, EmployeeContractConstants.NO_INFO));
}
}
}
......@@ -717,7 +724,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
try {
ExcelUtil<EmployeeContractExportVO> util = new ExcelUtil<>(EmployeeContractExportVO.class);
for (EmployeeContractExportVO vo : list) {
util.convertEntity(vo,null,null,null);
util.convertEntity(vo, null, null, null);
}
out = response.getOutputStream();
response.setContentType("multipart/form-data");
......@@ -756,7 +763,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
try {
ExcelUtil<EmployeeContractExportVO> util = new ExcelUtil<>(EmployeeContractExportVO.class);
for (EmployeeContractExportVO vo : list) {
util.convertEntity(vo,null,null,null);
util.convertEntity(vo, null, null, null);
}
out = response.getOutputStream();
response.setContentType("multipart/form-data");
......
......@@ -174,6 +174,35 @@
a.REASON,
a.AUDIT_TIME_LAST
</sql>
<!-- 导出 -->
<sql id="Base_Export_Column_List">
a.APPLY_NO,
a.EMP_NO,
a.EMP_NAME,
a.EMP_IDCARD,
a.CONTRACT_START,
a.CONTRACT_END,
a.FILE_PROVINCE,
a.FILE_CITY,
a.FILE_TOWN,
a.SUBJECT_DEPART,
a.DEPT_NO,
a.EMP_NATRUE,
a.CONTRACT_NAME,
a.CONTRACT_SUB_NAME,
a.SITUATION,
a.CONTRACT_TYPE,
a.CONTRACT_PARTY,
a.SUBJECT_UNIT,
a.AUDIT_STATUS,
a.IN_USE,
if(a.IS_FILE = 0,'有附件','无附件') FILES,
a.IS_FILE,
a.CREATE_NAME,
a.CREATE_TIME
</sql>
<sql id="tEmployeeContractInfo_where">
<if test="tEmployeeContractInfo != null">
......@@ -351,6 +380,7 @@
a.DELETE_FLAG = 0
<include refid="tEmployeeContractInfo_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<!--list-->
......@@ -362,28 +392,31 @@
a.DELETE_FLAG = 0
<include refid="tEmployeeContractInfo_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<!--导出-->
<select id="getTEmployeeContractExport" resultMap="tEmployeeContrctInfoExportMap">
SELECT
<include refid="Base_Column_List"/>
<include refid="Base_Export_Column_List"/>
FROM t_employee_contract_info a
<where>
a.DELETE_FLAG = 0
<include refid="tEmployeeContractInfo_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<!--导出历史合并-->
<select id="getTEmployeeContractExportHistory" resultMap="tEmployeeContrctInfoExportMap">
SELECT
<include refid="Base_Column_List"/>
<include refid="Base_Export_Column_List"/>
FROM t_employee_contract_info a
<where>
a.DELETE_FLAG = 0
<include refid="tEmployeeContractInfo_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<!--tEmployeeContractInfo简单分页查询-->
......@@ -407,4 +440,9 @@
SELECT ifnull(max(right(e.APPLY_NO,5)),0) APPLY_NO FROM t_employee_contract_info e where e.DELETE_FLAG = 0 and e.CREATE_TIME>DATE_FORMAT(now(),'%Y-%m-%d')
</select>
<!-- 根据编码获取数据 -->
<select id="getContractByApplyNo" resultType="java.lang.String">
SELECT e.id FROM t_employee_contract_info e where e.APPLY_NO = #{applyNo}
</select>
</mapper>
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