From cc495948d834e87d5f1d389d42bdd2d32e1327c1 Mon Sep 17 00:00:00 2001 From: yinq <1345442242@qq.com> Date: Fri, 19 Aug 2022 15:38:37 +0800 Subject: [PATCH] =?UTF-8?q?add=E8=B5=84=E6=BA=90=E8=B4=9F=E8=8D=B7?= =?UTF-8?q?=E7=8E=87=E6=8A=A5=E8=A1=A8(=E5=91=A8=E7=BB=B4=E5=BA=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbnormalBillController.java | 2 - .../anomaly/controller/ReportController.java | 18 ++++++ .../mesnac/anomaly/mapper/ReportMapper.java | 7 +++ .../mesnac/anomaly/service/ReportService.java | 7 +++ .../service/impl/ReportServiceImpl.java | 13 ++++ .../main/resources/mapper/ReportMapper.xml | 62 +++++++++++++++++++ .../integration/service/ERPAPIWebService.java | 4 +- .../service/impl/ERPAPIWebServiceImpl.java | 4 +- .../meapi/controller/ResrceController.java | 46 ++++++++++++++ 9 files changed, 157 insertions(+), 6 deletions(-) diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java index f2bd368b..a14d88f1 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java @@ -483,8 +483,6 @@ public class AbnormalBillController { } - } - /** * 设备异常响应检索 */ diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/ReportController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/ReportController.java index a8611155..a08e8ca9 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/ReportController.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/ReportController.java @@ -6,6 +6,8 @@ package com.foreverwin.mesnac.anomaly.controller; * @Since 2021-08-23 */ +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONArray; import com.foreverwin.mesnac.anomaly.service.ReportService; import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.R; @@ -271,4 +273,20 @@ public class ReportController { } } + /** + * 资源负荷率报表(周维度) + * @param paramMap + * @return + */ + @GetMapping("/weekLoadRateReport") + public R weekLoadRateReport(@RequestParam(required = false) Map paramMap){ + try{ + return R.ok(reportService.weekLoadRateReport(paramMap)); + }catch (Exception e){ + return R.failed(e.getMessage()); + } + } + + + } diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/ReportMapper.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/ReportMapper.java index 2357da5f..5573efe1 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/ReportMapper.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/ReportMapper.java @@ -111,4 +111,11 @@ public interface ReportMapper { * @return */ List> qualityRepairReport(Map paramMap); + + /** + * 资源负荷率报表(周维度) + * @param paramMap + * @return + */ + List> weekLoadRateReport(Map paramMap); } diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/ReportService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/ReportService.java index f84cd73d..6bf248de 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/ReportService.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/ReportService.java @@ -117,4 +117,11 @@ public interface ReportService { * @return */ List> qualityRepairReport(Map paramMap); + + /** + * 资源负荷率报表(周维度) + * @param paramMap + * @return + */ + List> weekLoadRateReport(Map paramMap); } diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/ReportServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/ReportServiceImpl.java index 62c1f758..2d07ba4b 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/ReportServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/ReportServiceImpl.java @@ -504,6 +504,19 @@ public class ReportServiceImpl implements ReportService { return reportMapper.qualityRepairReport(paramMap); } + /** + * 资源负荷率报表(周维度) + * @param paramMap + * @return + */ + @Override + public List> weekLoadRateReport(Map paramMap) { + String site = CommonMethods.getSite(); + paramMap.put("site", site); + paramMap.put("locale", LocaleContextHolder.getLocale().getLanguage()); + return reportMapper.weekLoadRateReport(paramMap); + } + /** diff --git a/anomaly/src/main/resources/mapper/ReportMapper.xml b/anomaly/src/main/resources/mapper/ReportMapper.xml index 31e23af6..504e8ea0 100644 --- a/anomaly/src/main/resources/mapper/ReportMapper.xml +++ b/anomaly/src/main/resources/mapper/ReportMapper.xml @@ -1492,4 +1492,66 @@ + \ No newline at end of file diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/ERPAPIWebService.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/ERPAPIWebService.java index 64080b5e..888fcd62 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/service/ERPAPIWebService.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/ERPAPIWebService.java @@ -46,6 +46,6 @@ public interface ERPAPIWebService { WebServiceResponse itemBatchReceive(@WebParam(name = "itemBatchReceiveRequest") ItemBatchReceiveRequest itemBatchReceiveRequest); - @WebMethod(action = "http://service.integration.mesnac.com/test") - WebServiceResponse test(@WebParam(name = "TestSyncRequest") TestSyncRequest testSyncRequest); + /* @WebMethod(action = "http://service.integration.mesnac.com/test") + WebServiceResponse test(@WebParam(name = "TestSyncRequest") TestSyncRequest testSyncRequest);*/ } diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/ERPAPIWebServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/ERPAPIWebServiceImpl.java index b7f88b41..9e7f9661 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/ERPAPIWebServiceImpl.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/ERPAPIWebServiceImpl.java @@ -254,10 +254,10 @@ public class ERPAPIWebServiceImpl implements ERPAPIWebService { return response; } - @Override + /* @Override public WebServiceResponse test(TestSyncRequest testSyncRequest) { WebServiceResponse response = new WebServiceResponse(); System.out.println("接收成功:"+testSyncRequest.toString()); return response; - } + }*/ } diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/ResrceController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/ResrceController.java index ae136f60..004dce02 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/ResrceController.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/ResrceController.java @@ -1,8 +1,14 @@ package com.foreverwin.mesnac.meapi.controller; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.meapi.enums.HandleEnum; +import com.foreverwin.mesnac.meapi.model.CustomFields; import com.foreverwin.mesnac.meapi.model.Resrce; +import com.foreverwin.mesnac.meapi.service.CustomFieldsService; import com.foreverwin.mesnac.meapi.service.ResrceService; import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.FrontPage; @@ -10,6 +16,8 @@ import com.foreverwin.modular.core.util.R; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,6 +33,9 @@ public class ResrceController { @Autowired public ResrceService resrceService; + @Autowired + private CustomFieldsService customFieldsService; + /** * 查询所有数据 @@ -218,4 +229,39 @@ public class ResrceController { List> resourceTypeResourceList = resrceService.getResourceTypeResource(site); return R.ok(resourceTypeResourceList); } + + /** + * 资源负荷率报表 + * 存入 周产能、月产能 + * @param paramMap + * @return + */ + @PostMapping("/weekLoadRateReportSaveAll") + public R weekLoadRateReportSaveAll(@RequestBody Map paramMap) { + try { + List> resultList = (List>) paramMap.get("resultList"); + ArrayList CustomFieldsList = new ArrayList<>(); + if (paramMap.get("capacity").equals("weekCapacity")) { + for (HashMap hashMap : resultList) { + CustomFields customFields = new CustomFields(); + customFields.setHandle(HandleEnum.RESOURCE.getHandle(CommonMethods.getSite(), hashMap.get("RESRCE"))); + customFields.setAttribute("WEEK_CAPACITY"); + customFields.setValue(hashMap.get("weekCapacity")); + CustomFieldsList.add(customFields); + } + } else { + for (HashMap hashMap : resultList) { + CustomFields customFields = new CustomFields(); + customFields.setHandle(HandleEnum.RESOURCE.getHandle(CommonMethods.getSite(), hashMap.get("RESRCE"))); + customFields.setAttribute("MONTH_CAPACITY"); + customFields.setValue(hashMap.get("monthCapacity")); + CustomFieldsList.add(customFields); + } + } + customFieldsService.saveOrUpdateCustomFields(CustomFieldsList); + return R.ok("保存成功"); + }catch(Exception e){ + return R.failed(e.getMessage()); + } + } } \ No newline at end of file