bug修复

This commit is contained in:
guo 2024-01-04 18:16:34 +08:00
parent 78f81398b5
commit 6fb89a1ade
29 changed files with 114 additions and 114 deletions

View File

@ -1,23 +0,0 @@
package com.zhgd.xmgl.base.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 单列图表y轴
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MultiTrendOne {
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("数值")
private List<String> data;
}

View File

@ -1,44 +0,0 @@
package com.zhgd.xmgl.base.entity.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 多列图表带总数
*/
@Data
public class MultiTrendVo {
@ApiModelProperty("x轴")
private List<String> x;
@ApiModelProperty("y轴数据")
List<MultiTrendOne> data;
@ApiModelProperty("总数")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String count;
/**
* @param dataList 数据list
* @param allList x的list
* @return
*/
public static List<String> fillData(List<TrendVo> dataList, List<String> allList) {
ArrayList<String> list = new ArrayList<>();
Map<String, TrendVo> map = dataList.stream().collect(Collectors.toMap(trendVo -> trendVo.getX(), Function.identity(), (o, o2) -> o));
for (String s : allList) {
TrendVo vo = map.get(s);
if (vo != null) {
list.add(vo.getY());
} else {
list.add("0");
}
}
return list;
}
}

View File

@ -148,7 +148,7 @@ public class AmmeterRecordDetailServiceImpl extends ServiceImpl<AmmeterRecordDet
//近7天
map.put("addTime_begin", DateUtil.formatDate(DateUtil.offsetDay(new Date(), -10)));
List<AmmeterRecordDetail> ammeterRecordDetails = baseMapper.queryUseRecord(map);
List<String> days = DateUtils.getDateStrList(60, "yyyy-MM-dd");
List<String> days = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
List<TrendVo> list = ammeterRecordDetails.stream().map(detail -> {
TrendVo vo = new TrendVo();
vo.setY(detail.getDegree() + "");
@ -174,7 +174,7 @@ public class AmmeterRecordDetailServiceImpl extends ServiceImpl<AmmeterRecordDet
List<AmmeterMonthRecord> ammeterMonthRecords = ammeterMonthRecordMapper.selectList(new LambdaQueryWrapper<AmmeterMonthRecord>()
.eq(AmmeterMonthRecord::getAmmeterNo, ammeterNo)
.eq(AmmeterMonthRecord::getProjectSn, projectSn));
List<String> dateStrList = DateUtils.getDateStrList(90, "yyyy-MM");
List<String> dateStrList = DateUtils.getDateTimeStrList(90, "yyyy-MM");
List<TrendVo> list = ammeterMonthRecords.stream().map(detail -> {
TrendVo vo = new TrendVo();
vo.setY(detail.getUseDegree() + "");
@ -188,7 +188,7 @@ public class AmmeterRecordDetailServiceImpl extends ServiceImpl<AmmeterRecordDet
List<AmmeterMonthRecord> ammeterMonthRecords = ammeterMonthRecordMapper.selectList(new LambdaQueryWrapper<AmmeterMonthRecord>()
.eq(AmmeterMonthRecord::getAmmeterNo, ammeterNo)
.eq(AmmeterMonthRecord::getProjectSn, projectSn));
List<String> dateStrList = DateUtils.getDateStrList(93, "yyyy-MM");
List<String> dateStrList = DateUtils.getDateTimeStrList(93, "yyyy-MM");
List<TrendVo> list = ammeterMonthRecords.stream().map(detail -> {
TrendVo vo = new TrendVo();
vo.setY(detail.getUseDegree() + "");

View File

@ -99,7 +99,7 @@ public class GantryCraneAlarmServiceImpl extends ServiceImpl<GantryCraneAlarmMap
map.put("startTime", DateUtils.offsetDayStr(DateUtil.now(), -15));
map.put("endTime", DateUtil.now());
List<TrendVo> list = baseMapper.countGantryCraneAlarmWindSpeed(map);
List<String> days = DateUtils.getDateStrList(60, "yyyy-MM-dd");
List<String> days = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
return TrendVo.fillTrendVos(list, days, "MM-dd");
}
return null;

View File

@ -12,7 +12,6 @@ import com.zhgd.xmgl.modules.bigdevice.entity.GantryCraneWorkCycle;
import com.zhgd.xmgl.modules.bigdevice.entity.vo.CountGantryCraneWorkCycleVo;
import com.zhgd.xmgl.modules.bigdevice.mapper.GantryCraneMapper;
import com.zhgd.xmgl.modules.bigdevice.mapper.GantryCraneWorkCycleMapper;
import com.zhgd.xmgl.modules.bigdevice.service.IBigDeviceDiscloseRecordService;
import com.zhgd.xmgl.modules.bigdevice.service.IGantryCraneWorkCycleService;
import com.zhgd.xmgl.util.DateUtils;
import com.zhgd.xmgl.util.MessageUtil;
@ -69,7 +68,7 @@ public class GantryCraneWorkCycleServiceImpl extends ServiceImpl<GantryCraneWork
List<TrendVo> trendVos = gantryCraneWorkCycleMapper.countGantryCraneWorkCycleNumEveryday(map);
List<String> days;
if (Objects.equals(MapUtils.getInteger(map, "type"), 1)) {
days = DateUtils.getDateStrList(72, "yyyy-MM-dd");
days = DateUtils.getDateTimeStrList(72, "yyyy-MM-dd");
} else if (Objects.equals(MapUtils.getInteger(map, "type"), 2)) {
days = DateUtils.getDaysBefore(50);
} else {
@ -88,9 +87,9 @@ public class GantryCraneWorkCycleServiceImpl extends ServiceImpl<GantryCraneWork
List<TrendVo> trendVos = gantryCraneWorkCycleMapper.workTimeAnalysis(paramMap);
List<String> days;
if (Objects.equals(MapUtils.getInteger(paramMap, "type"), 1)) {
days = DateUtils.getDateStrList(60, "yyyy-MM-dd");
days = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
} else if (Objects.equals(MapUtils.getInteger(paramMap, "type"), 2)) {
days = DateUtils.getDateStrList(400, "yyyy-MM-dd");
days = DateUtils.getDateTimeStrList(400, "yyyy-MM-dd");
} else {
return null;
}

View File

@ -386,7 +386,7 @@ public class CarPassRecordServiceImpl extends ServiceImpl<CarPassRecordMapper, C
private void fillDataCarPassRecordInOutCount(List<TodayOutInNumber> todayOutInNumbers) {
Map<String, TodayOutInNumber> map = todayOutInNumbers.stream().collect(Collectors.toMap(TodayOutInNumber::getPassTime, Function.identity()));
todayOutInNumbers.clear();
for (String h : DateUtils.getDateStrList(100, "HH:mm")) {
for (String h : DateUtils.getDateTimeStrList(100, "HH:mm")) {
TodayOutInNumber toi = map.get(h);
if (toi == null) {
toi = new TodayOutInNumber();

View File

@ -527,7 +527,7 @@ public class HiddenDangerInspectRecordServiceImpl extends ServiceImpl<HiddenDang
private List<DangerInspectionPassMonthStaticsVo> fillData(List<DangerInspectionPassMonthStaticsVo> monthStatics) {
List<DangerInspectionPassMonthStaticsVo> rtVos = new ArrayList<>();
Map<String, DangerInspectionPassMonthStaticsVo> map = monthStatics.stream().collect(Collectors.toMap(e -> e.getDay(), e -> e, (o, o2) -> o));
for (String orderDay : DateUtils.getDateStrList(80, "yyyy-MM-dd")) {
for (String orderDay : DateUtils.getDateTimeStrList(80, "yyyy-MM-dd")) {
DangerInspectionPassMonthStaticsVo vo = map.get(orderDay);
if (vo == null) {
vo = new DangerInspectionPassMonthStaticsVo();

View File

@ -100,7 +100,7 @@ public class ElectricalDataServiceImpl extends ServiceImpl<ElectricalDataMapper,
private void fillData(List<ElectricalData> electricalDataList) {
Map<String, ElectricalData> dataMap = electricalDataList.stream().collect(Collectors.toMap(ElectricalData::getTime, Function.identity()));
electricalDataList.clear();
for (String hour : DateUtils.getDateStrList(20, "HH:00")) {
for (String hour : DateUtils.getDateTimeStrList(20, "HH:00")) {
ElectricalData ed = dataMap.get(hour);
if (ed == null) {
ed = new ElectricalData();

View File

@ -205,7 +205,7 @@ public class DustNoiseDataServiceImpl extends ServiceImpl<DustNoiseDataMapper, D
private void fillData(List<DustNoiseData> dustNoiseDatas) {
Map<String, DustNoiseData> dataMap = dustNoiseDatas.stream().collect(Collectors.toMap(DustNoiseData::getTime, Function.identity()));
dustNoiseDatas.clear();
for (String hour : DateUtils.getDateStrList(100, "HH:mm")) {
for (String hour : DateUtils.getDateTimeStrList(100, "HH:mm")) {
DustNoiseData dnd = dataMap.get(hour);
if (dnd == null) {
dnd = new DustNoiseData();

View File

@ -759,10 +759,10 @@ public class EnvironmentAlarmServiceImpl extends ServiceImpl<EnvironmentAlarmMap
List<String> dayList = new ArrayList<>();
if (dateType == 2) {
//查询近一月所有天数
dayList = DateUtils.getDateStrList(80, "yyyy-MM-dd");
dayList = DateUtils.getDateTimeStrList(80, "yyyy-MM-dd");
} else {
//查询近一周所有天数
dayList = DateUtils.getDateStrList(60, "yyyy-MM-dd");
dayList = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
}
List<Map<String, Object>> list = companyService.selectComapnyOrProjectList(map);
if (list != null && list.size() > 0) {

View File

@ -40,7 +40,7 @@ public class LocationTagLowVoltageAlarmServiceImpl extends ServiceImpl<LocationT
@Override
public List<TrendVo> countLocationTagLowVoltageAlarmEveryDay(HashMap<String, Object> paramMap) {
List<TrendVo> list = baseMapper.countLocationTagLowVoltageAlarmEveryDay(paramMap);
List<String> days = DateUtils.getDateStrList(60, "yyyy-MM-dd");
List<String> days = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
List<TrendVo> trendVos = TrendVo.fillTrendVos(list, days, "MM-dd");
return trendVos;
}

View File

@ -120,7 +120,7 @@ public class RtToolServiceImpl extends ServiceImpl<RtToolMapper, RtTool> impleme
dimensions.add("当日出库量");
flexibleBigScreenVo.setDimensions(dimensions);
flexibleBigScreenVo.setSource(source);
List<String> strList = DateUtils.getDateStrList(60, "yyyy-MM-dd");
List<String> strList = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
FlexibleBigScreenVo.fillTrendVos(flexibleBigScreenVo, strList, "MM-dd");
return flexibleBigScreenVo;
}

View File

@ -92,7 +92,7 @@ public class SmartBeamFieldMaintainDataServiceImpl extends ServiceImpl<SmartBeam
dimensions.add("湿度");
flexibleBigScreenVo.setDimensions(dimensions);
flexibleBigScreenVo.setSource(source);
List<String> strList = DateUtils.getDateStrList(100, "HH:00");
List<String> strList = DateUtils.getDateTimeStrList(100, "HH:00");
FlexibleBigScreenVo.fillTrendVos(flexibleBigScreenVo, strList, "HH:00");
return flexibleBigScreenVo;
}

View File

@ -100,7 +100,7 @@ public class SmartGroutDataServiceImpl extends ServiceImpl<SmartGroutDataMapper,
dimensions.add("不合格");
flexibleBigScreenVo.setDimensions(dimensions);
flexibleBigScreenVo.setSource(source);
List<String> strList = DateUtils.getDateStrList(500, "yyyy-MM");
List<String> strList = DateUtils.getDateTimeStrList(500, "yyyy-MM");
FlexibleBigScreenVo.fillTrendVos(flexibleBigScreenVo, strList, "月份M");
return flexibleBigScreenVo;
}

View File

@ -3,11 +3,9 @@ package com.zhgd.xmgl.modules.smartgrout.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.TypeReference;
import com.zhgd.xmgl.base.entity.vo.FlexibleBigScreenVo;
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutData;
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutSteelBeamData;
import com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutSteelBeamDataMapper;
import com.zhgd.xmgl.modules.smartgrout.service.ISmartGroutSteelBeamDataService;
import com.zhgd.xmgl.modules.smarttension.entity.SmartTensionSteelBeamData;
import com.zhgd.xmgl.util.DateUtils;
import org.apache.commons.collections.MapUtils;
import org.springframework.stereotype.Service;
@ -62,7 +60,7 @@ public class SmartGroutSteelBeamDataServiceImpl extends ServiceImpl<SmartGroutSt
dimensions.add("不合格");
flexibleBigScreenVo.setDimensions(dimensions);
flexibleBigScreenVo.setSource(source);
List<String> strList = DateUtils.getDateStrList(500, "yyyy-MM");
List<String> strList = DateUtils.getDateTimeStrList(500, "yyyy-MM");
FlexibleBigScreenVo.fillTrendVos(flexibleBigScreenVo, strList, "月份M");
return flexibleBigScreenVo;
}

View File

@ -108,7 +108,7 @@ public class SmartTensionDataServiceImpl extends ServiceImpl<SmartTensionDataMap
dimensions.add("不合格");
flexibleBigScreenVo.setDimensions(dimensions);
flexibleBigScreenVo.setSource(source);
List<String> strList = DateUtils.getDateStrList(500, "yyyy-MM");
List<String> strList = DateUtils.getDateTimeStrList(500, "yyyy-MM");
FlexibleBigScreenVo.fillTrendVos(flexibleBigScreenVo, strList, "月份M");
return flexibleBigScreenVo;
}

View File

@ -60,7 +60,7 @@ public class SmartTensionSteelBeamDataServiceImpl extends ServiceImpl<SmartTensi
dimensions.add("不合格");
flexibleBigScreenVo.setDimensions(dimensions);
flexibleBigScreenVo.setSource(source);
List<String> strList = DateUtils.getDateStrList(500, "yyyy-MM");
List<String> strList = DateUtils.getDateTimeStrList(500, "yyyy-MM");
FlexibleBigScreenVo.fillTrendVos(flexibleBigScreenVo, strList, "月份M");
return flexibleBigScreenVo;
}

View File

@ -6,8 +6,8 @@ import com.gexin.fastjson.JSON;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentData;
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentDataExt;
import com.zhgd.xmgl.modules.standard.service.IStandardCurrentDataService;
import com.zhgd.xmgl.modules.taskprogress.entity.TaskProgressMaterialRel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -133,7 +133,7 @@ public class StandardCurrentDataController {
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/selectNewCurrentData")
public Result<StandardCurrentData> selectNewCurrentData(@RequestBody Map<String, Object> map) {
public Result<StandardCurrentData> selectNewCurrentData(@RequestBody @ApiIgnore Map<String, Object> map) {
return Result.success(standardCurrentDataService.selectNewCurrentData(map));
}
@ -143,7 +143,7 @@ public class StandardCurrentDataController {
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/selectDayCurrentDataList")
public Result<List<StandardCurrentData>> selectDayCurrentDataList(@RequestBody Map<String, Object> map) {
public Result<List<StandardCurrentData>> selectDayCurrentDataList(@RequestBody @ApiIgnore Map<String, Object> map) {
return Result.success(standardCurrentDataService.selectDayCurrentDataList(map));
}
@ -154,7 +154,7 @@ public class StandardCurrentDataController {
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/selectStandardCurrentDataList")
public Result<List<StandardCurrentData>> selectStandardCurrentDataList(@RequestBody Map<String, Object> map) {
public Result<List<StandardCurrentData>> selectStandardCurrentDataList(@RequestBody @ApiIgnore Map<String, Object> map) {
return Result.success(standardCurrentDataService.selectStandardCurrentDataList(map));
}
@ -185,8 +185,20 @@ public class StandardCurrentDataController {
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/selectStandardAnalysisReport")
public Result<List<EntityMap>> selectStandardAnalysisReport(@RequestBody Map<String, Object> map) {
public Result<List<EntityMap>> selectStandardAnalysisReport(@RequestBody @ApiIgnore Map<String, Object> map) {
return Result.success(standardCurrentDataService.selectStandardAnalysisReport(map));
}
@ApiOperation(value = "统计实时数据", notes = "统计实时数据", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", dataType = "String", paramType = "body", required = false),
@ApiImplicitParam(name = "type", value = "查询类型1过去24小时 ", dataType = "Integer", paramType = "body", required = true),
})
@PostMapping(value = "/countStandardCurrentData")
public Result<List<StandardCurrentDataExt>> countStandardCurrentData(@RequestBody @ApiIgnore Map<String, Object> map) {
return Result.success(standardCurrentDataService.countStandardCurrentData(map));
}
}

View File

@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.standard.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@ -22,7 +23,7 @@ import io.swagger.annotations.ApiModelProperty;
@ApiModel(value="StandardCurrentData实体类",description="StandardCurrentData")
public class StandardCurrentData implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value="id")

View File

@ -0,0 +1,12 @@
package com.zhgd.xmgl.modules.standard.entity;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class StandardCurrentDataExt extends StandardCurrentData {
@ApiModelProperty("时间")
private String time;
}

View File

@ -5,6 +5,7 @@ import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentDataExt;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentData;
@ -29,11 +30,13 @@ public interface StandardCurrentDataMapper extends BaseMapper<StandardCurrentDat
Integer getStandardDevState(Map<String, Object> map);
List<EntityMap> queryStandardCurrentDataPageList(Page<EntityMap> page, @Param("param")Map<String, Object> map);
List<EntityMap> queryStandardCurrentDataPageList(Page<EntityMap> page, @Param("param") Map<String, Object> map);
List<EntityMap> selectDownloadStandardCurrentDataList(Map<String, Object> map);
List<EntityMap> selectStandardCurrentDataTotalAlarmStateList();
List<EntityMap> selectStandardAnalysisReport(Map<String, Object> map);
List<StandardCurrentDataExt> countStandardCurrentData(Map<String, Object> map);
}

View File

@ -100,15 +100,31 @@
and receive_time>=CONCAT(DATE_ADD(curdate(),interval -day(curdate())+1 day),' 00:00:00')
</if>
<if test="type == '3'.toString()">
<if test="startTime!=null and startTime!=''">
<if test="startTime != null and startTime != ''">
AND receive_time &gt;=CONCAT(DATE_FORMAT(#{startTime},'%Y-%m-%d'),' 00:00:00')
</if>
<if test="endTime!=null and endTime!=''">
<if test="endTime != null and endTime != ''">
AND receive_time &lt;=CONCAT(DATE_FORMAT(#{endTime},'%Y-%m-%d'),' 23:59:59')
</if>
</if>
GROUP BY day_title
ORDER BY day_title
</select>
</mapper>
<select id="countStandardCurrentData" resultType="com.zhgd.xmgl.modules.standard.entity.StandardCurrentDataExt">
select DATE_FORMAT(receive_time,"%Y-%m-%d %H:00:00") time,ifnull(ROUND(AVG(temperature),2),0)
temperature,ifnull(ROUND(AVG(humidity),2),0) humidity
from standard_current_data
WHERE 1=1
<if test="projectSn != null and projectSn != ''">
and project_sn=#{projectSn}
</if>
<if test="devSn != null and devSn != ''">
and dev_sn=#{devSn}
</if>
<if test="type == '1'.toString()">
and receive_time>=CONCAT(date_sub(curdate(),INTERVAL 2 DAY),' 00:00:00')
</if>
GROUP BY time
</select>
</mapper>

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentData;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentDataExt;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@ -33,4 +34,6 @@ public interface IStandardCurrentDataService extends IService<StandardCurrentDat
List<EntityMap> selectStandardAnalysisReport(Map<String, Object> map);
void saveStandardCurrentData(JSONObject json);
List<StandardCurrentDataExt> countStandardCurrentData(Map<String, Object> map);
}

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.standard.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -9,11 +10,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentData;
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentDataExt;
import com.zhgd.xmgl.modules.standard.entity.StandardDev;
import com.zhgd.xmgl.modules.standard.mapper.StandardCurrentDataMapper;
import com.zhgd.xmgl.modules.standard.mapper.StandardDevMapper;
import com.zhgd.xmgl.modules.standard.service.IStandardAlarmService;
import com.zhgd.xmgl.modules.standard.service.IStandardCurrentDataService;
import com.zhgd.xmgl.util.DateUtils;
import com.zhgd.xmgl.util.JxlExcelUtils;
import com.zhgd.xmgl.util.MessageUtil;
import org.apache.commons.lang3.StringUtils;
@ -24,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -145,7 +149,7 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
standardCurrentData.setHumidity(String.valueOf(avg));
}
standardCurrentDataMapper.insert(standardCurrentData);
StandardDev tempStandardDev=new StandardDev();
StandardDev tempStandardDev = new StandardDev();
tempStandardDev.setId(standardDev.getId());
tempStandardDev.setRealTime(new Date());
tempStandardDev.setDevHumidity(standardCurrentData.getHumidity());
@ -153,5 +157,25 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
standardDevMapper.updateById(tempStandardDev);
}
@Override
public List<StandardCurrentDataExt> countStandardCurrentData(Map<String, Object> map) {
List<StandardCurrentDataExt> standardCurrentDataExts = baseMapper.countStandardCurrentData(map);
List<String> dateStrList = DateUtils.getDateTimeStrList(20, "yyyy-MM-dd HH:00:00");
List<StandardCurrentDataExt> rtList = new ArrayList<>();
Map<String, StandardCurrentDataExt> m = standardCurrentDataExts.stream().collect(Collectors.toMap(StandardCurrentDataExt::getTime, Function.identity()));
for (String date : dateStrList) {
StandardCurrentDataExt e = m.get(date);
if (e == null) {
e = new StandardCurrentDataExt();
e.setTime(date);
e.setHumidity("0");
e.setTemperature("0");
}
e.setTime(DateUtil.format(DateUtil.parse(e.getTime()), "HH:00"));
rtList.add(e);
}
return rtList;
}
}

View File

@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.async.AsyncAiAnalyse;
import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
import com.zhgd.xmgl.base.entity.vo.SectorVo;
@ -145,9 +144,9 @@ public class AiAnalyseHardWareAlarmRecordServiceImpl extends ServiceImpl<AiAnaly
} else if ("2".equals(MapUtils.getString(map, "selectType"))) {
dayList = DateUtils.getNowFewDaysAgoList(29);
} else if ("3".equals(MapUtils.getString(map, "selectType"))) {
dayList = DateUtils.getDateStrList(100, "HH:mm");
dayList = DateUtils.getDateTimeStrList(100, "HH:mm");
} else {
dayList = DateUtils.getDateStrList(20, "HH:00");
dayList = DateUtils.getDateTimeStrList(20, "HH:00");
}
List<Map<String, Object>> dataList = new ArrayList<>();
Map<String, Object> data = aiAnalyseHardWareAlarmRecordMapper.selectAiAnalyseHardWareAlarmTrendList(map);

View File

@ -98,7 +98,7 @@ public class WaterMeterMonthRecordServiceImpl extends ServiceImpl<WaterMeterMont
private void fillMonthAlarmList(List<WaterMeterStatisticsVo.Alarm> alarmList) {
Map<String, WaterMeterStatisticsVo.Alarm> map = alarmList.stream().collect(Collectors.toMap(e -> e.getTitleTime(), Function.identity()));
alarmList.clear();
for (String date : DateUtils.getDateStrList(80, "yyyy-MM-dd")) {
for (String date : DateUtils.getDateTimeStrList(80, "yyyy-MM-dd")) {
WaterMeterStatisticsVo.Alarm alarm = map.get(date);
if (alarm == null) {
alarm = new WaterMeterStatisticsVo.Alarm();

View File

@ -95,7 +95,7 @@ public class WaterMeterRecordDetailServiceImpl extends ServiceImpl<WaterMeterRec
//近7天
map.put("addTime_begin", DateUtil.formatDate(DateUtil.offsetDay(new Date(), -10)));
List<TrendVo> list = baseMapper.queryUseRecordTrend(map);
List<String> days = DateUtils.getDateStrList(60, "yyyy-MM-dd");
List<String> days = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
return TrendVo.fillTrendVos(list, days, "MM-dd");
} else if (Objects.equals(type, 2)) {
//本月
@ -107,13 +107,13 @@ public class WaterMeterRecordDetailServiceImpl extends ServiceImpl<WaterMeterRec
//近半年
map.put("addTime_begin", DateUtils.offsetDayStr(DateUtil.now(), -6));
List<TrendVo> list = waterMeterMonthRecordMapper.queryUseRecord(map);
List<String> dateStrList = DateUtils.getDateStrList(90, "yyyy-MM");
List<String> dateStrList = DateUtils.getDateTimeStrList(90, "yyyy-MM");
return TrendVo.fillTrendVos(list, dateStrList, "yyyy-MM");
} else if (Objects.equals(type, 4)) {
//近一年
map.put("addTime_begin", DateUtils.offsetDayStr(DateUtil.now(), -12));
List<TrendVo> list = waterMeterMonthRecordMapper.queryUseRecord(map);
List<String> dateStrList = DateUtils.getDateStrList(93, "yyyy-MM");
List<String> dateStrList = DateUtils.getDateTimeStrList(93, "yyyy-MM");
return TrendVo.fillTrendVos(list, dateStrList, "yyyy-MM");
}
return trendVos;

View File

@ -1012,7 +1012,7 @@ status 状态码 String 1表示成功其余表示失败
return workerAttendance;
}).collect(Collectors.groupingBy(WorkerAttendance::getCreateTimeHour));
ArrayList<NumberTimeTableVo> rtList = new ArrayList<>();
List<String> allHourInDay = DateUtils.getDateStrList(100, "HH:mm");
List<String> allHourInDay = DateUtils.getDateTimeStrList(100, "HH:mm");
int lastNum = 0;
for (String hour : allHourInDay) {
List<WorkerAttendance> workerAttendances = timeDateListMap.get(hour);

View File

@ -328,7 +328,7 @@ public class DateUtils {
}
return list;
} else if (type == 2) {
return getDateStrList(60, "yyyy-MM-dd");
return getDateTimeStrList(60, "yyyy-MM-dd");
} else if (type == 3) {
return getNowMonthAllDayList();
}
@ -441,7 +441,7 @@ public class DateUtils {
}
/**
* 获取所有日期列表
* 获取所有日期时间列表
*
* @param type 类型
* 10.近12小时,20.近24小时每小时,30.近半天,40.近一天,50.近两天,60.近一周每天,70.近两周,72.近15天每天,80.近一个月每天,90.近半年每月,93.近一年每月
@ -449,7 +449,7 @@ public class DateUtils {
* @param pattern 格式 yyyy-MM-dd HH:mm:ss
* @return
*/
public static List<String> getDateStrList(int type, String pattern) {
public static List<String> getDateTimeStrList(int type, String pattern) {
if (type == 20) {
//近24小时每小时egHH:00
ArrayList<String> rtList = new ArrayList<>();
@ -559,6 +559,6 @@ public class DateUtils {
public static void main(String[] args) {
System.out.println(getNowWeekAllDayList());
System.out.println(getDateStrList(100, "HH:mm"));
System.out.println(getDateTimeStrList(100, "HH:mm"));
}
}