代码字典缓存异步处理
This commit is contained in:
parent
eaadfe2eeb
commit
d745ed77e4
@ -15,16 +15,17 @@ import java.util.List;
|
|||||||
public class ComDictUtils {
|
public class ComDictUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置字典缓存
|
* 设置代码字典缓存
|
||||||
*
|
*
|
||||||
* @param key 参数键
|
* @param zdlb 字典类别
|
||||||
* @param dictDatas 字典数据列表
|
* @param dictDatas 字典数据列表
|
||||||
*/
|
*/
|
||||||
public static void setDictCache(String key, List<ComDict> dictDatas) {
|
public static void setDictCache(String zdlb, List<ComDict> dictDatas) {
|
||||||
//先清除该key的所有缓存,然后再重新设置该key的缓存
|
//先清除该key的所有缓存,然后再重新设置该key的缓存
|
||||||
SpringUtils.getBean(RedisCache.class).deleteObject(key);
|
SpringUtils.getBean(RedisCache.class).deleteObject(zdlb);
|
||||||
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);
|
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(zdlb), dictDatas);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空字典缓存
|
* 清空字典缓存
|
||||||
*/
|
*/
|
||||||
@ -35,11 +36,11 @@ public class ComDictUtils {
|
|||||||
/**
|
/**
|
||||||
* 获取字典缓存
|
* 获取字典缓存
|
||||||
*
|
*
|
||||||
* @param key 参数键
|
* @param zdlb 字典类别
|
||||||
* @return dictDatas 字典数据列表
|
* @return dictDatas 字典数据列表
|
||||||
*/
|
*/
|
||||||
public static List<ComDict> getDictCache(String key) {
|
public static List<ComDict> getDictCache(String zdlb) {
|
||||||
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
|
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(zdlb));
|
||||||
if (StringUtils.isNotNull(arrayCache)) {
|
if (StringUtils.isNotNull(arrayCache)) {
|
||||||
return arrayCache.toList(ComDict.class);
|
return arrayCache.toList(ComDict.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CommonUtil {
|
public class CommonUtil {
|
||||||
@ -43,20 +44,43 @@ public class CommonUtil {
|
|||||||
XmValMapper xmValMapper;
|
XmValMapper xmValMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
XmAlarmdetailMapper xmAlarmdetailMapper;
|
XmAlarmdetailMapper xmAlarmdetailMapper;
|
||||||
|
|
||||||
//====检验主表操作方法集合===
|
//====检验主表操作方法集合===
|
||||||
public LabPat getLabPatOne(Date jyrq, String yq, String ybh) {
|
public LabPat getLabPatOne(Date jyrq, String yq, String ybh) {
|
||||||
return labPatMapper.getLabPatOne(jyrq, yq, ybh);
|
return labPatMapper.getLabPatOne(jyrq, yq, ybh);
|
||||||
}
|
}
|
||||||
public List<LabPat> getLabPatListBySqh(String sqh){return labPatMapper.getLabPatListBySqh(sqh);}
|
|
||||||
public List<LabPat> getLabPatList(LabPat labPat) {return labPatMapper.getLabPat(labPat);}
|
public List<LabPat> getLabPatListBySqh(String sqh) {
|
||||||
|
return labPatMapper.getLabPatListBySqh(sqh);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LabPat> getLabPatList(LabPat labPat) {
|
||||||
|
return labPatMapper.getLabPat(labPat);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertLabPat(LabPat labPat) {return labPatMapper.updateLabPat(labPat);}
|
public int insertLabPat(LabPat labPat) {
|
||||||
|
return labPatMapper.updateLabPat(labPat);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int delLabPat(LabPat labPat){return labPatMapper.updateLabPat(labPat);}
|
public int delLabPat(LabPat labPat) {
|
||||||
|
return labPatMapper.updateLabPat(labPat);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateLabPat(LabPat labPat){return labPatMapper.updateLabPat(labPat);}
|
public int updateLabPat(LabPat labPat) {
|
||||||
public int getCountByKey(Date jyrq, String yq,String ybh) {return labPatMapper.getCountByKey(jyrq,yq,ybh);}
|
return labPatMapper.updateLabPat(labPat);
|
||||||
public String getSqhByKey(Date jyrq,String yq,String ybh){return labPatMapper.getSqhByKey(jyrq,yq,ybh);}
|
}
|
||||||
|
|
||||||
|
public int getCountByKey(Date jyrq, String yq, String ybh) {
|
||||||
|
return labPatMapper.getCountByKey(jyrq, yq, ybh);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSqhByKey(Date jyrq, String yq, String ybh) {
|
||||||
|
return labPatMapper.getSqhByKey(jyrq, yq, ybh);
|
||||||
|
}
|
||||||
|
|
||||||
//申请单主表方法集合
|
//申请单主表方法集合
|
||||||
public LabReqmain getLabReqmainOne(String sqh) {
|
public LabReqmain getLabReqmainOne(String sqh) {
|
||||||
return labReqmainMapper.getLabReqmainOne(sqh);
|
return labReqmainMapper.getLabReqmainOne(sqh);
|
||||||
@ -64,31 +88,83 @@ public class CommonUtil {
|
|||||||
//申请单明细表集合
|
//申请单明细表集合
|
||||||
|
|
||||||
//====检验结果表操作方法集合===
|
//====检验结果表操作方法集合===
|
||||||
public LabResult getLabResult(Date jyrq, String yq, String ybh, String xmdh) {return labResultMapper.getLabResult(jyrq, yq, ybh,xmdh);}
|
public LabResult getLabResult(Date jyrq, String yq, String ybh, String xmdh) {
|
||||||
public List<LabResult> getLabResultList(Date jyrq, String yq, String ybh) {return labResultMapper.getLabResultList(jyrq, yq, ybh);}
|
return labResultMapper.getLabResult(jyrq, yq, ybh, xmdh);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LabResult> getLabResultList(Date jyrq, String yq, String ybh) {
|
||||||
|
return labResultMapper.getLabResultList(jyrq, yq, ybh);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertLabResult(LabResult labResult) {return labResultMapper.insertLabResult(labResult);}
|
public int insertLabResult(LabResult labResult) {
|
||||||
public List<LabResult> getresultinfo(Date jyrq, String yq, String ybh) {return labResultMapper.getLabResultList(jyrq, yq, ybh);}
|
return labResultMapper.insertLabResult(labResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LabResult> getresultinfo(Date jyrq, String yq, String ybh) {
|
||||||
|
return labResultMapper.getLabResultList(jyrq, yq, ybh);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int delLabResult(LabResult labResult) {return labResultMapper.delLabResult(labResult);}
|
public int delLabResult(LabResult labResult) {
|
||||||
|
return labResultMapper.delLabResult(labResult);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int delNullLabResult(Date jyrq, String yq, String ybh) {return labResultMapper.delNullLabResult(jyrq, yq, ybh);}
|
public int delNullLabResult(Date jyrq, String yq, String ybh) {
|
||||||
|
return labResultMapper.delNullLabResult(jyrq, yq, ybh);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateLabResult(LabResult labResult) {return labResultMapper.updateLabResult(labResult);}
|
public int updateLabResult(LabResult labResult) {
|
||||||
|
return labResultMapper.updateLabResult(labResult);
|
||||||
|
}
|
||||||
|
|
||||||
//=====项目字典查询=========
|
//=====项目字典查询=========
|
||||||
public List<XmInfo> getXmInfoList(String yq) {return xmInfoMapper.getXmInfoList(yq);}
|
public List<XmInfo> getXmInfoList(String yq) {
|
||||||
public XmInfo getXmInfo(String yq,String xmdh) {return xmInfoMapper.getXmInfo(yq,xmdh);}
|
return xmInfoMapper.getXmInfoList(yq);
|
||||||
public List<XmRef> getXmRefList(String yq) {return xmRefMapper.getXmRefList(yq);}
|
}
|
||||||
public XmRef getXmRef(String yq,String xmdh) {return xmRefMapper.getXmRef(yq,xmdh);}
|
|
||||||
public XmRef getXmRefValue(Map<String,Object> map) {return xmRefMapper.getXmRefValue(map);}
|
public XmInfo getXmInfo(String yq, String xmdh) {
|
||||||
public String getXmRefJgbz(String yq,String xmdh,String csjg,String csjg1,String csjg2) {return xmValMapper.getXmValJgbz(yq,xmdh,csjg,csjg1,csjg2);}
|
return xmInfoMapper.getXmInfo(yq, xmdh);
|
||||||
public List<XmAlarmdetail> getXmAlarmdetail(String yq,String xmdh){return xmAlarmdetailMapper.getXmAlarmdetail(yq,xmdh);};
|
}
|
||||||
|
|
||||||
|
public List<XmRef> getXmRefList(String yq) {
|
||||||
|
return xmRefMapper.getXmRefList(yq);
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmRef getXmRef(String yq, String xmdh) {
|
||||||
|
return xmRefMapper.getXmRef(yq, xmdh);
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmRef getXmRefValue(Map<String, Object> map) {
|
||||||
|
return xmRefMapper.getXmRefValue(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getXmRefJgbz(String yq, String xmdh, String csjg, String csjg1, String csjg2) {
|
||||||
|
return xmValMapper.getXmValJgbz(yq, xmdh, csjg, csjg1, csjg2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<XmAlarmdetail> getXmAlarmdetail(String yq, String xmdh) {
|
||||||
|
return xmAlarmdetailMapper.getXmAlarmdetail(yq, xmdh);
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
//服务器时间方法
|
//服务器时间方法
|
||||||
public Date getCurrentTime(){return commonMapper.getCurrentTime();}
|
public Date getCurrentTime() {
|
||||||
public String getCurrentDate(){return DateFormatUtils.format(commonMapper.getCurrentTime(), "yyyy-MM-dd");}
|
return commonMapper.getCurrentTime();
|
||||||
public String getCurrentDateTime(){return DateFormatUtils.format(commonMapper.getCurrentTime(), "yyyy-MM-dd HH:mm:ss");}
|
}
|
||||||
|
|
||||||
|
public String getCurrentDate() {
|
||||||
|
return DateFormatUtils.format(commonMapper.getCurrentTime(), "yyyy-MM-dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrentDateTime() {
|
||||||
|
return DateFormatUtils.format(commonMapper.getCurrentTime(), "yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
|
||||||
//字典查询单位名称
|
//字典查询单位名称
|
||||||
public String getCompany(String yljg) {
|
public String getCompany(String yljg) {
|
||||||
if (yljg == null || yljg.equals("")) return getCompany();
|
if (yljg == null || yljg.equals("")) return getCompany();
|
||||||
@ -99,6 +175,7 @@ public class CommonUtil {
|
|||||||
return zdmc;
|
return zdmc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCompany() {
|
public String getCompany() {
|
||||||
String zdmc = getComDictNameById("99", "COMPANY");
|
String zdmc = getComDictNameById("99", "COMPANY");
|
||||||
if (zdmc == null || zdmc.equals("")) {
|
if (zdmc == null || zdmc.equals("")) {
|
||||||
@ -112,24 +189,29 @@ public class CommonUtil {
|
|||||||
public String getComDictNameById(String zdlb, String zddh) {
|
public String getComDictNameById(String zdlb, String zddh) {
|
||||||
List<ComDict> comDictList = getDictCache(zdlb);
|
List<ComDict> comDictList = getDictCache(zdlb);
|
||||||
if (comDictList != null) {
|
if (comDictList != null) {
|
||||||
for (ComDict dict : comDictList) {
|
List<ComDict> collect = comDictList.stream().filter(comDict -> comDict.getZddh().equals(zddh)).collect(Collectors.toList());
|
||||||
if (zddh.equals(dict.getZddh())) {
|
if(collect.size() > 0){
|
||||||
return dict.getZdmc();
|
return collect.get(0).getZdmc();
|
||||||
}
|
}
|
||||||
}}
|
}
|
||||||
|
//如果redis当中没有查到数据,则先在设置redis值,
|
||||||
|
ComDictUtils.setDictCache(zdlb,comDictMapper.getComDictListByZdlb(zdlb));
|
||||||
return comDictMapper.getComDictNameById(zdlb, zddh);
|
return comDictMapper.getComDictNameById(zdlb, zddh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getComDictIdByName(String zdlb, String zdmc) {
|
public String getComDictIdByName(String zdlb, String zdmc) {
|
||||||
List<ComDict> comDictList = getDictCache(zdlb);
|
List<ComDict> comDictList = getDictCache(zdlb);
|
||||||
if (comDictList != null) {
|
if (comDictList != null) {
|
||||||
for (ComDict dict : comDictList) {
|
List<ComDict> collect = comDictList.stream().filter(comDict -> comDict.getZdmc().equals(zdmc)).collect(Collectors.toList());
|
||||||
if (zdmc.equals(dict.getZdmc())) {
|
if(collect.size() > 0){
|
||||||
return dict.getZddh();
|
return collect.get(0).getZdmc();
|
||||||
}
|
}
|
||||||
}}
|
}
|
||||||
|
//如果redis当中没有查到数据,则先在设置redis值,
|
||||||
|
ComDictUtils.setDictCache(zdlb,comDictMapper.getComDictListByZdlb(zdlb));
|
||||||
return comDictMapper.getComDictIdByName(zdlb, zdmc);
|
return comDictMapper.getComDictIdByName(zdlb, zdmc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getComOptValue(String yq, String xxdh) {
|
public String getComOptValue(String yq, String xxdh) {
|
||||||
ComOpt comOpt = getOptCache(yq, xxdh);
|
ComOpt comOpt = getOptCache(yq, xxdh);
|
||||||
if (comOpt != null) {
|
if (comOpt != null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user