Переглянути джерело

增加his业务逻辑代码及数据比对接口

liuqq 3 роки тому
батько
коміт
4b50de64c4

+ 4 - 9
external-service/src/main/java/com/lantone/external/facade/VLtDeptInfoFacade.java

@@ -1,23 +1,18 @@
 package com.lantone.external.facade;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.lantone.common.util.BeanUtil;
 import com.lantone.common.util.ListUtil;
 import com.lantone.external.entity.VLtDeptInfo;
 import com.lantone.external.service.impl.VLtDeptInfoServiceImpl;
-import com.lantone.external.util.RedisUtil;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
-import java.util.Set;
 
 @Component
 public class VLtDeptInfoFacade extends VLtDeptInfoServiceImpl {
 
-    @Autowired
-    RedisUtil redisUtil;
+    /*@Autowired
+    RedisUtil redisUtil;*/
 
     private static final String DEPTS = "depts";
 
@@ -30,7 +25,7 @@ public class VLtDeptInfoFacade extends VLtDeptInfoServiceImpl {
         */
         List<VLtDeptInfo> list=this.getBaseMapper().selectList(queryWrapper);
         if(ListUtil.isNotEmpty(list)){
-            //获取所有的key值
+            /*//获取所有的key值
             Set<String> keys= redisUtil.getKeyList(DEPTS);
             //先删除以往缓存数据
             redisUtil.delete(keys);
@@ -38,7 +33,7 @@ public class VLtDeptInfoFacade extends VLtDeptInfoServiceImpl {
             //将新获取的数据进行存储
             List<VLtDeptInfo> deptList= BeanUtil.listCopyTo(list,VLtDeptInfo.class);
             Boolean flag=redisUtil.setIfAbsent(DEPTS, JSON.toJSONString(deptList));
-            return flag;
+            return flag;*/
         }
         return true;
     }

+ 4 - 9
external-service/src/main/java/com/lantone/external/facade/VLtDoctorInfoFacade.java

@@ -1,23 +1,18 @@
 package com.lantone.external.facade;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.lantone.common.util.BeanUtil;
 import com.lantone.common.util.ListUtil;
 import com.lantone.external.entity.VLtDoctorInfo;
 import com.lantone.external.service.impl.VLtDoctorInfoServiceImpl;
-import com.lantone.external.util.RedisUtil;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
-import java.util.Set;
 
 @Component
 public class VLtDoctorInfoFacade extends VLtDoctorInfoServiceImpl {
 
-    @Autowired
-    RedisUtil redisUtil;
+    /*@Autowired
+    RedisUtil redisUtil;*/
 
     private static final String DOCTORS = "doctors";
 
@@ -31,14 +26,14 @@ public class VLtDoctorInfoFacade extends VLtDoctorInfoServiceImpl {
         */
         List<VLtDoctorInfo> list=this.getBaseMapper().selectList(queryWrapper);
         if(ListUtil.isNotEmpty(list)){
-            //获取所有的key值
+            /*//获取所有的key值
             Set<String> keys= redisUtil.getKeyList(DOCTORS);
             //先删除以往缓存数据
             redisUtil.delete(keys);
 
             //将新获取的数据进行存储
             List<VLtDoctorInfo> doctorList= BeanUtil.listCopyTo(list,VLtDoctorInfo.class);
-            Boolean flag=redisUtil.setIfAbsent(DOCTORS, JSON.toJSONString(doctorList));
+            Boolean flag=redisUtil.setIfAbsent(DOCTORS, JSON.toJSONString(doctorList));*/
         }
     }
 }

+ 4 - 10
external-service/src/main/java/com/lantone/external/facade/VLtRecordTypeFacade.java

@@ -1,24 +1,18 @@
 package com.lantone.external.facade;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.lantone.common.util.BeanUtil;
 import com.lantone.common.util.ListUtil;
-import com.lantone.external.config.RedisConfig;
 import com.lantone.external.entity.VLtRecordType;
 import com.lantone.external.service.impl.VLtRecordTypeServiceImpl;
-import com.lantone.external.util.RedisUtil;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
-import java.util.Set;
 
 @Component
 public class VLtRecordTypeFacade extends VLtRecordTypeServiceImpl {
 
-    @Autowired
-    RedisUtil redisUtil;
+   /* @Autowired
+    RedisUtil redisUtil;*/
 
     private static final String RECORD_TYPE = "recordTypes";
 
@@ -32,13 +26,13 @@ public class VLtRecordTypeFacade extends VLtRecordTypeServiceImpl {
         */
         List<VLtRecordType> list=this.getBaseMapper().selectList(queryWrapper);
         if(ListUtil.isNotEmpty(list)){
-            //获取所有的key值
+           /* //获取所有的key值
             Set<String> keys= redisUtil.getKeyList(RECORD_TYPE);
             //先删除以往缓存数据
             redisUtil.delete(keys);
             //将新获取的数据进行存储
             List<VLtRecordType> deptList= BeanUtil.listCopyTo(list,VLtRecordType.class);
-            Boolean flag=redisUtil.setIfAbsent(RECORD_TYPE, JSON.toJSONString(deptList));
+            Boolean flag=redisUtil.setIfAbsent(RECORD_TYPE, JSON.toJSONString(deptList));*/
         }
     }
 }

+ 2 - 10
external-service/src/main/java/com/lantone/external/facade/ViewDoctorInfoFacade.java

@@ -1,22 +1,14 @@
 package com.lantone.external.facade;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.lantone.common.util.BeanUtil;
-import com.lantone.common.util.ListUtil;
 import com.lantone.external.entity.VLtDoctorInfo;
-import com.lantone.external.util.RedisUtil;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.List;
-import java.util.Set;
-
 @Component
 public class ViewDoctorInfoFacade {
 
-    @Autowired
-    RedisUtil redisUtil;
+    /*@Autowired
+    RedisUtil redisUtil;*/
 
     private static final String DOCTORS = "doctors";
 

+ 2 - 4
external-service/src/main/java/com/lantone/external/facade/ViewRecordTypeFacade.java

@@ -2,15 +2,13 @@ package com.lantone.external.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.lantone.external.entity.VLtRecordType;
-import com.lantone.external.util.RedisUtil;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
 public class ViewRecordTypeFacade{
 
-   @Autowired
-   RedisUtil redisUtil;
+   /*@Autowired
+   RedisUtil redisUtil;*/
 
     private static final String RECORD_TYPE = "recordTypes";
 

+ 6 - 9
external-service/src/main/java/com/lantone/external/task/DataViewTask.java

@@ -4,7 +4,6 @@ import com.lantone.external.dto.RespDTO;
 import com.lantone.external.facade.VLtDeptInfoFacade;
 import com.lantone.external.facade.VLtDoctorInfoFacade;
 import com.lantone.external.facade.VLtRecordTypeFacade;
-import com.lantone.external.util.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
@@ -12,15 +11,13 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
-import java.util.*;
-
 @Component
 @Configuration      //1.主要用于标记配置类,兼备Component的效果。
 @EnableScheduling   // 2.开启定时任务
 @Slf4j
 public class DataViewTask {
-    @Autowired
-    RedisUtil redisUtil;
+    /*@Autowired
+    RedisUtil redisUtil;*/
 
     private static final String DEPTS = "depts";
     private static final String DOCTORS = "doctors";
@@ -57,7 +54,7 @@ public class DataViewTask {
     public RespDTO initDoctorData(){
         try{
             //获取所有的key值
-            String values= redisUtil.get(DOCTORS);
+            //String values= redisUtil.get(DOCTORS);
             //根据key值,获取对应的数据
            /* List<BasDoctorInfo> list= JSON.parseArray(values,BasDoctorInfo.class);
             if(ListUtil.isNotEmpty(list)){
@@ -77,7 +74,7 @@ public class DataViewTask {
     //@Scheduled(cron = "0 47 17 * * ?")
     public void initDeptData(){
         //获取所有的key值
-        String values= redisUtil.get(DEPTS);
+        //String values= redisUtil.get(DEPTS);
         //根据key值,获取对应的数据
         /*List<BasDeptInfo> list= JSON.parseArray(values,BasDeptInfo.class);
         if(ListUtil.isNotEmpty(list)){
@@ -93,7 +90,7 @@ public class DataViewTask {
     //@Scheduled(cron = "0 48 17 * * ?")
     public void initRecordTypeData(){
         //获取所有的key值
-        String values= redisUtil.get(RECORD_TYPE);
+        //String values= redisUtil.get(RECORD_TYPE);
         //根据key值,获取对应的数据
         /*List<MedRecordType> list= JSON.parseArray(values,MedRecordType.class);
         if(ListUtil.isNotEmpty(list)){
@@ -103,7 +100,7 @@ public class DataViewTask {
 
     public void initDoctors() throws Exception{
         //获取所有的key值
-        Set<String> keys= redisUtil.getKeyList(DEPTS+"**");
+        //Set<String> keys= redisUtil.getKeyList(DEPTS+"**");
         //根据key值,获取对应的数据
         /*List<List<BasDoctorInfo>> list=redisUtil.multiGet(keys);
         if(ListUtil.isNotEmpty(list)){

+ 0 - 306
external-service/src/main/java/com/lantone/external/util/RedisUtil.java

@@ -1,306 +0,0 @@
-package com.lantone.external.util;
-
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.MapUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Component;
-
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @description: redis工具类
- * @author: zhoutg
- * @time: 2020/8/11 19:52
- */
-@Component
-public class RedisUtil {
-
-    @Autowired
-    @Qualifier("redisTemplateForTable")
-    RedisTemplate redisTemplate;
-
-    /**
-     * 根据指定key获取value
-     *
-     * @param key 键
-     */
-    public <T> T get(String key) {
-        return (T) redisTemplate.opsForValue().get(key);
-    }
-
-    /**
-     * 根据指定key设置obj
-     *
-     * @param key
-     * @param obj
-     */
-    public void set(String key, Object obj) {
-        redisTemplate.opsForValue().set(key, obj);
-    }
-
-    /**
-     * 根据指定key设置obj
-     *
-     * @param key
-     * @param obj
-     */
-    public boolean setFlag(String key, Object obj) {
-        try {
-            redisTemplate.opsForValue().set(key, obj);
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 批量获取
-     *
-     * @param keys
-     * @return
-     */
-    public <T> List<T> multiGet(Collection<String> keys) {
-        return redisTemplate.opsForValue().multiGet(keys);
-    }
-
-    /**
-     * 批量设置
-     *
-     * @param map
-     * @return
-     */
-    public void multiSet(Map<String, Object> map) {
-        redisTemplate.opsForValue().multiSet(map);
-    }
-
-    /**
-     * 更新指定的数据
-     *
-     * @param key
-     * @param str
-     */
-    public void updateValue(String key, String str) {
-        redisTemplate.opsForValue().set(key, str);
-    }
-
-    /**
-     * 删除key
-     *
-     * @param key
-     */
-    public void delete(String key) {
-        redisTemplate.delete(key);
-    }
-
-    /**
-     * 批量删除key
-     *
-     * @param keys
-     */
-    public void delete(Collection<String> keys) {
-        redisTemplate.delete(keys);
-    }
-
-    /**
-     * 根据前缀删除key
-     *
-     * @param prex
-     */
-    public void deleteByPrex(String prex) {
-        prex = prex + "**";
-        Set<String> keys = getKeyList(prex);
-        if (CollectionUtils.isNotEmpty(keys)) {
-            redisTemplate.delete(keys);
-        }
-    }
-
-    /**
-     * 根据前缀删除key
-     *
-     * @param prex
-     */
-    public <T> List<T> getByPrex(String prex) {
-        prex = prex + "**";
-        Set<String> keys = getKeyList(prex);
-        if (CollectionUtils.isNotEmpty(keys)) {
-            return multiGet(keys);
-        }
-        return null;
-    }
-
-    /**
-     * 根据正则key获取value列表
-     *
-     * @param pattern 键
-     */
-    public <T> List<T> getByRegex(String pattern) {
-        Set<String> keys = getKeyList(pattern);
-        return multiGet(keys);
-    }
-
-    /**
-     * 查找匹配的key
-     *
-     * @param pattern
-     * @return
-     */
-    public Set<String> getKeyList(String pattern) {
-        return redisTemplate.keys(pattern);
-    }
-
-    /**
-     * 序列化key
-     *
-     * @param key
-     * @return
-     */
-    public byte[] dump(String key) {
-        return redisTemplate.dump(key);
-    }
-
-    /**
-     * 是否存在key
-     *
-     * @param key
-     * @return
-     */
-    public Boolean hasKey(String key) {
-        return redisTemplate.hasKey(key);
-    }
-
-    /**
-     * 设置过期时间
-     *
-     * @param key
-     * @param timeout
-     * @param unit
-     * @return
-     */
-    public Boolean expire(String key, long timeout, TimeUnit unit) {
-        return redisTemplate.expire(key, timeout, unit);
-    }
-
-    /**
-     * 设置过期时间
-     *
-     * @param key
-     * @param date
-     * @return
-     */
-    public Boolean expireAt(String key, Date date) {
-        return redisTemplate.expireAt(key, date);
-    }
-
-    /**
-     * 移除 key 的过期时间,key 将持久保持
-     *
-     * @param key
-     * @return
-     */
-    public Boolean persist(String key) {
-        return redisTemplate.persist(key);
-    }
-
-    /**
-     * 返回 key 的剩余的过期时间
-     *
-     * @param key
-     * @param unit
-     * @return
-     */
-    public Long getExpire(String key, TimeUnit unit) {
-        return redisTemplate.getExpire(key, unit);
-    }
-
-    /**
-     * 返回 key 的剩余的过期时间
-     *
-     * @param key
-     * @return
-     */
-    public Long getExpire(String key) {
-        return redisTemplate.getExpire(key);
-    }
-
-    /**
-     * 修改 key 的名称
-     *
-     * @param oldKey
-     * @param newKey
-     */
-    public void rename(String oldKey, String newKey) {
-        redisTemplate.rename(oldKey, newKey);
-    }
-
-    /**
-     * 仅当 newkey 不存在时,将 oldKey 改名为 newkey
-     *
-     * @param oldKey
-     * @param newKey
-     * @return
-     */
-    public Boolean renameIfAbsent(String oldKey, String newKey) {
-        return redisTemplate.renameIfAbsent(oldKey, newKey);
-    }
-
-    /**
-     * 设置指定 key 的值
-     *
-     * @param key
-     * @param value
-     */
-    public void set(String key, String value) {
-        redisTemplate.opsForValue().set(key, value);
-    }
-
-    /**
-     * 将值 value 关联到 key ,并将 key 的过期时间设为 timeout
-     *
-     * @param key
-     * @param value
-     * @param timeout 过期时间
-     * @param unit    时间单位, 天:TimeUnit.DAYS 小时:TimeUnit.HOURS 分钟:TimeUnit.MINUTES
-     *                秒:TimeUnit.SECONDS 毫秒:TimeUnit.MILLISECONDS
-     */
-    public void setEx(String key, Object value, long timeout, TimeUnit unit) {
-        redisTemplate.opsForValue().set(key, value, timeout, unit);
-    }
-
-    /**
-     * 只有在 key 不存在时设置 key 的值
-     *
-     * @param key
-     * @param value
-     * @return 之前已经存在返回false, 不存在返回true
-     */
-    public boolean setIfAbsent(String key, String value) {
-        return redisTemplate.opsForValue().setIfAbsent(key, value);
-    }
-
-    /**
-     * map集合的形式添加键值对
-     *
-     * @param key
-     * @param map
-     */
-    public void putHashMap(String key, Map<String, Object> map) {
-        if (MapUtils.isNotEmpty(map)) {
-            redisTemplate.opsForHash().putAll(key, map);
-        }
-    }
-
-    /**
-     * 获取集合中指定field的内容
-     * @param key
-     * @param field
-     * @param <T>
-     * @return
-     */
-    public <T> T getByKeyAndField(String key, String field) {
-        return (T)redisTemplate.opsForHash().get(key, field);
-    }
-}