bug修改

This commit is contained in:
guo 2024-01-24 18:55:08 +08:00
parent 26adb2882e
commit e4ba5a42b6
6 changed files with 74 additions and 10 deletions

View File

@ -110,7 +110,7 @@ public class RtWorkTicketServiceImpl extends ServiceImpl<RtWorkTicketMapper, RtW
videoItem.setPlayUrl(url);
}
} catch (Exception e) {
e.printStackTrace();
log.error("err:", e);
}
}
}

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.smartgrout.controller;
import com.zhgd.xmgl.base.entity.vo.FlexibleBigScreenVo;
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
import com.zhgd.xmgl.modules.smartgrout.service.ISmartGroutSteelBeamDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -185,11 +186,21 @@ public class SmartGroutSteelBeamDataController {
@ApiOperation(value = "统计压浆孔合格情况", notes = "统计压浆孔合格情况", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "type", value = "类型1每月", paramType = "body", required = true, dataType = "String"),
})
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "type", value = "类型1每月", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/countStatus")
public Result<FlexibleBigScreenVo> countStatus(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(smartGroutSteelBeamDataService.countStatus(paramMap));
}
@ApiOperation(value = "统计钢束压浆合格率", notes = "统计钢束压浆合格率", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "type", value = "1今日2、7日3、30日", paramType = "body", required = true, dataType = "Integer"),
})
@PostMapping(value = "/countStatusTrend")
public Result<List<TrendOneVo>> countStatusTrend(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(smartGroutSteelBeamDataService.countStatusTrend(paramMap));
}
}

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.smartgrout.mapper;
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutSteelBeamData;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -17,4 +18,6 @@ import java.util.List;
public interface SmartGroutSteelBeamDataMapper extends BaseMapper<SmartGroutSteelBeamData> {
List<HashMap<String, Object>> countStatus(HashMap<String, Object> paramMap);
List<TrendOneVo> countStatusTrend(HashMap<String, Object> paramMap);
}

View File

@ -1,12 +1,37 @@
<?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.smartgrout.mapper.SmartGroutSteelBeamDataMapper">
<select id="countStatus" resultType="java.util.HashMap">
select date_format(create_date, '%Y-%m') 月份, ifnull(sum(if(status=1,1,0)),0)
合格,ifnull(sum(if(status=2,1,0)),0) 不合格
from smart_grout_steel_beam_data
where project_sn = #{projectSn}
group by date_format(create_date, '%Y-%m')
</select>
<select id="countStatus" resultType="java.util.HashMap">
select date_format(create_date, '%Y-%m') 月份, ifnull(sum(if(status=1,1,0)),0)
合格,ifnull(sum(if(status=2,1,0)),0) 不合格
from smart_grout_steel_beam_data
where project_sn = #{projectSn}
group by date_format(create_date, '%Y-%m')
<select id="countStatusTrend" resultType="com.zhgd.xmgl.base.entity.vo.TrendOneVo">
select
<if test="type == '1'.toString()">
date_format(end_time, '%Y-%m-%d %H:00') x,
</if>
<if test="type == '2'.toString()">
date_format(end_time, '%Y-%m-%d') x,
</if>
<if test="type == '3'.toString()">
date_format(end_time, '%Y-%m-%d') x,
</if>
ifnull(round(sum(if(status = 1, 1, 0))/count(*)*100,2), 0) y
from smart_grout_steel_beam_data
where project_sn = #{projectSn}
<if test="type == '1'.toString()">
and end_time > current_date
</if>
<if test="type == '2'.toString()">
and end_time > date_sub(end_time, interval 6 day)
</if>
<if test="type == '3'.toString()">
and end_time > date_sub(end_time, interval 29 day)
</if>
group by x
</select>
</mapper>

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.smartgrout.service;
import com.zhgd.xmgl.base.entity.vo.FlexibleBigScreenVo;
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutSteelBeamData;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -21,4 +22,6 @@ public interface ISmartGroutSteelBeamDataService extends IService<SmartGroutStee
List<SmartGroutSteelBeamData> queryList(HashMap<String, Object> paramMap);
FlexibleBigScreenVo countStatus(HashMap<String, Object> paramMap);
List<TrendOneVo> countStatusTrend(HashMap<String, Object> paramMap);
}

View File

@ -3,6 +3,7 @@ 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.base.entity.vo.TrendOneVo;
import com.zhgd.xmgl.modules.smartgrout.entity.SmartGroutSteelBeamData;
import com.zhgd.xmgl.modules.smartgrout.mapper.SmartGroutSteelBeamDataMapper;
import com.zhgd.xmgl.modules.smartgrout.service.ISmartGroutSteelBeamDataService;
@ -67,6 +68,27 @@ public class SmartGroutSteelBeamDataServiceImpl extends ServiceImpl<SmartGroutSt
return null;
}
@Override
public List<TrendOneVo> countStatusTrend(HashMap<String, Object> paramMap) {
Integer type = MapUtils.getInteger(paramMap, "type");
String format = null;
List<String> dateTimeStrList = null;
if (Objects.equals(type, 1)) {
format = "yyyy-MM-dd HH:00";
dateTimeStrList = DateUtils.getDateTimeStrList(100, "yyyy-MM-dd HH:00");
} else if (Objects.equals(type, 2)) {
format = "yyyy-MM-dd";
dateTimeStrList = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
} else if (Objects.equals(type, 3)) {
format = "yyyy-MM-dd";
dateTimeStrList = DateUtils.getDateTimeStrList(80, "yyyy-MM-dd");
} else {
return null;
}
List<TrendOneVo> list = baseMapper.countStatusTrend(paramMap);
return TrendOneVo.fillTrendVos(list, dateTimeStrList, format);
}
private QueryWrapper<SmartGroutSteelBeamData> getQueryWrapper(HashMap<String, Object> paramMap) {
QueryWrapper<SmartGroutSteelBeamData> queryWrapper = QueryGenerator.initPageQueryWrapper(SmartGroutSteelBeamData.class, paramMap);
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(SmartGroutSteelBeamData::getId));