省侧大屏

This commit is contained in:
cwchen 2024-03-28 16:36:50 +08:00
parent c16ba37ecf
commit cab920a18c
3 changed files with 55 additions and 17 deletions

View File

@ -4,6 +4,7 @@ import com.securitycontrol.entity.screen.dto.ScreenParamDto;
import com.securitycontrol.entity.screen.vo.ConstrQuality; import com.securitycontrol.entity.screen.vo.ConstrQuality;
import com.securitycontrol.entity.screen.vo.MapRiskVo; import com.securitycontrol.entity.screen.vo.MapRiskVo;
import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@ -124,12 +125,25 @@ public interface IScIndexMapper {
/** /**
* 效率分析工程进度分析 * 效率分析工程进度分析
*
* @param dto * @param dto
* @return List<Map < Object>> * @return List<Map < Object>>
* @description * @description
* @author cwchen * @author cwchen
* @date 2024/3/28 13:47 * @date 2024/3/28 13:47
*/ */
@MapKey("id") @MapKey("orgId")
List<Map<String, Object>> efficiencyAnalysis(ScreenParamDto dto); List<Map<String, Object>> efficiencyAnalysis(ScreenParamDto dto);
/**
* 获取隐患数
* @param orgId
* @param dto
* @return List<Map<String, Object>>
* @description
* @author cwchen
* @date 2024/3/28 15:44
*/
@MapKey("bidCode")
List<Map<String, Object>> getDangerNum(@Param("orgId") String orgId, @Param("params") ScreenParamDto dto);
} }

View File

@ -1,7 +1,6 @@
package com.securitycontrol.screen.service.impl; package com.securitycontrol.screen.service.impl;
import com.securitycontrol.common.core.constant.Constant; import com.securitycontrol.common.core.constant.Constant;
import com.securitycontrol.common.core.utils.StringUtils;
import com.securitycontrol.common.core.utils.aes.DateTimeHelper; import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
import com.securitycontrol.common.core.web.domain.AjaxResult; import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.screen.dto.ScreenParamDto; import com.securitycontrol.entity.screen.dto.ScreenParamDto;
@ -211,7 +210,18 @@ public class ScIndexServiceImpl implements IScIndexService {
dto.setStartTime(timeArr[0]); dto.setStartTime(timeArr[0]);
dto.setEndTime(timeArr[1]); dto.setEndTime(timeArr[1]);
list = mapper.potentialSafetyHazard(dto); list = mapper.potentialSafetyHazard(dto);
// 获取隐患数
list.forEach(item -> {
int num = 0;
List<Map<String, Object>> dangerList = mapper.getDangerNum(String.valueOf(item.get("orgId")), dto);
for (Map<String, Object> map : dangerList) {
Integer dangerNum = Integer.parseInt(String.valueOf(map.get("num")));
if (dangerNum > 0) {
num++;
}
}
item.put("dangerNum", num);
});
} catch (Exception e) { } catch (Exception e) {
log.error("工程安全隐患分析", e); log.error("工程安全隐患分析", e);
} }
@ -222,12 +232,12 @@ public class ScIndexServiceImpl implements IScIndexService {
public AjaxResult resourceUse(ScreenParamDto dto) { public AjaxResult resourceUse(ScreenParamDto dto) {
Map<String, Object> map = new HashMap<>(3); Map<String, Object> map = new HashMap<>(3);
// 人员利用率 设备使用率 能源使用情况 // 人员利用率 设备使用率 能源使用情况
Double personnelRate = new Double(0),deviceRate = new Double(0),energyValue = new Double(1201); Double personnelRate = new Double(0), deviceRate = new Double(0), energyValue = new Double(1201);
try { try {
Future<Double> future = testTaskExecutor.submit(() -> { Future<Double> future = testTaskExecutor.submit(() -> {
log.info("人员利用率-执行线程{}", Thread.currentThread().getName()); log.info("人员利用率-执行线程{}", Thread.currentThread().getName());
List<Integer> personnelList = personnelList = mapper.getPersonnel(dto); List<Integer> personnelList = personnelList = mapper.getPersonnel(dto);
if(personnelList.get(0) == 0 || personnelList.get(1) == 0){ if (personnelList.get(0) == 0 || personnelList.get(1) == 0) {
return new Double(0); return new Double(0);
} }
BigDecimal value = new BigDecimal("0"); BigDecimal value = new BigDecimal("0");
@ -242,13 +252,13 @@ public class ScIndexServiceImpl implements IScIndexService {
log.info("设备使用率-执行线程{}", Thread.currentThread().getName()); log.info("设备使用率-执行线程{}", Thread.currentThread().getName());
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
list = mapper.allDeviceStatus(dto); list = mapper.allDeviceStatus(dto);
if(CollectionUtils.isEmpty(list)){ if (CollectionUtils.isEmpty(list)) {
return new Double(0); return new Double(0);
} }
int onlineNum = 0,totalNum = list.size(); int onlineNum = 0, totalNum = list.size();
for (Map<String, Object> objectMap : list) { for (Map<String, Object> objectMap : list) {
if(Objects.equals(objectMap.get("status"),Constant.ONLINE)){ if (Objects.equals(objectMap.get("status"), Constant.ONLINE)) {
onlineNum ++; onlineNum++;
} }
} }
BigDecimal onlineValue = BigDecimal.valueOf(onlineNum); BigDecimal onlineValue = BigDecimal.valueOf(onlineNum);
@ -260,9 +270,9 @@ public class ScIndexServiceImpl implements IScIndexService {
} catch (Exception e) { } catch (Exception e) {
log.error("资源利用", e); log.error("资源利用", e);
} }
map.put("personnelRate",personnelRate); map.put("personnelRate", personnelRate);
map.put("deviceRate",deviceRate); map.put("deviceRate", deviceRate);
map.put("energyValue",energyValue); map.put("energyValue", energyValue);
return AjaxResult.success(map); return AjaxResult.success(map);
} }
@ -281,18 +291,18 @@ public class ScIndexServiceImpl implements IScIndexService {
BigDecimal value = new BigDecimal("0"); BigDecimal value = new BigDecimal("0");
BigDecimal multipleValue = new BigDecimal("100"); BigDecimal multipleValue = new BigDecimal("100");
for (int i = 0; i < v.size(); i++) { for (int i = 0; i < v.size(); i++) {
if(Objects.nonNull(v.get(i).get("planId")) && Objects.nonNull(v.get(i).get("gxProgress")) && Objects.nonNull(v.get(i).get("gxWeight"))){ if (Objects.nonNull(v.get(i).get("planId")) && Objects.nonNull(v.get(i).get("gxProgress")) && Objects.nonNull(v.get(i).get("gxWeight"))) {
BigDecimal bigDecimal = new BigDecimal(String.valueOf(v.get(i).get("gxWeight"))); BigDecimal bigDecimal = new BigDecimal(String.valueOf(v.get(i).get("gxWeight")));
BigDecimal bigDecimal2 = new BigDecimal(String.valueOf(v.get(i).get("gxProgress"))); BigDecimal bigDecimal2 = new BigDecimal(String.valueOf(v.get(i).get("gxProgress")));
value = value.add(bigDecimal.multiply(bigDecimal2).divide(multipleValue, 3, BigDecimal.ROUND_HALF_UP)); value = value.add(bigDecimal.multiply(bigDecimal2).divide(multipleValue, 3, BigDecimal.ROUND_HALF_UP));
} }
} }
dataMap.put("proName",v.get(0).get("proName")); dataMap.put("proName", v.get(0).get("proName"));
dataMap.put("value",value.doubleValue()); dataMap.put("value", value.doubleValue());
dataList.add(dataMap); dataList.add(dataMap);
}); });
} catch (Exception e) { } catch (Exception e) {
log.error("效率分析(工程进度分析)",e); log.error("效率分析(工程进度分析)", e);
} }
return AjaxResult.success(dataList); return AjaxResult.success(dataList);
} }

View File

@ -131,4 +131,18 @@
)a ON tgp.plan_id = a.planId )a ON tgp.plan_id = a.planId
WHERE tp.del_flag = 0 WHERE tp.del_flag = 0
</select> </select>
<!--获取地市隐患数-->
<select id="getDangerNum" resultType="java.util.Map">
SELECT jwp.bid_no AS bidCode,
IFNULL(a.num,0) AS num
FROM jj_week_plan jwp
LEFT JOIN (
SELECT tw.bid_code,COUNT(tw.bid_code) AS num
FROM tb_warn tw
WHERE tw.warn_time BETWEEN #{params.startTime} AND #{params.endTime}
GROUP BY tw.bid_code
) a ON jwp.bid_no = a.bid_code
WHERE jwp.start_date BETWEEN #{params.startTime} AND #{params.endTime} AND jwp.end_date BETWEEN #{params.startTime} AND #{params.endTime}
AND jwp.build_no = #{orgId}
</select>
</mapper> </mapper>