bug修改

This commit is contained in:
guo 2024-01-22 13:55:19 +08:00
parent bdc753a506
commit 065c193ac1
8 changed files with 69 additions and 6 deletions

View File

@ -233,5 +233,13 @@ public class WeighInfoController {
return Result.success(weighInfoService.countWeighInfoGoodsName(paramMap)); return Result.success(weighInfoService.countWeighInfoGoodsName(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 = "/countWeighInfoTrend")
public Result<List<TrendVo>> countWeighInfoTrend(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(weighInfoService.countWeighInfoTrend(paramMap));
}
} }

View File

@ -8,11 +8,11 @@ public class CountWeighInfoVO {
@ApiModelProperty("今日过磅") @ApiModelProperty("今日过磅")
private Double weighingToday; private Double weighingToday;
@ApiModelProperty("今日预约") @ApiModelProperty("今日预约")
private Double makeAnAppointmentToday; private Integer makeAnAppointmentToday;
@ApiModelProperty("累计过磅") @ApiModelProperty("累计过磅")
private Double accumulatedWeighing; private Double accumulatedWeighing;
@ApiModelProperty("累计预约") @ApiModelProperty("累计预约")
private Double cumulativeReservations; private Integer cumulativeReservations;
@ApiModelProperty("本次过磅数") @ApiModelProperty("本次过磅数")
private Double numberOfWeighThisTime; private Double numberOfWeighThisTime;
@ApiModelProperty("车牌号") @ApiModelProperty("车牌号")

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.weight.mapper; package com.zhgd.xmgl.modules.weight.mapper;
import com.zhgd.xmgl.base.entity.vo.SectorOneVo; import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
import com.zhgd.xmgl.base.entity.vo.TrendVo;
import com.zhgd.xmgl.modules.weight.entity.vo.CountWeighInfoVO; import com.zhgd.xmgl.modules.weight.entity.vo.CountWeighInfoVO;
import com.zhgd.xmgl.modules.weight.entity.vo.WeighInfoForwardingUnitRankVo; import com.zhgd.xmgl.modules.weight.entity.vo.WeighInfoForwardingUnitRankVo;
import com.zhgd.xmgl.modules.weight.entity.vo.WeighInfoGoodsNameStatisticVo; import com.zhgd.xmgl.modules.weight.entity.vo.WeighInfoGoodsNameStatisticVo;
@ -34,4 +35,6 @@ public interface WeighInfoMapper extends BaseMapper<WeighInfo> {
CountWeighInfoVO countWeighInfo(HashMap<String, Object> paramMap); CountWeighInfoVO countWeighInfo(HashMap<String, Object> paramMap);
List<SectorOneVo> countWeighInfoGoodsName(HashMap<String, Object> paramMap); List<SectorOneVo> countWeighInfoGoodsName(HashMap<String, Object> paramMap);
List<TrendVo> countWeighInfoTrend(HashMap<String, Object> paramMap);
} }

View File

@ -28,7 +28,7 @@
</select> </select>
<select id="countWeighInfo" resultType="com.zhgd.xmgl.modules.weight.entity.vo.CountWeighInfoVO"> <select id="countWeighInfo" resultType="com.zhgd.xmgl.modules.weight.entity.vo.CountWeighInfoVO">
select ifnull(sum(if(create_time>current_date,1,0)),0) makeAnAppointmentToday, select ifnull(sum(if(add_date_time>current_date,1,0)),0) makeAnAppointmentToday,
count(*) cumulativeReservations count(*) cumulativeReservations
from weigh_book_vehicle_info from weigh_book_vehicle_info
where project_sn=#{projectSn} where project_sn=#{projectSn}

View File

@ -101,6 +101,7 @@
select forwarding_unit as name,count(*) count from weigh_info select forwarding_unit as name,count(*) count from weigh_info
where project_sn=#{projectSn} where project_sn=#{projectSn}
group by forwarding_unit group by forwarding_unit
order by count desc
</select> </select>
<select id="countWeighInfo" resultType="com.zhgd.xmgl.modules.weight.entity.vo.CountWeighInfoVO"> <select id="countWeighInfo" resultType="com.zhgd.xmgl.modules.weight.entity.vo.CountWeighInfoVO">
@ -118,4 +119,29 @@
group by goods_name group by goods_name
order by count order by count
</select> </select>
<select id="countWeighInfoTrend" resultType="com.zhgd.xmgl.base.entity.vo.TrendVo">
select
<if test="type == '1'.toString()">
date_format(gross_time,'%Y-%m-%d %H:00') x,
</if>
<if test="type == '2'.toString()">
date_format(gross_time,'%Y-%m-%d') x,
</if>
<if test="type == '3'.toString()">
date_format(gross_time,'%Y-%m-%d') x,
</if>
count(*) y from weigh_info
where project_sn=#{projectSn}
<if test="type == '1'.toString()">
and gross_time > current_date
</if>
<if test="type == '2'.toString()">
and gross_time > date_sub(gross_time,interval 6 day)
</if>
<if test="type == '3'.toString()">
and gross_time > date_sub(gross_time,interval 29 day)
</if>
group by x
</select>
</mapper> </mapper>

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.base.entity.vo.SectorOneVo; import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
import com.zhgd.xmgl.base.entity.vo.SectorVo; import com.zhgd.xmgl.base.entity.vo.SectorVo;
import com.zhgd.xmgl.base.entity.vo.TrendVo;
import com.zhgd.xmgl.modules.weight.entity.WeighInfo; import com.zhgd.xmgl.modules.weight.entity.WeighInfo;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.weight.entity.vo.CountWeighInfoVO; import com.zhgd.xmgl.modules.weight.entity.vo.CountWeighInfoVO;
@ -38,4 +39,6 @@ public interface IWeighInfoService extends IService<WeighInfo> {
CountWeighInfoVO countWeighInfo(HashMap<String, Object> paramMap); CountWeighInfoVO countWeighInfo(HashMap<String, Object> paramMap);
SectorVo countWeighInfoGoodsName(HashMap<String, Object> paramMap); SectorVo countWeighInfoGoodsName(HashMap<String, Object> paramMap);
List<TrendVo> countWeighInfoTrend(HashMap<String, Object> paramMap);
} }

View File

@ -122,7 +122,6 @@ public class WeighBookVehicleInfoServiceImpl extends ServiceImpl<WeighBookVehicl
@Override @Override
public List<TrendVo> countWeighBookVehicleInfoTrend(HashMap<String, Object> paramMap) { public List<TrendVo> countWeighBookVehicleInfoTrend(HashMap<String, Object> paramMap) {
List<TrendVo> list = baseMapper.countWeighBookVehicleInfoTrend(paramMap);
Integer type = MapUtils.getInteger(paramMap, "type"); Integer type = MapUtils.getInteger(paramMap, "type");
String format = null; String format = null;
List<String> dateTimeStrList = null; List<String> dateTimeStrList = null;
@ -138,6 +137,7 @@ public class WeighBookVehicleInfoServiceImpl extends ServiceImpl<WeighBookVehicl
} else { } else {
return null; return null;
} }
List<TrendVo> list = baseMapper.countWeighBookVehicleInfoTrend(paramMap);
return TrendVo.fillTrendVos(list, dateTimeStrList, format); return TrendVo.fillTrendVos(list, dateTimeStrList, format);
} }

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.base.entity.vo.SectorOneVo; import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
import com.zhgd.xmgl.base.entity.vo.SectorVo; import com.zhgd.xmgl.base.entity.vo.SectorVo;
import com.zhgd.xmgl.base.entity.vo.TrendVo;
import com.zhgd.xmgl.modules.weight.entity.WeighInfo; import com.zhgd.xmgl.modules.weight.entity.WeighInfo;
import com.zhgd.xmgl.modules.weight.entity.WeighPic; import com.zhgd.xmgl.modules.weight.entity.WeighPic;
import com.zhgd.xmgl.modules.weight.entity.vo.CountWeighInfoVO; import com.zhgd.xmgl.modules.weight.entity.vo.CountWeighInfoVO;
@ -19,6 +20,7 @@ import com.zhgd.xmgl.modules.weight.mapper.WeighBookVehicleInfoMapper;
import com.zhgd.xmgl.modules.weight.mapper.WeighInfoMapper; import com.zhgd.xmgl.modules.weight.mapper.WeighInfoMapper;
import com.zhgd.xmgl.modules.weight.mapper.WeighPicMapper; import com.zhgd.xmgl.modules.weight.mapper.WeighPicMapper;
import com.zhgd.xmgl.modules.weight.service.IWeighInfoService; import com.zhgd.xmgl.modules.weight.service.IWeighInfoService;
import com.zhgd.xmgl.util.DateUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -109,7 +111,7 @@ public class WeighInfoServiceImpl extends ServiceImpl<WeighInfoMapper, WeighInfo
.eq(WeighInfo::getProjectSn, projectSn).orderByDesc(WeighInfo::getId).last("limit 1")); .eq(WeighInfo::getProjectSn, projectSn).orderByDesc(WeighInfo::getId).last("limit 1"));
if (weighInfo != null) { if (weighInfo != null) {
try { try {
countWeighInfoVO.setNumberOfWeighThisTime(weighInfo.getGrossWeight().doubleValue()); countWeighInfoVO.setNumberOfWeighThisTime(weighInfo.getNetWeight().doubleValue());
countWeighInfoVO.setNumberPlate(weighInfo.getLicensePlate()); countWeighInfoVO.setNumberPlate(weighInfo.getLicensePlate());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -124,4 +126,25 @@ public class WeighInfoServiceImpl extends ServiceImpl<WeighInfoMapper, WeighInfo
return SectorVo.getSectorVo(list); return SectorVo.getSectorVo(list);
} }
@Override
public List<TrendVo> countWeighInfoTrend(HashMap<String, Object> paramMap) {
Integer type = MapUtils.getInteger(paramMap, "type");
String format = null;
List<String> dateTimeStrList = null;
if (Objects.equals(type, 1)) {
format = "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<TrendVo> list = baseMapper.countWeighInfoTrend(paramMap);
return TrendVo.fillTrendVos(list, dateTimeStrList, format);
}
} }