Commit 1fbda067 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/develop' into develop

parents e7c8b6d1 e9fe1f76
...@@ -17,14 +17,15 @@ ...@@ -17,14 +17,15 @@
package com.yifu.cloud.plus.v1.yifu.archives.vo; package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; 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.constant.ExcelAttributeConstants;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Past; import javax.validation.constraints.Past;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -68,13 +69,13 @@ public class EmployeeProjectExportVO{ ...@@ -68,13 +69,13 @@ public class EmployeeProjectExportVO{
* 身份证有效期起 * 身份证有效期起
*/ */
@ExcelProperty(value = "身份证开始日期") @ExcelProperty(value = "身份证开始日期")
private LocalDate validityStart; private Date validityStart;
/** /**
* 身份证有效期止 * 身份证有效期止
*/ */
@ExcelProperty(value = "身份证截止日期") @ExcelProperty(value = "身份证截止日期")
private LocalDate validityEnd; private Date validityEnd;
/** /**
* 婚姻状况 * 婚姻状况
...@@ -188,12 +189,14 @@ public class EmployeeProjectExportVO{ ...@@ -188,12 +189,14 @@ public class EmployeeProjectExportVO{
* 入学时间 * 入学时间
*/ */
@ExcelProperty(value = "入学时间") @ExcelProperty(value = "入学时间")
@DateTimeFormat("yyyy-MM-dd")
private LocalDateTime admissionDate; private LocalDateTime admissionDate;
/** /**
* 毕业时间 * 毕业时间
*/ */
@ExcelProperty(value = "毕业时间") @ExcelProperty(value = "毕业时间")
@DateTimeFormat("yyyy-MM-dd")
private LocalDateTime gradutionDate; private LocalDateTime gradutionDate;
/** /**
...@@ -233,6 +236,7 @@ public class EmployeeProjectExportVO{ ...@@ -233,6 +236,7 @@ public class EmployeeProjectExportVO{
* 创建时间 * 创建时间
*/ */
@ExcelProperty(value = "人员档案创建时间") @ExcelProperty(value = "人员档案创建时间")
@DateTimeFormat("yyyy-MM-dd")
private LocalDateTime proCreateTime; private LocalDateTime proCreateTime;
...@@ -285,7 +289,7 @@ public class EmployeeProjectExportVO{ ...@@ -285,7 +289,7 @@ public class EmployeeProjectExportVO{
*/ */
@ExcelProperty(value ="入职日期") @ExcelProperty(value ="入职日期")
@Past @Past
private LocalDate enjoinDate; private Date enjoinDate;
/** /**
* 试用期(单位月) * 试用期(单位月)
...@@ -400,6 +404,7 @@ public class EmployeeProjectExportVO{ ...@@ -400,6 +404,7 @@ public class EmployeeProjectExportVO{
* 项目档案创建时间 * 项目档案创建时间
*/ */
@ExcelProperty(value ="项目档案创建时间") @ExcelProperty(value ="项目档案创建时间")
@DateTimeFormat("yyyy-MM-dd")
private LocalDateTime createTime; private LocalDateTime createTime;
private List<String> idList; private List<String> idList;
......
/*
* 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.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import java.io.Serializable;
import java.util.Date;
/**
* 项目档案表excel对应的实体
*
* @author huyc
* @date 2022-06-20 17:54:40
*/
@Data
@ColumnWidth(30)
public class EmployeeProjectUpdateVO extends RowIndex implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工类型(字典值,0外包1派遣2代理)
*/
@ExcelProperty(value ="员工类型")
@ExcelAttribute(name = "员工类型",maxLength = 2,isDataId = true,dataType = ExcelAttributeConstants.EMP_NATRUE)
private String empNatrue;
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名",maxLength = 20)
@ExcelProperty(value ="员工姓名")
private String empName;
/**
* 身份证号码
*/
@NotNull(message = "身份证号不能为空")
@ExcelAttribute(name = "身份证号",isNotEmpty = true, errorInfo = "身份证号不能为空",maxLength = 20)
@ExcelProperty(value ="身份证号")
private String empIdcard;
/**
* 开户行
*/
@ExcelAttribute(name = "开户行")
@ExcelProperty(value ="开户行")
private String bankName;
/**
* 支行
*/
@ExcelAttribute(name = "支行")
@ExcelProperty(value ="支行")
private String bankSubName;
/**
* 银行卡号
*/
@ExcelAttribute(name ="银行卡号")
@ExcelProperty(value ="银行卡号")
private String bankNo;
/**
* 项目编码
*/
@NotNull(message = "项目编码不能为空")
@ExcelProperty(value ="项目编码")
@ExcelAttribute(name = "项目编码",isNotEmpty = true, errorInfo = "项目编码不能为空",maxLength = 20)
private String deptNo;
/**
* 合同类型(字典值)
*/
@ExcelAttribute(name = "合同类型",maxLength = 10,isDataId = true,dataType = ExcelAttributeConstants.PERSONNEL_TYPE)
@ExcelProperty(value ="合同类型")
private String contractType;
/**
* 工时制
*/
@ExcelAttribute(name = "工时制",maxLength = 10,isDataId = true,dataType = ExcelAttributeConstants.WORKING_HOURS)
@ExcelProperty(value ="工时制")
private String workingHours;
/**
* 就职岗位
*/
@ExcelAttribute(name = "就职岗位",maxLength = 20)
@ExcelProperty(value ="就职岗位")
private String post;
/**
* 入职日期
*/
@ExcelAttribute(name = "入职日期",maxLength = 4)
@ExcelProperty(value ="入职日期")
@Past
@DateTimeFormat("yyyy-MM-dd")
private Date enjoinDate;
/**
* 试用期(单位月)
*/
@ExcelAttribute(name = "试用期",maxLength = 4)
@ExcelProperty(value ="试用期")
private String tryPeriod;
}
...@@ -102,9 +102,8 @@ public class EmployeeProjectVO extends RowIndex implements Serializable { ...@@ -102,9 +102,8 @@ public class EmployeeProjectVO extends RowIndex implements Serializable {
/** /**
* 工时制 * 工时制
*/ */
@NotNull(message = "工时制不能为空")
@ExcelProperty(value ="工时制") @ExcelProperty(value ="工时制")
@ExcelAttribute(name = "工时制",isNotEmpty = true, errorInfo = "工时制不能为空",maxLength = 10,isDataId = true,dataType = ExcelAttributeConstants.WORKING_HOURS) @ExcelAttribute(name = "工时制",maxLength = 10,isDataId = true,dataType = ExcelAttributeConstants.WORKING_HOURS)
private String workingHours; private String workingHours;
/** /**
...@@ -119,7 +118,6 @@ public class EmployeeProjectVO extends RowIndex implements Serializable { ...@@ -119,7 +118,6 @@ public class EmployeeProjectVO extends RowIndex implements Serializable {
* 入职日期 * 入职日期
*/ */
@ExcelProperty(value ="入职日期") @ExcelProperty(value ="入职日期")
@NotNull(message = "入职日期不能为空")
@Past @Past
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyy-MM-dd")
private Date enjoinDate; private Date enjoinDate;
...@@ -128,8 +126,7 @@ public class EmployeeProjectVO extends RowIndex implements Serializable { ...@@ -128,8 +126,7 @@ public class EmployeeProjectVO extends RowIndex implements Serializable {
* 试用期(单位月) * 试用期(单位月)
*/ */
@ExcelProperty(value ="试用期") @ExcelProperty(value ="试用期")
@NotNull(message = "试用期不能为空") @ExcelAttribute(name = "试用期",maxLength = 4)
@ExcelAttribute(name = "试用期",isNotEmpty = true, errorInfo = "试用期不能为空",maxLength = 4)
private String tryPeriod; private String tryPeriod;
} }
...@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo; ...@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
...@@ -79,7 +80,7 @@ public class TEmpChangeInfoVO implements Serializable { ...@@ -79,7 +80,7 @@ public class TEmpChangeInfoVO implements Serializable {
* 划转起始月 * 划转起始月
*/ */
@ExcelProperty(value ="划转起始月") @ExcelProperty(value ="划转起始月")
@ExcelAttribute(name = "划转起始月",maxLength = 6,isInteger = true) @ExcelAttribute(name = "划转起始月",maxLength = 6, errorInfo = "划转起始月不能超过6位",isInteger = true)
private String changeStartMonth; private String changeStartMonth;
} }
...@@ -23,9 +23,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -23,9 +23,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord; import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCertRecordMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCertRecordMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCertRecordService; import com.yifu.cloud.plus.v1.yifu.archives.service.TCertRecordService;
...@@ -33,6 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.CertRecordSearchVo; ...@@ -33,6 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.CertRecordSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo;
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.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.LocalDateTimeUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -53,6 +56,9 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert ...@@ -53,6 +56,9 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
private final TEmployeeProjectMapper projectMapper; private final TEmployeeProjectMapper projectMapper;
private final TEmployeeInfoMapper employeeInfoMapper; private final TEmployeeInfoMapper employeeInfoMapper;
private final TEmployeeContractInfoMapper contractInfoMapper;
@Override @Override
public R<TCertRecordVo> getCertRecordInfo(String id) { public R<TCertRecordVo> getCertRecordInfo(String id) {
TEmployeeProject project = projectMapper.selectById(id); TEmployeeProject project = projectMapper.selectById(id);
...@@ -63,6 +69,21 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert ...@@ -63,6 +69,21 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
if (!Common.isNotNull(employeeInfo)){ if (!Common.isNotNull(employeeInfo)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR); return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
} }
// 取值最早的合同
TEmployeeContractInfo last = contractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.TWO_STRING)
.eq(TEmployeeContractInfo::getIsObsolete,CommonConstants.ZERO_STRING)
.orderByDesc(TEmployeeContractInfo::getAuditTimeLast)
.last(CommonConstants.LAST_ONE_SQL));
// 取值最早的合同
TEmployeeContractInfo first = contractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.TWO_STRING)
.eq(TEmployeeContractInfo::getIsObsolete,CommonConstants.ZERO_STRING)
.orderByAsc(TEmployeeContractInfo::getAuditTimeLast)
.last(CommonConstants.LAST_ONE_SQL));
TCertRecordVo vo = new TCertRecordVo(); TCertRecordVo vo = new TCertRecordVo();
vo.setEmpIdcard(project.getEmpIdcard()); vo.setEmpIdcard(project.getEmpIdcard());
vo.setEmpId(project.getEmpId()); vo.setEmpId(project.getEmpId());
...@@ -70,17 +91,24 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert ...@@ -70,17 +91,24 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
vo.setPost(project.getPost()); vo.setPost(project.getPost());
vo.setProjectName(project.getDeptName()); vo.setProjectName(project.getDeptName());
vo.setProjectCode(project.getDeptNo()); vo.setProjectCode(project.getDeptNo());
// TODO 最新合同时间 // 最新合同时间
vo.setContractStart(null); if (Common.isNotNull(last)){
vo.setContractEnd(null); if (Common.isNotNull(last.getContractStart())){
// TODO 派减离职时间和原因 vo.setContractStart(LocalDateTimeUtils.convertDateToLDT(last.getContractStart()));
}
if (Common.isNotNull(last.getContractEnd())){
vo.setContractEnd(LocalDateTimeUtils.convertDateToLDT(last.getContractEnd()));
}
}
// 派减离职时间和原因
vo.setLeaveTime(employeeInfo.getLeaveTime()); vo.setLeaveTime(employeeInfo.getLeaveTime());
vo.setLeaveReason(employeeInfo.getLeaveReason()); vo.setLeaveReason(employeeInfo.getLeaveReason());
// TODO 第一次合同开始截止时间 // 第一次合同开始时间和创建时间
vo.setEntryTime(employeeInfo.getCreateTime()); if (Common.isNotNull(first) && Common.isNotNull(first.getContractStart())){
vo.setFirstContractTime(null); vo.setEntryTime(LocalDateTimeUtils.convertDateToLDT(first.getContractStart()));
vo.setFirstContractTime(LocalDateTimeUtils.convertDateToLDT(first.getContractStart()));
}
vo.setSex(employeeInfo.getEmpSex()); vo.setSex(employeeInfo.getEmpSex());
vo.setIntroductionUnit(CommonConstants.EMPTY_STRING); vo.setIntroductionUnit(CommonConstants.EMPTY_STRING);
vo.setSeal("安徽皖信人力资源管理有限公司"); vo.setSeal("安徽皖信人力资源管理有限公司");
......
...@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service; ...@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import java.util.*; import java.util.*;
import java.util.regex.Pattern;
/** /**
* 档案划转日志表 * 档案划转日志表
...@@ -54,6 +55,8 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper, ...@@ -54,6 +55,8 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
private final TEmployeeLogServiceImpl tEmployeeLogService; private final TEmployeeLogServiceImpl tEmployeeLogService;
public static final Pattern PATTERN = Pattern.compile("^[-\\+]?[\\d]*$");
/** /**
* @Author huyc * @Author huyc
* @Description 档案划转 * @Description 档案划转
...@@ -116,15 +119,25 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper, ...@@ -116,15 +119,25 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
errorMsg = new HashSet<>(); errorMsg = new HashSet<>();
TEmpChangeInfoVO excel = excelVOList.get(i); TEmpChangeInfoVO excel = excelVOList.get(i);
if (Common.isNotNull(excel.getChangeStartMonth()) && excel.getChangeStartMonth().length() > CommonConstants.dingleDigitIntArray[6]) {
errorMsg.add("第" + (i + 2) + "行划转起始月长度不能超过6位");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月长度不能超过6位"));
}
if (!Common.isEmpty(excel.getChangeStartMonth()) && !PATTERN.matcher(excel.getChangeStartMonth()).matches()) {
errorMsg.add("第" + (i + 2) + "行划转起始月格式错误");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月格式错误"));
}
if (excel.getUnsettleDeal().equals(CommonConstants.IS_CHANGE)) { if (excel.getUnsettleDeal().equals(CommonConstants.IS_CHANGE)) {
if (Common.isEmpty(excel.getChangeStartMonth())) { if (Common.isEmpty(excel.getChangeStartMonth())) {
errorMsg.add("第" + (i + 2) + "行划转起始月不能为空"); errorMsg.add("第" + (i + 2) + "行划转起始月不能为空");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月不能为空")); errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月不能为空"));
} else if (Integer.parseInt(excel.getChangeStartMonth()) > Integer.parseInt(DateUtil.getThisMonth())) { } else if (PATTERN.matcher(excel.getChangeStartMonth()).matches()) {
if (Integer.parseInt(excel.getChangeStartMonth()) > Integer.parseInt(DateUtil.getThisMonth())) {
errorMsg.add("第" + (i + 2) + "行划转起始月要小于等于当前月"); errorMsg.add("第" + (i + 2) + "行划转起始月要小于等于当前月");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月要小于等于当前月")); errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月要小于等于当前月"));
} }
} }
}
//项目编码校验 //项目编码校验
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda() TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
......
...@@ -268,8 +268,8 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -268,8 +268,8 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
alert.setFileTown(Integer.toString(contract.getFileTown())); alert.setFileTown(Integer.toString(contract.getFileTown()));
} }
alert.setEmpType(contract.getEmpNatrue()); alert.setEmpType(contract.getEmpNatrue());
alert.setContractType(contract.getContractName());
alert.setContractTerm(contract.getContractType()); alert.setContractTerm(contract.getContractType());
alert.setContractTerm(contract.getContractTerm());
if (Common.isNotNull(alert.getContractEnd())){ if (Common.isNotNull(alert.getContractEnd())){
if (Common.isNotNull(contract.getContractEnd()) && contract.getContractEnd().before(nowDate)){ if (Common.isNotNull(contract.getContractEnd()) && contract.getContractEnd().before(nowDate)){
alert.setDueFlag(CommonConstants.ONE_STRING); alert.setDueFlag(CommonConstants.ONE_STRING);
......
...@@ -39,6 +39,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService; ...@@ -39,6 +39,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService; import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectUpdateVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeXProjectVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeXProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
...@@ -48,6 +49,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; ...@@ -48,6 +49,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
...@@ -455,14 +457,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -455,14 +457,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (excel.getEmpNatrue().equals(CommonConstants.ZERO_STRING) || excel.getEmpNatrue().equals(CommonConstants.ONE_STRING)) { if (excel.getEmpNatrue().equals(CommonConstants.ZERO_STRING) || excel.getEmpNatrue().equals(CommonConstants.ONE_STRING)) {
if (excel.getContractType().equals(CommonConstants.ONE_STRING)) { if (excel.getContractType().equals(CommonConstants.ONE_STRING)) {
if (Common.isEmpty(excel.getWorkingHours())) { if (Common.isEmpty(excel.getWorkingHours())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "工时制不能为空!")); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "工时制不能为空!"));
} }
} }
if (Common.isEmpty(excel.getEnjoinDate())) { if (Common.isEmpty(excel.getEnjoinDate())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "入职日期不能为空!")); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "入职日期不能为空!"));
} }
if (Common.isEmpty(excel.getTryPeriod())) { if (Common.isEmpty(excel.getTryPeriod())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "试用期不能为空!")); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "试用期不能为空!"));
} }
} }
if (idCardMap.get(idCard.concat(deptNo)) != null) { if (idCardMap.get(idCard.concat(deptNo)) != null) {
...@@ -564,13 +566,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -564,13 +566,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Transactional @Transactional
public R<List<ErrorMessage>> importEmpProjectUpdate(InputStream inputStream) { public R<List<ErrorMessage>> importEmpProjectUpdate(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmployeeProjectVO> util1 = new ExcelUtil<>(EmployeeProjectVO.class); ExcelUtil<EmployeeProjectUpdateVO> util1 = new ExcelUtil<>(EmployeeProjectUpdateVO.class);
; ;
// 写法2: // 写法2:
// 匿名内部类 不用额外写一个DemoDataListener // 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭 // 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try { try {
EasyExcel.read(inputStream, EmployeeProjectVO.class, new ReadListener<EmployeeProjectVO>() { EasyExcel.read(inputStream, EmployeeProjectUpdateVO.class, new ReadListener<EmployeeProjectUpdateVO>() {
/** /**
* 单次缓存的数据量 * 单次缓存的数据量
*/ */
...@@ -578,10 +580,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -578,10 +580,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/** /**
*临时存储 *临时存储
*/ */
private List<EmployeeProjectVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); private List<EmployeeProjectUpdateVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override @Override
public void invoke(EmployeeProjectVO data, AnalysisContext context) { public void invoke(EmployeeProjectUpdateVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder(); ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex(); Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1); data.setRowIndex(rowIndex + 1);
...@@ -624,7 +626,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -624,7 +626,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
* @Description 批量更新项目档案信息 * @Description 批量更新项目档案信息
* @Date 19:25 2022/6/21 * @Date 19:25 2022/6/21
**/ **/
public void importEmpProjectUpdate(List<EmployeeProjectVO> excelVOList, List<ErrorMessage> errorMessageList) { public void importEmpProjectUpdate(List<EmployeeProjectUpdateVO> excelVOList, List<ErrorMessage> errorMessageList) {
// 通用校验获取失败的数据 // 通用校验获取失败的数据
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>(); Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
...@@ -637,7 +639,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -637,7 +639,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (Common.isNotNull(errorMsgMap.get(i + 2))) { if (Common.isNotNull(errorMsgMap.get(i + 2))) {
continue; continue;
} }
EmployeeProjectVO excel = excelVOList.get(i); EmployeeProjectUpdateVO excel = excelVOList.get(i);
String checkCount = excel.getEmpIdcard().concat(excel.getDeptNo()); String checkCount = excel.getEmpIdcard().concat(excel.getDeptNo());
if (Common.isNotNull(checkCountMap.get(checkCount))) { if (Common.isNotNull(checkCountMap.get(checkCount))) {
...@@ -656,7 +658,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -656,7 +658,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
// 数据合法情况 // 数据合法情况
if (CollUtil.isEmpty(errorMessageList)) { if (CollUtil.isEmpty(errorMessageList)) {
updateExcelPro(excel, updateList, tEmployeeProject);
updateExcelProj(excel, updateList, tEmployeeProject);
if (!excel.getEmpNatrue().equals(tEmployeeProject.getEmpNatrue())) { if (!excel.getEmpNatrue().equals(tEmployeeProject.getEmpNatrue())) {
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda() TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard()) .eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
...@@ -778,7 +781,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -778,7 +781,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override @Override
public void listExportProject(HttpServletResponse response, EmployeeProjectExportVO projectDTO, String idstr, List<String> exportFields) { public void listExportProject(HttpServletResponse response, EmployeeProjectExportVO projectDTO, String idstr, List<String> exportFields) {
String fileName = "项目档案批量导出" + LocalDateTime.now() + ".xlsx"; String fileName = "项目档案批量导出" + DateUtil.getThisTime() + ".xlsx";
// 根据用户传入确定要导出的字段 // 根据用户传入确定要导出的字段
Set<String> includeColumnFiledNames = new HashSet<String>(); Set<String> includeColumnFiledNames = new HashSet<String>();
for (String exportField : exportFields) { for (String exportField : exportFields) {
...@@ -804,7 +807,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -804,7 +807,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
out = response.getOutputStream(); out = response.getOutputStream();
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(fileName, "UTF-8")); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeProjectExportVO.class).includeColumnFiledNames(includeColumnFiledNames).sheet("项目档案") EasyExcel.write(out, EmployeeProjectExportVO.class).includeColumnFiledNames(includeColumnFiledNames).sheet("项目档案")
.doWrite(list); .doWrite(list);
...@@ -908,6 +911,19 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -908,6 +911,19 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeProjectOld, tEmployeeProject); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeProjectOld, tEmployeeProject);
} }
/**
* 更新项目档案
*/
private void updateExcelProj(EmployeeProjectUpdateVO excel, List<TEmployeeProject> proupdateList, TEmployeeProject tEmployeeProject) {
BeanUtil.copyProperties(excel, tEmployeeProject);
YifuUser user = SecurityUtils.getUser();
tEmployeeProject.setUpdateBy(user.getId());
proupdateList.add(tEmployeeProject);
// 记录变更日志
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeProjectOld, tEmployeeProject);
}
@Override @Override
public List<TEmployeeProject> getListByEmpId(String empId, int projectStatus) { public List<TEmployeeProject> getListByEmpId(String empId, int projectStatus) {
TEmployeeProject project = new TEmployeeProject(); TEmployeeProject project = new TEmployeeProject();
......
...@@ -74,6 +74,9 @@ ...@@ -74,6 +74,9 @@
<if test="tElecEmployeeInfo.deptName != null and tElecEmployeeInfo.deptName.trim() != ''"> <if test="tElecEmployeeInfo.deptName != null and tElecEmployeeInfo.deptName.trim() != ''">
AND b.DEPT_NAME like concat('%',#{tElecEmployeeInfo.deptName},'%') AND b.DEPT_NAME like concat('%',#{tElecEmployeeInfo.deptName},'%')
</if> </if>
<if test="tElecEmployeeInfo.empNo != null and tElecEmployeeInfo.empNo.trim() != ''">
AND b.EMP_NO like = #{tElecEmployeeInfo.empNo}
</if>
<if test="tElecEmployeeInfo.deptNo != null and tElecEmployeeInfo.deptNo.trim() != ''"> <if test="tElecEmployeeInfo.deptNo != null and tElecEmployeeInfo.deptNo.trim() != ''">
AND b.DEPT_NO like concat('%',#{tElecEmployeeInfo.deptNo},'%') AND b.DEPT_NO like concat('%',#{tElecEmployeeInfo.deptNo},'%')
</if> </if>
......
...@@ -220,6 +220,7 @@ ...@@ -220,6 +220,7 @@
a.STATUS, a.STATUS,
a.CREATE_NAME, a.CREATE_NAME,
a.CREATE_TIME, a.CREATE_TIME,
b.EMP_EMAIL,
b.EMP_NATRUE AS PROEMP_NATRUE b.EMP_NATRUE AS PROEMP_NATRUE
</sql> </sql>
......
...@@ -91,4 +91,14 @@ public interface CacheConstants { ...@@ -91,4 +91,14 @@ public interface CacheConstants {
**/ **/
String EVERYDAY_EMP_CONTRACT_CODE = "everyday_emp_contract_code"; String EVERYDAY_EMP_CONTRACT_CODE = "everyday_emp_contract_code";
/**
* 区域数据--标签
*/
String AREA_LABEL = "area_label:";
/**
* 区域数据--值
*/
String AREA_VALUE = "area_value:";
} }
...@@ -192,7 +192,7 @@ public interface CommonConstants { ...@@ -192,7 +192,7 @@ public interface CommonConstants {
//- 横 //- 横
char DOWN_LINE_CHAR ='_'; char DOWN_LINE_CHAR ='_';
// 冒号 : // 冒号 :
String COLON_STRING =""; String COLON_STRING =":";
// - 横 分割线 中 // - 横 分割线 中
String CENTER_SPLIT_LINE_STRING = "-"; String CENTER_SPLIT_LINE_STRING = "-";
// 斜杠 // 斜杠
......
package com.yifu.cloud.plus.v1.yifu.common.core.util; package com.yifu.cloud.plus.v1.yifu.common.core.util;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
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.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants;
...@@ -46,8 +47,6 @@ public class ExcelUtil <T> implements Serializable { ...@@ -46,8 +47,6 @@ public class ExcelUtil <T> implements Serializable {
private Field[] fields; private Field[] fields;
public void convertEntity(T vo, String[] exportFields, Map<String,String> diyDicMap, String dateFormat) { public void convertEntity(T vo, String[] exportFields, Map<String,String> diyDicMap, String dateFormat) {
String provinceTemp;
String cityTemp;
// 得到所有定义字段 // 得到所有定义字段
Field[] allFields = clazz.getDeclaredFields(); Field[] allFields = clazz.getDeclaredFields();
List<Field> fields = new ArrayList<>(); List<Field> fields = new ArrayList<>();
...@@ -171,7 +170,10 @@ public class ExcelUtil <T> implements Serializable { ...@@ -171,7 +170,10 @@ public class ExcelUtil <T> implements Serializable {
} }
// 默认字典获取不到 去 缓存获取 // 默认字典获取不到 去 缓存获取
if (Common.isEmpty(tempValue) && Common.isNotNull(attr.dataType())){ if (Common.isEmpty(tempValue) && Common.isNotNull(attr.dataType())){
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(attr.dataType()); Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue()
.get(CacheConstants.DICT_DETAILS
+ CommonConstants.COLON_STRING
+attr.dataType());
if (dicObj != null) { if (dicObj != null) {
for (Map.Entry<String, String> entry : dicObj.entrySet()) { for (Map.Entry<String, String> entry : dicObj.entrySet()) {
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(value.trim())) { if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(value.trim())) {
...@@ -447,11 +449,11 @@ public class ExcelUtil <T> implements Serializable { ...@@ -447,11 +449,11 @@ public class ExcelUtil <T> implements Serializable {
return propertyValue; return propertyValue;
} }
private String getAreaLabel(String c) { private String getAreaLabel(String c) {
return (String)RedisUtil.redis.opsForValue().get(c); return (String)RedisUtil.redis.opsForValue().get(CacheConstants.AREA_VALUE + c);
} }
private String getAreaValue(String c, String tempStr, ExcelAttribute attr,Integer rowNum, ErrorMessage errorTemp) { private String getAreaValue(String c, String tempStr, ExcelAttribute attr,Integer rowNum, ErrorMessage errorTemp) {
tempStr = String.valueOf(RedisUtil.redis.opsForValue().get(c)); tempStr = String.valueOf(RedisUtil.redis.opsForValue().get(CacheConstants.AREA_LABEL + c));
if (Common.isEmpty(tempStr)){ if (Common.isEmpty(tempStr)){
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, attr.name() + ":" + c.trim() + "校验异常,请联系管理人员"), errorTemp); errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, attr.name() + ":" + c.trim() + "校验异常,请联系管理人员"), errorTemp);
return CommonConstants.EMPTY_STRING; return CommonConstants.EMPTY_STRING;
...@@ -465,7 +467,10 @@ public class ExcelUtil <T> implements Serializable { ...@@ -465,7 +467,10 @@ public class ExcelUtil <T> implements Serializable {
} }
private String getDicValue(String c, String tempStr, ExcelAttribute attr,Integer rowNum, ErrorMessage errorTemp) { private String getDicValue(String c, String tempStr, ExcelAttribute attr,Integer rowNum, ErrorMessage errorTemp) {
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(attr.dataType()); Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue()
.get(CacheConstants.DICT_DETAILS
+ CommonConstants.COLON_STRING
+attr.dataType());
boolean flag = true; boolean flag = true;
for (Map.Entry<String,String> entry:dicObj.entrySet()){ for (Map.Entry<String,String> entry:dicObj.entrySet()){
if (Common.isNotNull(entry.getValue()) && entry.getValue().equals(c.trim())){ if (Common.isNotNull(entry.getValue()) && entry.getValue().equals(c.trim())){
......
...@@ -96,7 +96,6 @@ public class RedisUtil { ...@@ -96,7 +96,6 @@ public class RedisUtil {
} }
return result; return result;
} }
/** /**
* 写入缓存 * 写入缓存
* @param key * @param key
......
...@@ -112,7 +112,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi ...@@ -112,7 +112,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
private void extractedRedis(SysDictItem item) { private void extractedRedis(SysDictItem item) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
updateDictItem(item.getType(),resultMap); updateDictItem(CacheConstants.DICT_DETAILS+CommonConstants.COLON_STRING+item.getType(),resultMap);
redisUtil.set(item.getType(),resultMap); redisUtil.set(item.getType(),resultMap);
} }
......
...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.admin.init; ...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.admin.init;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysAreaService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysAreaService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictItemService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictItemService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
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.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
...@@ -39,7 +40,9 @@ public class DictItemRedisInit { ...@@ -39,7 +40,9 @@ public class DictItemRedisInit {
Map<String, Object> dictItem = dictItemService.getAllDictItemSub(); Map<String, Object> dictItem = dictItemService.getAllDictItemSub();
if (Common.isNotNull(dictItem)){ if (Common.isNotNull(dictItem)){
for (Map.Entry<String,Object> entry:dictItem.entrySet()){ for (Map.Entry<String,Object> entry:dictItem.entrySet()){
redisUtil.set(entry.getKey(),entry.getValue()); redisUtil.set(CacheConstants.DICT_DETAILS
+ CommonConstants.COLON_STRING
+ entry.getKey(),entry.getValue());
} }
} }
log.info("字典数据加入缓存初始化结束..."); log.info("字典数据加入缓存初始化结束...");
...@@ -49,18 +52,21 @@ public class DictItemRedisInit { ...@@ -49,18 +52,21 @@ public class DictItemRedisInit {
if (Common.isNotNull(allAreas)){ if (Common.isNotNull(allAreas)){
Map<String,SysArea> areaMap = new HashMap<>(); Map<String,SysArea> areaMap = new HashMap<>();
for (SysArea area:allAreas){ for (SysArea area:allAreas){
redisUtil.set("area_" + area.getId(),area.getAreaName()); redisUtil.set(CacheConstants.AREA_LABEL
+ area.getId(),area.getAreaName());
areaMap.put(area.getId().toString(),area); areaMap.put(area.getId().toString(),area);
} }
SysArea temp; SysArea temp;
for (SysArea area:allAreas){ for (SysArea area:allAreas){
if (Common.isNotNull(area.getParentId()) && area.getParentId().intValue() > 0){ if (Common.isNotNull(area.getParentId()) && area.getParentId().intValue() > 0){
temp = areaMap.get(area.getParentId().toString()); temp = areaMap.get(area.getParentId().toString());
redisUtil.set("area_" + area.getAreaName() redisUtil.set(CacheConstants.AREA_VALUE
+ area.getAreaName()
+ CommonConstants.DOWN_LINE_STRING + CommonConstants.DOWN_LINE_STRING
+(Common.isNotNull(temp)?temp.getAreaName():""),area.getId()); +(Common.isNotNull(temp)?temp.getAreaName():""),area.getId());
}else { }else {
redisUtil.set("area_" + area.getAreaName(),area.getId()); redisUtil.set(CacheConstants.AREA_VALUE
+ area.getAreaName(),area.getId());
} }
} }
} }
......
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