每月流量统计

This commit is contained in:
zhuxinyu
2023-04-10 20:31:45 +08:00
parent 35f7f13154
commit 9199a7c763
7 changed files with 45 additions and 8 deletions

View File

@@ -22,10 +22,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.validation.annotation.Validated;
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 java.util.List;
@@ -118,6 +115,16 @@ public class OperationContrController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getMonthFlow")
@ApiOperation("获取每月流量")
@ApiImplicitParam(name = "deviceInfoParam", value = "实体", required = true)
public HttpResult<List<LineFlowMealDetailVO>> getMonthFlow (@RequestBody PqsParam deviceInfoParam){
String methodDescribe = getMethodDescribe("getMonthFlow");
LogUtil.njcnDebug(log, "{},参数集合:{}", methodDescribe, deviceInfoParam);
List<LineFlowMealDetailVO> result = lineService.getMonthFlow(deviceInfoParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)

View File

@@ -420,6 +420,8 @@ public interface LineMapper extends BaseMapper<Line> {
List<LineFlowMealDetailVO> getDeviceRunStatistics(@Param("list") List<String> list, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
Page<LineFlowMealDetailVO> getNewDeviceRunStatistics(Page<LineFlowMealDetailVO> page,@Param("devs") List<String> list, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
Page<LineFlowMealDetailVO> getNewDeviceFlowStatistics(Page<LineFlowMealDetailVO> page,@Param("devs") List<String> list, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
Page<LineFlowMealDetailVO> getNewDeviceRunStatistics (Page<LineFlowMealDetailVO> page,@Param("devs") List<String> list, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
Page<LineFlowMealDetailVO> getNewDeviceFlowStatistics (Page<LineFlowMealDetailVO> page,@Param("devs") List<String> list, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
List<LineFlowMealDetailVO> getMonthFlow (@Param("devId") String devId,@Param("startTime") DateTime beginOfDay, @Param("endTime") DateTime endOfDay);
}

View File

@@ -118,7 +118,7 @@
<select id="getRunManageDevList" resultType="com.njcn.device.pq.pojo.vo.RunTimeVO">
SELECT
dev.Id as id,
dev.Id AS id,
area.NAME AS areaName,
gd.NAME AS gdName,
sub.NAME AS bdName,
@@ -170,7 +170,7 @@
#{item2}
</foreach>
</if>
<if test="manufacturers.size()!=0">
<if test="manufacturers.size() != 0">
and device.Manufacturer in
<foreach collection="manufacturers" item="item3" separator="," open="(" close=")">
#{item3}

View File

@@ -1053,5 +1053,23 @@
and d.com_flag = #{comFlag}
and a.state = 1
</select>
<select id="getMonthFlow" resultType="com.njcn.device.pq.pojo.vo.LineFlowMealDetailVO">
select t.*,
(t.statisValue)/(t.flowMeal) flowProportion
from (
SELECT
m.Dev_Id,
ifnull(d.flow, (select flow from cld_flow_meal where type = 0 and flag = 1)) + ifnull(d1.flow, 0) flowMeal,
ifnull(m.Actual_Value,0)/1024/1024 statisValue
FROM cld_month_flow m
LEFT JOIN cld_dev_meal c ON m.Dev_Id = c.line_id
LEFT JOIN cld_flow_meal d ON c.Base_Meal_Id = d.id
LEFT JOIN cld_flow_meal d1 ON c.Ream_Meal_Id = d1.id
where m.Dev_Id = #{devId}
and
m.Time_Id between #{startTime} and #{endTime}
) t
ORDER BY flowProportion DESC
</select>
</mapper>

View File

@@ -208,4 +208,6 @@ public interface LineService {
Page<TopMsgPO> dailyDeviceAbnormalStatistics(PqsParam param);
List<TopMsgPO> dailyDeviceAbnormal(DeviceInfoParam.BusinessParam conditionBusinessParam);
List<LineFlowMealDetailVO> getMonthFlow (PqsParam deviceInfoParam);
}

View File

@@ -403,6 +403,12 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
return topMsgDetails;
}
@Override
public List<LineFlowMealDetailVO> getMonthFlow(PqsParam deviceInfoParam) {
List<LineFlowMealDetailVO> list = lineMapper.getMonthFlow(deviceInfoParam.getDevId(),DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())));
return list;
}
@Override
public List<LineFlowMealDetailVO> getDeviceRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam) {
ArrayList<LineFlowMealDetailVO> lineFlowMealDetailList = new ArrayList<>();