From fd17bbf485efb4f96a5fe5efc42d23e0534de662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Thu, 3 Aug 2023 16:04:39 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=8F=90=E4=BA=A4middle=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql b/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql index 31cd566..a4d1b49 100644 --- a/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql +++ b/hzims-service/hzims-middle/src/main/resources/db/1.0.1.sql @@ -1,3 +1,5 @@ +alter table hzims_workflow_operation_log add is_operation_log tinyint(1) comment '1 正常日志 0 错误日志'; +alter table hzims_statistics add sort int comment '排序'; create table log_options_module_name ( id bigint primary key auto_increment, From 045a8bad31cbf491741a0f962809c3e5b35a853f Mon Sep 17 00:00:00 2001 From: tyty Date: Thu, 3 Aug 2023 16:51:41 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=BA=93=E5=AD=98=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=A2=84=E8=AD=A6=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java index e8c5d55..981f9f7 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/aspect/LimitRemindAspect.java @@ -171,9 +171,9 @@ public class LimitRemindAspect { private void warningPush(String alert, User pusher,Long warehouseId) { MessagePushRecordDto message = new MessagePushRecordDto(); - message.setBusinessClassify("business"); - message.setBusinessKey(MessageConstants.BusinessClassifyEnum.ASSETS.getKey()); - message.setSubject(MessageConstants.BusinessClassifyEnum.ASSETS.getDescription()); + message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.ASSETS.getKey()); + message.setBusinessKey("资产预警"); + message.setSubject("资产预警"); message.setTaskId(warehouseId); message.setTenantId("200000"); message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH)); @@ -191,7 +191,7 @@ public class LimitRemindAspect { } message.setPusher(userId.toString()); message.setPusherName(pusher.getName()); - message.setAccount(pusher.getAccount()); + message.setAccount(pusher.getId().toString()); message.setCreateUser(userId); messageClient.sendMessage(message); From 3f049061b81d9d13f4f1344231c4273eed1a54ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Thu, 3 Aug 2023 16:56:12 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9middle=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../middle/systemlog/service/impl/StatisticsServiceImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java index 581533f..6a279e0 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java @@ -109,8 +109,12 @@ public class StatisticsServiceImpl extends ServiceImpl selectPage(Page page1, StatisticsVo statistics) { - statistics.setCreateTime(statistics.getCreateTime().substring(0, 10)); - statistics.setEndTime(statistics.getEndTime().substring(0, 10)); + if (statistics.getCreateTime() != null) { + statistics.setCreateTime(statistics.getCreateTime().substring(0, 10)); + } + if (statistics.getEndTime() != null) { + statistics.setEndTime(statistics.getEndTime().substring(0, 10)); + } IPage statisticsResponseVoIPage = baseMapper.selectPages(page1, statistics); // List records = statisticsResponseVoIPage.getRecords(); // List collect = records.stream().sorted(Comparator.comparing(StatisticsResponseVo::getSort)).collect(Collectors.toList()); From 75168758ac4f24e9613f929638e692390066067f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Thu, 3 Aug 2023 17:11:39 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9ticket=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ticket/src/main/resources/db/2.0.0.sql | 40 +++++++++++++--------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/hzims-service/ticket/src/main/resources/db/2.0.0.sql b/hzims-service/ticket/src/main/resources/db/2.0.0.sql index 28979e5..ecd99b4 100644 --- a/hzims-service/ticket/src/main/resources/db/2.0.0.sql +++ b/hzims-service/ticket/src/main/resources/db/2.0.0.sql @@ -100,29 +100,35 @@ SET FOREIGN_KEY_CHECKS=1; -- auto-generated definition +-- auto-generated definition create table hzims_ticket_count ( - id bigint auto_increment comment '主键ID' + id bigint auto_increment comment '主键ID' primary key, - date_time varchar(20) null comment '日期', - dept_id bigint null comment '站点Id', - dept_name varchar(100) null comment '站点名称', - ticket_type varchar(255) null comment '票据类型', - ticket_number int null comment '开票数量', - ticket_complete_num int null comment '完成数量', - ticket_delay_num int null comment '延期数量', - ticket_proportion_num int null comment '合格数量', - create_time datetime default CURRENT_TIMESTAMP null comment '创建时间', - update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间', - is_deleted tinyint(1) default 0 null comment '逻辑删除', - tenant_id varchar(12) null comment '租户ID', - create_dept varchar(30) null comment '创建部门', - status tinyint null, - create_user bigint not null comment '创建人', - update_user bigint null + date_time varchar(20) null comment '日期', + dept_id bigint null comment '站点Id', + dept_name varchar(100) null comment '站点名称', + ticket_type varchar(255) null comment '票据类型', + ticket_number int null comment '开票数量', + ticket_complete_num int null comment '完成数量', + ticket_delay_num int null comment '延期数量', + ticket_proportion_num int null comment '合格数量', + create_time datetime default CURRENT_TIMESTAMP null comment '创建时间', + update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间', + is_deleted tinyint(1) default 0 null comment '逻辑删除', + tenant_id varchar(12) null comment '租户ID', + create_dept varchar(30) null comment '创建部门', + status tinyint null, + create_user bigint not null comment '创建人', + update_user bigint null, + invalidated_ticket_num int null comment '废票数量', + wrong_ticket_num int null comment '错票数量', + percent_pass_ticket varchar(50) null comment '合格率' ) comment '两票统计分析' row_format = DYNAMIC; + + insert into hzims_work_ticket_finish(ticket_id, ground_num, brake_number) select ticket_id, ground_switch_count,ground_wire_code from hzims_work_ticket_flow; From feb67734aef518092cf9661af2a0ca8eb070a5b9 Mon Sep 17 00:00:00 2001 From: tyty Date: Thu, 3 Aug 2023 17:22:30 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=B0=B4=E7=94=B5=E7=AB=99=E6=9C=88?= =?UTF-8?q?=E6=8A=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/controller/AreaMonthReportController.java | 4 +- .../main/service/IAreaMonthReportService.java | 2 +- .../service/impl/AreaMonthReportServiceImpl.java | 148 +++++++++++---------- 3 files changed, 80 insertions(+), 74 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java index 38638c5..d0db6d4 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java @@ -123,11 +123,11 @@ public class AreaMonthReportController extends BladeController { @ApiOperation("导出水电站月报") @GetMapping("/exportHydropowerStationMonthReport") public R exportHydropowerStationMonthReport(HttpServletResponse response, @ApiParam(value = "日期-年", required = true) Integer year,@ApiParam(value = "日期-月", required = true) Integer month, - @ApiParam(value = "日期-日", required = true) Integer date,@ApiParam(value = "站点Id", required = true) Long stationId,@ApiParam(value = "月报类型", required = true) Long type) { + @ApiParam(value = "站点Id", required = true) Long deptId,@ApiParam(value = "月报类型", required = true) Long type) { HashMap map = new HashMap<>(); if (type==1){ - service.exportHydropowerStationMonthReport(response, map,year,month,date,stationId); + service.exportHydropowerStationMonthReport(response, map,year,month,deptId); //word模板相对路径、word生成路径、word生成的文件名称、数据源 } XWPFDocument xwpfDocument = WordUtils.exportWordV2("template/waterMonReport.docx", map); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java index 3cf0c3a..e8007a3 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java @@ -18,5 +18,5 @@ public interface IAreaMonthReportService { R export(HttpServletResponse response, String date); - R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap map, Integer year, Integer month, Integer date,Long stationId); + R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap map, Integer year, Integer month,Long deptId); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java index 77f6308..67ec81b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java @@ -202,7 +202,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { return R.data("success"); } @Override - public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap map, Integer year, Integer month, Integer date, Long deptId) { + public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap map, Integer year, Integer month, Long deptId) { R> deptByCurrentUser = sysClient.getDeptByCurrentUser(); if (!deptByCurrentUser.isSuccess()||deptByCurrentUser.getData()!=null){ return R.fail("用户权限查询失败"); @@ -239,7 +239,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { map.put("month", month); Integer monthBefore = month - 1; map.put("monthBefore", monthBefore); - map.put("date", date); +// map.put("date", date); map.put("commissionTime", commissionTime.toString()); map.put("stationName", deptName); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日"); @@ -274,6 +274,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { .mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum(); BigDecimal sumData=new BigDecimal(sum).divide(new BigDecimal(1000),2,BigDecimal.ROUND_UP); map.put("installedCapacity", sumData); + //各站点分组 Map> listMap = Optional.ofNullable(realsByDept) .orElse(new ArrayList<>()).stream() @@ -295,75 +296,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { ImageEntity capacityProportionChart = JFreeUtil.pieChartByDouble("水电项目装机容量占比图", capacityProportionMap, 500, 400); map.put("capacityProportionChart", capacityProportionChart); //各发电站发电量环比图+表格数据组装 - List deptIdsString = deptIds.stream().map(s -> String.valueOf(s)).collect(Collectors.toList()); - List planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString()); - List powerPercentageVoList = new ArrayList<>(); - //水电站,光伏站和带代运维数据近三年数据 - Map> powerMapThree = (Map>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA); - List listByYear = TimeUtils.getListByYear(year); - List listByYearBefore = TimeUtils.getListByYear(yearBefore); - String monStart = TimeUtils.getMon(year, month); - String monStartYearBefore = TimeUtils.getMon(yearBefore, month); - String monStartMonBefore = TimeUtils.getMon(year, monthBefore); - for (Map.Entry> deviceMap : powerMapThree.entrySet()) { - String deptNameByKey = ""; - if (stationIds.contains(deviceMap.getKey())) { - MonPowerPercentageVo powerVo = new MonPowerPercentageVo(); - powerVo.setDeptId(deviceMap.getKey()); - List collect = stationEntityList.stream().filter(s -> deviceMap.getKey().equals(s.getId())).collect(Collectors.toList()); - if (collect!=null) { - Long dept = collect.get(0).getRefDept(); - List dep = deptList.stream().filter(s -> dept.equals(s.getId())).collect(Collectors.toList()); - deptNameByKey=dep.get(0).getDeptName(); - } - powerVo.setDeptName(deptNameByKey); - BigDecimal powerYear = new BigDecimal(0); - BigDecimal powerYearBefore = new BigDecimal(0); - BigDecimal powerMonth = new BigDecimal(0); - BigDecimal powerMonthBefore = new BigDecimal(0); - BigDecimal powerMonthYearBefore = new BigDecimal(0); - Double planGeneration = 0d; - List planGenerationById = planYearData.stream().filter(s -> collect.get(0).getRefDept().equals(s.getStationDeptId())).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(planGenerationById)) { - planGeneration = Double.valueOf(planGenerationById.get(0).getPlanGeneration()); - } - //当前机构近三年的数据 - Map value = deviceMap.getValue(); - //今年发电量 - powerYear=value.entrySet().stream().filter(s->listByYear.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); - //转换单位kwh-》万Kwh - powerYear=powerYear.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); - powerYearBefore=value.entrySet().stream().filter(s->listByYearBefore.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); - powerYearBefore=powerYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); - powerMonth=value.entrySet().stream().filter(s->monStart.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); - powerMonth=powerMonth.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); - powerMonthBefore=value.entrySet().stream().filter(s->monStartMonBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); - powerMonthBefore=powerMonthBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); - powerMonthYearBefore=value.entrySet().stream().filter(s->monStartYearBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); - powerMonthYearBefore=powerMonthYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); - powerVo.setPowerYear(powerYear.doubleValue()); - powerVo.setPowerYearBefore(powerYearBefore.doubleValue()); - BigDecimal yearPercentage = new BigDecimal(0); - BigDecimal planPercentage = new BigDecimal(0); - if (powerYearBefore.compareTo(BigDecimal.ZERO) != 0) { - yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP); - } - if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) { - planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP); - } - powerVo.setPlanPercentage(planPercentage.doubleValue()); - powerVo.setPowerYearPercentage(yearPercentage.doubleValue()); - powerVo.setPowerMon(powerMonth.doubleValue()); - powerVo.setPowerMonBefore(powerMonthBefore.doubleValue()); - powerVo.setPowerMonYearBefore(powerMonthYearBefore.doubleValue()); - BigDecimal monPercentage = new BigDecimal(0); - if (powerMonthYearBefore.compareTo(BigDecimal.ZERO) != 0) { - monPercentage = (powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP); - } - powerVo.setPowerMonPercentage(monPercentage.doubleValue()); - powerPercentageVoList.add(powerVo); - } - } + List powerPercentageVoList = getMonPowerPercentageVos(year, month, deptList, deptIds, stationEntityList, stationIds, yearBefore, monthBefore); // getPowerData(deptList, yearStart, yearEnd, yearBeforeStart, yearBeforeEnd, monthStart, monthEnd, beforeMonthStart, beforeMonthEnd, monthStartBeforeYear, monthEndBeforeYear, devices, planYearData, powerPercentageVoList); // 各发电站发电量环比图数据组装 //柱状图图数据 @@ -688,6 +621,79 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { return R.success("成功"); } + private List getMonPowerPercentageVos(Integer year, Integer month, List deptList, List deptIds, List stationEntityList, List stationIds, Integer yearBefore, Integer monthBefore) { + List deptIdsString = deptIds.stream().map(s -> String.valueOf(s)).collect(Collectors.toList()); + List planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString()); + List powerPercentageVoList = new ArrayList<>(); + //水电站,光伏站和带代运维数据近三年数据 + Map> powerMapThree = (Map>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA); + List listByYear = TimeUtils.getListByYear(year); + List listByYearBefore = TimeUtils.getListByYear(yearBefore); + String monStart = TimeUtils.getMon(year, month); + String monStartYearBefore = TimeUtils.getMon(yearBefore, month); + String monStartMonBefore = TimeUtils.getMon(year, monthBefore); + for (Map.Entry> deviceMap : powerMapThree.entrySet()) { + String deptNameByKey = ""; + if (stationIds.contains(deviceMap.getKey())) { + MonPowerPercentageVo powerVo = new MonPowerPercentageVo(); + powerVo.setDeptId(deviceMap.getKey()); + List collect = stationEntityList.stream().filter(s -> deviceMap.getKey().equals(s.getId())).collect(Collectors.toList()); + if (collect!=null) { + Long dept = collect.get(0).getRefDept(); + List dep = deptList.stream().filter(s -> dept.equals(s.getId())).collect(Collectors.toList()); + deptNameByKey=dep.get(0).getDeptName(); + } + powerVo.setDeptName(deptNameByKey); + BigDecimal powerYear = new BigDecimal(0); + BigDecimal powerYearBefore = new BigDecimal(0); + BigDecimal powerMonth = new BigDecimal(0); + BigDecimal powerMonthBefore = new BigDecimal(0); + BigDecimal powerMonthYearBefore = new BigDecimal(0); + Double planGeneration = 0d; + List planGenerationById = planYearData.stream().filter(s -> collect.get(0).getRefDept().equals(s.getStationDeptId())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(planGenerationById)) { + planGeneration = Double.valueOf(planGenerationById.get(0).getPlanGeneration()); + } + //当前机构近三年的数据 + Map value = deviceMap.getValue(); + //今年发电量 + powerYear=value.entrySet().stream().filter(s->listByYear.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); + //转换单位kwh-》万Kwh + powerYear=powerYear.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); + powerYearBefore=value.entrySet().stream().filter(s->listByYearBefore.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); + powerYearBefore=powerYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); + powerMonth=value.entrySet().stream().filter(s->monStart.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); + powerMonth=powerMonth.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); + powerMonthBefore=value.entrySet().stream().filter(s->monStartMonBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); + powerMonthBefore=powerMonthBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); + powerMonthYearBefore=value.entrySet().stream().filter(s->monStartYearBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); + powerMonthYearBefore=powerMonthYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); + powerVo.setPowerYear(powerYear.doubleValue()); + powerVo.setPowerYearBefore(powerYearBefore.doubleValue()); + BigDecimal yearPercentage = new BigDecimal(0); + BigDecimal planPercentage = new BigDecimal(0); + if (powerYearBefore.compareTo(BigDecimal.ZERO) != 0) { + yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP); + } + if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) { + planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP); + } + powerVo.setPlanPercentage(planPercentage.doubleValue()); + powerVo.setPowerYearPercentage(yearPercentage.doubleValue()); + powerVo.setPowerMon(powerMonth.doubleValue()); + powerVo.setPowerMonBefore(powerMonthBefore.doubleValue()); + powerVo.setPowerMonYearBefore(powerMonthYearBefore.doubleValue()); + BigDecimal monPercentage = new BigDecimal(0); + if (powerMonthYearBefore.compareTo(BigDecimal.ZERO) != 0) { + monPercentage = (powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP); + } + powerVo.setPowerMonPercentage(monPercentage.doubleValue()); + powerPercentageVoList.add(powerVo); + } + } + return powerPercentageVoList; + } + private void getPowerData(List deptList, String yearStart, String yearEnd, String yearBeforeStart, String yearBeforeEnd, String monthStart, String monthEnd, String beforeMonthStart, String beforeMonthEnd, String monthStartBeforeYear, String monthEndBeforeYear, List devices, List planYearData, List powerPercentageVoList) { for (Dept dept : deptList) { MonPowerPercentageVo powerVo = new MonPowerPercentageVo(); From f2127fdb16215c3b1c439b808aa80e019e9252f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Fri, 4 Aug 2023 09:56:12 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E4=B8=A4=E7=A5=A8?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=90=88=E6=A0=BC=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../standardTicket/service/impl/StandardTicketInfoServiceImpl.java | 4 +++- .../hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java index ab8a946..4da8447 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java @@ -729,7 +729,9 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl createDept = userClient.getDataScope(bladeUser.getUserId()); - + log.info("================================================================"); + log.info("获取权限Id =======================> ", createDept); + log.info("================================================================"); StandardTicketInfoDto standardTicketInfoDto = new StandardTicketInfoDto(); BeanUtils.copyProperties(ticketCountQueryVo, standardTicketInfoDto); LambdaQueryWrapper queryWrapper = this.getQueryWrapper(standardTicketInfoDto); diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java index 1b94fa1..915a6ea 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java @@ -405,7 +405,8 @@ public class TicketCountServiceImpl extends BaseServiceImpl getStandardTicketCountList(List createDept, List items, String ticketType, String dateTime, BladeUser user) { + private List + getStandardTicketCountList(List createDept, List items, String ticketType, String dateTime, BladeUser user) { List ticketInfoEntities = standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType, dateTime); if (CollectionUtils.isEmpty(ticketInfoEntities)) { @@ -459,6 +460,7 @@ public class TicketCountServiceImpl extends BaseServiceImpl evaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList); evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1); + evaluateEntityLambdaQueryWrapper.groupBy(TicketInfoEvaluateEntity::getTicketId); List evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper); ticketCount.setTicketProportionNum(evaluateEntities.size()); @@ -549,6 +551,7 @@ public class TicketCountServiceImpl extends BaseServiceImpl evaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList); evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1); + evaluateEntityLambdaQueryWrapper.groupBy(TicketInfoEvaluateEntity::getTicketId); List evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper); ticketCount.setTicketProportionNum(evaluateEntities.size());