08ed838b 康伟

kangwei: 设备中心半年、全年时间条件

1 个父辈 11e8dfa4
...@@ -629,6 +629,27 @@ public class DateUtils { ...@@ -629,6 +629,27 @@ public class DateUtils {
629 return sdf.format(preDate); 629 return sdf.format(preDate);
630 } 630 }
631 631
632 /***
633 * 获取几个月之后日期
634 * @param month
635 * @return
636 */
637 public static String getDateByAfterMonth(int month) {
638 // 设置日期格式
639 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
640 // 创建一个Calendar实例,并设置为当前日期和时间
641 Calendar calendar = Calendar.getInstance();
642 // 减去半年(6个月)
643 //calendar.add(Calendar.MONTH, -6);
644 calendar.add(Calendar.MONTH, month);
645
646 // Date preDate = calendar.getTime();
647 // 获取半年前的日期
648 String afterDate = dateFormat.format(calendar.getTime());
649 return afterDate;
650 }
651
652
632 /** 653 /**
633 * 获取日期时间集合 654 * 获取日期时间集合
634 * @param start 655 * @param start
......
...@@ -62,14 +62,14 @@ public class ReportStatisticsDTO { ...@@ -62,14 +62,14 @@ public class ReportStatisticsDTO {
62 62
63 public String getLastYearStartTime() { 63 public String getLastYearStartTime() {
64 if(StringUtils.isEmpty(lastYearStartTime)){ 64 if(StringUtils.isEmpty(lastYearStartTime)){
65 lastYearStartTime = DateUtils.getTbDate(lastYearStartTime); 65 lastYearStartTime = DateUtils.getTbDate(startTime);
66 } 66 }
67 return lastYearStartTime; 67 return lastYearStartTime;
68 } 68 }
69 69
70 public String getLastYearEndTime() { 70 public String getLastYearEndTime() {
71 if(StringUtils.isEmpty(lastYearEndTime)){ 71 if(StringUtils.isEmpty(lastYearEndTime)){
72 lastYearEndTime = DateUtils.getTbDate(lastYearEndTime); 72 lastYearEndTime = DateUtils.getTbDate(endTime);
73 } 73 }
74 return lastYearEndTime; 74 return lastYearEndTime;
75 } 75 }
...@@ -81,8 +81,8 @@ public class ReportStatisticsDTO { ...@@ -81,8 +81,8 @@ public class ReportStatisticsDTO {
81 }else{ 81 }else{
82 time = DateUtils.getCurrentYear()+""; 82 time = DateUtils.getCurrentYear()+"";
83 } 83 }
84
85 } 84 }
86 return time; 85 return time;
87 } 86 }
87
88 } 88 }
......
...@@ -11,7 +11,9 @@ import com.skua.modules.equipment.dto.ReportStatisticsDTO; ...@@ -11,7 +11,9 @@ import com.skua.modules.equipment.dto.ReportStatisticsDTO;
11 import com.skua.modules.equipment.mapper.ProductionEquipmentMapper; 11 import com.skua.modules.equipment.mapper.ProductionEquipmentMapper;
12 import com.skua.modules.equipment.service.IProductionEquipmentService; 12 import com.skua.modules.equipment.service.IProductionEquipmentService;
13 import com.skua.modules.equipment.vo.*; 13 import com.skua.modules.equipment.vo.*;
14 import com.skua.tool.util.DateUtils;
14 import com.skua.tool.util.JSUtils; 15 import com.skua.tool.util.JSUtils;
16 import io.swagger.annotations.ApiModelProperty;
15 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.stereotype.Service; 18 import org.springframework.stereotype.Service;
17 import org.springframework.transaction.annotation.Transactional; 19 import org.springframework.transaction.annotation.Transactional;
...@@ -218,7 +220,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -218,7 +220,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
218 //本月新增 220 //本月新增
219 productionEquipmentVO.setIncrease(increase); 221 productionEquipmentVO.setIncrease(increase);
220 //设备完好率 222 //设备完好率
221 BigDecimal bigDecimal = new BigDecimal(v*100).setScale(2, BigDecimal.ROUND_HALF_UP); 223 BigDecimal bigDecimal = new BigDecimal(ConvertUtils.getDou(v,0d)*100).setScale(2, BigDecimal.ROUND_HALF_UP);
222 productionEquipmentVO.setEquipmentIntactRate(bigDecimal.toString() + "%"); 224 productionEquipmentVO.setEquipmentIntactRate(bigDecimal.toString() + "%");
223 //设备完好总台日 225 //设备完好总台日
224 BigDecimal bigDecimal5 = new BigDecimal(goodDay).setScale(2, BigDecimal.ROUND_HALF_UP); 226 BigDecimal bigDecimal5 = new BigDecimal(goodDay).setScale(2, BigDecimal.ROUND_HALF_UP);
...@@ -387,6 +389,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -387,6 +389,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
387 List<Map<String,Object>> mapList = commonSqlService.queryForList(dict_sql); 389 List<Map<String,Object>> mapList = commonSqlService.queryForList(dict_sql);
388 List<String> categoryNameList = new ArrayList<>(); 390 List<String> categoryNameList = new ArrayList<>();
389 List<String> categoryIdList = new ArrayList<>();*/ 391 List<String> categoryIdList = new ArrayList<>();*/
392 String startTime;
393 String endTime = DateUtils.getDateByAfterMonth(0);//当前日期
394 if (6 == reportStatisticsDTO.getTimeUnit()) {
395 startTime = DateUtils.getDateByAfterMonth(-6);
396 } else {
397 startTime = DateUtils.getDateByAfterMonth(-12);
398 }
399 reportStatisticsDTO.setStartTime(startTime);
400 reportStatisticsDTO.setEndTime(endTime);
390 return productionEquipmentMapper.getEquipmentStatisticsDetailsNew(pageList,reportStatisticsDTO); 401 return productionEquipmentMapper.getEquipmentStatisticsDetailsNew(pageList,reportStatisticsDTO);
391 } 402 }
392 @Override 403 @Override
...@@ -491,7 +502,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -491,7 +502,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
491 List<ContrastVO> list = new ArrayList<>(); 502 List<ContrastVO> list = new ArrayList<>();
492 List<Map> rate = null; 503 List<Map> rate = null;
493 List<Map> onYearRate = new ArrayList<>(); 504 List<Map> onYearRate = new ArrayList<>();
494 if (reportStatisticsDTO.getTimeUnit() == 6) { 505 if (6 == reportStatisticsDTO.getTimeUnit()) {
495 rate = productionEquipmentMapper.getHalfIntactRate(); 506 rate = productionEquipmentMapper.getHalfIntactRate();
496 onYearRate = productionEquipmentMapper.getHalfIntactYearOnYearRate(); 507 onYearRate = productionEquipmentMapper.getHalfIntactYearOnYearRate();
497 } else { 508 } else {
...@@ -627,6 +638,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -627,6 +638,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
627 638
628 //设备完好率详情(新) 639 //设备完好率详情(新)
629 public List<Map> getEquipmentIntactRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO) { 640 public List<Map> getEquipmentIntactRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO) {
641 String startTime;
642 String endTime = DateUtils.getDateByAfterMonth(0);//当前日期
643 if (6 == reportStatisticsDTO.getTimeUnit()) {
644 startTime = DateUtils.getDateByAfterMonth(-6);
645 } else {
646 startTime = DateUtils.getDateByAfterMonth(-12);
647 }
648 reportStatisticsDTO.setStartTime(startTime);
649 reportStatisticsDTO.setEndTime(endTime);
630 return productionEquipmentMapper.getEquipmentIntactRateDetailsNew(reportStatisticsDTO); 650 return productionEquipmentMapper.getEquipmentIntactRateDetailsNew(reportStatisticsDTO);
631 } 651 }
632 @Override 652 @Override
...@@ -636,7 +656,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -636,7 +656,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
636 List<Map> MTBF = new ArrayList<>(); 656 List<Map> MTBF = new ArrayList<>();
637 //平均修复时间 657 //平均修复时间
638 List<Map> MTTR = new ArrayList<>(); 658 List<Map> MTTR = new ArrayList<>();
639 if (reportStatisticsDTO.getTimeUnit() == 6) { 659 if (6 == reportStatisticsDTO.getTimeUnit()) {
640 MTBF = productionEquipmentMapper.getHalfIntactMTBF(); //平均故障时间 660 MTBF = productionEquipmentMapper.getHalfIntactMTBF(); //平均故障时间
641 MTTR = productionEquipmentMapper.getHalfIntactMTTR(); 661 MTTR = productionEquipmentMapper.getHalfIntactMTTR();
642 } else { 662 } else {
...@@ -786,7 +806,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -786,7 +806,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
786 List<ContrastVO> contrastVOS = new ArrayList<>(); 806 List<ContrastVO> contrastVOS = new ArrayList<>();
787 List<Map> completeRate = new ArrayList<>(); 807 List<Map> completeRate = new ArrayList<>();
788 List<Map> completeYearOnYearRate = new ArrayList<>(); 808 List<Map> completeYearOnYearRate = new ArrayList<>();
789 if (reportStatisticsDTO.getTimeUnit() == 6) { 809 if (6 == reportStatisticsDTO.getTimeUnit()) {
790 completeRate = productionEquipmentMapper.getHalfIntactCompleteRate(); 810 completeRate = productionEquipmentMapper.getHalfIntactCompleteRate();
791 completeYearOnYearRate = productionEquipmentMapper.getHalfIntactCompleteYearOnYearRate(); 811 completeYearOnYearRate = productionEquipmentMapper.getHalfIntactCompleteYearOnYearRate();
792 } else { 812 } else {
...@@ -834,6 +854,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -834,6 +854,15 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
834 * @return 854 * @return
835 */ 855 */
836 public List<Map> getMaintainCompleteRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO) { 856 public List<Map> getMaintainCompleteRateDetailsNew(ReportStatisticsDTO reportStatisticsDTO) {
857 String startTime;
858 String endTime = DateUtils.getDateByAfterMonth(0);//当前日期
859 if (6 == reportStatisticsDTO.getTimeUnit() ) {
860 startTime = DateUtils.getDateByAfterMonth(-6);
861 } else {
862 startTime = DateUtils.getDateByAfterMonth(-12);
863 }
864 reportStatisticsDTO.setStartTime(startTime);
865 reportStatisticsDTO.setEndTime(endTime);
837 return productionEquipmentMapper.getMaintainCompleteRateDetails(reportStatisticsDTO); 866 return productionEquipmentMapper.getMaintainCompleteRateDetails(reportStatisticsDTO);
838 } 867 }
839 @Override 868 @Override
...@@ -941,7 +970,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -941,7 +970,7 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
941 List<ContrastVO> list = new ArrayList<>(); 970 List<ContrastVO> list = new ArrayList<>();
942 List<Map> contrastCost = new ArrayList<>(); 971 List<Map> contrastCost = new ArrayList<>();
943 972
944 if (reportStatisticsDTO.getTimeUnit() == 6) {//半年 973 if (6 == reportStatisticsDTO.getTimeUnit() ) {//半年
945 contrastCost = productionEquipmentMapper.getHalfIntactContrastCost(reportStatisticsDTO.getDepartIds()); 974 contrastCost = productionEquipmentMapper.getHalfIntactContrastCost(reportStatisticsDTO.getDepartIds());
946 } else { 975 } else {
947 contrastCost = productionEquipmentMapper.getOneYearContrastCost(reportStatisticsDTO.getDepartIds()); 976 contrastCost = productionEquipmentMapper.getOneYearContrastCost(reportStatisticsDTO.getDepartIds());
...@@ -962,6 +991,16 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi ...@@ -962,6 +991,16 @@ public class ProductionEquipmentServiceImpl implements IProductionEquipmentServi
962 //维护维修费用详情 991 //维护维修费用详情
963 @Override 992 @Override
964 public List<Map> getContrastCostDetails(ReportStatisticsDTO reportStatisticsDTO) { 993 public List<Map> getContrastCostDetails(ReportStatisticsDTO reportStatisticsDTO) {
994
995 String startTime;
996 String endTime = DateUtils.getDateByAfterMonth(0);//当前日期
997 if (6 == reportStatisticsDTO.getTimeUnit()) {
998 startTime = DateUtils.getDateByAfterMonth(-6);
999 } else {
1000 startTime = DateUtils.getDateByAfterMonth(-12);
1001 }
1002 reportStatisticsDTO.setStartTime(startTime);
1003 reportStatisticsDTO.setEndTime(endTime);
965 return productionEquipmentMapper.getContrastCostDetails(reportStatisticsDTO); 1004 return productionEquipmentMapper.getContrastCostDetails(reportStatisticsDTO);
966 } 1005 }
967 1006
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!