环境设备10分钟没有接收数据就离线,混凝土拌合站bug修复

This commit is contained in:
guoshengxiong 2025-07-30 15:17:28 +08:00
parent abdb7e04c1
commit e7eef4e308
8 changed files with 35 additions and 21 deletions

View File

@ -51,10 +51,10 @@
and dev_sn = #{devSn}
</if>
<if test="type == '2'.toString()">
and create_date > date_sub(create_date, interval 6 day)
and create_date > date_sub(current_date, interval 6 day)
</if>
<if test="type == '3'.toString()">
and create_date > date_sub(create_date, interval 29 day)
and create_date > date_sub(current_date, interval 29 day)
</if>
group by x
</select>
@ -67,7 +67,7 @@
<if test="devSn != null and devSn != ''">
and dev_sn = #{devSn}
</if>
and create_date > date_sub(create_date, interval 6 day)
and create_date > date_sub(current_date, interval 6 day)
group by x
</select>
</mapper>

View File

@ -158,6 +158,7 @@ public class ConcreteMixStationDataController {
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "devSn", value = "设备sn", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "type", value = "1今日2、7日3、30日", paramType = "body", required = true, dataType = "Integer"),
})
@PostMapping(value = "/countUseStatus")
public Result<SectorVo> countUseStatus(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {

View File

@ -56,6 +56,15 @@
<if test="devSn != null and devSn != ''">
and dev_sn = #{devSn}
</if>
<if test="type == '1'.toString()">
and discharge_time > current_date
</if>
<if test="type == '2'.toString()">
and discharge_time > date_sub(current_date,interval 6 day)
</if>
<if test="type == '3'.toString()">
and discharge_time > date_sub(current_date,interval 29 day)
</if>
group by use_status
</select>
@ -73,10 +82,10 @@
and discharge_time > current_date
</if>
<if test="type == '2'.toString()">
and discharge_time > date_sub(discharge_time,interval 6 day)
and discharge_time > date_sub(current_date,interval 6 day)
</if>
<if test="type == '3'.toString()">
and discharge_time > date_sub(discharge_time,interval 29 day)
and discharge_time > date_sub(current_date,interval 29 day)
</if>
group by power_level
</select>

View File

@ -2,25 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhgd.xmgl.modules.concretemixstation.mapper.ConcreteMixStationMaterialDataMapper">
<select id="countMaterialName" resultType="com.zhgd.xmgl.base.entity.vo.SectorOneVo">
select material_name name,ifnull(sum(actual_amount),0) count
from concrete_mix_station_material_data
select cmsmd.material_name name
,ifnull(sum(cmsmd.actual_amount),0) count
from concrete_mix_station_material_data cmsmd
join concrete_mix_station_data cmsd on cmsd.id=cmsmd.concrete_mix_station_data_id
where 1=1
<if test="projectSn != null and projectSn != ''">
and project_sn = #{projectSn}
and cmsmd.project_sn = #{projectSn}
</if>
<if test="devSn != null and devSn != ''">
and dev_sn = #{devSn}
and cmsmd.dev_sn = #{devSn}
</if>
<if test="type == '1'.toString()">
and create_date > current_date
and cmsd.discharge_time > current_date
</if>
<if test="type == '2'.toString()">
and create_date > date_sub(create_date,interval 6 day)
and cmsd.discharge_time > date_sub(current_date,interval 6 day)
</if>
<if test="type == '3'.toString()">
and create_date > date_sub(create_date,interval 29 day)
and cmsd.discharge_time > date_sub(current_date,interval 29 day)
</if>
group by material_name
group by cmsmd.material_name
order by count desc
</select>
</mapper>

View File

@ -5,7 +5,7 @@
(case
when round((UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(
${real_time}
)) / 86400) &lt;= 7 then 1
)) / 60) &lt;= 10 then 1
else 0 end)
</sql>
<update id="updateEnvironmentDevRealTimeById">

View File

@ -15,10 +15,10 @@
and create_date > current_date
</if>
<if test="type == '2'.toString()">
and create_date > date_sub(create_date,interval 6 day)
and create_date > date_sub(current_date,interval 6 day)
</if>
<if test="type == '3'.toString()">
and create_date > date_sub(create_date,interval 29 day)
and create_date > date_sub(current_date,interval 29 day)
</if>
group by material_name
order by count desc

View File

@ -15,10 +15,10 @@
and create_date > current_date
</if>
<if test="type == '2'.toString()">
and create_date > date_sub(create_date,interval 6 day)
and create_date > date_sub(current_date,interval 6 day)
</if>
<if test="type == '3'.toString()">
and create_date > date_sub(create_date,interval 29 day)
and create_date > date_sub(current_date,interval 29 day)
</if>
group by clmc
order by count desc

View File

@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.*;
@ -29,6 +30,7 @@ import java.util.*;
**/
@Slf4j
@Component
@RequestMapping("/xmgl/task/")
public class VideoTask {
@Autowired
private ProjectVideoConfigMapper projectVideoConfigMapper;
@ -43,6 +45,7 @@ public class VideoTask {
@SchedulerLock(name = "updateVideoState", lockAtMostFor = 1000 * 60 * 60, lockAtLeastFor = 1000 * 60 * 5)
@Scheduled(cron = "0 0 */1 * * ?")
@RequestMapping("updateVideoState")
public void updateVideoState() {
try {
QueryWrapper<ProjectVideoConfig> queryWrapper = new QueryWrapper<>();
@ -54,8 +57,7 @@ public class VideoTask {
}
}
} catch (Exception e) {
//log.error("error",e);
log.info(e.getMessage());
log.error("error",e);
}
}
@ -65,7 +67,7 @@ public class VideoTask {
queryWrapper.lambda().eq(VideoItem::getVideoId, videoConfig.getId());
List<VideoItem> list = videoItemMapper.selectList(queryWrapper);
if (list != null && list.size() > 0) {
if (videoConfig.getVideoType() == ProjectVideoConfigVideoTypeEnum.YSY.getValue()) {
if (Objects.equals(videoConfig.getVideoType(), ProjectVideoConfigVideoTypeEnum.YSY.getValue())) {
String accessToken = YsVideoUtil.getToken(videoConfig.getAppId(), videoConfig.getAppSecret());
for (VideoItem videoItem : list) {
Integer state = YsVideoUtil.getVideoStatus(videoConfig.getAppId(), videoConfig.getAppSecret(), videoItem.getSerialNumber(), accessToken);