| | |
| | | // 格式: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, toStart, toEnd); |
| | | apsGasPipelineCapacityPlanService.copyPlan(date, factory, major, toStart, toEnd); |
| | | return success(); |
| | | } |
| | | |
| | |
| | | byte[] file = IOUtils.resourceToByteArray("/templates/气体工单数据模板v1.0.xlsx"); |
| | | ByteArrayResource resource = new ByteArrayResource(file); |
| | | return ResponseEntity.ok() |
| | | .header("Access-Control-Expose-Headers", HttpHeaders.CONTENT_DISPOSITION) |
| | | .header(HttpHeaders.CONTENT_DISPOSITION, |
| | | String.format("attachment;filename=%s", URLEncoder.encode("气体工单数据模板.xlsx", StandardCharsets.UTF_8))) |
| | | .header(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") |
| | |
| | | byte[] file = IOUtils.resourceToByteArray("/templates/气体预测数据模板v1.0.xlsx"); |
| | | ByteArrayResource resource = new ByteArrayResource(file); |
| | | return ResponseEntity.ok() |
| | | .header("Access-Control-Expose-Headers", HttpHeaders.CONTENT_DISPOSITION) |
| | | .header(HttpHeaders.CONTENT_DISPOSITION, |
| | | String.format("attachment;filename=%s", URLEncoder.encode("气体预测数据模板.xlsx", StandardCharsets.UTF_8))) |
| | | .header(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") |
| | |
| | | */ |
| | | public int deleteApsGasPipelineCapacityPlanByIds(Long[] ids); |
| | | |
| | | void deleteByDateAndFactory(String year, String month, String factory); |
| | | void deleteByDateAndFactory(String year, String month, String factory, String major); |
| | | } |
| | |
| | | */ |
| | | public int deleteApsGasPipelineCapacityPlanById(Long id); |
| | | |
| | | void copyPlan(String date, String factory, String toStart, String toEnd); |
| | | void copyPlan(String date, String factory, String major, String toStart, String toEnd); |
| | | } |
| | |
| | | @SneakyThrows |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void copyPlan(String date, String factory, String toStart, String toEnd) { |
| | | public void copyPlan(String date, String factory, String major, String toStart, String toEnd) { |
| | | |
| | | String[] dtSrc = date.split("-"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); |
| | |
| | | plan.setYear(Integer.valueOf(dtSrc[0]).toString()); |
| | | plan.setMonth(Integer.valueOf(dtSrc[1]).toString()); |
| | | plan.setOrgCode(factory); |
| | | plan.setMajor(major); |
| | | List<ApsGasPipelineCapacityPlan> templatePlans = apsGasPipelineCapacityPlanMapper.selectApsGasPipelineCapacityPlanList(plan); |
| | | while (dtStart.before(dtEnd)) { |
| | | String year = dtStart.get(Calendar.YEAR) + ""; |
| | |
| | | apsGasPipelineCapacityPlanMapper.deleteByDateAndFactory( |
| | | year, |
| | | month, |
| | | factory |
| | | factory, |
| | | major |
| | | ); |
| | | templatePlans.forEach(p -> { |
| | | p.setYear(year); |
| | |
| | | where year = #{year} |
| | | and month = #{month} |
| | | and org_code = #{factory} |
| | | and major = #{major} |
| | | </delete> |
| | | </mapper> |