Commit 9ed13c40 authored by hanbing's avatar hanbing

根据数据库设计统一实体类字段名,包括厂商代码、厂商名称、厂商简称

parent 33f871d4
......@@ -14,6 +14,6 @@ public class BaseCrossInfo {
@ApiModelProperty(value = "信号机ID")
private String code;
@ApiModelProperty(value = "厂商缩写")
private String manufacturerAbbr;
@ApiModelProperty(value = "厂商代码")
private String manufacturerCode;
}
......@@ -21,9 +21,9 @@ public class HttpRequest {
}
public HttpRequest(String manufacturerAbbr, String apiCode) {
public HttpRequest(String manufacturerCode, String apiCode) {
// 获取请求地址
ManufacturerApiInfoPO manufacturerApiInfoPO = Constants.getManufacturerUrlMap(manufacturerAbbr +
ManufacturerApiInfoPO manufacturerApiInfoPO = Constants.getManufacturerUrlMap(manufacturerCode +
Constants.SEPARATOR_UNDER_LINE + apiCode);
if (manufacturerApiInfoPO == null) {
throw new NoSuchApiException("没有此接口信息,请在t_manufacturer_api_info表中添加");
......
......@@ -19,9 +19,9 @@ public class OutVO<T> {
private String systemAbbr;
/**
* 厂商缩写
* 厂商代码
*/
private String manufacturerAbbr;
private String manufacturerCode;
/**
* 更新时间
......
......@@ -9,8 +9,8 @@ public class BasicEnum {
public enum ManufacturerEnum {
HK(1, "海康", "HK");
private Integer code;
private String name;
private String abbr;
private Integer id;
private String nick;
private String code;
}
}
......@@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import static net.wanji.utc.common.ResultEnum.BODY_NOT_MATCH;
......@@ -55,7 +54,7 @@ public class ControlCommandController {
return Result.success();
}
Integer manufacturerId = check(signalId);
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getId())) {
return hkControlCommandService.allRedControl(signalId, null, null, command);
} else {
// todo else
......@@ -86,10 +85,10 @@ public class ControlCommandController {
//开启适配服务
for (TimePlanVO timePlanVo : timePlans) {
timePlanVo.setCode(crossInfoPo.getCode());
timePlanVo.setManufacturerAbbr(crossInfoPo.getManufacturerId() + "");
timePlanVo.setManufacturerCode(crossInfoPo.getManufacturerId() + "");
}
Integer manufacturerId = crossInfoPo.getManufacturerId();
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getId())) {
return hkControlCommandService.phaseTimingSend(timePlans);
} else {
// todo else
......@@ -116,9 +115,9 @@ public class ControlCommandController {
throw new ControlException(BODY_NOT_MATCH.getResultCode(), "参数错误,信号机ID不正确。");
}
planSendVO.setCode(crossInfoPo.getCode());
planSendVO.setManufacturerAbbr(crossInfoPo.getManufacturerId() + "");
planSendVO.setManufacturerCode(crossInfoPo.getManufacturerId() + "");
Integer manufacturerId = crossInfoPo.getManufacturerId();
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getId())) {
return hkControlCommandService.planSend(planSendVO);
} else {
......@@ -145,7 +144,7 @@ public class ControlCommandController {
return Result.success();
}
Integer manufacturerId = check(signalId);
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getId())) {
return hkControlCommandService.allRedControl(signalId, null, null, command);
} else {
// todo else
......@@ -167,7 +166,7 @@ public class ControlCommandController {
return Result.success();
}
Integer manufacturerId = check(signalId);
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getId())) {
return hkControlCommandService.yellowLightControl(signalId, null, null, command);
} else {
// todo else
......@@ -189,7 +188,7 @@ public class ControlCommandController {
return Result.success();
}
Integer manufacturerId = check(signalId);
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getId())) {
return hkControlCommandService.closeLightControl(signalId, null, null, command);
} else {
// todo else
......@@ -214,7 +213,7 @@ public class ControlCommandController {
return Result.success();
}
Integer manufacturerId = check(signalId);
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getId())) {
return hkControlCommandService.stepControl(signalId, null, null, command, stepNum);
} else {
// todo else
......@@ -235,7 +234,7 @@ public class ControlCommandController {
return Result.success();
}
Integer manufacturerId = check(signalId);
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getId())) {
return hkControlCommandService.scheduleSend(signalId, null, null, null);
} else {
// todo else
......@@ -257,7 +256,7 @@ public class ControlCommandController {
}
try {
Integer manufacturerId = check(signalId);
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
if (manufacturerId.equals(BasicEnum.ManufacturerEnum.HK.getId())) {
return hkControlCommandService.lockControl(signalId, phaseLock);
} else {
// todo else
......
package net.wanji.utc.controller;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.utc.entity.JsonViewObject;
import net.wanji.utc.po.CrossInfoPO;
import net.wanji.utc.po.ManufacturerApiInfoPO;
import net.wanji.utc.service.systemadmin.CrossInfoService;
import net.wanji.utc.service.systemadmin.ManufacturerApiInfoService;
import net.wanji.utc.vo.systemadmin.CrossInfoListInVO;
import net.wanji.utc.vo.systemadmin.DeleteListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoListInVO;
import org.springframework.beans.factory.annotation.Autowired;
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/11/24 8:32
*/
@Api(value = "系统管理-信号机管理", description = "系统管理-信号机管理")
@RequestMapping("/crossInfo")
@RestController
public class CrossInfoController {
@Autowired
CrossInfoService crossInfoService;
@ApiOperation(value = "信号机列表", notes = "信号机列表", response = CrossInfoPO.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/list",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossInfoPO.class),
})
public JsonViewObject list(@RequestBody CrossInfoListInVO crossInfoListInVO) {
PageInfo<CrossInfoPO> crossInfoPOPageInfo = crossInfoService.list(crossInfoListInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(crossInfoPOPageInfo);
}
// @ApiOperation(value = "接口添加或修改", notes = "接口添加或修改", consumes = MediaType.APPLICATION_JSON)
// @PostMapping(value = "/insertOrUpdate", consumes = MediaType.APPLICATION_JSON)
// public JsonViewObject insertOrUpdate(@RequestBody ManufacturerApiInfoInsertOrUpdateInVO inVO) {
// manufacturerApiInfoService.insertOrUpdate(inVO);
// JsonViewObject jsonViewObject = JsonViewObject.newInstance();
//
// return jsonViewObject.success();
// }
//
// @ApiOperation(value = "接口删除", notes = "接口删除", consumes = MediaType.APPLICATION_JSON)
// @PostMapping(value = "/delete", consumes = MediaType.APPLICATION_JSON)
// public JsonViewObject delete(@RequestBody DeleteListInVO inVO) {
// manufacturerApiInfoService.delete(inVO);
// JsonViewObject jsonViewObject = JsonViewObject.newInstance();
//
// return jsonViewObject.success();
// }
}
......@@ -33,8 +33,8 @@ public class StaticInfoController {
@ApiOperation(value = "信号路口基础信息", notes = "信号路口基础信息")
public ResponseEntity crossInfo(HttpServletRequest request, @RequestBody CrossInfoInVO crossInfoInVO) {
OutVO<BaseCrossInfo> outVO = new OutVO<>();
String manufacturerAbbr = crossInfoInVO.getManufacturerAbbr();
outVO.setManufacturerAbbr(manufacturerAbbr);
String manufacturerCode = crossInfoInVO.getManufacturerCode();
outVO.setManufacturerCode(manufacturerCode);
outVO.setUpdatetime(new Date());
outVO.setSystemAbbr(Constants.SYSTEM_ABBR);
......
......@@ -23,4 +23,7 @@ public interface CrossInfoMapper {
List<CrossInfoPO> selectByManufacturerId(@Param("manufacturerId") Integer manufacturerId);
List<CrossInfoPO> selectAll();
List<CrossInfoPO> selectByOptionals(@Param("crossName") String crossName,
@Param("manufacturerId") Integer manufacturerId);
}
......@@ -17,7 +17,7 @@ public interface ManufacturerInfoMapper {
List<ManufacturerInfoPO> selectAll();
List<ManufacturerInfoPO> selectByOptionalName(@Param("name") String name);
List<ManufacturerInfoPO> selectByOptionalPartialName(@Param("name") String name);
void insertOne(ManufacturerInfoPO manufacturerInfoPO);
......@@ -25,5 +25,5 @@ public interface ManufacturerInfoMapper {
void deleteBatch(@Param("ids") List<Integer> ids);
Integer selectIdByName(@Param("manufacturerName") String manufacturerName);
Integer selectIdByNick(@Param("manufacturerNick") String manufacturerNick);
}
......@@ -11,39 +11,39 @@ import java.util.Date;
*/
@Data
public class CrossInfoPO {
@ApiModelProperty(name = "路口ID",notes = "")
@ApiModelProperty(value = "路口ID",notes = "")
private String id ;
/** 路口名称 */
@ApiModelProperty(name = "路口名称",notes = "")
@ApiModelProperty(value = "路口名称",notes = "")
private String name ;
/** 信号机编号 */
@ApiModelProperty(name = "信号机编号",notes = "")
@ApiModelProperty(value = "信号机编号",notes = "")
private String code ;
/** 厂商ID */
@ApiModelProperty(name = "厂商ID",notes = "")
@ApiModelProperty(value = "厂商ID",notes = "")
private Integer manufacturerId ;
/** 信号机IP */
@ApiModelProperty(name = "信号机IP",notes = "")
@ApiModelProperty(value = "信号机IP",notes = "")
private String ip ;
/** 信号机端口 */
@ApiModelProperty(name = "信号机端口",notes = "")
@ApiModelProperty(value = "信号机端口",notes = "")
private Integer port ;
/** 经纬度 */
@ApiModelProperty(name = "经纬度",notes = "")
@ApiModelProperty(value = "经纬度",notes = "")
private String location ;
/** 版本号 */
@ApiModelProperty(name = "版本号",notes = "")
@ApiModelProperty(value = "版本号",notes = "")
private String version ;
/** 型号 */
@ApiModelProperty(name = "型号",notes = "")
@ApiModelProperty(value = "型号",notes = "")
private String model ;
/** 安装时间 */
@ApiModelProperty(name = "安装时间",notes = "")
@ApiModelProperty(value = "安装时间",notes = "")
private Date installTime ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
@ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
@ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ;
}
......@@ -242,7 +242,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode);
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl());
return res;
}
......@@ -330,7 +330,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
List<BaseCrossInfo> baseSignals = new ArrayList<>();
BaseCrossInfo baseSignal = new BaseCrossInfo();
baseSignal.setCode(signalId);
baseSignal.setManufacturerAbbr(BasicEnum.ManufacturerEnum.HK.getAbbr());
baseSignal.setManufacturerCode(BasicEnum.ManufacturerEnum.HK.getCode());
baseSignals.add(baseSignal);
return hkGetSignalMethodService.queryHkSignalInfo(baseSignals);
}
......
......@@ -79,7 +79,7 @@ public class HkGetSignalMethodServiceImpl implements HkGetSignalMethodService {
int curRunTime = jsonObject.getIntValue("curRunTime"); // 当前运行时长
int cycleCountDown = cycleLen - curRunTime; // 周期剩余时长
infoVo.setCode(entity.getCode());
infoVo.setManufacturerAbbr(entity.getManufacturerAbbr());
infoVo.setManufacturerCode(entity.getManufacturerCode());
infoVo.setCycleCountDown(cycleCountDown);
infoVo.setCycleLen(cycleLen);
......@@ -140,7 +140,7 @@ public class HkGetSignalMethodServiceImpl implements HkGetSignalMethodService {
private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode);
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl());
return res;
}
......
......@@ -77,7 +77,7 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
int curRunTime = jsonObject.getIntValue("curRunTime"); // 当前运行时长
int cycleCountDown = cycleLen - curRunTime; // 周期剩余时长
infoVo.setCode(entity.getCode());
infoVo.setManufacturerAbbr(entity.getManufacturerAbbr());
infoVo.setManufacturerCode(entity.getManufacturerCode());
infoVo.setCycleCountDown(cycleCountDown);
infoVo.setCycleLen(cycleLen);
// 循环相位列表
......@@ -159,7 +159,7 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode);
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl());
return res;
}
......
......@@ -65,7 +65,7 @@ public class HkRunningStatusServiceImpl implements HkRunningStatusService {
}
// 从Redis中查询控制类型
String lightsStatusVOStr = redisUtil.getHash(RedisKeyConst.KEY_PREFIX + RedisKeyConst.LIGHTS_STATUS,
baseCrossInfo.getManufacturerAbbr() + Constants.SEPARATOR_UNDER_LINE + po.getSignalId());
baseCrossInfo.getManufacturerCode() + Constants.SEPARATOR_UNDER_LINE + po.getSignalId());
LightsStatusVO lightsStatusVO = JSON.parseObject(lightsStatusVOStr, LightsStatusVO.class);
String runMode = lightsStatusVO.getRunMode();
int runModeInt = Integer.parseInt(runMode);
......@@ -83,7 +83,7 @@ public class HkRunningStatusServiceImpl implements HkRunningStatusService {
private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode);
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl());
return res;
}
......
......@@ -47,7 +47,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
List<BaseCrossInfo> baseCrossInfoList = getBaseCrossInfoList(manufacturerEnum);
if (baseCrossInfoList == null) continue;
List<SignalStatusLogPO> signalStatusLogPOList = null;
if(manufacturerEnum.getAbbr().equals(BasicEnum.ManufacturerEnum.HK.getAbbr())) {
if(manufacturerEnum.getCode().equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
// 海康
// 3.2.5信号机运行状态和告警信息
signalStatusLogPOList = hkRunningStatusService.getHkRunningStatus(baseCrossInfoList);
......@@ -63,7 +63,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
// 更新Redis
if (null != signalStatusLogPOList) {
for (SignalStatusLogPO signalStatusLogPO : signalStatusLogPOList) {
String field = manufacturerEnum.getAbbr() + Constants.SEPARATOR_UNDER_LINE +
String field = manufacturerEnum.getCode() + Constants.SEPARATOR_UNDER_LINE +
signalStatusLogPO.getSignalId();
redisUtil.setHash(RedisKeyConst.KEY_PREFIX + RedisKeyConst.TELESEME_STATUS, field,
signalStatusLogPO.getStatus()+"");
......@@ -83,7 +83,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
List<BaseCrossInfo> baseCrossInfoList = getBaseCrossInfoList(manufacturerEnum);
if (baseCrossInfoList == null) continue;
List<LightsStatusVO> lightsStatusVOList = null;
if(manufacturerEnum.getAbbr().equals(BasicEnum.ManufacturerEnum.HK.getAbbr())) {
if(manufacturerEnum.getCode().equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
// 海康
// 3.2.4灯态
lightsStatusVOList = hkLightsStatusService.getHkLightsStatus(baseCrossInfoList);
......@@ -93,7 +93,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
// 更新Redis
if (lightsStatusVOList != null) {
for (LightsStatusVO lightsStatusVO : lightsStatusVOList) {
String field = manufacturerEnum.getAbbr() + Constants.SEPARATOR_UNDER_LINE +
String field = manufacturerEnum.getCode() + Constants.SEPARATOR_UNDER_LINE +
lightsStatusVO.getCode();
redisUtil.setHash(RedisKeyConst.KEY_PREFIX + RedisKeyConst.LIGHTS_STATUS, field,
JSON.toJSONString(lightsStatusVO));
......@@ -104,7 +104,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
private List<BaseCrossInfo> getBaseCrossInfoList(BasicEnum.ManufacturerEnum manufacturerEnum) {
// 查询路口信息
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr(manufacturerEnum.getAbbr());
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr(manufacturerEnum.getCode());
Integer manufacturerId = manufacturerInfoPO.getId();
List<CrossInfoPO> crossInfoPOList = crossInfoMapper.selectByManufacturerId(manufacturerId);
if (ListUtil.isEmpty(crossInfoPOList)) {
......@@ -115,7 +115,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
for (CrossInfoPO infoPO : crossInfoPOList) {
BaseCrossInfo baseCrossInfo = new BaseCrossInfo();
baseCrossInfo.setCode(infoPO.getCode());
baseCrossInfo.setManufacturerAbbr(manufacturerEnum.getAbbr());
baseCrossInfo.setManufacturerCode(manufacturerEnum.getCode());
baseCrossInfoList.add(baseCrossInfo);
}
return baseCrossInfoList;
......
......@@ -8,5 +8,5 @@ import net.wanji.utc.vo.DetailCrossInfoVO;
* @date 2022/11/16 11:03
*/
public interface OthersStaticInfoService {
ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(String manufacturerAbbr);
ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(String manufacturerCode);
}
......@@ -110,7 +110,7 @@ public class HkCrossSchedulesServiceImpl implements HkCrossSchedulesService {
private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode);
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl());
return res;
}
......
......@@ -111,7 +111,7 @@ public class HkPlanSectionServiceImpl implements HkPlanSectionService {
private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode);
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl());
return res;
}
......
......@@ -253,7 +253,7 @@ public class HkSchemePhaseLightsServiceImpl implements HkSchemePhaseLightsServic
private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode);
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl());
return res;
}
......
......@@ -75,7 +75,7 @@ public class HkStaticInfoServiceImpl implements HkStaticInfoService {
crossInfoPO.setName(crossName);
crossInfoPO.setCode(crossCode);
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr(
BasicEnum.ManufacturerEnum.HK.getAbbr());
BasicEnum.ManufacturerEnum.HK.getCode());
if (manufacturerInfoPO != null) {
crossInfoPO.setManufacturerId(manufacturerInfoPO.getId());
}
......@@ -99,7 +99,7 @@ public class HkStaticInfoServiceImpl implements HkStaticInfoService {
private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode);
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl());
return res;
}
......
......@@ -22,8 +22,8 @@ public class OthersStaticInfoServiceImpl implements OthersStaticInfoService {
private HttpRestUtil httpRestUtil;
@Override
public ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(String manufacturerAbbr) {
HttpRequest httpRequest = new HttpRequest(manufacturerAbbr, "queryCrossing");
public ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(String manufacturerCode) {
HttpRequest httpRequest = new HttpRequest(manufacturerCode, "queryCrossing");
String result = httpRestUtil.doExecute(httpRequest.getUrl(), httpRequest.getHeaders(), HttpMethod.POST, null);
if (StringUtils.isEmpty(result)) {
return null;
......
......@@ -46,11 +46,11 @@ public class StaticInfoServiceImpl implements StaticInfoService {
public ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(OutVO<BaseCrossInfo> outVO) {
List<CrossInfoPO> crossInfoPOList = new ArrayList<>();
ManufacturerRes<DetailCrossInfoVO> res = new ManufacturerRes<>();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getAbbr(), outVO.getManufacturerAbbr())) {
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), outVO.getManufacturerCode())) {
crossInfoPOList = hkStaticInfoService.hkCrossBasicInfo();
} else {
// todo 其他厂商
res = othersStaticInfoService.crossBasicInfo(outVO.getManufacturerAbbr());
res = othersStaticInfoService.crossBasicInfo(outVO.getManufacturerCode());
if (null == res) {
return null;
}
......@@ -69,7 +69,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
crossInfoPO.setId(id);
crossInfoPO.setName(vo.getCrossName());
crossInfoPO.setCode(id);
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr(vo.getManufacturerAbbr());
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr(vo.getManufacturerCode());
if (manufacturerInfoPO != null) {
crossInfoPO.setManufacturerId(manufacturerInfoPO.getId());
}
......@@ -103,8 +103,8 @@ public class StaticInfoServiceImpl implements StaticInfoService {
Integer manufacturerId = crossInfoPO.getManufacturerId();
// 获取厂商缩写
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId);
String manufacturerAbbr = manufacturerInfoPO.getCode();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getAbbr(), manufacturerAbbr)) {
String manufacturerCode = manufacturerInfoPO.getCode();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
// 海康
hkSchemePhaseLightsService.hkSchemePhaseLights(crossId, crossCode);
} else {
......@@ -121,9 +121,9 @@ public class StaticInfoServiceImpl implements StaticInfoService {
Integer manufacturerId = crossInfoPO.getManufacturerId();
// 获取厂商缩写
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId);
String manufacturerAbbr = manufacturerInfoPO.getCode();
String manufacturerCode = manufacturerInfoPO.getCode();
Integer planNo = planSectionInVO.getPlanNo();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getAbbr(), manufacturerAbbr)) {
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
// 海康
hkPlanSectionService.planSection(crossCode, planNo, crossId);
} else {
......@@ -133,9 +133,9 @@ public class StaticInfoServiceImpl implements StaticInfoService {
@Override
public void crossSchedules(CrossSchedulesInVO crossSchedulesInVO) throws Exception {
String manufacturerAbbr = crossSchedulesInVO.getManufacturerAbbr();
String manufacturerCode = crossSchedulesInVO.getManufacturerCode();
List<String> crossIdList = crossSchedulesInVO.getCrossIdList();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getAbbr(), manufacturerAbbr)) {
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
// 海康
hkCrossSchedulesService.crossSchedules(crossIdList);
} else {
......
package net.wanji.utc.service.systemadmin;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.po.CrossInfoPO;
import net.wanji.utc.vo.systemadmin.CrossInfoListInVO;
/**
* @author Kent HAN
* @date 2022/11/25 8:54
*/
public interface CrossInfoService {
PageInfo<CrossInfoPO> list(CrossInfoListInVO crossInfoListInVO);
}
package net.wanji.utc.service.systemadmin.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.mapper.CrossInfoMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.CrossInfoPO;
import net.wanji.utc.po.ManufacturerApiInfoPO;
import net.wanji.utc.service.systemadmin.CrossInfoService;
import net.wanji.utc.vo.systemadmin.CrossInfoListInVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/25 8:54
*/
@Service
public class CrossInfoServiceImpl implements CrossInfoService {
@Autowired
ManufacturerInfoMapper manufacturerInfoMapper;
@Autowired
CrossInfoMapper crossInfoMapper;
@Override
public PageInfo<CrossInfoPO> list(CrossInfoListInVO crossInfoListInVO) {
Integer pageNum = crossInfoListInVO.getPageNum();
Integer pageSize = crossInfoListInVO.getPageSize();
String crossName = crossInfoListInVO.getCrossName();
String manufacturerNick = crossInfoListInVO.getManufacturerName();
Integer manufacturerId = null;
if (manufacturerNick != null) {
manufacturerId = manufacturerInfoMapper.selectIdByNick(manufacturerNick);
}
PageHelper.startPage(pageNum, pageSize);
List<CrossInfoPO> crossInfoPOList = crossInfoMapper.selectByOptionals(crossName, manufacturerId);
PageInfo<CrossInfoPO> crossInfoPOPageInfo = new PageInfo<>(crossInfoPOList);
return crossInfoPOPageInfo;
}
}
......@@ -6,7 +6,6 @@ import net.wanji.utc.common.typeenum.ManufacturerApiInfoTypeEnum;
import net.wanji.utc.mapper.ManufacturerApiInfoMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.ManufacturerApiInfoPO;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.systemadmin.ManufacturerApiInfoService;
import net.wanji.utc.vo.systemadmin.DeleteListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO;
......@@ -41,10 +40,10 @@ public class ManufacturerApiInfoServiceImpl implements ManufacturerApiInfoServic
typeCode = ManufacturerApiInfoTypeEnum.getCodeByMsg(typeStr);
}
String manufacturerName = manufacturerApiInfoListInVO.getManufacturerName();
String manufacturerNick = manufacturerApiInfoListInVO.getManufacturerNick();
Integer manufacturerId = null;
if (manufacturerName != null) {
manufacturerId = manufacturerInfoMapper.selectIdByName(manufacturerName);
if (manufacturerNick != null) {
manufacturerId = manufacturerInfoMapper.selectIdByNick(manufacturerNick);
}
PageHelper.startPage(pageNum, pageSize);
......@@ -63,7 +62,7 @@ public class ManufacturerApiInfoServiceImpl implements ManufacturerApiInfoServic
String typeStr = inVO.getApiType();
Integer typeCode = ManufacturerApiInfoTypeEnum.getCodeByMsg(typeStr);
String manufacturerName = inVO.getManufacturerName();
Integer manufacturerId = manufacturerInfoMapper.selectIdByName(manufacturerName);
Integer manufacturerId = manufacturerInfoMapper.selectIdByNick(manufacturerName);
manufacturerApiInfoPO.setType(typeCode);
manufacturerApiInfoPO.setManufacturerId(manufacturerId);
if (id == null || id == 0) {
......
......@@ -30,7 +30,7 @@ public class ManufacturerServiceImpl implements ManufacturerService {
String name = manufacturerListInVO.getName();
PageHelper.startPage(pageNum, pageSize);
List<ManufacturerInfoPO> manufacturerInfoPOList = manufacturerInfoMapper.selectByOptionalName(name);
List<ManufacturerInfoPO> manufacturerInfoPOList = manufacturerInfoMapper.selectByOptionalPartialName(name);
PageInfo<ManufacturerInfoPO> borrowPOPageInfo = new PageInfo<>(manufacturerInfoPOList);
return borrowPOPageInfo;
......
......@@ -11,6 +11,6 @@ import lombok.Data;
@Data
@ApiModel(value = "CrossInfoInVO", description = "查询信号路口基础信息输入参数")
public class CrossInfoInVO {
@ApiModelProperty(value = "厂商缩写 HK-海康")
String manufacturerAbbr;
@ApiModelProperty(value = "厂商代码 HK")
String manufacturerCode;
}
......@@ -13,8 +13,8 @@ import java.util.List;
@Data
@ApiModel(value = "CrossSchedulesInVO", description = "查询时间表数据输入参数")
public class CrossSchedulesInVO {
@ApiModelProperty(value = "厂商缩写 HK-海康")
String manufacturerAbbr;
@ApiModelProperty(value = "厂商缩写 HK")
String manufacturerCode;
@ApiModelProperty(value = "路口列表")
List<String> crossIdList;
......
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/25 8:55
*/
@Data
public class CrossInfoListInVO {
@ApiModelProperty(required = true, value = "页号")
Integer pageNum;
@ApiModelProperty(required = true, value = "每页记录数")
Integer pageSize;
@ApiModelProperty( value = "路口名称")
String crossName;
@ApiModelProperty( value = "信号机厂商")
String manufacturerName;
}
......@@ -20,5 +20,5 @@ public class ManufacturerApiInfoListInVO {
@ApiModelProperty( value = "接口类型")
String typeStr;
@ApiModelProperty( value = "接口厂商")
String manufacturerName;
String manufacturerNick;
}
......@@ -64,4 +64,17 @@
select id,name,code,manufacturer_id,ip,port,location,version,model,install_time,gmt_create,gmt_modified
from t_cross_info
</select>
<select id="selectByOptionals" resultMap="BaseResultMap">
select id,name,code,manufacturer_id,ip,port,location,version,model,install_time,gmt_create,gmt_modified
from t_cross_info
<where>
<if test="crossName != null and name != ''">
AND name LIKE CONCAT('%',#{crossName},'%')
</if>
<if test="manufacturerId != null and manufacturerId != 0">
AND manufacturer_id = #{manufacturerId}
</if>
</where>
</select>
</mapper>
......@@ -66,7 +66,7 @@
from t_manufacturer_info
</select>
<select id="selectByOptionalName" resultMap="BaseResultMap">
<select id="selectByOptionalPartialName" resultMap="BaseResultMap">
select id,code,name,nick_name,address,maintenance_unit,gmt_create,gmt_modified
from t_manufacturer_info
<where>
......@@ -77,8 +77,8 @@
order by id
</select>
<select id="selectIdByName" resultType="java.lang.Integer">
<select id="selectIdByNick" resultType="java.lang.Integer">
select id from t_manufacturer_info
where name = #{manufacturerName}
where nick_name = #{manufacturerNick}
</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