ソースを参照

处理isc_isolation_point

车车 4 ヶ月 前
コミット
dd93a5f3db

+ 27 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/isolationpoint/vo/BindingPointVO.java

@@ -0,0 +1,27 @@
+package cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 隔离点对象 is_isolation_point
+ *
+ * @author cgj
+ * @date 2024-10-18
+ */
+@Data
+public class BindingPointVO
+{
+    @Schema(description = "电柜ID")
+    private Long lotoId;
+
+    @Schema(description = "绑定的隔离点数据")
+    private List<Long> bindingPointIds;
+
+    @Schema(description = "解绑的隔离点数据")
+    private List<Long> unbindPointIds;
+
+
+}

+ 105 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/isolationpoint/vo/PointDetailVO.java

@@ -0,0 +1,105 @@
+package cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 隔离点对象 is_isolation_point
+ *
+ * @author cgj
+ * @date 2024-10-18
+ */
+@EqualsAndHashCode(callSuper = false)
+@Data
+public class PointDetailVO
+{
+    private static final long serialVersionUID = 1L;
+
+    @Schema(description = "隔离点ID")
+    private Long Id;
+
+    @Schema(description = "隔离点编号")
+    private String pointCode;
+
+    @Schema(description = "隔离点名称")
+    private String pointName;
+
+    @Schema(description = "隔离点类型")
+    private String pointType;
+
+    @Schema(description = "隔离点类型Name")
+    private String pointTypeName;
+
+    @Schema(description = "隔离点nfc")
+    private String pointNfc;
+
+    @Schema(description = "所属车间ID")
+    private Long workshopId;
+
+    @Schema(description = "所属车间Name")
+    private String workshopName;
+
+    @Schema(description = "所属区域ID")
+    private Long workareaId;
+
+    @Schema(description = "所属区域Name")
+    private String workareaName;
+
+    @Schema(description = "所属mars岗位ID")
+    private Long workstationId;
+
+    @Schema(description = "所属mars岗位Name")
+    private String workstationName;
+
+    @Schema(description = "所属电柜ID")
+    private Long lotoId;
+
+    @Schema(description = "所属电柜Name")
+    private String lotoName;
+
+    @Schema(description = "危险能量类型")
+    private String powerType;
+
+    @Schema(description = "危险能量类型Name")
+    private String powerTypeName;
+
+    @Schema(description = "隔离方式")
+    private String isolationMethod;
+
+    @Schema(description = "隔离点图标")
+    private String pointIcon;
+
+    @Schema(description = "隔离点图片")
+    private String pointPicture;
+
+    @Schema(description = "删除标志(0代表存在 2代表删除)")
+    private String delFlag;
+
+    @Schema(description = "锁具类型id")
+    private Long lockTypeId;
+
+    @Schema(description = "锁具类型编码")
+    private String lockTypeCode;
+
+    @Schema(description = "锁具类型名称")
+    private String lockTypeName;
+
+    @Schema(description = "锁具类型图标")
+    private String lockTypeIcon;
+
+    @Schema(description = "锁具类型图片")
+    private String lockTypeImg;
+
+    @Schema(description = "挂锁ID")
+    private Long lockId;
+
+    @Schema(description = "挂锁NFC")
+    private String lockNfc;
+
+    @Schema(description = "辅件类型ID")
+    private Long locksetTypeId;
+
+    @Schema(description = "前置隔离点ID")
+    private Long prePointId;
+}

+ 124 - 95
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/lotostation/LotoStationController.java

@@ -1,95 +1,124 @@
-package cn.iocoder.yudao.module.iscs.controller.admin.lotostation;
-
-import org.springframework.web.bind.annotation.*;
-import jakarta.annotation.Resource;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.security.access.prepost.PreAuthorize;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.Operation;
-
-import jakarta.validation.constraints.*;
-import jakarta.validation.*;
-import jakarta.servlet.http.*;
-import java.util.*;
-import java.io.IOException;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-
-import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
-
-import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
-import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
-
-import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.*;
-import cn.iocoder.yudao.module.iscs.dal.dataobject.lotostation.LotoStationDO;
-import cn.iocoder.yudao.module.iscs.service.lotostation.LotoStationService;
-
-@Tag(name = "管理后台 - 电柜")
-@RestController
-@RequestMapping("/iscs/loto-station")
-@Validated
-public class LotoStationController {
-
-    @Resource
-    private LotoStationService lotoStationService;
-
-    @PostMapping("/insertLotoStation")
-    @Operation(summary = "创建电柜")
-    @PreAuthorize("@ss.hasPermission('iscs:loto-station:create')")
-    public CommonResult<Long> insertLotoStation(@Valid @RequestBody LotoStationSaveReqVO createReqVO) {
-        return success(lotoStationService.createLotoStation(createReqVO));
-    }
-
-    @PutMapping("/updateLotoStation")
-    @Operation(summary = "更新电柜")
-    @PreAuthorize("@ss.hasPermission('iscs:loto-station:update')")
-    public CommonResult<Boolean> updateLotoStation(@Valid @RequestBody LotoStationSaveReqVO updateReqVO) {
-        lotoStationService.updateLotoStation(updateReqVO);
-        return success(true);
-    }
-
-    @DeleteMapping("/deleteLotoStationList")
-    @Parameter(name = "ids", description = "编号", required = true)
-    @Operation(summary = "批量删除电柜")
-                @PreAuthorize("@ss.hasPermission('iscs:loto-station:delete')")
-    public CommonResult<Boolean> deleteLotoStationList(@RequestParam("ids") List<Long> ids) {
-        lotoStationService.deleteLotoStationListByIds(ids);
-        return success(true);
-    }
-
-    @GetMapping("/selectLotoStationById")
-    @Operation(summary = "获得电柜")
-    @Parameter(name = "id", description = "编号", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('iscs:loto-station:query')")
-    public CommonResult<LotoStationRespVO> selectLotoStationById(@RequestParam("id") Long id) {
-        LotoStationDO lotoStation = lotoStationService.getLotoStation(id);
-        return success(BeanUtils.toBean(lotoStation, LotoStationRespVO.class));
-    }
-
-    @GetMapping("/getLotoStationPage")
-    @Operation(summary = "获得电柜分页")
-    @PreAuthorize("@ss.hasPermission('iscs:loto-station:query')")
-    public CommonResult<PageResult<LotoStationRespVO>> getLotoStationPage(@Valid LotoStationPageReqVO pageReqVO) {
-        PageResult<LotoStationDO> pageResult = lotoStationService.getLotoStationPage(pageReqVO);
-        return success(BeanUtils.toBean(pageResult, LotoStationRespVO.class));
-    }
-
-    @GetMapping("/exportLotoStationExcel")
-    @Operation(summary = "导出电柜 Excel")
-    @PreAuthorize("@ss.hasPermission('iscs:loto-station:export')")
-    @ApiAccessLog(operateType = EXPORT)
-    public void exportLotoStationExcel(@Valid LotoStationPageReqVO pageReqVO,
-              HttpServletResponse response) throws IOException {
-        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
-        List<LotoStationDO> list = lotoStationService.getLotoStationPage(pageReqVO).getList();
-        // 导出 Excel
-        ExcelUtils.write(response, "电柜.xls", "数据", LotoStationRespVO.class,
-                        BeanUtils.toBean(list, LotoStationRespVO.class));
-    }
-
-}
+package cn.iocoder.yudao.module.iscs.controller.admin.lotostation;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.BindingPointVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.LotoStationPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.LotoStationRespVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.LotoStationSaveReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.PointsMapVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.lotostation.LotoStationDO;
+import cn.iocoder.yudao.module.iscs.service.lotostation.LotoStationService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.Valid;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Tag(name = "管理后台 - 电柜")
+@RestController
+@RequestMapping("/iscs/loto-station")
+@Validated
+public class LotoStationController {
+
+    @Resource
+    private LotoStationService lotoStationService;
+
+    @PostMapping("/insertLotoStation")
+    @Operation(summary = "创建电柜")
+    @PreAuthorize("@ss.hasPermission('iscs:loto-station:create')")
+    public CommonResult<Long> insertLotoStation(@Valid @RequestBody LotoStationSaveReqVO createReqVO) {
+        return success(lotoStationService.createLotoStation(createReqVO));
+    }
+
+    @PutMapping("/updateLotoStation")
+    @Operation(summary = "更新电柜")
+    @PreAuthorize("@ss.hasPermission('iscs:loto-station:update')")
+    public CommonResult<Boolean> updateLotoStation(@Valid @RequestBody LotoStationSaveReqVO updateReqVO) {
+        lotoStationService.updateLotoStation(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/deleteLotoStationList")
+    @Parameter(name = "ids", description = "编号", required = true)
+    @Operation(summary = "批量删除电柜")
+                @PreAuthorize("@ss.hasPermission('iscs:loto-station:delete')")
+    public CommonResult<Boolean> deleteLotoStationList(@RequestParam("ids") List<Long> ids) {
+        lotoStationService.deleteLotoStationListByIds(ids);
+        return success(true);
+    }
+
+    @GetMapping("/selectLotoStationById")
+    @Operation(summary = "获得电柜")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('iscs:loto-station:query')")
+    public CommonResult<LotoStationRespVO> selectLotoStationById(@RequestParam("id") Long id) {
+        LotoStationRespVO lotoStation = lotoStationService.getLotoStation(id);
+        return success(lotoStation);
+    }
+
+    @GetMapping("/getLotoStationPage")
+    @Operation(summary = "获得电柜分页")
+    @PreAuthorize("@ss.hasPermission('iscs:loto-station:query')")
+    public CommonResult<PageResult<LotoStationRespVO>> getLotoStationPage(@Valid LotoStationPageReqVO pageReqVO) {
+        PageResult<LotoStationDO> pageResult = lotoStationService.getLotoStationPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, LotoStationRespVO.class));
+    }
+
+    @GetMapping("/exportLotoStationExcel")
+    @Operation(summary = "导出电柜 Excel")
+    @PreAuthorize("@ss.hasPermission('iscs:loto-station:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportLotoStationExcel(@Valid LotoStationPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<LotoStationDO> list = lotoStationService.getLotoStationPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "电柜.xls", "数据", LotoStationRespVO.class,
+                        BeanUtils.toBean(list, LotoStationRespVO.class));
+    }
+
+    @GetMapping("/selectLotoBySerialNumber")
+    @Operation(summary = "获取电柜详细信息")
+    @Parameter(name = "lotoSerialNumber", description = "lotoSerialNumber")
+    @PreAuthorize("@ss.hasPermission('iscs:loto-station:query')")
+    public CommonResult<LotoStationRespVO> selectLotoBySerialNumber(@RequestParam("lotoSerialNumber") String lotoSerialNumber) {
+        LotoStationRespVO lotoStation = lotoStationService.selectLotoBySerialNumber(lotoSerialNumber);
+        return success(lotoStation);
+    }
+
+    @GetMapping(value = "/selectLotoMapById")
+    @Operation(summary = "获取电柜map解析数据")
+    @Parameters({
+            @Parameter(name = "workareaId", description = "区域id"),
+            @Parameter(name = "sopId", description = "sopId"),
+            @Parameter(name = "ticketId", description = "ticketId")
+    })
+    public CommonResult<List<PointsMapVO>> selectLotoMapById(Long lotoId, Long sopId, Long ticketId) {
+        return CommonResult.success(lotoStationService.selectLotoMapById(lotoId, sopId, ticketId));
+    }
+
+    @PostMapping("/updatePointsBindingLoto")
+    @Operation(summary = "隔离点绑定/解绑电柜")
+    @PreAuthorize("@ss.hasPermi('iscs:station:edit')")
+    public CommonResult<Boolean> updatePointsBindingLoto(@RequestBody @Parameter(name = "vo", description = "修改数据类,放到body") BindingPointVO vo)
+    {
+        return CommonResult.success(lotoStationService.updatePointsBindingLoto(vo));
+    }
+
+}

+ 10 - 5
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/lotostation/vo/LotoStationRespVO.java

@@ -1,11 +1,12 @@
 package cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo;
 
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.*;
-import java.util.*;
-import org.springframework.format.annotation.DateTimeFormat;
+import lombok.Data;
+
 import java.time.LocalDateTime;
-import com.alibaba.excel.annotation.*;
 
 @Schema(description = "管理后台 - 电柜 Response VO")
 @Data
@@ -56,4 +57,8 @@ public class LotoStationRespVO {
     @ExcelProperty("创建时间")
     private LocalDateTime createTime;
 
-}
+    @Schema(description = "地图name")
+    @TableField(exist = false)
+    private String mapName;
+
+}

+ 81 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/lotostation/vo/PointsMapVO.java

@@ -0,0 +1,81 @@
+package cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 工作区域对象 is_workarea
+ *
+ * @author cgj
+ * @date 2024-10-18
+ */
+@Data
+public class PointsMapVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Schema(description = "横坐标")
+    private Integer row;
+
+    @Schema(description = "纵坐标")
+    private Integer col;
+
+    @Schema(description = "点位id")
+    private Long pointId;
+
+    @Schema(description = "点位Name")
+    private String pointName;
+
+    @Schema(description = "作用")
+    private String remark;
+
+    @Schema(description = "前置点位id")
+    private Long prePointId;
+
+    @Schema(description = "隔离点类型")
+    private String pointType;
+
+    @Schema(description = "隔离点类型Name")
+    private String pointTypeName;
+
+    @Schema(description = "危险能量类型")
+    private String powerType;
+
+    @Schema(description = "危险能量类型Name")
+    private String powerTypeName;
+
+    @Schema(description = "点位选中状态")
+    private Boolean state;
+
+    @Schema(description = "隔离点图标")
+    private String pointIcon;
+
+    @Schema(description = "隔离点图片")
+    private String pointPicture;
+
+    @Schema(description = "区域地图")
+    private String mapImg;
+
+    @Schema(description = "x")
+    private String x;
+
+    @Schema(description = "y")
+    private String y;
+
+    @Schema(description = "entityId")
+    private Long entityId;
+
+    @Schema(description = "entityName")
+    private String entityName;
+
+    @Schema(description = "id")
+    private Long id;
+
+    @Schema(description = "mapId")
+    private Long mapId;
+
+    @Schema(description = "mapType")
+    private String mapType;
+
+}

+ 10 - 5
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/dal/mysql/isolationpoint/IsolationPointMapper.java

@@ -1,13 +1,15 @@
 package cn.iocoder.yudao.module.iscs.dal.mysql.isolationpoint;
 
-import java.util.*;
-
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.IsolationPointPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.PointDetailVO;
 import cn.iocoder.yudao.module.iscs.dal.dataobject.isolationpoint.IsolationPointDO;
 import org.apache.ibatis.annotations.Mapper;
-import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.*;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 隔离点 Mapper
@@ -40,4 +42,7 @@ public interface IsolationPointMapper extends BaseMapperX<IsolationPointDO> {
                 .orderByDesc(IsolationPointDO::getId));
     }
 
-}
+    List<PointDetailVO> getPointDetailList(@Param(value = "pointIds") List<Long> pointIds);
+
+
+}

+ 67 - 63
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/isolationpoint/IsolationPointService.java

@@ -1,63 +1,67 @@
-package cn.iocoder.yudao.module.iscs.service.isolationpoint;
-
-import java.util.*;
-import jakarta.validation.*;
-import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.*;
-import cn.iocoder.yudao.module.iscs.dal.dataobject.isolationpoint.IsolationPointDO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * 隔离点 Service 接口
- *
- * @author 芋道源码
- */
-public interface IsolationPointService extends IService<IsolationPointDO> {
-
-    /**
-     * 创建隔离点
-     *
-     * @param createReqVO 创建信息
-     * @return 编号
-     */
-    Long createIsolationPoint(@Valid IsolationPointSaveReqVO createReqVO);
-
-    /**
-     * 更新隔离点
-     *
-     * @param updateReqVO 更新信息
-     */
-    void updateIsolationPoint(@Valid IsolationPointSaveReqVO updateReqVO);
-
-    /**
-     * 删除隔离点
-     *
-     * @param id 编号
-     */
-    void deleteIsolationPoint(Long id);
-
-    /**
-    * 批量删除隔离点
-    *
-    * @param ids 编号
-    */
-    void deleteIsolationPointListByIds(List<Long> ids);
-
-    /**
-     * 获得隔离点
-     *
-     * @param id 编号
-     * @return 隔离点
-     */
-    IsolationPointDO getIsolationPoint(Long id);
-
-    /**
-     * 获得隔离点分页
-     *
-     * @param pageReqVO 分页查询
-     * @return 隔离点分页
-     */
-    PageResult<IsolationPointDO> getIsolationPointPage(IsolationPointPageReqVO pageReqVO);
-
-}
+package cn.iocoder.yudao.module.iscs.service.isolationpoint;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.IsolationPointPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.IsolationPointSaveReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.PointDetailVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.isolationpoint.IsolationPointDO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import jakarta.validation.Valid;
+
+import java.util.List;
+
+/**
+ * 隔离点 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface IsolationPointService extends IService<IsolationPointDO> {
+
+    /**
+     * 创建隔离点
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createIsolationPoint(@Valid IsolationPointSaveReqVO createReqVO);
+
+    /**
+     * 更新隔离点
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateIsolationPoint(@Valid IsolationPointSaveReqVO updateReqVO);
+
+    /**
+     * 删除隔离点
+     *
+     * @param id 编号
+     */
+    void deleteIsolationPoint(Long id);
+
+    /**
+    * 批量删除隔离点
+    *
+    * @param ids 编号
+    */
+    void deleteIsolationPointListByIds(List<Long> ids);
+
+    /**
+     * 获得隔离点
+     *
+     * @param id 编号
+     * @return 隔离点
+     */
+    IsolationPointDO getIsolationPoint(Long id);
+
+    /**
+     * 获得隔离点分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 隔离点分页
+     */
+    PageResult<IsolationPointDO> getIsolationPointPage(IsolationPointPageReqVO pageReqVO);
+
+    List<PointDetailVO> getPointDetailList(List<Long> pointIds);
+
+}

+ 99 - 94
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/isolationpoint/IsolationPointServiceImpl.java

@@ -1,94 +1,99 @@
-package cn.iocoder.yudao.module.iscs.service.isolationpoint;
-
-import cn.hutool.core.collection.CollUtil;
-import org.springframework.stereotype.Service;
-import jakarta.annotation.Resource;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
-import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.*;
-import cn.iocoder.yudao.module.iscs.dal.dataobject.isolationpoint.IsolationPointDO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-
-import cn.iocoder.yudao.module.iscs.dal.mysql.isolationpoint.IsolationPointMapper;
-
-import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
-import static cn.iocoder.yudao.module.iscs.enums.ErrorCodeConstants.*;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
-/**
- * 隔离点 Service 实现类
- *
- * @author 芋道源码
- */
-@Service
-@Validated
-public class IsolationPointServiceImpl extends ServiceImpl<IsolationPointMapper, IsolationPointDO> implements IsolationPointService {
-
-    @Resource
-    private IsolationPointMapper isolationPointMapper;
-
-    @Override
-    public Long createIsolationPoint(IsolationPointSaveReqVO createReqVO) {
-        // 插入
-        IsolationPointDO isolationPoint = BeanUtils.toBean(createReqVO, IsolationPointDO.class);
-        isolationPointMapper.insert(isolationPoint);
-
-        // 返回
-        return isolationPoint.getId();
-    }
-
-    @Override
-    public void updateIsolationPoint(IsolationPointSaveReqVO updateReqVO) {
-        // 校验存在
-        validateIsolationPointExists(updateReqVO.getId());
-        // 更新
-        IsolationPointDO updateObj = BeanUtils.toBean(updateReqVO, IsolationPointDO.class);
-        isolationPointMapper.updateById(updateObj);
-    }
-
-    @Override
-    public void deleteIsolationPoint(Long id) {
-        // 校验存在
-        validateIsolationPointExists(id);
-        // 删除
-        isolationPointMapper.deleteById(id);
-    }
-
-    @Override
-        public void deleteIsolationPointListByIds(List<Long> ids) {
-        // 校验存在
-        validateIsolationPointExists(ids);
-        // 删除
-        isolationPointMapper.deleteByIds(ids);
-        }
-
-    private void validateIsolationPointExists(List<Long> ids) {
-        List<IsolationPointDO> list = isolationPointMapper.selectByIds(ids);
-        if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
-            throw exception(ISOLATION_POINT_NOT_EXISTS);
-        }
-    }
-
-    private void validateIsolationPointExists(Long id) {
-        if (isolationPointMapper.selectById(id) == null) {
-            throw exception(ISOLATION_POINT_NOT_EXISTS);
-        }
-    }
-
-    @Override
-    public IsolationPointDO getIsolationPoint(Long id) {
-        return isolationPointMapper.selectById(id);
-    }
-
-    @Override
-    public PageResult<IsolationPointDO> getIsolationPointPage(IsolationPointPageReqVO pageReqVO) {
-        return isolationPointMapper.selectPage(pageReqVO);
-    }
-
-}
+package cn.iocoder.yudao.module.iscs.service.isolationpoint;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.Assert;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.IsolationPointPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.IsolationPointSaveReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.PointDetailVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.isolationpoint.IsolationPointDO;
+import cn.iocoder.yudao.module.iscs.dal.mysql.isolationpoint.IsolationPointMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.iscs.enums.ErrorCodeConstants.ISOLATION_POINT_NOT_EXISTS;
+
+/**
+ * 隔离点 Service 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+@Validated
+public class IsolationPointServiceImpl extends ServiceImpl<IsolationPointMapper, IsolationPointDO> implements IsolationPointService {
+
+    @Resource
+    private IsolationPointMapper isolationPointMapper;
+
+    @Override
+    public Long createIsolationPoint(IsolationPointSaveReqVO createReqVO) {
+        // 插入
+        IsolationPointDO isolationPoint = BeanUtils.toBean(createReqVO, IsolationPointDO.class);
+        isolationPointMapper.insert(isolationPoint);
+
+        // 返回
+        return isolationPoint.getId();
+    }
+
+    @Override
+    public void updateIsolationPoint(IsolationPointSaveReqVO updateReqVO) {
+        // 校验存在
+        validateIsolationPointExists(updateReqVO.getId());
+        // 更新
+        IsolationPointDO updateObj = BeanUtils.toBean(updateReqVO, IsolationPointDO.class);
+        isolationPointMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteIsolationPoint(Long id) {
+        // 校验存在
+        validateIsolationPointExists(id);
+        // 删除
+        isolationPointMapper.deleteById(id);
+    }
+
+    @Override
+        public void deleteIsolationPointListByIds(List<Long> ids) {
+        // 校验存在
+        validateIsolationPointExists(ids);
+        // 删除
+        isolationPointMapper.deleteByIds(ids);
+        }
+
+    private void validateIsolationPointExists(List<Long> ids) {
+        List<IsolationPointDO> list = isolationPointMapper.selectByIds(ids);
+        if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
+            throw exception(ISOLATION_POINT_NOT_EXISTS);
+        }
+    }
+
+    private void validateIsolationPointExists(Long id) {
+        if (isolationPointMapper.selectById(id) == null) {
+            throw exception(ISOLATION_POINT_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public IsolationPointDO getIsolationPoint(Long id) {
+        return isolationPointMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<IsolationPointDO> getIsolationPointPage(IsolationPointPageReqVO pageReqVO) {
+        return isolationPointMapper.selectPage(pageReqVO);
+    }
+
+    @Override
+    public List<PointDetailVO> getPointDetailList(List<Long> pointIds) {
+        Assert.isTrue(!pointIds.isEmpty(), "查询隔离点信息出错!");
+        List<PointDetailVO> isIsolationPoints = isolationPointMapper.getPointDetailList(pointIds);
+        return isIsolationPoints;
+    }
+
+}

+ 74 - 63
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/lotostation/LotoStationService.java

@@ -1,63 +1,74 @@
-package cn.iocoder.yudao.module.iscs.service.lotostation;
-
-import java.util.*;
-import jakarta.validation.*;
-import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.*;
-import cn.iocoder.yudao.module.iscs.dal.dataobject.lotostation.LotoStationDO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * 电柜 Service 接口
- *
- * @author 芋道源码
- */
-public interface LotoStationService extends IService<LotoStationDO> {
-
-    /**
-     * 创建电柜
-     *
-     * @param createReqVO 创建信息
-     * @return 编号
-     */
-    Long createLotoStation(@Valid LotoStationSaveReqVO createReqVO);
-
-    /**
-     * 更新电柜
-     *
-     * @param updateReqVO 更新信息
-     */
-    void updateLotoStation(@Valid LotoStationSaveReqVO updateReqVO);
-
-    /**
-     * 删除电柜
-     *
-     * @param id 编号
-     */
-    void deleteLotoStation(Long id);
-
-    /**
-    * 批量删除电柜
-    *
-    * @param ids 编号
-    */
-    void deleteLotoStationListByIds(List<Long> ids);
-
-    /**
-     * 获得电柜
-     *
-     * @param id 编号
-     * @return 电柜
-     */
-    LotoStationDO getLotoStation(Long id);
-
-    /**
-     * 获得电柜分页
-     *
-     * @param pageReqVO 分页查询
-     * @return 电柜分页
-     */
-    PageResult<LotoStationDO> getLotoStationPage(LotoStationPageReqVO pageReqVO);
-
-}
+package cn.iocoder.yudao.module.iscs.service.lotostation;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.BindingPointVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.LotoStationPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.LotoStationRespVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.LotoStationSaveReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.PointsMapVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.lotostation.LotoStationDO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import jakarta.validation.Valid;
+
+import java.util.List;
+
+/**
+ * 电柜 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface LotoStationService extends IService<LotoStationDO> {
+
+    /**
+     * 创建电柜
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createLotoStation(@Valid LotoStationSaveReqVO createReqVO);
+
+    /**
+     * 更新电柜
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateLotoStation(@Valid LotoStationSaveReqVO updateReqVO);
+
+    /**
+     * 删除电柜
+     *
+     * @param id 编号
+     */
+    void deleteLotoStation(Long id);
+
+    /**
+    * 批量删除电柜
+    *
+    * @param ids 编号
+    */
+    void deleteLotoStationListByIds(List<Long> ids);
+
+    /**
+     * 获得电柜
+     *
+     * @param id 编号
+     * @return 电柜
+     */
+    LotoStationRespVO getLotoStation(Long id);
+
+    /**
+     * 获得电柜分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 电柜分页
+     */
+    PageResult<LotoStationDO> getLotoStationPage(LotoStationPageReqVO pageReqVO);
+
+    LotoStationRespVO selectLotoBySerialNumber(String lotoSerialNumber);
+
+    List<PointsMapVO> selectLotoMapById(Long lotoId, Long sopId, Long ticketId);
+
+    Boolean updatePointsBindingLoto(BindingPointVO vo);
+
+
+}

+ 258 - 94
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/lotostation/LotoStationServiceImpl.java

@@ -1,94 +1,258 @@
-package cn.iocoder.yudao.module.iscs.service.lotostation;
-
-import cn.hutool.core.collection.CollUtil;
-import org.springframework.stereotype.Service;
-import jakarta.annotation.Resource;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
-import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.*;
-import cn.iocoder.yudao.module.iscs.dal.dataobject.lotostation.LotoStationDO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-
-import cn.iocoder.yudao.module.iscs.dal.mysql.lotostation.LotoStationMapper;
-
-import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
-import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
-import static cn.iocoder.yudao.module.iscs.enums.ErrorCodeConstants.*;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
-/**
- * 电柜 Service 实现类
- *
- * @author 芋道源码
- */
-@Service
-@Validated
-public class LotoStationServiceImpl extends ServiceImpl<LotoStationMapper, LotoStationDO> implements LotoStationService {
-
-    @Resource
-    private LotoStationMapper lotoStationMapper;
-
-    @Override
-    public Long createLotoStation(LotoStationSaveReqVO createReqVO) {
-        // 插入
-        LotoStationDO lotoStation = BeanUtils.toBean(createReqVO, LotoStationDO.class);
-        lotoStationMapper.insert(lotoStation);
-
-        // 返回
-        return lotoStation.getId();
-    }
-
-    @Override
-    public void updateLotoStation(LotoStationSaveReqVO updateReqVO) {
-        // 校验存在
-        validateLotoStationExists(updateReqVO.getId());
-        // 更新
-        LotoStationDO updateObj = BeanUtils.toBean(updateReqVO, LotoStationDO.class);
-        lotoStationMapper.updateById(updateObj);
-    }
-
-    @Override
-    public void deleteLotoStation(Long id) {
-        // 校验存在
-        validateLotoStationExists(id);
-        // 删除
-        lotoStationMapper.deleteById(id);
-    }
-
-    @Override
-        public void deleteLotoStationListByIds(List<Long> ids) {
-        // 校验存在
-        validateLotoStationExists(ids);
-        // 删除
-        lotoStationMapper.deleteByIds(ids);
-        }
-
-    private void validateLotoStationExists(List<Long> ids) {
-        List<LotoStationDO> list = lotoStationMapper.selectByIds(ids);
-        if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
-            throw exception(LOTO_STATION_NOT_EXISTS);
-        }
-    }
-
-    private void validateLotoStationExists(Long id) {
-        if (lotoStationMapper.selectById(id) == null) {
-            throw exception(LOTO_STATION_NOT_EXISTS);
-        }
-    }
-
-    @Override
-    public LotoStationDO getLotoStation(Long id) {
-        return lotoStationMapper.selectById(id);
-    }
-
-    @Override
-    public PageResult<LotoStationDO> getLotoStationPage(LotoStationPageReqVO pageReqVO) {
-        return lotoStationMapper.selectPage(pageReqVO);
-    }
-
-}
+package cn.iocoder.yudao.module.iscs.service.lotostation;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.Assert;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.BindingPointVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.PointDetailVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.LotoStationPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.LotoStationRespVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.LotoStationSaveReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.lotostation.vo.PointsMapVO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.isolationpoint.IsolationPointDO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.jobticketpoints.JobTicketPointsDO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.lotostation.LotoStationDO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.map.MapDO;
+import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopPointsDO;
+import cn.iocoder.yudao.module.iscs.dal.mysql.lotostation.LotoStationMapper;
+import cn.iocoder.yudao.module.iscs.service.isolationpoint.IsolationPointService;
+import cn.iocoder.yudao.module.iscs.service.jobticketpoints.JobTicketPointsService;
+import cn.iocoder.yudao.module.iscs.service.map.MapService;
+import cn.iocoder.yudao.module.iscs.service.sop.SopPointsService;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.annotation.Resource;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.iscs.enums.ErrorCodeConstants.LOTO_STATION_NOT_EXISTS;
+
+/**
+ * 电柜 Service 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+@Validated
+public class LotoStationServiceImpl extends ServiceImpl<LotoStationMapper, LotoStationDO> implements LotoStationService {
+
+    @Resource
+    private LotoStationMapper lotoStationMapper;
+    @Resource
+    private MapService mapService;
+    @Resource
+    private IsolationPointService isolationPointService;
+    @Resource
+    private SopPointsService sopPointsService;
+    @Resource
+    private JobTicketPointsService jobTicketPointsService;
+
+
+
+
+    @Override
+    public Long createLotoStation(LotoStationSaveReqVO createReqVO) {
+        Assert.notBlank(createReqVO.getLotoName(), "名称不可为空!");
+        // 判断名称重复
+        List<LotoStationDO> list = list(Wrappers.<LotoStationDO>lambdaQuery()
+                .eq(LotoStationDO::getLotoName, createReqVO.getLotoName()));
+        Assert.isTrue(list.isEmpty(), "该名称已被使用,请重新填写!");
+        // 判断序列号重复
+        List<LotoStationDO> list1 = list(Wrappers.<LotoStationDO>lambdaQuery()
+                .eq(LotoStationDO::getLotoSerialNumber, createReqVO.getLotoSerialNumber()));
+        Assert.isTrue(list1.isEmpty(), "该序列号已被使用,请重新填写!");
+        // 插入
+        LotoStationDO lotoStation = BeanUtils.toBean(createReqVO, LotoStationDO.class);
+        lotoStationMapper.insert(lotoStation);
+
+        // 返回
+        return lotoStation.getId();
+    }
+
+    @Override
+    public void updateLotoStation(LotoStationSaveReqVO updateReqVO) {
+        Assert.notNull(updateReqVO.getId(), "主键id不能为空!");
+        // 判断名称重复
+        List<LotoStationDO> list = list(Wrappers.<LotoStationDO>lambdaQuery()
+                .eq(LotoStationDO::getLotoName, updateReqVO.getLotoName())
+                .ne(LotoStationDO::getId, updateReqVO.getId()));
+        Assert.isTrue(list.isEmpty(), "该名称已被使用,请重新填写!");
+        // 判断序列号重复
+        List<LotoStationDO> list1 = list(Wrappers.<LotoStationDO>lambdaQuery()
+                .eq(LotoStationDO::getLotoSerialNumber, updateReqVO.getLotoSerialNumber())
+                .ne(LotoStationDO::getId, updateReqVO.getId()));
+        Assert.isTrue(list1.isEmpty(), "该序列号已被使用,请重新填写!");
+        update(Wrappers.<LotoStationDO>lambdaUpdate()
+                .eq(LotoStationDO::getId, updateReqVO.getId())
+                .set(LotoStationDO::getLotoName, updateReqVO.getLotoName())
+                .set(LotoStationDO::getLotoSerialNumber, updateReqVO.getLotoSerialNumber())
+                .set(LotoStationDO::getOrderNum, updateReqVO.getOrderNum())
+                .set(LotoStationDO::getMapId, updateReqVO.getMapId() != null ? updateReqVO.getMapId() : null)
+                .set(LotoStationDO::getWorkstationId, updateReqVO.getWorkstationId() != null ? updateReqVO.getWorkstationId() : null)
+                .set(LotoStationDO::getMap, StringUtils.isNotBlank(updateReqVO.getMap()) ? updateReqVO.getMap() : null));
+    }
+
+    @Override
+    public void deleteLotoStation(Long id) {
+        // 校验存在
+        validateLotoStationExists(id);
+        // 删除
+        lotoStationMapper.deleteById(id);
+    }
+
+    @Override
+        public void deleteLotoStationListByIds(List<Long> ids) {
+        // 校验存在
+        validateLotoStationExists(ids);
+        // 删除
+        lotoStationMapper.deleteByIds(ids);
+        }
+
+    private void validateLotoStationExists(List<Long> ids) {
+        List<LotoStationDO> list = lotoStationMapper.selectByIds(ids);
+        if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
+            throw exception(LOTO_STATION_NOT_EXISTS);
+        }
+    }
+
+    private void validateLotoStationExists(Long id) {
+        if (lotoStationMapper.selectById(id) == null) {
+            throw exception(LOTO_STATION_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public LotoStationRespVO getLotoStation(Long id) {
+        LotoStationDO byId = getById(id);
+        LotoStationRespVO bean = BeanUtils.toBean(byId, LotoStationRespVO.class);
+        if (bean != null && bean.getMapId() != null) {
+            MapDO map = mapService.getById(bean.getMapId());
+            if (bean != null) {
+                bean.setMapName(map.getName());
+            }
+        }
+        return bean;
+    }
+
+    @Override
+    public PageResult<LotoStationDO> getLotoStationPage(LotoStationPageReqVO pageReqVO) {
+        return lotoStationMapper.selectPage(pageReqVO);
+    }
+
+    @Override
+    public LotoStationRespVO selectLotoBySerialNumber(String lotoSerialNumber) {
+        Assert.notBlank(lotoSerialNumber, "请提供loto柜序列号!");
+        LotoStationDO one = getOne(Wrappers.<LotoStationDO>lambdaQuery()
+                .eq(LotoStationDO::getLotoSerialNumber, lotoSerialNumber));
+        return BeanUtils.toBean(one, LotoStationRespVO.class);
+    }
+
+    @Override
+    public List<PointsMapVO> selectLotoMapById(Long lotoId, Long sopId, Long ticketId) {
+        // 1.断言校验
+        Assert.notNull(lotoId, "请传入电柜id");
+        // 2.查询区域信息
+        LotoStationDO lotoStation = getById(lotoId);
+        // 3.解析map
+        List<PointsMapVO> points = new ArrayList<>();
+        if (lotoStation != null && StringUtils.isNotBlank(lotoStation.getMap())) {
+            String map = lotoStation.getMap();
+            ObjectMapper objectMapper = new ObjectMapper();
+            try {
+                points = objectMapper.readValue(map, new TypeReference<List<PointsMapVO>>(){});
+                // 4.补充点位name,隔离点类型,危险能量类型
+                List<Long> pointIds = points.stream().map(PointsMapVO::getPointId).collect(Collectors.toList());
+                List<PointDetailVO> pointDetailList = isolationPointService.getPointDetailList(pointIds);
+                // 5.获取sop信息
+                List<SopPointsDO> isSopPoints;
+                if (sopId != null) {
+                    isSopPoints = sopPointsService.list(Wrappers.<SopPointsDO>lambdaQuery()
+                            .eq(SopPointsDO::getSopId, sopId));
+                } else {
+                    isSopPoints = new ArrayList<>();
+                }
+                // 6.获取作业票点位数据
+                List<JobTicketPointsDO> isJobTicketPoints;
+                if (ticketId != null) {
+                    isJobTicketPoints = jobTicketPointsService.list(Wrappers.<JobTicketPointsDO>lambdaQuery()
+                            .eq(JobTicketPointsDO::getTicketId, ticketId));
+                } else {
+                    isJobTicketPoints = new ArrayList<>();
+                }
+                // 6.组装数据
+                points.stream().filter(o -> {
+                    // 初始化选中状态
+                    o.setState(false);
+                    // 如果点位信息有,则填充
+                    if (!pointDetailList.isEmpty()) {
+                        for (PointDetailVO pointDetailVO : pointDetailList) {
+                            if (o.getPointId().equals(pointDetailVO.getId())) {
+                                o.setPointName(pointDetailVO.getPointName());
+                                o.setPointType(pointDetailVO.getPointType());
+                                o.setPointTypeName(pointDetailVO.getPointTypeName());
+                                o.setPowerType(pointDetailVO.getPowerType());
+                                o.setPowerTypeName(pointDetailVO.getPowerTypeName());
+                                o.setPointIcon(pointDetailVO.getPointIcon());
+                                o.setPointPicture(pointDetailVO.getPointPicture());
+                            }
+                        }
+                    }
+                    // sop如果选中信息有则开始标记
+                    if (!isSopPoints.isEmpty()) {
+                        for (SopPointsDO isSopPoint : isSopPoints) {
+                            if (o.getPointId().equals(isSopPoint.getPointId())) {
+                                o.setState(true);
+                                // 根据sop的前置节点赋值
+                                o.setPrePointId(isSopPoint.getPrePointId());
+                            }
+                        }
+                    }
+                    // 作业票如果选中信息有则开始标记
+                    if (!isJobTicketPoints.isEmpty()) {
+                        for (JobTicketPointsDO ticketPoint : isJobTicketPoints) {
+                            if (o.getPointId().equals(ticketPoint.getPointId())) {
+                                o.setState(true);
+                                // 根据作业票的前置节点赋值
+                                o.setPrePointId(ticketPoint.getPrePointId());
+                            }
+                        }
+                    }
+                    return true;
+                }).collect(Collectors.toList());
+            } catch (IOException e) {
+                Assert.isTrue(false, "map数据解析失败!");
+                e.printStackTrace();
+            }
+        }
+        return points;
+    }
+
+    @Override
+    public Boolean updatePointsBindingLoto(BindingPointVO vo) {
+        Assert.notNull(vo.getLotoId(), "电柜ID不能为空!");
+        if (!vo.getBindingPointIds().isEmpty()) {
+            // 开始绑定
+            isolationPointService.update(Wrappers.<IsolationPointDO>lambdaUpdate()
+                    .in(IsolationPointDO::getId, vo.getBindingPointIds())
+                    .set(IsolationPointDO::getLotoId, vo.getLotoId()));
+        }
+        if (!vo.getUnbindPointIds().isEmpty()) {
+            // 开始解绑
+            isolationPointService.update(Wrappers.<IsolationPointDO>lambdaUpdate()
+                    .in(IsolationPointDO::getId, vo.getUnbindPointIds())
+                    .set(IsolationPointDO::getLotoId, null));
+        }
+        return true;
+    }
+
+}

+ 18 - 1
yudao-module-iscs/src/main/resources/mapper/IsolationPointMapper.xml

@@ -9,4 +9,21 @@
         文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
      -->
 
-</mapper>
+    <select id="getPointDetailList"
+            resultType="cn.iocoder.yudao.module.iscs.controller.admin.isolationpoint.vo.PointDetailVO">
+        select p.*,
+        d.label as powerTypeName,
+        dd.label as pointTypeName,
+        r.rfid as point_nfc
+        from isc_isolation_point p
+        left join system_dict_data d on d.dict_type = 'power_type' and p.power_type = d.value
+        left join system_dict_data dd on dd.dict_type = 'point_type' and p.point_type = dd.value
+        left join isc_rfid_token r on r.id = p.rfid_id
+        <where>
+            p.id in
+            <foreach collection="pointIds" index="index" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </where>
+    </select>
+</mapper>