Browse Source

交警信息

develop
王兴琳 6 months ago
parent
commit
4077374b78
  1. 130
      zc-business/src/main/java/com/zc/business/controller/DcTrafficPoliceController.java
  2. 12
      zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java
  3. 101
      zc-business/src/main/java/com/zc/business/domain/DcTrafficPolice.java
  4. 64
      zc-business/src/main/java/com/zc/business/mapper/DcTrafficPoliceMapper.java
  5. 64
      zc-business/src/main/java/com/zc/business/service/IDcTrafficPoliceService.java
  6. 104
      zc-business/src/main/java/com/zc/business/service/impl/DcTrafficPoliceServiceImpl.java
  7. 8
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  8. 35
      zc-business/src/main/resources/mapper/business/DcGantryStatisticsDataMapper.xml
  9. 84
      zc-business/src/main/resources/mapper/business/DcTrafficPoliceMapper.xml

130
zc-business/src/main/java/com/zc/business/controller/DcTrafficPoliceController.java

@ -0,0 +1,130 @@
package com.zc.business.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zc.business.domain.DcTrafficPolice;
import com.zc.business.service.IDcTrafficPoliceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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-06-06
*/
@Api(tags = "交警信息管理")
@RestController
@RequestMapping("/system/police")
public class DcTrafficPoliceController extends BaseController
{
@Autowired
private IDcTrafficPoliceService dcTrafficPoliceService;
/**
* 查询交管数据列表
*/
@ApiOperation("查询交警列表")
// @PreAuthorize("@ss.hasPermi('system:police:list')")
@GetMapping("/list")
public TableDataInfo list(DcTrafficPolice dcTrafficPolice)
{
startPage();
List<DcTrafficPolice> list = dcTrafficPoliceService.selectDcTrafficPoliceList(dcTrafficPolice);
return getDataTable(list);
}
/**
* 导出交管数据列表
*/
@ApiOperation("导出交管数据列表")
// @PreAuthorize("@ss.hasPermi('system:police:export')")
@Log(title = "交管数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DcTrafficPolice dcTrafficPolice)
{
List<DcTrafficPolice> list = dcTrafficPoliceService.selectDcTrafficPoliceList(dcTrafficPolice);
ExcelUtil<DcTrafficPolice> util = new ExcelUtil<>(DcTrafficPolice.class);
util.exportExcel(response, list, "交管数据数据");
}
/**
* 获取交管数据详细信息
*/
@ApiOperation("获取交管数据详细信息")
//@PreAuthorize("@ss.hasPermi('system:police:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(dcTrafficPoliceService.selectDcTrafficPoliceById(id));
} /**
* 获取事件所属交管信息
*/
@ApiOperation("获取事件所属交管信息")
@GetMapping("/enent/{make}")
public AjaxResult getInfoEvent(@PathVariable("make") String make)
{
return AjaxResult.success(dcTrafficPoliceService.selectEvent(make));
}
/**
* 新增交管数据
*/
@ApiOperation("新增交管数据")
// @PreAuthorize("@ss.hasPermi('system:police:add')")
@Log(title = "交管数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcTrafficPolice dcTrafficPolice)
{
return toAjax(dcTrafficPoliceService.insertDcTrafficPolice(dcTrafficPolice));
}
/**
* 修改交管数据
*/
@ApiOperation("修改交管数据")
@PreAuthorize("@ss.hasPermi('system:police:edit')")
@Log(title = "交管数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcTrafficPolice dcTrafficPolice)
{
return toAjax(dcTrafficPoliceService.updateDcTrafficPolice(dcTrafficPolice));
}
/**
* 删除交管数据
*/
@ApiOperation("删除交管数据")
// @PreAuthorize("@ss.hasPermi('system:police:remove')")
@Log(title = "交管数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dcTrafficPoliceService.deleteDcTrafficPoliceByIds(ids));
}
}

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

@ -274,9 +274,9 @@ public AjaxResult sectionHourlyTrafficFlow(String startDate, String endDate) thr
}/**
* 各收费站入口分车型车流量
*/
@ApiOperation("各收费站入口分车型车流量")
@GetMapping("/history/trafficFlowAtTollStationEntrance")
public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endDate,String stationType) throws HttpException, IOException {
@ApiOperation("各收费站入口分车型小时车流量")
@GetMapping("/history/trafficFlowAtTollStationEntranceHour")
public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String endDate,String stationType) throws HttpException, IOException {
// 调用服务层方法,获取当前交通指标数据
List<Map<String, String>> jsonArray = dcTrafficStatisticsService.trafficFlowAtTollStationEntrance(startDate, endDate, stationType);
// 将获取到的交通指标数据封装为成功的结果并返回
@ -286,9 +286,9 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD
/**
* 各收费站入口分车型小时车流量
*/
@ApiOperation("各收费站入口分车型小时车流量")
@GetMapping("/history/trafficFlowAtTollStationEntranceHour")
public AjaxResult trafficFlowAtTollStationEntranceHour(String startDate, String endDate,String stationType) throws HttpException, IOException {
@ApiOperation("各收费站入口分车型车流量")
@GetMapping("/history/trafficFlowAtTollStationEntrance")
public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endDate,String stationType) throws HttpException, IOException {
// 调用服务层方法,获取当前交通指标数据
JSONArray jsonArray = dcTrafficStatisticsService.trafficFlowAtTollStationEntranceHour(startDate, endDate, stationType);
// 将获取到的交通指标数据封装为成功的结果并返回

101
zc-business/src/main/java/com/zc/business/domain/DcTrafficPolice.java

@ -0,0 +1,101 @@
package com.zc.business.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
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_traffic_police
*
* @author ruoyi
* @date 2024-06-06
*/
@ApiModel("交警信息对象")
public class DcTrafficPolice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@ApiModelProperty("ID")
private Long id;
/** $column.columnComment */
@ApiModelProperty("名称")
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String name;
@ApiModelProperty("电话")
/** 电话 */
@Excel(name = "电话")
private String phone;
@ApiModelProperty("开始桩号")
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String stakeMake;
/** $column.columnComment */
@ApiModelProperty("结束桩号")
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String endMake;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setStakeMake(String stakeMake)
{
this.stakeMake = stakeMake;
}
public String getStakeMake()
{
return stakeMake;
}
public void setEndMake(String endMake)
{
this.endMake = endMake;
}
public String getEndMake()
{
return endMake;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("phone", getPhone())
.append("stakeMake", getStakeMake())
.append("endMake", getEndMake())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}

64
zc-business/src/main/java/com/zc/business/mapper/DcTrafficPoliceMapper.java

@ -0,0 +1,64 @@
package com.zc.business.mapper;
import com.zc.business.domain.DcTrafficPolice;
import java.util.List;
/**
* 交管数据Mapper接口
*
* @author ruoyi
* @date 2024-06-06
*/
public interface DcTrafficPoliceMapper
{
/**
* 查询交管数据
*
* @param id 交管数据主键
* @return 交管数据
*/
public DcTrafficPolice selectDcTrafficPoliceById(Long id);
/**
* 查询交管数据列表
*
* @param dcTrafficPolice 交管数据
* @return 交管数据集合
*/
List<DcTrafficPolice> selectDcTrafficPoliceList(DcTrafficPolice dcTrafficPolice);
/**
* 新增交管数据
*
* @param dcTrafficPolice 交管数据
* @return 结果
*/
int insertDcTrafficPolice(DcTrafficPolice dcTrafficPolice);
/**
* 修改交管数据
*
* @param dcTrafficPolice 交管数据
* @return 结果
*/
int updateDcTrafficPolice(DcTrafficPolice dcTrafficPolice);
/**
* 删除交管数据
*
* @param id 交管数据主键
* @return 结果
*/
int deleteDcTrafficPoliceById(Long id);
/**
* 批量删除交管数据
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteDcTrafficPoliceByIds(Long[] ids);
public DcTrafficPolice selectEvent(String make);
}

64
zc-business/src/main/java/com/zc/business/service/IDcTrafficPoliceService.java

@ -0,0 +1,64 @@
package com.zc.business.service;
import com.zc.business.domain.DcTrafficPolice;
import java.util.List;
/**
* 交管数据Service接口
*
* @author ruoyi
* @date 2024-06-06
*/
public interface IDcTrafficPoliceService
{
/**
* 查询交管数据
*
* @param id 交管数据主键
* @return 交管数据
*/
public DcTrafficPolice selectDcTrafficPoliceById(Long id);
/**
* 查询交管数据列表
*
* @param dcTrafficPolice 交管数据
* @return 交管数据集合
*/
List<DcTrafficPolice> selectDcTrafficPoliceList(DcTrafficPolice dcTrafficPolice);
/**
* 新增交管数据
*
* @param dcTrafficPolice 交管数据
* @return 结果
*/
int insertDcTrafficPolice(DcTrafficPolice dcTrafficPolice);
/**
* 修改交管数据
*
* @param dcTrafficPolice 交管数据
* @return 结果
*/
int updateDcTrafficPolice(DcTrafficPolice dcTrafficPolice);
/**
* 批量删除交管数据
*
* @param ids 需要删除的交管数据主键集合
* @return 结果
*/
int deleteDcTrafficPoliceByIds(Long[] ids);
/**
* 删除交管数据信息
*
* @param id 交管数据主键
* @return 结果
*/
int deleteDcTrafficPoliceById(Long id);
public DcTrafficPolice selectEvent(String make);
}

104
zc-business/src/main/java/com/zc/business/service/impl/DcTrafficPoliceServiceImpl.java

@ -0,0 +1,104 @@
package com.zc.business.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.zc.business.domain.DcTrafficPolice;
import com.zc.business.mapper.DcTrafficPoliceMapper;
import com.zc.business.service.IDcTrafficPoliceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 交管数据Service业务层处理
*
* @author ruoyi
* @date 2024-06-06
*/
@Service
public class DcTrafficPoliceServiceImpl implements IDcTrafficPoliceService
{
@Autowired
private DcTrafficPoliceMapper dcTrafficPoliceMapper;
/**
* 查询交管数据
*
* @param id 交管数据主键
* @return 交管数据
*/
@Override
public DcTrafficPolice selectDcTrafficPoliceById(Long id)
{
return dcTrafficPoliceMapper.selectDcTrafficPoliceById(id);
}
/**
* 查询交管数据列表
*
* @param dcTrafficPolice 交管数据
* @return 交管数据
*/
@Override
public List<DcTrafficPolice> selectDcTrafficPoliceList(DcTrafficPolice dcTrafficPolice)
{
return dcTrafficPoliceMapper.selectDcTrafficPoliceList(dcTrafficPolice);
}
/**
* 新增交管数据
*
* @param dcTrafficPolice 交管数据
* @return 结果
*/
@Override
public int insertDcTrafficPolice(DcTrafficPolice dcTrafficPolice)
{
dcTrafficPolice.setCreateTime(DateUtils.getNowDate());
return dcTrafficPoliceMapper.insertDcTrafficPolice(dcTrafficPolice);
}
/**
* 修改交管数据
*
* @param dcTrafficPolice 交管数据
* @return 结果
*/
@Override
public int updateDcTrafficPolice(DcTrafficPolice dcTrafficPolice)
{
dcTrafficPolice.setUpdateTime(DateUtils.getNowDate());
return dcTrafficPoliceMapper.updateDcTrafficPolice(dcTrafficPolice);
}
/**
* 批量删除交管数据
*
* @param ids 需要删除的交管数据主键
* @return 结果
*/
@Override
public int deleteDcTrafficPoliceByIds(Long[] ids)
{
return dcTrafficPoliceMapper.deleteDcTrafficPoliceByIds(ids);
}
/**
* 删除交管数据信息
*
* @param id 交管数据主键
* @return 结果
*/
@Override
public int deleteDcTrafficPoliceById(Long id)
{
return dcTrafficPoliceMapper.deleteDcTrafficPoliceById(id);
}
@Override
public DcTrafficPolice selectEvent(String make) {
return dcTrafficPoliceMapper.selectEvent(make);
}
}

8
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -14,6 +14,7 @@ import com.zc.business.mapper.DcEventMapper;
import com.zc.business.mapper.DcProcessConfigMapper;
import com.zc.business.mapper.DcWarningMapper;
import com.zc.business.service.IDcEventService;
import com.zc.business.service.IDcTrafficPoliceService;
import com.zc.business.service.IDcWarningService;
import com.zc.business.utils.StakeMarkUtils;
import com.zc.common.core.websocket.WebSocketService;
@ -56,6 +57,8 @@ public class DcWarningServiceImpl implements IDcWarningService
@Autowired
private DcEventProcessServiceImpl dcEventProcessService;
@Autowired
private IDcTrafficPoliceService dcTrafficPoliceService;
@Autowired
private DcProcessConfigMapper dcProcessConfigMapper;
@Resource
private RedisCache redisCache;
@ -643,8 +646,11 @@ public class DcWarningServiceImpl implements IDcWarningService
if (!sortedHashMaps.isEmpty()) {
HashMap<String, Object> map = sortedHashMaps.get(0);
Long id = Long.parseLong(map.get("id").toString());//取出最近的机构id
//todo 交警
List<HashMap<String, Object>> trafficPolice = dcWarningMapper.selectTrafficPolice(id);//交警人员信息
mapAll.put("trafficPolice",trafficPolice);
DcTrafficPolice dcTrafficPolice = dcTrafficPoliceService.selectEvent(dcWarning.getStakeMark());
mapAll.put("trafficPolice",dcTrafficPolice);
}
if (dcDispatch==null){
mapAll.put("existence",0);

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

@ -93,22 +93,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="realTimeTrafficFlow" resultMap="countMap" resultType="map" >
SELECT
intervals.interval_name,
intervals.stake_make,
intervals.end_make,
COALESCE(SUM(dgsd.traffic_volume), 0) AS total_traffic_volume
FROM
(
SELECT 'K054+394' AS start_stake, 'K059+289' AS end_stake, '殷家林枢纽' AS interval_name UNION ALL
SELECT 'K059+289', 'K072+847', '大学城立交' UNION ALL
SELECT 'K072+847', 'K083+835', '长清立交' UNION ALL
SELECT 'K083+835', 'K086+499', '松竹枢纽' UNION ALL
SELECT 'K086+499', 'K099+750', '孝里立交' UNION ALL
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 'K145+933', 'K155+652', '东平立交' UNION ALL
SELECT 'K155+652', 'K173+950', '东平湖枢纽' UNION ALL
SELECT 'K173+950', 'K179+396', '梁山东立交' UNION ALL
SELECT 'K179+396', 'K190+495', '梁山立交' UNION ALL
SELECT 'K054+394' AS stake_make, 'K059+289' AS end_make, '殷家林枢纽-大学城立交' AS interval_name UNION ALL
SELECT 'K059+289', 'K072+847', '大学城立交-长清立交' UNION ALL
SELECT 'K072+847', 'K083+835', '长清立交-松竹枢纽' UNION ALL
SELECT 'K083+835', 'K086+499', '松竹枢纽-孝里立交' UNION ALL
SELECT 'K086+499', 'K099+750', '孝里立交-平阴北立交' UNION ALL
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 'K145+933', 'K155+652', '东平立交-东平湖枢纽' UNION ALL
SELECT 'K155+652', 'K173+950', '东平湖枢纽-梁山东立交' UNION ALL
SELECT 'K173+950', 'K179+396', '梁山东立交-梁山立交' UNION ALL
SELECT 'K179+396', 'K190+495', '梁山立交-嘉祥西立交' UNION ALL
SELECT 'K190+495', 'K202+979', '嘉祥西立交'
) AS intervals
LEFT JOIN (
@ -121,12 +123,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dc_facility
WHERE
direction = #{direction}
) AS ps ON ps.stake_mark BETWEEN CONCAT(intervals.start_stake, '+0') AND CONCAT(intervals.end_stake, '+0')
) AS ps ON ps.stake_mark BETWEEN CONCAT(intervals.stake_make, '+0') AND CONCAT(intervals.end_make, '+0')
LEFT JOIN dc_gantry_statistics_data dgsd ON ps.facility_code = dgsd.gantry_code
AND dgsd.statistical_date =#{startDate}
AND dgsd.period_type =#{periodType}
GROUP BY
intervals.interval_name;
intervals.interval_name,
intervals.stake_make,
intervals.end_make;
</select>
</mapper>

84
zc-business/src/main/resources/mapper/business/DcTrafficPoliceMapper.xml

@ -0,0 +1,84 @@
<?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.DcTrafficPoliceMapper">
<resultMap type="com.zc.business.domain.DcTrafficPolice" id="DcTrafficPoliceResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="stakeMake" column="stake_make" />
<result property="endMake" column="end_make" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDcTrafficPoliceVo">
select id, name, phone, stake_make, end_make, create_time, update_time from dc_traffic_police
</sql>
<select id="selectDcTrafficPoliceList" parameterType="DcTrafficPolice" resultMap="DcTrafficPoliceResult">
<include refid="selectDcTrafficPoliceVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="stakeMake != null and stakeMake != ''"> and stake_make = #{stakeMake}</if>
<if test="endMake != null and endMake != ''"> and end_make = #{endMake}</if>
</where>
</select>
<select id="selectDcTrafficPoliceById" parameterType="Long" resultMap="DcTrafficPoliceResult">
<include refid="selectDcTrafficPoliceVo"/>
where id = #{id}
</select>
<insert id="insertDcTrafficPolice" parameterType="DcTrafficPolice" useGeneratedKeys="true" keyProperty="id">
insert into dc_traffic_police
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="phone != null">phone,</if>
<if test="stakeMake != null">stake_make,</if>
<if test="endMake != null">end_make,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="phone != null">#{phone},</if>
<if test="stakeMake != null">#{stakeMake},</if>
<if test="endMake != null">#{endMake},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDcTrafficPolice" parameterType="DcTrafficPolice">
update dc_traffic_police
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="stakeMake != null">stake_make = #{stakeMake},</if>
<if test="endMake != null">end_make = #{endMake},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcTrafficPoliceById" parameterType="Long">
delete from dc_traffic_police where id = #{id}
</delete>
<delete id="deleteDcTrafficPoliceByIds" parameterType="String">
delete from dc_traffic_police where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectEvent" parameterType="String" resultMap="DcTrafficPoliceResult">
<include refid="selectDcTrafficPoliceVo"/>
WHERE #{make} BETWEEN dc_traffic_police.stake_make AND dc_traffic_police.end_make;
</select>
</mapper>
Loading…
Cancel
Save