Commit 888be65d authored by hanbing's avatar hanbing

方案管理-路口配置-路口方向列表

parent 43b9150d
...@@ -23,7 +23,7 @@ pipeline { ...@@ -23,7 +23,7 @@ pipeline {
} }
stage('编译构建web模块') { stage('编译构建web模块') {
steps { steps {
sh 'mvn -pl signal-web-service clean package -Dmaven.test.skip=true jib:build -DsendCredentialsOverHttp=true' sh 'mvn -pl signal-control-service clean package -Dmaven.test.skip=true jib:build -DsendCredentialsOverHttp=true'
} }
} }
stage('删除utc模块镜像和容器') { stage('删除utc模块镜像和容器') {
...@@ -48,13 +48,13 @@ pipeline { ...@@ -48,13 +48,13 @@ pipeline {
steps { steps {
sh ''' sh '''
echo \'检查容器是否存在\' echo \'检查容器是否存在\'
containerid=`docker ps -a|grep signal-web-service|awk \'{print $1}\'` containerid=`docker ps -a|grep signal-control-service|awk \'{print $1}\'`
if [ "$containerid" != "" ];then if [ "$containerid" != "" ];then
echo \'容器存在,删除容器\' echo \'容器存在,删除容器\'
docker rm -f $containerid docker rm -f $containerid
fi fi
echo \'检查镜像是否存在\' echo \'检查镜像是否存在\'
imageid=`docker images|grep signal-web-service|awk \'{print $3}\'` imageid=`docker images|grep signal-control-service|awk \'{print $3}\'`
if [ "$imageid" != "" ];then if [ "$imageid" != "" ];then
echo \'删除镜像\' echo \'删除镜像\'
docker rmi -f $imageid docker rmi -f $imageid
...@@ -69,7 +69,7 @@ pipeline { ...@@ -69,7 +69,7 @@ pipeline {
} }
stage('拉取web模块镜像') { stage('拉取web模块镜像') {
steps { steps {
sh 'docker pull 10.100.1.87:5000/xinkong/signal-web-service:0.2.1' sh 'docker pull 10.100.1.87:5000/xinkong/signal-control-service:0.2.1'
} }
} }
stage('运行utc模块容器') { stage('运行utc模块容器') {
...@@ -79,7 +79,7 @@ pipeline { ...@@ -79,7 +79,7 @@ pipeline {
} }
stage('运行web模块容器') { stage('运行web模块容器') {
steps { steps {
sh 'docker run -p 32001:32001 -p 15116:15116 -itd --name signal-web-service 10.100.1.87:5000/xinkong/signal-web-service:0.2.1' sh 'docker run -p 32001:32001 -p 15116:15116 -itd --name signal-control-service 10.100.1.87:5000/xinkong/signal-control-service:0.2.1'
} }
} }
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<modules> <modules>
<module>identity-client-starter</module> <module>identity-client-starter</module>
<module>signal-utc-service</module> <module>signal-utc-service</module>
<module>signal-web-service</module> <module>signal-control-service</module>
<module>wj-common</module> <module>wj-common</module>
<module>wj-databus</module> <module>wj-databus</module>
<module>wj-identity</module> <module>wj-identity</module>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<version>0.2.1</version> <version>0.2.1</version>
</parent> </parent>
<artifactId>signal-web-service</artifactId> <artifactId>signal-control-service</artifactId>
<name>signal-web-service</name> <name>signal-web-service</name>
......
...@@ -6,7 +6,7 @@ import java.util.Objects; ...@@ -6,7 +6,7 @@ import java.util.Objects;
* @author Kent HAN * @author Kent HAN
* @date 2022/11/8 17:20 * @date 2022/11/8 17:20
*/ */
public enum SpecialServiceCrossDirEnum { public enum CrossDirEnum {
ONE(1, "北"), ONE(1, "北"),
TWO(2, "东北"), TWO(2, "东北"),
THREE(3, "东"), THREE(3, "东"),
...@@ -14,18 +14,18 @@ public enum SpecialServiceCrossDirEnum { ...@@ -14,18 +14,18 @@ public enum SpecialServiceCrossDirEnum {
FIVE(5, "南"), FIVE(5, "南"),
SIX(6, "西南"), SIX(6, "西南"),
SEVEN(7, "西"), SEVEN(7, "西"),
EIGHT(3, "西北"); EIGHT(8, "西北");
private final int code; private final int code;
private final String msg; private final String msg;
SpecialServiceCrossDirEnum(int code, String msg) { CrossDirEnum(int code, String msg) {
this.code = code; this.code = code;
this.msg = msg; this.msg = msg;
} }
public static String getMsgByCode(int code) { public static String getMsgByCode(int code) {
for (SpecialServiceCrossDirEnum value : SpecialServiceCrossDirEnum.values()) { for (CrossDirEnum value : CrossDirEnum.values()) {
if (value.code == code) { if (value.code == code) {
return value.msg; return value.msg;
} }
...@@ -34,7 +34,7 @@ public enum SpecialServiceCrossDirEnum { ...@@ -34,7 +34,7 @@ public enum SpecialServiceCrossDirEnum {
} }
public static Integer getCodeByMsg(String msg) { public static Integer getCodeByMsg(String msg) {
for (SpecialServiceCrossDirEnum value : SpecialServiceCrossDirEnum.values()) { for (CrossDirEnum value : CrossDirEnum.values()) {
if (Objects.equals(value.msg, msg)) { if (Objects.equals(value.msg, msg)) {
return value.code; return value.code;
} }
......
package net.wanji.web.common.enums;
/**
* @author Kent HAN
* @date 2022/11/8 17:20
*/
public enum CrossInOutEnum {
ONE(1, "进口"),
TWO(2, "出口");
private final int code;
private final String msg;
CrossInOutEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(int code) {
for (CrossInOutEnum value : CrossInOutEnum.values()) {
if (value.code == code) {
return value.msg;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.controller.scheme;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.web.common.entity.JsonViewObject;
import net.wanji.web.dto.CrossIdDTO;
import net.wanji.web.service.scheme.impl.CrossConfigServiceImpl;
import net.wanji.web.vo.scheme.CrossDirsVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType;
/**
* @author Kent HAN
* @date 2022/12/20 10:14
*/
@Api(value = "CrossConfigController", description = "方案管理-路口配置")
@RequestMapping("/crossConfig")
@RestController
public class CrossConfigController {
private final CrossConfigServiceImpl crossConfigServiceImpl;
public CrossConfigController(CrossConfigServiceImpl crossConfigServiceImpl) {
this.crossConfigServiceImpl = crossConfigServiceImpl;
}
@ApiOperation(value = "获取路口方向列表", notes = "获取路口方向列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/listCrossDirs",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossDirsVO.class),
})
public JsonViewObject listCrossDirs(@RequestBody CrossIdDTO crossIdDTO) {
String crossId = crossIdDTO.getCrossId();
CrossDirsVO crossDirsVO = crossConfigServiceImpl.listCrossDirs(crossId);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(crossDirsVO);
}
}
package net.wanji.web.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/12/20 10:17
*/
@Data
public class CrossIdDTO {
@ApiModelProperty(value = "路口ID,如:c7e7b1f352dd4acab4a60088eb391cca", required = true)
private String crossId;
}
package net.wanji.web.mapper.scheme;
import io.lettuce.core.dynamic.annotation.Param;
import net.wanji.web.po.scheme.CrossDirInfoPO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/12/20 10:32
*/
@Repository
public interface CrossDirInfoMapper {
List<CrossDirInfoPO> listByCrossID(@Param("crossId") String crossId);
}
package net.wanji.web.po.scheme;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/12/20 10:36
*/
@Data
public class CrossDirInfoPO {
/** 路口方向ID(路口ID_方向_进出口_主辅路序号) */
@ApiModelProperty(name = "路口方向ID(路口ID_方向_进出口_主辅路序号)",notes = "")
private String id ;
/** 路口方向类型:1北;2东北;3东;4东南;5南;6西南;7西;8西北 */
@ApiModelProperty(name = "路口方向类型:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer dirType ;
/** 进出口类型:1进口;2出口 */
@ApiModelProperty(name = "进出口类型:1进口;2出口",notes = "")
private Integer inOutType ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId ;
/** 方向路段长度 */
@ApiModelProperty(name = "方向路段长度",notes = "")
private Double length ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
...@@ -4,7 +4,7 @@ import cn.hutool.http.HttpUtil; ...@@ -4,7 +4,7 @@ import cn.hutool.http.HttpUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import net.wanji.web.common.enums.CrossPhasePlanTurnTypeEnum; import net.wanji.web.common.enums.CrossPhasePlanTurnTypeEnum;
import net.wanji.web.common.enums.SpecialServiceCrossDirEnum; import net.wanji.web.common.enums.CrossDirEnum;
import net.wanji.web.common.enums.SpecialServiceCrossTurnEnum; import net.wanji.web.common.enums.SpecialServiceCrossTurnEnum;
import net.wanji.web.common.exception.CrossRelationException; import net.wanji.web.common.exception.CrossRelationException;
import net.wanji.web.common.util.CrossUtil; import net.wanji.web.common.util.CrossUtil;
...@@ -157,7 +157,7 @@ public class SpecialServiceServiceImpl implements SpecialServiceService { ...@@ -157,7 +157,7 @@ public class SpecialServiceServiceImpl implements SpecialServiceService {
crossListOutVO.setName(crossInfo.getName()); crossListOutVO.setName(crossInfo.getName());
// 获取控制方向 // 获取控制方向
Integer dirCode = specialServiceCrossPO.getDir(); Integer dirCode = specialServiceCrossPO.getDir();
String dir = SpecialServiceCrossDirEnum.getMsgByCode(dirCode); String dir = CrossDirEnum.getMsgByCode(dirCode);
String turnCode = specialServiceCrossPO.getTurn(); String turnCode = specialServiceCrossPO.getTurn();
if (turnCode != null) { if (turnCode != null) {
String turn = SpecialServiceCrossTurnEnum.getMsgByCode(turnCode); String turn = SpecialServiceCrossTurnEnum.getMsgByCode(turnCode);
...@@ -186,7 +186,7 @@ public class SpecialServiceServiceImpl implements SpecialServiceService { ...@@ -186,7 +186,7 @@ public class SpecialServiceServiceImpl implements SpecialServiceService {
// 获取方向(东西南北...) // 获取方向(东西南北...)
int length = dirInAndOut.length(); int length = dirInAndOut.length();
String dirStr = dirInAndOut.substring(0, length - 2); String dirStr = dirInAndOut.substring(0, length - 2);
Integer dir = SpecialServiceCrossDirEnum.getCodeByMsg(dirStr); Integer dir = CrossDirEnum.getCodeByMsg(dirStr);
specialServiceCrossMapper.updatDir(specialServiceId, crossId, dir); specialServiceCrossMapper.updatDir(specialServiceId, crossId, dir);
// 更新当前路口转向 // 更新当前路口转向
Integer sort = updateCrossInVO.getSort(); Integer sort = updateCrossInVO.getSort();
...@@ -325,7 +325,7 @@ public class SpecialServiceServiceImpl implements SpecialServiceService { ...@@ -325,7 +325,7 @@ public class SpecialServiceServiceImpl implements SpecialServiceService {
// 从 13FNK0C6790_1_2_1 中获取 “北进口” // 从 13FNK0C6790_1_2_1 中获取 “北进口”
int length = crossInId.length(); int length = crossInId.length();
String dir = crossInId.substring(length - 5, length - 4); String dir = crossInId.substring(length - 5, length - 4);
String dirStr = SpecialServiceCrossDirEnum.getMsgByCode(Integer.parseInt(dir)); String dirStr = CrossDirEnum.getMsgByCode(Integer.parseInt(dir));
String s = dirStr + "进口"; String s = dirStr + "进口";
return s; return s;
} }
......
package net.wanji.web.service.scheme;
import net.wanji.web.vo.scheme.CrossDirsVO;
/**
* @author Kent HAN
* @date 2022/12/20 10:26
*/
public interface CrossConfigService {
CrossDirsVO listCrossDirs(String crossId);
}
package net.wanji.web.service.scheme.impl;
import net.wanji.web.common.enums.CrossDirEnum;
import net.wanji.web.common.enums.CrossInOutEnum;
import net.wanji.web.mapper.scheme.CrossDirInfoMapper;
import net.wanji.web.po.scheme.CrossDirInfoPO;
import net.wanji.web.service.scheme.CrossConfigService;
import net.wanji.web.vo.scheme.CrossDirsVO;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/12/20 10:27
*/
@Service
public class CrossConfigServiceImpl implements CrossConfigService {
private final CrossDirInfoMapper crossDirInfoMapper;
public CrossConfigServiceImpl(CrossDirInfoMapper crossDirInfoMapper) {
this.crossDirInfoMapper = crossDirInfoMapper;
}
@Override
public CrossDirsVO listCrossDirs(String crossId) {
List<CrossDirInfoPO> crossDirInfoPOList = crossDirInfoMapper.listByCrossID(crossId);
CrossDirsVO crossDirsVO = new CrossDirsVO();
crossDirsVO.setCrossId(crossId);
ArrayList<String> dirs = new ArrayList<>();
for (CrossDirInfoPO crossDirInfoPO : crossDirInfoPOList) {
Integer inOutTypeCode = crossDirInfoPO.getInOutType();
if (inOutTypeCode == 1) { // 只取进口
Integer dirTypeCode = crossDirInfoPO.getDirType();
String dirType = CrossDirEnum.getMsgByCode(dirTypeCode);
String inOutType = CrossInOutEnum.getMsgByCode(inOutTypeCode);
String dir = dirType + inOutType;
dirs.add(dir);
}
}
crossDirsVO.setCrossDirs(dirs);
return crossDirsVO;
}
}
...@@ -4,8 +4,6 @@ import io.swagger.annotations.ApiModel; ...@@ -4,8 +4,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
/** /**
......
package net.wanji.web.vo.scheme;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/12/20 10:21
*/
@Data
public class CrossDirsVO {
@ApiModelProperty(value = "路口ID", required = true)
private String crossId;
@ApiModelProperty(value = "路口方向列表", required = true)
private List<String> crossDirs;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.scheme.CrossDirInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.scheme.CrossDirInfoPO" id="BaseResultMap">
<result property="id" column="id"/>
<result property="dirType" column="dir_type"/>
<result property="inOutType" column="in_out_type"/>
<result property="crossId" column="cross_id"/>
<result property="length" column="length"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
</resultMap>
<select id="listByCrossID" resultMap="BaseResultMap">
select
id,dir_type,in_out_type,cross_id,length,gmt_create,gmt_modified
from t_base_cross_dir_info
where cross_id = #{crossId}
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment