bug修复

This commit is contained in:
guo 2024-01-19 16:18:03 +08:00
parent 2447883c03
commit ceea73541e
18 changed files with 437 additions and 291 deletions

View File

@ -63,12 +63,10 @@ public class AntiPressureFoldDev implements Serializable {
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "进场时间")
private java.util.Date entryTime;
/**
* 负责人
*/
@Excel(name = "负责人", width = 15)
@ApiModelProperty(value = "负责人")
private java.lang.String personInCharge;
private java.lang.Long dutyUserId;
@ApiModelProperty(value = "负责人名称")
private java.lang.String dutyUserName;
/**
* 所属试验室
*/

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.Date;
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 lombok.Data;
@ -165,4 +166,10 @@ public class AntiPressureFoldManage implements Serializable {
@Excel(name = "项目sn", width = 15)
@ApiModelProperty(value = "项目sn")
private java.lang.String projectSn;
@TableField(exist = false)
@ApiModelProperty(value = "所属试验室")
private java.lang.String affiliatedLaboratory;
@TableField(exist = false)
@ApiModelProperty(value = "设备名称")
private java.lang.String deviceName;
}

View File

@ -1,8 +1,15 @@
package com.zhgd.xmgl.modules.antipressurefold.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManage;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 抗压抗折一体机-管理
@ -13,4 +20,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@Mapper
public interface AntiPressureFoldManageMapper extends BaseMapper<AntiPressureFoldManage> {
IPage<AntiPressureFoldManage> queryList(Page<AntiPressureFoldManage> page, @Param(Constants.WRAPPER) QueryWrapper<AntiPressureFoldManage> queryWrapper);
List<AntiPressureFoldManage> queryList(@Param(Constants.WRAPPER) QueryWrapper<AntiPressureFoldManage> queryWrapper);
}

View File

@ -1,4 +1,9 @@
<?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.zhgd.xmgl.modules.antipressurefold.mapper.AntiPressureFoldManageMapper">
<select id="queryList" resultType="com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManage">
select apfm.*,apfd.device_name,apfd.affiliated_laboratory from anti_pressure_fold_manage apfm
join anti_pressure_fold_dev apfd on apfd.dev_sn=apfm.dev_sn
${ew.customSqlSegment}
</select>
</mapper>

View File

@ -1,21 +1,20 @@
package com.zhgd.xmgl.modules.antipressurefold.service.impl;
import com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManage;
import com.zhgd.xmgl.modules.antipressurefold.mapper.AntiPressureFoldManageMapper;
import com.zhgd.xmgl.modules.antipressurefold.service.IAntiPressureFoldManageService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.util.PageUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManage;
import com.zhgd.xmgl.modules.antipressurefold.mapper.AntiPressureFoldManageMapper;
import com.zhgd.xmgl.modules.antipressurefold.service.IAntiPressureFoldManageService;
import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import com.zhgd.xmgl.util.RefUtil;
/**
* @Description: 抗压抗折一体机-管理
* @author pds
@ -28,7 +27,7 @@ public class AntiPressureFoldManageServiceImpl extends ServiceImpl<AntiPressureF
public IPage<AntiPressureFoldManage> queryPageList(HashMap<String, Object> paramMap) {
QueryWrapper<AntiPressureFoldManage> queryWrapper = getQueryWrapper(paramMap);
Page<AntiPressureFoldManage> page = PageUtil.getPage(paramMap);
IPage<AntiPressureFoldManage> pageList = this.page(page, queryWrapper);
IPage<AntiPressureFoldManage> pageList = baseMapper.queryList(page, queryWrapper);
pageList.setRecords(dealList(pageList.getRecords()));
return pageList;
}
@ -36,12 +35,13 @@ public class AntiPressureFoldManageServiceImpl extends ServiceImpl<AntiPressureF
@Override
public List<AntiPressureFoldManage> queryList(HashMap<String, Object> paramMap) {
QueryWrapper<AntiPressureFoldManage> queryWrapper = getQueryWrapper(paramMap);
return dealList(this.list(queryWrapper));
return dealList(baseMapper.queryList(queryWrapper));
}
private QueryWrapper<AntiPressureFoldManage> getQueryWrapper(HashMap<String, Object> paramMap) {
QueryWrapper<AntiPressureFoldManage> queryWrapper = QueryGenerator.initPageQueryWrapper(AntiPressureFoldManage.class, paramMap);
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(AntiPressureFoldManage::getId));
String alias = "apfm.";
QueryWrapper<AntiPressureFoldManage> queryWrapper = QueryGenerator.initPageQueryWrapper(AntiPressureFoldManage.class, paramMap, alias);
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(AntiPressureFoldManage::getId));
return queryWrapper;
}

View File

@ -13,12 +13,14 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.IOUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -27,8 +29,11 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -193,7 +198,7 @@ public class MaterialApproachRecordController {
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "材料进场记录 列表");
mv.addObject(NormalExcelConstants.CLASS, MaterialApproachRecord.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("材料进场记录 列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams(null, "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
@ -213,7 +218,7 @@ public class MaterialApproachRecordController {
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setTitleRows(0);
params.setHeadRows(1);
params.setNeedSave(true);
try {
@ -236,4 +241,20 @@ public class MaterialApproachRecordController {
return Result.ok("文件导入失败!");
}
@GetMapping(value = "/downloadTemplate")
@ApiOperation(value = "下载导入模板")
public void downloadTemplate(HttpServletResponse response) {
try {
OutputStream out = response.getOutputStream();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-project");
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("材料进场记录导入模板.xlsx", "UTF-8"));
InputStream fis = new ClassPathResource("template/材料进场记录导入模板.xlsx").getInputStream();
IOUtils.copy(fis, out);
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -34,7 +34,7 @@ public class MaterialApproachRecord implements Serializable {
/**
* 进场时间
*/
@Excel(name = "进场时间", width = 15, format = "yyyy-MM-dd")
@Excel(name = "进场时间(格式yyyy-MM-dd)", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "进场时间")
@ -63,8 +63,10 @@ public class MaterialApproachRecord implements Serializable {
@Excel(name = "进场量", width = 15)
@ApiModelProperty(value = "进场量")
private Double approachVolume;
@Excel(name = "出场重量", width = 15)
@ApiModelProperty(value = "出场量")
private Double appearanceVolume;
@Excel(name = "净重量", width = 15)
@ApiModelProperty(value = "净重量")
private Double netWeightVolume;

View File

@ -138,6 +138,8 @@ public class PressureTestMachineManage implements Serializable {
@Excel(name = "公称直径(mm)", width = 15)
@ApiModelProperty(value = "公称直径(mm)")
private java.lang.Double nominalDiameter;
@ApiModelProperty(value = "施工部位")
private String constructionPart;
/**
* 创建时间 yyyy-MM-dd HH:mm:ss
*/

View File

@ -1,7 +1,9 @@
package com.zhgd.xmgl.modules.standard.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManageBlockNumber;
import com.zhgd.xmgl.modules.standard.entity.StandardAlarm;
import com.zhgd.xmgl.modules.standard.service.IStandardAlarmService;
import io.swagger.annotations.Api;
@ -10,11 +12,10 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -34,11 +35,26 @@ public class StandardAlarmController {
@Autowired
private IStandardAlarmService standardAlarmService;
/**
* 分页列表查询
*
* @return
*/
@ApiOperation(value = "分页列表查询标养室报警记录", notes = "分页列表查询标养室报警记录", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "type", value = "1当天", paramType = "query", required = false, dataType = "Integer"),
})
@GetMapping(value = "/page")
public Result<IPage<StandardAlarm>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> paramMap) {
return Result.success(standardAlarmService.queryPageList(paramMap));
}
@ApiOperation(value = "标养室报警统计", notes = "标养室报警统计", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = false, dataType = "String"),
})
@PostMapping(value = "/getStandardAlarmStatistics")
public Result<Map<String, Object>> getStandardAlarmStatistics(@RequestBody Map<String, Object> map) {

View File

@ -66,7 +66,6 @@ public class StandardCurrentDataController {
*/
@ApiOperation(value = "添加标养室实时数据信息", notes = "添加标养室实时数据信息", httpMethod = "POST")
//@PostMapping(value = "/add",produces = {"application/json;charset=UTF-8"})
@PostMapping(value = "/saveStandardCurrentData", produces = {"application/json;charset=UTF-8"})
public Result saveStandardCurrentData(@RequestBody final JSONObject json) {
log.info("saveStandardCurrentData:{}", JSON.toJSONString(json));
@ -81,7 +80,6 @@ public class StandardCurrentDataController {
* @return
*/
@ApiOperation(value = "添加标养室实时数据信息", notes = "添加标养室实时数据信息", httpMethod = "POST")
//@PostMapping(value = "/saveStandardCurrentData")
@PostMapping(value = "/addCurrentData")
public Result<StandardCurrentData> addCurrentData(@RequestBody StandardCurrentData standardCurrentData) {
log.info("addCurrentData:{}", JSON.toJSONString(standardCurrentData));
@ -129,8 +127,8 @@ public class StandardCurrentDataController {
@ApiOperation(value = "查询设备最新一条实时数据", notes = "查询设备最新一条实时数据", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "type", value = "1当天", paramType = "body", required = false, dataType = "Integer"),
})
@PostMapping(value = "/selectNewCurrentData")
@ -194,7 +192,7 @@ public class StandardCurrentDataController {
@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),
@ApiImplicitParam(name = "type", value = "查询类型1过去24小时 2今天", dataType = "Integer", paramType = "body", required = true),
})
@PostMapping(value = "/countStandardCurrentData")
public Result<List<StandardCurrentDataExt>> countStandardCurrentData(@RequestBody @ApiIgnore Map<String, Object> 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;
@ -43,12 +44,20 @@ public class StandardAlarm implements Serializable {
@Excel(name = "报警值", width = 15)
@ApiModelProperty(value = "报警值")
private java.lang.String alarmValue;
/**报警时间*/
/**
* 报警时间
*/
@Excel(name = "报警时间", width = 15)
@ApiModelProperty(value = "报警时间")
private java.lang.String alarmTime;
/**阀值*/
/**
* 阀值
*/
@Excel(name = "阀值", width = 15)
@ApiModelProperty(value = "阀值")
private java.lang.String thresholdValue;
@TableField(exist = false)
@ApiModelProperty(value = "实验室名称(设备名称)")
private java.lang.String laboratoryName;
}

View File

@ -1,12 +1,17 @@
package com.zhgd.xmgl.modules.standard.mapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import org.apache.ibatis.annotations.Mapper;
import com.zhgd.xmgl.modules.standard.entity.StandardAlarm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* @Description: 标养室报警记录
@ -28,4 +33,6 @@ public interface StandardAlarmMapper extends BaseMapper<StandardAlarm> {
List<Map<String, Object>> selectDevAlarmList(Map<String, Object> map);
List<EntityMap> selectExcelStandardDevAlarmList(Map<String, Object> map);
IPage<StandardAlarm> queryPageList(Page page, @Param("p") HashMap<String, Object> paramMap);
}

View File

@ -5,14 +5,26 @@
<select id="selectStandardAlarmList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap" parameterType="map">
SELECT a.*,b.business_name,b.laboratory_addr,b.laboratory_name,b.laboratory_director,b.lx_phone
from standard_alarm a LEFT JOIN standard_dev b ON (a.dev_sn=b.dev_sn and a.project_sn=b.project_sn)
WHERE a.dev_sn=#{devSn} AND a.project_sn=#{projectSn}
WHERE 1=1
<if test="devSn != null and devSn != ''">
and a.dev_sn=#{devSn}
</if>
<if test="projectSn != null and projectSn != ''">
AND a.project_sn=#{projectSn}
</if>
ORDER BY a.alarm_time DESC
LIMIT 10
</select>
<select id="getCurrentDayStandardAlarmCount" resultType="java.lang.Integer" parameterType="map">
SELECT count(1)
from standard_alarm a
WHERE a.dev_sn=#{devSn} AND a.project_sn=#{projectSn}
WHERE 1=1
<if test="devSn != null and devSn != ''">
and a.dev_sn=#{devSn}
</if>
<if test="projectSn != null and projectSn != ''">
AND a.project_sn=#{projectSn}
</if>
and a.alarm_time>=CONCAT(DATE_FORMAT(now(),"%Y-%m-%d"),' 00:00:00')
</select>
<select id="selectStandardAlarmListByTime" resultType="com.zhgd.xmgl.modules.standard.entity.StandardAlarm">
@ -89,4 +101,20 @@
</if>
ORDER BY w1.alarm_time desc
</select>
<select id="queryPageList" resultType="com.zhgd.xmgl.modules.standard.entity.StandardAlarm">
select * from standard_alarm sa
join standard_dev sd on sa.dev_sn = sd.dev_sn
where 1=1
<if test="p.projectSn != null and p.projectSn != ''">
and sa.project_sn = #{p.projectSn}
</if>
<if test="p.devSn != null and p.devSn != ''">
and sa.dev_sn = #{p.devSn}
</if>
<if test="p.type == '1'.toString()">
and sa.alarm_time >= current_date
</if>
order by sa.alarm_time desc
</select>
</mapper>

View File

@ -6,7 +6,13 @@
parameterType="map">
SELECT a.*
from standard_current_data a
WHERE a.dev_sn=#{devSn} AND a.project_sn=#{projectSn}
WHERE 1=1
<if test="devSn != null and devSn != ''">
and a.dev_sn=#{devSn}
</if>
<if test="projectSn != null and projectSn != ''">
AND a.project_sn=#{projectSn}
</if>
<if test="type == '1'.toString()">
and a.receive_time > current_date
</if>
@ -129,6 +135,9 @@
<if test="type == '1'.toString()">
and receive_time>=CONCAT(date_sub(curdate(),INTERVAL 2 DAY),' 00:00:00')
</if>
<if test="type == '2'.toString()">
and receive_time>=current_date
</if>
GROUP BY time
</select>
</mapper>

View File

@ -1,11 +1,13 @@
package com.zhgd.xmgl.modules.standard.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.xmgl.modules.standard.entity.StandardAlarm;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentData;
import com.zhgd.xmgl.modules.standard.entity.StandardDev;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -29,4 +31,5 @@ public interface IStandardAlarmService extends IService<StandardAlarm> {
void exporExcelStandardDevAlarm(HttpServletResponse response, Map<String, Object> map);
IPage<StandardAlarm> queryPageList(HashMap<String, Object> paramMap);
}

View File

@ -1,6 +1,8 @@
package com.zhgd.xmgl.modules.standard.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
@ -13,6 +15,7 @@ import com.zhgd.xmgl.modules.standard.mapper.StandardWarningMapper;
import com.zhgd.xmgl.modules.standard.service.IStandardAlarmService;
import com.zhgd.xmgl.util.DateUtils;
import com.zhgd.xmgl.util.JxlExcelUtils;
import com.zhgd.xmgl.util.PageUtil;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -144,6 +147,12 @@ public class StandardAlarmServiceImpl extends ServiceImpl<StandardAlarmMapper, S
}
}
@Override
public IPage<StandardAlarm> queryPageList(HashMap<String, Object> paramMap) {
Page page = PageUtil.getPage(paramMap);
return standardAlarmMapper.queryPageList(page, paramMap);
}
@Override
public void addStandardAlarmData(StandardCurrentData standardCurrentData, StandardDev standardDev) {
QueryWrapper<StandardWarning> queryWrapper = new QueryWrapper<>();

View File

@ -19,6 +19,7 @@ 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.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -159,6 +160,8 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
@Override
public List<StandardCurrentDataExt> countStandardCurrentData(Map<String, Object> map) {
Integer type = MapUtils.getInteger(map, "type");
if (Objects.equals(type, 1)) {
List<StandardCurrentDataExt> standardCurrentDataExts = baseMapper.countStandardCurrentData(map);
List<String> dateStrList = DateUtils.getDateTimeStrList(20, "yyyy-MM-dd HH:00:00");
List<StandardCurrentDataExt> rtList = new ArrayList<>();
@ -175,6 +178,25 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
rtList.add(e);
}
return rtList;
} else if (Objects.equals(type, 2)) {
List<StandardCurrentDataExt> standardCurrentDataExts = baseMapper.countStandardCurrentData(map);
List<String> dateStrList = DateUtils.getDateTimeStrList(100, "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;
}
return null;
}