| | |
| | | package com.dy.pmsOther.screen; |
| | | |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper; |
| | | import com.dy.pmsGlobal.daoSta.*; |
| | | import com.dy.pmsGlobal.pojoSta.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | private StaWipSnExMapper wipSnExDao; |
| | | private StaDeviceProductionLogMapper deviceProductionLogDao; |
| | | private StaRepairInfoMapper repairInfoDao; |
| | | private PrAssemblyPlanMapper assemblyPlanDao; |
| | | @Autowired |
| | | public void setDeviceLastDao(StaDeviceLastMapper deviceLastDao) { |
| | | this.deviceLastDao = deviceLastDao; |
| | |
| | | @Autowired |
| | | public void setDeviceProductionLogDao(StaDeviceProductionLogMapper deviceProductionLogDao) { |
| | | this.deviceProductionLogDao = deviceProductionLogDao; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setAssemblyPlanDao(PrAssemblyPlanMapper assemblyPlanDao) { |
| | | this.assemblyPlanDao = assemblyPlanDao; |
| | | } |
| | | |
| | | @Autowired |
| | |
| | | Date date = Date.from(dt.atZone(ZoneId.systemDefault()).toInstant()); |
| | | return date; |
| | | } |
| | | |
| | | public List<JSONObject> queryPlanList() { |
| | | List<JSONObject> list = assemblyPlanDao.queryPlanList(); |
| | | Map<String, JSONObject> map = new ConcurrentHashMap<>(); // 使用并发安全的Map |
| | | for(JSONObject item:list){ |
| | | String planId = String.valueOf(item.getObj("planId")); |
| | | JSONObject innerObject = new JSONObject() |
| | | .set("nodeId", String.valueOf(item.getObj("nodeId"))) |
| | | .set("content", item.getObj("content")); |
| | | if(map.containsKey(planId)){ |
| | | JSONArray array = (JSONArray)map.get(planId).get("nodes"); |
| | | array.add(innerObject); |
| | | }else{ |
| | | JSONArray array = new JSONArray(); |
| | | array.add(innerObject); |
| | | JSONObject outObject= new JSONObject() |
| | | .set("planId", planId) |
| | | .set("planName", item.getObj("planName")) |
| | | .set("nodes", array); |
| | | map.put(planId,outObject); |
| | | } |
| | | } |
| | | return map.values().stream().collect(Collectors.toList()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |