0b6b9df7 康伟

kangwei:备统计分析功能调试

       设备统计详情接口
       设备完好率详情接口
       维护维修费用
       维护维修费用详情接口
1 个父辈 0cd11034
...@@ -364,18 +364,19 @@ public class JSUtils { ...@@ -364,18 +364,19 @@ public class JSUtils {
364 public static String quoteEach(String str,String splitStr) { 364 public static String quoteEach(String str,String splitStr) {
365 if( str != null && str.length() > 0 ){ 365 if( str != null && str.length() > 0 ){
366 String[] items = str.split(splitStr); 366 String[] items = str.split(splitStr);
367 StringBuilder sb = new StringBuilder(); 367 String result = "";
368 for (int i = 0; i < items.length; i++) { 368 for (int i = 0; i < items.length; i++) {
369 if (i > 0) { 369 if(StringUtils.isNotEmpty(items[i])){
370 sb.append(", "); 370 if(result.length()>0) result +=",";
371 result += "'"+items[i]+"'";
371 } 372 }
372 sb.append('\'').append(items[i]).append('\'');
373 } 373 }
374 return sb.toString(); 374 return result;
375 } 375 }
376 return str; 376 return str;
377 } 377 }
378 378
379
379 /*** 380 /***
380 * 计算时间的前几个月的月份 381 * 计算时间的前几个月的月份
381 * @param month 382 * @param month
...@@ -395,7 +396,15 @@ public class JSUtils { ...@@ -395,7 +396,15 @@ public class JSUtils {
395 } 396 }
396 397
397 public static void main(String[] args) { 398 public static void main(String[] args) {
398 System.out.println(getMonthBytime(-12,"2024-12")); 399 //System.out.println(getMonthBytime(-12,"2024-12"));
400 String str = "11,22,33,44";
401 System.out.println(quoteEach(str,",") );
402 str = ",11,,33,44";
403 System.out.println(quoteEach(str,",") );
404 str = ",11,22,33,44,,";
405 System.out.println(quoteEach(str,",") );
406 str = "11,,,44";
407 System.out.println(quoteEach(str,",") );
399 } 408 }
400 409
401 /* ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript"); 410 /* ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
......
1 package com.skua.modules.material.controller; 1 package com.skua.modules.material.controller;
2 2
3 import com.alibaba.fastjson.JSON;
4 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 3 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 import com.baomidou.mybatisplus.core.metadata.IPage; 4 import com.baomidou.mybatisplus.core.metadata.IPage;
6 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 import com.skua.core.api.vo.Result; 6 import com.skua.core.api.vo.Result;
7 import com.skua.core.aspect.AutoLogAspect;
8 import com.skua.core.aspect.annotation.AutoLog; 8 import com.skua.core.aspect.annotation.AutoLog;
9 import com.skua.core.context.BaseContextHandler; 9 import com.skua.core.context.BaseContextHandler;
10 import com.skua.core.context.SpringContextUtils; 10 import com.skua.core.context.SpringContextUtils;
11 import com.skua.core.query.QueryGenerator; 11 import com.skua.core.query.QueryGenerator;
12 import com.skua.core.util.ConvertUtils; 12 import com.skua.core.util.ConvertUtils;
13 import com.skua.core.util.DateUtils; 13 import com.skua.core.util.DateUtils;
14 import com.skua.modules.erp.entity.ApproveRecord; 14 import com.skua.modules.common.service.ICommonSqlService;
15 import com.skua.modules.erp.entity.ErpSettlement;
16 import com.skua.modules.erp.vo.PurchaseContractVO;
17 import com.skua.modules.material.entity.MaterialInfo; 15 import com.skua.modules.material.entity.MaterialInfo;
18 import com.skua.modules.material.entity.MaterialInfoHandleRecord; 16 import com.skua.modules.material.entity.MaterialInfoHandleRecord;
19 import com.skua.modules.material.entity.MaterialInformation;
20 import com.skua.modules.material.service.IMaterialInfoHandleRecordService; 17 import com.skua.modules.material.service.IMaterialInfoHandleRecordService;
21 import com.skua.modules.material.service.IMaterialInfoService; 18 import com.skua.modules.material.service.IMaterialInfoService;
22 import com.skua.modules.material.vo.MaterialInfoStatisticsVO; 19 import com.skua.modules.material.vo.MaterialInfoStatisticsVO;
...@@ -39,13 +36,10 @@ import org.springframework.web.bind.annotation.*; ...@@ -39,13 +36,10 @@ import org.springframework.web.bind.annotation.*;
39 import org.springframework.web.multipart.MultipartFile; 36 import org.springframework.web.multipart.MultipartFile;
40 import org.springframework.web.multipart.MultipartHttpServletRequest; 37 import org.springframework.web.multipart.MultipartHttpServletRequest;
41 import org.springframework.web.servlet.ModelAndView; 38 import org.springframework.web.servlet.ModelAndView;
42
43 import javax.annotation.Resource; 39 import javax.annotation.Resource;
44 import javax.servlet.http.HttpServletRequest; 40 import javax.servlet.http.HttpServletRequest;
45 import javax.servlet.http.HttpServletResponse; 41 import javax.servlet.http.HttpServletResponse;
46 import java.io.IOException; 42 import java.io.IOException;
47 import java.io.UnsupportedEncodingException;
48 import java.net.URLDecoder;
49 import java.util.*; 43 import java.util.*;
50 44
51 /** 45 /**
...@@ -66,6 +60,8 @@ public class MaterialInfoController { ...@@ -66,6 +60,8 @@ public class MaterialInfoController {
66 private IMaterialInfoHandleRecordService materialInfoHandleRecordService; 60 private IMaterialInfoHandleRecordService materialInfoHandleRecordService;
67 @Resource 61 @Resource
68 private ISysDepartService departService; 62 private ISysDepartService departService;
63 @Autowired
64 private ICommonSqlService commonSqlService;
69 65
70 /** 66 /**
71 * 分页列表查询 67 * 分页列表查询
...@@ -106,6 +102,8 @@ public class MaterialInfoController { ...@@ -106,6 +102,8 @@ public class MaterialInfoController {
106 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, 102 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
107 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, 103 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
108 HttpServletRequest req) { 104 HttpServletRequest req) {
105
106
109 Result<IPage<MaterialInfo>> result = new Result<IPage<MaterialInfo>>(); 107 Result<IPage<MaterialInfo>> result = new Result<IPage<MaterialInfo>>();
110 Page<MaterialInfo> page = new Page<MaterialInfo>(pageNo, pageSize); 108 Page<MaterialInfo> page = new Page<MaterialInfo>(pageNo, pageSize);
111 QueryWrapper<MaterialInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap()); 109 QueryWrapper<MaterialInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
...@@ -117,6 +115,33 @@ public class MaterialInfoController { ...@@ -117,6 +115,33 @@ public class MaterialInfoController {
117 return result; 115 return result;
118 } 116 }
119 117
118 @AutoLog(value = "厂区资料管理-上级制度")
119 @ApiOperation(value = "厂区资料管理-上级制度", notes = "厂区资料管理-上级制度")
120 @GetMapping(value = "/superiorList")
121 public Result<IPage<MaterialInfo>> querySuperiorList(MaterialInfo materialInfo,
122 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
123 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
124 HttpServletRequest req) {
125 Result<IPage<MaterialInfo>> result = new Result<IPage<MaterialInfo>>();
126 Page<MaterialInfo> page = new Page<MaterialInfo>(pageNo, pageSize);
127 QueryWrapper<MaterialInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
128
129 String sql = "SELECT CONCAT(a.parent_id ,',' ,b.parent_id) FROM sys_depart a";
130 sql += "LEFT JOIN sys_depart b ON a.parent_id = b.id WHERE a.id = '"+BaseContextHandler.getRealDepartId()+"'";
131 String departIds = commonSqlService.queryForString( sql );
132 departIds = JSUtils.quoteEach(departIds,",");
133 if(StringUtils.isNotEmpty(departIds)){
134 queryWrapper.in("depart_id", departIds);
135 }
136 // QueryWrapper<MaterialInfo> queryWrapper = getMaterialInfoQueryWrapper(materialInfo);
137 queryWrapper.orderByDesc("create_time");
138 IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
139 result.setSuccess(true);
140 result.setResult(pageList);
141 return result;
142 }
143
144
120 @AutoLog(value = "厂区资料管理-待审核列表") 145 @AutoLog(value = "厂区资料管理-待审核列表")
121 @ApiOperation(value = "厂区资料管理-待审核列表", notes = "厂区资料管理-待审核列表") 146 @ApiOperation(value = "厂区资料管理-待审核列表", notes = "厂区资料管理-待审核列表")
122 @GetMapping(value = "/unAuditList") 147 @GetMapping(value = "/unAuditList")
......
...@@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 import com.skua.core.api.vo.Result; 5 import com.skua.core.api.vo.Result;
6 import com.skua.core.aspect.annotation.AutoLog; 6 import com.skua.core.aspect.annotation.AutoLog;
7 import com.skua.core.context.BaseContextHandler;
7 import com.skua.modules.equipment.dto.ReportStatisticsDTO; 8 import com.skua.modules.equipment.dto.ReportStatisticsDTO;
8 import com.skua.modules.equipment.service.IProductionEquipmentService; 9 import com.skua.modules.equipment.service.IProductionEquipmentService;
9 import com.skua.modules.equipment.vo.*; 10 import com.skua.modules.equipment.vo.*;
11 import com.skua.modules.system.service.ISysDepartService;
12 import com.skua.tool.util.JSUtils;
10 import io.swagger.annotations.Api; 13 import io.swagger.annotations.Api;
11 import io.swagger.annotations.ApiOperation; 14 import io.swagger.annotations.ApiOperation;
12 import lombok.extern.slf4j.Slf4j; 15 import lombok.extern.slf4j.Slf4j;
16 import org.apache.commons.lang3.StringUtils;
13 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.web.bind.annotation.GetMapping; 18 import org.springframework.web.bind.annotation.GetMapping;
15 import org.springframework.web.bind.annotation.RequestMapping; 19 import org.springframework.web.bind.annotation.RequestMapping;
...@@ -26,12 +30,15 @@ import java.util.Map; ...@@ -26,12 +30,15 @@ import java.util.Map;
26 public class EquipmentCenterController { 30 public class EquipmentCenterController {
27 @Autowired 31 @Autowired
28 private IProductionEquipmentService iProductionEquipmentService; 32 private IProductionEquipmentService iProductionEquipmentService;
33 @Autowired
34 private ISysDepartService departService;
29 35
30 @AutoLog(value = "设备中心-顶部总览") 36 @AutoLog(value = "设备中心-顶部总览")
31 @ApiOperation(value = "设备中心-顶部总览", notes = "设备中心-顶部总览") 37 @ApiOperation(value = "设备中心-顶部总览", notes = "设备中心-顶部总览")
32 @GetMapping(value = "/topOverview") 38 @GetMapping(value = "/topOverview")
33 public Result<ProductionEquipmentVO> topOverview(ReportStatisticsDTO reportStatisticsDTO) { 39 public Result<ProductionEquipmentVO> topOverview(ReportStatisticsDTO reportStatisticsDTO) {
34 Result<ProductionEquipmentVO> result = new Result<ProductionEquipmentVO>(); 40 Result<ProductionEquipmentVO> result = new Result<ProductionEquipmentVO>();
41 setDepartIds(reportStatisticsDTO);
35 ProductionEquipmentVO productionEquipmentVO = iProductionEquipmentService.getProductionEquipmentVO(reportStatisticsDTO); 42 ProductionEquipmentVO productionEquipmentVO = iProductionEquipmentService.getProductionEquipmentVO(reportStatisticsDTO);
36 result.setResult(productionEquipmentVO); 43 result.setResult(productionEquipmentVO);
37 return result; 44 return result;
...@@ -42,6 +49,7 @@ public class EquipmentCenterController { ...@@ -42,6 +49,7 @@ public class EquipmentCenterController {
42 @GetMapping(value = "/equipmentStatistics") 49 @GetMapping(value = "/equipmentStatistics")
43 public Result<FaultStatisticsVO> equipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) { 50 public Result<FaultStatisticsVO> equipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) {
44 Result<FaultStatisticsVO> result = new Result<>(); 51 Result<FaultStatisticsVO> result = new Result<>();
52 setDepartIds(reportStatisticsDTO);
45 FaultStatisticsVO equipmentStatistics = iProductionEquipmentService.getEquipmentStatistics(reportStatisticsDTO); 53 FaultStatisticsVO equipmentStatistics = iProductionEquipmentService.getEquipmentStatistics(reportStatisticsDTO);
46 result.setResult(equipmentStatistics); 54 result.setResult(equipmentStatistics);
47 result.setSuccess(true); 55 result.setSuccess(true);
...@@ -56,17 +64,34 @@ public class EquipmentCenterController { ...@@ -56,17 +64,34 @@ public class EquipmentCenterController {
56 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { 64 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
57 Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>(); 65 Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>();
58 Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize); 66 Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize);
67 setDepartIds(reportStatisticsDTO);
59 pageList = iProductionEquipmentService.getEquipmentStatisticsDetails(pageList, reportStatisticsDTO); 68 pageList = iProductionEquipmentService.getEquipmentStatisticsDetails(pageList, reportStatisticsDTO);
60 result.setSuccess(true); 69 result.setSuccess(true);
61 result.setResult(pageList); 70 result.setResult(pageList);
62 return result; 71 return result;
63 } 72 }
64 73
74 @AutoLog(value = "设备中心-设备统计详情(新)")
75 @ApiOperation(value = "设备中心-设备统计详情(新)", notes = "设备中心-设备统计详情(新)")
76 @GetMapping(value = "/equipmentStatisticsDetailsNew")
77 public Result<IPage<EquipmentStatisticsCountVO>> equipmentStatisticsDetailsNew(ReportStatisticsDTO reportStatisticsDTO,
78 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
79 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
80 Result<IPage<EquipmentStatisticsCountVO>> result = new Result<IPage<EquipmentStatisticsCountVO>>();
81 Page<EquipmentStatisticsCountVO> page = new Page<EquipmentStatisticsCountVO>(pageNo, pageSize);
82 setDepartIds(reportStatisticsDTO);//设置departIds
83 IPage<EquipmentStatisticsCountVO> pageList =iProductionEquipmentService.getEquipmentStatisticsDetailsNew(page, reportStatisticsDTO);
84 result.setSuccess(true);
85 result.setResult(pageList);
86 return result;
87 }
88
65 @AutoLog(value = "设备中心-设备状态") 89 @AutoLog(value = "设备中心-设备状态")
66 @ApiOperation(value = "设备中心-设备状态", notes = "设备中心-设备状态") 90 @ApiOperation(value = "设备中心-设备状态", notes = "设备中心-设备状态")
67 @GetMapping(value = "/equipmentState") 91 @GetMapping(value = "/equipmentState")
68 public Result<List<TOPTenVO>> equipmentState(ReportStatisticsDTO reportStatisticsDTO) { 92 public Result<List<TOPTenVO>> equipmentState(ReportStatisticsDTO reportStatisticsDTO) {
69 Result<List<TOPTenVO>> result = new Result<>(); 93 Result<List<TOPTenVO>> result = new Result<>();
94 setDepartIds(reportStatisticsDTO);
70 List<TOPTenVO> equipmentState = iProductionEquipmentService.getEquipmentState(reportStatisticsDTO); 95 List<TOPTenVO> equipmentState = iProductionEquipmentService.getEquipmentState(reportStatisticsDTO);
71 result.setSuccess(true); 96 result.setSuccess(true);
72 result.setResult(equipmentState); 97 result.setResult(equipmentState);
...@@ -81,6 +106,7 @@ public class EquipmentCenterController { ...@@ -81,6 +106,7 @@ public class EquipmentCenterController {
81 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { 106 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
82 Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>(); 107 Result<IPage<EquipmentNewMaintenancePlanVO>> result = new Result<IPage<EquipmentNewMaintenancePlanVO>>();
83 Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize); 108 Page<EquipmentNewMaintenancePlanVO> pageList = new Page<EquipmentNewMaintenancePlanVO>(pageNo, pageSize);
109 setDepartIds(reportStatisticsDTO);
84 pageList = iProductionEquipmentService.getEquipmentStateDetails(pageList, reportStatisticsDTO); 110 pageList = iProductionEquipmentService.getEquipmentStateDetails(pageList, reportStatisticsDTO);
85 result.setSuccess(true); 111 result.setSuccess(true);
86 result.setResult(pageList); 112 result.setResult(pageList);
...@@ -92,6 +118,7 @@ public class EquipmentCenterController { ...@@ -92,6 +118,7 @@ public class EquipmentCenterController {
92 @GetMapping(value = "/equipmentIntactRate") 118 @GetMapping(value = "/equipmentIntactRate")
93 public Result<List<ContrastVO>> equipmentIntactRate(ReportStatisticsDTO reportStatisticsDTO) { 119 public Result<List<ContrastVO>> equipmentIntactRate(ReportStatisticsDTO reportStatisticsDTO) {
94 Result<List<ContrastVO>> result = new Result<List<ContrastVO>>(); 120 Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
121 setDepartIds(reportStatisticsDTO);
95 List<ContrastVO> equipmentIntactRate = iProductionEquipmentService.getEquipmentIntactRate(reportStatisticsDTO); 122 List<ContrastVO> equipmentIntactRate = iProductionEquipmentService.getEquipmentIntactRate(reportStatisticsDTO);
96 result.setSuccess(true); 123 result.setSuccess(true);
97 result.setResult(equipmentIntactRate); 124 result.setResult(equipmentIntactRate);
...@@ -103,17 +130,30 @@ public class EquipmentCenterController { ...@@ -103,17 +130,30 @@ public class EquipmentCenterController {
103 @GetMapping(value = "/equipmentIntactRateDetails") 130 @GetMapping(value = "/equipmentIntactRateDetails")
104 public Result<List<Map>> equipmentIntactRateDetails(ReportStatisticsDTO reportStatisticsDTO) { 131 public Result<List<Map>> equipmentIntactRateDetails(ReportStatisticsDTO reportStatisticsDTO) {
105 Result<List<Map>> result = new Result<List<Map>>(); 132 Result<List<Map>> result = new Result<List<Map>>();
133 setDepartIds(reportStatisticsDTO);
106 List<Map> equipmentIntactRateDetails = iProductionEquipmentService.getEquipmentIntactRateDetails(reportStatisticsDTO); 134 List<Map> equipmentIntactRateDetails = iProductionEquipmentService.getEquipmentIntactRateDetails(reportStatisticsDTO);
107 result.setResult(equipmentIntactRateDetails); 135 result.setResult(equipmentIntactRateDetails);
108 result.setSuccess(true); 136 result.setSuccess(true);
109 return result; 137 return result;
110 } 138 }
111 139
140 @AutoLog(value = "设备中心-设备完好率详情(新)")
141 @ApiOperation(value = "设备中心-设备完好率详情(新)", notes = "设备中心-设备完好率详情(新)")
142 @GetMapping(value = "/equipmentIntactRateDetailsNew")
143 public Result<List<Map>> equipmentIntactRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO) {
144 Result<List<Map>> result = new Result<List<Map>>();
145 setDepartIds(reportStatisticsDTO);
146 List<Map> equipmentIntactRateDetails = iProductionEquipmentService.getEquipmentIntactRateDetailsNew(reportStatisticsDTO);
147 result.setResult(equipmentIntactRateDetails);
148 result.setSuccess(true);
149 return result;
150 }
112 @AutoLog(value = "设备中心-MTTR&MTBF") 151 @AutoLog(value = "设备中心-MTTR&MTBF")
113 @ApiOperation(value = "设备中心-MTTR&MTBF", notes = "设备中心-MTTR&MTBF") 152 @ApiOperation(value = "设备中心-MTTR&MTBF", notes = "设备中心-MTTR&MTBF")
114 @GetMapping(value = "/equipmentMF") 153 @GetMapping(value = "/equipmentMF")
115 public Result<List<ContrastVO>> equipmentMF(ReportStatisticsDTO reportStatisticsDTO) { 154 public Result<List<ContrastVO>> equipmentMF(ReportStatisticsDTO reportStatisticsDTO) {
116 Result<List<ContrastVO>> result = new Result<List<ContrastVO>>(); 155 Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
156 setDepartIds(reportStatisticsDTO);
117 List<ContrastVO> equipmentMF = iProductionEquipmentService.getEquipmentMF(reportStatisticsDTO); 157 List<ContrastVO> equipmentMF = iProductionEquipmentService.getEquipmentMF(reportStatisticsDTO);
118 result.setResult(equipmentMF); 158 result.setResult(equipmentMF);
119 result.setSuccess(true); 159 result.setSuccess(true);
...@@ -125,6 +165,7 @@ public class EquipmentCenterController { ...@@ -125,6 +165,7 @@ public class EquipmentCenterController {
125 @GetMapping(value = "/equipmentMFDetails") 165 @GetMapping(value = "/equipmentMFDetails")
126 public Result<List<Map>> equipmentMFDetails(ReportStatisticsDTO reportStatisticsDTO) { 166 public Result<List<Map>> equipmentMFDetails(ReportStatisticsDTO reportStatisticsDTO) {
127 Result<List<Map>> result = new Result<List<Map>>(); 167 Result<List<Map>> result = new Result<List<Map>>();
168 setDepartIds(reportStatisticsDTO);
128 List<Map> equipmentMFDetails = iProductionEquipmentService.getEquipmentMFDetails(reportStatisticsDTO); 169 List<Map> equipmentMFDetails = iProductionEquipmentService.getEquipmentMFDetails(reportStatisticsDTO);
129 result.setResult(equipmentMFDetails); 170 result.setResult(equipmentMFDetails);
130 result.setSuccess(true); 171 result.setSuccess(true);
...@@ -136,6 +177,7 @@ public class EquipmentCenterController { ...@@ -136,6 +177,7 @@ public class EquipmentCenterController {
136 @GetMapping(value = "/maintainCompleteRate") 177 @GetMapping(value = "/maintainCompleteRate")
137 public Result<List<ContrastVO>> maintainCompleteRate(ReportStatisticsDTO reportStatisticsDTO) { 178 public Result<List<ContrastVO>> maintainCompleteRate(ReportStatisticsDTO reportStatisticsDTO) {
138 Result<List<ContrastVO>> result = new Result<List<ContrastVO>>(); 179 Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
180 setDepartIds(reportStatisticsDTO);
139 List<ContrastVO> maintainCompleteRate = iProductionEquipmentService.getMaintainCompleteRate(reportStatisticsDTO); 181 List<ContrastVO> maintainCompleteRate = iProductionEquipmentService.getMaintainCompleteRate(reportStatisticsDTO);
140 result.setResult(maintainCompleteRate); 182 result.setResult(maintainCompleteRate);
141 result.setSuccess(true); 183 result.setSuccess(true);
...@@ -147,6 +189,7 @@ public class EquipmentCenterController { ...@@ -147,6 +189,7 @@ public class EquipmentCenterController {
147 @GetMapping(value = "/maintainCompleteRateDetails") 189 @GetMapping(value = "/maintainCompleteRateDetails")
148 public Result<List<Map>> maintainCompleteRateDetails(ReportStatisticsDTO reportStatisticsDTO) { 190 public Result<List<Map>> maintainCompleteRateDetails(ReportStatisticsDTO reportStatisticsDTO) {
149 Result<List<Map>> result = new Result<>(); 191 Result<List<Map>> result = new Result<>();
192 setDepartIds(reportStatisticsDTO);
150 List<Map> maintainCompleteRateDetails = iProductionEquipmentService.getMaintainCompleteRateDetails(reportStatisticsDTO); 193 List<Map> maintainCompleteRateDetails = iProductionEquipmentService.getMaintainCompleteRateDetails(reportStatisticsDTO);
151 result.setResult(maintainCompleteRateDetails); 194 result.setResult(maintainCompleteRateDetails);
152 result.setSuccess(true); 195 result.setSuccess(true);
...@@ -158,6 +201,7 @@ public class EquipmentCenterController { ...@@ -158,6 +201,7 @@ public class EquipmentCenterController {
158 @GetMapping(value = "/maintainRepairCost") 201 @GetMapping(value = "/maintainRepairCost")
159 public Result<List<ContrastVO>> maintainRepairCost(ReportStatisticsDTO reportStatisticsDTO) { 202 public Result<List<ContrastVO>> maintainRepairCost(ReportStatisticsDTO reportStatisticsDTO) {
160 Result<List<ContrastVO>> result = new Result<List<ContrastVO>>(); 203 Result<List<ContrastVO>> result = new Result<List<ContrastVO>>();
204 setDepartIds(reportStatisticsDTO);
161 List<ContrastVO> maintainCompleteRate = iProductionEquipmentService.getContrastCost(reportStatisticsDTO); 205 List<ContrastVO> maintainCompleteRate = iProductionEquipmentService.getContrastCost(reportStatisticsDTO);
162 result.setResult(maintainCompleteRate); 206 result.setResult(maintainCompleteRate);
163 result.setSuccess(true); 207 result.setSuccess(true);
...@@ -169,9 +213,24 @@ public class EquipmentCenterController { ...@@ -169,9 +213,24 @@ public class EquipmentCenterController {
169 @GetMapping(value = "/maintainRepairCostDetails") 213 @GetMapping(value = "/maintainRepairCostDetails")
170 public Result<List<Map>> maintainRepairCostDetails(ReportStatisticsDTO reportStatisticsDTO) { 214 public Result<List<Map>> maintainRepairCostDetails(ReportStatisticsDTO reportStatisticsDTO) {
171 Result<List<Map>> result = new Result<>(); 215 Result<List<Map>> result = new Result<>();
216 setDepartIds(reportStatisticsDTO);
172 List<Map> contrastCostDetails = iProductionEquipmentService.getContrastCostDetails(reportStatisticsDTO); 217 List<Map> contrastCostDetails = iProductionEquipmentService.getContrastCostDetails(reportStatisticsDTO);
173 result.setResult(contrastCostDetails); 218 result.setResult(contrastCostDetails);
174 result.setSuccess(true); 219 result.setSuccess(true);
175 return result; 220 return result;
176 } 221 }
222
223 /***
224 * 设置查询条件的departIds属性
225 * @param reportStatisticsDTO
226 */
227 private void setDepartIds(ReportStatisticsDTO reportStatisticsDTO){
228 String departIds = null;
229 if (StringUtils.isNotEmpty(reportStatisticsDTO.getFactoryId())) {
230 departIds = departService.getChildDepartId(reportStatisticsDTO.getFactoryId());
231 }else{
232 departIds = BaseContextHandler.getDeparts();
233 }
234 reportStatisticsDTO.setDepartIds(JSUtils.quoteEach(departIds,","));
235 }
177 } 236 }
......
1 package com.skua.modules.equipment.dto; 1 package com.skua.modules.equipment.dto;
2 2
3 import com.skua.modules.equipment.vo.IndexVO; 3 import com.skua.modules.equipment.vo.IndexVO;
4 import com.skua.tool.util.DateUtils;
4 import io.swagger.annotations.ApiModelProperty; 5 import io.swagger.annotations.ApiModelProperty;
5 import lombok.Data; 6 import lombok.Data;
7 import org.apache.commons.lang3.StringUtils;
6 8
7 import java.util.List; 9 import java.util.List;
8 10
...@@ -46,7 +48,22 @@ public class ReportStatisticsDTO { ...@@ -46,7 +48,22 @@ public class ReportStatisticsDTO {
46 List<IndexVO> outOfGinseng; 48 List<IndexVO> outOfGinseng;
47 @ApiModelProperty(value = "时间") 49 @ApiModelProperty(value = "时间")
48 private String time; 50 private String time;
51
52 @ApiModelProperty(value = "部门集合")
53 private String departIds;
49 @ApiModelProperty(value = "1总公司2分公司3厂站") 54 @ApiModelProperty(value = "1总公司2分公司3厂站")
50 private Integer isCompany; 55 private Integer isCompany;
51 56
57
58 public String getTime() {
59 if(StringUtils.isEmpty(time)){//判断time如果为空,获取starttime的年份数据,否则获取当前年
60 if( StringUtils.isNotEmpty(startTime) ){
61 time = DateUtils.getDateYear(startTime)+"";
62 }else{
63 time = DateUtils.getCurrentYear()+"";
64 }
65
66 }
67 return time;
68 }
52 } 69 }
......
1 package com.skua.modules.equipment.mapper; 1 package com.skua.modules.equipment.mapper;
2 2
3 import com.baomidou.mybatisplus.core.metadata.IPage;
4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
3 import com.skua.modules.equipment.dto.ReportStatisticsDTO; 5 import com.skua.modules.equipment.dto.ReportStatisticsDTO;
4 import com.skua.modules.equipment.entity.SysUser; 6 import com.skua.modules.equipment.entity.SysUser;
7 import com.skua.modules.equipment.pojo.Equipment;
5 import com.skua.modules.equipment.vo.EquipmentNewMaintenancePlanVO; 8 import com.skua.modules.equipment.vo.EquipmentNewMaintenancePlanVO;
9 import com.skua.modules.equipment.vo.EquipmentStatisticsCountVO;
6 import com.skua.modules.equipment.vo.ProportionStatisticsVO; 10 import com.skua.modules.equipment.vo.ProportionStatisticsVO;
7 import org.apache.ibatis.annotations.Mapper; 11 import org.apache.ibatis.annotations.Mapper;
8 import org.apache.ibatis.annotations.Param; 12 import org.apache.ibatis.annotations.Param;
...@@ -34,7 +38,8 @@ public interface ProductionEquipmentMapper { ...@@ -34,7 +38,8 @@ public interface ProductionEquipmentMapper {
34 38
35 //获取维修费用 39 //获取维修费用
36 Double getRepairCost(@Param("startTime") String startTime, @Param("endTime") String endTime); 40 Double getRepairCost(@Param("startTime") String startTime, @Param("endTime") String endTime);
37 41 //获取维修费用 2024-1227 获取维修费用:来源维修表
42 // Double getRepairNewCost( @Param("departIds") String departIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
38 //获取维护任务数量 status 1:已完成 0:未完成 43 //获取维护任务数量 status 1:已完成 0:未完成
39 Integer getTaskNum(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("status") Integer status); 44 Integer getTaskNum(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("status") Integer status);
40 45
...@@ -56,6 +61,8 @@ public interface ProductionEquipmentMapper { ...@@ -56,6 +61,8 @@ public interface ProductionEquipmentMapper {
56 61
57 //厂获取生产设备总台数详情 62 //厂获取生产设备总台数详情
58 List<EquipmentNewMaintenancePlanVO> getEquipmentStatisticsDetailsFactory(ReportStatisticsDTO reportStatisticsDTO); 63 List<EquipmentNewMaintenancePlanVO> getEquipmentStatisticsDetailsFactory(ReportStatisticsDTO reportStatisticsDTO);
64 //厂获取生产设备总台数详情(新)
65 IPage<EquipmentStatisticsCountVO> getEquipmentStatisticsDetailsNew(Page<EquipmentStatisticsCountVO> page, @Param("param") ReportStatisticsDTO reportStatisticsDTO);
59 66
60 //总公司获取等级分类 67 //总公司获取等级分类
61 List<Map> getLevelByHeadquarters(ReportStatisticsDTO reportStatisticsDTO); 68 List<Map> getLevelByHeadquarters(ReportStatisticsDTO reportStatisticsDTO);
...@@ -141,10 +148,10 @@ public interface ProductionEquipmentMapper { ...@@ -141,10 +148,10 @@ public interface ProductionEquipmentMapper {
141 List<Map> getOneYearCompleteYearOnYearRate(); 148 List<Map> getOneYearCompleteYearOnYearRate();
142 149
143 //半年维修维护费用对比 150 //半年维修维护费用对比
144 List<Map> getHalfIntactContrastCost(); 151 List<Map> getHalfIntactContrastCost(@Param("departIds") String departIds);
145 152
146 //一年维修维护费用对比 153 //一年维修维护费用对比
147 List<Map> getOneYearContrastCost(); 154 List<Map> getOneYearContrastCost(@Param("departIds") String departIds);
148 155
149 //总公司获取停机时间 156 //总公司获取停机时间
150 List<Map> getDownTimeByMonthHeadquarters(ReportStatisticsDTO reportStatisticsDTO); 157 List<Map> getDownTimeByMonthHeadquarters(ReportStatisticsDTO reportStatisticsDTO);
...@@ -180,4 +187,8 @@ public interface ProductionEquipmentMapper { ...@@ -180,4 +187,8 @@ public interface ProductionEquipmentMapper {
180 List<Map>getRepairCostByHeadquarters(ReportStatisticsDTO reportStatisticsDTO); 187 List<Map>getRepairCostByHeadquarters(ReportStatisticsDTO reportStatisticsDTO);
181 List<Map>getRepairCostByBranchOffice(ReportStatisticsDTO reportStatisticsDTO); 188 List<Map>getRepairCostByBranchOffice(ReportStatisticsDTO reportStatisticsDTO);
182 List<Map>getRepairCostByFactory(ReportStatisticsDTO reportStatisticsDTO); 189 List<Map>getRepairCostByFactory(ReportStatisticsDTO reportStatisticsDTO);
190 //设备中心-维护维修费用详情
191 List<Map> getContrastCostDetails(ReportStatisticsDTO reportStatisticsDTO);
192 //设备完好率详情(新)
193 List<Map> getEquipmentIntactRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO);
183 } 194 }
......
...@@ -107,39 +107,60 @@ ...@@ -107,39 +107,60 @@
107 and #{endTime} 107 and #{endTime}
108 </if> 108 </if>
109 </select> 109 </select>
110
111 <select id="getEquipmentStatisticsDetailsNew" resultType="com.skua.modules.equipment.vo.EquipmentStatisticsCountVO">
112 select d.depart_name , d.id 'depart_id',
113 ifnull(ccc.category_value1 , 0 ) category_value1,
114 ifnull(ccc.category_value2 , 0 ) category_value2,
115 ifnull(ccc.category_value3 , 0 ) category_value3
116 from sys_depart d
117 left join (
118 select bbb.depart_id,
119 ifnull((CASE WHEN equipment_level = '2421538a0286b491ffb863db92fe6cbf' THEN bbb.hour END),0) 'category_value1',
120 ifnull((CASE WHEN equipment_level = '6bf727eb7e7cca6a95c694dab0036b2c' THEN bbb.hour END),0) 'category_value2',
121 ifnull((CASE WHEN equipment_level = 'a64bfc58110d2c105a6026e8bd02c232' THEN bbb.hour END),0) 'category_value3'
122
123 from (
124 select ei.depart_id , ei.equipment_level , ifnull(COUNT( ei.id ),0) AS'hour' from equipment_info ei
125 where 1=1
126 <if test="param.startTime != null ">
127 and ei.create_time &gt;= #{param.startTime}
128 </if>
129 <if test="param.endTime != null ">
130 and ei.create_time &lt;= #{param.endTime}
131 </if>
132 <if test="param.departIds != null ">
133 and ei.depart_id in(${param.departIds})
134 </if>
135 group by ei.depart_id , ei.equipment_level
136 )bbb group by bbb.depart_id
137 )ccc on ccc.depart_id = d.id
138 where d.depart_type = 1
139 <if test="param.departIds != null ">
140 and d.id in (${param.departIds})
141 </if>
142 order by ccc.category_value1 desc
143 </select>
144
145
146
110 <select id="getLevelByTime" resultType="com.skua.modules.equipment.vo.ProportionStatisticsVO" 147 <select id="getLevelByTime" resultType="com.skua.modules.equipment.vo.ProportionStatisticsVO"
111 parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO"> 148 parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO">
112 SELECT 149 select aaa.item_text as category, ifnull(COUNT( ei.id ),0) AS'hour' from equipment_info ei
113 t1.des as category, 150 left join (
114 t1.equipmentNum as hour, 151 select t.item_value , t.item_text from sys_dict_item t where t.dict_id in (select id from sys_dict where dict_code = 'equipment-equipment_level')
115 CONCAT( ROUND( IFNULL( t1.equipmentNum, 0 ) / t2.equipmentTotal, 3 )* 100, '%' ) AS proportion 152 ) aaa on aaa.item_value = ei.equipment_level
116 FROM 153 where 1=1
117 ( 154 <if test="startTime != null ">
118 SELECT 155 and ei.create_time &gt;= #{startTime}
119 sdi.item_text AS des,
120 COUNT( ei.id ) AS equipmentNum
121 FROM
122 equipment_info ei
123 LEFT JOIN sys_dict_item sdi ON sdi.item_value = ei.equipment_level
124 WHERE
125 sdi.dict_id = '77c2f3bd6d16dec67f2ea11d84b6000e'
126 <if test="endTime !=null and endTime !=''">
127 AND ei.create_time &lt;= #{endTime}
128 </if> 156 </if>
129 GROUP BY 157 <if test="endTime != null ">
130 ei.equipment_level 158 and ei.create_time &lt;= #{endTime}
131 ) t1,(
132 SELECT
133 count( 1 ) AS equipmentTotal
134 FROM
135 equipment_info
136 WHERE
137 1=1
138
139 <if test="endTime !=null and endTime !=''">
140 AND create_time &lt;= #{endTime}
141 </if> 159 </if>
142 ) t2 160 <if test="departIds != null ">
161 and ei.depart_id in(${departIds})
162 </if>
163 group by ei.equipment_level
143 </select> 164 </select>
144 <select id="getTypeByTime" parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO" 165 <select id="getTypeByTime" parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO"
145 resultType="com.skua.modules.equipment.vo.ProportionStatisticsVO"> 166 resultType="com.skua.modules.equipment.vo.ProportionStatisticsVO">
...@@ -793,7 +814,7 @@ ...@@ -793,7 +814,7 @@
793 FROM 814 FROM
794 equipment_maintain_task emt LEFT JOIN equipment_task_cost etc ON etc.task_id=emt.id 815 equipment_maintain_task emt LEFT JOIN equipment_task_cost etc ON etc.task_id=emt.id
795 WHERE 816 WHERE
796 LEFT ( emt.maintain_time, 7 ) = t.MONTH AND emt.del_flag = 0 817 LEFT ( emt.maintain_time, 7 ) = t.MONTH AND emt.del_flag = 0 and emt.depart_id in(${departIds})
797 ) AS maintainCost, 818 ) AS maintainCost,
798 ( 819 (
799 SELECT 820 SELECT
...@@ -802,7 +823,7 @@ ...@@ -802,7 +823,7 @@
802 equipment_repair er 823 equipment_repair er
803 WHERE 824 WHERE
804 LEFT ( er.create_time, 7 ) = t.MONTH 825 LEFT ( er.create_time, 7 ) = t.MONTH
805 AND er.del_flag = 1 826 AND er.del_flag = 1 and er.depart_id in(${departIds})
806 ) AS repairCost 827 ) AS repairCost
807 FROM 828 FROM
808 ( 829 (
...@@ -824,7 +845,7 @@ ...@@ -824,7 +845,7 @@
824 FROM 845 FROM
825 equipment_maintain_task emt LEFT JOIN equipment_task_cost etc ON etc.task_id=emt.id 846 equipment_maintain_task emt LEFT JOIN equipment_task_cost etc ON etc.task_id=emt.id
826 WHERE 847 WHERE
827 LEFT ( emt.maintain_time, 7 ) = t.MONTH AND emt.del_flag = 0 848 LEFT ( emt.maintain_time, 7 ) = t.MONTH AND emt.del_flag = 0 and emt.depart_id in(${departIds})
828 ) AS maintainCost, 849 ) AS maintainCost,
829 ( 850 (
830 SELECT 851 SELECT
...@@ -833,7 +854,7 @@ ...@@ -833,7 +854,7 @@
833 equipment_repair er 854 equipment_repair er
834 WHERE 855 WHERE
835 LEFT ( er.create_time, 7 ) = t.MONTH 856 LEFT ( er.create_time, 7 ) = t.MONTH
836 AND er.del_flag = 1 857 AND er.del_flag = 1 and er.depart_id in(${departIds})
837 ) AS repairCost 858 ) AS repairCost
838 FROM 859 FROM
839 ( 860 (
...@@ -847,6 +868,45 @@ ...@@ -847,6 +868,45 @@
847 MONTH DESC 868 MONTH DESC
848 ) AS t 869 ) AS t
849 </select> 870 </select>
871 <!--维护维修费用详情 -->
872 <select id="getContrastCostDetails" resultType="java.util.Map">
873 select d.id depart_id , d.depart_name ,ifnull(aaa.maintainCost,0) maintainCost,ifnull(bbb.repairCost,0) repairCost from sys_depart d
874 left join (
875 SELECT emt.depart_id , IFNULL(sum(etc.material_cost+etc.maintenance_cost+etc.labor_cost+etc.machinery_cost+etc.service_cost+etc.wastage_cost+etc.other_cost),0) maintainCost
876 FROM equipment_maintain_task emt LEFT JOIN equipment_task_cost etc ON etc.task_id=emt.id
877 WHERE emt.del_flag = 0 and emt.maintain_time &gt;= #{startTime} and emt.maintain_time &lt;= #{endTime}
878 group by emt.depart_id
879 ) aaa on aaa.depart_id = d.id
880 left join (
881 SELECT er.depart_id, IFNULL(SUM(er.total_cost),0) repairCost
882 FROM equipment_repair er
883 WHERE er.del_flag = 1 and er.create_time &gt;= #{startTime} and er.create_time &lt;= #{endTime}
884 group by er.depart_id
885 )bbb on bbb.depart_id = d.id
886 where d.depart_type = 1
887 and d.id in (${departIds})
888 </select>
889
890 <!-- 设备完好率详情(新)-->
891 <select id="getEquipmentIntactRateDetailsNew" resultType="java.util.Map">
892 select d.id depart_id , d.depart_name ,round(ifnull(aaa.intact,0),2) 'intact', round(ifnull(bbb.percentage,0),2) 'percentage' from sys_depart d
893 left join (
894 SELECT er.depart_id ,ifnull(( COUNT(id)*30 - IFNULL( SUM( UNIX_TIMESTAMP( reality_maintenance_end_time )- UNIX_TIMESTAMP( repair_date ) )/ 60 / 60 / 24, 0 ) ) *100/ (COUNT(id)*30) , 0) 'intact'
895 FROM equipment_repair er
896 WHERE er.del_flag = 1 and er.create_time &gt;= #{startTime} and er.create_time &lt;= #{endTime}
897 group by er.depart_id
898 ) aaa on aaa.depart_id = d.id
899 left join (
900 SELECT er.depart_id , ifnull(( COUNT(id)*30 - IFNULL( SUM( UNIX_TIMESTAMP( reality_maintenance_end_time )- UNIX_TIMESTAMP( repair_date ) )/ 60 / 60 / 24, 0 ) ) *100/ (COUNT(id)*30) , 0) 'percentage'
901 FROM equipment_repair er
902 WHERE er.del_flag = 1 and er.create_time &gt;= #{startTime} and er.create_time &lt;= #{endTime}
903 group by er.depart_id
904 )bbb on bbb.depart_id = d.id
905 where d.depart_type = 1 and d.id in (${departIds})
906 order by aaa.intact desc
907 </select>
908
909
850 <select id="getDownTimeByMonthHeadquarters" resultType="java.util.Map" 910 <select id="getDownTimeByMonthHeadquarters" resultType="java.util.Map"
851 parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO"> 911 parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO">
852 SELECT sd1.depart_name AS departName,sd1.id as departId, 912 SELECT sd1.depart_name AS departName,sd1.id as departId,
...@@ -1117,6 +1177,8 @@ ...@@ -1117,6 +1177,8 @@
1117 GROUP BY 1177 GROUP BY
1118 sd1.id 1178 sd1.id
1119 </select> 1179 </select>
1180
1181
1120 <select id="getMaintainCostByHeadquarters" parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO" 1182 <select id="getMaintainCostByHeadquarters" parameterType="com.skua.modules.equipment.dto.ReportStatisticsDTO"
1121 resultType="java.util.Map"> 1183 resultType="java.util.Map">
1122 SELECT 1184 SELECT
......
1 package com.skua.modules.equipment.service; 1 package com.skua.modules.equipment.service;
2 2
3 import com.baomidou.mybatisplus.core.metadata.IPage;
3 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4 import com.skua.modules.equipment.dto.ReportStatisticsDTO; 5 import com.skua.modules.equipment.dto.ReportStatisticsDTO;
5 import com.skua.modules.equipment.vo.*; 6 import com.skua.modules.equipment.vo.*;
...@@ -19,6 +20,7 @@ import java.util.Map; ...@@ -19,6 +20,7 @@ import java.util.Map;
19 *</pre> 20 *</pre>
20 ***************************/ 21 ***************************/
21 public interface IProductionEquipmentService { 22 public interface IProductionEquipmentService {
23 //设备中心-顶部总览
22 ProductionEquipmentVO getProductionEquipmentVO(ReportStatisticsDTO reportStatisticsDTO); 24 ProductionEquipmentVO getProductionEquipmentVO(ReportStatisticsDTO reportStatisticsDTO);
23 25
24 //设备统计 26 //设备统计
...@@ -27,6 +29,9 @@ public interface IProductionEquipmentService { ...@@ -27,6 +29,9 @@ public interface IProductionEquipmentService {
27 //设备统计详情 29 //设备统计详情
28 Page<EquipmentNewMaintenancePlanVO> getEquipmentStatisticsDetails(Page<EquipmentNewMaintenancePlanVO> pageList, ReportStatisticsDTO reportStatisticsDTO); 30 Page<EquipmentNewMaintenancePlanVO> getEquipmentStatisticsDetails(Page<EquipmentNewMaintenancePlanVO> pageList, ReportStatisticsDTO reportStatisticsDTO);
29 31
32 //设备统计详情(new)
33 IPage<EquipmentStatisticsCountVO> getEquipmentStatisticsDetailsNew(Page<EquipmentStatisticsCountVO> pageList, ReportStatisticsDTO reportStatisticsDTO);
34
30 //获取设备状态 35 //获取设备状态
31 List<TOPTenVO> getEquipmentState(ReportStatisticsDTO reportStatisticsDTO); 36 List<TOPTenVO> getEquipmentState(ReportStatisticsDTO reportStatisticsDTO);
32 37
...@@ -38,6 +43,8 @@ public interface IProductionEquipmentService { ...@@ -38,6 +43,8 @@ public interface IProductionEquipmentService {
38 43
39 //设备完好率详情 44 //设备完好率详情
40 List<Map> getEquipmentIntactRateDetails(ReportStatisticsDTO reportStatisticsDTO); 45 List<Map> getEquipmentIntactRateDetails(ReportStatisticsDTO reportStatisticsDTO);
46 List<Map> getEquipmentIntactRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO);
47
41 48
42 //MF 49 //MF
43 List<ContrastVO> getEquipmentMF(ReportStatisticsDTO reportStatisticsDTO); 50 List<ContrastVO> getEquipmentMF(ReportStatisticsDTO reportStatisticsDTO);
......
1 /*
2 package com.skua.modules.equipment.service.impl;
3
4 import cn.hutool.core.util.StrUtil;
5 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 import com.skua.core.context.BaseContextHandler;
7 import com.skua.core.util.DoubleOperaUtils;
8 import com.skua.modules.equipment.dto.ReportStatisticsDTO;
9 import com.skua.modules.equipment.mapper.ProductionEquipmentMapper;
10 import com.skua.modules.equipment.service.IProductionEquipmentService;
11 import com.skua.modules.equipment.vo.*;
12 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Service;
14 import org.springframework.transaction.annotation.Transactional;
15
16 import java.math.BigDecimal;
17 import java.text.DateFormat;
18 import java.text.SimpleDateFormat;
19 import java.util.*;
20
21 */
22 /***************************
23 *<pre>
24 * @Project Name : cdxr
25 * @Package : com.skua.modules.equipment.service.impl
26 * @File Name : ProductionEquipmentServiceImpl
27 * @Author : luowei
28 * @Date : 2022/12/5 15:24
29 * @Purpose :
30 * @History :
31 *</pre>
32 ***************************//*
33
34 @Service
35 @Transactional
36 public class BAK_ProductionEquipmentServiceImpl implements IProductionEquipmentService {
37 @Autowired
38 private ProductionEquipmentMapper productionEquipmentMapper;
39 private static final String MONTH_START = "-01 00:00:00";
40 private static final String MONTH_END = "-31 23:59:59";
41 private static final String YEAR_START = "-01-01 00:00:00";
42 private static final String YEAR_END = "-12-31 23:59:59";
43 private static final String C = "一般设备(C类)";
44 private static final String B = "主要设备(B类)";
45 private static final String A = "重点设备(A类)";
46
47 @Override
48 public ProductionEquipmentVO getProductionEquipmentVO(ReportStatisticsDTO reportStatisticsDTO) {
49 ProductionEquipmentVO productionEquipmentVO = new ProductionEquipmentVO();
50 Integer increase = 0;
51 Integer equipmentNum = 0;
52 double v = 1.00;
53 String repairNum = null;
54 Double goodDay = 0.00;
55 Double goodDayRing = 0.00;
56 Integer repairPlanNum = 0;
57 Integer repairCompleteNum = 0;
58 Double repairCompleteRate = 0.00;
59 Double repairCompleteRing = 0.00;
60 Double repairCost = 0.00;
61 Double maintainCost = 0.00;
62 Double totalCost = 0.00;
63 Double costRing = 0.00;
64
65 //ab总数
66 Integer ABEquipmentNum = 0;
67 if (reportStatisticsDTO.getTimeUnit() != null && reportStatisticsDTO.getTimeUnit() == 3) {
68 if (reportStatisticsDTO.getTime()==null){
69 reportStatisticsDTO.setTime(reportStatisticsDTO.getEndTime().substring(0,7));
70 }
71 //总数
72 equipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), null);
73 //ab总数
74 ABEquipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), "C");
75 //这个月新增
76 increase = productionEquipmentMapper.getEquipmentNum(reportStatisticsDTO.getStartTime(), reportStatisticsDTO.getEndTime(), null);
77 DateFormat format = new SimpleDateFormat("yyyy-MM");
78 String lastMonth = null;
79 Date parse = null;
80 try {
81 parse = format.parse(reportStatisticsDTO.getTime());
82 Calendar calendar = Calendar.getInstance();
83 calendar.setTime(parse);
84 calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1);
85 lastMonth = format.format(calendar.getTime());
86 } catch (Exception e) {
87 e.getMessage();
88 }
89 //设备完好率
90 //求总停机天数
91 Map downtime = productionEquipmentMapper.getDowntime(reportStatisticsDTO.getStartTime(), reportStatisticsDTO.getEndTime());
92 String downtime1 = "0.00";
93 if (null != downtime.get("downtime")) {
94 downtime1 = downtime.get("downtime").toString();
95 }
96 v = (increase * 30 - Double.parseDouble(downtime1)) / (increase * 30);
97 repairNum = downtime.get("repairNum").toString();
98 goodDay = 30 - Double.parseDouble(downtime1);
99 //上月的设备完好率
100 Map downtime2 = productionEquipmentMapper.getDowntime(lastMonth + MONTH_START, lastMonth + MONTH_END);
101 String downtime3 = "0.00";
102 if (null != downtime2.get("downtime")) {
103 downtime3 = downtime2.get("downtime").toString();
104 }
105 Integer increase1 = productionEquipmentMapper.getEquipmentNum(lastMonth + MONTH_START, lastMonth + MONTH_END, null);
106 Double v1 = 0.00;
107 if (increase1 > 0) {
108 v1 = (increase1 * 30 - Double.parseDouble(downtime3)) / (increase1 * 30);
109 }
110 if (v1 > 0) {
111 goodDayRing = (v - v1) / v1 * 100;
112 }
113 //维修计划完成率
114 //维护计划台数
115 repairPlanNum = productionEquipmentMapper.getTaskNum(reportStatisticsDTO.getTime() + MONTH_START, reportStatisticsDTO.getTime() + MONTH_END, null);
116 //维护完成台数
117 repairCompleteNum = productionEquipmentMapper.getTaskNum(reportStatisticsDTO.getTime() + MONTH_START, reportStatisticsDTO.getTime() + MONTH_END, 1);
118 repairCompleteRate = (double) repairCompleteNum / repairPlanNum * 100;
119 //环比
120 Integer repairNum1 = productionEquipmentMapper.getTaskNum(lastMonth + MONTH_START, lastMonth + MONTH_END, null);
121 Integer finish = productionEquipmentMapper.getTaskNum(lastMonth + MONTH_START, lastMonth + MONTH_END, 1);
122 Double lastRepairCompleteRate = 0.00;
123 if (repairNum1 > 0) {
124 lastRepairCompleteRate = (double) finish / repairNum1 * 100;
125 }
126 if (lastRepairCompleteRate > 0) {
127 repairCompleteRing = (repairCompleteRate - lastRepairCompleteRate) / lastRepairCompleteRate * 100;
128 }
129 //维护维修费用
130 //维修费
131 repairCost = productionEquipmentMapper.getRepairCost(reportStatisticsDTO.getTime() + MONTH_START, reportStatisticsDTO.getTime() + MONTH_END);
132 //保养费
133 maintainCost = productionEquipmentMapper.getMaintainCost(reportStatisticsDTO.getTime() + MONTH_START, reportStatisticsDTO.getTime() + MONTH_END);
134 totalCost = repairCost + maintainCost;
135 //环比
136 Double repairCost1 = productionEquipmentMapper.getRepairCost(lastMonth + MONTH_START, lastMonth + MONTH_END);
137 Double maintainCost1 = productionEquipmentMapper.getMaintainCost(lastMonth + MONTH_START, lastMonth + MONTH_END);
138 if (repairCost1 + maintainCost1 > 0) {
139 costRing = (totalCost - (repairCost1 + maintainCost1)) / (repairCost1 + maintainCost1) * 100;
140 }
141 } else {
142 if (reportStatisticsDTO.getTime()==null){
143 reportStatisticsDTO.setTime(reportStatisticsDTO.getEndTime().substring(0,4));
144 }
145 //总数
146 equipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), null);
147 //ab总数
148 ABEquipmentNum = productionEquipmentMapper.getEquipmentNum("1970-01-01 00:00:00", reportStatisticsDTO.getEndTime(), "C");
149 if (null == reportStatisticsDTO.getTime()) {
150 Calendar cal = Calendar.getInstance();
151 reportStatisticsDTO.setTime(String.valueOf(cal.get(Calendar.YEAR)));
152 }
153 increase = productionEquipmentMapper.getEquipmentNum(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END, null);
154 //设备完好率
155 //求总停机天数
156 Map downtime = productionEquipmentMapper.getDowntime(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END);
157 String downtime1 = null;
158 if (downtime.get("downtime") == null) {
159 downtime1 = "0.00";
160 } else {
161 downtime1 = downtime.get("downtime").toString();
162 }
163 v = (increase * 365 - Double.parseDouble(downtime1)) / (increase * 365);
164 repairNum = downtime.get("repairNum").toString();
165 goodDay = 365 - Double.parseDouble(downtime1);
166 //上一年的设备完好率
167 Integer lastYear = Integer.parseInt(reportStatisticsDTO.getTime()) - 1;
168
169
170 Map downtime2 = productionEquipmentMapper.getDowntime(lastYear + YEAR_START, lastYear + YEAR_END);
171 String downtime3 = null;
172 if (null == downtime2.get("downtime")) {
173 downtime3 = "0.00";
174 } else {
175 downtime3 = downtime2.get("downtime").toString();
176 }
177 Integer increase1 = productionEquipmentMapper.getEquipmentNum(lastYear + YEAR_START, lastYear + YEAR_END, null);
178 Double v1 = 0.00;
179 if (increase1 > 0) {
180 v1 = (increase1 * 365 - Double.parseDouble(downtime3)) / (increase1 * 365);
181 }
182 if (v1 > 0) {
183 goodDayRing = (v - v1) / v1 * 100;
184 }
185 //维修计划完成率
186 //维护计划台数
187 repairPlanNum = productionEquipmentMapper.getTaskNum(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END, null);
188 //维护完成台数
189 repairCompleteNum = productionEquipmentMapper.getTaskNum(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END, 1);
190 repairCompleteRate = (double) repairCompleteNum / repairPlanNum * 100;
191 //环比
192 Integer repairNum1 = productionEquipmentMapper.getTaskNum(lastYear + YEAR_START, lastYear + YEAR_END, null);
193 Integer finish = productionEquipmentMapper.getTaskNum(lastYear + YEAR_START, lastYear + YEAR_END, 1);
194 Double lastRepairCompleteRate = 0.00;
195 if (repairNum1 > 0) {
196 lastRepairCompleteRate = (double) finish / repairNum1 * 100;
197 }
198 if (lastRepairCompleteRate > 0) {
199 repairCompleteRing = (repairCompleteRate - lastRepairCompleteRate) / lastRepairCompleteRate * 100;
200 }
201 //维护维修费用
202 //维修费
203 repairCost = productionEquipmentMapper.getRepairCost(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END);
204 //保养费
205 maintainCost = productionEquipmentMapper.getMaintainCost(reportStatisticsDTO.getTime() + YEAR_START, reportStatisticsDTO.getTime() + YEAR_END);
206 totalCost = repairCost + maintainCost;
207 //环比
208 Double repairCost1 = productionEquipmentMapper.getRepairCost(lastYear + YEAR_START, lastYear + YEAR_END);
209 Double maintainCost1 = productionEquipmentMapper.getMaintainCost(lastYear + YEAR_START, lastYear + YEAR_END);
210 if (repairCost1 + maintainCost1 > 0) {
211 costRing = (totalCost - (repairCost1 + maintainCost1)) / (repairCost1 + maintainCost1) * 100;
212 }
213 }
214 productionEquipmentVO.setEquipmentNum(equipmentNum);
215 productionEquipmentVO.setAbEquipmentNum(ABEquipmentNum);
216 //本月新增
217 productionEquipmentVO.setIncrease(increase);
218 //设备完好率
219 BigDecimal bigDecimal = new BigDecimal(v*100).setScale(2, BigDecimal.ROUND_HALF_UP);
220 productionEquipmentVO.setEquipmentIntactRate(bigDecimal.toString() + "%");
221 //设备完好总台日
222 BigDecimal bigDecimal5 = new BigDecimal(goodDay).setScale(2, BigDecimal.ROUND_HALF_UP);
223 productionEquipmentVO.setEquipmentIntactDay(bigDecimal5.toString());
224 //维护台次
225 productionEquipmentVO.setMaintainUnits(repairNum);
226 //设备完好率月环比
227 BigDecimal bigDecimal1 = new BigDecimal(goodDayRing).setScale(2, BigDecimal.ROUND_HALF_UP);
228 productionEquipmentVO.setEquipmentIntactRingRate(bigDecimal1.toString() + "%");
229 //维修计划完成率
230 BigDecimal bigDecimal2 = new BigDecimal(repairCompleteRate).setScale(2, BigDecimal.ROUND_HALF_UP);
231 productionEquipmentVO.setRepairCompleteRate(bigDecimal2.toString() + "%");
232 //维护计划
233 productionEquipmentVO.setRepairPlan(repairPlanNum.toString());
234 //维护完成
235 productionEquipmentVO.setRepairComplete(repairCompleteNum.toString());
236 //维修计划完成月环比
237 BigDecimal bigDecimal3 = new BigDecimal(repairCompleteRing).setScale(2, BigDecimal.ROUND_HALF_UP);
238 productionEquipmentVO.setRepairCompleteRingRate(bigDecimal3.toString() + "%");
239 //维护维修费用
240 productionEquipmentVO.setRepairMaintainCost(totalCost.toString());
241 //维修费用
242 productionEquipmentVO.setRepairCost(repairCost.toString());
243 //维护
244 productionEquipmentVO.setMaintainCost(maintainCost.toString());
245 //环比
246 BigDecimal bigDecimal4 = new BigDecimal(costRing).setScale(2, BigDecimal.ROUND_HALF_UP);
247 productionEquipmentVO.setRepairMaintainCostRingRate(bigDecimal4.toString() + "%");
248 return productionEquipmentVO;
249 }
250
251 @Override
252 public FaultStatisticsVO getEquipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) {
253 FaultStatisticsVO faultStatisticsVO = new FaultStatisticsVO();
254 List<ProportionStatisticsVO> levelByTime = productionEquipmentMapper.getLevelByTime(reportStatisticsDTO);
255 if (levelByTime.size() > 0) {
256 levelByTime.forEach(l -> {
257 reportStatisticsDTO.setEquipmentLevel(l.getCategory());
258 List<ProportionStatisticsVO> typeByTime = productionEquipmentMapper.getTypeByTime(reportStatisticsDTO);
259 l.setProportionStatisticsVOList(typeByTime);
260 });
261 }
262 faultStatisticsVO.setLevel(levelByTime);
263 return faultStatisticsVO;
264 }
265
266 @Override
267 public Page<EquipmentNewMaintenancePlanVO> getEquipmentStatisticsDetails(Page<EquipmentNewMaintenancePlanVO> pageList, ReportStatisticsDTO reportStatisticsDTO) {
268 int n = 0;
269 //前端传入公司id和需要展示的层级
270 if (StrUtil.isEmpty(reportStatisticsDTO.getCompanyId()) && null == reportStatisticsDTO.getIsCompany()) {
271 String realFactoryId = (String) BaseContextHandler.get("realFactoryId");
272 reportStatisticsDTO.setCompanyId(realFactoryId);
273 String orgCode = BaseContextHandler.getOrgCode();
274 n = orgCode.length() - orgCode.replaceAll("A", "").length();
275 } else {
276 n = reportStatisticsDTO.getIsCompany();
277 }
278 List<EquipmentNewMaintenancePlanVO> equipmentStatistics = new ArrayList<>();
279 if (n == 1) {
280 equipmentStatistics = productionEquipmentMapper.getEquipmentStatisticsDetailsHeadquarters(reportStatisticsDTO);
281 int finalN = n;
282 equipmentStatistics.forEach(e -> {
283 ReportStatisticsDTO reportStatisticsDTO1 = new ReportStatisticsDTO();
284 reportStatisticsDTO1.setCompanyId(e.getCompanyId());
285 reportStatisticsDTO1.setStartTime(reportStatisticsDTO.getStartTime());
286 reportStatisticsDTO1.setEndTime(reportStatisticsDTO.getEndTime());
287 List<Map> levelByHeadquarters = productionEquipmentMapper.getLevelByHeadquarters(reportStatisticsDTO1);
288 e.setType(finalN);
289 if (levelByHeadquarters.size() > 0) {
290 levelByHeadquarters.forEach(l -> {
291 String equipmentLevel = (String) l.get("equipmentLevel");
292 if (equipmentLevel.equals(A)) {
293 e.setAClass(equipmentLevel);
294 } else if (equipmentLevel.equals(B)) {
295 e.setBClass(equipmentLevel);
296 } else {
297 e.setCClass(equipmentLevel);
298 }
299 });
300 } else {
301 e.setAClass("0");
302 e.setBClass("0");
303 e.setCClass("0");
304 }
305 });
306 } else if (n == 2) {
307 equipmentStatistics = productionEquipmentMapper.getEquipmentStatisticsDetailsBranchOffice(reportStatisticsDTO);
308 int finalN1 = n;
309 equipmentStatistics.forEach(e -> {
310 e.setType(finalN1);
311 ReportStatisticsDTO reportStatisticsDTO1 = new ReportStatisticsDTO();
312 reportStatisticsDTO1.setCompanyId(e.getCompanyId());
313 reportStatisticsDTO1.setStartTime(reportStatisticsDTO.getStartTime());
314 reportStatisticsDTO1.setEndTime(reportStatisticsDTO.getEndTime());
315 List<Map> levelByBranchOffice = productionEquipmentMapper.getLevelByBranchOffice(reportStatisticsDTO1);
316 if (levelByBranchOffice.size() > 0) {
317 levelByBranchOffice.forEach(l -> {
318 String equipmentLevel = (String) l.get("equipmentLevel");
319 if (equipmentLevel.equals(A)) {
320 e.setAClass(equipmentLevel);
321 } else if (equipmentLevel.equals(B)) {
322 e.setBClass(equipmentLevel);
323 } else {
324 e.setCClass(equipmentLevel);
325 }
326 });
327 } else {
328 e.setAClass("0");
329 e.setBClass("0");
330 e.setCClass("0");
331 }
332 });
333 } else {
334 equipmentStatistics = productionEquipmentMapper.getEquipmentStatisticsDetailsFactory(reportStatisticsDTO);
335 int finalN2 = n;
336 equipmentStatistics.forEach(e -> {
337 e.setType(finalN2);
338 ReportStatisticsDTO reportStatisticsDTO1 = new ReportStatisticsDTO();
339 reportStatisticsDTO1.setCompanyId(e.getCompanyId());
340 reportStatisticsDTO1.setStartTime(reportStatisticsDTO.getStartTime());
341 reportStatisticsDTO1.setEndTime(reportStatisticsDTO.getEndTime());
342 List<Map> levelByBranchOffice = productionEquipmentMapper.getLevelByBranchOffice(reportStatisticsDTO1);
343 if (levelByBranchOffice.size() > 0) {
344 levelByBranchOffice.forEach(l -> {
345 String equipmentLevel = (String) l.get("equipmentLevel");
346 if (equipmentLevel.equals(A)) {
347 e.setAClass(equipmentLevel);
348 } else if (equipmentLevel.equals(B)) {
349 e.setBClass(equipmentLevel);
350 } else {
351 e.setCClass(equipmentLevel);
352 }
353 });
354 } else {
355 e.setAClass("0");
356 e.setBClass("0");
357 e.setCClass("0");
358 }
359 });
360 }
361 return pageList.setRecords(equipmentStatistics);
362 }
363
364 @Override
365 public List<TOPTenVO> getEquipmentState(ReportStatisticsDTO reportStatisticsDTO) {
366 List<TOPTenVO> list = new ArrayList<>();
367 TOPTenVO topTenVO = new TOPTenVO();
368 reportStatisticsDTO.setEquipmentType("wxdd");
369 Integer equipmentStatus = productionEquipmentMapper.getEquipmentStatus(reportStatisticsDTO);
370 topTenVO.setFactoryName("待修");
371 topTenVO.setNum(equipmentStatus.toString());
372 list.add(topTenVO);
373 TOPTenVO topTenVO1 = new TOPTenVO();
374 reportStatisticsDTO.setEquipmentType("sbwx");
375 Integer equipmentStatus1 = productionEquipmentMapper.getEquipmentStatus(reportStatisticsDTO);
376 topTenVO1.setFactoryName("在修");
377 topTenVO1.setNum(equipmentStatus1.toString());
378 list.add(topTenVO1);
379 return list;
380 }
381
382 @Override
383 public Page<EquipmentNewMaintenancePlanVO> getEquipmentStateDetails(Page<EquipmentNewMaintenancePlanVO> pageList, ReportStatisticsDTO reportStatisticsDTO) {
384 int n = 0;
385 //前端传入公司id和需要展示的层级
386 if (StrUtil.isEmpty(reportStatisticsDTO.getCompanyId()) && null == reportStatisticsDTO.getIsCompany()) {
387 String realFactoryId = (String) BaseContextHandler.get("realFactoryId");
388 reportStatisticsDTO.setCompanyId(realFactoryId);
389 String orgCode = BaseContextHandler.getOrgCode();
390 n = orgCode.length() - orgCode.replaceAll("A", "").length();
391 } else {
392 n = reportStatisticsDTO.getIsCompany();
393 }
394 List<EquipmentNewMaintenancePlanVO> equipmentStatistics = new ArrayList<>();
395 if (n == 1) {
396 equipmentStatistics = productionEquipmentMapper.getEquipmentStatisticsDetailsHeadquarters(reportStatisticsDTO);
397 equipmentStatistics.forEach(e -> {
398 ReportStatisticsDTO reportStatisticsDTO1 = new ReportStatisticsDTO();
399 reportStatisticsDTO1.setCompanyId(e.getCompanyId());
400 reportStatisticsDTO1.setStartTime(reportStatisticsDTO.getStartTime());
401 reportStatisticsDTO1.setEndTime(reportStatisticsDTO.getEndTime());
402 List<Map> statusByHeadquarters = productionEquipmentMapper.getStatusByHeadquarters(reportStatisticsDTO1);
403 if (statusByHeadquarters.size() > 0) {
404 statusByHeadquarters.forEach(s -> {
405 String accessState = (String) s.get("accessState");
406 String repairNum = String.valueOf(s.get("repairNum"));
407 if ("wxdd".equals(accessState)) {
408 e.setWaiting(repairNum);
409 } else if ("sbwx".equals(accessState)) {
410 e.setRepairing(repairNum);
411 }
412 });
413 }
414
415 });
416 } else if (n == 2) {
417 equipmentStatistics = productionEquipmentMapper.getEquipmentStatisticsDetailsBranchOffice(reportStatisticsDTO);
418 equipmentStatistics.forEach(e -> {
419 ReportStatisticsDTO reportStatisticsDTO1 = new ReportStatisticsDTO();
420 reportStatisticsDTO1.setCompanyId(e.getCompanyId());
421 reportStatisticsDTO1.setStartTime(reportStatisticsDTO.getStartTime());
422 reportStatisticsDTO1.setEndTime(reportStatisticsDTO.getEndTime());
423 List<Map> statusByBranchOffice = productionEquipmentMapper.getStatusByBranchOffice(reportStatisticsDTO1);
424 if (statusByBranchOffice.size() > 0) {
425 statusByBranchOffice.forEach(s -> {
426 String accessState = (String) s.get("accessState");
427 String repairNum = (String) s.get("repairNum");
428 if ("wxdd".equals(accessState)) {
429 e.setWaiting(repairNum);
430 } else if ("sbwx".equals(accessState)) {
431 e.setRepairing(repairNum);
432 }
433 });
434 }
435 });
436
437 } else {
438 equipmentStatistics = productionEquipmentMapper.getEquipmentStatisticsDetailsFactory(reportStatisticsDTO);
439 equipmentStatistics.forEach(e -> {
440 ReportStatisticsDTO reportStatisticsDTO1 = new ReportStatisticsDTO();
441 reportStatisticsDTO1.setCompanyId(e.getCompanyId());
442 reportStatisticsDTO1.setStartTime(reportStatisticsDTO.getStartTime());
443 reportStatisticsDTO1.setEndTime(reportStatisticsDTO.getEndTime());
444 List<Map> statusByBranchOffice = productionEquipmentMapper.getStatusByBranchOffice(reportStatisticsDTO1);
445 if (statusByBranchOffice.size() > 0) {
446 statusByBranchOffice.forEach(s -> {
447 String accessState = (String) s.get("accessState");
448 String repairNum = (String) s.get("repairNum");
449 if ("wxdd".equals(accessState)) {
450 e.setWaiting(repairNum);
451 } else if ("sbwx".equals(accessState)) {
452 e.setRepairing(repairNum);
453 }
454 });
455 }
456 });
457 }
458 return pageList.setRecords(equipmentStatistics);
459 }
460
461 @Override
462 public List<ContrastVO> getEquipmentIntactRate(ReportStatisticsDTO reportStatisticsDTO) {
463 List<ContrastVO> list = new ArrayList<>();
464 List<Map> rate = null;
465 List<Map> onYearRate = new ArrayList<>();
466 if (reportStatisticsDTO.getTimeUnit() == 6) {
467 rate = productionEquipmentMapper.getHalfIntactRate();
468 onYearRate = productionEquipmentMapper.getHalfIntactYearOnYearRate();
469 } else {
470 rate = productionEquipmentMapper.getOneYearRate();
471 onYearRate = productionEquipmentMapper.getOneYearYearOnYearRate();
472 }
473 List<Map> yearOnYear = onYearRate;
474 rate.forEach(h -> {
475 ContrastVO contrastVO = new ContrastVO();
476 String month = (String) h.get("month");
477 String lastYear = (String) h.get("lastYear");
478 String d = h.get("downtime").toString();
479 Double downtime = Double.parseDouble(d);
480 Long increase = (Long) h.get("increase");
481 double v = 0.00;
482 if (increase > 0) {
483 v = DoubleOperaUtils.bigDecimalRound((increase * 30 - downtime) / (increase * 30), 2)*100;
484 }
485 contrastVO.setMonth(month);
486 contrastVO.setRepairNum(v + "%");
487 yearOnYear.forEach(y -> {
488 String lastYear1 = (String) y.get("lastYear");
489 if (lastYear1.equals(lastYear)) {
490 Long increase1 = (Long) y.get("increase");
491 String d1 = y.get("downtime").toString();
492 Double downtime1 = Double.parseDouble(d1);
493 double v1 = 0.00;
494 if (increase1 > 0) {
495 v1 = DoubleOperaUtils.bigDecimalRound((increase1 * 30 - downtime1) / (increase1 * 30),2)*100;
496 }
497 contrastVO.setMaintainNum(v1 + "%");
498 }
499 });
500 list.add(contrastVO);
501 });
502 return list;
503 }
504
505 @Override
506 public List<Map> getEquipmentIntactRateDetails(ReportStatisticsDTO reportStatisticsDTO) {
507 List<Map> list = new ArrayList<>();
508 int n = 0;
509 String lastMonth = null;
510 //前端传入公司id和需要展示的层级
511 if (StrUtil.isEmpty(reportStatisticsDTO.getCompanyId()) && null == reportStatisticsDTO.getIsCompany()) {
512 String realFactoryId = (String) BaseContextHandler.get("realFactoryId");
513 reportStatisticsDTO.setCompanyId(realFactoryId);
514 String orgCode = BaseContextHandler.getOrgCode();
515 n = orgCode.length() - orgCode.replaceAll("A", "").length();
516 } else {
517 n = reportStatisticsDTO.getIsCompany();
518 }
519 Date parse = null;
520 DateFormat format = new SimpleDateFormat("yyyy-MM");
521 try {
522 parse = format.parse(reportStatisticsDTO.getTime());
523 Calendar calendar = Calendar.getInstance();
524 calendar.setTime(parse);
525 calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 1);
526 calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) + 1);
527 lastMonth = format.format(calendar.getTime());
528 } catch (Exception e) {
529 e.getMessage();
530 }
531 List<Map> downTimeByMonthHeadquarters = null;
532 List<Map> equipmentNumByMonthHeadquarters = null;
533 List<Map> downTimeByMonthHeadquartersLastYear = null;
534 List<Map> equipmentNumByMonthHeadquartersLastYear = null;
535 if (n == 1) {
536 downTimeByMonthHeadquarters = productionEquipmentMapper.getDownTimeByMonthHeadquarters(reportStatisticsDTO);
537 equipmentNumByMonthHeadquarters = productionEquipmentMapper.getEquipmentNumByMonthHeadquarters(reportStatisticsDTO);
538 reportStatisticsDTO.setTime(lastMonth);
539 downTimeByMonthHeadquartersLastYear = productionEquipmentMapper.getDownTimeByMonthHeadquarters(reportStatisticsDTO);
540 equipmentNumByMonthHeadquartersLastYear = productionEquipmentMapper.getEquipmentNumByMonthHeadquarters(reportStatisticsDTO);
541 } else if (n == 2) {
542 downTimeByMonthHeadquarters = productionEquipmentMapper.getDownTimeByBranchOffice(reportStatisticsDTO);
543 equipmentNumByMonthHeadquarters = productionEquipmentMapper.getEquipmentNumByBranchOffice(reportStatisticsDTO);
544 reportStatisticsDTO.setTime(lastMonth);
545 downTimeByMonthHeadquartersLastYear = productionEquipmentMapper.getDownTimeByBranchOffice(reportStatisticsDTO);
546 equipmentNumByMonthHeadquartersLastYear = productionEquipmentMapper.getEquipmentNumByBranchOffice(reportStatisticsDTO);
547 } else {
548 downTimeByMonthHeadquarters = productionEquipmentMapper.getDownTimeByFactory(reportStatisticsDTO);
549 equipmentNumByMonthHeadquarters = productionEquipmentMapper.getEquipmentNumByFactory(reportStatisticsDTO);
550 reportStatisticsDTO.setTime(lastMonth);
551 downTimeByMonthHeadquartersLastYear = productionEquipmentMapper.getDownTimeByFactory(reportStatisticsDTO);
552 equipmentNumByMonthHeadquartersLastYear = productionEquipmentMapper.getEquipmentNumByFactory(reportStatisticsDTO);
553 }
554 List<Map> finalEquipmentNumByMonthHeadquarters = equipmentNumByMonthHeadquarters;
555 List<Map> finalDownTimeByMonthHeadquartersLastYear = downTimeByMonthHeadquartersLastYear;
556 List<Map> finalEquipmentNumByMonthHeadquartersLastYear = equipmentNumByMonthHeadquartersLastYear;
557 int finalN = n;
558 downTimeByMonthHeadquarters.forEach(d -> {
559 Map map = new HashMap<>();
560 String departName = d.get("departName").toString();
561 String departId = d.get("departId").toString();
562 String downtime = d.get("downtime").toString();
563 finalEquipmentNumByMonthHeadquarters.forEach(e -> {
564 String companyName = e.get("companyName").toString();
565 String equipmentNum = e.get("equipmentNum").toString();
566 if (companyName.equals(departName)) {
567 //Double v = (Integer.parseInt(equipmentNum) * 30 - (Integer.parseInt(equipmentNum) * Double.parseDouble(downtime))) / (Integer.parseInt(equipmentNum) * 30);
568 Double v = (Integer.parseInt(equipmentNum) * 30 - Double.parseDouble(downtime)) / (Integer.parseInt(equipmentNum) * 30)*100;
569 v = DoubleOperaUtils.bigDecimalRound(v, 2);
570 map.put("departName", departName);
571 map.put("departId", departId);
572 map.put("intact", v);
573 map.put("percentage", 0.00);
574 map.put("type", finalN);
575 }
576 });
577 finalDownTimeByMonthHeadquartersLastYear.forEach(d1 -> {
578 String departName1 = d1.get("departName").toString();
579 String downtime1 = d1.get("downtime").toString();
580 if (departName1.equals(departName)) {
581 finalEquipmentNumByMonthHeadquartersLastYear.forEach(e1 -> {
582 String companyName1 = e1.get("companyName").toString();
583 String equipmentNum1 = e1.get("equipmentNum").toString();
584 if (companyName1.equals(departName1)) {
585 //Double v1 = (Integer.parseInt(equipmentNum1) * 30 - (Integer.parseInt(equipmentNum1) * Double.parseDouble(downtime1))) / Integer.parseInt(equipmentNum1) * 30;
586
587 Double v1 = (Integer.parseInt(equipmentNum1) * 30 - Double.parseDouble(downtime1)) / (Integer.parseInt(equipmentNum1) * 30)*100;
588 v1 = DoubleOperaUtils.bigDecimalRound(v1, 2);
589
590 map.put("percentage", v1);
591 }
592 });
593 }
594 });
595 list.add(map);
596 });
597 return list;
598 }
599
600 @Override
601 public List<ContrastVO> getEquipmentMF(ReportStatisticsDTO reportStatisticsDTO) {
602 List<ContrastVO> contrastVOS = new ArrayList<>();
603 //平均故障时间
604 List<Map> MTBF = new ArrayList<>();
605 //平均修复时间
606 List<Map> MTTR = new ArrayList<>();
607 if (reportStatisticsDTO.getTimeUnit() == 6) {
608 MTBF = productionEquipmentMapper.getHalfIntactMTBF();
609 MTTR = productionEquipmentMapper.getHalfIntactMTTR();
610 } else {
611 MTBF = productionEquipmentMapper.getOneYearMTBF();
612 MTTR = productionEquipmentMapper.getOneYearMTTR();
613 }
614 List<Map> finalMTTR = MTTR;
615 MTBF.forEach(h -> {
616 //循环平均故障时间
617 ContrastVO contrastVO = new ContrastVO();
618 //月份
619 String month = h.get("month").toString();
620 //运行时间
621 String runTime = h.get("runTime").toString();
622 //故障数
623 String failures = h.get("failures").toString();
624 //故障设备数量
625 String equips = h.get("equips").toString();
626 contrastVO.setMonth(month);
627 Double d = 0.00;
628 if (!failures.equals("0") && !equips.equals("0")) {
629 d = Double.parseDouble(runTime) / Integer.parseInt(failures) / Integer.parseInt(equips);
630 d = DoubleOperaUtils.bigDecimalRound(d,2);
631 }
632 contrastVO.setRepairNum(d.toString());
633 finalMTTR.forEach(o -> {
634 String month1 = o.get("month").toString();
635 if (month.equals(month1)) {
636 //停机时间
637 String downtime = o.get("downtime").toString();
638 if(Double.parseDouble(downtime) < 0){
639 downtime = "0.00";
640 }
641 //设备总数量
642 String increase = o.get("increase").toString();
643 // String equips1 = o.get("equips").toString();
644 // Double d1 = Double.parseDouble(runTime1) / Integer.parseInt(failures1) / Integer.parseInt(equips1);
645 Double d1 = Double.parseDouble(downtime) / Integer.parseInt(increase);
646 d1 = DoubleOperaUtils.bigDecimalRound(d1,2);
647
648 contrastVO.setMaintainNum(d1.toString());
649 }
650 });
651 contrastVOS.add(contrastVO);
652 });
653 return contrastVOS;
654 }
655
656 @Override
657 public List<Map> getEquipmentMFDetails(ReportStatisticsDTO reportStatisticsDTO) {
658 List<Map> list = new ArrayList<>();
659 int n = 0;
660 String lastMonth = null;
661 List<Map> listMF = new ArrayList<>();
662 //前端传入公司id和需要展示的层级
663 if (StrUtil.isEmpty(reportStatisticsDTO.getCompanyId()) && null == reportStatisticsDTO.getIsCompany()) {
664 String realFactoryId = (String) BaseContextHandler.get("realFactoryId");
665 reportStatisticsDTO.setCompanyId(realFactoryId);
666 String orgCode = BaseContextHandler.getOrgCode();
667 n = orgCode.length() - orgCode.replaceAll("A", "").length();
668 } else {
669 n = reportStatisticsDTO.getIsCompany();
670 }
671 List<Map> failures = new ArrayList<>();
672 List<Map> runTime = new ArrayList<>();
673 List<Map> faultEquipment = new ArrayList<>();
674 if (n == 1) {
675 failures = productionEquipmentMapper.getFailuresByHeadquarters(reportStatisticsDTO);
676 runTime = productionEquipmentMapper.getRunTimeByHeadquarters(reportStatisticsDTO);
677 faultEquipment = productionEquipmentMapper.getFaultEquipmentByHeadquarters(reportStatisticsDTO);
678 } else if (n == 2) {
679 failures = productionEquipmentMapper.getFailuresByBranchOffice(reportStatisticsDTO);
680 runTime = productionEquipmentMapper.getRunTimeByBranchOffice(reportStatisticsDTO);
681 faultEquipment = productionEquipmentMapper.getFaultEquipmentByBranchOffice(reportStatisticsDTO);
682 } else {
683 failures = productionEquipmentMapper.getFailuresByFactory(reportStatisticsDTO);
684 runTime = productionEquipmentMapper.getRunTimeByFactory(reportStatisticsDTO);
685 faultEquipment = productionEquipmentMapper.getFaultEquipmentByFactory(reportStatisticsDTO);
686 }
687 List<Map> finalRunTime = runTime;
688 List<Map> finalFailures = failures;
689 int finalN = n;
690 faultEquipment.forEach(f -> {
691 Map map = new HashMap<>();
692 String departName = f.get("departName").toString();
693 String departId = f.get("departId").toString();
694 String faultEquipment1 = f.get("faultEquipment").toString();
695 map.put("departName", departName);
696 map.put("departId", departId);
697 map.put("type", finalN);
698 map.put("MTBF", 0);
699 finalRunTime.forEach(r -> {
700 String runTime1 = r.get("runTime").toString();
701 String departName1 = r.get("departName").toString();
702 if (departName.equals(departName1)) {
703 finalFailures.forEach(f1 -> {
704 String failures1 = f1.get("failures").toString();
705 String departName2 = f1.get("departName").toString();
706 if (departName2.equals(departName1)) {
707 Double v = Double.parseDouble(runTime1) / Integer.parseInt(failures1) / Integer.parseInt(faultEquipment1);
708 v = DoubleOperaUtils.bigDecimalRound(v, 2);
709 map.put("MTBF", v);
710 }
711 });
712 }
713 });
714 listMF.add(map);
715 });
716 List<Map> downTime = new ArrayList<>();
717 List<Map> equipmentNum = new ArrayList<>();
718 if (n == 1) {
719 downTime = productionEquipmentMapper.getDownTimeByMonthHeadquarters(reportStatisticsDTO);
720 equipmentNum = productionEquipmentMapper.getEquipmentNumByMonthHeadquarters(reportStatisticsDTO);
721 } else if (n == 2) {
722 downTime = productionEquipmentMapper.getDownTimeByBranchOffice(reportStatisticsDTO);
723 equipmentNum = productionEquipmentMapper.getEquipmentNumByBranchOffice(reportStatisticsDTO);
724 } else {
725 downTime = productionEquipmentMapper.getDownTimeByFactory(reportStatisticsDTO);
726 equipmentNum = productionEquipmentMapper.getEquipmentNumByFactory(reportStatisticsDTO);
727 }
728 List<Map> finalDownTime = downTime;
729 List<Map> finalEquipmentNum = equipmentNum;
730 listMF.forEach(l -> {
731 String departName1 = l.get("departName").toString();
732 l.put("MTTR", 0);
733 finalDownTime.forEach(d -> {
734 String departName = d.get("departName").toString();
735 String downtime = d.get("downtime").toString();
736 if (departName1.equals(departName)) {
737 finalEquipmentNum.forEach(e -> {
738 String equipmentNum1 = e.get("equipmentNum").toString();
739 String companyName = e.get("companyName").toString();
740 if (companyName.equals(departName)) {
741 Double v1 = Double.parseDouble(downtime) / Integer.parseInt(equipmentNum1);
742 v1 = DoubleOperaUtils.bigDecimalRound(v1, 2);
743 l.put("MTTR", v1);
744 }
745 });
746 }
747 });
748 });
749 return listMF;
750 }
751
752 @Override
753 public List<ContrastVO> getMaintainCompleteRate(ReportStatisticsDTO reportStatisticsDTO) {
754 List<ContrastVO> contrastVOS = new ArrayList<>();
755 List<Map> completeRate = new ArrayList<>();
756 List<Map> completeYearOnYearRate = new ArrayList<>();
757 if (reportStatisticsDTO.getTimeUnit() == 6) {
758 completeRate = productionEquipmentMapper.getHalfIntactCompleteRate();
759 completeYearOnYearRate = productionEquipmentMapper.getHalfIntactCompleteYearOnYearRate();
760 } else {
761 completeRate = productionEquipmentMapper.getOneYearCompleteRate();
762 completeYearOnYearRate = productionEquipmentMapper.getOneYearCompleteYearOnYearRate();
763 }
764 List<Map> finalCompleteYearOnYearRate = completeYearOnYearRate;
765 completeRate.forEach(c -> {
766 ContrastVO contrastVO = new ContrastVO();
767 String month = c.get("month").toString();
768 String m = month.substring(5);
769 String planNum = c.get("planNum").toString();
770 String completeNum = c.get("completeNum").toString();
771 contrastVO.setMonth(month);
772 Double d = 0.00;
773 if (!"0".equals(planNum)) {
774 d = Double.parseDouble(completeNum) / Double.parseDouble(planNum) * 100;
775 //保留两位小数
776 d = DoubleOperaUtils.bigDecimalRound(d,2);
777 }
778 contrastVO.setRepairNum(d.toString());
779 finalCompleteYearOnYearRate.forEach(y -> {
780 String month1 = y.get("month").toString();
781 String m1 = month1.substring(5);
782 if (m1.equals(m)) {
783 String planNum1 = y.get("planNum").toString();
784 String completeNum1 = y.get("completeNum").toString();
785 Double v = 0.00;
786 if (!"0".equals(planNum1)) {
787 v = Double.parseDouble(completeNum1) / Double.parseDouble(planNum1) * 100;
788 //保留两位小数
789 v = DoubleOperaUtils.bigDecimalRound(v,2);
790 }
791 contrastVO.setMaintainNum(v.toString());
792 }
793 });
794 contrastVOS.add(contrastVO);
795 });
796 return contrastVOS;
797 }
798
799 @Override
800 public List<Map> getMaintainCompleteRateDetails(ReportStatisticsDTO reportStatisticsDTO) {
801 List<Map> list = new ArrayList<>();
802 int n = 0;
803 String lastMonth = null;
804 //前端传入公司id和需要展示的层级
805 if (StrUtil.isEmpty(reportStatisticsDTO.getCompanyId()) && null == reportStatisticsDTO.getIsCompany()) {
806 String realFactoryId = (String) BaseContextHandler.get("realFactoryId");
807 reportStatisticsDTO.setCompanyId(realFactoryId);
808 String orgCode = BaseContextHandler.getOrgCode();
809 n = orgCode.length() - orgCode.replaceAll("A", "").length();
810 } else {
811 n = reportStatisticsDTO.getIsCompany();
812 }
813 Date parse = null;
814 DateFormat format = new SimpleDateFormat("yyyy-MM");
815 try {
816 parse = format.parse(reportStatisticsDTO.getTime());
817 Calendar calendar = Calendar.getInstance();
818 calendar.setTime(parse);
819 calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 1);
820 calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) + 1);
821 lastMonth = format.format(calendar.getTime());
822 } catch (Exception e) {
823 e.getMessage();
824 }
825 List<Map> maintainPlanByHeadquarters = new ArrayList<>();
826 List<Map> maintainPlanByHeadquarters1 = new ArrayList<>();
827 List<Map> maintainPlanByHeadquarters2 = new ArrayList<>();
828 List<Map> maintainPlanByHeadquarters3 = new ArrayList<>();
829 if (n == 1) {
830 maintainPlanByHeadquarters = productionEquipmentMapper.getMaintainPlanByHeadquarters(reportStatisticsDTO);
831 reportStatisticsDTO.setLabelType(2);
832 maintainPlanByHeadquarters1 = productionEquipmentMapper.getMaintainPlanByHeadquarters(reportStatisticsDTO);
833 reportStatisticsDTO.setTime(lastMonth);
834 reportStatisticsDTO.setLabelType(null);
835 maintainPlanByHeadquarters2 = productionEquipmentMapper.getMaintainPlanByHeadquarters(reportStatisticsDTO);
836 reportStatisticsDTO.setLabelType(2);
837 maintainPlanByHeadquarters3 = productionEquipmentMapper.getMaintainPlanByHeadquarters(reportStatisticsDTO);
838 } else if (n == 2) {
839 maintainPlanByHeadquarters = productionEquipmentMapper.getMaintainPlanByBranchOffice(reportStatisticsDTO);
840 reportStatisticsDTO.setLabelType(2);
841 maintainPlanByHeadquarters1 = productionEquipmentMapper.getMaintainPlanByBranchOffice(reportStatisticsDTO);
842 reportStatisticsDTO.setTime(lastMonth);
843 reportStatisticsDTO.setLabelType(null);
844 maintainPlanByHeadquarters2 = productionEquipmentMapper.getMaintainPlanByBranchOffice(reportStatisticsDTO);
845 reportStatisticsDTO.setLabelType(2);
846 maintainPlanByHeadquarters3 = productionEquipmentMapper.getMaintainPlanByBranchOffice(reportStatisticsDTO);
847 } else {
848 maintainPlanByHeadquarters = productionEquipmentMapper.getMaintainPlanByFactory(reportStatisticsDTO);
849 reportStatisticsDTO.setLabelType(2);
850 maintainPlanByHeadquarters1 = productionEquipmentMapper.getMaintainPlanByFactory(reportStatisticsDTO);
851 reportStatisticsDTO.setTime(lastMonth);
852 reportStatisticsDTO.setLabelType(null);
853 maintainPlanByHeadquarters2 = productionEquipmentMapper.getMaintainPlanByFactory(reportStatisticsDTO);
854 reportStatisticsDTO.setLabelType(2);
855 maintainPlanByHeadquarters3 = productionEquipmentMapper.getMaintainPlanByFactory(reportStatisticsDTO);
856 }
857 List<Map> finalMaintainPlanByHeadquarters = maintainPlanByHeadquarters1;
858 List<Map> finalMaintainPlanByHeadquarters1 = maintainPlanByHeadquarters2;
859 List<Map> finalMaintainPlanByHeadquarters2 = maintainPlanByHeadquarters3;
860 int finalN = n;
861 maintainPlanByHeadquarters.forEach(m -> {
862 Map map = new HashMap<>();
863 String departName = m.get("departName").toString();
864 String departId = m.get("departId").toString();
865 String planNum = m.get("planNum").toString();
866 map.put("departName", departName);
867 map.put("departId", departId);
868 map.put("complete", 0);
869 map.put("lastYearComplete", 0);
870 map.put("type", finalN);
871 finalMaintainPlanByHeadquarters.forEach(m1 -> {
872 String departName1 = m1.get("departName").toString();
873 if (departName.equals(departName1)) {
874 String planNum1 = m1.get("planNum").toString();
875 Double v = Integer.parseInt(planNum1) / Integer.parseInt(planNum) * 100.00;
876 map.put("complete", v);
877 }
878 });
879 finalMaintainPlanByHeadquarters1.forEach(m2 -> {
880 String departName1 = m2.get("departName").toString();
881 if (departName1.equals(departName)) {
882 String planNum1 = m2.get("planNum").toString();
883 finalMaintainPlanByHeadquarters2.forEach(m3 -> {
884 String departName2 = m3.get("departName").toString();
885 if (departName2.equals(departName1)) {
886 String planNum2 = m3.get("planNum").toString();
887 Double o = Integer.parseInt(planNum2) / Integer.parseInt("planNum1") * 100.00;
888 map.put("lastYearComplete", o);
889 }
890 });
891 }
892 });
893 list.add(map);
894 });
895 return list;
896 }
897
898 //维修维护费用对比
899 @Override
900 public List<ContrastVO> getContrastCost(ReportStatisticsDTO reportStatisticsDTO) {
901 List<ContrastVO> list = new ArrayList<>();
902 List<Map> contrastCost = new ArrayList<>();
903 if (reportStatisticsDTO.getTimeUnit() == 6) {//半年
904 contrastCost = productionEquipmentMapper.getHalfIntactContrastCost(reportStatisticsDTO.getDepartIds());
905 } else {
906 contrastCost = productionEquipmentMapper.getOneYearContrastCost(reportStatisticsDTO.getDepartIds());
907 }
908 contrastCost.forEach(c -> {
909 ContrastVO contrastVO = new ContrastVO();
910 String month = c.get("month").toString();
911 String maintainCost = c.get("maintainCost").toString();
912 String repairCost = c.get("repairCost").toString();
913 contrastVO.setMonth(month);
914 contrastVO.setMaintainNum(maintainCost);
915 contrastVO.setRepairNum(repairCost);
916 list.add(contrastVO);
917 });
918 return list;
919 }
920
921 //维护维修费用详情
922 @Override
923 public List<Map> getContrastCostDetails(ReportStatisticsDTO reportStatisticsDTO) {
924 return productionEquipmentMapper.getContrastCostDetails(reportStatisticsDTO);
925 }
926
927 */
928 /* @Override
929 public List<Map> getContrastCostDetails(ReportStatisticsDTO reportStatisticsDTO) {
930 List<Map> list = new ArrayList<>();
931 int n = 0;
932 String lastMonth = null;
933 //前端传入公司id和需要展示的层级
934 if (StrUtil.isEmpty(reportStatisticsDTO.getCompanyId()) && null == reportStatisticsDTO.getIsCompany()) {
935 String realFactoryId = (String) BaseContextHandler.get("realFactoryId");
936 reportStatisticsDTO.setCompanyId(realFactoryId);
937 String orgCode = BaseContextHandler.getOrgCode();
938 n = orgCode.length() - orgCode.replaceAll("A", "").length();
939 } else {
940 n = reportStatisticsDTO.getIsCompany();
941 }
942 List<Map> maintainCost = new ArrayList<>();
943 List<Map> repairCost = new ArrayList<>();
944 if (n == 1) {
945 maintainCost = productionEquipmentMapper.getMaintainCostByHeadquarters(reportStatisticsDTO);
946 repairCost = productionEquipmentMapper.getRepairCostByHeadquarters(reportStatisticsDTO);
947 } else if (n == 2) {
948 maintainCost = productionEquipmentMapper.getMaintainCostByBranchOffice(reportStatisticsDTO);
949 repairCost = productionEquipmentMapper.getRepairCostByBranchOffice(reportStatisticsDTO);
950 } else {
951 maintainCost = productionEquipmentMapper.getMaintainCostByFactory(reportStatisticsDTO);//维护金额
952 repairCost = productionEquipmentMapper.getRepairCostByFactory(reportStatisticsDTO);
953 }
954 List<Map> finalRepairCost = repairCost;
955 if (maintainCost.size() > repairCost.size()) {
956 int finalN = n;
957 maintainCost.forEach(m -> {
958 Map map = new HashMap<>();
959 String departName = m.get("departName").toString();
960 String departId = m.get("departId").toString();
961 String maintainCost1 = m.get("maintainCost").toString();
962 map.put("departName", departName);
963 map.put("departId", departId);
964 map.put("maintainCost", maintainCost1);
965 map.put("repairCost", 0);
966 map.put("type", finalN);
967 finalRepairCost.forEach(r -> {
968 String departName1 = r.get("departName").toString();
969 String repairCost1 = r.get("repairCost").toString();
970 if (departName1.equals(departName)) {
971 map.put("repairCost", repairCost1);
972 }
973 });
974 list.add(map);
975 });
976 } else {
977 List<Map> finalMaintainCost = maintainCost;
978 int finalN1 = n;
979 repairCost.forEach(r -> {
980 Map map = new HashMap<>();
981 String departName1 = r.get("departName").toString();
982 String departId = r.get("departId").toString();
983 map.put("departId", departId);
984 //String repairCost1 = r.get("repairCost").toString();
985 String repairCost1 = ConvertUtils.getString(r.get("repairCost"));
986 map.put("departName", departName1);
987 map.put("repairCost", repairCost1);
988 map.put("maintainCost", 0);
989 map.put("type", finalN1);
990 finalMaintainCost.forEach(m -> {
991 String departName = m.get("departName").toString();
992 String maintainCost1 = m.get("maintainCost").toString();
993 if (departName1.equals(departName)) {
994 map.put("maintainCost", maintainCost1);
995 }
996 });
997 list.add(map);
998 });
999 }
1000
1001 return list;
1002 }*//*
1003
1004
1005 }
1006 */
1 package com.skua.modules.equipment.service.impl; 1 package com.skua.modules.equipment.service.impl;
2 2
3 import cn.hutool.core.util.StrUtil; 3 import cn.hutool.core.util.StrUtil;
4 import com.baomidou.mybatisplus.core.metadata.IPage;
4 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 import com.skua.core.context.BaseContextHandler; 6 import com.skua.core.context.BaseContextHandler;
6 import com.skua.core.util.ConvertUtils; 7 import com.skua.core.util.ConvertUtils;
7 import com.skua.core.util.DoubleOperaUtils; 8 import com.skua.core.util.DoubleOperaUtils;
9 import com.skua.modules.common.service.ICommonSqlService;
8 import com.skua.modules.equipment.dto.ReportStatisticsDTO; 10 import com.skua.modules.equipment.dto.ReportStatisticsDTO;
9 import com.skua.modules.equipment.mapper.ProductionEquipmentMapper; 11 import com.skua.modules.equipment.mapper.ProductionEquipmentMapper;
10 import com.skua.modules.equipment.service.IProductionEquipmentService; 12 import com.skua.modules.equipment.service.IProductionEquipmentService;
11 import com.skua.modules.equipment.vo.*; 13 import com.skua.modules.equipment.vo.*;
14 import com.skua.tool.util.JSUtils;
12 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Service; 16 import org.springframework.stereotype.Service;
14 import org.springframework.transaction.annotation.Transactional; 17 import org.springframework.transaction.annotation.Transactional;
...@@ -34,6 +37,7 @@ import java.util.*; ...@@ -34,6 +37,7 @@ import java.util.*;
34 public class ProductionEquipmentServiceImpl implements IProductionEquipmentService { 37 public class ProductionEquipmentServiceImpl implements IProductionEquipmentService {
35 @Autowired 38 @Autowired
36 private ProductionEquipmentMapper productionEquipmentMapper; 39 private ProductionEquipmentMapper productionEquipmentMapper;
40
37 private static final String MONTH_START = "-01 00:00:00"; 41 private static final String MONTH_START = "-01 00:00:00";
38 private static final String MONTH_END = "-31 23:59:59"; 42 private static final String MONTH_END = "-31 23:59:59";
39 private static final String YEAR_START = "-01-01 00:00:00"; 43 private static final String YEAR_START = "-01-01 00:00:00";
...@@ -163,6 +167,8 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -163,6 +167,8 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
163 goodDay = 365 - Double.parseDouble(downtime1); 167 goodDay = 365 - Double.parseDouble(downtime1);
164 //上一年的设备完好率 168 //上一年的设备完好率
165 Integer lastYear = Integer.parseInt(reportStatisticsDTO.getTime()) - 1; 169 Integer lastYear = Integer.parseInt(reportStatisticsDTO.getTime()) - 1;
170
171
166 Map downtime2 = productionEquipmentMapper.getDowntime(lastYear + YEAR_START, lastYear + YEAR_END); 172 Map downtime2 = productionEquipmentMapper.getDowntime(lastYear + YEAR_START, lastYear + YEAR_END);
167 String downtime3 = null; 173 String downtime3 = null;
168 if (null == downtime2.get("downtime")) { 174 if (null == downtime2.get("downtime")) {
...@@ -248,12 +254,28 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -248,12 +254,28 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
248 public FaultStatisticsVO getEquipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) { 254 public FaultStatisticsVO getEquipmentStatistics(ReportStatisticsDTO reportStatisticsDTO) {
249 FaultStatisticsVO faultStatisticsVO = new FaultStatisticsVO(); 255 FaultStatisticsVO faultStatisticsVO = new FaultStatisticsVO();
250 List<ProportionStatisticsVO> levelByTime = productionEquipmentMapper.getLevelByTime(reportStatisticsDTO); 256 List<ProportionStatisticsVO> levelByTime = productionEquipmentMapper.getLevelByTime(reportStatisticsDTO);
251 if (levelByTime.size() > 0) { 257
258 /*if (levelByTime.size() > 0) {
252 levelByTime.forEach(l -> { 259 levelByTime.forEach(l -> {
253 reportStatisticsDTO.setEquipmentLevel(l.getCategory()); 260 reportStatisticsDTO.setEquipmentLevel(l.getCategory());
254 List<ProportionStatisticsVO> typeByTime = productionEquipmentMapper.getTypeByTime(reportStatisticsDTO); 261 List<ProportionStatisticsVO> typeByTime = productionEquipmentMapper.getTypeByTime(reportStatisticsDTO);
255 l.setProportionStatisticsVOList(typeByTime); 262 l.setProportionStatisticsVOList(typeByTime);
256 }); 263 });
264 }*/
265 Double equipmentTotal = 0d;
266 //获取总记录数
267 if(levelByTime != null && !levelByTime.isEmpty()){
268 for(ProportionStatisticsVO statisticsVO : levelByTime){
269 equipmentTotal = equipmentTotal + ConvertUtils.getDouble( statisticsVO.getHour(),0d) ;
270 }
271 }
272 //计算比例
273 if(equipmentTotal.doubleValue() > 0 ){
274 // CONCAT( ROUND( IFNULL( t1.equipmentNum, 0 ) / t2.equipmentTotal, 3 )* 100, '%' ) AS proportion
275 equipmentTotal = equipmentTotal * 0.01d;
276 for(ProportionStatisticsVO statisticsVO : levelByTime){
277 statisticsVO.setProportion(JSUtils.divide(statisticsVO.getHour(),equipmentTotal));
278 }
257 } 279 }
258 faultStatisticsVO.setLevel(levelByTime); 280 faultStatisticsVO.setLevel(levelByTime);
259 return faultStatisticsVO; 281 return faultStatisticsVO;
...@@ -357,6 +379,17 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -357,6 +379,17 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
357 return pageList.setRecords(equipmentStatistics); 379 return pageList.setRecords(equipmentStatistics);
358 } 380 }
359 381
382
383
384 @Override
385 public IPage<EquipmentStatisticsCountVO> getEquipmentStatisticsDetailsNew(Page<EquipmentStatisticsCountVO> pageList, ReportStatisticsDTO reportStatisticsDTO) {
386
387 /* String dict_sql = "select t.item_value as 'id' , t.item_text , 'name' from sys_dict_item t where t.dict_id in (select id from sys_dict where dict_code = 'equipment-equipment_level') order by t.id asc ";
388 List<Map<String,Object>> mapList = commonSqlService.queryForList(dict_sql);
389 List<String> categoryNameList = new ArrayList<>();
390 List<String> categoryIdList = new ArrayList<>();*/
391 return productionEquipmentMapper.getEquipmentStatisticsDetailsNew(pageList,reportStatisticsDTO);
392 }
360 @Override 393 @Override
361 public List<TOPTenVO> getEquipmentState(ReportStatisticsDTO reportStatisticsDTO) { 394 public List<TOPTenVO> getEquipmentState(ReportStatisticsDTO reportStatisticsDTO) {
362 List<TOPTenVO> list = new ArrayList<>(); 395 List<TOPTenVO> list = new ArrayList<>();
...@@ -453,7 +486,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -453,7 +486,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
453 } 486 }
454 return pageList.setRecords(equipmentStatistics); 487 return pageList.setRecords(equipmentStatistics);
455 } 488 }
456 489 //设备完好率
457 @Override 490 @Override
458 public List<ContrastVO> getEquipmentIntactRate(ReportStatisticsDTO reportStatisticsDTO) { 491 public List<ContrastVO> getEquipmentIntactRate(ReportStatisticsDTO reportStatisticsDTO) {
459 List<ContrastVO> list = new ArrayList<>(); 492 List<ContrastVO> list = new ArrayList<>();
...@@ -463,8 +496,8 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -463,8 +496,8 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
463 rate = productionEquipmentMapper.getHalfIntactRate(); 496 rate = productionEquipmentMapper.getHalfIntactRate();
464 onYearRate = productionEquipmentMapper.getHalfIntactYearOnYearRate(); 497 onYearRate = productionEquipmentMapper.getHalfIntactYearOnYearRate();
465 } else { 498 } else {
466 rate = productionEquipmentMapper.getOneYearRate(); 499 rate = productionEquipmentMapper.getOneYearRate();//一年完好率
467 onYearRate = productionEquipmentMapper.getOneYearYearOnYearRate(); 500 onYearRate = productionEquipmentMapper.getOneYearYearOnYearRate();//一年同比
468 } 501 }
469 List<Map> yearOnYear = onYearRate; 502 List<Map> yearOnYear = onYearRate;
470 rate.forEach(h -> { 503 rate.forEach(h -> {
...@@ -497,7 +530,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -497,7 +530,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
497 }); 530 });
498 return list; 531 return list;
499 } 532 }
500 533 //设备完好率详情
501 @Override 534 @Override
502 public List<Map> getEquipmentIntactRateDetails(ReportStatisticsDTO reportStatisticsDTO) { 535 public List<Map> getEquipmentIntactRateDetails(ReportStatisticsDTO reportStatisticsDTO) {
503 List<Map> list = new ArrayList<>(); 536 List<Map> list = new ArrayList<>();
...@@ -529,27 +562,27 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -529,27 +562,27 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
529 List<Map> downTimeByMonthHeadquartersLastYear = null; 562 List<Map> downTimeByMonthHeadquartersLastYear = null;
530 List<Map> equipmentNumByMonthHeadquartersLastYear = null; 563 List<Map> equipmentNumByMonthHeadquartersLastYear = null;
531 if (n == 1) { 564 if (n == 1) {
532 downTimeByMonthHeadquarters = productionEquipmentMapper.getDownTimeByMonthHeadquarters(reportStatisticsDTO); 565 downTimeByMonthHeadquarters = productionEquipmentMapper.getDownTimeByMonthHeadquarters(reportStatisticsDTO);//总公司获取停机时间
533 equipmentNumByMonthHeadquarters = productionEquipmentMapper.getEquipmentNumByMonthHeadquarters(reportStatisticsDTO); 566 equipmentNumByMonthHeadquarters = productionEquipmentMapper.getEquipmentNumByMonthHeadquarters(reportStatisticsDTO);//总公司获取设备数量
534 reportStatisticsDTO.setTime(lastMonth); 567 reportStatisticsDTO.setTime(lastMonth);
535 downTimeByMonthHeadquartersLastYear = productionEquipmentMapper.getDownTimeByMonthHeadquarters(reportStatisticsDTO); 568 downTimeByMonthHeadquartersLastYear = productionEquipmentMapper.getDownTimeByMonthHeadquarters(reportStatisticsDTO);//总公司获取停机时间
536 equipmentNumByMonthHeadquartersLastYear = productionEquipmentMapper.getEquipmentNumByMonthHeadquarters(reportStatisticsDTO); 569 equipmentNumByMonthHeadquartersLastYear = productionEquipmentMapper.getEquipmentNumByMonthHeadquarters(reportStatisticsDTO);//总公司获取设备数量
537 } else if (n == 2) { 570 } else if (n == 2) {
538 downTimeByMonthHeadquarters = productionEquipmentMapper.getDownTimeByBranchOffice(reportStatisticsDTO); 571 downTimeByMonthHeadquarters = productionEquipmentMapper.getDownTimeByBranchOffice(reportStatisticsDTO);//分公司
539 equipmentNumByMonthHeadquarters = productionEquipmentMapper.getEquipmentNumByBranchOffice(reportStatisticsDTO); 572 equipmentNumByMonthHeadquarters = productionEquipmentMapper.getEquipmentNumByBranchOffice(reportStatisticsDTO);
540 reportStatisticsDTO.setTime(lastMonth); 573 reportStatisticsDTO.setTime(lastMonth);
541 downTimeByMonthHeadquartersLastYear = productionEquipmentMapper.getDownTimeByBranchOffice(reportStatisticsDTO); 574 downTimeByMonthHeadquartersLastYear = productionEquipmentMapper.getDownTimeByBranchOffice(reportStatisticsDTO);
542 equipmentNumByMonthHeadquartersLastYear = productionEquipmentMapper.getEquipmentNumByBranchOffice(reportStatisticsDTO); 575 equipmentNumByMonthHeadquartersLastYear = productionEquipmentMapper.getEquipmentNumByBranchOffice(reportStatisticsDTO);
543 } else { 576 } else {
544 downTimeByMonthHeadquarters = productionEquipmentMapper.getDownTimeByFactory(reportStatisticsDTO); 577 downTimeByMonthHeadquarters = productionEquipmentMapper.getDownTimeByFactory(reportStatisticsDTO);//厂站 停机时间
545 equipmentNumByMonthHeadquarters = productionEquipmentMapper.getEquipmentNumByFactory(reportStatisticsDTO); 578 equipmentNumByMonthHeadquarters = productionEquipmentMapper.getEquipmentNumByFactory(reportStatisticsDTO);// 厂站信息
546 reportStatisticsDTO.setTime(lastMonth); 579 reportStatisticsDTO.setTime(lastMonth);
547 downTimeByMonthHeadquartersLastYear = productionEquipmentMapper.getDownTimeByFactory(reportStatisticsDTO); 580 downTimeByMonthHeadquartersLastYear = productionEquipmentMapper.getDownTimeByFactory(reportStatisticsDTO);
548 equipmentNumByMonthHeadquartersLastYear = productionEquipmentMapper.getEquipmentNumByFactory(reportStatisticsDTO); 581 equipmentNumByMonthHeadquartersLastYear = productionEquipmentMapper.getEquipmentNumByFactory(reportStatisticsDTO);
549 } 582 }
550 List<Map> finalEquipmentNumByMonthHeadquarters = equipmentNumByMonthHeadquarters; 583 List<Map> finalEquipmentNumByMonthHeadquarters = equipmentNumByMonthHeadquarters;
551 List<Map> finalDownTimeByMonthHeadquartersLastYear = downTimeByMonthHeadquartersLastYear; 584 List<Map> finalDownTimeByMonthHeadquartersLastYear = downTimeByMonthHeadquartersLastYear;//总公司获取停机时间
552 List<Map> finalEquipmentNumByMonthHeadquartersLastYear = equipmentNumByMonthHeadquartersLastYear; 585 List<Map> finalEquipmentNumByMonthHeadquartersLastYear = equipmentNumByMonthHeadquartersLastYear;//总公司获取设备数量
553 int finalN = n; 586 int finalN = n;
554 downTimeByMonthHeadquarters.forEach(d -> { 587 downTimeByMonthHeadquarters.forEach(d -> {
555 Map map = new HashMap<>(); 588 Map map = new HashMap<>();
...@@ -593,6 +626,10 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -593,6 +626,10 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
593 return list; 626 return list;
594 } 627 }
595 628
629 //设备完好率详情(新)
630 public List<Map> getEquipmentIntactRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO) {
631 return productionEquipmentMapper.getEquipmentIntactRateDetailsNew(reportStatisticsDTO);
632 }
596 @Override 633 @Override
597 public List<ContrastVO> getEquipmentMF(ReportStatisticsDTO reportStatisticsDTO) { 634 public List<ContrastVO> getEquipmentMF(ReportStatisticsDTO reportStatisticsDTO) {
598 List<ContrastVO> contrastVOS = new ArrayList<>(); 635 List<ContrastVO> contrastVOS = new ArrayList<>();
...@@ -891,14 +928,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -891,14 +928,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
891 return list; 928 return list;
892 } 929 }
893 930
931 //维修维护费用对比
894 @Override 932 @Override
895 public List<ContrastVO> getContrastCost(ReportStatisticsDTO reportStatisticsDTO) { 933 public List<ContrastVO> getContrastCost(ReportStatisticsDTO reportStatisticsDTO) {
896 List<ContrastVO> list = new ArrayList<>(); 934 List<ContrastVO> list = new ArrayList<>();
897 List<Map> contrastCost = new ArrayList<>(); 935 List<Map> contrastCost = new ArrayList<>();
898 if (reportStatisticsDTO.getTimeUnit() == 6) { 936 if (reportStatisticsDTO.getTimeUnit() == 6) {//半年
899 contrastCost = productionEquipmentMapper.getHalfIntactContrastCost(); 937 contrastCost = productionEquipmentMapper.getHalfIntactContrastCost(reportStatisticsDTO.getDepartIds());
900 } else { 938 } else {
901 contrastCost = productionEquipmentMapper.getOneYearContrastCost(); 939 contrastCost = productionEquipmentMapper.getOneYearContrastCost(reportStatisticsDTO.getDepartIds());
902 } 940 }
903 contrastCost.forEach(c -> { 941 contrastCost.forEach(c -> {
904 ContrastVO contrastVO = new ContrastVO(); 942 ContrastVO contrastVO = new ContrastVO();
...@@ -913,8 +951,14 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -913,8 +951,14 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
913 return list; 951 return list;
914 } 952 }
915 953
954 //维护维修费用详情
916 @Override 955 @Override
917 public List<Map> getContrastCostDetails(ReportStatisticsDTO reportStatisticsDTO) { 956 public List<Map> getContrastCostDetails(ReportStatisticsDTO reportStatisticsDTO) {
957 return productionEquipmentMapper.getContrastCostDetails(reportStatisticsDTO);
958 }
959
960 /* @Override
961 public List<Map> getContrastCostDetails(ReportStatisticsDTO reportStatisticsDTO) {
918 List<Map> list = new ArrayList<>(); 962 List<Map> list = new ArrayList<>();
919 int n = 0; 963 int n = 0;
920 String lastMonth = null; 964 String lastMonth = null;
...@@ -936,7 +980,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -936,7 +980,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
936 maintainCost = productionEquipmentMapper.getMaintainCostByBranchOffice(reportStatisticsDTO); 980 maintainCost = productionEquipmentMapper.getMaintainCostByBranchOffice(reportStatisticsDTO);
937 repairCost = productionEquipmentMapper.getRepairCostByBranchOffice(reportStatisticsDTO); 981 repairCost = productionEquipmentMapper.getRepairCostByBranchOffice(reportStatisticsDTO);
938 } else { 982 } else {
939 maintainCost = productionEquipmentMapper.getMaintainCostByFactory(reportStatisticsDTO); 983 maintainCost = productionEquipmentMapper.getMaintainCostByFactory(reportStatisticsDTO);//维护金额
940 repairCost = productionEquipmentMapper.getRepairCostByFactory(reportStatisticsDTO); 984 repairCost = productionEquipmentMapper.getRepairCostByFactory(reportStatisticsDTO);
941 } 985 }
942 List<Map> finalRepairCost = repairCost; 986 List<Map> finalRepairCost = repairCost;
...@@ -987,6 +1031,6 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -987,6 +1031,6 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
987 } 1031 }
988 1032
989 return list; 1033 return list;
990 } 1034 }*/
991 1035
992 } 1036 }
......
1 package com.skua.modules.equipment.vo;
2
3 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty;
5 import lombok.Data;
6
7 /**
8 * @auther kangwei
9 * @create 2024-12-27-15:32
10 */
11
12 @Data
13 @ApiModel(value = "设备统计数量对象", description = "设备统计数量对象")
14 public class EquipmentStatisticsCountVO {
15
16 @ApiModelProperty(value = "厂站名称")
17 private String departName;
18 @ApiModelProperty(value = "厂站编号")
19 private String departId;
20
21 @ApiModelProperty(value = "分类1数量")
22 private String categoryValue1;
23 @ApiModelProperty(value = "分类2数量")
24 private String categoryValue2;
25 @ApiModelProperty(value = "分类3数量")
26 private String categoryValue3;
27 }
...@@ -20,7 +20,7 @@ public class ProportionStatisticsVO { ...@@ -20,7 +20,7 @@ public class ProportionStatisticsVO {
20 //类别 20 //类别
21 private String category; 21 private String category;
22 //占比 22 //占比
23 private String proportion; 23 private String proportion = "0%";
24 // 小时 24 // 小时
25 private String hour; 25 private String hour;
26 //设备中心的设备统计用 26 //设备中心的设备统计用
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!