打印插件
This commit is contained in:
parent
636088f638
commit
1e5fd5866f
@ -0,0 +1,18 @@
|
||||
package com.transitPlatForm.common.core.domain.entity;
|
||||
|
||||
|
||||
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 byte[] bakdata1;
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.transitPlatForm.interfaceCommon.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.transitPlatForm.common.core.domain.entity.SysExeBak;
|
||||
import com.transitPlatForm.common.core.redis.RedisCache;
|
||||
import com.transitPlatForm.common.utils.StringUtils;
|
||||
import com.transitPlatForm.common.utils.spring.SpringUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* lis插件更新工具类
|
||||
*/
|
||||
public class LisupdateUtils {
|
||||
public static final String SYS_EXE_BAK_KEY="sys_exe_bak:";
|
||||
/**
|
||||
* 设置代码插件更新缓存
|
||||
*
|
||||
* @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(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 SYS_EXE_BAK_KEY + configKey;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.transitPlatForm.transitPF.controller.plugin;
|
||||
|
||||
import com.transitPlatForm.common.annotation.Anonymous;
|
||||
import com.transitPlatForm.common.core.controller.BaseController;
|
||||
import com.transitPlatForm.common.core.domain.Result;
|
||||
import com.transitPlatForm.transitPF.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);
|
||||
}
|
||||
@Anonymous
|
||||
@ApiOperation("获取打印内容")
|
||||
@GetMapping("/getprintlist")
|
||||
public Result getprintlist(String guid) {
|
||||
return lisPluginService.getprintlist(guid);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.transitPlatForm.transitPF.mapper;
|
||||
|
||||
import com.transitPlatForm.common.core.domain.entity.SysExeBak;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface LisPluginMapper {
|
||||
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);
|
||||
String getLabIntersendList(String guid);
|
||||
List<Map<String, Object>> getBarprintList(@Param("strIds") List<String> strIds);
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.transitPlatForm.transitPF.service;
|
||||
|
||||
|
||||
import com.transitPlatForm.common.core.domain.Result;
|
||||
|
||||
public interface LisPluginService {
|
||||
Result queryfilelist();
|
||||
Result getfile(String filename);
|
||||
Result getdwfile(String filename);
|
||||
Result getprintlist(String printid);
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.transitPlatForm.transitPF.service.impl;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import com.transitPlatForm.common.core.domain.Result;
|
||||
import com.transitPlatForm.common.core.domain.entity.SysExeBak;
|
||||
import com.transitPlatForm.interfaceCommon.utils.LisupdateUtils;
|
||||
import com.transitPlatForm.transitPF.mapper.LisPluginMapper;
|
||||
import com.transitPlatForm.transitPF.service.LisPluginService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class LisPluginServiceImpl implements LisPluginService {
|
||||
@Autowired
|
||||
LisPluginMapper lisPluginMapper;
|
||||
@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=lisPluginMapper.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="103";//=comOptMapper.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=lisPluginMapper.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","未找到");
|
||||
}
|
||||
@Override
|
||||
public Result getprintlist(String guid){
|
||||
String senddata=lisPluginMapper.getLabIntersendList(guid);
|
||||
if(senddata==null||"".equals(senddata))return new Result("-1","未找到");
|
||||
List<String> strIds = Arrays.asList(senddata.split(","));
|
||||
List<Map<String,Object>> result = lisPluginMapper.getBarprintList(strIds);
|
||||
return new Result("0","成功",result);
|
||||
}
|
||||
}
|
||||
36
pf_transitPF/src/main/resources/mapper/LisPluginMapper.xml
Normal file
36
pf_transitPF/src/main/resources/mapper/LisPluginMapper.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<?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.transitPlatForm.transitPF.mapper.LisPluginMapper">
|
||||
|
||||
<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>
|
||||
<select id="getLabIntersendList" resultType="String">
|
||||
Select senddata From lab_intersend_list where guid=#{guid}
|
||||
</select>
|
||||
<select id="getBarprintList" resultType="map">
|
||||
Select * From v_barprint_list
|
||||
WHERE bar IN (
|
||||
<foreach collection="strIds" item="id" separator="," open="" close="">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user