Browse Source

保养查看报错修复

guarantee-lsq 2 years ago
parent
commit
a6e9d71467

+ 1 - 1
platform-dao/src/main/java/com/platform/dao/entity/check/CheckStandard.java

@@ -173,5 +173,5 @@ public class CheckStandard implements Serializable {
      */
     private List<CheckStandardSpareVO> detailList;
 
-    private String positionNo; // 设备位号
+    //private String positionNo; // 设备位号
 }

+ 1 - 1
platform-dao/src/main/resources/mapper/check/CheckStandardMapper.xml

@@ -137,7 +137,7 @@ checkstandard.last_date,
     </sql>
     <select id="selectList" parameterType="com.platform.dao.dto.check.CheckStandardDTO"
             resultType="com.platform.dao.vo.query.check.CheckStandardVO">
-        select checkstandard.*, sbInfo.name as sbName, sbInfo.no as sbNo,
+        select checkstandard.*, sbInfo.name as sbName, sbInfo.no as sbNo, sbInfo.position_no as positionNo,
         sbInfo.level as sbLevel,sbInfo.position_no as positionNo,
         sbInfo.repair_user as repairUser,
         partInfo.name as partName

+ 4 - 4
platform-rest/src/main/java/com/platform/rest/controller/check/CheckStandardController.java

@@ -60,8 +60,8 @@ public class CheckStandardController {
      * @return R
      */
     @GetMapping("/{id}")
-    public R<CheckStandard> getById(@PathVariable("id") String id){
-        return new R<>(checkStandardService.getModelById(id));
+    public R<CheckStandardVO> getById(@PathVariable("id") String id){
+        return new R<>(checkStandardService.getVOById(id));
     }
 
     @PostMapping("/add/{id}")
@@ -201,8 +201,8 @@ public class CheckStandardController {
    * @return R
    */
   @GetMapping("/page")
-  public R<AbstractPageResultBean<CheckStandard>> query(CheckStandardDTO checkStandardDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
-      return new R<>(checkStandardService.selectPageInfo(checkStandardDTO, pageNum, pageSize));
+  public R<AbstractPageResultBean<CheckStandardVO>> query(CheckStandardDTO checkStandardDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
+      return new R<>(checkStandardService.selectPage(checkStandardDTO, pageNum, pageSize));
   }
 
   /**

+ 5 - 0
platform-service/src/main/java/com/platform/service/check/CheckStandardService.java

@@ -72,4 +72,9 @@ public interface CheckStandardService extends IBaseService<CheckStandard, CheckS
      */
     AbstractPageResultBean<CheckStandardSpareVO> selectSpareWarnVOPage(int month, int type, int pageNum, int pageSize);
 
+   AbstractPageResultBean<CheckStandardVO> selectPage(CheckStandardDTO record, int pageNum, int pageSize);
+
+   CheckStandardVO getVOById(String id);
+
+
 }

+ 41 - 2
platform-service/src/main/java/com/platform/service/check/impl/CheckStandardServiceImpl.java

@@ -144,12 +144,51 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
     }
 
     @Override
-    public AbstractPageResultBean<CheckStandard> selectPageInfo(CheckStandardDTO record, int pageNum, int pageSize) {
+    public AbstractPageResultBean<CheckStandardVO> selectPage(CheckStandardDTO record, int pageNum, int pageSize) {
         PageHelper.startPage(pageNum, pageSize);
-        AbstractPageResultBean<CheckStandard> pageInfo = new MyPage(mapper.selectList(record));
+        AbstractPageResultBean<CheckStandardVO> pageInfo = new MyPage(mapper.selectList(record));
         return pageInfo;
     }
 
+    @Override
+    public CheckStandardVO getVOById(String id) {
+        CheckStandard checkStandard = super.getModelById(id);
+  /*      Weekend<CheckStandardParam> weekend = new Weekend<>(CheckStandardParam.class);
+        weekend.weekendCriteria().andEqualTo(CheckStandardParam::getStandardId, id);
+        List<CheckStandardParam> paramList = paramMapper.selectByExample(weekend);
+        checkStandard.setParamList(paramList);*/
+
+
+
+        if(checkStandard == null){
+            throw new BusinessException("保养标准已经删除,该任务无需执行,请删除该任务");
+        }
+        CheckStandardVO vo = BeanConverterUtil.copyObjectProperties(checkStandard,CheckStandardVO.class);
+        Weekend<SysFile> weekendFile = new Weekend<>(SysFile.class);
+        weekendFile.weekendCriteria().andEqualTo(SysFile::getTargetId, checkStandard.getId());
+        List<SysFile> sysFiles = sysFileService.getListByTargetAndType(checkStandard.getId(), null);
+        List<SysFile> checkImgList = ListUtils.newArrayList();
+        List<SysFile> checkFileList = ListUtils.newArrayList();
+        sysFiles.forEach(item -> {
+            if (item.getType().equals( SysFileTypeEnum.CHECK_STANDARD_IMGS.getValue())) {
+                checkImgList.add(item);
+            }
+            if (item.getType().equals( SysFileTypeEnum.CHECK_STANDARD_FILES.getValue())) {
+                checkFileList.add(item);
+            }
+        });
+        vo.setCheckImgList(checkImgList);
+        vo.setCheckFileList(checkFileList);
+        SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(vo.getSbId());
+        if(sbInfo != null){
+            vo.setPositionNo(sbInfo.getPositionNo());
+        }
+        // 备件列表
+        List<CheckStandardSpareVO> spareList = spareService.selectVOListByCheckId(checkStandard.getId());
+        vo.setDetailList(spareList);
+        return vo;
+    }
+
     /**
      * 编码需要查询最大的编码,然后+1,
      * 编码格式:五位,补零,00001