Merge remote-tracking branch 'lis8.0/master'

This commit is contained in:
jiangs 2026-03-09 10:10:39 +08:00
commit 163bfe89ba
10 changed files with 297 additions and 2 deletions

View File

@ -50,5 +50,8 @@ public class CacheConstants
* lis设置缓存
*/
public static final String COM_OPT_KEY = "com_opt:";
/**
* lis插件更新缓存
*/
public static final String SYS_EXE_BAK_KEY="sys_exe_bak:";
}

View File

@ -0,0 +1,19 @@
package com.czlis.common.core.domain.entity.lis;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysExeBak {
private String filepath;
private String filena;
private Date bakdt1;
private Date bakdt2;
private byte[] bakdata1;
private byte[] bakdata2;
}

View File

@ -0,0 +1,61 @@
package com.czlis.common.utils;
import com.alibaba.fastjson2.JSONArray;
import com.czlis.common.constant.CacheConstants;
import com.czlis.common.core.domain.entity.lis.SysExeBak;
import com.czlis.common.core.redis.RedisCache;
import com.czlis.common.utils.spring.SpringUtils;
import java.util.Collection;
import java.util.List;
/**
* lis插件更新工具类
*/
public class LisupdateUtils {
/**
* 设置代码插件更新缓存
*
* @param zdlb 插件更新类别
* @param PluginDatas 插件更新数据列表
*/
public static void setPluginCache(String zdlb, List<SysExeBak> PluginDatas) {
//先清除该key的所有缓存,然后再重新设置该key的缓存
SpringUtils.getBean(RedisCache.class).deleteObject(zdlb);
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(zdlb), PluginDatas);
}
/**
* 清空插件更新缓存
*/
public static void clearPluginCache() {
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_EXE_BAK_KEY + "*");
SpringUtils.getBean(RedisCache.class).deleteObject(keys);
}
/**
* 获取插件更新缓存
*
* @param zdlb 插件更新类别
* @return PluginDatas 插件更新数据列表
*/
public static List<SysExeBak> getPluginCache(String zdlb) {
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(zdlb));
if (StringUtils.isNotNull(arrayCache)) {
return arrayCache.toList(SysExeBak.class);
}
return null;
}
/**
* 设置cache key
*
* @param configKey 参数键
* @return 缓存键key
*/
public static String getCacheKey(String configKey) {
return CacheConstants.SYS_EXE_BAK_KEY + configKey;
}
}

View File

@ -0,0 +1,12 @@
package com.czlis.interfaceCommon.mapper;
import com.czlis.common.core.domain.entity.lis.SysExeBak;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysExeBakMapper {
List<SysExeBak> queryfilelist(String filepath);
SysExeBak getfile(@Param("filepath") String filepath, @Param("filena") String filena);
SysExeBak getdwfile(@Param("reportid") Integer reportid, @Param("reportkind") String reportkind);
}

View File

@ -0,0 +1,28 @@
package com.czlis.interfaceCommon.utils;
import com.czlis.common.core.domain.Result;
import com.czlis.common.core.domain.entity.lis.SysExeBak;
import com.czlis.common.utils.LisupdateUtils;
import com.czlis.interfaceCommon.mapper.SysExeBakMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Slf4j
@Component
public class SysExeBakUtil {
@Autowired
SysExeBakMapper sysExeBakMapper;
/**
* 定时检查插件更新
* @return
*/
public Result checkplugin(){
List<SysExeBak> filelist=sysExeBakMapper.queryfilelist("plugin");
LisupdateUtils.clearPluginCache();
LisupdateUtils.setPluginCache("plugin",filelist);
return new Result("0","成功!");
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.czlis.interfaceCommon.mapper.SysExeBakMapper">
<select id="queryfilelist" resultType="com.czlis.common.core.domain.entity.lis.SysExeBak">
select filepath,filena,bakdt1 from sys_exe_bak
where filepath = #{filepath}
</select>
<select id="getfile" resultType="com.czlis.common.core.domain.entity.lis.SysExeBak">
select bakdata1 from sys_exe_bak
<where>
<if test="filepath != null"> and filepath = #{filepath}</if>
<if test="filena != null and filena !=''">and filena = #{filena}</if>
</where>
</select>
<select id="getdwfile" resultType="com.czlis.common.core.domain.entity.lis.SysExeBak">
Select reportcontent as bakdata1 From blood_report
<where>
<if test="reportid != null"> and reportid = #{reportid}</if>
<if test="reportkind != null and reportkind !=''">and reportkind = #{reportkind}</if>
</where>
</select>
</mapper>

View File

@ -6,6 +6,7 @@ import com.czlis.common.core.domain.Result;
import com.czlis.interfaceCommon.constants.LisinterfaceNameConstants;
import com.czlis.interfaceCommon.pojo.inter.SetDict;
import com.czlis.interfaceCommon.utils.LisInterfaceUtil;
import com.czlis.interfaceCommon.utils.SysExeBakUtil;
import com.czlis.quartz.util.LisTaskUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -23,7 +24,8 @@ public class LisTask {
@Autowired
private LisInterfaceUtil lisInterfaceUtil;
@Autowired
private SysExeBakUtil sysExeBakUtil;
/**
* 获取his科室信息接口定时任务
* @return
@ -85,4 +87,11 @@ public class LisTask {
LisTaskUtil.deletePdfFilesBefore(outputPath);
return new Result("0","删除文件成功!");
}
/**
* 定时检查插件更新
* @return
*/
public Result checkplugin(){
return sysExeBakUtil.checkplugin();
}
}

View File

@ -0,0 +1,42 @@
package com.czlis.liswork.controller.plugin;
import com.czlis.common.annotation.Anonymous;
import com.czlis.common.core.controller.BaseController;
import com.czlis.common.core.domain.Result;
import com.czlis.liswork.service.LisPluginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/plugin")
@Api(tags = "插件自动更新接口")
@Slf4j
public class LisPluginController extends BaseController {
@Autowired
private LisPluginService lisPluginService;
@Anonymous
@ApiOperation("检查更新时间戳")
@GetMapping("/queryfilelist")
public Result queryfilelist() {
return lisPluginService.queryfilelist();
}
@Anonymous
@ApiOperation("获取更新文件")
@GetMapping("/getfile")
public Result getfile(String filename) {
return lisPluginService.getfile(filename);
}
@Anonymous
@ApiOperation("获取dw文件")
@GetMapping("/getdwfile")
public Result getdwfile(String filename) {
return lisPluginService.getdwfile(filename);
}
}

View File

@ -0,0 +1,9 @@
package com.czlis.liswork.service;
import com.czlis.common.core.domain.Result;
public interface LisPluginService {
Result queryfilelist();
Result getfile(String filename);
Result getdwfile(String filename);
}

View File

@ -0,0 +1,87 @@
package com.czlis.liswork.service.impl;
import cn.hutool.core.codec.Base64;
import com.czlis.common.core.domain.Result;
import com.czlis.common.core.domain.entity.lis.SysExeBak;
import com.czlis.common.utils.LisupdateUtils;
import com.czlis.interfaceCommon.mapper.SysExeBakMapper;
import com.czlis.interfaceCommon.utils.CommonUtil;
import com.czlis.liswork.service.LisPluginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class LisPluginServiceImpl implements LisPluginService {
@Autowired
SysExeBakMapper sysExeBakMapper;
@Autowired
CommonUtil commonUtil;
@Override
public Result queryfilelist(){
//List<SysExeBak> filelist=sysExeBakMapper.queryfilelist("plugin");
List<SysExeBak> filelist=LisupdateUtils.getPluginCache("plugin");
return new Result("0","成功",filelist);
}
@Override
public Result getfile(String filename){
SysExeBak file=sysExeBakMapper.getfile("plugin",filename);
if(file!=null){
byte[] txnr = file.getBakdata1();
String filedata = Base64.encode(txnr);
Map<String,String> map=new HashMap<>();
map.put("filename",filename);
map.put("filesize",txnr.length+"");
map.put("filedata",filedata);
return new Result("0","成功",map);
}
return new Result("-1","未找到");
}
/**
* 获取打印条码模板的DW文件
* @param filetype
* @return
*/
@Override
public Result getdwfile(String filetype){
String reportids=commonUtil.getComOptValue("_MZCX_",filetype);
if(reportids==null||"".equals(reportids))return new Result("-1","未找到模板");
Integer reportid = Integer.parseInt(reportids);
String reportkind="C";
switch (filetype) {
case "BARRPT":
//条码模板
reportkind="C";
break;
case "REQRPT":
//申请单模板
reportkind="F";
break;
case "RBKRPT":
//回执单模板
reportkind="D";
break;
case "BARRPT_ZJM":
//主界面条码模板
reportkind="C";
break;
}
SysExeBak file=sysExeBakMapper.getdwfile(reportid,"C");
if(file!=null){
byte[] txnr = file.getBakdata1();
String filedata = Base64.encode(txnr);
Map<String,String> map=new HashMap<>();
map.put("filesize",txnr.length+"");
map.put("filedata",filedata);
return new Result("0","成功",map);
}
return new Result("-1","未找到");
}
}