Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d05efd92f4
|
|
@ -44,4 +44,10 @@ public class ParamDto {
|
|||
|
||||
@ApiModelProperty(value = "未绑定班组人员")
|
||||
private String unBandingUsers;
|
||||
|
||||
@ApiModelProperty(value = "角色编码")
|
||||
private String roleCode;
|
||||
|
||||
@ApiModelProperty(value = "建管单位")
|
||||
private String orgId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ public class DeviceBdChildVo {
|
|||
|
||||
@ApiModelProperty(value = "区域名称")
|
||||
private String areaName;
|
||||
|
||||
@ApiModelProperty(value = "杆塔ID")
|
||||
private String gtId;
|
||||
/**
|
||||
* 查询条件限制
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -14,4 +14,10 @@ public class ScreenParamDto extends ScreenDto{
|
|||
|
||||
@ApiModelProperty("参数")
|
||||
private String param;
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty("结束时间")
|
||||
private String endTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.securitycontrol.background.controller;
|
||||
|
||||
import com.securitycontrol.background.service.IAppService;
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-28-17:30
|
||||
* @version:1.0
|
||||
* @description:APP-web层
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/index/")
|
||||
public class AppController {
|
||||
|
||||
@Resource(name = "IAppService")
|
||||
private IAppService service;
|
||||
|
||||
@ApiOperation(value = "项目简介")
|
||||
@GetMapping("getProBrief")
|
||||
public AjaxResult getProBrief(ParamDto dto){
|
||||
return service.getProBrief(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "当前登录人绑定工程")
|
||||
@GetMapping("getProsByUser")
|
||||
public AjaxResult getProsByUser(ParamDto dto){
|
||||
return service.getProsByUser(dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.securitycontrol.background.mapper;
|
||||
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-28-17:37
|
||||
* @version:1.0
|
||||
* @description:app数据库访问层
|
||||
*/
|
||||
@Repository(value = "IAppMapper")
|
||||
public interface IAppMapper {
|
||||
|
||||
/**
|
||||
* 项目简介
|
||||
*
|
||||
* @param dto
|
||||
* @return ProVo
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 17:58
|
||||
*/
|
||||
ProVo getProBrief(ParamDto dto);
|
||||
|
||||
/**
|
||||
* 获取工程图片/平面图
|
||||
*
|
||||
* @param proId
|
||||
* @return List<ResourceFileVo>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 18:09
|
||||
*/
|
||||
List<ResourceFileVo> getFiles(String proId);
|
||||
|
||||
/**
|
||||
* 当前登录人绑定的工程
|
||||
* @param dto
|
||||
* @return List<Map < String>>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 19:11
|
||||
*/
|
||||
@MapKey("bidCode")
|
||||
List<Map<String, String>> getProsByUser(ParamDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.securitycontrol.background.service;
|
||||
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-28-17:35
|
||||
* @version:1.0
|
||||
* @description:app-业务层
|
||||
*/
|
||||
public interface IAppService {
|
||||
/**
|
||||
* 项目简介
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 17:50
|
||||
*/
|
||||
AjaxResult getProBrief(ParamDto dto);
|
||||
|
||||
/**
|
||||
* 当前登录人绑定的工程
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 19:08
|
||||
*/
|
||||
AjaxResult getProsByUser(ParamDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.securitycontrol.background.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.securitycontrol.background.mapper.IAppMapper;
|
||||
import com.securitycontrol.background.service.IAppService;
|
||||
import com.securitycontrol.common.core.constant.HttpStatus;
|
||||
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.entity.background.dto.ParamDto;
|
||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||
import com.securitycontrol.system.api.RemoteFileService;
|
||||
import com.securitycontrol.system.api.domain.SysFile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-28-17:36
|
||||
* @version:1.0
|
||||
* @description:App业务逻辑层
|
||||
*/
|
||||
@Service(value = "IAppService")
|
||||
@Slf4j
|
||||
public class AppServiceImpl implements IAppService {
|
||||
|
||||
@Resource(name = "IAppMapper")
|
||||
private IAppMapper mapper;
|
||||
|
||||
@Resource
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
@Override
|
||||
public AjaxResult getProBrief(ParamDto dto) {
|
||||
ProVo proVo = new ProVo();
|
||||
try {
|
||||
proVo = mapper.getProBrief(dto);
|
||||
List<ProVo.FileData> list = new ArrayList<>();
|
||||
List<ResourceFileVo> resourceFileVos = mapper.getFiles(proVo.getProId());
|
||||
if (CollectionUtils.isNotEmpty(resourceFileVos)) {
|
||||
for (ResourceFileVo fileVo : resourceFileVos) {
|
||||
String base64 = null;
|
||||
Result<SysFile> result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER);
|
||||
if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
|
||||
String jsonString = JSON.toJSONString(result.getData());
|
||||
JSONObject item = JSON.parseObject(jsonString);
|
||||
base64 = item.getString("url");
|
||||
}
|
||||
ProVo.FileData fileData = new ProVo.FileData();
|
||||
fileData.setFileId(fileVo.getFileId());
|
||||
fileData.setBase64Url(base64);
|
||||
fileData.setFileSourceType(fileVo.getSourceType());
|
||||
list.add(fileData);
|
||||
}
|
||||
}
|
||||
proVo.setFileData(list);
|
||||
} catch (Exception e) {
|
||||
log.error("工程简介", e);
|
||||
}
|
||||
return AjaxResult.success(proVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getProsByUser(ParamDto dto) {
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getProsByUser(dto);
|
||||
} catch (Exception e) {
|
||||
log.error("当前登录人绑定的工程");
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.securitycontrol.background.mapper.IAppMapper">
|
||||
|
||||
<!--项目简介-->
|
||||
<select id="getProBrief" resultType="com.securitycontrol.entity.system.base.vo.ProVo">
|
||||
SELECT tp.pro_id AS proId,
|
||||
tp.sign_code AS signCode,
|
||||
tp.bid_code AS bidCode,
|
||||
tp.pro_code AS proCode,
|
||||
tp.pro_name AS proName,
|
||||
sb.city_name AS org,
|
||||
tp.plan_start_time AS planStartTime,
|
||||
tp.plan_end_time AS planEndTime,
|
||||
tp.jl_unit AS jlUnit,
|
||||
tp.sg_unit AS sgUnit,
|
||||
tp.pro_brief AS proBrief,
|
||||
tp.pro_type AS proType
|
||||
FROM tb_project tp
|
||||
LEFT JOIN sys_build sb ON tp.org = sb.org_id
|
||||
WHERE tp.bid_code = #{bidCode} AND del_flag = 0
|
||||
</select>
|
||||
<!-- 获取工程图片/平面图 -->
|
||||
<select id="getFiles" resultType="com.securitycontrol.entity.system.vo.ResourceFileVo">
|
||||
SELECT id AS resourceId,
|
||||
file_id AS fileId
|
||||
FROM tb_resource_file
|
||||
WHERE source_id = #{proId} AND source_type = '工程图片'
|
||||
</select>
|
||||
<!--当前登录人绑定的工程-->
|
||||
<select id="getProsByUser" resultType="java.util.Map">
|
||||
SELECT tp.pro_name AS proName,
|
||||
tp.bid_code AS bidCode
|
||||
FROM tb_project tp
|
||||
<if test="id!=null and id!='' and roleCode == 'roleCode'">
|
||||
INNER JOIN tb_user_pro tup ON tp.bid_code = tup.bid_cod AND tup.del_flag = '0' AND tup.user_id = #{id}
|
||||
</if>
|
||||
WHERE tp.del_flag = 0
|
||||
<if test="orgId != '' and orgId!=null and roleCode == 'city'">
|
||||
AND tp.org = #{orgId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -66,6 +66,7 @@
|
|||
<if test="updateTime != null and updateTime!=''">device_model,</if>
|
||||
<if test="bdId != null and bdId!=''">bd_id,</if>
|
||||
<if test="areaId != null and areaId!=''">area_id,</if>
|
||||
<if test="gtId != null and gtId!=''">gt_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
|
||||
|
|
@ -80,6 +81,7 @@
|
|||
<if test="deviceModel != null and deviceModel!=''">#{deviceModel},</if>
|
||||
<if test="bdId != null and bdId!=''">#{bdId},</if>
|
||||
<if test="areaId != null and areaId!=''">#{areaId},</if>
|
||||
<if test="gtId != null and gtId!=''">#{gtId},</if>
|
||||
</trim>
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
|
|
@ -94,6 +96,7 @@
|
|||
<if test="deviceModel != null and deviceModel != ''">device_model = #{deviceModel},</if>
|
||||
<if test="bdId != null and bdId != ''">bd_id = #{bdId},</if>
|
||||
<if test="areaId != null and areaId != ''">area_id = #{areaId},</if>
|
||||
<if test="gtId != null and gtId != ''">gt_id = #{gtId},</if>
|
||||
</set>
|
||||
WHERE device_id = #{deviceId}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.securitycontrol.entity.screen.dto.ScreenParamDto;
|
|||
import com.securitycontrol.screen.service.IScIndexService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
|
@ -59,4 +58,22 @@ public class ScIndexController {
|
|||
public AjaxResult deviceStatus(ScreenParamDto dto){
|
||||
return service.deviceStatus(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "工程安全隐患分析")
|
||||
@GetMapping("potentialSafetyHazard")
|
||||
public AjaxResult potentialSafetyHazard(ScreenParamDto dto){
|
||||
return service.potentialSafetyHazard(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "资源利用")
|
||||
@GetMapping("resourceUse")
|
||||
public AjaxResult resourceUse(ScreenParamDto dto){
|
||||
return service.resourceUse(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "效率分析")
|
||||
@GetMapping("efficiencyAnalysis")
|
||||
public AjaxResult efficiencyAnalysis(ScreenParamDto dto){
|
||||
return service.efficiencyAnalysis(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.securitycontrol.entity.screen.dto.ScreenParamDto;
|
|||
import com.securitycontrol.entity.screen.vo.ConstrQuality;
|
||||
import com.securitycontrol.entity.screen.vo.MapRiskVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -77,6 +78,7 @@ public interface IScIndexMapper {
|
|||
|
||||
/**
|
||||
* 设备状态
|
||||
*
|
||||
* @param dto
|
||||
* @return List<Map < Object>>
|
||||
* @description
|
||||
|
|
@ -85,4 +87,63 @@ public interface IScIndexMapper {
|
|||
*/
|
||||
@MapKey("bidCode")
|
||||
List<Map<String, Object>> deviceStatus(ScreenParamDto dto);
|
||||
|
||||
/**
|
||||
* 工程安全隐患分析
|
||||
*
|
||||
* @param dto
|
||||
* @return List<Map < Object>>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 9:13
|
||||
*/
|
||||
@MapKey("orgId")
|
||||
List<Map<String, Object>> potentialSafetyHazard(ScreenParamDto dto);
|
||||
|
||||
/**
|
||||
* 获取班组人员/获取站班会人员
|
||||
*
|
||||
* @param dto
|
||||
* @return List<Integer>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 11:05
|
||||
*/
|
||||
List<Integer> getPersonnel(ScreenParamDto dto);
|
||||
|
||||
/**
|
||||
* 设备 在线/不在线 数量
|
||||
*
|
||||
* @param dto
|
||||
* @return List<Map < Object>>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 11:28
|
||||
*/
|
||||
@MapKey("id")
|
||||
List<Map<String, Object>> allDeviceStatus(ScreenParamDto dto);
|
||||
|
||||
/**
|
||||
* 效率分析(工程进度分析)
|
||||
*
|
||||
* @param dto
|
||||
* @return List<Map < Object>>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 13:47
|
||||
*/
|
||||
@MapKey("orgId")
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public interface IScIndexService {
|
|||
|
||||
/**
|
||||
* 设备状态
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
|
|
@ -74,4 +75,36 @@ public interface IScIndexService {
|
|||
* @date 2024/3/27 19:50
|
||||
*/
|
||||
AjaxResult deviceStatus(ScreenParamDto dto);
|
||||
|
||||
/**
|
||||
* 工程安全隐患分析
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/27 20:49
|
||||
*/
|
||||
AjaxResult potentialSafetyHazard(ScreenParamDto dto);
|
||||
|
||||
/**
|
||||
* 资源利用
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 10:51
|
||||
*/
|
||||
AjaxResult resourceUse(ScreenParamDto dto);
|
||||
|
||||
/**
|
||||
* 效率分析(工程进度)
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 13:39
|
||||
*/
|
||||
AjaxResult efficiencyAnalysis(ScreenParamDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.securitycontrol.screen.service.impl;
|
||||
|
||||
import com.securitycontrol.common.core.constant.Constant;
|
||||
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
|
||||
import com.securitycontrol.entity.screen.vo.ConstrQuality;
|
||||
|
|
@ -10,11 +11,13 @@ import com.securitycontrol.screen.service.IScIndexService;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -30,6 +33,9 @@ public class ScIndexServiceImpl implements IScIndexService {
|
|||
@Resource(name = "IScIndexMapper")
|
||||
private IScIndexMapper mapper;
|
||||
|
||||
@Resource(name = "testTaskExecutor")
|
||||
private ThreadPoolTaskExecutor testTaskExecutor;
|
||||
|
||||
@Override
|
||||
public AjaxResult proStatusStatistics(ScreenParamDto dto) {
|
||||
Map<Object, Object> dataMap = new HashMap<>(16);
|
||||
|
|
@ -153,9 +159,9 @@ public class ScIndexServiceImpl implements IScIndexService {
|
|||
|
||||
@Override
|
||||
public AjaxResult deviceStatus(ScreenParamDto dto) {
|
||||
HashMap<Object, Object> returnMap = new HashMap<>();
|
||||
Map<Object, Object> returnMap = new HashMap<>(16);
|
||||
List<Map<String, Object>> dataList = new ArrayList<>(256);
|
||||
List<Map<String, Object>> list = new ArrayList<>(256);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
int allTotalNum = 0, onlineTotalNum = 0, offTotalNum = 0;
|
||||
try {
|
||||
list = mapper.deviceStatus(dto);
|
||||
|
|
@ -194,4 +200,110 @@ public class ScIndexServiceImpl implements IScIndexService {
|
|||
returnMap.put("offTotalNum", offTotalNum);
|
||||
return AjaxResult.success(returnMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult potentialSafetyHazard(ScreenParamDto dto) {
|
||||
List<Map<String, Object>> list = new ArrayList<>(16);
|
||||
try {
|
||||
String currentWeekTime = DateTimeHelper.getCurrentWeekTime();
|
||||
String[] timeArr = currentWeekTime.split(",");
|
||||
dto.setStartTime(timeArr[0]);
|
||||
dto.setEndTime(timeArr[1]);
|
||||
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) {
|
||||
log.error("工程安全隐患分析", e);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult resourceUse(ScreenParamDto dto) {
|
||||
Map<String, Object> map = new HashMap<>(3);
|
||||
// 人员利用率 设备使用率 能源使用情况
|
||||
Double personnelRate = new Double(0), deviceRate = new Double(0), energyValue = new Double(1201);
|
||||
try {
|
||||
Future<Double> future = testTaskExecutor.submit(() -> {
|
||||
log.info("人员利用率-执行线程{}", Thread.currentThread().getName());
|
||||
List<Integer> personnelList = personnelList = mapper.getPersonnel(dto);
|
||||
if (personnelList.get(0) == 0 || personnelList.get(1) == 0) {
|
||||
return new Double(0);
|
||||
}
|
||||
BigDecimal value = new BigDecimal("0");
|
||||
BigDecimal multipleValue = new BigDecimal("100");
|
||||
BigDecimal classPeople = BigDecimal.valueOf(personnelList.get(0));
|
||||
BigDecimal teamPeople = BigDecimal.valueOf(personnelList.get(1));
|
||||
value = classPeople.divide(teamPeople, 3, BigDecimal.ROUND_HALF_UP);
|
||||
value = value.multiply(multipleValue);
|
||||
return value.doubleValue();
|
||||
});
|
||||
Future<Double> future2 = testTaskExecutor.submit(() -> {
|
||||
log.info("设备使用率-执行线程{}", Thread.currentThread().getName());
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
list = mapper.allDeviceStatus(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new Double(0);
|
||||
}
|
||||
int onlineNum = 0, totalNum = list.size();
|
||||
for (Map<String, Object> objectMap : list) {
|
||||
if (Objects.equals(objectMap.get("status"), Constant.ONLINE)) {
|
||||
onlineNum++;
|
||||
}
|
||||
}
|
||||
BigDecimal onlineValue = BigDecimal.valueOf(onlineNum);
|
||||
BigDecimal totalValue = BigDecimal.valueOf(totalNum);
|
||||
return onlineValue.divide(totalValue, 3, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
});
|
||||
personnelRate = future.get();
|
||||
deviceRate = future2.get();
|
||||
} catch (Exception e) {
|
||||
log.error("资源利用", e);
|
||||
}
|
||||
map.put("personnelRate", personnelRate);
|
||||
map.put("deviceRate", deviceRate);
|
||||
map.put("energyValue", energyValue);
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult efficiencyAnalysis(ScreenParamDto dto) {
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.efficiencyAnalysis(dto);
|
||||
Map<String, List<Map<String, Object>>> map = list.stream().collect(Collectors.groupingBy(item -> {
|
||||
return String.valueOf(item.get("bidCode"));
|
||||
}));
|
||||
map.forEach((k, v) -> {
|
||||
// 根据每个工程的工序计划及进度填报计算效率
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
BigDecimal value = new BigDecimal("0");
|
||||
BigDecimal multipleValue = new BigDecimal("100");
|
||||
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"))) {
|
||||
BigDecimal bigDecimal = new BigDecimal(String.valueOf(v.get(i).get("gxWeight")));
|
||||
BigDecimal bigDecimal2 = new BigDecimal(String.valueOf(v.get(i).get("gxProgress")));
|
||||
value = value.add(bigDecimal.multiply(bigDecimal2).divide(multipleValue, 3, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
dataMap.put("proName", v.get(0).get("proName"));
|
||||
dataMap.put("value", value.doubleValue());
|
||||
dataList.add(dataMap);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("效率分析(工程进度分析)", e);
|
||||
}
|
||||
return AjaxResult.success(dataList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,4 +79,70 @@
|
|||
INNER JOIN tb_project tp on tpb.bid_code = tp.bid_code AND tp.del_flag = 0
|
||||
WHERE tbd.del_flage = 0
|
||||
</select>
|
||||
<!--工程安全隐患分析-->
|
||||
<select id="potentialSafetyHazard" resultType="java.util.Map">
|
||||
SELECT sb.org_id AS orgId,
|
||||
sb.city_name AS orgName,
|
||||
IFNULL(a.num,0) AS planNum,
|
||||
0 AS dangerNum
|
||||
FROM sys_build sb
|
||||
LEFT JOIN (
|
||||
SELECT build_no,COUNT(build_no) AS num
|
||||
FROM jj_week_plan
|
||||
WHERE start_date BETWEEN #{startTime} AND #{endTime} AND end_date BETWEEN #{startTime} AND #{endTime}
|
||||
GROUP BY build_no
|
||||
)a ON sb.org_id = a.build_no
|
||||
</select>
|
||||
<!--取班组人员/获取站班会人员-->
|
||||
<select id="getPersonnel" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM t_class_metting_people
|
||||
WHERE create_day = CURRENT_DATE
|
||||
UNION ALL
|
||||
SELECT COUNT(*)
|
||||
FROM t_team_people
|
||||
WHERE del_falge = '0'
|
||||
</select>
|
||||
<!--设备 在线/不在线 数量 边带子设备/设备-->
|
||||
<select id="allDeviceStatus" resultType="java.util.Map">
|
||||
SELECT tbd.device_id AS id, IF(tbd.status = '801', '1', '0') AS status
|
||||
FROM tb_bd_device tbd
|
||||
WHERE tbd.del_flage = 0
|
||||
UNION ALL
|
||||
SELECT td.device_id AS id,
|
||||
IF(on_line = '1', '1', '0') AS status
|
||||
FROM tb_device td
|
||||
WHERE td.del_flag = 0
|
||||
</select>
|
||||
<!--效率分析(工程进度分析)-->
|
||||
<select id="efficiencyAnalysis" resultType="java.util.Map">
|
||||
SELECT tp.bid_code AS bidCode,
|
||||
tp.pro_name AS proName,
|
||||
tgp.plan_id AS planId,
|
||||
tgp.gx_weight AS gxWeight,
|
||||
a.gxProgress
|
||||
FROM tb_project tp
|
||||
LEFT JOIN tb_gx_plan tgp ON tp.bid_code = tgp.bid_code AND tgp.del_flag = 0
|
||||
LEFT JOIN (
|
||||
SELECT tpp.plan_id AS planId,
|
||||
tpp.gx_progress AS gxProgress
|
||||
FROM tb_project_progress tpp
|
||||
INNER JOIN (SELECT MAX( create_time ) AS create_time FROM tb_project_progress GROUP BY plan_id) tpp2 ON tpp.create_time = tpp2.create_time
|
||||
)a ON tgp.plan_id = a.planId
|
||||
WHERE tp.del_flag = 0
|
||||
</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>
|
||||
|
|
@ -94,10 +94,21 @@ public interface IProScheduleMapper {
|
|||
|
||||
/**
|
||||
* 工程为线路时 更新杆塔当前工序
|
||||
*
|
||||
* @param vo
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/16 15:40
|
||||
*/
|
||||
void updateGtData(GxPlanProgressVo vo);
|
||||
|
||||
/**
|
||||
* 获取当前工序计划的填报进度
|
||||
* @param vo
|
||||
* @return String
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/28 14:10
|
||||
*/
|
||||
String getGxPlanProgress(GxPlanProgressVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,15 @@ public class ProScheduleServiceImpl implements IProScheduleService {
|
|||
vo.setType(1);
|
||||
mapper.updateGxPlanData(vo);
|
||||
}
|
||||
// 获取当前工序计划的填报进度
|
||||
String nowGxPlanProgress = mapper.getGxPlanProgress(vo);
|
||||
if(StringUtils.isNotEmpty(nowGxPlanProgress)){
|
||||
double aDouble = Double.parseDouble(nowGxPlanProgress);
|
||||
double bDouble = Double.parseDouble(vo.getGxProgress());
|
||||
if(bDouble < aDouble){
|
||||
return AjaxResult.error("当前进度填报需大于上一次填报进度");
|
||||
}
|
||||
}
|
||||
Long timestamp = DateTimeHelper.convertDateStringToTimestamp(vo.getPlanEndTime(), "yyyy-MM-dd");
|
||||
if (timestamp == null) {
|
||||
return AjaxResult.error("计划结束时间格式不正确");
|
||||
|
|
@ -117,7 +126,7 @@ public class ProScheduleServiceImpl implements IProScheduleService {
|
|||
mapper.updateGxPlanData(vo);
|
||||
}
|
||||
// 填报工序计划
|
||||
vo.setCreateTime(DateTimeHelper.getNowDate());
|
||||
vo.setCreateTime(DateTimeHelper.getNowTime());
|
||||
String progressId = IdUtils.getUUId();
|
||||
vo.setProgressId(progressId);
|
||||
mapper.addGxPlanProgress(vo);
|
||||
|
|
|
|||
|
|
@ -41,21 +41,22 @@
|
|||
SELECT tp.bid_code AS bidCode,
|
||||
tp.pro_name AS proName
|
||||
FROM tb_project tp
|
||||
WHERE del_flag = 0
|
||||
ORDER BY plan_start_time
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
SELECT tup.bid_cod AS bidCode,
|
||||
tp.pro_name AS proName
|
||||
FROM tb_user_pro tup
|
||||
LEFT JOIN tb_project tp on tup.bid_cod = tp.bid_code
|
||||
WHERE tup.user_id = #{param}
|
||||
LEFT JOIN tb_project tp on tup.bid_cod = tp.bid_code AND tp.del_flag = 0
|
||||
WHERE tup.user_id = #{param} AND tup.del_flag = '0'
|
||||
ORDER BY tup.times
|
||||
</if>
|
||||
<if test="type == 3">
|
||||
SELECT tp.bid_code AS bidCode,
|
||||
tp.pro_name AS proName
|
||||
FROM tb_project tp
|
||||
WHERE tp.org = #{param}
|
||||
WHERE tp.org = #{param} AND tp.del_flag = 0
|
||||
ORDER BY plan_start_time
|
||||
</if>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -217,7 +217,6 @@
|
|||
<!--工程详情-->
|
||||
<select id="getProById" resultType="com.securitycontrol.entity.system.base.vo.ProVo">
|
||||
SELECT tp.pro_id AS proId,
|
||||
tp.user_id AS userId,
|
||||
tp.sign_code AS signCode,
|
||||
tp.bid_code AS bidCode,
|
||||
tp.pro_code AS proCode,
|
||||
|
|
|
|||
|
|
@ -125,4 +125,12 @@
|
|||
<select id="isFirstFillingGxProgress" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM tb_project_progress WHERE plan_id = #{planId}
|
||||
</select>
|
||||
<!--获取当前工序计划的填报进度-->
|
||||
<select id="getGxPlanProgress" resultType="java.lang.String">
|
||||
SELECT tpp.gx_progress AS gxProgress
|
||||
FROM tb_project_progress tpp
|
||||
WHERE plan_id = #{planId}
|
||||
ORDER BY create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
<if test="proType == 2">
|
||||
SELECT gt_id AS id,
|
||||
gt_name AS name
|
||||
FROM t_pro_gt WHERE bid_code = #{param}
|
||||
FROM t_pro_gt WHERE bid_code = #{param} AND del_flag = 0
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
|
@ -76,9 +76,12 @@
|
|||
team_leader AS teamLeader,
|
||||
team_leader_phone AS teamLeaderPhone
|
||||
FROM tb_work_team
|
||||
<if test="param!=null and param!=''">
|
||||
bid_code = #{param}
|
||||
</if>
|
||||
<where>
|
||||
<if test="param!=null and param!=''">
|
||||
AND bid_code = #{param}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
<!--工程下拉选-->
|
||||
<select id="getProLists" resultType="com.securitycontrol.entity.system.vo.SelectVo">
|
||||
|
|
@ -94,7 +97,7 @@
|
|||
area_name AS name
|
||||
FROM tb_area
|
||||
<where>
|
||||
bid_code = #{bidCode}
|
||||
bid_code = #{bidCode} AND del_flag = 0
|
||||
<if test="gtId !=null and gtId!=''">
|
||||
AND gt_id = #{gtId}
|
||||
</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue