质安管理
This commit is contained in:
@ -1,6 +1,9 @@
|
|||||||
package org.dromara.websocket.websocket.service;
|
package org.dromara.websocket.websocket.service;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import jakarta.websocket.*;
|
import jakarta.websocket.*;
|
||||||
import jakarta.websocket.server.ServerEndpoint;
|
import jakarta.websocket.server.ServerEndpoint;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -16,6 +19,7 @@ import org.dromara.cailiaoshebei.domain.vo.BusPurchaseDocVo;
|
|||||||
import org.dromara.cailiaoshebei.service.IBusMrpBaseService;
|
import org.dromara.cailiaoshebei.service.IBusMrpBaseService;
|
||||||
import org.dromara.cailiaoshebei.service.IBusPurchaseDocService;
|
import org.dromara.cailiaoshebei.service.IBusPurchaseDocService;
|
||||||
import org.dromara.common.core.utils.SpringUtils;
|
import org.dromara.common.core.utils.SpringUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.materials.domain.vo.materials.MatMaterialsUseDetailVo;
|
import org.dromara.materials.domain.vo.materials.MatMaterialsUseDetailVo;
|
||||||
import org.dromara.materials.service.IMatMaterialsService;
|
import org.dromara.materials.service.IMatMaterialsService;
|
||||||
import org.dromara.project.service.impl.BusAttendanceServiceImpl;
|
import org.dromara.project.service.impl.BusAttendanceServiceImpl;
|
||||||
@ -111,6 +115,7 @@ public class BigScreenWebSocketServer {
|
|||||||
maps.add(infoData);
|
maps.add(infoData);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
// 质安管理
|
||||||
if (dpzaglService != null) {
|
if (dpzaglService != null) {
|
||||||
saveDateDpzagl(dpzaglService, params, projectId, maps);
|
saveDateDpzagl(dpzaglService, params, projectId, maps);
|
||||||
}
|
}
|
||||||
@ -246,9 +251,10 @@ public class BigScreenWebSocketServer {
|
|||||||
busAttendanceService.getAttendanceInfo(projectId, (long) timeType, infoData);
|
busAttendanceService.getAttendanceInfo(projectId, (long) timeType, infoData);
|
||||||
//返回数据
|
//返回数据
|
||||||
maps.add(infoData);
|
maps.add(infoData);
|
||||||
message = JSONUtil.toJsonStr(maps);
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
// 质安管理
|
||||||
|
jxzagl(projectId,message,maps);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
@ -266,7 +272,8 @@ public class BigScreenWebSocketServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
session.getBasicRemote().sendText("服务端已收到消息:" + message);
|
message = JSONUtil.toJsonStr(maps);
|
||||||
|
session.getBasicRemote().sendText( message);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("📤 回复会话[{}]失败:{}", session.getId(), e.getMessage());
|
log.error("📤 回复会话[{}]失败:{}", session.getId(), e.getMessage());
|
||||||
}
|
}
|
||||||
@ -382,6 +389,70 @@ public class BigScreenWebSocketServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询大屏-质量管理-接收消息
|
||||||
|
*/
|
||||||
|
private void jxzagl(Long projectId, String message,List<Map<String, String>> maps) {
|
||||||
|
DpzaglService dpzaglService = SpringUtils.getBean(DpzaglService.class);
|
||||||
|
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Map<String, String> dateMap = objectMapper.readValue(
|
||||||
|
message,
|
||||||
|
new TypeReference<Map<String, String>>() {}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 3. 获取数据(两种方式)
|
||||||
|
String startDate = dateMap.get("startDate");
|
||||||
|
String endDate = dateMap.get("endDate");
|
||||||
|
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA);
|
||||||
|
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(endDate)){
|
||||||
|
throw new RuntimeException("时间获取异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
DpznglBo dpznglBo = new DpznglBo();
|
||||||
|
dpznglBo.setStartDate(LocalDate.parse(startDate, formatter));
|
||||||
|
dpznglBo.setEndDate(LocalDate.parse(endDate, formatter));
|
||||||
|
dpznglBo.setProjectId(projectId);
|
||||||
|
|
||||||
|
// 查询大屏-质安管理-安全员分布情况
|
||||||
|
|
||||||
|
List<DpznglAqyVo> dpznglAqyVos = dpzaglService.listByAqy(dpznglBo);
|
||||||
|
if (dpznglAqyVos != null && dpznglAqyVos.size() > 0) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("type", "aqy");
|
||||||
|
map.put("data", JSONUtil.toJsonStr(dpznglAqyVos));
|
||||||
|
maps.add(map);
|
||||||
|
}
|
||||||
|
// 查询大屏-质安管理-站班会,巡检工单,整改情况
|
||||||
|
DpznglVo dpznglVo = dpzaglService.queryList(dpznglBo);
|
||||||
|
|
||||||
|
if (dpznglVo != null) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("type", "zagl");
|
||||||
|
map.put("data", JSONUtil.toJsonStr(dpznglVo));
|
||||||
|
maps.add(map);
|
||||||
|
}
|
||||||
|
//查询大屏-质安管理-站班会
|
||||||
|
DpznglVo byzbh = dpzaglService.listByzbh(dpznglBo);
|
||||||
|
if (byzbh != null) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("type", "zbh");
|
||||||
|
map.put("data", JSONUtil.toJsonStr(byzbh));
|
||||||
|
maps.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询大屏质保管理
|
* 查询大屏质保管理
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user