修改字典

parent 963d85a2
......@@ -257,7 +257,11 @@
<artifactId>shiro-spring</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.39</version>
</dependency>
<!--springfox-swagger需要的最小依赖 start -->
<dependency>
......
package com.xzxtshiro.util;
import com.alibaba.fastjson.JSONObject;
import com.xzxtshiro.pojo.SysDictitem;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -11,57 +12,36 @@ import java.util.Map;
public class RedisUtil {
//读取redis服务
/**
*
* hkey:省份 山西:14
* key: :14_CODE_UNIT_141181991700
* @return
* redis存储服务
* key:查询条件 (15_CODE_AJDLB_05000300_诈骗案_05000000)
* 15_CODE_AJDLB_0500*
* 15_CODE_AJDLB_0500*_诈*
*/
public static XzxtRestResult ReadRedisRest(String hkey,String key) {
public static XzxtRestResult ReadRedisRest(String key) {
//查询参数
Map<String, String> param = new HashMap<>();
XzxtRestResult xzxtRestResult = new XzxtRestResult();
param.put("hkey", hkey);
param.put("key", key);
//调用redisrest的服务
String json = HttpClientUtil.doPost("http://127.0.0.1:9043/xzxt-rest/ReadRedisRest", param);
if (!StringUtils.isBlank(json)) {
xzxtRestResult = XzxtRestResult.format(json);
}
return xzxtRestResult;
}
/**
*模糊查詢
* hkey:省份 山西:14
* key: :14_CODE_UNIT_141181991700
* @return
*/
public static XzxtRestResult ReadRedisRestList(String hkey,String key,String name) {
//查询参数
Map<String, String> param = new HashMap<>();
XzxtRestResult xzxtRestResult = new XzxtRestResult();
param.put("hkey", hkey);
param.put("key", key);
param.put("name", name);
//调用redisrest的服务
String json = HttpClientUtil.doPost("http://127.0.0.1:9043/xzxt-rest/ReadRedisRestList", param);
if (!StringUtils.isBlank(json)) {
xzxtRestResult = XzxtRestResult.formatToList(json,SysDictitem.class);
xzxtRestResult = JSONObject.parseObject(json, XzxtRestResult.class);
if (!StringUtils.isBlank(xzxtRestResult.getData().toString())) {
xzxtRestResult = xzxtRestResult.format(xzxtRestResult.getData().toString());
}
return xzxtRestResult;
}
//更新edis服务
/**
*
* hkey:省份 山西:14
* tpye:CODE_UNIT
* @return
* redis存储服务
* ssdw:省份 山西:14
* type::CODE_UNIT 传入空,就是更新所有字典
*/
public static XzxtRestResult UpdateRedisRest(String hkey,String tpye) {
public static XzxtRestResult UpdateRedisRest(String ssdw,String type) {
//查询参数
Map<String, String> param = new HashMap<>();
XzxtRestResult xzxtRestResult = new XzxtRestResult();
param.put("hkey", hkey);
param.put("type", tpye);
param.put("ssdw", ssdw);
param.put("type", type);
//调用redisrest的服务
String json = HttpClientUtil.doPost("http://127.0.0.1:9043/xzxt-rest/UpdateRedisRest", param);
if (!StringUtils.isBlank(json)) {
......
......@@ -49,12 +49,12 @@ public class ZtreeDataUtil {
String unitStr = user.getUnitcode();
String usergrade = user.getGrade();
SysDictitem dictitem = new SysDictitem();
dictitem.setGroupid("CODE_UNIT_ALL");
dictitem.setGroupid("SHIRO_UNIT");
dictitem.setCodeStr(unitStr.substring(0,2)+"%");
XzxtRestResult xzxtRestResult=new XzxtRestResult();
//从缓存中取内容
try {
xzxtRestResult=RedisUtil.ReadRedisRest(unitStr.substring(0,2),dictitem.getGroupid());
xzxtRestResult=RedisUtil.ReadRedisRest(unitStr.substring(0,2)+"_"+dictitem.getGroupid());
String result="";
if(xzxtRestResult.getStatus()==202) {
result= (String) xzxtRestResult.getData();
......@@ -66,7 +66,7 @@ public class ZtreeDataUtil {
//先存储
RedisUtil.UpdateRedisRest(unitStr.substring(0,2),dictitem.getGroupid());
//读取
xzxtRestResult=RedisUtil.ReadRedisRest(unitStr.substring(0,2),dictitem.getGroupid());
xzxtRestResult=RedisUtil.ReadRedisRest(unitStr.substring(0,2)+"_"+dictitem.getGroupid());
result= (String) xzxtRestResult.getData();
model.addAttribute("unit", result);
} catch (Exception e) {
......
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