Compare commits
4 Commits
b888819a47
...
f9cf92bd02
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9cf92bd02 | ||
|
|
4c7a5ab963 | ||
|
|
2275e641da | ||
|
|
d8b97b36d6 |
@ -4,9 +4,12 @@ import com.czlis.common.core.domain.entity.lis.SysExeBak;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface SysExeBakMapper {
|
public interface SysExeBakMapper {
|
||||||
List<SysExeBak> queryfilelist(String filepath);
|
List<SysExeBak> queryfilelist(String filepath);
|
||||||
SysExeBak getfile(@Param("filepath") String filepath, @Param("filena") String filena);
|
SysExeBak getfile(@Param("filepath") String filepath, @Param("filena") String filena);
|
||||||
SysExeBak getdwfile(@Param("reportid") Integer reportid, @Param("reportkind") String reportkind);
|
SysExeBak getdwfile(@Param("reportid") Integer reportid, @Param("reportkind") String reportkind);
|
||||||
|
String getLabIntersendList(String guid);
|
||||||
|
List<Map<String, Object>> getBarprintList(@Param("strIds") List<String> strIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -255,6 +255,32 @@ public class ChatWebSocketServer {
|
|||||||
}
|
}
|
||||||
return roleUsers;
|
return roleUsers;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 根据WebId筛选在线用户(如仅获取管理员)
|
||||||
|
*/
|
||||||
|
public static List<WebSocketUser> getOnlineUsersByWebId(String webId) {
|
||||||
|
List<WebSocketUser> roleUsers = new ArrayList<>();
|
||||||
|
if (webId == null || webId.trim().isEmpty()) {
|
||||||
|
return roleUsers;
|
||||||
|
}
|
||||||
|
for (WebSocketUser user : ONLINE_USER_MAP.values()) {
|
||||||
|
if (webId.equals(user.getWebId()) && user.isConnected()) {
|
||||||
|
roleUsers.add(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return roleUsers;
|
||||||
|
}
|
||||||
|
public static String getUsersByWebId(String webId) {
|
||||||
|
if (webId == null || webId.trim().isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (WebSocketUser user : ONLINE_USER_MAP.values()) {
|
||||||
|
if (webId.equals(user.getWebId())) {
|
||||||
|
return user.getUserId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 新增:通过IP快速查询对应的userId(核心效率方法)
|
* 新增:通过IP快速查询对应的userId(核心效率方法)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -231,6 +231,9 @@ public class WebSocketMsgServiceImpl implements WebSocketMsgService {
|
|||||||
case "username":
|
case "username":
|
||||||
user.setUsername(value);
|
user.setUsername(value);
|
||||||
break;
|
break;
|
||||||
|
case "webid":
|
||||||
|
user.setWebId(value);
|
||||||
|
break;
|
||||||
case "role":
|
case "role":
|
||||||
user.setRole(value);
|
user.setRole(value);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -12,6 +12,7 @@ public class WebSocketUser {
|
|||||||
// 核心字段:用户唯一标识(仍保持final,不建议修改)
|
// 核心字段:用户唯一标识(仍保持final,不建议修改)
|
||||||
private final String userId;
|
private final String userId;
|
||||||
// 身份属性(移除final修饰符,支持修改)
|
// 身份属性(移除final修饰符,支持修改)
|
||||||
|
private String webId;
|
||||||
private String username; // 用户名
|
private String username; // 用户名
|
||||||
private String role; // 角色(如ADMIN/USER)
|
private String role; // 角色(如ADMIN/USER)
|
||||||
private String loginIp; // 登录IP
|
private String loginIp; // 登录IP
|
||||||
@ -46,7 +47,15 @@ public class WebSocketUser {
|
|||||||
public void setUsername(String username) {
|
public void setUsername(String username) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
}
|
}
|
||||||
|
// ========== 可修改属性(getter + setter) ==========
|
||||||
|
public String getWebId() {
|
||||||
|
return webId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加username的setter方法
|
||||||
|
public void setWebId(String webId) {
|
||||||
|
this.webId = webId;
|
||||||
|
}
|
||||||
public String getRole() {
|
public String getRole() {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,4 +22,15 @@
|
|||||||
<if test="reportkind != null and reportkind !=''">and reportkind = #{reportkind}</if>
|
<if test="reportkind != null and reportkind !=''">and reportkind = #{reportkind}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|||||||
@ -38,5 +38,11 @@ public class LisPluginController extends BaseController {
|
|||||||
public Result getdwfile(String filename) {
|
public Result getdwfile(String filename) {
|
||||||
return lisPluginService.getdwfile(filename);
|
return lisPluginService.getdwfile(filename);
|
||||||
}
|
}
|
||||||
|
@Anonymous
|
||||||
|
@ApiOperation("获取打印内容")
|
||||||
|
@GetMapping("/getprintlist")
|
||||||
|
public Result getprintlist(String guid) {
|
||||||
|
return lisPluginService.getprintlist(guid);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,4 +6,5 @@ public interface LisPluginService {
|
|||||||
Result queryfilelist();
|
Result queryfilelist();
|
||||||
Result getfile(String filename);
|
Result getfile(String filename);
|
||||||
Result getdwfile(String filename);
|
Result getdwfile(String filename);
|
||||||
|
Result getprintlist(String printid);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,13 +4,14 @@ import cn.hutool.core.codec.Base64;
|
|||||||
import com.czlis.common.core.domain.Result;
|
import com.czlis.common.core.domain.Result;
|
||||||
import com.czlis.common.core.domain.entity.lis.SysExeBak;
|
import com.czlis.common.core.domain.entity.lis.SysExeBak;
|
||||||
import com.czlis.common.utils.LisupdateUtils;
|
import com.czlis.common.utils.LisupdateUtils;
|
||||||
|
import com.czlis.interfaceCommon.mapper.ComOptMapper;
|
||||||
import com.czlis.interfaceCommon.mapper.SysExeBakMapper;
|
import com.czlis.interfaceCommon.mapper.SysExeBakMapper;
|
||||||
import com.czlis.interfaceCommon.utils.CommonUtil;
|
|
||||||
import com.czlis.liswork.service.LisPluginService;
|
import com.czlis.liswork.service.LisPluginService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -21,7 +22,7 @@ public class LisPluginServiceImpl implements LisPluginService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
SysExeBakMapper sysExeBakMapper;
|
SysExeBakMapper sysExeBakMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
CommonUtil commonUtil;
|
ComOptMapper comOptMapper;
|
||||||
@Override
|
@Override
|
||||||
public Result queryfilelist(){
|
public Result queryfilelist(){
|
||||||
//List<SysExeBak> filelist=sysExeBakMapper.queryfilelist("plugin");
|
//List<SysExeBak> filelist=sysExeBakMapper.queryfilelist("plugin");
|
||||||
@ -50,7 +51,7 @@ public class LisPluginServiceImpl implements LisPluginService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result getdwfile(String filetype){
|
public Result getdwfile(String filetype){
|
||||||
String reportids=commonUtil.getComOptValue("_MZCX_",filetype);
|
String reportids=comOptMapper.getComOptValue("_MZCX_",filetype);
|
||||||
if(reportids==null||"".equals(reportids))return new Result("-1","未找到模板");
|
if(reportids==null||"".equals(reportids))return new Result("-1","未找到模板");
|
||||||
Integer reportid = Integer.parseInt(reportids);
|
Integer reportid = Integer.parseInt(reportids);
|
||||||
String reportkind="C";
|
String reportkind="C";
|
||||||
@ -84,4 +85,12 @@ public class LisPluginServiceImpl implements LisPluginService {
|
|||||||
}
|
}
|
||||||
return new Result("-1","未找到");
|
return new Result("-1","未找到");
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public Result getprintlist(String guid){
|
||||||
|
String senddata=sysExeBakMapper.getLabIntersendList(guid);
|
||||||
|
if(senddata==null||"".equals(senddata))return new Result("-1","未找到");
|
||||||
|
List<String> strIds = Arrays.asList(senddata.split(","));
|
||||||
|
List<Map<String,Object>> result = sysExeBakMapper.getBarprintList(strIds);
|
||||||
|
return new Result("0","成功",result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.czlis.common.core.domain.Result;
|
import com.czlis.common.core.domain.Result;
|
||||||
|
import com.czlis.common.core.domain.entity.SysLoginParam;
|
||||||
import com.czlis.common.core.domain.entity.lis.LabIntersendList;
|
import com.czlis.common.core.domain.entity.lis.LabIntersendList;
|
||||||
import com.czlis.common.core.domain.entity.lis.LabReqdetail;
|
import com.czlis.common.core.domain.entity.lis.LabReqdetail;
|
||||||
import com.czlis.common.core.domain.entity.lis.LabReqmain;
|
import com.czlis.common.core.domain.entity.lis.LabReqmain;
|
||||||
@ -374,6 +375,10 @@ public class ZycxServiceImpl implements ZycxService {
|
|||||||
String ip= IpUtils.getIpAddr();
|
String ip= IpUtils.getIpAddr();
|
||||||
System.out.println("请求业务的IP:"+ip);
|
System.out.println("请求业务的IP:"+ip);
|
||||||
List<WebSocketUser> printUsers = ChatWebSocketServer.getOnlineUsersByLoginIp(ip);
|
List<WebSocketUser> printUsers = ChatWebSocketServer.getOnlineUsersByLoginIp(ip);
|
||||||
|
if (printUsers.isEmpty()) {
|
||||||
|
String webid=getLocalid();
|
||||||
|
printUsers= ChatWebSocketServer.getOnlineUsersByWebId(webid);
|
||||||
|
}
|
||||||
if (printUsers.isEmpty()) {
|
if (printUsers.isEmpty()) {
|
||||||
System.out.println("当前客户端打印插件不在线");
|
System.out.println("当前客户端打印插件不在线");
|
||||||
return new Result("-1","当前客户端打印插件不在线");
|
return new Result("-1","当前客户端打印插件不在线");
|
||||||
@ -383,6 +388,7 @@ public class ZycxServiceImpl implements ZycxService {
|
|||||||
System.out.println("已给客户端[" + webSocketUser.getUsername() + "]推送打印通知,IP:" + webSocketUser.getLoginIp());
|
System.out.println("已给客户端[" + webSocketUser.getUsername() + "]推送打印通知,IP:" + webSocketUser.getLoginIp());
|
||||||
return new Result("0","打印成功");
|
return new Result("0","打印成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result printsetup(){
|
public Result printsetup(){
|
||||||
WebSocketMessage wsMessage=new WebSocketMessage();
|
WebSocketMessage wsMessage=new WebSocketMessage();
|
||||||
@ -396,8 +402,20 @@ public class ZycxServiceImpl implements ZycxService {
|
|||||||
String ip= IpUtils.getIpAddr();
|
String ip= IpUtils.getIpAddr();
|
||||||
String UserId = ChatWebSocketServer.getUserIdByIp(ip);
|
String UserId = ChatWebSocketServer.getUserIdByIp(ip);
|
||||||
if(UserId==null||"".equals(UserId)){
|
if(UserId==null||"".equals(UserId)){
|
||||||
|
String webid=getLocalid();
|
||||||
|
UserId=ChatWebSocketServer.getUsersByWebId(webid);
|
||||||
|
if(UserId!=null&&!"".equals(UserId)){
|
||||||
|
return new Result("0","客户端插件正常");
|
||||||
|
}
|
||||||
return new Result("-1","当前客户端打印插件不在线或未安装");
|
return new Result("-1","当前客户端打印插件不在线或未安装");
|
||||||
}
|
}
|
||||||
return new Result("0","客户端插件正常");
|
return new Result("0","客户端插件正常");
|
||||||
}
|
}
|
||||||
|
private String getLocalid() {
|
||||||
|
SysLoginParam user= SecurityUtils.getLoginUser().getSysLoginParam();
|
||||||
|
if(user!=null) {
|
||||||
|
return user.getLocalid();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user