diff --git a/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java b/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java index 9551d9e..972cffb 100644 --- a/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java +++ b/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/interceptor/ParamSecureHandler.java @@ -229,6 +229,7 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor { * 判断是否越权 */ private boolean checkIsYq(HttpServletRequest request) throws Exception { + String head=request.getHeader(SecurityConstants.FROM_SOURCE); if(SecurityConstants.INNER.equals(head)){ return true; diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/SjMaxDeviceServiceImpl.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/SjMaxDeviceServiceImpl.java index 7e8be3e..b09c7cb 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/SjMaxDeviceServiceImpl.java +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/SjMaxDeviceServiceImpl.java @@ -35,16 +35,6 @@ public class SjMaxDeviceServiceImpl implements SjMaxDeviceService{ String endTime = endDate.toString(); o.setStartTime(startTime); o.setEndTime(endTime); - String sql = "SELECT DATE_ADD("+startTime+", INTERVAL (ones.a + tens.a * 10) DAY) AS dt\n" + - " FROM\n" + - " (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3\n" + - " UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7\n" + - " UNION ALL SELECT 8 UNION ALL SELECT 9) AS ones\n" + - " CROSS JOIN\n" + - " (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3\n" + - " UNION ALL SELECT 4 UNION ALL SELECT 5) AS tens\n" + - " WHERE DATE_ADD("+startTime+", INTERVAL (ones.a + tens.a * 10) DAY) <= "+endTime; - o.setSql(sql); List workerList = mapper.selectWorkerEcharts(o); result.put("workerEcharts", workerList); result.put("todayDutyRate", 0); @@ -56,15 +46,16 @@ public class SjMaxDeviceServiceImpl implements SjMaxDeviceService{ } } //整体人员利用率和设备使用率 - double totalActualCount = list.stream() + double totalActualCount = workerList.stream() .mapToDouble(SjMaxDevice::getActualCount) .sum(); - double totalShouldCount = list.stream() + double totalShouldCount = workerList.stream() .mapToDouble(SjMaxDevice::getShouldCount) .sum(); double workerUtilization = 0; if (totalShouldCount > 0) { workerUtilization = (totalActualCount / totalShouldCount) * 100; + workerUtilization = (double) Math.round(workerUtilization * 10.0) / 10.0; } result.put("workerUtilization", workerUtilization); double totalUsedDay = list.stream() @@ -76,6 +67,7 @@ public class SjMaxDeviceServiceImpl implements SjMaxDeviceService{ double deviceUtilization = 0; if (totalShouldCount > 0) { deviceUtilization = (totalUsedDay / totalEinDay) * 100; + deviceUtilization = (double) Math.round(deviceUtilization * 10.0) / 10.0; } result.put("deviceUtilization", deviceUtilization); //效率分析 diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/SjProjectSafetyServiceImpl.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/SjProjectSafetyServiceImpl.java index ff8f4f4..12014f5 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/SjProjectSafetyServiceImpl.java +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/SjProjectSafetyServiceImpl.java @@ -1,7 +1,11 @@ package com.securitycontrol.screen.service.impl; +import com.securitycontrol.common.core.constant.SecurityConstants; +import com.securitycontrol.common.core.domain.Result; import com.securitycontrol.common.core.web.domain.AjaxResult; import com.securitycontrol.screen.service.SjProjectSafetyService; +import com.securitycontrol.system.api.RemoteFileService; +import com.securitycontrol.system.api.domain.SysFile; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; @@ -19,6 +23,9 @@ public class SjProjectSafetyServiceImpl implements SjProjectSafetyService { @Resource private SjProjectSafetyMapper mapper; + @Resource + private RemoteFileService remoteFileService; + @Override public List selectProSafetyLedger(SjProjectSafety o) { @@ -27,6 +34,11 @@ public class SjProjectSafetyServiceImpl implements SjProjectSafetyService { @Override public List selectProSafetyVideo(SjProjectSafety o) { + List sjProjectSafeties = mapper.selectProSafetyVideo(o); + sjProjectSafeties.forEach(data -> { + Result result= remoteFileService.getFileBast64(data.getImagePath(), SecurityConstants.INNER); + data.setImagePath(result.getData().getUrl()); + }); return mapper.selectProSafetyVideo(o); } diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjConstructionProgressMapper.xml b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjConstructionProgressMapper.xml index c5cf558..4bbf15e 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjConstructionProgressMapper.xml +++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjConstructionProgressMapper.xml @@ -66,7 +66,18 @@ SELECT COALESCE(p_summary.planned_count, 0) AS planned_count, COALESCE(a_summary.actual_count, 0) AS actual_count FROM ( - #{sql} + + SELECT DATE_ADD(#{startTime}, INTERVAL (ones.a + tens.a * 10) DAY) AS dt + FROM + (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 + UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 + UNION ALL SELECT 8 UNION ALL SELECT 9) AS ones + CROSS JOIN + (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 + UNION ALL SELECT 4 UNION ALL SELECT 5) AS tens + WHERE DATE_ADD(#{startTime}, INTERVAL (ones.a + tens.a * 10) DAY) <= #{endTime} + + ) AS date_list LEFT JOIN ( SELECT @@ -74,7 +85,15 @@ SELECT p.pro_type, COUNT(p.id) AS planned_count FROM ( - #{sql} + SELECT DATE_ADD(#{startTime}, INTERVAL (ones.a + tens.a * 10) DAY) AS dt + FROM + (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 + UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 + UNION ALL SELECT 8 UNION ALL SELECT 9) AS ones + CROSS JOIN + (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 + UNION ALL SELECT 4 UNION ALL SELECT 5) AS tens + WHERE DATE_ADD(#{startTime}, INTERVAL (ones.a + tens.a * 10) DAY) <= #{endTime} ) AS dl_inner INNER JOIN sj_construction_progress p ON dl_inner.dt BETWEEN p.plan_start_time AND p.plan_end_time @@ -86,7 +105,15 @@ SELECT a.pro_type, COUNT(a.id) AS actual_count FROM ( - #{sql} + SELECT DATE_ADD(#{startTime}, INTERVAL (ones.a + tens.a * 10) DAY) AS dt + FROM + (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 + UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 + UNION ALL SELECT 8 UNION ALL SELECT 9) AS ones + CROSS JOIN + (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 + UNION ALL SELECT 4 UNION ALL SELECT 5) AS tens + WHERE DATE_ADD(#{startTime}, INTERVAL (ones.a + tens.a * 10) DAY) <= #{endTime} ) AS dl_inner INNER JOIN sj_construction_progress a ON dl_inner.dt BETWEEN a.start_time AND a.end_time diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjEnergyReductionMapper.xml b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjEnergyReductionMapper.xml index f23c89e..cd93213 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjEnergyReductionMapper.xml +++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjEnergyReductionMapper.xml @@ -100,7 +100,15 @@ (SELECT DISTINCT type FROM sj_energy_reduction WHERE type IS NOT NULL) t CROSS JOIN -- 生成日期序列 - ( #{sql} ) AS date_list + ( SELECT DATE_ADD(#{startTime}, INTERVAL (ones.a + tens.a * 10) DAY) AS dt + FROM + (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 + UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 + UNION ALL SELECT 8 UNION ALL SELECT 9) AS ones + CROSS JOIN + (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 + UNION ALL SELECT 4 UNION ALL SELECT 5) AS tens + WHERE DATE_ADD(#{startTime}, INTERVAL (ones.a + tens.a * 10) DAY) <= #{endTime} ) AS date_list LEFT JOIN sj_energy_reduction e ON t.type = e.type AND date_list.dt = e.create_time diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjMaxDeviceMapper.xml b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjMaxDeviceMapper.xml index 0618490..7cf8f7d 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjMaxDeviceMapper.xml +++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/SjMaxDeviceMapper.xml @@ -25,19 +25,22 @@