| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 气体管路产能规划Controller |
| | | * |
| | | * |
| | | * @author hjy |
| | | * @date 2025-04-24 |
| | | */ |
| | |
| | | @Tag(name = "气体管路产能规划", description = "气体管路产能规划接口") |
| | | @RestController |
| | | @RequestMapping("/gasPipelineCapacityPlan") |
| | | public class ApsGasPipelineCapacityPlanController extends BaseController |
| | | { |
| | | public class ApsGasPipelineCapacityPlanController extends BaseController { |
| | | @Autowired |
| | | private IApsGasPipelineCapacityPlanService apsGasPipelineCapacityPlanService; |
| | | |
| | |
| | | * 查询气体管路产能规划列表 |
| | | */ |
| | | @Operation(summary = "查询气体管路产能规划列表", description = "分页查询") |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:list") |
| | | // @RequiresPermissions("aps:gasPipelineCapacityPlan:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) |
| | | { |
| | | public TableDataInfo list(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) { |
| | | // startPage(); |
| | | List<ApsGasPipelineCapacityPlan> list = apsGasPipelineCapacityPlanService.selectApsGasPipelineCapacityPlanList(apsGasPipelineCapacityPlan); |
| | | ApsStandardProcess apsStandardProcess = new ApsStandardProcess(); |
| | | apsStandardProcess.setMajor(apsGasPipelineCapacityPlan.getMajor()); |
| | | apsStandardProcess.setPlant(apsGasPipelineCapacityPlan.getOrgCode()); |
| | | List<ApsStandardProcess> processList = apsStandardProcessService.selectApsStandardProcessListAll(apsStandardProcess); |
| | | if(list.isEmpty()){ |
| | | for(ApsStandardProcess apsStandardProcessTemp : processList){ |
| | | if (list.isEmpty()) { |
| | | for (ApsStandardProcess apsStandardProcessTemp : processList) { |
| | | ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlanTemp = new ApsGasPipelineCapacityPlan(); |
| | | apsGasPipelineCapacityPlanTemp.setProcessName(apsStandardProcessTemp.getProcessName()); |
| | | apsGasPipelineCapacityPlanTemp.setOrgCode(apsStandardProcessTemp.getPlant()); |
| | | apsGasPipelineCapacityPlanTemp.setWorkshop(apsStandardProcessTemp.getWorkShop()); |
| | | list.add(apsGasPipelineCapacityPlanTemp); |
| | | } |
| | | } else { |
| | | list.forEach(item -> { |
| | | processList.stream().filter(p -> Objects.equals(p.getPlant(), item.getOrgCode())) |
| | | .filter(p -> Objects.equals(p.getProcessName(), item.getProcessName())) |
| | | .findFirst().ifPresent(p -> { |
| | | item.setWorkshop(p.getWorkShop()); |
| | | }); |
| | | }); |
| | | } |
| | | if(processList.size()>list.size()){ |
| | | List<String> newProcess = new ArrayList<>(); |
| | | for(ApsStandardProcess apsStandardProcessTemp : processList){ |
| | | if (processList.size() > list.size()) { |
| | | List<ApsStandardProcess> newProcess = new ArrayList<>(); |
| | | for (ApsStandardProcess apsStandardProcessTemp : processList) { |
| | | boolean flag = true; |
| | | for(ApsGasPipelineCapacityPlan temp : list){ |
| | | if(apsStandardProcessTemp.getProcessName().equals(temp.getProcessName())){ |
| | | for (ApsGasPipelineCapacityPlan temp : list) { |
| | | if (apsStandardProcessTemp.getProcessName().equals(temp.getProcessName())) { |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | if(flag){ |
| | | newProcess.add(apsStandardProcessTemp.getProcessName()); |
| | | if (flag) { |
| | | newProcess.add(apsStandardProcessTemp); |
| | | } |
| | | } |
| | | for(String processName : newProcess){ |
| | | for (ApsStandardProcess processName : newProcess) { |
| | | ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlanTemp = new ApsGasPipelineCapacityPlan(); |
| | | apsGasPipelineCapacityPlanTemp.setProcessName(processName); |
| | | apsGasPipelineCapacityPlanTemp.setProcessName(processName.getProcessName()); |
| | | apsGasPipelineCapacityPlanTemp.setOrgCode(processName.getPlant()); |
| | | apsGasPipelineCapacityPlanTemp.setWorkshop(processName.getWorkShop()); |
| | | list.add(apsGasPipelineCapacityPlanTemp); |
| | | } |
| | | } |
| | | list.sort((a, b)->a.getProcessName().compareTo(b.getProcessName())); |
| | | list.sort((a, b) -> a.getProcessName().compareTo(b.getProcessName())); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:export") |
| | | @Log(title = "气体管路产能规划", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) |
| | | { |
| | | public void export(HttpServletResponse response, ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) { |
| | | List<ApsGasPipelineCapacityPlan> list = apsGasPipelineCapacityPlanService.selectApsGasPipelineCapacityPlanList(apsGasPipelineCapacityPlan); |
| | | ExcelUtil<ApsGasPipelineCapacityPlan> util = new ExcelUtil<ApsGasPipelineCapacityPlan>(ApsGasPipelineCapacityPlan.class); |
| | | util.exportExcel(response, list, "气体管路产能规划数据"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 复制气体管路产能规划 |
| | | */ |
| | | @Operation(summary = "复制气体管路产能规划", description = "复制") |
| | | // @RequiresPermissions("aps:gasPipelineCapacityPlan:copy") |
| | | @Log(title = "复制气体管路产能规划", businessType = BusinessType.INSERT) |
| | | @PutMapping("/copy") |
| | | public AjaxResult copy( |
| | | // 格式:yyyy-MM |
| | | @RequestParam String date, |
| | | @RequestParam String factory, |
| | | @RequestParam String major, |
| | | // 格式:yyyy-MM |
| | | @RequestParam String toStart, |
| | | // 格式:yyyy-MM |
| | | @RequestParam String toEnd) { |
| | | apsGasPipelineCapacityPlanService.copyPlan(date, factory, major, toStart, toEnd); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "获取气体管路产能规划详细信息", description = "根据id获取") |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:query") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return success(apsGasPipelineCapacityPlanService.selectApsGasPipelineCapacityPlanById(id)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:add") |
| | | @Log(title = "气体管路产能规划", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody List<ApsGasPipelineCapacityPlan> apsGasPipelineCapacityPlan) |
| | | { |
| | | public AjaxResult add(@RequestBody List<ApsGasPipelineCapacityPlan> apsGasPipelineCapacityPlan) { |
| | | apsGasPipelineCapacityPlan.forEach(apsGasPipelineCapacityPlanTemp -> { |
| | | if(apsGasPipelineCapacityPlanTemp.getId()==null){ |
| | | if (apsGasPipelineCapacityPlanTemp.getId() == null) { |
| | | apsGasPipelineCapacityPlanTemp.setCreateBy(SecurityUtils.getUsername()); |
| | | apsGasPipelineCapacityPlanTemp.setCreateTime(DateUtils.getNowDate()); |
| | | apsGasPipelineCapacityPlanService.insertApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlanTemp); |
| | | }else{ |
| | | } else { |
| | | apsGasPipelineCapacityPlanTemp.setUpdateBy(SecurityUtils.getUsername()); |
| | | apsGasPipelineCapacityPlanTemp.setUpdateTime(DateUtils.getNowDate()); |
| | | apsGasPipelineCapacityPlanService.updateApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlanTemp); |
| | |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:edit") |
| | | @Log(title = "气体管路产能规划", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) |
| | | { |
| | | public AjaxResult edit(@RequestBody ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) { |
| | | return toAjax(apsGasPipelineCapacityPlanService.updateApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlan)); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "删除气体管路产能规划", description = "批量删除") |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:remove") |
| | | @Log(title = "气体管路产能规划", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | return toAjax(apsGasPipelineCapacityPlanService.deleteApsGasPipelineCapacityPlanByIds(ids)); |
| | | } |
| | | } |