bug修复

This commit is contained in:
guo 2023-12-18 16:22:20 +08:00
parent 7bb923bdb0
commit 2fcc12604d
6 changed files with 121 additions and 33 deletions

View File

@ -269,4 +269,7 @@ public class GantryCraneCurrentData implements Serializable {
private java.lang.String powerOnTimes;
@TableField(exist = false)
private java.lang.String fieldAcquisitionUrl;
@TableField(exist = false)
@ApiModelProperty(value = "风速等级")
private java.lang.String windSpeedLevel;
}

View File

@ -6,12 +6,12 @@ import org.checkerframework.checker.units.qual.C;
@Data
public class CountGantryCraneWorkCycleVo {
//@ApiModelProperty("工作时长(小时)")
//@ApiModelProperty("主钩循环(次)")
//@ApiModelProperty("吊钩载重(吨)")
//@ApiModelProperty("副钩循环(次)")
//private String workTimeCount;
//private String 主钩循环;
//private String 吊钩载重;
//private String 副钩循环;
@ApiModelProperty("工作时长(小时)")
private Double workTimeSum;
@ApiModelProperty("主钩循环(次)")
private Double mainHookCount;
@ApiModelProperty("吊钩载重(吨)")
private Double hookWeightSum;
@ApiModelProperty("副钩循环(次)")
private Double auxiliaryHookCount;
}

View File

@ -44,7 +44,13 @@
<select id="countGantryCraneWorkCycle"
resultType="com.zhgd.xmgl.modules.bigdevice.entity.vo.CountGantryCraneWorkCycleVo">
select ifnull(sum(ifnull(work_time, 0)) / 3600, 0) workTimeCount
select ifnull(sum(ifnull(work_time, 0)) / 3600, 0) workTimeSum,
sum(ifnull(if(work_type=0,1,0),0)) mainHookCount,
sum(ifnull(if(work_type=1,1,0),0)) auxiliaryHookCount,
sum(ifnull(master_hook_work_max_weight,0))+
sum(ifnull(second_master_hook_work_max_weight,0))+
sum(ifnull(sub_hook_work_max_weight,0))+
sum(ifnull(second_sub_hook_work_max_weight,0)) hookWeightSum
from gantry_crane_work_cycle
where 1 = 1
<if test="projectSn != null and projectSn != ''">
@ -56,9 +62,12 @@
</select>
<select id="workTimeAnalysis" resultType="com.zhgd.xmgl.base.entity.vo.TrendVo">
SELECT date_format(work_time, '%Y-%m-%d') x, count(*) y
SELECT date_format(add_time, '%Y-%m-%d') x, ROUND(ifnull(sum(ifnull(work_time, 0)) / 3600, 0),2) y
FROM gantry_crane_work_cycle
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>

View File

@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.bigdevice.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.execption.OpenAlertException;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.async.AsyncGantryCrane;
@ -11,11 +12,11 @@ import com.zhgd.xmgl.modules.bigdevice.entity.GantryCraneCurrentData;
import com.zhgd.xmgl.modules.bigdevice.mapper.GantryCraneCurrentDataMapper;
import com.zhgd.xmgl.modules.bigdevice.mapper.GantryCraneMapper;
import com.zhgd.xmgl.modules.bigdevice.service.IGantryCraneCurrentDataService;
import com.zhgd.xmgl.util.AqiUtil;
import com.zhgd.xmgl.util.MessageUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@ -40,25 +41,29 @@ public class GantryCraneCurrentDataServiceImpl extends ServiceImpl<GantryCraneCu
@Override
public void saveGantryCraneCurrentData(GantryCraneCurrentData gantryCraneCurrentData) {
QueryWrapper<GantryCrane> queryWrapper=new QueryWrapper<>();
QueryWrapper<GantryCrane> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(GantryCrane::getDevSn, gantryCraneCurrentData.getDevSn());
GantryCrane gantryCrane=gantryCraneMapper.selectOne(queryWrapper);
if (gantryCrane==null){
GantryCrane gantryCrane = gantryCraneMapper.selectOne(queryWrapper);
if (gantryCrane == null) {
throw new OpenAlertException(MessageUtil.get("EquipmentNumIncorrectErr"));
}
gantryCraneCurrentData.setProjectSn(gantryCrane.getProjectSn());
gantryCraneCurrentData.setReciveTime(new Date());
gantryCraneCurrentDataMapper.insert(gantryCraneCurrentData);
GantryCrane tempGantryCrane=new GantryCrane();
GantryCrane tempGantryCrane = new GantryCrane();
tempGantryCrane.setId(gantryCrane.getId());
tempGantryCrane.setRealTime(new Date());
gantryCraneMapper.updateById(tempGantryCrane);
asyncGantryCrane.sendGantryCraneCurrentData(gantryCraneCurrentData,gantryCrane);
asyncGantryCrane.sendGantryCraneCurrentData(gantryCraneCurrentData, gantryCrane);
}
@Override
public GantryCraneCurrentData getNewestGantryCraneCurrentData(Map<String, Object> map) {
return gantryCraneCurrentDataMapper.getNewestGantryCraneCurrentData(map);
GantryCraneCurrentData data = gantryCraneCurrentDataMapper.getNewestGantryCraneCurrentData(map);
if (StringUtils.isNotBlank(data.getWindSpeed())) {
data.setWindSpeedLevel(AqiUtil.getWindSpeedLevel(Double.valueOf(data.getWindSpeed())));
}
return data;
}
@Override
@ -71,7 +76,7 @@ public class GantryCraneCurrentDataServiceImpl extends ServiceImpl<GantryCraneCu
int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString());
int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString());
Page<EntityMap> page = new Page<>(pageNo, pageSize);
List<EntityMap> list=gantryCraneCurrentDataMapper.queryGantryCraneCurrentDataPageList(page, map);
List<EntityMap> list = gantryCraneCurrentDataMapper.queryGantryCraneCurrentDataPageList(page, map);
return page.setRecords(list);
}
}

View File

@ -90,7 +90,7 @@ public class GantryCraneWorkCycleServiceImpl extends ServiceImpl<GantryCraneWork
if (Objects.equals(MapUtils.getInteger(paramMap, "type"), 1)) {
days = DateUtils.getDateStrList(60, "yyyy-MM-dd");
} else if (Objects.equals(MapUtils.getInteger(paramMap, "type"), 2)) {
days = DateUtils.getDaysBefore(400);
days = DateUtils.getDateStrList(400, "yyyy-MM-dd");
} else {
return null;
}

View File

@ -2,7 +2,6 @@ package com.zhgd.xmgl.util;
import cn.hutool.http.HttpException;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.gexin.fastjson.JSON;
import com.gexin.fastjson.JSONObject;
import com.zhgd.redis.lock.RedisRepository;
@ -296,11 +295,83 @@ public class AqiUtil {
return result;
}
/**
* 获取风速等级
*
* @param windSpeed
* @return
*/
public static String getWindSpeedLevel(Double windSpeed) {
//风级 名称 风速(m/s) (km/h) 陆地地面物象
//0 无风 0.0-0.2 <1 烟直上
//1 软风 0.3-1.5 1-5 烟示风向
//2 轻风 1.6-3.3 6-11 感觉有风
//3 微风 3.4-5.4 12-19 旌旗展开
//4 和风 5.5-7.9 20-28 吹起尘土
//5 清风 8.0-10.7 29-38 小树摇摆
//6 强风 10.8-13.8 39-49 电线有声
//7 劲风疾风 13.9-17.1 50-61 步行困难
//8 大风 17.2-20.7 62-74 折毁树枝
//9 烈风 20.8-24.4 75-88 小损房屋
//10 狂风 24.5-28.4 89-102 拔起树木
//11 暴风 28.5-32.6 103-117 损毁重大
//12 台风一级飓风 32.7-36.9 117-134 摧毁极大
//13 台风一级飓风 37.0-41.4 134-149
//14 强台风二级飓风 41.5-46.1 150-166
//15 强台风三级飓风 46.2-50.9 167-183
//16 超强台风三级飓风 51.0-56.0 184-201
//17 超强台风四级飓风 56.1-61.2 202-220
//17+ 超强台风四级飓风 61.3 221
//超级台风五级飓风 250
if (windSpeed == null) {
return null;
}
if (windSpeed >= 0 && windSpeed < 0.3) {
return "0级";
} else if (windSpeed >= 0.3 && windSpeed < 1.6) {
return "1级";
} else if (windSpeed >= 1.6 && windSpeed < 3.4) {
return "2级";
} else if (windSpeed >= 3.4 && windSpeed < 5.5) {
return "3级";
} else if (windSpeed >= 5.5 && windSpeed < 8) {
return "4级";
} else if (windSpeed >= 8 && windSpeed < 10.8) {
return "5级";
} else if (windSpeed >= 10.8 && windSpeed < 13.9) {
return "6级";
} else if (windSpeed >= 13.9 && windSpeed < 17.2) {
return "7级";
} else if (windSpeed >= 17.2 && windSpeed < 20.8) {
return "8级";
} else if (windSpeed >= 20.8 && windSpeed < 24.5) {
return "9级";
} else if (windSpeed >= 24.5 && windSpeed < 28.5) {
return "10级";
} else if (windSpeed >= 28.5 && windSpeed < 32.7) {
return "11级";
} else if (windSpeed >= 32.7 && windSpeed < 37) {
return "12级";
} else if (windSpeed >= 37 && windSpeed < 41.5) {
return "13级";
} else if (windSpeed >= 41.5 && windSpeed < 46.2) {
return "14级";
} else if (windSpeed >= 46.2 && windSpeed < 51) {
return "15级";
} else if (windSpeed >= 51 && windSpeed < 56.1) {
return "16级";
} else if (windSpeed >= 56.1 && windSpeed < 61.3) {
return "17级";
} else if (windSpeed >= 61.3) {
return "17+级";
}
return null;
}
public static void main(String[] args) {
/*double temp=getPm25IAQI(85d);
log.info(temp);
log.info(getDegree(getPollutionDegree(temp)));*/
log.info(getDegree(getPollutionDegree(temp)));*/
//log.info(getWeatherInfo("110100"));
//log.info(getWeatherData("110100"));
//System.out.println(getWeatherInfo("11"));