提交 ec7ee022 authored 作者: Phyday's avatar Phyday

对接平台路况数据,提供移动端接口

上级 587f94bc
......@@ -23,30 +23,42 @@ SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `road_condition_event`;
CREATE TABLE `road_condition_event`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`road_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路线编码',
`road_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路线名称',
`startM` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '开始桩号',
`endM` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '结束桩号',
`event_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '事件类型',
`event_title` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '事件标题',
`event_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '事件详情',
`influence` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '影响程度',
`cars_length` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '压车长度',
`solution` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绕行方案',
`start_time` datetime(0) NULL DEFAULT NULL COMMENT '发布时间',
`start_unit` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发布单位',
`start_person` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发布人',
`pre_end_time` datetime(0) NULL DEFAULT NULL COMMENT '预撤时间',
`end_time` datetime(0) NULL DEFAULT NULL COMMENT '撤销时间',
`end_unit` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '撤销单位',
`end_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '撤销原因',
`id` int(11) NOT NULL AUTO_INCREMENT,
`event_id` varchar(30) DEFAULT NULL COMMENT '事件id',
`road_code` varchar(20) DEFAULT NULL COMMENT '路线编码',
`road_name` varchar(20) DEFAULT NULL COMMENT '路线名称',
`maintain_unit` varchar(30) DEFAULT NULL COMMENT '管养单位',
`sToeM` varchar(20) DEFAULT NULL COMMENT '起止桩号',
`startM` varchar(10) DEFAULT NULL COMMENT '开始桩号',
`endM` varchar(10) DEFAULT NULL COMMENT '结束桩号',
`event_type` varchar(10) DEFAULT NULL COMMENT '事件类型',
`event_title` varchar(60) DEFAULT NULL COMMENT '事件标题',
`event_content` varchar(255) DEFAULT NULL COMMENT '事件详情',
`influence` varchar(10) DEFAULT NULL COMMENT '影响程度(1=封闭交通/2=影响交通/3=可正常通行)',
`cars_length` varchar(8) DEFAULT NULL COMMENT '压车长度',
`solution` varchar(255) DEFAULT NULL COMMENT '绕行方案',
`start_person` varchar(10) DEFAULT NULL COMMENT '发布人',
`start_time` datetime DEFAULT NULL COMMENT '发布时间',
`start_unit` varchar(15) DEFAULT NULL COMMENT '发布单位',
`start_unit_no` varchar(20) DEFAULT NULL COMMENT '发布单位代码',
`start_bz` varchar(255) DEFAULT NULL COMMENT '备注',
`pre_end_time` datetime DEFAULT NULL COMMENT '预撤时间',
`end_person` varchar(10) DEFAULT NULL COMMENT '撤销人',
`end_time` datetime DEFAULT NULL COMMENT '撤销时间',
`end_unit` varchar(15) DEFAULT NULL COMMENT '撤销单位',
`end_unit_no` varchar(20) DEFAULT NULL COMMENT '撤销单位代码',
`end_reason` varchar(255) DEFAULT NULL COMMENT '撤销原因',
`end_bz` varchar(255) DEFAULT NULL COMMENT '撤销备注',
`check_person` varchar(10) DEFAULT NULL COMMENT '审核人',
`check_time` datetime DEFAULT NULL COMMENT '审核时间',
`longitude` varchar(50) DEFAULT NULL COMMENT '经度',
`latitude` varchar(50) DEFAULT NULL COMMENT '纬度',
`current` varchar(10) DEFAULT NULL COMMENT '当前页',
`size` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 11
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '路况事件管理'
ROW_FORMAT = Dynamic;
AUTO_INCREMENT = 5987
DEFAULT CHARSET = utf8mb4 COMMENT ='路况事件管理';
SET FOREIGN_KEY_CHECKS = 1;
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.elephant.framework.galaxy</groupId>
<artifactId>aroad</artifactId>
<version>0.0.1</version>
<name>aroad</name>
<description>智慧公路项目</description>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.elephant.framework.galaxy</groupId>
<artifactId>aroad</artifactId>
<version>0.0.1</version>
<name>aroad</name>
<description>智慧公路项目</description>
<properties>
<java.version>1.8</java.version>
<hutool.version>4.3.2</hutool.version>
<ttl.version>2.10.1</ttl.version>
<spring.security.oauth2.version>2.3.5.RELEASE</spring.security.oauth2.version>
<fastdfs.version>1.26.5</fastdfs.version>
</properties>
<properties>
<java.version>1.8</java.version>
<hutool.version>4.3.2</hutool.version>
<ttl.version>2.10.1</ttl.version>
<spring.security.oauth2.version>2.3.5.RELEASE</spring.security.oauth2.version>
<fastdfs.version>1.26.5</fastdfs.version>
</properties>
<dependencies>
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-amqp</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>${spring.security.oauth2.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.7.1</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.0.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- 文件上传依赖包 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>
<!--hutool-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<!--TTL-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>${ttl.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
</dependency>
<dependencies>
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-amqp</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>${spring.security.oauth2.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.7.1</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.0.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- 文件上传依赖包 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>
<!--hutool-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<!--TTL-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>${ttl.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<!-- fastdfs-client -->
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>${fastdfs.version}</version>
</dependency>
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>${fastdfs.version}</version>
</dependency>
</dependencies>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<!-- fastdfs-client -->
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>${fastdfs.version}</version>
</dependency>
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>${fastdfs.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.rpc</groupId>
<artifactId>javax.xml.rpc-api</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
......@@ -2,6 +2,7 @@ package com.elephant.framework.galaxy.aroad;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
......@@ -11,6 +12,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
*/
@EnableScheduling
@SpringBootApplication
public class ARoadApplication {
......
......@@ -6,10 +6,21 @@ import com.elephant.framework.galaxy.aroad.module.common.controller.BaseControll
import com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent;
import com.elephant.framework.galaxy.aroad.module.roadcondition.service.RoadConditionEventService;
import com.elephant.framework.galaxy.aroad.response.R;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.ezmorph.object.DateMorpher;
import net.sf.json.JSONArray;
import net.sf.json.util.JSONUtils;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 路况事件统计
*
......@@ -42,12 +53,11 @@ public class RoadConditionEventController extends BaseController {
/**
* 分页查询
*
* @param text 路况事件统计
* @return
*/
@GetMapping("/mobilepage")
public R getRoadConditionEventMobilePage(@RequestParam("text") String text) {
return new R<>(roadConditionEventService.getRoadConditionEventMobilePage(text));
public R getRoadConditionEventMobilePage() {
return new R<>(roadConditionEventService.getRoadConditionEventMobilePage());
}
/**
* @description : 根据事件类型统计
......@@ -221,4 +231,157 @@ public class RoadConditionEventController extends BaseController {
public R removeById(@PathVariable Integer id) {
return new R<>(roadConditionEventService.removeById(id));
}
/**
* 新增养护施工事件
* @param
* @return List<String>
*/
@SysLog("新增养护施工事件")
@PostMapping("/saveRoadMaintainEvent")
@ApiOperation(value = "新增养护施工事件")
@ApiImplicitParam(name = "jsonString", value = "养护施工事件JSON格式字符串", required = true, dataType = "String")
public R saveRoadMaintainEvent (@RequestBody String jsonString){
String msg = "";
Integer code = 0;
List<MultiValueMap<String,String>> errorEventIds = new ArrayList<MultiValueMap<String,String>>();
List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
JSONArray jsonArray = JSONArray.fromObject(jsonString);
String[] dateFormats = new String[] {"yyyy-MM-dd HH:mm:ss"};
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(dateFormats));
List<RoadConditionEvent> roadConditionEvents = ( List<RoadConditionEvent>)JSONArray.toCollection(jsonArray,RoadConditionEvent.class);
try{
for (RoadConditionEvent event : roadConditionEvents){
if (getRoadMaintainEventByEventID(event.getEventId()) > 0 ) {
Map<String,Object> map = new HashMap<String,Object>();
map.put("eventId",event.getEventId());
listMap.add(map);
msg = "该路况事件ID已存在,请调用路况事件更新接口,更新路况事件";
code = 203;
continue;
}
else{
roadConditionEventService.save(event);
if(code!=203){
msg = "success";
code = 200;
}
}
}
}catch (Exception e){
e.printStackTrace();
}
return new R<>(code,msg,listMap);
}
/**
* 根据事件ID查询该路况事件是否已经存在(大于0表示已存在)
* @return
*/
public Integer getRoadMaintainEventByEventID(String eventID) {
return roadConditionEventService.getRoadMaintainEventByEventID(eventID);
}
/**
* 更新养护施工事件
* 保存历史数据
* @param
* @return void
*/
@SysLog("更新养护施工事件")
@PostMapping("/updateRoadMaintainEvent")
@ApiOperation(value = "更新养护施工事件")
@ApiImplicitParam(name = "jsonString", value = "养护施工事件JSON格式字符串", required = true, dataType = "String")
public R updateRoadMaintainEvent(@RequestBody String jsonString) throws Exception{
List<Object> infoList = new ArrayList<Object>();
String msg = "";
Integer code = 0;
JSONArray jsonArray = JSONArray.fromObject(jsonString);
String[] dateFormats = new String[] {"yyyy-MM-dd HH:mm:ss"};
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(dateFormats));
List<RoadConditionEvent> roadConditionEvents = ( List<RoadConditionEvent>)JSONArray.toCollection(jsonArray,RoadConditionEvent.class);
try{
for(int i = 0;i< roadConditionEvents.size();i++){
RoadConditionEvent event = (RoadConditionEvent)roadConditionEvents.get(i);
RoadConditionEvent result = getRoadMaintainEvent(event);
if(result != null ){
infoList.add(jsonArray.get(i));
msg = "存在重复数据,请核实";
code = 204;
continue;
}
else{
roadConditionEventService.save(event);
if(code!=204){
msg = "success";
code = 200;
}
}
}
}catch(Exception e){
e.printStackTrace();
}
return new R<>(code,msg,infoList);
}
/**
* 查询该路况事件是否已经存在(大于0表示已存在) *
* @return
*/
public RoadConditionEvent getRoadMaintainEvent(RoadConditionEvent event) {
return roadConditionEventService.selectRoadMaintainEvent(event);
}
/**
* 删除养护施工事件(通过主键id)
* flag(删除:1)
* @param
* @return R
*/
@SysLog("删除养护施工事件,假删除")
@DeleteMapping("/deleteRoadMaintainEvent")
@ApiOperation(value = "删除养护施工事件")
@ApiImplicitParam(name = "jsonString", value = "养护施工事件JSON格式字符串", required = true, dataType = "String")
public R deleteRoadMaintainEvent(@RequestBody String jsonString){
JSONArray jsonArray = JSONArray.fromObject(jsonString);
String[] dateFormats = new String[] {"yyyy-MM-dd HH:mm:ss"};
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(dateFormats));
List<RoadConditionEvent> roadConditionEvents = ( List<RoadConditionEvent>)JSONArray.toCollection(jsonArray,RoadConditionEvent.class);
try{
for(RoadConditionEvent event : roadConditionEvents){
roadConditionEventService.deleteBatchByEvent(event);
}
}catch(Exception e){
e.printStackTrace();
}
return new R<>(200,"success");
}
/**
* 撤销养护施工事件(通过eventId)
* flag(撤销:0)
* @param
* @return R
*/
@SysLog("撤销养护施工事件")
@PutMapping("/revokeRoadMaintainEventByEventId")
@ApiOperation(value = "撤销养护施工事件")
@ApiImplicitParam(name = "jsonString", value = "养护施工事件JSON格式字符串", required = true, dataType = "String")
public R revokeRoadMaintainEventByEventId(@RequestBody String jsonString){
JSONArray jsonArray = JSONArray.fromObject(jsonString);
List<RoadConditionEvent> roadMaintainEvents = ( List<RoadConditionEvent>)JSONArray.toCollection(jsonArray,RoadConditionEvent.class);
List<Object> eventIdList = new ArrayList<Object>();
try{
for(RoadConditionEvent event : roadMaintainEvents){
eventIdList.add(event.getEventId());
}
Integer rowNumber = roadConditionEventService.updateBatchByEventId(eventIdList);
}catch(Exception e){
e.printStackTrace();
}
return new R<>(200,"success");
}
}
......@@ -20,6 +20,8 @@ import java.io.Serializable;
public class CoordinateDto implements Serializable {
/** 主键 */
private int id;
/** 事件标题 */
private String eventTitle;
/** 事件类型 */
private String eventType;
/** 经度 */
......
package com.elephant.framework.galaxy.aroad.module.roadcondition.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.Date;
/**
* 路况事件统计
* 路况事件
*
* @author Xingyuyang
* @date 2019-04-23 16:41:06
* @date 2019-05-16 15:28:40
*/
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@TableName("road_condition_event")
@EqualsAndHashCode(callSuper = true)
public class RoadConditionEvent extends Model<RoadConditionEvent> {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(type = IdType.AUTO)
private Integer id;
/** */
@TableId private Integer id;
/** 路线编码 */
@ApiModelProperty(value = "事件ID", name = "eventId")
private String eventId;
/**
* 路线编码
*/
@ApiModelProperty(value = "路线编号", name = "roadCode")
private String roadCode;
/** 路线名称 */
/**
* 路线名称
*/
@ApiModelProperty(value = "路线名称", name = "roadName")
private String roadName;
/** 开始桩号 */
/**
* 管养单位
*/
@ApiModelProperty(value = "管养单位", name = "maintainUnit")
private String maintainUnit;
/**
* 起止桩号
*/
@ApiModelProperty(value = "起止桩号", name = "stoem")
private String stoem;
/**
* 开始桩号
*/
@ApiModelProperty(value = "开始桩号", name = "startm")
private String startm;
/** 结束桩号 */
/**
* 结束桩号
*/
@ApiModelProperty(value = "结束桩号", name = "endm")
private String endm;
/** 事件类型 */
/**
* 事件类型
*/
@ApiModelProperty(value = "事件类型", name = "eventType")
private String eventType;
/** 事件标题 */
/**
* 事件标题
*/
@ApiModelProperty(value = "事件标题", name = "eventTitle")
private String eventTitle;
/** 事件详情 */
/**
* 事件详情
*/
@ApiModelProperty(value = "事件详情", name = "eventContent")
private String eventContent;
/** 影响程度 */
/**
* 影响程度(1=封闭交通/2=影响交通/3=可正常通行)
*/
@ApiModelProperty(value = "影响程度(1=封闭交通/2=影响交通/3=可正常通行)", name = "influence")
private String influence;
/** 压车长度 */
/**
* 压车长度
*/
@ApiModelProperty(value = "压车长度", name = "carsLength")
private String carsLength;
/** 绕行方案 */
/**
* 绕行方案
*/
@ApiModelProperty(value = "绕行方案", name = "solution")
private String solution;
/** 发布时间 */
/**
* 发布人
*/
@ApiModelProperty(value = "发布人", name = "startPerson")
private String startPerson;
/**
* 发布时间
*/
@ApiModelProperty(value = "发布时间", name = "startTime")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/** 发布单位 */
/**
* 发布单位
*/
@ApiModelProperty(value = "发布单位", name = "startUnit")
private String startUnit;
/** 发布人 */
private String startPerson;
/** 预撤时间 */
/**
* 发布单位代码
*/
@ApiModelProperty(value = "发布单位代码", name = "startUnitNo")
private String startUnitNo;
/**
* 备注
*/
@ApiModelProperty(value = "备注", name = "startBz")
private String startBz;
/**
* 预撤时间
*/
@ApiModelProperty(value = "预撤时间", name = "preEndTime")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date preEndTime;
/** 撤销时间 */
/**
* 撤销人
*/
@ApiModelProperty(value = "撤销人", name = "endPerson")
private String endPerson;
/**
* 撤销时间
*/
@ApiModelProperty(value = "撤销时间", name = "endTime")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/** 撤销单位 */
/**
* 撤销单位
*/
@ApiModelProperty(value = "撤销单位", name = "endUnit")
private String endUnit;
/** 撤销原因 */
/**
* 撤销单位代码
*/
@ApiModelProperty(value = "撤销单位代码", name = "endUnitNo")
private String endUnitNo;
/**
* 撤销原因
*/
@ApiModelProperty(value = "撤销原因", name = "endReason")
private String endReason;
private Long current;
private Long size;
/**
* 撤销备注
*/
@ApiModelProperty(value = "撤销备注", name = "endBz")
private String endBz;
/**
* 审核人
*/
@ApiModelProperty(value = "审核人", name = "checkPerson")
private String checkPerson;
/**
* 审核时间
*/
@ApiModelProperty(value = "审核时间", name = "checkTime")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date checkTime;
/**
* 经度
*/
@ApiModelProperty(value = "经度", name = "longitude")
private String longitude;
/**
* 纬度
*/
@ApiModelProperty(value = "纬度", name = "latitude")
private String latitude;
}
/**
* 当前页
*/
@ApiModelProperty(value = "当前页", name = "current")
private long current;
/**
* 一页的数量
*/
@ApiModelProperty(value = "一页的数量", name = "size")
private long size;
}
......@@ -18,7 +18,7 @@ public interface RoadConditionEventMapper extends BaseMapper<RoadConditionEvent>
IPage<RoadConditionEvent> getRoadConditionEventPage(
IPage<RoadConditionEvent> page, RoadConditionEvent roadConditionEvent);
List<RoadConditionEvent> getRoadConditionEventMobilePage(@Param("text") String text);
List<RoadConditionEvent> getRoadConditionEventMobilePage();
List<staticByEventTypeDto> staticByEventType();
......@@ -51,4 +51,28 @@ public interface RoadConditionEventMapper extends BaseMapper<RoadConditionEvent>
List<CityNameDto> getTree();
RoadConditionEvent getById(@Param("id") Integer id);
/**
* 查询数据库是否存在该实体
*
* @param event
* @return
*/
RoadConditionEvent selectRoadMaintainEvent(RoadConditionEvent event);
/**
* 撤销事件,更新flag标识为0
*
* @param eventIdList
* @return
*/
Integer updateBatchByEventId(@Param("eventIdList") List<Object> eventIdList);
/**
* 删除养护施工事件(假删除)更新flag标识为1
*
* @param event
* @return
*/
Integer deleteBatchByEvent(RoadConditionEvent event);
}
package com.elephant.framework.galaxy.aroad.module.roadcondition.service;
public interface GetRoadPlatformService {
void scheduledSaveRoadInfo();
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.elephant.framework.galaxy.aroad.module.roadcondition.dto.*;
import com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent;
import java.util.Date;
import java.util.List;
/**
......@@ -15,92 +16,145 @@ import java.util.List;
* @date 2019-04-23 16:41:06
*/
public interface RoadConditionEventService extends IService<RoadConditionEvent> {
IPage<RoadConditionEvent> getRoadConditionEventPage(Page<RoadConditionEvent> page, RoadConditionEvent roadConditionEvent);
List<RoadConditionEvent> getRoadConditionEventMobilePage(String text);
/**
*
* @description : 根据事件类型查询
* @author : Xingyuyang
* @date : 2019/4/23 0023 17:52
* @param :
* @return : java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent>
*
*/
List<staticByEventTypeDto> staticByEventType();
/**
*
* @description : 根据事件类型查询
* @author : Xingyuyang
* @date : 2019/4/23 0023 17:52
* @param :
* @return : java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent>
*
*/
List<staticByInfluenceDto> staticByInfluence();
/**
*
* @description : 根据月份查询
* @author : Xingyuyang
* @date : 2019-4-24 10:28:31
* @param :
* @return : java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent>
*
*/
List<staticByMonthDto> staticByMonth();
/**
*
* @description : 根据路段编码查询
* @author : Xingyuyang
* @date : 2019-4-24 10:28:31
* @param :
* @return : java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent>
*
*/
List<staticByRoadCodeDto> staticByRoadCode();
/**
*
* @description : 根据城市查询
* @author : Xingyuyang
* @date : 2019/4/24 14:28
* @return : java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.dto.staticByCityDto>
*
*/
List<staticByCityDto> staticByCity();
/**
*
* @description : 根据城市查询
* @author : Xingyuyang
* @date : 2019/4/24 14:28
* @return : java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.dto.staticByCityDto>
*
*/
List<staticByYHCityDto> staticByYHCity();
/**
* @Description: 查询树形结构
* @Param: []
* @return: java.util.List<com.elephant.framework.galaxy.travel.module.basic_resources.entity.BaseServiceArea>
* @Author: XingYuyang
* @Date: 2019/4/10
*/
BaseTreeDto getTree();
RoadConditionEvent getById(Integer id);
List<CoordinateDto> getYHCoordinates();
List<CoordinateDto> getSFZCoordinates();
List<CoordinateDto> getTFCoordinates();
List<CoordinateDto> getTQCoordinates();
List<CoordinateDto> getCoordinates();
/**
* 根据事件ID查询该路况事件是否已经存在(大于0表示已存在)
*
* @param eventID
* @return * @return
*/
Integer getRoadMaintainEventByEventID(String eventID);
/**
* 查询数据库是否存在该实体
*
* @param event
* @return
*/
RoadConditionEvent selectRoadMaintainEvent(RoadConditionEvent event);
/**
* 根据事件id更新标识
*
* @param
* @return
*/
Integer updateBatchByEventId(List<Object> eventIdList);
/** 删除事件(假删除),更新flag标识为1 */
Integer deleteBatchByEvent(RoadConditionEvent event);
/**
* 普通国省道养护施工事件信息是否已存在
*
* @return
*/
public Integer getRoadMaintainEventByRoadPlatform(
// String infid,
String inftypename,
String inftitle,
String infcontent,
String infwrinter,
Date writerdate,
String infchecker,
Date checkdate,
Date removedate,
// String remark,
String glno,
String writerno,
String loctx,
String locty,
String zhuanghao,
String daolu,
// String removereson,
// String departname,
// String removedepart,
// Date expdate,
// String impact,
// String zhfrom,
// String zhto,
String yccd);
IPage<RoadConditionEvent> getRoadConditionEventPage(
Page<RoadConditionEvent> page, RoadConditionEvent roadConditionEvent);
List<RoadConditionEvent> getRoadConditionEventMobilePage();
/**
* @description : 根据事件类型查询
* @author : Xingyuyang
* @date : 2019/4/23 0023 17:52
* @param :
* @return :
* java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent>
*/
List<staticByEventTypeDto> staticByEventType();
/**
* @description : 根据事件类型查询
* @author : Xingyuyang
* @date : 2019/4/23 0023 17:52
* @param :
* @return :
* java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent>
*/
List<staticByInfluenceDto> staticByInfluence();
/**
* @description : 根据月份查询
* @author : Xingyuyang
* @date : 2019-4-24 10:28:31
* @param :
* @return :
* java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent>
*/
List<staticByMonthDto> staticByMonth();
/**
* @description : 根据路段编码查询
* @author : Xingyuyang
* @date : 2019-4-24 10:28:31
* @param :
* @return :
* java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent>
*/
List<staticByRoadCodeDto> staticByRoadCode();
/**
* @description : 根据城市查询
* @author : Xingyuyang
* @date : 2019/4/24 14:28
* @return :
* java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.dto.staticByCityDto>
*/
List<staticByCityDto> staticByCity();
/**
* @description : 根据城市查询
* @author : Xingyuyang
* @date : 2019/4/24 14:28
* @return :
* java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.dto.staticByCityDto>
*/
List<staticByYHCityDto> staticByYHCity();
/**
* @Description: 查询树形结构 @Param: []
*
* @return:
* java.util.List<com.elephant.framework.galaxy.travel.module.basic_resources.entity.BaseServiceArea> @Author:
* XingYuyang @Date: 2019/4/10
*/
BaseTreeDto getTree();
RoadConditionEvent getById(Integer id);
List<CoordinateDto> getYHCoordinates();
List<CoordinateDto> getSFZCoordinates();
List<CoordinateDto> getTFCoordinates();
List<CoordinateDto> getTQCoordinates();
List<CoordinateDto> getCoordinates();
}
package com.elephant.framework.galaxy.aroad.module.roadcondition.service.impl;
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent;
import com.elephant.framework.galaxy.aroad.module.roadcondition.service.GetRoadPlatformService;
import com.elephant.framework.galaxy.aroad.module.roadcondition.service.RoadConditionEventService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.encoding.XMLType;
import java.text.SimpleDateFormat;
import java.util.Map;
/** 普通国省道路况接口 */
@Slf4j
@Service
public class GetRoadPlatformImpl implements GetRoadPlatformService {
@Autowired private RoadConditionEventService roadConditionEventService;
/** 定时任务间隔1分钟获取接口数据 */
@Override
@Scheduled(cron = "0 0/1 * * * ?")
public void scheduledSaveRoadInfo() {
log.info("执行定时任务获取路况平台路况事件时间: {}", DateTime.now());
try {
String endPoint = "http://103.239.155.114:17001/lkxxfw/RoadInfoService?wsdl";
String nameSpace = "http://services.team.com/";
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
javax.xml.rpc.Call call = service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endPoint).toString());
call.setOperationName(new QName(nameSpace, "getLkInfo"));
call.addParameter("arg0", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING); // 设置返回类型
String res = (String) call.invoke(new Object[] {"B"});
Map mapTypes = JSON.parseObject(res);
// System.out.println(res);
for (Object obj : mapTypes.keySet()) {
JSONArray ojb = (JSONArray) mapTypes.get("ROADINFO");
Object[] array = ojb.toArray();
for (Object o : array) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Integer rowNum = null;
rowNum =
roadConditionEventService.getRoadMaintainEventByRoadPlatform(
// ((JSONObject) o).get("infid").toString(),
((JSONObject) o).get("inftypename").toString(),
((JSONObject) o).get("inftitle").toString(),
((JSONObject) o).get("infcontent").toString(),
((JSONObject) o).get("infwrinter").toString(),
formatter.parse(((JSONObject) o).get("writerdate").toString()),
((JSONObject) o).get("infchecker").toString(),
formatter.parse(((JSONObject) o).get("checkdate").toString()),
formatter.parse(((JSONObject)o).get("removedate").toString().equals("null")?"1900-01-01 00:00:00":((JSONObject) o).get("removedate").toString()),
// ((JSONObject) o).get("remark").toString(),
((JSONObject) o).get("glno").toString(),
((JSONObject) o).get("writerno").toString(),
((JSONObject) o).get("loctx").toString(),
((JSONObject) o).get("locty").toString(),
((JSONObject) o).get("zhuanghao").toString(),
((JSONObject) o).get("daolu").toString(),
// ((JSONObject) o).get("removereson").toString(),
// ((JSONObject) o).get("departname").toString(),
// ((JSONObject) o).get("removedepart").toString(),
// formatter.parse(((JSONObject) o).get("expdate").toString()),
// ((JSONObject) o).get("impact").toString(),
// ((JSONObject) o).get("zhfrom").toString(),
// ((JSONObject) o).get("zhto").toString(),
((JSONObject) o).get("yccd").toString());
if (rowNum > 0) {
continue;
} else {
roadConditionEventService.save(
RoadConditionEvent.builder()
.eventId(((JSONObject) o).get("infid").toString())
.eventType(((JSONObject) o).get("inftypename").toString())
.eventTitle(((JSONObject) o).get("inftitle").toString())
.eventContent(((JSONObject) o).get("infcontent").toString())
.startPerson(((JSONObject) o).get("infwrinter").toString())
.startTime(formatter.parse(((JSONObject) o).get("writerdate").toString()))
.checkPerson(((JSONObject) o).get("infchecker").toString())
.checkTime(formatter.parse(((JSONObject) o).get("checkdate").toString()))
.endTime(formatter.parse(((JSONObject)o).get("removedate").toString().equals("null")?"1900-01-01 00:00:00":((JSONObject) o).get("removedate").toString()))
.startBz(((JSONObject) o).get("remark").toString())
.roadCode(((JSONObject) o).get("glno").toString())
.startUnitNo(((JSONObject) o).get("writerno").toString())
.longitude(((JSONObject) o).get("loctx").toString())
.latitude(((JSONObject) o).get("locty").toString())
.stoem(((JSONObject) o).get("zhuanghao").toString())
.roadName(((JSONObject) o).get("daolu").toString())
.endReason(((JSONObject) o).get("removereson").toString().equals("null")?"":((JSONObject) o).get("removereson").toString())
.maintainUnit(((JSONObject) o).get("departname").toString())
.endUnit(((JSONObject) o).get("removedepart").toString().equals("null")?"":((JSONObject) o).get("removedepart").toString())
.preEndTime(formatter.parse(((JSONObject) o).get("expdate").toString()))
.influence(((JSONObject) o).get("impact").toString())
.startm(((JSONObject) o).get("zhfrom").toString())
.endm(((JSONObject) o).get("zhto").toString())
.carsLength(((JSONObject) o).get("yccd").toString())
.solution("")
.startUnit("")
.endUnitNo("")
.endBz("")
.endPerson("")
.build());
}
}
}
} catch (Exception e) {
log.info("调用路况平台 exception: {}", e);
}
}
}
package com.elephant.framework.galaxy.aroad.module.roadcondition.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.elephant.framework.galaxy.aroad.module.roadcondition.dto.*;
import com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent;
import com.elephant.framework.galaxy.aroad.module.roadcondition.mapper.RoadConditionEventMapper;
import com.elephant.framework.galaxy.aroad.module.roadcondition.service.RoadConditionEventService;
import lombok.AllArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -21,23 +24,116 @@ import java.util.List;
* @date 2019-04-23 16:41:06
*/
@Service
@AllArgsConstructor
public class RoadConditionEventServiceImpl
extends ServiceImpl<RoadConditionEventMapper, RoadConditionEvent>
implements RoadConditionEventService {
public RoadConditionEvent getById(@Param("id") Integer id){
return baseMapper.getById(id);
}
private final RoadConditionEventMapper roadConditionEventMapper;
public IPage<RoadConditionEvent> getRoadConditionEventPage(Page<RoadConditionEvent> page, RoadConditionEvent roadConditionEvent) {
return baseMapper.getRoadConditionEventPage(page, roadConditionEvent);
}
/**
* 根据事件ID查询该路况事件是否已经存在(大于0表示已存在)
*
* @param eventID
* @return
*/
public Integer getRoadMaintainEventByEventID(String eventID) {
return roadConditionEventMapper.selectCount(
Wrappers.<RoadConditionEvent>query().lambda().eq(RoadConditionEvent::getId, eventID));
}
public List<RoadConditionEvent> getRoadConditionEventMobilePage(@Param("text") String text) {
return baseMapper.getRoadConditionEventMobilePage(text);
}
/**
* 查询数据库是否存在该实体
*
* @param event
* @return
*/
public RoadConditionEvent selectRoadMaintainEvent(RoadConditionEvent event) {
return baseMapper.selectRoadMaintainEvent(event);
}
/** 撤销事件,根据事件ID更新flag标识 */
public Integer updateBatchByEventId(List<Object> eventIdList) {
return baseMapper.updateBatchByEventId(eventIdList);
}
/** 删除事件(假删除),更新flag标识为1 */
public Integer deleteBatchByEvent(RoadConditionEvent event) {
return baseMapper.deleteBatchByEvent(event);
}
/**
* 普通国省道养护施工事件信息是否已存在
*
* @param
* @return
*/
public Integer getRoadMaintainEventByRoadPlatform(
String inftypename,
String inftitle,
String infcontent,
String infwrinter,
Date writerdate,
String infchecker,
Date checkdate,
Date removedate,
// String remark,
String glno,
String writerno,
String loctx,
String locty,
String zhuanghao,
String daolu,
// String removereson,
// String departname,
// String removedepart,
// Date expdate,
// String impact,
// String zhfrom,
// String zhto,
String yccd) {
return roadConditionEventMapper.selectCount(
Wrappers.<RoadConditionEvent>query()
.lambda()
// .eq(RoadConditionEvent::getEventId, infid)
.eq(RoadConditionEvent::getEventType, inftypename)
.eq(RoadConditionEvent::getEventTitle, inftitle)
.eq(RoadConditionEvent::getEventContent, infcontent)
.eq(RoadConditionEvent::getStartPerson, infwrinter)
.eq(RoadConditionEvent::getStartTime, writerdate)
.eq(RoadConditionEvent::getCheckPerson, infchecker)
.eq(RoadConditionEvent::getCheckTime, checkdate)
.eq(RoadConditionEvent::getEndTime, removedate)
// .eq(RoadConditionEvent::getStartBz, remark)
.eq(RoadConditionEvent::getRoadCode, glno)
.eq(RoadConditionEvent::getStartUnitNo, writerno)
.eq(RoadConditionEvent::getLongitude, loctx)
.eq(RoadConditionEvent::getLatitude, locty)
.eq(RoadConditionEvent::getStoem, zhuanghao)
.eq(RoadConditionEvent::getRoadName, daolu)
// .eq(RoadConditionEvent::getEndReason, removereson)
// .eq(RoadConditionEvent::getMaintainUnit, departname)
// .eq(RoadConditionEvent::getEndUnit, removedepart)
// .eq(RoadConditionEvent::getPreEndTime, expdate)
// .eq(RoadConditionEvent::getInfluence, impact)
// .eq(RoadConditionEvent::getStartm, zhfrom)
// .eq(RoadConditionEvent::getEndm, zhto)
.eq(RoadConditionEvent::getCarsLength, yccd));
}
public RoadConditionEvent getById(@Param("id") Integer id) {
return baseMapper.getById(id);
}
public IPage<RoadConditionEvent> getRoadConditionEventPage(
Page<RoadConditionEvent> page, RoadConditionEvent roadConditionEvent) {
return baseMapper.getRoadConditionEventPage(page, roadConditionEvent);
}
/**
public List<RoadConditionEvent> getRoadConditionEventMobilePage() {
return baseMapper.getRoadConditionEventMobilePage();
}
/**
* @description : 根据事件类型查询
* @author : Xingyuyang
* @date : 2019/4/23 0023 17:54
......@@ -96,50 +192,50 @@ public class RoadConditionEventServiceImpl
return baseMapper.staticByCity();
}
@Cacheable(value = "roadConditionCoordinates")
public List<CoordinateDto> getCoordinates() {
return baseMapper.getCoordinates();
}
@Cacheable(value = "roadConditionCoordinates")
public List<CoordinateDto> getCoordinates() {
return baseMapper.getCoordinates();
}
@Cacheable(value = "tqCoordinates")
public List<CoordinateDto> getTQCoordinates() {
return baseMapper.getTQCoordinates();
}
@Cacheable(value = "tqCoordinates")
public List<CoordinateDto> getTQCoordinates() {
return baseMapper.getTQCoordinates();
}
@Cacheable(value = "yhCoordinates")
public List<CoordinateDto> getYHCoordinates() {
return baseMapper.getYHCoordinates();
}
@Cacheable(value = "yhCoordinates")
public List<CoordinateDto> getYHCoordinates() {
return baseMapper.getYHCoordinates();
}
@Cacheable(value = "sfzCoordinates")
public List<CoordinateDto> getSFZCoordinates() {
return baseMapper.getSFZCoordinates();
}
@Cacheable(value = "sfzCoordinates")
public List<CoordinateDto> getSFZCoordinates() {
return baseMapper.getSFZCoordinates();
}
@Cacheable(value = "tfCoordinates")
public List<CoordinateDto> getTFCoordinates() {
return baseMapper.getTFCoordinates();
}
@Cacheable(value = "tfCoordinates")
public List<CoordinateDto> getTFCoordinates() {
return baseMapper.getTFCoordinates();
}
/**
* @description : 根据城市查询
* @author : Xingyuyang
* @date : 2019/4/24 0024 14:27
* @return :
* java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.dto.staticByCityDto>
*/
public List<staticByYHCityDto> staticByYHCity() {
return baseMapper.staticByYHCity();
}
/**
* @description : 根据城市查询
* @author : Xingyuyang
* @date : 2019/4/24 0024 14:27
* @return :
* java.util.List<com.elephant.framework.galaxy.aroad.module.roadcondition.dto.staticByCityDto>
*/
public List<staticByYHCityDto> staticByYHCity() {
return baseMapper.staticByYHCity();
}
/**
/**
* @Description: 查询所有服务区所属路线名称和编码的树形结构 @Param: []
*
* @return:
* java.util.List<com.elephant.framework.galaxy.travel.module.basic_resources.entity.BaseServiceArea> @Author:
* songwenjie @Date: 2019/4/10
*/
// @Cacheable(value="cityTree")
// @Cacheable(value="cityTree")
public BaseTreeDto getTree() {
List<CityNameDto> cityTree = baseMapper.getTree();
List<SingleNameDto> Jinan = new ArrayList<>();
......
......@@ -3,12 +3,12 @@ package com.elephant.framework.galaxy.aroad.security.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
/**
* @Description OAuth 资源服务器配置
*
* @auther wangjian
* @create 2019-02-21 21:23
*/
......@@ -17,18 +17,17 @@ import org.springframework.security.oauth2.config.annotation.web.configuration.R
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http.formLogin()
.and()
.authorizeRequests()
.anyRequest()
.authenticated()
.and()
.csrf()
.disable();
}
@Override
public void configure(HttpSecurity http) throws Exception {
http.formLogin()
.and()
.authorizeRequests()
.antMatchers("/roadconditionevent/**")
.permitAll()
.anyRequest()
.authenticated()
.and()
.csrf()
.disable();
}
}
......@@ -7,8 +7,11 @@
<resultMap id="roadConditionEventMap"
type="com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent">
<id property="id" column="id"/>
<result property="eventId" column="event_id"/>
<result property="roadCode" column="road_code"/>
<result property="roadName" column="road_name"/>
<result property="maintainUnit" column="maintain_unit"/>
<result property="stoem" column="sToeM"/>
<result property="startm" column="startM"/>
<result property="endm" column="endM"/>
<result property="eventType" column="event_type"/>
......@@ -17,15 +20,24 @@
<result property="influence" column="influence"/>
<result property="carsLength" column="cars_length"/>
<result property="solution" column="solution"/>
<result property="startPerson" column="start_person"/>
<result property="startTime" column="start_time"/>
<result property="startUnit" column="start_unit"/>
<result property="startPerson" column="start_person"/>
<result property="startUnitNo" column="start_unit_no"/>
<result property="startBz" column="start_bz"/>
<result property="preEndTime" column="pre_end_time"/>
<result property="endPerson" column="end_person"/>
<result property="endTime" column="end_time"/>
<result property="endUnit" column="end_unit"/>
<result property="endUnitNo" column="end_unit_no"/>
<result property="endReason" column="end_reason"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result property="endBz" column="end_bz"/>
<result property="checkPerson" column="check_person"/>
<result property="checkTime" column="check_time"/>
<result property="longitude" column="longitude"/>
<result property="latitude" column="latitude"/>
<result property="current" column="current"/>
<result property="size" column="size"/>
</resultMap>
<resultMap id="staticByEventTypeMap"
......@@ -75,6 +87,7 @@
type="com.elephant.framework.galaxy.aroad.module.roadcondition.dto.CoordinateDto">
<id column="id" property="id"/>
<result property="eventType" column="event_type"/>
<result property="eventTitle" column="event_title"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
</resultMap>
......@@ -82,46 +95,44 @@
<select id="getRoadConditionEventPage" resultMap="roadConditionEventMap"
parameterType="com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent">
SELECT
id,road_code,concat(road_code,'·',road_name) as
road_name,startm,endm,event_type,event_title,event_content,influence,cars_length,solution,start_time,start_unit,start_person,pre_end_time,end_time,end_unit,end_reason,longitude,latitude
*
FROM road_condition_event
<where>
<if test="roadConditionEvent.startUnit != null">start_unit = #{roadConditionEvent.startUnit} and</if>
<if test="roadConditionEvent.eventType != null">event_type = #{roadConditionEvent.eventType} and</if>
<if test="roadConditionEvent.startUnit != null">maintain_unit like CONCAT('%',#{roadConditionEvent.startUnit},'%') and</if>
<if test="roadConditionEvent.eventType != null">event_type like concat('%',#{roadConditionEvent.eventType},'%') and</if>
<if test="roadConditionEvent.influence != null">influence = #{roadConditionEvent.influence} and</if>
<if test="roadConditionEvent.carsLength != null">cars_length = #{roadConditionEvent.carsLength} and</if>
<if test="roadConditionEvent.startTime != null">start_time &gt; #{roadConditionEvent.startTime} and</if>
<if test="roadConditionEvent.endTime != null">end_time &lt; #{roadConditionEvent.endTime} and</if>
road_name is not null
1=1
</where>
</select>
<select id="getRoadConditionEventMobilePage" resultMap="roadConditionEventMap">
SELECT
id,road_code,concat(road_code,'·',road_name) as
road_name,startm,endm,event_type,event_title,event_content,influence,cars_length,solution,start_time,start_unit,start_person,pre_end_time,end_time,end_unit,end_reason,longitude,latitude
SELECT *
# id,road_code,concat(road_code,'·',road_name) as
# road_name,startm,endm,event_type,event_title,event_content,influence,cars_length,solution,start_time,start_unit,start_person,pre_end_time,end_time,end_unit,end_reason,longitude,latitude
FROM road_condition_event
<where>
<if test="text!= null">
road_code like CONCAT('%',#{text},'%')
or
road_name like CONCAT('%',#{text},'%')
or
event_type like CONCAT('%',#{text},'%')
or
event_title like CONCAT('%',#{text},'%')
or
event_content like CONCAT('%',#{text},'%')
or
influence like CONCAT('%',#{text},'%')
or
cars_length like CONCAT('%',#{text},'%')
or
start_unit like CONCAT('%',#{text},'%')
and
</if>
road_name is not null
</where>
<!-- <where>-->
<!-- <if test="text!= null">-->
<!-- road_code like CONCAT('%',#{text},'%')-->
<!-- or-->
<!-- road_name like CONCAT('%',#{text},'%')-->
<!-- or-->
<!-- event_type like CONCAT('%',#{text},'%')-->
<!-- or-->
<!-- event_title like CONCAT('%',#{text},'%')-->
<!-- or-->
<!-- event_content like CONCAT('%',#{text},'%')-->
<!-- or-->
<!-- influence like CONCAT('%',#{text},'%')-->
<!-- or-->
<!-- cars_length like CONCAT('%',#{text},'%')-->
<!-- or-->
<!-- start_unit like CONCAT('%',#{text},'%')-->
<!-- and-->
<!-- </if>-->
<!-- road_name is not null-->
<!-- </where>-->
</select>
<select id="getById" resultMap="roadConditionEventMap">
......@@ -149,7 +160,7 @@
YEAR(start_time) AS year,
MONTH(start_time) AS month
FROM road_condition_event
WHERE event_type = '养护施工'
WHERE event_type = '养护施工信息'
GROUP BY YEAR(start_time),
MONTH(start_time)
</select>
......@@ -158,25 +169,28 @@
SELECT count(*) AS count,
road_code as roadcode
FROM road_condition_event
WHERE event_type = '养护施工'
WHERE event_type = '养护施工信息'
GROUP BY road_code
</select>
<select id="staticByCity" resultMap="staticByCityMap">
SELECT count(shortName) as count,
city
FROM base_organize
WHERE city IS NOT NULL
AND city != '山东'
GROUP BY city
SELECT
count( * ) AS count,
# maintain_unit,
SUBSTRING( maintain_unit FROM 1 FOR 2 ) as city
FROM
road_condition_event
where SUBSTRING( maintain_unit FROM 1 FOR 2 )!='山东'
GROUP BY
maintain_unit
</select>
<select id="staticByYHCity" resultMap="staticByYHCityMap">
SELECT count(*) as count,
start_unit as startunit
maintain_unit as startunit
FROM road_condition_event
WHERE event_type = '养护施工'
GROUP BY start_unit
WHERE event_type = '养护施工信息'
GROUP BY maintain_unit
</select>
<select id="getTree" resultMap="citysWithOrganizesMap">
......@@ -190,31 +204,470 @@
</select>
<select id="getCoordinates" resultMap="CoordinateDtoMap">
select id, longitude, latitude, event_type
select id, longitude, latitude, event_type,event_title
from `road_condition_event`;
</select>
<select id="getTQCoordinates" resultMap="CoordinateDtoMap">
select id, longitude, latitude, event_type
select id, longitude, latitude, event_type,event_title
from `road_condition_event`
where event_type = '异常天气';
where event_title = '异常天气';
</select>
<select id="getYHCoordinates" resultMap="roadConditionEventMap">
select id, longitude, latitude, event_type
select id, longitude, latitude, event_type,event_title
from `road_condition_event`
where event_type = '养护施工';
where event_title = '养护施工';
</select>
<select id="getTFCoordinates" resultMap="CoordinateDtoMap">
select id, longitude, latitude, event_type
select id, longitude, latitude, event_type,event_title
from `road_condition_event`
where event_type = '突发事件';
where event_title = '突发事件';
</select>
<select id="getSFZCoordinates" resultMap="CoordinateDtoMap">
select id, longitude, latitude, event_type
select id, longitude, latitude, event_type,event_title
from `road_condition_event`
where event_type = '收费站异常';
where event_title = '收费站异常';
</select>
<select id="selectRoadMaintainEvent"
parameterType="com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent" resultMap="roadConditionEventMap">
SELECT * FROM road_condition_event
WHERE
<if test="id != null">
id = #{id} AND
</if>
<if test="id == null">
ISNULL(id) AND
</if>
<if test="eventId != null">
event_id = #{eventId} AND
</if>
<if test="eventId == null">
ISNULL(event_id) AND
</if>
<if test="roadCode != null">
road_code = #{roadCode} AND
</if>
<if test="roadCode == null">
ISNULL(road_code) AND
</if>
<if test="roadName != null">
road_name = #{roadName} AND
</if>
<if test="roadName == null">
ISNULL(road_name) AND
</if>
<if test="maintainUnit != null">
maintain_unit = #{maintainUnit} AND
</if>
<if test="maintainUnit == null">
ISNULL(maintain_unit) AND
</if>
<if test="stoem != null">
sToeM = #{stoem} AND
</if>
<if test="stoem == null">
ISNULL(sToeM) AND
</if>
<if test="startm != null">
startM = #{startm} AND
</if>
<if test="startm == null">
ISNULL(startM) AND
</if>
<if test="endm != null">
endM = #{endm} AND
</if>
<if test="endm == null">
ISNULL(endM) AND
</if>
<if test="eventType != null">
event_type = #{eventType} AND
</if>
<if test="eventType == null">
ISNULL(event_type) AND
</if>
<if test="eventTitle != null">
event_title = #{eventTitle} AND
</if>
<if test="eventTitle == null">
ISNULL(event_title) AND
</if>
<if test="eventContent != null">
event_content = #{eventContent} AND
</if>
<if test="eventContent == null">
ISNULL(event_content) AND
</if>
<if test="influence != null">
influence = #{influence} AND
</if>
<if test="influence == null">
ISNULL(influence) AND
</if>
<if test="carsLength != null">
cars_length = #{carsLength} AND
</if>
<if test="carsLength == null">
ISNULL(cars_length) AND
</if>
<if test="solution != null">
solution = #{solution} AND
</if>
<if test="solution == null">
ISNULL(solution) AND
</if>
<if test="startPerson != null">
start_person = #{startPerson} AND
</if>
<if test="startPerson == null">
ISNULL(start_person) AND
</if>
<if test="startTime != null">
start_time = #{startTime} AND
</if>
<if test="startTime == null">
ISNULL(start_time) AND
</if>
<if test="startUnit != null">
start_unit = #{startUnit} AND
</if>
<if test="startUnit == null">
ISNULL(start_unit) AND
</if>
<if test="startUnitNo != null">
start_unit_no = #{startUnitNo} AND
</if>
<if test="startUnitNo == null">
ISNULL(start_unit_no) AND
</if>
<if test="startBz != null">
start_bz = #{startBz} AND
</if>
<if test="startBz == null">
ISNULL(start_bz) AND
</if>
<if test="preEndTime != null">
pre_end_time = #{preEndTime} AND
</if>
<if test="preEndTime == null">
ISNULL(pre_end_time) AND
</if>
<if test="endPerson != null">
end_person = #{endPerson} AND
</if>
<if test="endPerson == null">
ISNULL(end_person) AND
</if>
<if test="endTime != null">
end_time = #{endTime} AND
</if>
<if test="endTime == null">
ISNULL(end_time) AND
</if>
<if test="endUnit != null">
end_unit = #{endUnit} AND
</if>
<if test="endUnit == null">
ISNULL(end_unit) AND
</if>
<if test="endUnitNo != null">
end_unit_no = #{endUnitNo} AND
</if>
<if test="endUnitNo == null">
ISNULL(end_unit_no) AND
</if>
<if test="endReason != null">
end_reason = #{endReason} AND
</if>
<if test="endReason == null">
ISNULL(end_reason) AND
</if>
<if test="endBz != null">
end_bz = #{endBz} AND
</if>
<if test="endBz == null">
ISNULL(end_bz) AND
</if>
<if test="checkPerson != null">
check_person = #{checkPerson} AND
</if>
<if test="checkPerson == null">
ISNULL(check_person) AND
</if>
<if test="checkTime != null">
check_time = #{checkTime} AND
</if>
<if test="checkTime == null">
ISNULL(check_time) AND
</if>
<if test="longitude != null">
longitude = #{longitude} AND
</if>
<if test="longitude == null">
ISNULL(longitude) AND
</if>
<if test="latitude != null">
latitude = #{latitude} AND
</if>
<if test="latitude == null">
ISNULL(latitude) AND
</if>
</select>
<update id="updateBatchByEventId" parameterType="java.util.List">
UPDATE road_condition_event
WHERE event_id IN
<foreach collection="eventIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="deleteBatchByEvent"
parameterType="com.elephant.framework.galaxy.aroad.module.roadcondition.entity.RoadConditionEvent">
UPDATE road_condition_event
WHERE
<if test="id != null">
id = #{id} AND
</if>
<if test="id == null">
ISNULL(id) AND
</if>
<if test="eventId != null">
event_id = #{eventId} AND
</if>
<if test="eventId == null">
ISNULL(event_id) AND
</if>
<if test="roadCode != null">
road_code = #{roadCode} AND
</if>
<if test="roadCode == null">
ISNULL(road_code) AND
</if>
<if test="roadName != null">
road_name = #{roadName} AND
</if>
<if test="roadName == null">
ISNULL(road_name) AND
</if>
<if test="maintainUnit != null">
maintain_unit = #{maintainUnit} AND
</if>
<if test="maintainUnit == null">
ISNULL(maintain_unit) AND
</if>
<if test="stoem != null">
sToeM = #{stoem} AND
</if>
<if test="stoem == null">
ISNULL(sToeM) AND
</if>
<if test="startm != null">
startM = #{startm} AND
</if>
<if test="startm == null">
ISNULL(startM) AND
</if>
<if test="endm != null">
endM = #{endm} AND
</if>
<if test="endm == null">
ISNULL(endM) AND
</if>
<if test="eventType != null">
event_type = #{eventType} AND
</if>
<if test="eventType == null">
ISNULL(event_type) AND
</if>
<if test="eventTitle != null">
event_title = #{eventTitle} AND
</if>
<if test="eventTitle == null">
ISNULL(event_title) AND
</if>
<if test="eventContent != null">
event_content = #{eventContent} AND
</if>
<if test="eventContent == null">
ISNULL(event_content) AND
</if>
<if test="influence != null">
influence = #{influence} AND
</if>
<if test="influence == null">
ISNULL(influence) AND
</if>
<if test="carsLength != null">
cars_length = #{carsLength} AND
</if>
<if test="carsLength == null">
ISNULL(cars_length) AND
</if>
<if test="solution != null">
solution = #{solution} AND
</if>
<if test="solution == null">
ISNULL(solution) AND
</if>
<if test="startPerson != null">
start_person = #{startPerson} AND
</if>
<if test="startPerson == null">
ISNULL(start_person) AND
</if>
<if test="startTime != null">
start_time = #{startTime} AND
</if>
<if test="startTime == null">
ISNULL(start_time) AND
</if>
<if test="startUnit != null">
start_unit = #{startUnit} AND
</if>
<if test="startUnit == null">
ISNULL(start_unit) AND
</if>
<if test="startUnitNo != null">
start_unit_no = #{startUnitNo} AND
</if>
<if test="startUnitNo == null">
ISNULL(start_unit_no) AND
</if>
<if test="startBz != null">
start_bz = #{startBz} AND
</if>
<if test="startBz == null">
ISNULL(start_bz) AND
</if>
<if test="preEndTime != null">
pre_end_time = #{preEndTime} AND
</if>
<if test="preEndTime == null">
ISNULL(pre_end_time) AND
</if>
<if test="endPerson != null">
end_person = #{endPerson} AND
</if>
<if test="endPerson == null">
ISNULL(end_person) AND
</if>
<if test="endTime != null">
end_time = #{endTime} AND
</if>
<if test="endTime == null">
ISNULL(end_time) AND
</if>
<if test="endUnit != null">
end_unit = #{endUnit} AND
</if>
<if test="endUnit == null">
ISNULL(end_unit) AND
</if>
<if test="endUnitNo != null">
end_unit_no = #{endUnitNo} AND
</if>
<if test="endUnitNo == null">
ISNULL(end_unit_no) AND
</if>
<if test="endReason != null">
end_reason = #{endReason} AND
</if>
<if test="endReason == null">
ISNULL(end_reason) AND
</if>
<if test="endBz != null">
end_bz = #{endBz} AND
</if>
<if test="endBz == null">
ISNULL(end_bz) AND
</if>
<if test="checkPerson != null">
check_person = #{checkPerson} AND
</if>
<if test="checkPerson == null">
ISNULL(check_person) AND
</if>
<if test="checkTime != null">
check_time = #{checkTime} AND
</if>
<if test="checkTime == null">
ISNULL(check_time) AND
</if>
<if test="longitude != null">
longitude = #{longitude} AND
</if>
<if test="longitude == null">
ISNULL(longitude) AND
</if>
<if test="latitude != null">
latitude = #{latitude} AND
</if>
<if test="latitude == null">
ISNULL(latitude) AND
</if>
</update>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论