Browse Source

修改事件导出 新增交通路况每小时数据

develop
王兴琳 5 months ago
parent
commit
3b02cfe8ae
  1. 2
      zc-business/src/main/java/com/zc/business/controller/DcEventController.java
  2. 106
      zc-business/src/main/java/com/zc/business/controller/DcRoadConditionInformationController.java
  3. 2
      zc-business/src/main/java/com/zc/business/controller/DcTrafficFlowWarning.java
  4. 3
      zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java
  5. 55
      zc-business/src/main/java/com/zc/business/domain/DcRoadConditionInformation.java
  6. 62
      zc-business/src/main/java/com/zc/business/mapper/DcRoadConditionInformationMapper.java
  7. 62
      zc-business/src/main/java/com/zc/business/service/IDcRoadConditionInformationService.java
  8. 97
      zc-business/src/main/java/com/zc/business/service/impl/DcRoadConditionInformationServiceImpl.java
  9. 15
      zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java
  10. 2
      zc-business/src/main/resources/mapper/business/DcGantryStatisticsDataMapper.xml
  11. 68
      zc-business/src/main/resources/mapper/business/DcRoadConditionInformationMapper.xml

2
zc-business/src/main/java/com/zc/business/controller/DcEventController.java

@ -72,7 +72,7 @@ public class DcEventController extends BaseController
//@PreAuthorize("@ss.hasPermi('system:event:export')")
@Log(title = "事件信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DcEvent dcEvent)
public void export(HttpServletResponse response,@RequestBody DcEvent dcEvent)
{
List<DcEvent> list = dcEventService.selectDcEventList(dcEvent);
ExcelUtil<DcEvent> util = new ExcelUtil<DcEvent>(DcEvent.class);

106
zc-business/src/main/java/com/zc/business/controller/DcRoadConditionInformationController.java

@ -0,0 +1,106 @@
package com.zc.business.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zc.business.domain.DcRoadConditionInformation;
import com.zc.business.service.IDcRoadConditionInformationService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 路况信息Controller
*
* @author ruoyi
* @date 2024-07-02
*/
@RestController
@RequestMapping("/system/information")
public class DcRoadConditionInformationController extends BaseController
{
@Autowired
private IDcRoadConditionInformationService dcRoadConditionInformationService;
/**
* 查询路况信息列表
*/
//@PreAuthorize("@ss.hasPermi('system:information:list')")
@GetMapping("/list")
public TableDataInfo list(DcRoadConditionInformation dcRoadConditionInformation)
{
startPage();
List<DcRoadConditionInformation> list = dcRoadConditionInformationService.selectDcRoadConditionInformationList(dcRoadConditionInformation);
return getDataTable(list);
}
/**
* 导出路况信息列表
*/
//@PreAuthorize("@ss.hasPermi('system:information:export')")
@Log(title = "路况信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DcRoadConditionInformation dcRoadConditionInformation)
{
List<DcRoadConditionInformation> list = dcRoadConditionInformationService.selectDcRoadConditionInformationList(dcRoadConditionInformation);
ExcelUtil<DcRoadConditionInformation> util = new ExcelUtil<>(DcRoadConditionInformation.class);
util.exportExcel(response, list, "路况信息数据");
}
/**
* 获取路况信息详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:information:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(dcRoadConditionInformationService.selectDcRoadConditionInformationById(id));
}
/**
* 新增路况信息
*/
// @PreAuthorize("@ss.hasPermi('system:information:add')")
@Log(title = "路况信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcRoadConditionInformation dcRoadConditionInformation)
{
return toAjax(dcRoadConditionInformationService.insertDcRoadConditionInformation(dcRoadConditionInformation));
}
/**
* 修改路况信息
*/
// @PreAuthorize("@ss.hasPermi('system:information:edit')")
@Log(title = "路况信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcRoadConditionInformation dcRoadConditionInformation)
{
return toAjax(dcRoadConditionInformationService.updateDcRoadConditionInformation(dcRoadConditionInformation));
}
/**
* 删除路况信息
*/
//@PreAuthorize("@ss.hasPermi('system:information:remove')")
@Log(title = "路况信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dcRoadConditionInformationService.deleteDcRoadConditionInformationByIds(ids));
}
}

2
zc-business/src/main/java/com/zc/business/controller/DcTrafficFlowWarning.java

@ -35,7 +35,7 @@ public class DcTrafficFlowWarning {
@Autowired
private IDcTollStationStatisticsDataService iDcTollStationStatisticsDataService;
//@Scheduled(cron = "0/10 * * * * ?")
// @Scheduled(cron = "0/10 * * * * ?")
@Scheduled(cron = "0 0 9 * * ?")
public void DcTrafficFlow() throws ParseException {
// 获取当前日期

3
zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java

@ -46,7 +46,7 @@ import java.util.stream.Collectors;
*
* @author xiepufeng
*/
//@Component
@Component
@Api(tags = "交通数据统计")
@RestController
@RequestMapping("/business/traffic-statistics")
@ -745,6 +745,7 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String
// 将获取到的交通指标数据封装为成功的结果并返回
return AjaxResult.success(jsonArray);
}
@Scheduled(cron = "0 */1 * * * ?")
// @Scheduled(cron = "0/30 * * * * ?")
@ApiOperation("获取当前拥堵路段")
@GetMapping("/current/getTheCurrentCongestedSection")

55
zc-business/src/main/java/com/zc/business/domain/DcRoadConditionInformation.java

@ -0,0 +1,55 @@
package com.zc.business.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 路况信息对象 dc_road_condition_information
*
* @author ruoyi
* @date 2024-07-02
*/
public class DcRoadConditionInformation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 其他配置 */
@Excel(name = "其他配置")
private String otherConfig;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setOtherConfig(String otherConfig)
{
this.otherConfig = otherConfig;
}
public String getOtherConfig()
{
return otherConfig;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("otherConfig", getOtherConfig())
.toString();
}
}

62
zc-business/src/main/java/com/zc/business/mapper/DcRoadConditionInformationMapper.java

@ -0,0 +1,62 @@
package com.zc.business.mapper;
import com.zc.business.domain.DcRoadConditionInformation;
import java.util.List;
/**
* 路况信息Mapper接口
*
* @author ruoyi
* @date 2024-07-02
*/
public interface DcRoadConditionInformationMapper
{
/**
* 查询路况信息
*
* @param id 路况信息主键
* @return 路况信息
*/
public DcRoadConditionInformation selectDcRoadConditionInformationById(Long id);
/**
* 查询路况信息列表
*
* @param dcRoadConditionInformation 路况信息
* @return 路况信息集合
*/
List<DcRoadConditionInformation> selectDcRoadConditionInformationList(DcRoadConditionInformation dcRoadConditionInformation);
/**
* 新增路况信息
*
* @param dcRoadConditionInformation 路况信息
* @return 结果
*/
int insertDcRoadConditionInformation(DcRoadConditionInformation dcRoadConditionInformation);
/**
* 修改路况信息
*
* @param dcRoadConditionInformation 路况信息
* @return 结果
*/
int updateDcRoadConditionInformation(DcRoadConditionInformation dcRoadConditionInformation);
/**
* 删除路况信息
*
* @param id 路况信息主键
* @return 结果
*/
int deleteDcRoadConditionInformationById(Long id);
/**
* 批量删除路况信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteDcRoadConditionInformationByIds(Long[] ids);
}

62
zc-business/src/main/java/com/zc/business/service/IDcRoadConditionInformationService.java

@ -0,0 +1,62 @@
package com.zc.business.service;
import com.zc.business.domain.DcRoadConditionInformation;
import java.util.List;
/**
* 路况信息Service接口
*
* @author ruoyi
* @date 2024-07-02
*/
public interface IDcRoadConditionInformationService
{
/**
* 查询路况信息
*
* @param id 路况信息主键
* @return 路况信息
*/
public DcRoadConditionInformation selectDcRoadConditionInformationById(Long id);
/**
* 查询路况信息列表
*
* @param dcRoadConditionInformation 路况信息
* @return 路况信息集合
*/
List<DcRoadConditionInformation> selectDcRoadConditionInformationList(DcRoadConditionInformation dcRoadConditionInformation);
/**
* 新增路况信息
*
* @param dcRoadConditionInformation 路况信息
* @return 结果
*/
int insertDcRoadConditionInformation(DcRoadConditionInformation dcRoadConditionInformation);
/**
* 修改路况信息
*
* @param dcRoadConditionInformation 路况信息
* @return 结果
*/
int updateDcRoadConditionInformation(DcRoadConditionInformation dcRoadConditionInformation);
/**
* 批量删除路况信息
*
* @param ids 需要删除的路况信息主键集合
* @return 结果
*/
int deleteDcRoadConditionInformationByIds(Long[] ids);
/**
* 删除路况信息信息
*
* @param id 路况信息主键
* @return 结果
*/
int deleteDcRoadConditionInformationById(Long id);
}

97
zc-business/src/main/java/com/zc/business/service/impl/DcRoadConditionInformationServiceImpl.java

@ -0,0 +1,97 @@
package com.zc.business.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.zc.business.domain.DcRoadConditionInformation;
import com.zc.business.mapper.DcRoadConditionInformationMapper;
import com.zc.business.service.IDcRoadConditionInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 路况信息Service业务层处理
*
* @author ruoyi
* @date 2024-07-02
*/
@Service
public class DcRoadConditionInformationServiceImpl implements IDcRoadConditionInformationService
{
@Autowired
private DcRoadConditionInformationMapper dcRoadConditionInformationMapper;
/**
* 查询路况信息
*
* @param id 路况信息主键
* @return 路况信息
*/
@Override
public DcRoadConditionInformation selectDcRoadConditionInformationById(Long id)
{
return dcRoadConditionInformationMapper.selectDcRoadConditionInformationById(id);
}
/**
* 查询路况信息列表
*
* @param dcRoadConditionInformation 路况信息
* @return 路况信息
*/
@Override
public List<DcRoadConditionInformation> selectDcRoadConditionInformationList(DcRoadConditionInformation dcRoadConditionInformation)
{
return dcRoadConditionInformationMapper.selectDcRoadConditionInformationList(dcRoadConditionInformation);
}
/**
* 新增路况信息
*
* @param dcRoadConditionInformation 路况信息
* @return 结果
*/
@Override
public int insertDcRoadConditionInformation(DcRoadConditionInformation dcRoadConditionInformation)
{
dcRoadConditionInformation.setCreateTime(DateUtils.getNowDate());
return dcRoadConditionInformationMapper.insertDcRoadConditionInformation(dcRoadConditionInformation);
}
/**
* 修改路况信息
*
* @param dcRoadConditionInformation 路况信息
* @return 结果
*/
@Override
public int updateDcRoadConditionInformation(DcRoadConditionInformation dcRoadConditionInformation)
{
dcRoadConditionInformation.setUpdateTime(DateUtils.getNowDate());
return dcRoadConditionInformationMapper.updateDcRoadConditionInformation(dcRoadConditionInformation);
}
/**
* 批量删除路况信息
*
* @param ids 需要删除的路况信息主键
* @return 结果
*/
@Override
public int deleteDcRoadConditionInformationByIds(Long[] ids)
{
return dcRoadConditionInformationMapper.deleteDcRoadConditionInformationByIds(ids);
}
/**
* 删除路况信息信息
*
* @param id 路况信息主键
* @return 结果
*/
@Override
public int deleteDcRoadConditionInformationById(Long id)
{
return dcRoadConditionInformationMapper.deleteDcRoadConditionInformationById(id);
}
}

15
zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java

@ -5,16 +5,16 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.zc.business.constant.RedisKeyConstants;
import com.zc.business.domain.DcCongestionSection;
import com.zc.business.domain.DcFacility;
import com.zc.business.domain.DcRoadSection;
import com.zc.business.domain.DcRoadSectionCongestion;
import com.zc.business.domain.*;
import com.zc.business.enums.StakeMarkRange;
import com.zc.business.enums.UniversalEnum;
import com.zc.business.service.IDcFacilityService;
import com.zc.business.service.IDcRoadConditionInformationService;
import com.zc.business.service.IDcRoadSectionService;
import com.zc.business.service.IDcTrafficStatisticsService;
import com.zc.business.utils.StakeMarkUtils;
@ -27,6 +27,7 @@ import okhttp3.Response;
import okhttp3.ResponseBody;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@ -56,6 +57,8 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi
@Resource
private IDcFacilityService facilityService;
@Autowired
private IDcRoadConditionInformationService dcRoadConditionInformationService;
@Resource
private IDcRoadSectionService roadSectionService;
@ -985,6 +988,10 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi
}
}
//插入 数据库 road_condition_information
DcRoadConditionInformation dcRoadConditionInformation =new DcRoadConditionInformation();
dcRoadConditionInformation.setOtherConfig(jsonArray.toJSONString());
dcRoadConditionInformationService.insertDcRoadConditionInformation(dcRoadConditionInformation);
return jsonArray;
}

2
zc-business/src/main/resources/mapper/business/DcGantryStatisticsDataMapper.xml

@ -226,7 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT 'K099+750', 'K105+904', '平阴北立交' UNION ALL
SELECT 'K105+904', 'K117+878', '平阴立交' UNION ALL
SELECT 'K117+878', 'K126+233', '孔村枢纽' UNION ALL
SELECT 'K126+233', 'K145+933', '平阴南立交-' UNION ALL
SELECT 'K126+233', 'K145+933', '平阴南立交' UNION ALL
SELECT 'K145+933', 'K155+652', '东平立交' UNION ALL
SELECT 'K155+652', 'K173+950', '东平湖枢纽' UNION ALL
SELECT 'K173+950', 'K179+396', '梁山东立交' UNION ALL

68
zc-business/src/main/resources/mapper/business/DcRoadConditionInformationMapper.xml

@ -0,0 +1,68 @@
<?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.zc.business.mapper.DcRoadConditionInformationMapper">
<resultMap type="com.zc.business.domain.DcRoadConditionInformation" id="DcRoadConditionInformationResult">
<result property="id" column="id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="otherConfig" column="other_config" />
</resultMap>
<sql id="selectDcRoadConditionInformationVo">
select id, create_time, update_time, other_config from dc_road_condition_information
</sql>
<select id="selectDcRoadConditionInformationList" parameterType="DcRoadConditionInformation" resultMap="DcRoadConditionInformationResult">
<include refid="selectDcRoadConditionInformationVo"/>
<where>
<if test="otherConfig != null and otherConfig != ''"> and other_config = #{otherConfig}</if>
</where>
ORDER BY create_time DESC
</select>
<select id="selectDcRoadConditionInformationById" parameterType="Long" resultMap="DcRoadConditionInformationResult">
<include refid="selectDcRoadConditionInformationVo"/>
where id = #{id}
</select>
<insert id="insertDcRoadConditionInformation" parameterType="DcRoadConditionInformation">
insert into dc_road_condition_information
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="otherConfig != null">other_config,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="otherConfig != null">#{otherConfig},</if>
</trim>
</insert>
<update id="updateDcRoadConditionInformation" parameterType="DcRoadConditionInformation">
update dc_road_condition_information
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="otherConfig != null">other_config = #{otherConfig},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcRoadConditionInformationById" parameterType="Long">
delete from dc_road_condition_information where id = #{id}
</delete>
<delete id="deleteDcRoadConditionInformationByIds" parameterType="String">
delete from dc_road_condition_information where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save