Commit 6a13dee2 authored by fangxinjiang's avatar fangxinjiang

字典调整

parent a5e4688e
......@@ -268,8 +268,8 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
alert.setFileTown(Integer.toString(contract.getFileTown()));
}
alert.setEmpType(contract.getEmpNatrue());
alert.setContractType(contract.getContractName());
alert.setContractTerm(contract.getContractType());
alert.setContractTerm(contract.getContractTerm());
if (Common.isNotNull(alert.getContractEnd())){
if (Common.isNotNull(contract.getContractEnd()) && contract.getContractEnd().before(nowDate)){
alert.setDueFlag(CommonConstants.ONE_STRING);
......
......@@ -91,4 +91,14 @@ public interface CacheConstants {
**/
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 {
//- 横
char DOWN_LINE_CHAR ='_';
// 冒号 :
String COLON_STRING ="";
String COLON_STRING =":";
// - 横 分割线 中
String CENTER_SPLIT_LINE_STRING = "-";
// 斜杠
......
package com.yifu.cloud.plus.v1.yifu.common.core.util;
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.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants;
......@@ -46,8 +47,6 @@ public class ExcelUtil <T> implements Serializable {
private Field[] fields;
public void convertEntity(T vo, String[] exportFields, Map<String,String> diyDicMap, String dateFormat) {
String provinceTemp;
String cityTemp;
// 得到所有定义字段
Field[] allFields = clazz.getDeclaredFields();
List<Field> fields = new ArrayList<>();
......@@ -171,7 +170,10 @@ public class ExcelUtil <T> implements Serializable {
}
// 默认字典获取不到 去 缓存获取
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) {
for (Map.Entry<String, String> entry : dicObj.entrySet()) {
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(value.trim())) {
......@@ -447,11 +449,11 @@ public class ExcelUtil <T> implements Serializable {
return propertyValue;
}
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) {
tempStr = String.valueOf(RedisUtil.redis.opsForValue().get(c));
tempStr = String.valueOf(RedisUtil.redis.opsForValue().get(CacheConstants.AREA_LABEL + c));
if (Common.isEmpty(tempStr)){
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, attr.name() + ":" + c.trim() + "校验异常,请联系管理人员"), errorTemp);
return CommonConstants.EMPTY_STRING;
......@@ -459,7 +461,10 @@ public class ExcelUtil <T> implements Serializable {
return tempStr;
}
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;
for (Map.Entry<String,String> entry:dicObj.entrySet()){
if (Common.isNotNull(entry.getValue()) && entry.getValue().equals(c.trim())){
......
......@@ -96,7 +96,6 @@ public class RedisUtil {
}
return result;
}
/**
* 写入缓存
* @param key
......
......@@ -112,7 +112,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
private void extractedRedis(SysDictItem item) {
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);
}
......
......@@ -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.service.SysAreaService;
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.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
......@@ -39,7 +40,9 @@ public class DictItemRedisInit {
Map<String, Object> dictItem = dictItemService.getAllDictItemSub();
if (Common.isNotNull(dictItem)){
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("字典数据加入缓存初始化结束...");
......@@ -49,18 +52,21 @@ public class DictItemRedisInit {
if (Common.isNotNull(allAreas)){
Map<String,SysArea> areaMap = new HashMap<>();
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);
}
SysArea temp;
for (SysArea area:allAreas){
if (Common.isNotNull(area.getParentId()) && area.getParentId().intValue() > 0){
temp = areaMap.get(area.getParentId().toString());
redisUtil.set("area_" + area.getAreaName()
redisUtil.set(CacheConstants.AREA_VALUE
+ area.getAreaName()
+ CommonConstants.DOWN_LINE_STRING
+(Common.isNotNull(temp)?temp.getAreaName():""),area.getId());
}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