Commit 80886a91 authored by fangxinjiang's avatar fangxinjiang

EKP 权限-- 配置文件

parent 71a3aa2c
/*
* 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 com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import lombok.Data;
import java.io.Serializable;
/**
* 人员档案表excel导出对应的实体
*
* @author hgw
* @date 2022-6-24 15:15:24
*/
@Data
@ColumnWidth(10)
public class EmployeeContractCheckVO extends RowIndex implements Serializable {
private static final long serialVersionUID = 1L;
@ColumnWidth(20)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "身份证号")
private String empIdcard;
}
...@@ -197,7 +197,7 @@ public class TEmpContractAlertController { ...@@ -197,7 +197,7 @@ public class TEmpContractAlertController {
* 获取反馈日志详情 * 获取反馈日志详情
* *
* @author wzb * @author wzb
* @param id * @param applyNo
* @return {@link R} * @return {@link R}
*/ */
@Operation(summary = "获取反馈日志详情", description = "获取反馈日志详情") @Operation(summary = "获取反馈日志详情", description = "获取反馈日志详情")
...@@ -223,4 +223,17 @@ public class TEmpContractAlertController { ...@@ -223,4 +223,17 @@ public class TEmpContractAlertController {
} }
/**
* 员工合同续签原因排查
*
* @author fxj
* @date 2023-09-01 17:31:05
**/
@SneakyThrows
@Operation(description = "员工合同续签原因排查")
@SysLog("员工合同续签原因排查")
@PostMapping("/importListAdd")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
return tEmpContractAlertService.importDiy(file.getInputStream());
}
} }
...@@ -66,4 +66,6 @@ public interface TEmpContractAlertService extends IService<TEmpContractAlert> { ...@@ -66,4 +66,6 @@ public interface TEmpContractAlertService extends IService<TEmpContractAlert> {
**/ **/
R<List<EmpContractAlertUpdateVO>> batchUpdate(InputStream inputStream); R<List<EmpContractAlertUpdateVO>> batchUpdate(InputStream inputStream);
R<List<ErrorMessage>> importDiy(InputStream inputStream);
} }
...@@ -39,6 +39,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpContractAlertService; ...@@ -39,6 +39,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpContractAlertService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ChangeFeedBackAllVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.ChangeFeedBackAllVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ContractAlertSearchVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.ContractAlertSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpContractAlertUpdateVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpContractAlertUpdateVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractCheckVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
...@@ -610,4 +611,179 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -610,4 +611,179 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
} }
} }
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmployeeContractCheckVO> util1 = new ExcelUtil<>(EmployeeContractCheckVO.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmployeeContractCheckVO.class, new ReadListener<EmployeeContractCheckVO>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmployeeContractCheckVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmployeeContractCheckVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTCompanyInfo(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}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 importTCompanyInfo(List<EmployeeContractCheckVO> excelVOList, List<ErrorMessage> errorMessageList) {
// 个性化校验逻辑
ErrorMessage errorMsg;
// 执行数据插入操作 组装
String res;
for (int i = 0; i < excelVOList.size(); i++) {
EmployeeContractCheckVO excel = excelVOList.get(i);
// 业务逻辑实现
res = check(excel);
// 插入
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),res,null,excel.getEmpIdcard()));
}
}
/**
* 插入excel bad record
*/
private String check(EmployeeContractCheckVO excel) {
// 获取合同为在档、员工类型为“0外包”、“1派遣”、最近一次合同审核通过、过期或离过期还有3个月的数据
List<TEmployeeContractInfo> exitist = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.TWO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
if (Common.isEmpty(exitist)){
return excel.getEmpIdcard()+":未找到审核通过的在用合同信息";
}
Map<String,String> map = new HashMap<>();
String temp = null;
String temp2;
String mapTemp=CommonConstants.EMPTY_STRING;
for (TEmployeeContractInfo vo:exitist){
mapTemp = map.get(vo.getEmpIdcard());
if (baseMapper.selectCount(Wrappers.<TEmpContractAlert>query().lambda()
.eq(TEmpContractAlert::getEmpIdcard,vo.getEmpIdcard())
.eq(TEmpContractAlert::getProjectNo,vo.getDeptNo())) > 0){
mapTemp = (mapTemp==null?"身份证":mapTemp+" | 身份证")+excel.getEmpIdcard() +"合同申请编号:"+vo.getApplyNo() + " 已存在合同续签提醒";
map.put(vo.getEmpIdcard(),mapTemp);
continue;
}
if ("续签".equals(vo.getSituation()) || "终止".equals(vo.getSituation())){
//map.put(vo.getEmpIdcard(),excel.getEmpIdcard() + "续签、终止类型的合同不提示");
mapTemp = (mapTemp==null?"身份证":mapTemp+" | 身份证")+excel.getEmpIdcard() +"合同申请编号:"+vo.getApplyNo() +" 续签、终止类型的合同不提示";
map.put(vo.getEmpIdcard(),mapTemp);
continue;
}
if (Common.isNotNull(vo.getAuditStatus()) && vo.getAuditStatus().intValue() != 2){
mapTemp = (mapTemp==null?"身份证":mapTemp+" | 身份证")+excel.getEmpIdcard() +"合同申请编号:"+vo.getApplyNo() +" 合同审核不通过";
map.put(vo.getEmpIdcard(),mapTemp);
continue;
}
if (CommonConstants.ONE_STRING.equals(vo.getIsObsolete())){
mapTemp = (mapTemp==null?"身份证":mapTemp+" | 身份证")+excel.getEmpIdcard() +"合同申请编号:"+vo.getApplyNo() + " 合同已作废---IsObsolete=1 为作废";
map.put(vo.getEmpIdcard(),mapTemp);
continue;
}
if (!CommonConstants.ONE_STRING.equals(vo.getContractType())){
mapTemp = (mapTemp==null?"身份证":mapTemp+" | 身份证")+excel.getEmpIdcard() +"合同申请编号:"+vo.getApplyNo() + " 签订期限不为‘固定期限’";
map.put(vo.getEmpIdcard(),mapTemp);
continue;
}
if (!CommonConstants.ZERO_STRING.equals(vo.getWorkFlag())){
mapTemp = (mapTemp==null?"身份证":mapTemp+" | 身份证")+excel.getEmpIdcard() +"合同申请编号:"+vo.getApplyNo() +" 合同状态 非在职";
map.put(vo.getEmpIdcard(),mapTemp);
continue;
}
if (!vo.getContractEnd().before(DateUtil.dateIncreaseByDay(
DateUtil.dateIncreaseByMonth(DateUtil.getCurrentDateTime(),
CommonConstants.dingleDigitIntArray[3]), CommonConstants.dingleDigitIntArray[1]))){
mapTemp = (mapTemp==null?"身份证":mapTemp+" | 身份证")+excel.getEmpIdcard() +"合同申请编号:"+vo.getApplyNo() + " 合同截止时间为 "+vo.getContractEnd()+ " 未到期";
map.put(vo.getEmpIdcard(),mapTemp);
continue;
}
temp2 =check2(vo);
if (Common.isNotNull(temp2)){
mapTemp = (mapTemp==null?"身份证":mapTemp+" | 身份证")+excel.getEmpIdcard() +"合同申请编号:"+vo.getApplyNo() + temp2;
map.put(vo.getEmpIdcard(),mapTemp);
continue;
}else {
mapTemp = (mapTemp==null?"身份证":mapTemp+" | 身份证")+excel.getEmpIdcard() +"合同申请编号:"+vo.getApplyNo() + ":条件符合未生成代码提醒";
map.put(vo.getEmpIdcard(),mapTemp);
continue;
}
}
if (!Common.isEmpty(mapTemp)){
return mapTemp;
}
return excel.getEmpIdcard() + ":条件符合未生成代码提醒";
}
private String check2(TEmployeeContractInfo contract) {
TEmployeeInfo employeeInfo = employeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeInfo::getEmpIdcard,contract.getEmpIdcard()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(employeeInfo)){
TEmployeeProject project = projectMapper.selectOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard,employeeInfo.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getDeptNo,contract.getDeptNo())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(project)){
if ((Common.isNotNull(project.getProjectStatus())
&& project.getProjectStatus().intValue()== CommonConstants.ONE_INT)){
return "对应身份证的项目档案已减项";
}
if((!CommonConstants.ZERO_STRING.equals(project.getEmpNatrue())
&& !CommonConstants.ONE_STRING.equals(project.getEmpNatrue())
&& !CommonConstants.THREE_STRING.equals(project.getEmpNatrue()))
){
return "对应身份证的项目档案员工类型 非外包、派遣、内部员工";
}
}
if (Common.isEmpty(project)){
return "无合同对应项目编码的的在用项目档案 或 存在多个在用合同";
}
}else {
return "无对应身份证在用档案信息";
}
return null;
}
} }
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