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

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

上级 587f94bc
......@@ -24,29 +24,41 @@ 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 '撤销原因',
`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;
......
......@@ -155,6 +155,47 @@
<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>
......
......@@ -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,80 +16,133 @@ 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);
/**
* 根据事件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>
*
* @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>
*
* @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>
*
* @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>
*
* @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>
*
* @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>
*
* @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
* @Description: 查询树形结构 @Param: []
*
* @return:
* java.util.List<com.elephant.framework.galaxy.travel.module.basic_resources.entity.BaseServiceArea> @Author:
* XingYuyang @Date: 2019/4/10
*/
BaseTreeDto getTree();
......
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,20 +24,113 @@ 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){
private final RoadConditionEventMapper roadConditionEventMapper;
/**
* 根据事件ID查询该路况事件是否已经存在(大于0表示已存在)
*
* @param eventID
* @return
*/
public Integer getRoadMaintainEventByEventID(String eventID) {
return roadConditionEventMapper.selectCount(
Wrappers.<RoadConditionEvent>query().lambda().eq(RoadConditionEvent::getId, eventID));
}
/**
* 查询数据库是否存在该实体
*
* @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) {
public IPage<RoadConditionEvent> getRoadConditionEventPage(
Page<RoadConditionEvent> page, RoadConditionEvent roadConditionEvent) {
return baseMapper.getRoadConditionEventPage(page, roadConditionEvent);
}
public List<RoadConditionEvent> getRoadConditionEventMobilePage(@Param("text") String text) {
return baseMapper.getRoadConditionEventMobilePage(text);
public List<RoadConditionEvent> getRoadConditionEventMobilePage() {
return baseMapper.getRoadConditionEventMobilePage();
}
/**
......@@ -139,7 +235,7 @@ public class RoadConditionEventServiceImpl
* 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
*/
......@@ -22,13 +22,12 @@ public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter
http.formLogin()
.and()
.authorizeRequests()
.antMatchers("/roadconditionevent/**")
.permitAll()
.anyRequest()
.authenticated()
.and()
.csrf()
.disable();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论