forked from xxhjsb/wit-park-backend
统计接口改动
parent
c29f407cfb
commit
07387c620e
|
@ -57,11 +57,11 @@ public class HazardousOperation extends BaseEntity
|
|||
|
||||
/** 作业开始时间 */
|
||||
@ApiModelProperty(value = "作业开始时间")
|
||||
private Date operationStart;
|
||||
private String operationStart;
|
||||
|
||||
/** 作业结束时间 */
|
||||
@ApiModelProperty(value = "作业结束时间")
|
||||
private Date operationEnd;
|
||||
private String operationEnd;
|
||||
|
||||
/** 作业地点 */
|
||||
@ApiModelProperty(value = "作业地点")
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.hbt.safety.supervision.pojo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.hbt.common.core.annotation.Excel;
|
||||
import com.hbt.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.hbt.safety.supervision.pojo;
|
||||
|
||||
import com.hbt.common.core.annotation.Excel;
|
||||
import com.hbt.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
|
@ -106,8 +106,8 @@ public class HazardousOperationServiceImpl implements IHazardousOperationService
|
|||
@Override
|
||||
public String hazardousOperationStatistics() {
|
||||
// 获取当前时间
|
||||
Date date = new Date();
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String dateNowStr = sdf.format(new Date());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
// 查询危险作业信息
|
||||
|
@ -129,7 +129,7 @@ public class HazardousOperationServiceImpl implements IHazardousOperationService
|
|||
|
||||
// 进行中的危险作业
|
||||
List<HazardousOperation> hazardousOperations = list.stream()
|
||||
.filter(s -> s.getOperationStart().before(date) && s.getOperationEnd().after(date))
|
||||
.filter(s -> s.getOperationStart().compareTo(dateNowStr) <= 0 &&s.getOperationEnd().compareTo(dateNowStr) >= 0)
|
||||
.collect(Collectors.toList());
|
||||
map.put("underwayHazardousOperation", hazardousOperations.size());
|
||||
|
||||
|
@ -142,12 +142,12 @@ public class HazardousOperationServiceImpl implements IHazardousOperationService
|
|||
|
||||
// 待开始危险作业
|
||||
int toBeStarted = (int) list.stream()
|
||||
.filter(s -> s.getOperationStart().after(date)).count();
|
||||
.filter(s -> s.getOperationStart().compareTo(dateNowStr) > 0).count();
|
||||
map.put("toBeStarted", toBeStarted);
|
||||
|
||||
// 历史危险作业
|
||||
int historyHazardousOperation = (int) list.stream()
|
||||
.filter(s -> s.getOperationEnd().before(date)).count();
|
||||
.filter(s -> s.getOperationEnd().compareTo(dateNowStr) < 0).count();
|
||||
map.put("historyHazardousOperation", historyHazardousOperation);
|
||||
return JSONObject.toJSONString(map);
|
||||
}
|
||||
|
@ -158,7 +158,8 @@ public class HazardousOperationServiceImpl implements IHazardousOperationService
|
|||
@Override
|
||||
public String hazardousOperationManagement() {
|
||||
// 获取当前时间
|
||||
Date date = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String dateNowStr = sdf.format(new Date());
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
|
@ -170,19 +171,19 @@ public class HazardousOperationServiceImpl implements IHazardousOperationService
|
|||
|
||||
// 进行中的危险作业
|
||||
List<HazardousOperation> hazardousOperations = list.stream()
|
||||
.filter(s -> s.getOperationStart().before(date) && s.getOperationEnd().after(date))
|
||||
.filter(s -> s.getOperationStart().compareTo(dateNowStr) <= 0 &&s.getOperationEnd().compareTo(dateNowStr) >= 0)
|
||||
.collect(Collectors.toList());
|
||||
map.put("underwayHazardousOperation", hazardousOperations);
|
||||
|
||||
|
||||
// 待开始危险作业
|
||||
List<HazardousOperation> toBeStarted = list.stream()
|
||||
.filter(s -> s.getOperationStart().after(date)).collect(Collectors.toList());
|
||||
.filter(s -> s.getOperationStart().compareTo(dateNowStr) > 0).collect(Collectors.toList());
|
||||
map.put("toBeStarted", toBeStarted);
|
||||
|
||||
// 历史危险作业
|
||||
List<HazardousOperation> historyHazardousOperation = list.stream()
|
||||
.filter(s -> s.getOperationEnd().before(date)).collect(Collectors.toList());
|
||||
.filter(s -> s.getOperationEnd().compareTo(dateNowStr) < 0).collect(Collectors.toList());
|
||||
map.put("historyHazardousOperation", historyHazardousOperation);
|
||||
return JSONObject.toJSONString(map);
|
||||
}
|
||||
|
@ -206,21 +207,20 @@ public class HazardousOperationServiceImpl implements IHazardousOperationService
|
|||
|
||||
List<HazardousOperation> hazardousOperations = hazardousOperationMapper.hazardousOperationVariationTendency(startTime);
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
List<HazardousOperationWeekDateVo> hazardousOperationWeekDateVos = new ArrayList<>();
|
||||
// 组装数据
|
||||
for (int i = 0; i < statisticsList.size(); i++) {
|
||||
int finalI = i;
|
||||
// 筛选进行中的数量 进行中:作业开始时间大于等于周开始的时间,小于等于周结束的时间 或者作业结束时间大于等周开始时间小于等于周结束时间
|
||||
int onGoingCount = (int) hazardousOperations.stream()
|
||||
.filter(s -> (sdf.format(s.getOperationStart()).compareTo(statisticsList.get(finalI).get("startTime")) >=0
|
||||
&& sdf.format(s.getOperationStart()).compareTo(statisticsList.get(finalI).get("endTime")) <= 0)
|
||||
|| (sdf.format(s.getOperationEnd()).compareTo(statisticsList.get(finalI).get("startTime")) >= 0
|
||||
&& sdf.format(s.getOperationEnd()).compareTo(statisticsList.get(finalI).get("endTime")) <= 0)).count();
|
||||
.filter(s -> (s.getOperationStart().compareTo(statisticsList.get(finalI).get("startTime")) >=0
|
||||
&& s.getOperationStart().compareTo(statisticsList.get(finalI).get("endTime")) <= 0)
|
||||
|| (s.getOperationEnd().compareTo(statisticsList.get(finalI).get("startTime")) >= 0
|
||||
&& s.getOperationEnd().compareTo(statisticsList.get(finalI).get("endTime")) <= 0)).count();
|
||||
|
||||
// 筛选待开始的数量 待开始:周结束时间小于 作业开始时间
|
||||
int toBeStartedCount = (int) hazardousOperations.stream()
|
||||
.filter(s -> sdf.format(s.getOperationStart()).compareTo(statisticsList.get(finalI).get("endTime")) > 0).count();
|
||||
.filter(s -> s.getOperationStart().compareTo(statisticsList.get(finalI).get("endTime")) > 0).count();
|
||||
HazardousOperationWeekDateVo hazardousOperationWeekDateVo = new HazardousOperationWeekDateVo();
|
||||
hazardousOperationWeekDateVo.setDate(date.get(i));
|
||||
hazardousOperationWeekDateVo.setOnGoingCount(onGoingCount);
|
||||
|
|
|
@ -340,7 +340,6 @@ public class YearWeeksUtil {
|
|||
}
|
||||
|
||||
public static String getResultData(List<Map<String, String>> statisticsList, List<String> list, List<String> date) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
List<WeekDateVo> weekDateVos = new ArrayList<>();
|
||||
// 组装数据
|
||||
for (int i = 0; i < statisticsList.size(); i++) {
|
||||
|
|
|
@ -19,21 +19,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectHazardousOperationVo">
|
||||
select id, name, operation_longitude, operation_latitude, operation_type, operation_start, operation_end, operation_site from hazardous_operation
|
||||
select id, name, operation_longitude operationLongitude, operation_latitude operationLatitude, operation_type operationType, DATE_FORMAT(operation_start,'%Y-%m-%d %H:%i:%S') operationStart, DATE_FORMAT(operation_end,'%Y-%m-%d %H:%i:%S') operationEnd, operation_site operationSite from hazardous_operation
|
||||
</sql>
|
||||
|
||||
<select id="selectHazardousOperationList" parameterType="com.hbt.safety.supervision.pojo.HazardousOperation" resultMap="HazardousOperationResult">
|
||||
<select id="selectHazardousOperationList" parameterType="com.hbt.safety.supervision.pojo.HazardousOperation" resultType="HazardousOperation">
|
||||
<include refid="selectHazardousOperationVo"/>
|
||||
</select>
|
||||
|
||||
<sql id="selectHazardousOperation">
|
||||
select distinct(a.id) id, a.name name, a.operation_level operationLevel, a.enterprise_id enterpriseId, a.operation_content operationContent, a.operation_type operationType, a.operation_start operationStart, a.operation_end operationEnd,a.operation_site operationSite,
|
||||
select distinct(a.id) id, a.name name, a.operation_level operationLevel, a.enterprise_id enterpriseId, a.operation_content operationContent, a.operation_type operationType, DATE_FORMAT(a.operation_start,'%Y-%m-%d %H:%i:%S') operationStart, DATE_FORMAT(a.operation_end,'%Y-%m-%d %H:%i:%S') operationEnd,a.operation_site operationSite,
|
||||
e.name enterprise
|
||||
from hazardous_operation as a
|
||||
left join enterprise_information as e on a.enterprise_id = e.id
|
||||
</sql>
|
||||
|
||||
<select id="selectHazardousOperationById" parameterType="Integer" resultMap="HazardousOperationResult">
|
||||
<select id="selectHazardousOperationById" parameterType="Integer" resultType="HazardousOperation">
|
||||
<include refid="selectHazardousOperation"/>
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
@ -97,11 +97,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<select id="selectHazardousOperations" resultType="com.hbt.safety.supervision.pojo.HazardousOperation">
|
||||
select id,operation_type operationType,operation_start operationStart ,operation_end operationEnd,enterprise_id enterpriseId from hazardous_operation
|
||||
select id,operation_type operationType,DATE_FORMAT(operation_start,'%Y-%m-%d') operationStart ,DATE_FORMAT(operation_end,'%Y-%m-%d') operationEnd,enterprise_id enterpriseId from hazardous_operation
|
||||
</select>
|
||||
|
||||
<select id="hazardousOperationManagement" resultType="HazardousOperation">
|
||||
select distinct(a.id) id, a.name name, a.operation_level operationLevel, a.enterprise_id enterpriseId, a.operation_content operationContent, a.operation_type operationType, a.operation_start operationStart, a.operation_end operationEnd,a.operation_site operationSite,
|
||||
select distinct(a.id) id, a.name name, a.operation_level operationLevel, a.enterprise_id enterpriseId, a.operation_content operationContent, a.operation_type operationType,DATE_FORMAT(a.operation_start,'%Y-%m-%d') operationStart, DATE_FORMAT(a.operation_end,'%Y-%m-%d') operationEnd,a.operation_site operationSite,
|
||||
e.name enterprise
|
||||
from hazardous_operation as a
|
||||
left join enterprise_information as e on a.enterprise_id = e.id
|
||||
|
|
Loading…
Reference in New Issue