From f61dc2d33639010a7b9505fad0cfbe9d36e1f83b Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 24 九月 2024 11:19:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dto/MmPredictItemDTO.java                     |   28 ---------
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java |   23 +++++--
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java             |    6 +
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java              |    2 
 iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml                                                |    3 +
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java    |   64 ++++++++++-----------
 6 files changed, 53 insertions(+), 73 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java
index c84413b..bf58c85 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java
@@ -7,7 +7,9 @@
 import com.iailab.module.model.mcs.pre.dto.MmPredictItemDTO;
 import com.iailab.module.model.mcs.pre.entity.MmPredictItemEntity;
 import com.iailab.module.model.mcs.pre.service.MmPredictItemService;
-import com.iailab.module.model.mcs.pre.vo.*;
+import com.iailab.module.model.mcs.pre.vo.CountItemtypeVO;
+import com.iailab.module.model.mcs.pre.vo.MmPredictItemPageReqVO;
+import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -19,7 +21,6 @@
 import java.util.Map;
 import java.util.UUID;
 
-import static com.iailab.framework.common.pojo.CommonResult.error;
 import static com.iailab.framework.common.pojo.CommonResult.success;
 
 /**
@@ -43,6 +44,14 @@
         return success(BeanUtils.toBean(page, MmPredictItemRespVO.class));
     }
 
+    @GetMapping("/list")
+    @PreAuthorize("@ss.hasPermission('model:pre-predict:query')")
+    public CommonResult<List<MmPredictItemEntity>> list(@RequestParam Map<String, Object> params) {
+        List<MmPredictItemEntity> list = mmPredictItemService.list(params);
+
+        return success(list);
+    }
+
     /**
      * 预测项信息
      */
@@ -59,10 +68,8 @@
     @PostMapping("/create")
     @PreAuthorize("@ss.hasPermission('model:pre-predict:create')")
     @DSTransactional(rollbackFor= Exception.class)
-    public CommonResult<Boolean> save(@RequestBody MmPredictItemEntity mmPredictItemEntity){
-        String id = UUID.randomUUID().toString();
-        mmPredictItemEntity.setId(id);
-        mmPredictItemService.add(mmPredictItemEntity);
+    public CommonResult<Boolean> save(@RequestBody MmPredictItemDTO mmPredictItemDto){
+        mmPredictItemService.add(mmPredictItemDto);
         return success(true);
     }
 
@@ -72,8 +79,8 @@
     @PutMapping("/update")
     @PreAuthorize("@ss.hasPermission('model:pre-predict:update')")
     @DSTransactional(rollbackFor= Exception.class)
-    public CommonResult<Boolean> update(@RequestBody MmPredictItemEntity mmPredictItemEntity){
-        mmPredictItemService.update(mmPredictItemEntity);
+    public CommonResult<Boolean> update(@RequestBody MmPredictItemDTO mmPredictItemDTO){
+        mmPredictItemService.update(mmPredictItemDTO);
         return success(true);
     }
 
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dto/MmPredictItemDTO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dto/MmPredictItemDTO.java
index ec5f99f..b46875e 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dto/MmPredictItemDTO.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/dto/MmPredictItemDTO.java
@@ -17,34 +17,6 @@
 public class MmPredictItemDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    private String id;
-
-    private String itemno;
-
-    private String itemname;
-
-    private String caltypeid;
-
-    private String itemtypeid;
-
-    private BigDecimal predictlength;
-
-    private BigDecimal granularity;
-
-    private BigDecimal status;
-
-    private BigDecimal isfuse;
-
-    private BigDecimal predictphase;
-
-    private BigDecimal workchecked;
-
-    private BigDecimal unittransfactor;
-
-    private Date createTime;
-
-    private Date updateTime;
-
     private MmPredictItemEntity mmPredictItem;
 
     private DmModuleItemEntity dmModuleItem;
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java
index d77d7a9..688c34a 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/MmPredictItemService.java
@@ -37,7 +37,9 @@
 
     PageResult<MmPredictItemEntity> queryPage(MmPredictItemPageReqVO reqVO);
 
-    void add(MmPredictItemEntity mmPredictItemEntity);
+    void add(MmPredictItemDTO mmPredictItemDto);
 
-    void update(MmPredictItemEntity mmPredictItemEntity);
+    void update(MmPredictItemDTO mmPredictItemDTO);
+
+    List<MmPredictItemEntity> list(Map<String, Object> params);
 }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
index 0af6c44..4a44fde 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
@@ -12,17 +12,13 @@
 import com.iailab.module.model.mcs.pre.service.MmPredictItemService;
 import com.iailab.module.model.mcs.pre.service.SequenceNumService;
 import com.iailab.module.model.mcs.pre.vo.MmPredictItemPageReqVO;
-import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO;
 import com.iailab.module.model.mdk.vo.ItemVO;
 import com.iailab.module.model.mdk.vo.MergeItemVO;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.util.*;
 
 /**
@@ -64,25 +60,30 @@
         return mmPredictItemDao.selectPage(reqVO);
     }
 
+//    @Override
+//    public void add(MmPredictItemEntity mmPredictItemEntity) {
+//        mmPredictItemDao.insert(mmPredictItemEntity);
+//    }
+
+//    @Override
+//    public void update(MmPredictItemEntity mmPredictItemEntity) {
+//        mmPredictItemDao.updateById(mmPredictItemEntity);
+//    }
+
     @Override
-    public void add(MmPredictItemEntity mmPredictItemEntity) {
-        mmPredictItemDao.insert(mmPredictItemEntity);
+    public List<MmPredictItemEntity> list(Map<String, Object> params) {
+        return Collections.emptyList();
     }
 
     @Override
-    public void update(MmPredictItemEntity mmPredictItemEntity) {
-        mmPredictItemDao.updateById(mmPredictItemEntity);
-    }
-
-    /*
-    public void savePredictItem(MmPredictItemDTO mmPredictItemDto) {
+    public void add(MmPredictItemDTO mmPredictItemDto) {
         MmPredictItemEntity predictItem = mmPredictItemDto.getMmPredictItem();
         predictItem.setId(UUID.randomUUID().toString());
         predictItem.setCreateTime(new Date());
         predictItem.setUpdateTime(new Date());
 
         MmItemTypeEntity itemType = mmItemTypeImpl.getById(predictItem.getItemtypeid());
-        if (ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) {
+        if (itemType != null && ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) {
             SequenceNumEntity sequenceNumEntity = sequenceNumService.getAndIncreaseByCode(ItemIncreaseCodeEnum.IM.toString());
             String str = String.format("%010d", sequenceNumEntity.getSequenceNum());
             predictItem.setItemno(sequenceNumEntity.getPrefix() + str);
@@ -105,7 +106,7 @@
                 item.setModelid(mmPredictModel.getId());
             });
             mmModelParamService.saveList(mmModelParamList);
-        } else if (ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) {
+        } else if (itemType != null && ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) {
             SequenceNumEntity sequenceNumEntity = sequenceNumService.getAndIncreaseByCode(ItemIncreaseCodeEnum.IC.toString());
             String str = String.format("%010d", sequenceNumEntity.getSequenceNum());
             predictItem.setItemno(sequenceNumEntity.getPrefix() + str);
@@ -122,15 +123,15 @@
         MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput();
         mmItemOutput.setItemid(predictItem.getId());
         mmItemOutputService.saveMmItemOutput(mmItemOutput);
-    }*/
-/*
+    }
+
     @Override
     public void update(MmPredictItemDTO mmPredictItemDto) {
         MmPredictItemEntity predictItem = mmPredictItemDto.getMmPredictItem();
         predictItem.setUpdateTime(new Date());
-        this.updateById(predictItem);
+        mmPredictItemDao.updateById(predictItem);
         MmItemTypeEntity itemType = mmItemTypeImpl.getById(predictItem.getItemtypeid());
-        if (ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) {
+        if (itemType != null && ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) {
             MmPredictModelEntity mmPredictModel = mmPredictItemDto.getMmPredictModel();
             mmPredictModelService.update(mmPredictModel);
 
@@ -145,16 +146,20 @@
                 item.setModelid(mmPredictModel.getId());
             });
             mmModelParamService.saveList(mmModelParamList);
-        } else if (ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) {
+        } else if (itemType != null && ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) {
             MmPredictMergeItemEntity mMmPredictMergeItem = mmPredictItemDto.getMmPredictMergeItem();
             mmPredictMergeItemService.update(mMmPredictMergeItem);
         }
         DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem();
-        dmModuleItemService.update(dmModuleItem);
-
+        if(!"".equals(dmModuleItem.getId()) && dmModuleItem.getId() != null){
+            dmModuleItemService.update(dmModuleItem);
+        }
         MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput();
-        mmItemOutputService.update(mmItemOutput);
-    }*/
+        if(!"".equals(mmItemOutput.getId()) && dmModuleItem.getId() != null){
+            mmItemOutputService.update(mmItemOutput);
+        }
+    }
+
     @Override
     public void deleteBatch(String[] itemIds) {
         mmPredictItemDao.deleteBatchIds(Arrays.asList(itemIds));
@@ -167,29 +172,20 @@
     public MmPredictItemDTO info(String id) {
         MmPredictItemEntity predictItem = mmPredictItemDao.selectById(id);
         MmPredictItemDTO mmPredictItemDto = BeanUtils.toBean(predictItem, MmPredictItemDTO.class);
-        return mmPredictItemDto;
-    }
-/*
-
-    @Override
-    public MmPredictItemDTO info(String id) {
-        MmPredictItemEntity predictItem = mmPredictItemDao.selectById(id);
-        MmPredictItemDTO mmPredictItemDto = BeanUtils.toBean(predictItem, MmPredictItemDTO.class);
         mmPredictItemDto.setMmPredictItem(predictItem);
         mmPredictItemDto.setDmModuleItem(dmModuleItemService.getByItemid(id));
         mmPredictItemDto.setMmItemOutput(mmItemOutputService.getByItemid(id));
         MmItemTypeEntity itemType = mmItemTypeImpl.getById(predictItem.getItemtypeid());
-        if (ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) {
+        if (itemType != null && ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) {
             MmPredictModelEntity mmPredictModel = mmPredictModelService.getByItemid(id);
             mmPredictItemDto.setMmPredictModel(mmPredictModel);
             mmPredictItemDto.setMmModelArithSettingsList(mmModelArithSettingsService.getByModelid(mmPredictModel.getId()));
             mmPredictItemDto.setMmModelParamList(mmModelParamService.getByModelid(mmPredictModel.getId()));
-        } else if (ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) {
+        } else if (itemType != null && ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) {
             mmPredictItemDto.setMmPredictMergeItem(mmPredictMergeItemService.getByItemid(id));
         }
         return mmPredictItemDto;
     }
-*/
 
     @Override
     public int check(MmPredictItemEntity mmPredictItem) {
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
index 97193fc..ac4490c 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
@@ -227,7 +227,7 @@
         Velocity.init(prop);
 
         //生成menu.xml文件
-        Map<String, Map<String, List<MpkFileDTO>>> collect = entities.stream().collect(Collectors.groupingBy(MpkFileDTO::getMenuName, Collectors.groupingBy(e -> StringUtils.isNotBlank(e.getGroupName()) ? e.getGroupName() : "default_group")));
+        LinkedHashMap<String, LinkedHashMap<String, List<MpkFileDTO>>> collect = entities.stream().collect(Collectors.groupingBy(MpkFileDTO::getMenuName, LinkedHashMap::new, Collectors.groupingBy(e -> StringUtils.isNotBlank(e.getGroupName()) ? e.getGroupName() : "default_group",LinkedHashMap::new,Collectors.toList())));
         Map<String, Object> map1 = new HashMap<>();
         map1.put("collects", collect);
         File xmlFile = new File(dirPath.getAbsolutePath() + File.separator + "menu.xml");
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml
index 2abdabd..3a7e1a6 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml
+++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml
@@ -93,10 +93,13 @@
                 LEFT JOIN t_mpk_model_method b ON a.id = b.mpk_file_id
                 LEFT JOIN t_mpk_method_setting c ON b.id = c.method_id
                 LEFT JOIN t_mpk_setting_select d ON c.id = d.setting_id
+                LEFT JOIN t_mpk_file_menu e ON e.name = a.menu_name
+                LEFT JOIN t_mpk_file_group f ON f.menu_id = e.id and f.name = a.group_name
         WHERE a.id in
         <foreach collection="ids" item="item" open="(" close=")" separator=",">
             #{item}
         </foreach>
+        ORDER BY e.sort,f.sort,a.create_date
     </select>
     <select id="getProjectModelCount" resultType="java.lang.Integer" parameterType="java.lang.String">
         SELECT

--
Gitblit v1.9.3