Commit fdb24121 authored by hanbing's avatar hanbing

静态信息接口添加返回值

parent 41b3fa91
......@@ -5,6 +5,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.utc.dto.systemadmin.CrossInfoInsertOrUpdateDTO;
import net.wanji.utc.dto.systemadmin.CrossInfoListDTO;
import net.wanji.utc.dto.systemadmin.DeleteByStringIdListDTO;
import net.wanji.utc.entity.JsonViewObject;
import net.wanji.utc.service.systemadmin.CrossInfoService;
import net.wanji.utc.vo.systemadmin.*;
......@@ -30,15 +33,15 @@ public class CrossInfoController {
@Autowired
CrossInfoService crossInfoService;
@ApiOperation(value = "信号机列表", notes = "信号机列表", response = CrossInfoListOutVO.class,
@ApiOperation(value = "信号机列表", notes = "信号机列表", response = CrossInfoListVO.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 = CrossInfoListOutVO.class),
@ApiResponse(code = 200, message = "OK", response = CrossInfoListVO.class),
})
public JsonViewObject list(@RequestBody CrossInfoListInVO crossInfoListInVO) {
PageInfo<CrossInfoListOutVO> crossInfoListOutVOPageInfo = crossInfoService.list(crossInfoListInVO);
public JsonViewObject list(@RequestBody CrossInfoListDTO crossInfoListDTO) {
PageInfo<CrossInfoListVO> crossInfoListOutVOPageInfo = crossInfoService.list(crossInfoListDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(crossInfoListOutVOPageInfo);
......@@ -46,7 +49,7 @@ public class CrossInfoController {
@ApiOperation(value = "信号机添加或修改", notes = "信号机添加或修改", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/insertOrUpdate", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject insertOrUpdate(@RequestBody CrossInfoInsertOrUpdateInVO inVO) {
public JsonViewObject insertOrUpdate(@RequestBody CrossInfoInsertOrUpdateDTO inVO) {
crossInfoService.insertOrUpdate(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
......@@ -55,7 +58,7 @@ public class CrossInfoController {
@ApiOperation(value = "信号机删除", notes = "信号机删除", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/delete", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject delete(@RequestBody DeleteByStringIdListInVO inVO) {
public JsonViewObject delete(@RequestBody DeleteByStringIdListDTO inVO) {
crossInfoService.delete(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
......
......@@ -5,13 +5,13 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.utc.dto.systemadmin.DeleteByIntegerIdListDTO;
import net.wanji.utc.dto.systemadmin.ManufacturerApiInfoInsertOrUpdateDTO;
import net.wanji.utc.dto.systemadmin.ManufacturerApiInfoListDTO;
import net.wanji.utc.entity.JsonViewObject;
import net.wanji.utc.po.ManufacturerApiInfoPO;
import net.wanji.utc.service.systemadmin.ManufacturerApiInfoService;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoOutVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -41,9 +41,9 @@ public class ManufacturerApiController {
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = ManufacturerApiInfoPO.class),
})
public JsonViewObject list(@RequestBody ManufacturerApiInfoListInVO manufacturerApiInfoListInVO) {
PageInfo<ManufacturerApiInfoOutVO> manufacturerApiInfoOutVOPageInfo =
manufacturerApiInfoService.list(manufacturerApiInfoListInVO);
public JsonViewObject list(@RequestBody ManufacturerApiInfoListDTO manufacturerApiInfoListDTO) {
PageInfo<ManufacturerApiInfoVO> manufacturerApiInfoOutVOPageInfo =
manufacturerApiInfoService.list(manufacturerApiInfoListDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(manufacturerApiInfoOutVOPageInfo);
......@@ -51,7 +51,7 @@ public class ManufacturerApiController {
@ApiOperation(value = "接口添加或修改", notes = "接口添加或修改", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/insertOrUpdate", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject insertOrUpdate(@RequestBody ManufacturerApiInfoInsertOrUpdateInVO inVO) {
public JsonViewObject insertOrUpdate(@RequestBody ManufacturerApiInfoInsertOrUpdateDTO inVO) {
manufacturerApiInfoService.insertOrUpdate(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
......@@ -60,7 +60,7 @@ public class ManufacturerApiController {
@ApiOperation(value = "接口删除", notes = "接口删除", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/delete", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject delete(@RequestBody DeleteByIntegerIdListInVO inVO) {
public JsonViewObject delete(@RequestBody DeleteByIntegerIdListDTO inVO) {
manufacturerApiInfoService.delete(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
......
......@@ -5,12 +5,12 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.utc.dto.systemadmin.ManufacturerInsertOrUpdateDTO;
import net.wanji.utc.entity.JsonViewObject;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.systemadmin.ManufacturerService;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerListInVO;
import net.wanji.utc.dto.systemadmin.DeleteByIntegerIdListDTO;
import net.wanji.utc.dto.systemadmin.ManufacturerListDTO;
import org.springframework.beans.factory.annotation.Autowired;
import javax.ws.rs.core.MediaType;
......@@ -40,8 +40,8 @@ public class ManufacturerController {
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = ManufacturerInfoPO.class),
})
public JsonViewObject list(@RequestBody ManufacturerListInVO manufacturerListInVO) {
PageInfo<ManufacturerInfoPO> manufacturerInfoPOPageInfo = manufacturerService.list(manufacturerListInVO);
public JsonViewObject list(@RequestBody ManufacturerListDTO manufacturerListDTO) {
PageInfo<ManufacturerInfoPO> manufacturerInfoPOPageInfo = manufacturerService.list(manufacturerListDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(manufacturerInfoPOPageInfo);
......@@ -49,7 +49,7 @@ public class ManufacturerController {
@ApiOperation(value = "厂商添加或修改", notes = "厂商添加或修改", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/insertOrUpdate", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject insertOrUpdate(@RequestBody ManufacturerInsertOrUpdateInVO inVO) {
public JsonViewObject insertOrUpdate(@RequestBody ManufacturerInsertOrUpdateDTO inVO) {
manufacturerService.insertOrUpdate(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
......@@ -58,7 +58,7 @@ public class ManufacturerController {
@ApiOperation(value = "厂商删除", notes = "厂商删除", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/delete", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject delete(@RequestBody DeleteByIntegerIdListInVO inVO) {
public JsonViewObject delete(@RequestBody DeleteByIntegerIdListDTO inVO) {
manufacturerService.delete(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
......
package net.wanji.utc.controller;
import net.wanji.utc.common.constant.Constants;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.utc.entity.JsonViewObject;
import net.wanji.utc.po.*;
import net.wanji.utc.service.staticinfo.StaticInfoService;
import net.wanji.utc.common.baseentity.BaseCrossInfo;
import net.wanji.utc.vo.CrossInfoInVO;
import net.wanji.utc.common.genericentity.OutVO;
import net.wanji.utc.dto.CrossInfoDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.wanji.utc.vo.CrossSchedulesInVO;
import net.wanji.utc.vo.PlanSectionInVO;
import net.wanji.utc.vo.SchemePhaseLightsInVO;
import net.wanji.utc.dto.CrossSchedulesDTO;
import net.wanji.utc.dto.PlanSectionDTO;
import net.wanji.utc.dto.SchemePhaseLightsDTO;
import net.wanji.utc.vo.PlanSectionVO;
import net.wanji.utc.vo.SchemePhaseLightsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import javax.ws.rs.core.MediaType;
import java.util.List;
/**
* 静态信息接口
......@@ -29,41 +33,80 @@ public class StaticInfoController {
@Autowired
StaticInfoService staticInfoService;
@PostMapping("/crossInfo")
@ApiOperation(value = "信号路口基础信息", notes = "信号路口基础信息")
public ResponseEntity crossInfo(HttpServletRequest request, @RequestBody CrossInfoInVO crossInfoInVO) {
OutVO<BaseCrossInfo> outVO = new OutVO<>();
String manufacturerCode = crossInfoInVO.getManufacturerCode();
outVO.setManufacturerCode(manufacturerCode);
outVO.setUpdatetime(new Date());
outVO.setSystemAbbr(Constants.SYSTEM_ABBR);
@PostMapping(value = "/crossInfo",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiOperation(value = "信号路口基础信息", notes = "信号路口基础信息", response = CrossInfoPO.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossInfoPO.class)
})
public JsonViewObject crossInfo(@RequestBody CrossInfoDTO crossInfoDTO) {
List<CrossInfoPO> crossInfoPOList = staticInfoService.crossBasicInfo(crossInfoDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
staticInfoService.crossBasicInfo(outVO);
return ResponseEntity.ok("success");
return jsonViewObject.success(crossInfoPOList);
}
@PostMapping("/schemePhaseLights")
@ApiOperation(value = "方案数据-方案信息、相位信息、灯组信息", notes = "方案数据-方案信息、相位信息、灯组信息")
public ResponseEntity schemePhaseLights(HttpServletRequest request,
@RequestBody SchemePhaseLightsInVO schemePhaseLightsInVO) throws Exception {
staticInfoService.schemePhaseLights(schemePhaseLightsInVO);
return ResponseEntity.ok("success");
@PostMapping(value = "/schemePhaseLights",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiOperation(value = "方案数据-方案信息、相位信息、灯组信息", notes = "方案数据-方案信息、相位信息、灯组信息",
response = SchemePhaseLightsVO.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SchemePhaseLightsVO.class)
})
public JsonViewObject schemePhaseLights(@RequestBody SchemePhaseLightsDTO schemePhaseLightsDTO) throws Exception {
// 更新数据库
staticInfoService.schemePhaseLights(schemePhaseLightsDTO);
// 构造返回值
SchemePhaseLightsVO schemePhaseLightsVO = staticInfoService.buildSchemePhaseLightsResponse(schemePhaseLightsDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(schemePhaseLightsVO);
}
@PostMapping(value = "/planSection",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiOperation(value = "计划数据-计划信息、时段信息", notes = "计划数据-计划信息、时段信息", response = PlanSectionVO.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = PlanSectionVO.class)
})
public JsonViewObject planSection(@RequestBody PlanSectionDTO planSectionDTO) throws Exception {
// 更新数据库
staticInfoService.planSection(planSectionDTO);
// 构造返回值
String crossId = planSectionDTO.getCrossId();
Integer planNo = planSectionDTO.getPlanNo();
PlanSectionVO planSectionVO = new PlanSectionVO();
if (planNo == -1) {
// 返回所有
planSectionVO = staticInfoService.buildPlanSectionResponse(crossId);
} else {
// 按计划号返回
planSectionVO = staticInfoService.buildPlanSectionResponse(crossId, planNo);
}
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
@PostMapping("/planSection")
@ApiOperation(value = "计划数据-计划信息、时段信息", notes = "计划数据-计划信息、时段信息")
public ResponseEntity planSection(HttpServletRequest request,
@RequestBody PlanSectionInVO planSectionInVO) throws Exception {
staticInfoService.planSection(planSectionInVO);
return ResponseEntity.ok("success");
return jsonViewObject.success(planSectionVO);
}
@PostMapping("/crossSchedules")
@ApiOperation(value = "时间表数据", notes = "时间表数据")
public ResponseEntity crossSchedules(HttpServletRequest request,
@RequestBody CrossSchedulesInVO crossSchedulesInVO) throws Exception {
staticInfoService.crossSchedules(crossSchedulesInVO);
return ResponseEntity.ok("success");
@PostMapping(value = "/crossSchedules",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiOperation(value = "时间表数据", notes = "时间表数据", response = CrossSchedulesPO.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossSchedulesPO.class)
})
public JsonViewObject crossSchedules(@RequestBody CrossSchedulesDTO crossSchedulesDTO) throws Exception {
// 更新数据库
staticInfoService.crossSchedules(crossSchedulesDTO);
// 构造返回值
List<String> crossIdList = crossSchedulesDTO.getCrossIdList();
List<CrossSchedulesPO> crossSchedulesPOList = staticInfoService.buildCrossSchedulesResponse(crossIdList);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(crossSchedulesPOList);
}
}
package net.wanji.utc.vo;
package net.wanji.utc.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -9,8 +9,8 @@ import lombok.Data;
* @date 2022/11/15 9:57
*/
@Data
@ApiModel(value = "CrossInfoInVO", description = "查询信号路口基础信息输入参数")
public class CrossInfoInVO {
@ApiModel(value = "CrossInfoDTO", description = "查询信号路口基础信息输入参数")
public class CrossInfoDTO {
@ApiModelProperty(value = "厂商代码 HK")
String manufacturerCode;
}
package net.wanji.utc.vo;
package net.wanji.utc.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -11,9 +11,9 @@ import java.util.List;
* @date 2022/11/18 17:15
*/
@Data
@ApiModel(value = "CrossSchedulesInVO", description = "查询时间表数据输入参数")
public class CrossSchedulesInVO {
@ApiModelProperty(value = "厂商缩写 HK")
@ApiModel(value = "CrossSchedulesDTO", description = "查询时间表数据输入参数")
public class CrossSchedulesDTO {
@ApiModelProperty(value = "厂商代码 HK")
String manufacturerCode;
@ApiModelProperty(value = "路口列表")
......
package net.wanji.utc.vo;
package net.wanji.utc.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -9,8 +9,8 @@ import lombok.Data;
* @date 2022/11/15 9:57
*/
@Data
@ApiModel(value = "PlanSectionInVO", description = "查询计划数据-计划信息、时段信息输入参数")
public class PlanSectionInVO {
@ApiModel(value = "PlanSectionDTO", description = "查询计划数据-计划信息、时段信息输入参数")
public class PlanSectionDTO {
@ApiModelProperty(value = "路口ID")
private String crossId;
......
package net.wanji.utc.vo;
package net.wanji.utc.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -9,8 +9,8 @@ import lombok.Data;
* @date 2022/11/16 13:23
*/
@Data
@ApiModel(value = "SchemePhaseLightsInVO", description = "查询方案数据-方案信息、相位信息、灯组信息输入参数")
public class SchemePhaseLightsInVO {
@ApiModel(value = "SchemePhaseLightsDTO", description = "查询方案数据-方案信息、相位信息、灯组信息输入参数")
public class SchemePhaseLightsDTO {
@ApiModelProperty(value = "路口ID")
private String crossId;
}
package net.wanji.utc.vo.systemadmin;
package net.wanji.utc.dto.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -11,8 +11,8 @@ import java.util.Date;
* @date 2022/11/25 10:21
*/
@Data
@ApiModel(value = "CrossInfoInsertOrUpdateInVO", description = "信号机新增或修改输入参数")
public class CrossInfoInsertOrUpdateInVO {
@ApiModel(value = "CrossInfoInsertOrUpdateDTO", description = "信号机新增或修改输入参数")
public class CrossInfoInsertOrUpdateDTO {
@ApiModelProperty(value = "路口ID。不传ID为新增,传ID为修改",notes = "")
private String id ;
/** 信号机编号 */
......
package net.wanji.utc.vo.systemadmin;
package net.wanji.utc.dto.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -9,8 +9,8 @@ import lombok.Data;
* @date 2022/11/25 8:55
*/
@Data
@ApiModel(value = "CrossInfoListInVO", description = "信号机列表输入参数")
public class CrossInfoListInVO {
@ApiModel(value = "CrossInfoListDTO", description = "信号机列表输入参数")
public class CrossInfoListDTO {
@ApiModelProperty(required = true, value = "页号")
Integer pageNum;
@ApiModelProperty(required = true, value = "每页记录数")
......
package net.wanji.utc.vo.systemadmin;
package net.wanji.utc.dto.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -11,8 +11,8 @@ import java.util.List;
* @date 2022/11/24 10:10
*/
@Data
@ApiModel(value = "DeleteByIntegerIdListInVO", description = "厂商或接口删除输入参数")
public class DeleteByIntegerIdListInVO {
@ApiModel(value = "DeleteByIntegerIdListDTO", description = "厂商或接口删除输入参数")
public class DeleteByIntegerIdListDTO {
/** 厂商或接口ID列表 */
@ApiModelProperty(value = "厂商或接口ID列表",notes = "")
private List<Integer> ids ;
......
package net.wanji.utc.vo.systemadmin;
package net.wanji.utc.dto.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -11,8 +11,8 @@ import java.util.List;
* @date 2022/11/24 10:10
*/
@Data
@ApiModel(value = "DeleteByStringIdListInVO", description = "信号机删除输入参数")
public class DeleteByStringIdListInVO {
@ApiModel(value = "DeleteByStringIdListDTO", description = "信号机删除输入参数")
public class DeleteByStringIdListDTO {
/** 信号机ID列表 */
@ApiModelProperty(value = "信号机ID列表",notes = "")
private List<String> ids ;
......
package net.wanji.utc.vo.systemadmin;
package net.wanji.utc.dto.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -9,8 +9,8 @@ import lombok.Data;
* @date 2022/11/24 15:20
*/
@Data
@ApiModel(value = "ManufacturerApiInfoInsertOrUpdateInVO", description = "接口新增或修改输入参数")
public class ManufacturerApiInfoInsertOrUpdateInVO {
@ApiModel(value = "ManufacturerApiInfoInsertOrUpdateDTO", description = "接口新增或修改输入参数")
public class ManufacturerApiInfoInsertOrUpdateDTO {
/** 接口ID */
@ApiModelProperty(value = "接口ID。不传ID为新增,传ID为修改",notes = "")
private Integer id ;
......
package net.wanji.utc.vo.systemadmin;
package net.wanji.utc.dto.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -9,8 +9,8 @@ import lombok.Data;
* @date 2022/11/24 14:05
*/
@Data
@ApiModel(value = "ManufacturerApiInfoListInVO", description = "查询接口列表输入参数")
public class ManufacturerApiInfoListInVO {
@ApiModel(value = "ManufacturerApiInfoListDTO", description = "查询接口列表输入参数")
public class ManufacturerApiInfoListDTO {
@ApiModelProperty(required = true, value = "页号")
Integer pageNum;
@ApiModelProperty(required = true, value = "每页记录数")
......
package net.wanji.utc.vo.systemadmin;
package net.wanji.utc.dto.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -9,9 +9,9 @@ import lombok.Data;
* @date 2022/11/24 9:42
*/
@Data
@ApiModel(value = "ManufacturerInsertOrUpdateInVO",
@ApiModel(value = "ManufacturerInsertOrUpdateDTO",
description = "厂商添加或修改输入参数。如果携带ID,即为修改;如果不携带ID,即为新增")
public class ManufacturerInsertOrUpdateInVO {
public class ManufacturerInsertOrUpdateDTO {
/** 厂商ID */
@ApiModelProperty(value = "厂商ID。如果携带ID,即为修改;如果不携带ID,即为新增",notes = "")
private Integer id ;
......
package net.wanji.utc.vo.systemadmin;
package net.wanji.utc.dto.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -10,8 +10,8 @@ import lombok.Data;
*/
@Data
@ApiModel(value = "ManufacturerListInVO", description = "查询厂商列表输入参数")
public class ManufacturerListInVO {
@ApiModel(value = "ManufacturerListDTO", description = "查询厂商列表输入参数")
public class ManufacturerListDTO {
@ApiModelProperty(required = true, value = "页号")
Integer pageNum;
@ApiModelProperty(required = true, value = "每页记录数")
......
......@@ -16,7 +16,8 @@ public interface CrossInfoMapper {
List<String> selectCrossCodesByIds(@Param("entities") List<String> crossIdList);
String selectIdByCode(@Param("crossCode")String crossCode);
String selectIdByCodeAndManufacturerId(@Param("crossCode") String crossCode,
@Param("manufacturerId")Integer manufacturerId);
CrossInfoPO selectByCode(@Param("code") String code);
......@@ -32,4 +33,6 @@ public interface CrossInfoMapper {
void updateOne(CrossInfoPO crossInfoPO);
void deleteBatch(@Param("ids") List<String> ids);
void updateOneByCodeAndManufacturerId(CrossInfoPO crossInfoPO);
}
......@@ -17,4 +17,6 @@ public interface CrossPhaseMapper {
List<CrossPhasePO> selectByCrossIdAndPlanId(@Param("crossId") String crossId, @Param("planId") String planId);
List<Integer> selectIdsByPhaseNo(@Param("phaseNo") Integer phaseNo);
List<CrossPhasePO> selectByCrossId(@Param("crossId") String crossId);
}
......@@ -3,6 +3,8 @@ package net.wanji.utc.mapper;
import net.wanji.utc.po.CrossPlanPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/18 15:57
......@@ -12,5 +14,9 @@ public interface CrossPlanMapper {
void insertOne(CrossPlanPO crossPlanPO);
Integer selectIdByNo(@Param("crossId")String crossId, @Param("planNo")Integer planNo);
Integer selectIdByNo(@Param("crossId") String crossId, @Param("planNo")Integer planNo);
List<CrossPlanPO> selectByCrossId(@Param("crossId") String crossId);
List<CrossPlanPO> selectByCrossIdAndPlanNo(@Param("crossId") String crossId, @Param("planNo")Integer planNo);
}
......@@ -4,6 +4,7 @@ import net.wanji.utc.po.CrossSchedulesPO;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.List;
/**
* @author Kent HAN
......@@ -13,4 +14,6 @@ public interface CrossSchedulesMapper {
void deleteByCrossId(@Param("crossId") String crossId);
void insertBatch(@Param("entities") ArrayList<CrossSchedulesPO> crossSchedulesPOList);
List<CrossSchedulesPO> selectByCrossIds(@Param("crossIds") List<String> crossIdList);
}
......@@ -18,4 +18,6 @@ public interface CrossSchemeMapper {
CrossSchemePO selectByCrossIdAndSchemeNo(@Param("crossId") String crossId,
@Param("schemeNo") Integer schemeNo);
List<CrossSchemePO> selectByCrossId(@Param("crossId") String crossId);
}
......@@ -3,6 +3,8 @@ package net.wanji.utc.mapper;
import net.wanji.utc.po.CrossSectionPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/18 16:46
......@@ -12,4 +14,9 @@ public interface CrossSectionMapper {
@Param("timeSecNo") Integer timeSecNo);
void insertOne(CrossSectionPO crossSectionPO);
List<CrossSectionPO> selectByCrossId(@Param("crossId") String crossId);
List<CrossSectionPO> selectByCrossIdAndPlanId(@Param("crossId") String crossId,
@Param("planId") Integer planId);
}
......@@ -12,33 +12,33 @@ import java.util.Date;
@Data
public class CrossLightsPO {
/** 灯组ID */
@ApiModelProperty(name = "灯组ID",notes = "")
@ApiModelProperty(value = "灯组ID",notes = "")
private Integer id ;
/** 灯组号 */
@ApiModelProperty(name = "灯组号",notes = "")
@ApiModelProperty(value = "灯组号",notes = "")
private String lightsNo ;
/** 灯组名称 */
@ApiModelProperty(name = "灯组名称",notes = "")
@ApiModelProperty(value = "灯组名称",notes = "")
private String name ;
/** 灯组类型:1箭头;2圆饼,3行人 */
@ApiModelProperty(name = "灯组类型:1箭头2圆饼3行人",notes = "")
@ApiModelProperty(value = "灯组类型:1箭头2圆饼3行人",notes = "")
private Integer type ;
/** 灯组方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北 */
@ApiModelProperty(name = "灯组方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
@ApiModelProperty(value = "灯组方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer dir ;
/** 灯组转向:1左转;2右转;3直行;4左掉头;5直左;6直右;7右掉头;8向左合流;9向右合流;10左转加掉头;11右转加掉头;12直行加左掉头;13直行加右掉头;14左转右转;15左直右;16左转右转加掉头;17左直掉头;18左直右掉头;20行人 */
@ApiModelProperty(name = "灯组转向:1左转;2右转;3直行;4左掉头;5直左;6直右;7右掉头;8向左合流;9向右合流;10左转加掉头;11右转加掉头;12直行加左掉头;13直行加右掉头;14左转右转;15左直右;16左转右转加掉头;17左直掉头;18左直右掉头;20行人",notes = "")
@ApiModelProperty(value = "灯组转向:1左转;2右转;3直行;4左掉头;5直左;6直右;7右掉头;8向左合流;9向右合流;10左转加掉头;11右转加掉头;12直行加左掉头;13直行加右掉头;14左转右转;15左直右;16左转右转加掉头;17左直掉头;18左直右掉头;20行人",notes = "")
private Integer turn ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
@ApiModelProperty(value = "路口ID",notes = "")
private String crossId ;
/** 行人进出口:1进口;2出口,3进出口 */
@ApiModelProperty(name = "行人进出口:1进口2出口,3进出口",notes = "")
@ApiModelProperty(value = "行人进出口:1进口2出口,3进出口",notes = "")
private Integer inOutType ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
@ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
@ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ;
}
......@@ -12,57 +12,57 @@ import java.util.Date;
@Data
public class CrossPhasePO {
/** 相位ID */
@ApiModelProperty(name = "相位ID",notes = "")
@ApiModelProperty(value = "相位ID",notes = "")
private Integer id ;
/** 相位号 */
@ApiModelProperty(name = "相位号",notes = "")
@ApiModelProperty(value = "相位号",notes = "")
private String phaseNo;
/** 相位名称 */
@ApiModelProperty(name = "相位名称",notes = "")
@ApiModelProperty(value = "相位名称",notes = "")
private String name ;
/** 相位序号 */
@ApiModelProperty(name = "相位序号",notes = "")
@ApiModelProperty(value = "相位序号",notes = "")
private Integer sort ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
@ApiModelProperty(value = "路口ID",notes = "")
private String crossId ;
/** 方案ID */
@ApiModelProperty(name = "方案ID",notes = "")
@ApiModelProperty(value = "方案ID",notes = "")
private Integer planId ;
/** 环号 */
@ApiModelProperty(name = "环号",notes = "")
@ApiModelProperty(value = "环号",notes = "")
private Integer ringNo ;
/** 控制模式:1定周期;2绿灯;3黄灯;4红灯;5关灯;6绿闪;7黄闪;8红闪 */
@ApiModelProperty(name = "控制模式:1定周期;2绿灯;3黄灯;4红灯;5关灯;6绿闪;7黄闪;8红闪",notes = "")
@ApiModelProperty(value = "控制模式:1定周期;2绿灯;3黄灯;4红灯;5关灯;6绿闪;7黄闪;8红闪",notes = "")
private Integer controlMode ;
/** 相位时间 */
@ApiModelProperty(name = "相位时间",notes = "")
@ApiModelProperty(value = "相位时间",notes = "")
private Integer phaseTime ;
/** 绿灯时间 */
@ApiModelProperty(name = "绿灯时间",notes = "")
@ApiModelProperty(value = "绿灯时间",notes = "")
private Integer greenTime ;
/** 绿闪时间 */
@ApiModelProperty(name = "绿闪时间",notes = "")
@ApiModelProperty(value = "绿闪时间",notes = "")
private Integer greenFlashTime ;
/** 行闪时间 */
@ApiModelProperty(name = "行闪时间",notes = "")
@ApiModelProperty(value = "行闪时间",notes = "")
private Integer pedFlashTime ;
/** 黄灯时间 */
@ApiModelProperty(name = "黄灯时间",notes = "")
@ApiModelProperty(value = "黄灯时间",notes = "")
private Integer yellowTime ;
/** 红灯时间 */
@ApiModelProperty(name = "红灯时间",notes = "")
@ApiModelProperty(value = "红灯时间",notes = "")
private Integer redTime ;
/** 最小绿灯时间 */
@ApiModelProperty(name = "最小绿灯时间",notes = "")
@ApiModelProperty(value = "最小绿灯时间",notes = "")
private Integer minGreenTime ;
/** 最大绿灯时间 */
@ApiModelProperty(name = "最大绿灯时间",notes = "")
@ApiModelProperty(value = "最大绿灯时间",notes = "")
private Integer maxGreenTime ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
@ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
@ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ;
}
......@@ -12,21 +12,21 @@ import java.util.Date;
@Data
public class CrossPlanPO {
/** 计划ID */
@ApiModelProperty(name = "计划ID",notes = "")
@ApiModelProperty(value = "计划ID",notes = "")
private Integer id ;
/** 计划号 */
@ApiModelProperty(name = "计划号",notes = "")
@ApiModelProperty(value = "计划号",notes = "")
private String planNo ;
/** 计划名称 */
@ApiModelProperty(name = "计划名称",notes = "")
@ApiModelProperty(value = "计划名称",notes = "")
private String name ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
@ApiModelProperty(value = "路口ID",notes = "")
private String crossId ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
@ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
@ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ;
}
......@@ -12,27 +12,27 @@ import java.util.Date;
@Data
public class CrossSchedulesPO {
/** 日期ID */
@ApiModelProperty(name = "日期ID",notes = "")
@ApiModelProperty(value = "日期ID",notes = "")
private Integer id ;
/** 日期名称 */
@ApiModelProperty(name = "日期名称",notes = "")
@ApiModelProperty(value = "日期名称",notes = "")
private String name ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
@ApiModelProperty(value = "路口ID",notes = "")
private String crossId ;
/** 计划ID */
@ApiModelProperty(name = "计划ID",notes = "")
@ApiModelProperty(value = "计划ID",notes = "")
private Integer planId ;
/** 星期:1周一;2周二,3周三,4周四,5周五,6周六,7周日,0特殊日期 */
@ApiModelProperty(name = "星期:1周一",notes = "2周二,3周三,4周四,5周五,6周六,7周日,0特殊日期")
@ApiModelProperty(value = "星期:1周一",notes = "2周二,3周三,4周四,5周五,6周六,7周日,0特殊日期")
private Integer week ;
/** 特殊日期 */
@ApiModelProperty(name = "特殊日期",notes = "")
@ApiModelProperty(value = "特殊日期",notes = "")
private Date specialDate ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
@ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
@ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ;
}
......@@ -12,36 +12,36 @@ import java.util.Date;
@Data
public class CrossSchemePO {
/** 方案ID */
@ApiModelProperty(name = "方案ID",notes = "")
@ApiModelProperty(value = "方案ID",notes = "")
private Integer id ;
/** 方案号 */
@ApiModelProperty(name = "方案号",notes = "")
@ApiModelProperty(value = "方案号",notes = "")
private String schemeNo;
/** 方案名称 */
@ApiModelProperty(name = "方案名称",notes = "")
@ApiModelProperty(value = "方案名称",notes = "")
private String name ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
@ApiModelProperty(value = "路口ID",notes = "")
private String crossId ;
/** 周期 */
@ApiModelProperty(name = "周期",notes = "")
@ApiModelProperty(value = "周期",notes = "")
private Integer cycle ;
/** 协调相位ID */
@ApiModelProperty(name = "协调相位ID",notes = "")
@ApiModelProperty(value = "协调相位ID",notes = "")
private Integer coordPhase ;
/** 相位差 */
@ApiModelProperty(name = "相位差",notes = "")
@ApiModelProperty(value = "相位差",notes = "")
private Integer offset ;
/** 数据来源:1信号机;2平台 */
@ApiModelProperty(name = "数据来源:1信号机;2平台",notes = "")
@ApiModelProperty(value = "数据来源:1信号机;2平台",notes = "")
private Integer source ;
/** 删除标识:1删除;0未删除 */
@ApiModelProperty(name = "删除标识:1删除;0未删除",notes = "")
@ApiModelProperty(value = "删除标识:1删除;0未删除",notes = "")
private Integer isDeleted ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
@ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
@ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ;
}
......@@ -12,33 +12,33 @@ import java.util.Date;
@Data
public class CrossSectionPO {
/** 时段ID */
@ApiModelProperty(name = "时段ID",notes = "")
@ApiModelProperty(value = "时段ID",notes = "")
private Integer id ;
/** 时段号 */
@ApiModelProperty(name = "时段号",notes = "")
@ApiModelProperty(value = "时段号",notes = "")
private String sectionNo ;
/** 开始时间 */
@ApiModelProperty(name = "开始时间",notes = "")
@ApiModelProperty(value = "开始时间",notes = "")
private String startTime ;
/** 结束时间 */
@ApiModelProperty(name = "结束时间",notes = "")
@ApiModelProperty(value = "结束时间",notes = "")
private String endTime ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
@ApiModelProperty(value = "路口ID",notes = "")
private String crossId ;
/** 计划ID */
@ApiModelProperty(name = "计划ID",notes = "")
@ApiModelProperty(value = "计划ID",notes = "")
private Integer planId ;
/** 控制模式:1定周期;2绿波协调;3黄闪;4全红;5关灯;6单点自适应;7全感应;8半感应;9 */
@ApiModelProperty(name = "控制模式:1定周期;2绿波协调;3黄闪;4全红;5关灯;6单点自适应;7全感应;8半感应;9",notes = "")
@ApiModelProperty(value = "控制模式:1定周期;2绿波协调;3黄闪;4全红;5关灯;6单点自适应;7全感应;8半感应;9",notes = "")
private Integer controlMode ;
/** 方案ID */
@ApiModelProperty(name = "方案ID",notes = "")
@ApiModelProperty(value = "方案ID",notes = "")
private Integer scemeId ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
@ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
@ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ;
}
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.wanji.utc.common.baseentity.BaseCrossInfo;
import net.wanji.utc.common.commonentity.HttpRequest;
......@@ -12,8 +13,11 @@ import net.wanji.utc.common.constant.Constants;
import net.wanji.utc.common.typeenum.BasicEnum;
import net.wanji.utc.mapper.CrossInfoMapper;
import net.wanji.utc.mapper.CrossLightsMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.CrossLightsPO;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.runninginfo.HkLightsStatusService;
import net.wanji.utc.util.PathUtil;
import net.wanji.utc.vo.LightsStatusVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -30,22 +34,19 @@ import java.util.Map;
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class HkLightsStatusServiceImpl implements HkLightsStatusService {
@Value("${signal.manufacturer.hk.artemisPath}")
private String artemisPath;
@Autowired
private ArtemisConfig artemisConfig;
@Autowired
private CrossLightsMapper crossLightsMapper;
@Autowired
CrossInfoMapper crossInfoMapper;
private final ArtemisConfig artemisConfig;
private final CrossLightsMapper crossLightsMapper;
private final CrossInfoMapper crossInfoMapper;
private final ManufacturerInfoMapper manufacturerInfoMapper;
@Override
public List<LightsStatusVO> getHkLightsStatus(List<BaseCrossInfo> baseCrossInfoList) {
List<LightsStatusVO> result = new ArrayList<>();
LightsStatusVO infoVo;
try {
Map<String, String> path = getPathMapByApiCode("getRealtimeSchemeStateInfo");
Map<String, String> path = PathUtil.getPathMapByApiCode("getRealtimeSchemeStateInfo");
for (BaseCrossInfo entity : baseCrossInfoList) {
JSONObject jsonBody = new JSONObject();
jsonBody.put("pageNo", 1);
......@@ -58,8 +59,11 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
String strResult = ArtemisHttpUtil.doPostStringArtemis(artemisConfig, path, jsonBody.toJSONString(),
null, null, "application/json", null);
JSONObject object = JSON.parseObject(strResult);
ManufacturerInfoPO manufacturerInfoPO =
manufacturerInfoMapper.selectByCode(entity.getManufacturerCode());
String crossId = crossInfoMapper.selectIdByCode(entity.getCode());
String crossId = crossInfoMapper.selectIdByCodeAndManufacturerId(entity.getCode(),
manufacturerInfoPO.getId());
List<CrossLightsPO> crossLightsPOList = crossLightsMapper.selectByCrossId(crossId);
if(Constants.HK_SUCCESS_CODE.equals(object.getInteger(Constants.HK_CODE_KEY))) {
......@@ -156,11 +160,4 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
}
return color;
}
private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl());
return res;
}
}
package net.wanji.utc.service.staticinfo;
import net.wanji.utc.common.baseentity.BaseCrossInfo;
import net.wanji.utc.common.genericentity.ManufacturerRes;
import net.wanji.utc.common.genericentity.OutVO;
import net.wanji.utc.vo.CrossSchedulesInVO;
import net.wanji.utc.vo.DetailCrossInfoVO;
import net.wanji.utc.vo.PlanSectionInVO;
import net.wanji.utc.vo.SchemePhaseLightsInVO;
import net.wanji.utc.dto.CrossInfoDTO;
import net.wanji.utc.dto.CrossSchedulesDTO;
import net.wanji.utc.po.CrossInfoPO;
import net.wanji.utc.dto.PlanSectionDTO;
import net.wanji.utc.dto.SchemePhaseLightsDTO;
import net.wanji.utc.po.CrossSchedulesPO;
import net.wanji.utc.vo.PlanSectionVO;
import net.wanji.utc.vo.SchemePhaseLightsVO;
import java.util.List;
public interface StaticInfoService {
ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(OutVO<BaseCrossInfo> outVO);
List<CrossInfoPO> crossBasicInfo(CrossInfoDTO crossInfoDTO);
void schemePhaseLights(SchemePhaseLightsDTO schemePhaseLightsDTO) throws Exception;
void planSection(PlanSectionDTO planSectionDTO) throws Exception;
void crossSchedules(CrossSchedulesDTO crossSchedulesDTO) throws Exception;
SchemePhaseLightsVO buildSchemePhaseLightsResponse(SchemePhaseLightsDTO schemePhaseLightsDTO);
void schemePhaseLights(SchemePhaseLightsInVO schemePhaseLightsInVO) throws Exception;
PlanSectionVO buildPlanSectionResponse(String crossId);
void planSection(PlanSectionInVO planSectionInVO) throws Exception;
PlanSectionVO buildPlanSectionResponse(String crossId, Integer planNo);
void crossSchedules(CrossSchedulesInVO crossSchedulesInVO) throws Exception;
List<CrossSchedulesPO> buildCrossSchedulesResponse(List<String> crossIdList);
}
......@@ -6,15 +6,17 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import lombok.RequiredArgsConstructor;
import net.wanji.utc.common.commonentity.HttpRequest;
import net.wanji.utc.common.constant.Constants;
import net.wanji.utc.common.typeenum.BasicEnum;
import net.wanji.utc.mapper.CrossInfoMapper;
import net.wanji.utc.mapper.CrossPlanMapper;
import net.wanji.utc.mapper.CrossSchedulesMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.CrossSchedulesPO;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.staticinfo.HkCrossSchedulesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -25,17 +27,15 @@ import java.util.*;
* @date 2022/11/18 17:20
*/
@Service
@RequiredArgsConstructor
public class HkCrossSchedulesServiceImpl implements HkCrossSchedulesService {
@Value("${signal.manufacturer.hk.artemisPath}")
private String artemisPath;
@Autowired
private ArtemisConfig artemisConfig;
@Autowired
CrossInfoMapper crossInfoMapper;
@Autowired
CrossPlanMapper crossPlanMapper;
@Autowired
CrossSchedulesMapper crossSchedulesMapper;
private final ArtemisConfig artemisConfig;
private final CrossInfoMapper crossInfoMapper;
private final CrossPlanMapper crossPlanMapper;
private final CrossSchedulesMapper crossSchedulesMapper;
private final ManufacturerInfoMapper manufacturerInfoMapper;
@Override
public void crossSchedules(List<String> crossIdList) throws Exception {
......@@ -53,7 +53,10 @@ public class HkCrossSchedulesServiceImpl implements HkCrossSchedulesService {
JSONObject dataEle = data.getJSONObject(i);
JSONArray schedules = dataEle.getJSONArray("schedules");
String crossCode = dataEle.getString("crossCode");
String crossId = crossInfoMapper.selectIdByCode(crossCode);
String code = BasicEnum.ManufacturerEnum.HK.getCode();
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByCode(code);
Integer manufacturerId = manufacturerInfoPO.getId();
String crossId = crossInfoMapper.selectIdByCodeAndManufacturerId(crossCode, manufacturerId);
for (int j = 0; j < schedules.size(); j++) {
JSONObject schedule = schedules.getJSONObject(j);
JSONArray weeks = schedule.getJSONArray("weeks");
......
package net.wanji.utc.service.staticinfo.impl;
import lombok.RequiredArgsConstructor;
import net.wanji.utc.common.genericentity.ManufacturerRes;
import net.wanji.utc.common.typeenum.BasicEnum;
import net.wanji.utc.mapper.CrossInfoMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.CrossInfoPO;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.common.baseentity.BaseCrossInfo;
import net.wanji.utc.common.genericentity.OutVO;
import net.wanji.utc.dto.CrossInfoDTO;
import net.wanji.utc.mapper.*;
import net.wanji.utc.po.*;
import net.wanji.utc.service.staticinfo.*;
import net.wanji.utc.util.ListUtil;
import net.wanji.utc.vo.CrossSchedulesInVO;
import net.wanji.utc.vo.DetailCrossInfoVO;
import net.wanji.utc.vo.PlanSectionInVO;
import net.wanji.utc.vo.SchemePhaseLightsInVO;
import net.wanji.utc.dto.CrossSchedulesDTO;
import net.wanji.utc.dto.PlanSectionDTO;
import net.wanji.utc.dto.SchemePhaseLightsDTO;
import net.wanji.utc.vo.PlanSectionVO;
import net.wanji.utc.vo.SchemePhaseLightsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -30,79 +26,59 @@ import java.util.Objects;
@RequiredArgsConstructor
public class StaticInfoServiceImpl implements StaticInfoService {
private final HkCrossInfoService hkCrossInfoService;
@Autowired
CrossInfoMapper crossInfoMapper;
@Autowired
OthersStaticInfoService othersStaticInfoService;
@Autowired
ManufacturerInfoMapper manufacturerInfoMapper;
@Autowired
HkSchemePhaseLightsService hkSchemePhaseLightsService;
@Autowired
HkPlanSectionService hkPlanSectionService;
@Autowired
HkCrossSchedulesService hkCrossSchedulesService;
private final CrossInfoMapper crossInfoMapper;
private final OthersStaticInfoService othersStaticInfoService;
private final ManufacturerInfoMapper manufacturerInfoMapper;
private final HkSchemePhaseLightsService hkSchemePhaseLightsService;
private final HkPlanSectionService hkPlanSectionService;
private final HkCrossSchedulesService hkCrossSchedulesService;
private final CrossSchemeMapper crossSchemeMapper;
private final CrossPhaseMapper crossPhaseMapper;
private final CrossLightsMapper crossLightsMapper;
private final CrossPlanMapper crossPlanMapper;
private final CrossSectionMapper crossSectionMapper;
private final CrossSchedulesMapper crossSchedulesMapper;
@Override
public ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(OutVO<BaseCrossInfo> outVO) {
public List<CrossInfoPO> crossBasicInfo(CrossInfoDTO crossInfoDTO) {
List<CrossInfoPO> crossInfoPOList = new ArrayList<>();
ManufacturerRes<DetailCrossInfoVO> res = new ManufacturerRes<>();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), outVO.getManufacturerCode())) {
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), crossInfoDTO.getManufacturerCode())) {
crossInfoPOList = hkCrossInfoService.hkCrossBasicInfo();
} else {
// todo 其他厂商
res = othersStaticInfoService.crossBasicInfo(outVO.getManufacturerCode());
if (null == res) {
return null;
}
List<DetailCrossInfoVO> dataContent = res.getDatalist();
if (ListUtil.isEmpty(dataContent)) {
return null;
}
for (DetailCrossInfoVO vo : dataContent) {
String id = vo.getCode();
CrossInfoPO crossInfoPO = crossInfoMapper.selectByPrimaryKey(id);
if (null != crossInfoPO) {
continue;
}
crossInfoPO = new CrossInfoPO();
// 用信号机ID作为路口ID
crossInfoPO.setId(id);
crossInfoPO.setName(vo.getCrossName());
crossInfoPO.setCode(id);
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByCode(vo.getManufacturerCode());
if (manufacturerInfoPO != null) {
crossInfoPO.setManufacturerId(manufacturerInfoPO.getId());
}
crossInfoPO.setIp(vo.getIp());
crossInfoPO.setPort(vo.getPort());
// 经纬度
Double longitude = vo.getLon();
Double latitude = vo.getLat();
crossInfoPO.setLocation(longitude + "," + latitude);
crossInfoPO.setVersion(vo.getVersion());
crossInfoPO.setModel(vo.getModel());
crossInfoPO.setInstallTime(vo.getInstallTime());
crossInfoPOList.add(crossInfoPO);
}
}
//存储信号机信息
if (crossInfoPOList.size() == 0) {
return null;
}
crossInfoMapper.insertBatch(crossInfoPOList);
return res;
for (CrossInfoPO crossInfoPO : crossInfoPOList) {
String code = crossInfoPO.getCode();
Integer manufacturerId = crossInfoPO.getManufacturerId();
String id = crossInfoMapper.selectIdByCodeAndManufacturerId(code, manufacturerId);
if (id != null) {
// 如果有记录,则更新
crossInfoMapper.updateOneByCodeAndManufacturerId(crossInfoPO);
} else {
// 如果无记录,则新增
crossInfoMapper.insertOne(crossInfoPO);
}
}
String manufacturerCode = crossInfoDTO.getManufacturerCode();
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByCode(manufacturerCode);
Integer manufacturerId = manufacturerInfoPO.getId();
crossInfoPOList = crossInfoMapper.selectByManufacturerId(manufacturerId);
return crossInfoPOList;
}
@Override
public void schemePhaseLights(SchemePhaseLightsInVO schemePhaseLightsInVO) throws Exception {
String crossId = schemePhaseLightsInVO.getCrossId();
public void schemePhaseLights(SchemePhaseLightsDTO schemePhaseLightsDTO) throws Exception {
String crossId = schemePhaseLightsDTO.getCrossId();
// 获取厂商ID和信号机ID
CrossInfoPO crossInfoPO = crossInfoMapper.selectByPrimaryKey(crossId);
String crossCode = crossInfoPO.getCode();
Integer manufacturerId = crossInfoPO.getManufacturerId();
// 获取厂商缩写
// 获取厂商代码
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId);
String manufacturerCode = manufacturerInfoPO.getCode();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
......@@ -114,16 +90,16 @@ public class StaticInfoServiceImpl implements StaticInfoService {
}
@Override
public void planSection(PlanSectionInVO planSectionInVO) throws Exception {
String crossId = planSectionInVO.getCrossId();
public void planSection(PlanSectionDTO planSectionDTO) throws Exception {
String crossId = planSectionDTO.getCrossId();
// 获取厂商ID和信号机ID
CrossInfoPO crossInfoPO = crossInfoMapper.selectByPrimaryKey(crossId);
String crossCode = crossInfoPO.getCode();
Integer manufacturerId = crossInfoPO.getManufacturerId();
// 获取厂商缩写
// 获取厂商代码
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId);
String manufacturerCode = manufacturerInfoPO.getCode();
Integer planNo = planSectionInVO.getPlanNo();
Integer planNo = planSectionDTO.getPlanNo();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
// 海康
hkPlanSectionService.planSection(crossCode, planNo, crossId);
......@@ -133,9 +109,9 @@ public class StaticInfoServiceImpl implements StaticInfoService {
}
@Override
public void crossSchedules(CrossSchedulesInVO crossSchedulesInVO) throws Exception {
String manufacturerCode = crossSchedulesInVO.getManufacturerCode();
List<String> crossIdList = crossSchedulesInVO.getCrossIdList();
public void crossSchedules(CrossSchedulesDTO crossSchedulesDTO) throws Exception {
String manufacturerCode = crossSchedulesDTO.getManufacturerCode();
List<String> crossIdList = crossSchedulesDTO.getCrossIdList();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
// 海康
hkCrossSchedulesService.crossSchedules(crossIdList);
......@@ -144,4 +120,50 @@ public class StaticInfoServiceImpl implements StaticInfoService {
}
}
@Override
public SchemePhaseLightsVO buildSchemePhaseLightsResponse(SchemePhaseLightsDTO schemePhaseLightsDTO) {
String crossId = schemePhaseLightsDTO.getCrossId();
List<CrossSchemePO> crossSchemePOList = crossSchemeMapper.selectByCrossId(crossId);
List<CrossPhasePO> crossPhasePOList = crossPhaseMapper.selectByCrossId(crossId);
List<CrossLightsPO> crossLightsPOList = crossLightsMapper.selectByCrossId(crossId);
SchemePhaseLightsVO schemePhaseLightsVO = new SchemePhaseLightsVO();
schemePhaseLightsVO.setCrossSchemeList(crossSchemePOList);
schemePhaseLightsVO.setCrossPhaseList(crossPhasePOList);
schemePhaseLightsVO.setCrossLightsList(crossLightsPOList);
return schemePhaseLightsVO;
}
@Override
public PlanSectionVO buildPlanSectionResponse(String crossId) {
List<CrossPlanPO> crossPlanPOList = crossPlanMapper.selectByCrossId(crossId);
List<CrossSectionPO> crossSectionPOList = crossSectionMapper.selectByCrossId(crossId);
PlanSectionVO planSectionVO = new PlanSectionVO();
planSectionVO.setCrossPlanPOList(crossPlanPOList);
planSectionVO.setCrossSectionPOList(crossSectionPOList);
return planSectionVO;
}
@Override
public PlanSectionVO buildPlanSectionResponse(String crossId, Integer planNo) {
List<CrossPlanPO> crossPlanPOList = crossPlanMapper.selectByCrossIdAndPlanNo(crossId, planNo);
Integer planId = crossPlanMapper.selectIdByNo(crossId, planNo);
List<CrossSectionPO> crossSectionPOList = crossSectionMapper.selectByCrossIdAndPlanId(crossId, planId);
PlanSectionVO planSectionVO = new PlanSectionVO();
planSectionVO.setCrossPlanPOList(crossPlanPOList);
planSectionVO.setCrossSectionPOList(crossSectionPOList);
return planSectionVO;
}
@Override
public List<CrossSchedulesPO> buildCrossSchedulesResponse(List<String> crossIdList) {
List<CrossSchedulesPO> crossSchedulesPOList = crossSchedulesMapper.selectByCrossIds(crossIdList);
return crossSchedulesPOList;
}
}
package net.wanji.utc.service.systemadmin;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.vo.systemadmin.CrossInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListOutVO;
import net.wanji.utc.vo.systemadmin.DeleteByStringIdListInVO;
import net.wanji.utc.dto.systemadmin.CrossInfoInsertOrUpdateDTO;
import net.wanji.utc.dto.systemadmin.CrossInfoListDTO;
import net.wanji.utc.vo.systemadmin.CrossInfoListVO;
import net.wanji.utc.dto.systemadmin.DeleteByStringIdListDTO;
/**
* @author Kent HAN
* @date 2022/11/25 8:54
*/
public interface CrossInfoService {
PageInfo<CrossInfoListOutVO> list(CrossInfoListInVO crossInfoListInVO);
PageInfo<CrossInfoListVO> list(CrossInfoListDTO crossInfoListDTO);
void insertOrUpdate(CrossInfoInsertOrUpdateInVO inVO);
void insertOrUpdate(CrossInfoInsertOrUpdateDTO inVO);
void delete(DeleteByStringIdListInVO inVO);
void delete(DeleteByStringIdListDTO inVO);
}
package net.wanji.utc.service.systemadmin;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoOutVO;
import net.wanji.utc.dto.systemadmin.DeleteByIntegerIdListDTO;
import net.wanji.utc.dto.systemadmin.ManufacturerApiInfoInsertOrUpdateDTO;
import net.wanji.utc.dto.systemadmin.ManufacturerApiInfoListDTO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoVO;
/**
* @author Kent HAN
* @date 2022/11/24 13:59
*/
public interface ManufacturerApiInfoService {
PageInfo<ManufacturerApiInfoOutVO> list(ManufacturerApiInfoListInVO manufacturerApiInfoListInVO);
PageInfo<ManufacturerApiInfoVO> list(ManufacturerApiInfoListDTO manufacturerApiInfoListDTO);
void insertOrUpdate(ManufacturerApiInfoInsertOrUpdateInVO inVO);
void insertOrUpdate(ManufacturerApiInfoInsertOrUpdateDTO inVO);
void delete(DeleteByIntegerIdListInVO inVO);
void delete(DeleteByIntegerIdListDTO inVO);
}
package net.wanji.utc.service.systemadmin;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.dto.systemadmin.DeleteByIntegerIdListDTO;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerListInVO;
import net.wanji.utc.dto.systemadmin.ManufacturerInsertOrUpdateDTO;
import net.wanji.utc.dto.systemadmin.ManufacturerListDTO;
/**
* @author Kent HAN
* @date 2022/11/24 8:49
*/
public interface ManufacturerService {
PageInfo<ManufacturerInfoPO> list(ManufacturerListInVO manufacturerListInVO);
PageInfo<ManufacturerInfoPO> list(ManufacturerListDTO manufacturerListDTO);
void insertOrUpdate(ManufacturerInsertOrUpdateInVO inVO);
void insertOrUpdate(ManufacturerInsertOrUpdateDTO inVO);
void delete(DeleteByIntegerIdListInVO inVO);
void delete(DeleteByIntegerIdListDTO inVO);
}
......@@ -6,16 +6,16 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.common.exception.IpPortException;
import net.wanji.utc.common.exception.PortFormatException;
import net.wanji.utc.dto.systemadmin.CrossInfoInsertOrUpdateDTO;
import net.wanji.utc.dto.systemadmin.CrossInfoListDTO;
import net.wanji.utc.mapper.CrossInfoMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.CrossInfoPO;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.systemadmin.CrossInfoService;
import net.wanji.utc.util.PageUtils;
import net.wanji.utc.vo.systemadmin.CrossInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListOutVO;
import net.wanji.utc.vo.systemadmin.DeleteByStringIdListInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListVO;
import net.wanji.utc.dto.systemadmin.DeleteByStringIdListDTO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -35,13 +35,13 @@ public class CrossInfoServiceImpl implements CrossInfoService {
CrossInfoMapper crossInfoMapper;
@Override
public PageInfo<CrossInfoListOutVO> list(CrossInfoListInVO crossInfoListInVO) {
Integer pageNum = crossInfoListInVO.getPageNum();
Integer pageSize = crossInfoListInVO.getPageSize();
public PageInfo<CrossInfoListVO> list(CrossInfoListDTO crossInfoListDTO) {
Integer pageNum = crossInfoListDTO.getPageNum();
Integer pageSize = crossInfoListDTO.getPageSize();
String crossName = crossInfoListInVO.getCrossName();
String crossName = crossInfoListDTO.getCrossName();
String manufacturerNick = crossInfoListInVO.getManufacturerNick();
String manufacturerNick = crossInfoListDTO.getManufacturerNick();
Integer manufacturerId = null;
if (manufacturerNick != null) {
manufacturerId = manufacturerInfoMapper.selectIdByNick(manufacturerNick);
......@@ -51,22 +51,22 @@ public class CrossInfoServiceImpl implements CrossInfoService {
List<CrossInfoPO> crossInfoPOList = crossInfoMapper.selectByOptionals(crossName, manufacturerId);
PageInfo<CrossInfoPO> crossInfoPOPageInfo = new PageInfo<>(crossInfoPOList);
// 转换为VO类型的PageInfo对象
PageInfo<CrossInfoListOutVO> crossInfoListOutVOPageInfo = PageUtils.PageInfo2PageInfoVo(crossInfoPOPageInfo);
PageInfo<CrossInfoListVO> crossInfoListOutVOPageInfo = PageUtils.PageInfo2PageInfoVo(crossInfoPOPageInfo);
for (CrossInfoPO crossInfoPO : crossInfoPOList) {
CrossInfoListOutVO crossInfoListOutVO = new CrossInfoListOutVO();
BeanUtils.copyProperties(crossInfoPO, crossInfoListOutVO);
CrossInfoListVO crossInfoListVO = new CrossInfoListVO();
BeanUtils.copyProperties(crossInfoPO, crossInfoListVO);
Integer manufacturerIdInPage = crossInfoPO.getManufacturerId();
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerIdInPage);
String nickName = manufacturerInfoPO.getNickName();
crossInfoListOutVO.setManufacturerNick(nickName);
crossInfoListOutVOPageInfo.getList().add(crossInfoListOutVO);
crossInfoListVO.setManufacturerNick(nickName);
crossInfoListOutVOPageInfo.getList().add(crossInfoListVO);
}
return crossInfoListOutVOPageInfo;
}
@Override
public void insertOrUpdate(CrossInfoInsertOrUpdateInVO inVO) {
public void insertOrUpdate(CrossInfoInsertOrUpdateDTO inVO) {
CrossInfoPO crossInfoPO = new CrossInfoPO();
BeanUtils.copyProperties(inVO, crossInfoPO);
......@@ -108,7 +108,7 @@ public class CrossInfoServiceImpl implements CrossInfoService {
}
@Override
public void delete(DeleteByStringIdListInVO inVO) {
public void delete(DeleteByStringIdListDTO inVO) {
List<String> ids = inVO.getIds();
crossInfoMapper.deleteBatch(ids);
}
......
......@@ -2,17 +2,16 @@ package net.wanji.utc.service.systemadmin.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.common.typeenum.BasicEnum;
import net.wanji.utc.common.typeenum.ManufacturerApiInfoTypeEnum;
import net.wanji.utc.dto.systemadmin.ManufacturerApiInfoInsertOrUpdateDTO;
import net.wanji.utc.mapper.ManufacturerApiInfoMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.ManufacturerApiInfoPO;
import net.wanji.utc.service.systemadmin.ManufacturerApiInfoService;
import net.wanji.utc.util.PageUtils;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoOutVO;
import net.wanji.utc.dto.systemadmin.DeleteByIntegerIdListDTO;
import net.wanji.utc.dto.systemadmin.ManufacturerApiInfoListDTO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -31,19 +30,19 @@ public class ManufacturerApiInfoServiceImpl implements ManufacturerApiInfoServic
ManufacturerInfoMapper manufacturerInfoMapper;
@Override
public PageInfo<ManufacturerApiInfoOutVO> list(ManufacturerApiInfoListInVO manufacturerApiInfoListInVO) {
Integer pageNum = manufacturerApiInfoListInVO.getPageNum();
Integer pageSize = manufacturerApiInfoListInVO.getPageSize();
public PageInfo<ManufacturerApiInfoVO> list(ManufacturerApiInfoListDTO manufacturerApiInfoListDTO) {
Integer pageNum = manufacturerApiInfoListDTO.getPageNum();
Integer pageSize = manufacturerApiInfoListDTO.getPageSize();
String name = manufacturerApiInfoListInVO.getName();
String name = manufacturerApiInfoListDTO.getName();
String typeStr = manufacturerApiInfoListInVO.getTypeStr();
String typeStr = manufacturerApiInfoListDTO.getTypeStr();
Integer typeCode = null;
if (typeStr != null) {
typeCode = ManufacturerApiInfoTypeEnum.getCodeByMsg(typeStr);
}
String manufacturerNick = manufacturerApiInfoListInVO.getManufacturerNick();
String manufacturerNick = manufacturerApiInfoListDTO.getManufacturerNick();
Integer manufacturerId = null;
if (manufacturerNick != null) {
manufacturerId = manufacturerInfoMapper.selectIdByNick(manufacturerNick);
......@@ -54,26 +53,26 @@ public class ManufacturerApiInfoServiceImpl implements ManufacturerApiInfoServic
name, typeCode, manufacturerId);
PageInfo<ManufacturerApiInfoPO> manufacturerApiInfoPOPageInfo = new PageInfo<>(manufacturerApiInfoPOList);
// 转换为VO类型的PageInfo对象
PageInfo<ManufacturerApiInfoOutVO> manufacturerApiInfoOutVOPageInfo =
PageInfo<ManufacturerApiInfoVO> manufacturerApiInfoOutVOPageInfo =
PageUtils.PageInfo2PageInfoVo(manufacturerApiInfoPOPageInfo);
for (ManufacturerApiInfoPO manufacturerApiInfoPO : manufacturerApiInfoPOList) {
ManufacturerApiInfoOutVO manufacturerApiInfoOutVO = new ManufacturerApiInfoOutVO();
BeanUtils.copyProperties(manufacturerApiInfoPO, manufacturerApiInfoOutVO);
ManufacturerApiInfoVO manufacturerApiInfoVO = new ManufacturerApiInfoVO();
BeanUtils.copyProperties(manufacturerApiInfoPO, manufacturerApiInfoVO);
Integer type = manufacturerApiInfoPO.getType();
String apiType = ManufacturerApiInfoTypeEnum.getMsgByCode(type);
manufacturerApiInfoOutVO.setApiType(apiType);
manufacturerApiInfoVO.setApiType(apiType);
// 转换厂商简称
Integer manufacturerId1 = manufacturerApiInfoPO.getManufacturerId();
String manufacturerNick1 = manufacturerInfoMapper.selectNickById(manufacturerId1);
manufacturerApiInfoOutVO.setManufacturerNick(manufacturerNick1);
manufacturerApiInfoOutVOPageInfo.getList().add(manufacturerApiInfoOutVO);
manufacturerApiInfoVO.setManufacturerNick(manufacturerNick1);
manufacturerApiInfoOutVOPageInfo.getList().add(manufacturerApiInfoVO);
}
return manufacturerApiInfoOutVOPageInfo;
}
@Override
public void insertOrUpdate(ManufacturerApiInfoInsertOrUpdateInVO inVO) {
public void insertOrUpdate(ManufacturerApiInfoInsertOrUpdateDTO inVO) {
ManufacturerApiInfoPO manufacturerApiInfoPO = new ManufacturerApiInfoPO();
BeanUtils.copyProperties(inVO, manufacturerApiInfoPO);
String typeStr = inVO.getApiType();
......@@ -94,7 +93,7 @@ public class ManufacturerApiInfoServiceImpl implements ManufacturerApiInfoServic
}
@Override
public void delete(DeleteByIntegerIdListInVO inVO) {
public void delete(DeleteByIntegerIdListDTO inVO) {
List<Integer> ids = inVO.getIds();
manufacturerApiInfoMapper.deleteBatch(ids);
}
......
......@@ -2,12 +2,12 @@ package net.wanji.utc.service.systemadmin.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.dto.systemadmin.DeleteByIntegerIdListDTO;
import net.wanji.utc.dto.systemadmin.ManufacturerInsertOrUpdateDTO;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.systemadmin.ManufacturerService;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerListInVO;
import net.wanji.utc.dto.systemadmin.ManufacturerListDTO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -24,10 +24,10 @@ public class ManufacturerServiceImpl implements ManufacturerService {
ManufacturerInfoMapper manufacturerInfoMapper;
@Override
public PageInfo<ManufacturerInfoPO> list(ManufacturerListInVO manufacturerListInVO) {
Integer pageNum = manufacturerListInVO.getPageNum();
Integer pageSize = manufacturerListInVO.getPageSize();
String name = manufacturerListInVO.getName();
public PageInfo<ManufacturerInfoPO> list(ManufacturerListDTO manufacturerListDTO) {
Integer pageNum = manufacturerListDTO.getPageNum();
Integer pageSize = manufacturerListDTO.getPageSize();
String name = manufacturerListDTO.getName();
PageHelper.startPage(pageNum, pageSize);
List<ManufacturerInfoPO> manufacturerInfoPOList = manufacturerInfoMapper.selectByOptionalPartialName(name);
......@@ -37,7 +37,7 @@ public class ManufacturerServiceImpl implements ManufacturerService {
}
@Override
public void insertOrUpdate(ManufacturerInsertOrUpdateInVO inVO) {
public void insertOrUpdate(ManufacturerInsertOrUpdateDTO inVO) {
Integer id = inVO.getId();
ManufacturerInfoPO manufacturerInfoPO = new ManufacturerInfoPO();
BeanUtils.copyProperties(inVO, manufacturerInfoPO);
......@@ -51,7 +51,7 @@ public class ManufacturerServiceImpl implements ManufacturerService {
}
@Override
public void delete(DeleteByIntegerIdListInVO inVO) {
public void delete(DeleteByIntegerIdListDTO inVO) {
List<Integer> ids = inVO.getIds();
manufacturerInfoMapper.deleteBatch(ids);
}
......
package net.wanji.utc.vo;
import lombok.Data;
import net.wanji.utc.po.CrossPlanPO;
import net.wanji.utc.po.CrossSectionPO;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/12/1 14:07
*/
@Data
public class PlanSectionVO {
private List<CrossPlanPO> crossPlanPOList;
private List<CrossSectionPO> crossSectionPOList;
}
package net.wanji.utc.vo;
import lombok.Data;
import net.wanji.utc.po.CrossLightsPO;
import net.wanji.utc.po.CrossPhasePO;
import net.wanji.utc.po.CrossSchemePO;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/12/1 11:23
*/
@Data
public class SchemePhaseLightsVO {
private List<CrossSchemePO> crossSchemeList;
private List<CrossPhasePO> crossPhaseList;
private List<CrossLightsPO> crossLightsList;
}
......@@ -11,8 +11,8 @@ import java.util.Date;
* @date 2022/11/25 10:03
*/
@Data
@ApiModel(value = "CrossInfoListOutVO", description = "信号机列表返回参数")
public class CrossInfoListOutVO {
@ApiModel(value = "CrossInfoListVO", description = "信号机列表返回参数")
public class CrossInfoListVO {
@ApiModelProperty(value = "路口ID",notes = "")
private String id ;
/** 路口名称 */
......
......@@ -10,7 +10,7 @@ import java.util.Date;
* @date 2022/11/28 17:56
*/
@Data
public class ManufacturerApiInfoOutVO {
public class ManufacturerApiInfoVO {
/** 接口ID */
@ApiModelProperty(value = "接口ID",notes = "")
private Integer id ;
......
......@@ -64,6 +64,40 @@
where id = #{id}
</update>
<update id="updateOneByCodeAndManufacturerId">
update t_cross_info
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="code != null and code != ''">
code = #{code},
</if>
<if test="manufacturerId != null and manufacturerId != ''">
manufacturer_id = #{manufacturerId},
</if>
<if test="ip != null and ip != ''">
ip = #{ip},
</if>
<if test="port != null and port != ''">
port = #{port},
</if>
<if test="location != null and location != ''">
location = #{location},
</if>
<if test="version != null and version != ''">
version = #{version},
</if>
<if test="model != null and model != ''">
model = #{model},
</if>
<if test="installTime != null">
install_time = #{installTime},
</if>
</set>
where code = #{code} and manufacturer_id = #{manufacturerId}
</update>
<delete id="deleteBatch">
delete from t_cross_info
where id in
......@@ -88,10 +122,10 @@
</foreach>
</select>
<select id="selectIdByCode" resultType="java.lang.String">
<select id="selectIdByCodeAndManufacturerId" resultType="java.lang.String">
select id
from t_cross_info
where code = #{crossCode}
where code = #{crossCode} and manufacturer_id = #{manufacturerId}
</select>
<select id="selectByCode" resultMap="BaseResultMap">
......
......@@ -48,4 +48,11 @@
where phase_no = #{phaseNo}
</select>
<select id="selectByCrossId" resultMap="BaseResultMap">
select
id,phase_no,name,sort,cross_id,plan_id,ring_no,control_mode,phase_time,green_time,green_flash_time,ped_flash_time,yellow_time,red_time,min_green_time,max_green_time,gmt_create,gmt_modified
from t_cross_phase
where cross_id = #{crossId}
</select>
</mapper>
......@@ -27,5 +27,19 @@
where cross_id = #{crossId} and plan_no = #{planNo}
</select>
<select id="selectByCrossId" resultMap="BaseResultMap">
select
id,plan_no,name,cross_id,gmt_create,gmt_modified
from t_cross_plan
where cross_id = #{crossId}
</select>
<select id="selectByCrossIdAndPlanNo" resultMap="BaseResultMap">
select
id,plan_no,name,cross_id,gmt_create,gmt_modified
from t_cross_plan
where cross_id = #{crossId} and plan_no = #{planNo}
</select>
</mapper>
......@@ -26,5 +26,15 @@
where cross_id = #{crossId}
</delete>
<select id="selectByCrossIds" resultMap="BaseResultMap">
select
id,name,cross_id,plan_id,week,special_date,gmt_create,gmt_modified
from t_cross_schedules
where cross_id in
<foreach collection="crossIds" item="crossId" separator="," open="(" close=")">
#{crossId}
</foreach>
</select>
</mapper>
......@@ -41,4 +41,11 @@
where cross_id = #{crossId} and scheme_no = #{schemeNo}
</select>
<select id="selectByCrossId" resultMap="BaseResultMap">
select
id,scheme_no,name,cross_id,cycle,coord_phase,offset,source,is_deleted,gmt_create,gmt_modified
from t_cross_scheme
where cross_id = #{crossId}
</select>
</mapper>
......@@ -24,5 +24,19 @@
where cross_id = #{crossId} and section_no = #{timeSecNo}
</delete>
<select id="selectByCrossId" resultMap="BaseResultMap">
select
id,section_no,start_time,end_time,cross_id,plan_id,control_mode,sceme_id,gmt_create,gmt_modified
from t_cross_section
where cross_id = #{crossId}
</select>
<select id="selectByCrossIdAndPlanId" resultMap="BaseResultMap">
select
id,section_no,start_time,end_time,cross_id,plan_id,control_mode,sceme_id,gmt_create,gmt_modified
from t_cross_section
where cross_id = #{crossId} and plan_id = #{planId}
</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