From ec33a83aa39eedaf39675d4ef7be5f133f556846 Mon Sep 17 00:00:00 2001 From: yb <1113799@qq.com> Date: 星期四, 11 九月 2025 17:37:36 +0800 Subject: [PATCH] 倍率统计报表算法调整 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentMagnificationServiceImpl.java | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentMagnificationServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentMagnificationServiceImpl.java index 0debec7..ff20242 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentMagnificationServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentMagnificationServiceImpl.java @@ -58,12 +58,15 @@ @Override public void savesEquipmentMagnifications(String dateTime) { List<MdcEquipmentMagnification> magnifications = new ArrayList<>(); + List<Equipment> equipmentList = equipmentService.list(); + Map<String,List<MdcDriveTypeParamConfig>> map = new HashMap<>(); + Date now = DateUtils.plusTime(DateUtils.getNow(), -1); //涓昏酱鍊嶇巼 //杩涚粰鍊嶇巼 /* Equipment e = equipmentService.getById("12345678"); List<Equipment> equipmentList = new ArrayList<>(); equipmentList.add(e);*/ - if (org.apache.commons.lang.StringUtils.isNotBlank(dateTime)) { + if (StringUtils.isNotBlank(dateTime)) { try { Date initDate = DateUtils.toDate(dateTime, "yyyyMMdd"); String date = DateUtils.format(initDate,DateUtils.STR_DATE); @@ -73,23 +76,30 @@ } catch (Exception ee) { log.error("鍙傛暟鏍煎紡涓嶅", ee); } + + } - List<Equipment> equipmentList = equipmentService.list(); - Map<String,List<MdcDriveTypeParamConfig>> map = new HashMap<>(); - Date now = DateUtils.plusTime(DateUtils.getNow(), -1); for (Equipment equipment : equipmentList) { Date start = null; + List<String> dates = new ArrayList<>(); //鏌ヨ鏈�鍚庝竴鏉¤褰� - MdcEquipmentMagnification mdcMagnification = super.baseMapper.getMaxStaticsData(equipment.getEquipmentid()); - if (mdcMagnification == null) { - start = DateUtils.plusTime(DateUtils.getNow(), -20); + if (StringUtils.isNotBlank(dateTime)) { + Date initDate = DateUtils.toDate(dateTime, "yyyyMMdd"); + String date = DateUtils.format(initDate,DateUtils.STR_DATE); + dates.add(date); } else { - start = DateUtils.toDate(mdcMagnification.getTheDate(),DateUtils.STR_DATE ); - if (now.toString().equals(start.toString())) { - continue; + MdcEquipmentMagnification mdcMagnification = super.baseMapper.getMaxStaticsData(equipment.getEquipmentid()); + if (mdcMagnification == null) { + start = DateUtils.plusTime(DateUtils.getNow(), -20); + } else { + start = DateUtils.toDate(mdcMagnification.getTheDate(),DateUtils.STR_DATE ); + if (now.toString().equals(start.toString())) { + continue; + } } + dates = DateUtils.getDatesStringList(start,now); } - List<String> dates = DateUtils.getDatesStringList(start,now); + List<MdcDriveTypeParamConfig> list = new ArrayList<>(); if (!map.containsKey(equipment.getDrivetype())) { MdcDriveTypeParamConfig config1 = mdcDriveTypeParamConfigService.getEnglishName(spindlebeilv,equipment.getDrivetype()); @@ -127,8 +137,6 @@ if (!magnifications.isEmpty() && magnifications.size() > 0) { saveBatch(magnifications); } - //鏁版嵁淇濆瓨 - return; } @Override @@ -358,8 +366,8 @@ a.getSpindlebeilv().add(b.getSpindlebeilv()))).ifPresent(result::add); }); for (MdcEquipmentMagnificationDto mdcEquipmentMagnificationDto : result) { - mdcEquipmentMagnificationDto.setSpindlebeilv(mdcEquipmentMagnificationDto.getSpindlebeilv().divide(new BigDecimal(mdcMagnificationVos.size()), 2, RoundingMode.HALF_UP)); mdcEquipmentMagnificationDto.setFeedbeilv(mdcEquipmentMagnificationDto.getFeedbeilv().divide(new BigDecimal(mdcMagnificationVos.size()), 2, RoundingMode.HALF_UP)); + mdcEquipmentMagnificationDto.setSpindlebeilv(mdcEquipmentMagnificationDto.getSpindlebeilv().divide(new BigDecimal(mdcMagnificationVos.size()), 2, RoundingMode.HALF_UP)); } result.sort(Comparator.comparing(MdcEquipmentMagnificationDto::getTheDate)); return result; @@ -367,6 +375,7 @@ private MdcEquipmentMagnificationDto setDataList(List<MdcEquipmentMagnificationDto> list,String date,String equipmentId,MdcEquipmentMagnificationDto mdcMagnificationDto) { MdcEquipmentMagnificationDto result = new MdcEquipmentMagnificationDto(); + result.setTheDate(date); if (list != null && list.size() > 0) { for (MdcEquipmentMagnificationDto mdcEquipmentMagnificationDto : list) { if (date.equals(mdcEquipmentMagnificationDto.getTheDate()) && mdcEquipmentMagnificationDto.getEquipmentId().equals(equipmentId)) { -- Gitblit v1.9.3