Commit 5d6abc73 authored by zhangsen's avatar zhangsen

人员赋码规则修改

parent db55fa38
...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.jxiop.api.Enum; ...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.jxiop.api.Enum;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
/**
* 【 此类弃用 】
*/
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum QrcodePostEnum { public enum QrcodePostEnum {
......
...@@ -59,6 +59,16 @@ public class Constants { ...@@ -59,6 +59,16 @@ public class Constants {
"table|from|grant|use|group_concat|column_name|" + "table|from|grant|use|group_concat|column_name|" +
"information_schema.columns|table_schema|union|where|select|delete|update|order|by|count|" + "information_schema.columns|table_schema|union|where|select|delete|update|order|by|count|" +
"chr|mid|master|truncate|char|declare|or|;|-|--|,|like|//|/|%|#"; "chr|mid|master|truncate|char|declare|or|;|-|--|,|like|//|/|%|#";
/**
* 江西电建岗位字典key
*/
public static final String JXIOP_DICT_POST = "jxIop:dict:post";
/**
* 江西电建证书字典key
*/
public static final String JXIOP_DICT_CERTIFICATES = "jxIop:dict:certificates";
} }
...@@ -54,14 +54,20 @@ public class PersonBasicController extends BaseController { ...@@ -54,14 +54,20 @@ public class PersonBasicController extends BaseController {
try { try {
personBasicServiceImpl.addPerson(model, httpServletRequest); personBasicServiceImpl.addPerson(model, httpServletRequest);
}catch (InnerInvokException | ParseException e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
return this.buildResponseFalse(e.getMessage()); return this.buildResponseFalse(e.getMessage());
} }
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/addRedisPostAndCerInfo")
@ApiOperation(httpMethod = "POST", value = "岗位和证书信息缓存至redis", notes = "岗位和证书信息缓存至redis")
public ResponseModel<Object> addRedisPostAndCerInfo() {
personBasicServiceImpl.addRedisPostAndCerInfo();
return ResponseHelper.buildResponse(null);
}
...@@ -148,7 +154,7 @@ public class PersonBasicController extends BaseController { ...@@ -148,7 +154,7 @@ public class PersonBasicController extends BaseController {
projectName,orgCode)); projectName,orgCode));
} }
/** /**
* 列表全部数据查询 * 列表全部数据查询
* *
......
...@@ -6,15 +6,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -6,15 +6,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.QrcodeColorEnum; import com.yeejoin.amos.boot.module.jxiop.api.Enum.QrcodeColorEnum;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.QrcodePostEnum;
import com.yeejoin.amos.boot.module.jxiop.api.dto.*; import com.yeejoin.amos.boot.module.jxiop.api.dto.*;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonBasic;
import com.yeejoin.amos.boot.module.jxiop.api.entity.*; import com.yeejoin.amos.boot.module.jxiop.api.entity.*;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountFedMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountFedMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.service.IPersonBasicService; import com.yeejoin.amos.boot.module.jxiop.api.service.IPersonBasicService;
import com.yeejoin.amos.boot.module.jxiop.api.util.Constants;
import com.yeejoin.amos.boot.module.jxiop.biz.activemq.QuerueProduce; import com.yeejoin.amos.boot.module.jxiop.biz.activemq.QuerueProduce;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
...@@ -23,14 +25,13 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -23,14 +25,13 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.LoginInfoModel; import com.yeejoin.amos.feign.privilege.model.LoginInfoModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil; import com.yeejoin.amos.feign.privilege.util.DesUtil;
import org.apache.commons.compress.utils.Lists; import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -70,6 +71,14 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -70,6 +71,14 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
@Autowired @Autowired
QuerueProduce querueProduce; QuerueProduce querueProduce;
@Autowired
private AmosFeignService amosFeignService;
@Autowired
private RedisUtils redisUtils;
private String UPDATE="UPDATE"; private String UPDATE="UPDATE";
private String INSERT="INSERT"; private String INSERT="INSERT";
@Autowired @Autowired
...@@ -88,14 +97,38 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -88,14 +97,38 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
return this.queryForList("", false); return this.queryForList("", false);
} }
public void addRedisPostAndCerInfo() {
List<DictionarieValueModel> elevatorCategory = null;
try {
elevatorCategory = amosFeignService.listDictionaryByDictCode("YGZYJNJDZS");
} catch (Exception e) {
e.printStackTrace();
}
Map<String, String> collect = elevatorCategory.stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataDesc));
redisUtils.set(Constants.JXIOP_DICT_POST, collect);
List<DictionarieValueModel> elevator = null;
try {
elevator = amosFeignService.listDictionaryByDictCode("岗位资质鉴定证书");
} catch (Exception e) {
e.printStackTrace();
}
Map<String, String> collect2 = elevator.stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataDesc));
redisUtils.set(Constants.JXIOP_DICT_CERTIFICATES, collect2);
}
/** /**
* 新增 * 新增
*/ */
@Transactional @Transactional
public void addPerson(PersonDto model public void addPerson(PersonDto model, HttpServletRequest httpServletRequest) throws Exception {
, HttpServletRequest httpServletRequest if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) {
) throws ParseException { addRedisPostAndCerInfo();
}
// 岗位所需证书信息
Map<String, String> postNameMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_POST);
// 证书临期信息
Map<String, String> certificatesMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_CERTIFICATES);
//获取人员基本信息数据 //获取人员基本信息数据
PersonUser personUser = model.getPersonUser(); PersonUser personUser = model.getPersonUser();
...@@ -110,7 +143,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -110,7 +143,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
// 该岗位应获得的证书 // 该岗位应获得的证书
List<String> list2 = new ArrayList<>(); List<String> list2 = new ArrayList<>();
if (StringUtils.isNotEmpty(personUser.getPostName())) { if (StringUtils.isNotEmpty(personUser.getPostName())) {
String certificates = QrcodePostEnum.getCode(personUser.getPostName()); String certificates = postNameMap.get(personUser.getPostName());
list2 = Arrays.asList(certificates.split(",")); list2 = Arrays.asList(certificates.split(","));
} }
List<String> list = new ArrayList(list2); List<String> list = new ArrayList(list2);
...@@ -127,7 +160,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -127,7 +160,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
isOver = 1; isOver = 1;
} }
if (list.contains(item.getCertificateName()) && if (list.contains(item.getCertificateName()) &&
DateUtils.dateBetweenIncludeToday(date, new Date()) < 30 && DateUtils.dateBetweenIncludeToday(new Date(), date) < Integer.valueOf(certificatesMap.get(item.getCertificateName())) &&
DateUtils.dateCompare(date, new Date()) == 1) { DateUtils.dateCompare(date, new Date()) == 1) {
isInMonth = 1; isInMonth = 1;
} }
...@@ -234,6 +267,13 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -234,6 +267,13 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
@Transactional @Transactional
public PersonDto updatePerson(PersonDto model, HttpServletRequest httpServletRequest, Long sequenceNbr) throws ParseException { public PersonDto updatePerson(PersonDto model, HttpServletRequest httpServletRequest, Long sequenceNbr) throws ParseException {
if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) {
addRedisPostAndCerInfo();
}
// 岗位所需证书信息
Map<String, String> postNameMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_POST);
// 证书临期信息
Map<String, String> certificatesMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_CERTIFICATES);
//获取人员基本信息数据 //获取人员基本信息数据
PersonUser personUser = model.getPersonUser(); PersonUser personUser = model.getPersonUser();
...@@ -268,7 +308,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -268,7 +308,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
// 该岗位应获得的证书 // 该岗位应获得的证书
List<String> list2 = new ArrayList<>(); List<String> list2 = new ArrayList<>();
if (StringUtils.isNotEmpty(personUser.getPostName())) { if (StringUtils.isNotEmpty(personUser.getPostName())) {
String certificates = QrcodePostEnum.getCode(personUser.getPostName()); String certificates = String.valueOf(postNameMap.get(personUser.getPostName()));
list2 = Arrays.asList(certificates.split(",")); list2 = Arrays.asList(certificates.split(","));
} }
List<String> list = new ArrayList(list2); List<String> list = new ArrayList(list2);
...@@ -283,11 +323,10 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -283,11 +323,10 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
isOver = 1; isOver = 1;
} }
if (list.contains(item.getCertificateName()) && if (list.contains(item.getCertificateName()) &&
DateUtils.dateBetweenIncludeToday(date, new Date()) < 30 && DateUtils.dateBetweenIncludeToday(new Date(), date) < Integer.valueOf(certificatesMap.get(item.getCertificateName())) &&
DateUtils.dateCompare(date, new Date()) == 1) { DateUtils.dateCompare(date, new Date()) == 1) {
isInMonth = 1; isInMonth = 1;
} }
item.setPersonId(personBasic.getSequenceNbr()); item.setPersonId(personBasic.getSequenceNbr());
personCertificateService.save(item); personCertificateService.save(item);
list.remove(item.getCertificateName()); list.remove(item.getCertificateName());
...@@ -302,8 +341,6 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa ...@@ -302,8 +341,6 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode()); personBasic.setQrcodeColor(QrcodeColorEnum.YELLOW.getCode());
} }
this.personBasicMapper.updateById(personBasic); this.personBasicMapper.updateById(personBasic);
//人员账号信息 //人员账号信息
personAccount.setPersonId(sequenceNbr); personAccount.setPersonId(sequenceNbr);
oldpersonAccount=personAccountService.getById(personAccount.getSequenceNbr()); oldpersonAccount=personAccountService.getById(personAccount.getSequenceNbr());
......
...@@ -2,13 +2,16 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; ...@@ -2,13 +2,16 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.QrcodeColorEnum; import com.yeejoin.amos.boot.module.jxiop.api.Enum.QrcodeColorEnum;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.QrcodePostEnum;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonBasic;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonCertificate; import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonCertificate;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonCertificateMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonCertificateMapper;
import com.yeejoin.amos.boot.module.jxiop.api.util.Constants;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -33,9 +36,21 @@ public class PersonYardTimeTask { ...@@ -33,9 +36,21 @@ public class PersonYardTimeTask {
@Autowired @Autowired
PersonCertificateMapper personCertificateMapper; PersonCertificateMapper personCertificateMapper;
@Autowired
private AmosFeignService amosFeignService;
@Autowired
private RedisUtils redisUtils;
@Scheduled(cron = "0 0 0 1/1 * ? ") @Scheduled(cron = "0 0 0 1/1 * ? ")
public void timeYardTimeTask() { public void timeYardTimeTask() {
if (!redisUtils.hasKey(Constants.JXIOP_DICT_POST) || !redisUtils.hasKey(Constants.JXIOP_DICT_CERTIFICATES)) {
personBasicService.addRedisPostAndCerInfo();
}
// 岗位所需证书信息
Map<String, String> postNameMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_POST);
// 证书临期信息
Map<String, String> certificatesMap = (Map<String, String>) redisUtils.get(Constants.JXIOP_DICT_CERTIFICATES);
List<PersonBasic> personBasicList = personBasicMapper.selectList(null); List<PersonBasic> personBasicList = personBasicMapper.selectList(null);
List<PersonCertificate> personCertificates = personCertificateMapper.selectList(null); List<PersonCertificate> personCertificates = personCertificateMapper.selectList(null);
...@@ -51,7 +66,7 @@ public class PersonYardTimeTask { ...@@ -51,7 +66,7 @@ public class PersonYardTimeTask {
// 该岗位应获得的证书 // 该岗位应获得的证书
List<String> list2 = new ArrayList<>(); List<String> list2 = new ArrayList<>();
if (StringUtils.isNotEmpty(personBasic.getPostName())) { if (StringUtils.isNotEmpty(personBasic.getPostName())) {
String certificates = QrcodePostEnum.getCode(personBasic.getPostName()); String certificates = String.valueOf(postNameMap.get(personBasic.getPostName()));
list2 = Arrays.asList(certificates.split(",")); list2 = Arrays.asList(certificates.split(","));
} }
List<String> list = new ArrayList(list2); List<String> list = new ArrayList(list2);
...@@ -68,7 +83,7 @@ public class PersonYardTimeTask { ...@@ -68,7 +83,7 @@ public class PersonYardTimeTask {
} }
try { try {
if (list.contains(item.getCertificateName()) && if (list.contains(item.getCertificateName()) &&
DateUtils.dateBetweenIncludeToday(date, new Date()) < 30 && DateUtils.dateBetweenIncludeToday(new Date(), date) < Integer.valueOf(certificatesMap.get(item.getCertificateName())) &&
DateUtils.dateCompare(date, new Date()) == 1) { DateUtils.dateCompare(date, new Date()) == 1) {
isInMonth = 1; isInMonth = 1;
} }
......
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