Commit 1ee3f877a0c147fc2cf0e24da81f533ccd1b7dfc

Authored by YunaiV
1 parent 109e4233

✨ feat(mes): 新增当前用户工作站绑定状态 VO 和相关接口

yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/workrecord/MesProWorkRecordController.java
@@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils; @@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
9 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; 9 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
10 import cn.iocoder.yudao.module.mes.controller.admin.pro.workrecord.vo.MesProWorkRecordLogPageReqVO; 10 import cn.iocoder.yudao.module.mes.controller.admin.pro.workrecord.vo.MesProWorkRecordLogPageReqVO;
11 import cn.iocoder.yudao.module.mes.controller.admin.pro.workrecord.vo.MesProWorkRecordLogRespVO; 11 import cn.iocoder.yudao.module.mes.controller.admin.pro.workrecord.vo.MesProWorkRecordLogRespVO;
  12 +import cn.iocoder.yudao.module.mes.controller.admin.pro.workrecord.vo.MesProWorkRecordRespVO;
12 import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; 13 import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO;
13 import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workrecord.MesProWorkRecordDO; 14 import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workrecord.MesProWorkRecordDO;
14 import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workrecord.MesProWorkRecordLogDO; 15 import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workrecord.MesProWorkRecordLogDO;
@@ -99,7 +100,7 @@ public class MesProWorkRecordController { @@ -99,7 +100,7 @@ public class MesProWorkRecordController {
99 @GetMapping("/get-my") 100 @GetMapping("/get-my")
100 @Operation(summary = "获取当前用户绑定的工作站状态") 101 @Operation(summary = "获取当前用户绑定的工作站状态")
101 @PreAuthorize("@ss.hasPermission('mes:pro-workrecord:query')") 102 @PreAuthorize("@ss.hasPermission('mes:pro-workrecord:query')")
102 - public CommonResult<MesProWorkRecordLogRespVO> getMyWorkRecord() { 103 + public CommonResult<MesProWorkRecordRespVO> getMyWorkRecord() {
103 MesProWorkRecordDO record = workRecordService.getWorkRecord(getLoginUserId()); 104 MesProWorkRecordDO record = workRecordService.getWorkRecord(getLoginUserId());
104 return success(buildWorkRecordRespVO(record)); 105 return success(buildWorkRecordRespVO(record));
105 } 106 }
@@ -131,13 +132,11 @@ public class MesProWorkRecordController { @@ -131,13 +132,11 @@ public class MesProWorkRecordController {
131 }); 132 });
132 } 133 }
133 134
134 - private MesProWorkRecordLogRespVO buildWorkRecordRespVO(MesProWorkRecordDO record) { 135 + private MesProWorkRecordRespVO buildWorkRecordRespVO(MesProWorkRecordDO record) {
135 if (record == null) { 136 if (record == null) {
136 return null; 137 return null;
137 } 138 }
138 - MesProWorkRecordLogRespVO vo = new MesProWorkRecordLogRespVO()  
139 - .setUserId(record.getUserId()).setWorkstationId(record.getWorkstationId())  
140 - .setCreateTime(record.getClockInTime()); // 前端显示为上工时间 139 + MesProWorkRecordRespVO vo = BeanUtils.toBean(record, MesProWorkRecordRespVO.class);
141 // 拼接工作站信息 140 // 拼接工作站信息
142 MesMdWorkstationDO ws = workstationService.getWorkstation(record.getWorkstationId()); 141 MesMdWorkstationDO ws = workstationService.getWorkstation(record.getWorkstationId());
143 if (ws != null) { 142 if (ws != null) {
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/workrecord/vo/MesProWorkRecordRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.mes.controller.admin.pro.workrecord.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.Data;
  5 +import lombok.experimental.Accessors;
  6 +
  7 +import java.time.LocalDateTime;
  8 +
  9 +@Schema(description = "管理后台 - MES 当前用户工作站绑定状态 Response VO")
  10 +@Data
  11 +@Accessors(chain = true)
  12 +public class MesProWorkRecordRespVO {
  13 +
  14 + @Schema(description = "用户编号", example = "1")
  15 + private Long userId;
  16 +
  17 + @Schema(description = "用户昵称", example = "张三")
  18 + private String userNickname;
  19 +
  20 + @Schema(description = "工作站编号", example = "1")
  21 + private Long workstationId;
  22 +
  23 + @Schema(description = "工作站编码", example = "WS-001")
  24 + private String workstationCode;
  25 +
  26 + @Schema(description = "工作站名称", example = "注塑工作站")
  27 + private String workstationName;
  28 +
  29 + @Schema(description = "当前状态", example = "1")
  30 + private Integer type;
  31 +
  32 + @Schema(description = "上工时间")
  33 + private LocalDateTime clockInTime;
  34 +
  35 + @Schema(description = "下工时间")
  36 + private LocalDateTime clockOutTime;
  37 +
  38 +}