我的任务优化、工程量清单优化、gps消息websocket连接、物资管理:物资验收入库添加附件
This commit is contained in:
@ -12,6 +12,8 @@ public interface WebSocketConstants {
|
||||
*/
|
||||
String LOGIN_USER_KEY = "loginUser";
|
||||
|
||||
String PROJECT_ID = "projectId";
|
||||
|
||||
/**
|
||||
* 订阅的频道
|
||||
*/
|
||||
|
@ -13,6 +13,7 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.dromara.common.websocket.constant.WebSocketConstants.LOGIN_USER_KEY;
|
||||
import static org.dromara.common.websocket.constant.WebSocketConstants.PROJECT_ID;
|
||||
|
||||
/**
|
||||
* WebSocketHandler 实现类
|
||||
@ -27,14 +28,17 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler {
|
||||
*/
|
||||
@Override
|
||||
public void afterConnectionEstablished(WebSocketSession session) throws IOException {
|
||||
LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
// LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
|
||||
Long loginUser = (Long) session.getAttributes().get(PROJECT_ID);
|
||||
// if (ObjectUtil.isNull(loginUser) ) {
|
||||
if (loginUser == null ) {
|
||||
session.close(CloseStatus.BAD_DATA);
|
||||
log.info("[connect] invalid token received. sessionId: {}", session.getId());
|
||||
return;
|
||||
}
|
||||
WebSocketSessionHolder.addSession(loginUser.getUserId(), session);
|
||||
log.info("[connect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType());
|
||||
WebSocketSessionHolder.addSession(loginUser, session);
|
||||
// WebSocketSessionHolder.addSession(loginUser.getUserId(), session);
|
||||
// log.info("[connect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,11 +51,13 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler {
|
||||
@Override
|
||||
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
|
||||
// 从WebSocket会话中获取登录用户信息
|
||||
LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
|
||||
// LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
|
||||
Long loginUser = (Long) session.getAttributes().get(PROJECT_ID);
|
||||
|
||||
// 创建WebSocket消息DTO对象
|
||||
WebSocketMessageDto webSocketMessageDto = new WebSocketMessageDto();
|
||||
webSocketMessageDto.setSessionKeys(List.of(loginUser.getUserId()));
|
||||
// webSocketMessageDto.setSessionKeys(List.of(loginUser.getUserId()));
|
||||
webSocketMessageDto.setSessionKeys(List.of(loginUser));
|
||||
webSocketMessageDto.setMessage(message.getPayload());
|
||||
WebSocketUtils.publishMessage(webSocketMessageDto);
|
||||
}
|
||||
@ -100,13 +106,16 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler {
|
||||
*/
|
||||
@Override
|
||||
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) {
|
||||
LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
// LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
|
||||
Long loginUser = (Long) session.getAttributes().get(PROJECT_ID);
|
||||
// if (ObjectUtil.isNull(loginUser)) {
|
||||
if (loginUser != null ) {
|
||||
log.info("[disconnect] invalid token received. sessionId: {}", session.getId());
|
||||
return;
|
||||
}
|
||||
WebSocketSessionHolder.removeSession(loginUser.getUserId());
|
||||
log.info("[disconnect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType());
|
||||
// WebSocketSessionHolder.removeSession(loginUser.getUserId());
|
||||
WebSocketSessionHolder.removeSession(loginUser);
|
||||
// log.info("[disconnect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,6 +15,7 @@ import org.springframework.web.socket.server.HandshakeInterceptor;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.dromara.common.websocket.constant.WebSocketConstants.LOGIN_USER_KEY;
|
||||
import static org.dromara.common.websocket.constant.WebSocketConstants.PROJECT_ID;
|
||||
|
||||
/**
|
||||
* WebSocket握手请求的拦截器
|
||||
@ -44,6 +45,8 @@ public class PlusWebSocketInterceptor implements HandshakeInterceptor {
|
||||
String headerCid = ServletUtils.getRequest().getHeader(LoginHelper.CLIENT_KEY);
|
||||
String paramCid = ServletUtils.getParameter(LoginHelper.CLIENT_KEY);
|
||||
String clientId = StpUtil.getExtra(LoginHelper.CLIENT_KEY).toString();
|
||||
String projectIdStr = ServletUtils.getRequest().getParameter("projectId");
|
||||
Long projectId = Long.parseLong(projectIdStr);
|
||||
if (!StringUtils.equalsAny(clientId, headerCid, paramCid)) {
|
||||
// token 无效
|
||||
throw NotLoginException.newInstance(StpUtil.getLoginType(),
|
||||
@ -52,6 +55,7 @@ public class PlusWebSocketInterceptor implements HandshakeInterceptor {
|
||||
}
|
||||
|
||||
attributes.put(LOGIN_USER_KEY, loginUser);
|
||||
attributes.put(PROJECT_ID,projectId);
|
||||
return true;
|
||||
} catch (NotLoginException e) {
|
||||
log.error("WebSocket 认证失败'{}',无法访问系统资源", e.getMessage());
|
||||
|
@ -42,6 +42,14 @@ public class BusBiddingLimitVersions extends BaseEntity {
|
||||
*/
|
||||
private String versions;
|
||||
|
||||
|
||||
/**
|
||||
* 版本号名称
|
||||
*/
|
||||
private String versionsName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* excel文件
|
||||
*/
|
||||
|
@ -44,6 +44,14 @@ public class BusBiddingLimitVersionsBo extends BaseEntity {
|
||||
@NotBlank(message = "版本号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String versions;
|
||||
|
||||
|
||||
/**
|
||||
* 版本号名称
|
||||
*/
|
||||
private String versionsName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* excel文件
|
||||
*/
|
||||
|
@ -52,6 +52,14 @@ public class BusBiddingLimitVersionsVo implements Serializable {
|
||||
@ExcelProperty(value = "版本号")
|
||||
private String versions;
|
||||
|
||||
|
||||
/**
|
||||
* 版本号名称
|
||||
*/
|
||||
private String versionsName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* excel文件
|
||||
*/
|
||||
|
@ -40,6 +40,11 @@ public class BusBillofquantitiesVersions extends BaseEntity {
|
||||
*/
|
||||
private String versions;
|
||||
|
||||
/**
|
||||
* 版本号名称
|
||||
*/
|
||||
private String versionsName;
|
||||
|
||||
/**
|
||||
* exlce文件
|
||||
*/
|
||||
|
@ -39,4 +39,11 @@ public class BusBillofquantitiesVersionsBo extends BaseEntity {
|
||||
private String versions;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 版本号名称
|
||||
*/
|
||||
private String versionsName;
|
||||
|
||||
|
||||
}
|
||||
|
@ -48,6 +48,13 @@ public class BusBillofquantitiesVersionsVo implements Serializable {
|
||||
private String versions;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 版本号名称
|
||||
*/
|
||||
private String versionsName;
|
||||
|
||||
|
||||
/**
|
||||
* Excel文件
|
||||
*/
|
||||
|
@ -191,8 +191,22 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
|
||||
throw new ServiceException("上传文件失败");
|
||||
}
|
||||
String banBen = BatchNumberGenerator.generateBatchNumber("GCLBB-");
|
||||
String[] split = StringUtils.split(wordEntity.getFileName(),".xlsx");
|
||||
String vName = "";
|
||||
switch (bo.getWorkOrderType()){
|
||||
case "0":
|
||||
vName = "投标工程量清单-"+split[0];
|
||||
case "1":
|
||||
vName = "限价工程量清单-"+split[0];
|
||||
case "2":
|
||||
vName = "招采工程量清单-"+split[0];
|
||||
case "3":
|
||||
vName = "物资设备清单-"+split[0];
|
||||
|
||||
}
|
||||
int insert = baseMapper.insert(new BusBillofquantitiesVersions().
|
||||
setWorkOrderType(bo.getWorkOrderType()).
|
||||
setVersionsName(vName).
|
||||
setVersions(banBen).
|
||||
setProjectId(bo.getProjectId()).
|
||||
setExcelFile(wordEntity.getUrl()));
|
||||
|
@ -57,6 +57,19 @@ public class GpsEquipmentController extends BaseController {
|
||||
private final IBusProjectService projectService;
|
||||
|
||||
|
||||
/**
|
||||
* 接收设备数据
|
||||
* @param jsonData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/setData")
|
||||
public R<Void> setData(@RequestBody String jsonData) {
|
||||
log.info("接收设备数据:{}", jsonData);
|
||||
gpsEquipmentService.setData(jsonData);
|
||||
return toAjax(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 接收设备数据
|
||||
* @param jsonData
|
||||
|
@ -97,4 +97,6 @@ public interface IGpsEquipmentService extends IService<GpsEquipment>{
|
||||
List<GpsProjectVo> getProjectList();
|
||||
|
||||
List<GpsEquipmentSonVo> getClientList(Long projectId);
|
||||
|
||||
void setData(String jsonData);
|
||||
}
|
||||
|
@ -434,5 +434,18 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
||||
return gpsEquipmentSonService.getClientList(projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(String jsonData) {
|
||||
|
||||
// 发送给指定用户(equipment.getUserId())
|
||||
WebSocketMessageDto messageDto = new WebSocketMessageDto();
|
||||
messageDto.setMessage(jsonData);
|
||||
messageDto.setSessionKeys(Collections.singletonList(1897160897167638522L));
|
||||
WebSocketUtils.publishMessage(messageDto);
|
||||
|
||||
// WebSocketUtils.publishAll(jsonData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -123,6 +123,16 @@ public class MatMaterialReceive extends BaseEntity {
|
||||
*/
|
||||
private String licenseCountFileId;
|
||||
|
||||
|
||||
/**
|
||||
* 附件地址
|
||||
*/
|
||||
private String attachmentUrl;
|
||||
/**
|
||||
* 附件名称
|
||||
*/
|
||||
private String attachmentName;
|
||||
|
||||
/**
|
||||
* 设备材料入库/移交
|
||||
*/
|
||||
|
@ -94,6 +94,16 @@ public class MatMaterialReceiveCreateReq implements Serializable {
|
||||
*/
|
||||
private String licenseCountFileId;
|
||||
|
||||
private String attachmentId;
|
||||
/**
|
||||
* 附件地址
|
||||
*/
|
||||
private String attachmentUrl;
|
||||
/**
|
||||
* 附件名称
|
||||
*/
|
||||
private String attachmentName;
|
||||
|
||||
/**
|
||||
* 设备材料入库/移交
|
||||
*/
|
||||
|
@ -87,6 +87,10 @@ public class MatMaterialReceiveUpdateReq implements Serializable {
|
||||
*/
|
||||
private String licenseCountFileId;
|
||||
|
||||
/**
|
||||
* 附件id
|
||||
*/
|
||||
private String attachmentId;
|
||||
/**
|
||||
* 设备材料入库/移交
|
||||
*/
|
||||
|
@ -134,6 +134,15 @@ public class MatMaterialReceiveVo implements Serializable {
|
||||
*/
|
||||
private List<SysOssVo> licenseCountFile;
|
||||
|
||||
/**
|
||||
* 附件地址
|
||||
*/
|
||||
private String attachmentUrl;
|
||||
/**
|
||||
* 附件名称
|
||||
*/
|
||||
private String attachmentName;
|
||||
|
||||
/**
|
||||
* 设备材料入库/移交
|
||||
*/
|
||||
|
@ -241,7 +241,8 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv
|
||||
req.getLicenseCountFileId(),
|
||||
req.getReportCountFileId(),
|
||||
req.getTechDocCountFileId(),
|
||||
req.getCertCountFileId());
|
||||
req.getCertCountFileId(),
|
||||
req.getAttachmentId());
|
||||
boolean save = this.save(materialReceive);
|
||||
if (!save) {
|
||||
throw new ServiceException("物料接收单新增失败", HttpStatus.ERROR);
|
||||
@ -305,7 +306,8 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv
|
||||
req.getLicenseCountFileId(),
|
||||
req.getReportCountFileId(),
|
||||
req.getTechDocCountFileId(),
|
||||
req.getCertCountFileId());
|
||||
req.getCertCountFileId(),
|
||||
req.getAttachmentId());
|
||||
boolean update = this.updateById(materialReceive);
|
||||
if (!update) {
|
||||
throw new ServiceException("物料接收单修改失败", HttpStatus.ERROR);
|
||||
@ -482,9 +484,10 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv
|
||||
* @param reportCountFileId 报表文件id
|
||||
* @param techDocCountFileId 技术文档文件id
|
||||
* @param certCountFileId 证书文件id
|
||||
* @param attachmentId
|
||||
*/
|
||||
private void getFileSize(MatMaterialReceive materialReceive, String licenseCountFileId,
|
||||
String reportCountFileId, String techDocCountFileId, String certCountFileId) {
|
||||
String reportCountFileId, String techDocCountFileId, String certCountFileId, String attachmentId) {
|
||||
if (StringUtils.isNotBlank(licenseCountFileId)) {
|
||||
int size = Arrays.stream(licenseCountFileId.split(",")).map(Long::parseLong).toList().size();
|
||||
materialReceive.setLicenseCount(size);
|
||||
@ -501,6 +504,11 @@ public class MatMaterialReceiveServiceImpl extends ServiceImpl<MatMaterialReceiv
|
||||
int size = Arrays.stream(certCountFileId.split(",")).map(Long::parseLong).toList().size();
|
||||
materialReceive.setCertCount(size);
|
||||
}
|
||||
if (StringUtils.isNotBlank(attachmentId)) {
|
||||
SysOssVo ossVo = ossService.getById(Long.valueOf(attachmentId));
|
||||
materialReceive.setAttachmentUrl(ossVo.getUrl());
|
||||
materialReceive.setAttachmentName(ossVo.getOriginalName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,6 +42,14 @@ public class BusBLimitListVersions extends BaseEntity {
|
||||
*/
|
||||
private String versions;
|
||||
|
||||
|
||||
/**
|
||||
* 版本号名称
|
||||
*/
|
||||
private String versionsName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* excel文件
|
||||
*/
|
||||
|
@ -44,6 +44,14 @@ public class BusBLimitListVersionsBo extends BaseEntity {
|
||||
@NotBlank(message = "版本号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String versions;
|
||||
|
||||
|
||||
/**
|
||||
* 版本号名称
|
||||
*/
|
||||
private String versionsName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* excel文件
|
||||
*/
|
||||
|
@ -52,6 +52,14 @@ public class BusBLimitListVersionsVo implements Serializable {
|
||||
@ExcelProperty(value = "版本号")
|
||||
private String versions;
|
||||
|
||||
|
||||
/**
|
||||
* 版本号名称
|
||||
*/
|
||||
private String versionsName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* excel文件
|
||||
*/
|
||||
|
@ -51,6 +51,9 @@ public class FlowHisTaskVo implements Serializable {
|
||||
*/
|
||||
private Long definitionId;
|
||||
|
||||
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 流程定义名称
|
||||
*/
|
||||
|
@ -42,6 +42,8 @@ public class FlowInstanceVo {
|
||||
*/
|
||||
private Long definitionId;
|
||||
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 流程定义名称
|
||||
*/
|
||||
|
@ -50,6 +50,9 @@ public class FlowTaskVo implements Serializable {
|
||||
*/
|
||||
private Long definitionId;
|
||||
|
||||
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 流程实例表id
|
||||
*/
|
||||
|
@ -27,9 +27,11 @@
|
||||
fd.version,
|
||||
fd.form_custom,
|
||||
fd.form_path,
|
||||
fd.category
|
||||
fd.category,
|
||||
bp.project_name
|
||||
from flow_instance fi
|
||||
left join flow_definition fd on fi.definition_id = fd.id
|
||||
left join bus_project bp on bp.id = SUBSTRING_INDEX(fd.flow_code, '_', 1)
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
@ -64,11 +64,13 @@
|
||||
COALESCE(t.form_path, d.form_path) as form_path,
|
||||
d.version,
|
||||
uu.processed_by,
|
||||
uu.type
|
||||
uu.type,
|
||||
bp.project_name
|
||||
from flow_task t
|
||||
left join flow_user uu on uu.associated = t.id
|
||||
left join flow_definition d on t.definition_id = d.id
|
||||
left join flow_instance i on t.instance_id = i.id
|
||||
LEFT JOIN bus_project bp ON bp.id = SUBSTRING_INDEX( d.flow_code, '_', 1 )
|
||||
where t.node_type = 1
|
||||
and t.del_flag = '0'
|
||||
and uu.del_flag = '0'
|
||||
@ -180,10 +182,12 @@
|
||||
c.flow_name,
|
||||
c.flow_code,
|
||||
c.category,
|
||||
c.version
|
||||
c.version,
|
||||
bp.project_name
|
||||
from flow_his_task a
|
||||
left join flow_instance b on a.instance_id = b.id
|
||||
left join flow_definition c on a.definition_id = c.id
|
||||
LEFT JOIN bus_project bp ON bp.id = SUBSTRING_INDEX( c.flow_code, '_', 1 )
|
||||
where a.del_flag ='0'
|
||||
and b.del_flag = '0'
|
||||
and c.del_flag = '0'
|
||||
@ -214,11 +218,13 @@
|
||||
d.flow_name,
|
||||
d.flow_code,
|
||||
d.category,
|
||||
d.version
|
||||
d.version,
|
||||
bp.project_name
|
||||
from flow_user a
|
||||
left join flow_his_task b on a.associated = b.task_id
|
||||
left join flow_instance c on b.instance_id = c.id
|
||||
left join flow_definition d on c.definition_id=d.id
|
||||
LEFT JOIN bus_project bp ON bp.id = SUBSTRING_INDEX( d.flow_code, '_', 1 )
|
||||
where a.type = '4'
|
||||
and a.del_flag = '0'
|
||||
and b.del_flag = '0'
|
||||
|
Reference in New Issue
Block a user