Commit 6f54e94d authored by hanbing's avatar hanbing

系统管理-设备管理-信号机管理

parent 9ed13c40
...@@ -34,8 +34,8 @@ public class ApiInfoTask { ...@@ -34,8 +34,8 @@ public class ApiInfoTask {
for (ManufacturerApiInfoPO infoPO : manufacturerApiInfoPOList) { for (ManufacturerApiInfoPO infoPO : manufacturerApiInfoPOList) {
Integer manufacturerId = infoPO.getManufacturerId(); Integer manufacturerId = infoPO.getManufacturerId();
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId); ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId);
String abbr = manufacturerInfoPO.getCode(); String code = manufacturerInfoPO.getCode();
String s = abbr + Constants.SEPARATOR_UNDER_LINE + infoPO.getCode(); String s = code + Constants.SEPARATOR_UNDER_LINE + infoPO.getCode();
Constants.putManufacturerUrlMap(s, infoPO); Constants.putManufacturerUrlMap(s, infoPO);
} }
log.info("刷新" + manufacturerApiInfoPOList.size() + "条厂商URL至JVM"); log.info("刷新" + manufacturerApiInfoPOList.size() + "条厂商URL至JVM");
......
...@@ -7,13 +7,8 @@ import io.swagger.annotations.ApiResponse; ...@@ -7,13 +7,8 @@ import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import net.wanji.utc.entity.JsonViewObject; import net.wanji.utc.entity.JsonViewObject;
import net.wanji.utc.po.CrossInfoPO; 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.CrossInfoService;
import net.wanji.utc.service.systemadmin.ManufacturerApiInfoService; import net.wanji.utc.vo.systemadmin.*;
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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -36,18 +31,18 @@ public class CrossInfoController { ...@@ -36,18 +31,18 @@ public class CrossInfoController {
@Autowired @Autowired
CrossInfoService crossInfoService; CrossInfoService crossInfoService;
@ApiOperation(value = "信号机列表", notes = "信号机列表", response = CrossInfoPO.class, @ApiOperation(value = "信号机列表", notes = "信号机列表", response = CrossInfoListOutVO.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/list", @PostMapping(value = "/list",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossInfoPO.class), @ApiResponse(code = 200, message = "OK", response = CrossInfoListOutVO.class),
}) })
public JsonViewObject list(@RequestBody CrossInfoListInVO crossInfoListInVO) { public JsonViewObject list(@RequestBody CrossInfoListInVO crossInfoListInVO) {
PageInfo<CrossInfoPO> crossInfoPOPageInfo = crossInfoService.list(crossInfoListInVO); PageInfo<CrossInfoListOutVO> crossInfoListOutVOPageInfo = crossInfoService.list(crossInfoListInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(crossInfoPOPageInfo); return jsonViewObject.success(crossInfoListOutVOPageInfo);
} }
// @ApiOperation(value = "接口添加或修改", notes = "接口添加或修改", consumes = MediaType.APPLICATION_JSON) // @ApiOperation(value = "接口添加或修改", notes = "接口添加或修改", consumes = MediaType.APPLICATION_JSON)
......
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
*/ */
public interface ManufacturerInfoMapper { public interface ManufacturerInfoMapper {
ManufacturerInfoPO selectByAbbr(@Param("abbr") String abbr); ManufacturerInfoPO selectByCode(@Param("code") String code);
ManufacturerInfoPO selectById(@Param("manufacturerId") Integer manufacturerId); ManufacturerInfoPO selectById(@Param("manufacturerId") Integer manufacturerId);
......
...@@ -104,7 +104,7 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -104,7 +104,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
private List<BaseCrossInfo> getBaseCrossInfoList(BasicEnum.ManufacturerEnum manufacturerEnum) { private List<BaseCrossInfo> getBaseCrossInfoList(BasicEnum.ManufacturerEnum manufacturerEnum) {
// 查询路口信息 // 查询路口信息
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr(manufacturerEnum.getCode()); ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByCode(manufacturerEnum.getCode());
Integer manufacturerId = manufacturerInfoPO.getId(); Integer manufacturerId = manufacturerInfoPO.getId();
List<CrossInfoPO> crossInfoPOList = crossInfoMapper.selectByManufacturerId(manufacturerId); List<CrossInfoPO> crossInfoPOList = crossInfoMapper.selectByManufacturerId(manufacturerId);
if (ListUtil.isEmpty(crossInfoPOList)) { if (ListUtil.isEmpty(crossInfoPOList)) {
......
...@@ -74,7 +74,7 @@ public class HkStaticInfoServiceImpl implements HkStaticInfoService { ...@@ -74,7 +74,7 @@ public class HkStaticInfoServiceImpl implements HkStaticInfoService {
crossInfoPO.setId(IdUtil.simpleUUID()); crossInfoPO.setId(IdUtil.simpleUUID());
crossInfoPO.setName(crossName); crossInfoPO.setName(crossName);
crossInfoPO.setCode(crossCode); crossInfoPO.setCode(crossCode);
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr( ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByCode(
BasicEnum.ManufacturerEnum.HK.getCode()); BasicEnum.ManufacturerEnum.HK.getCode());
if (manufacturerInfoPO != null) { if (manufacturerInfoPO != null) {
crossInfoPO.setManufacturerId(manufacturerInfoPO.getId()); crossInfoPO.setManufacturerId(manufacturerInfoPO.getId());
......
...@@ -69,7 +69,7 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -69,7 +69,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
crossInfoPO.setId(id); crossInfoPO.setId(id);
crossInfoPO.setName(vo.getCrossName()); crossInfoPO.setName(vo.getCrossName());
crossInfoPO.setCode(id); crossInfoPO.setCode(id);
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr(vo.getManufacturerCode()); ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByCode(vo.getManufacturerCode());
if (manufacturerInfoPO != null) { if (manufacturerInfoPO != null) {
crossInfoPO.setManufacturerId(manufacturerInfoPO.getId()); crossInfoPO.setManufacturerId(manufacturerInfoPO.getId());
} }
......
package net.wanji.utc.service.systemadmin; package net.wanji.utc.service.systemadmin;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import net.wanji.utc.po.CrossInfoPO;
import net.wanji.utc.vo.systemadmin.CrossInfoListInVO; import net.wanji.utc.vo.systemadmin.CrossInfoListInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListOutVO;
/** /**
* @author Kent HAN * @author Kent HAN
* @date 2022/11/25 8:54 * @date 2022/11/25 8:54
*/ */
public interface CrossInfoService { public interface CrossInfoService {
PageInfo<CrossInfoPO> list(CrossInfoListInVO crossInfoListInVO); PageInfo<CrossInfoListOutVO> list(CrossInfoListInVO crossInfoListInVO);
} }
...@@ -5,12 +5,16 @@ import com.github.pagehelper.PageInfo; ...@@ -5,12 +5,16 @@ import com.github.pagehelper.PageInfo;
import net.wanji.utc.mapper.CrossInfoMapper; import net.wanji.utc.mapper.CrossInfoMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper; import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.CrossInfoPO; import net.wanji.utc.po.CrossInfoPO;
import net.wanji.utc.po.ManufacturerApiInfoPO; import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.systemadmin.CrossInfoService; import net.wanji.utc.service.systemadmin.CrossInfoService;
import net.wanji.utc.util.PageUtils;
import net.wanji.utc.vo.systemadmin.CrossInfoListInVO; import net.wanji.utc.vo.systemadmin.CrossInfoListInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListOutVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -25,7 +29,7 @@ public class CrossInfoServiceImpl implements CrossInfoService { ...@@ -25,7 +29,7 @@ public class CrossInfoServiceImpl implements CrossInfoService {
CrossInfoMapper crossInfoMapper; CrossInfoMapper crossInfoMapper;
@Override @Override
public PageInfo<CrossInfoPO> list(CrossInfoListInVO crossInfoListInVO) { public PageInfo<CrossInfoListOutVO> list(CrossInfoListInVO crossInfoListInVO) {
Integer pageNum = crossInfoListInVO.getPageNum(); Integer pageNum = crossInfoListInVO.getPageNum();
Integer pageSize = crossInfoListInVO.getPageSize(); Integer pageSize = crossInfoListInVO.getPageSize();
...@@ -40,7 +44,18 @@ public class CrossInfoServiceImpl implements CrossInfoService { ...@@ -40,7 +44,18 @@ public class CrossInfoServiceImpl implements CrossInfoService {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<CrossInfoPO> crossInfoPOList = crossInfoMapper.selectByOptionals(crossName, manufacturerId); List<CrossInfoPO> crossInfoPOList = crossInfoMapper.selectByOptionals(crossName, manufacturerId);
PageInfo<CrossInfoPO> crossInfoPOPageInfo = new PageInfo<>(crossInfoPOList); PageInfo<CrossInfoPO> crossInfoPOPageInfo = new PageInfo<>(crossInfoPOList);
// 转换为VO类型的PageInfo对象
PageInfo<CrossInfoListOutVO> crossInfoListOutVOPageInfo = PageUtils.PageInfo2PageInfoVo(crossInfoPOPageInfo);
for (CrossInfoPO crossInfoPO : crossInfoPOList) {
CrossInfoListOutVO crossInfoListOutVO = new CrossInfoListOutVO();
BeanUtils.copyProperties(crossInfoPO, crossInfoListOutVO);
Integer manufacturerIdInPage = crossInfoPO.getManufacturerId();
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerIdInPage);
String nickName = manufacturerInfoPO.getNickName();
crossInfoListOutVO.setManufacturerNick(nickName);
crossInfoListOutVOPageInfo.getList().add(crossInfoListOutVO);
}
return crossInfoPOPageInfo; return crossInfoListOutVOPageInfo;
} }
} }
package net.wanji.utc.util;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
public class PageUtils{
/**
* 将PageInfo对象泛型中的Po对象转化为Vo对象
* @param pageInfoPo PageInfo<Po>对象</>
* @param <P> Po类型
* @param <V> Vo类型
* @return
*/
public static <P, V> PageInfo<V> PageInfo2PageInfoVo(PageInfo<P> pageInfoPo) {
// 创建Page对象,实际上是一个ArrayList类型的集合
Page<V> page = new Page<>(pageInfoPo.getPageNum(), pageInfoPo.getPageSize());
page.setTotal(pageInfoPo.getTotal());
return new PageInfo<>(page);
}
}
\ No newline at end of file
package net.wanji.utc.vo.systemadmin; package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -8,6 +9,7 @@ import lombok.Data; ...@@ -8,6 +9,7 @@ import lombok.Data;
* @date 2022/11/25 8:55 * @date 2022/11/25 8:55
*/ */
@Data @Data
@ApiModel(value = "CrossInfoListInVO", description = "信号机列表输入参数")
public class CrossInfoListInVO { public class CrossInfoListInVO {
@ApiModelProperty(required = true, value = "页号") @ApiModelProperty(required = true, value = "页号")
Integer pageNum; Integer pageNum;
......
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/11/25 10:03
*/
@Data
@ApiModel(value = "CrossInfoListOutVO", description = "信号机列表返回参数")
public class CrossInfoListOutVO {
@ApiModelProperty(value = "路口ID",notes = "")
private String id ;
/** 路口名称 */
@ApiModelProperty(value = "路口名称",notes = "")
private String name ;
/** 信号机编号 */
@ApiModelProperty(value = "信号机编号",notes = "")
private String code ;
/** 信号机厂商 */
@ApiModelProperty(value = "信号机厂商",notes = "")
private String manufacturerNick ;
/** 信号机IP */
@ApiModelProperty(value = "信号机IP",notes = "")
private String ip ;
/** 信号机端口 */
@ApiModelProperty(value = "信号机端口",notes = "")
private Integer port ;
/** 经纬度 */
@ApiModelProperty(value = "经纬度",notes = "")
private String location ;
/** 版本号 */
@ApiModelProperty(value = "版本号",notes = "")
private String version ;
/** 型号 */
@ApiModelProperty(value = "型号",notes = "")
private String model ;
/** 安装时间 */
@ApiModelProperty(value = "安装时间",notes = "")
private Date installTime ;
/** 创建时间 */
@ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ;
}
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
select id,name,code,manufacturer_id,ip,port,location,version,model,install_time,gmt_create,gmt_modified select id,name,code,manufacturer_id,ip,port,location,version,model,install_time,gmt_create,gmt_modified
from t_cross_info from t_cross_info
<where> <where>
<if test="crossName != null and name != ''"> <if test="crossName != null and crossName != ''">
AND name LIKE CONCAT('%',#{crossName},'%') AND name LIKE CONCAT('%',#{crossName},'%')
</if> </if>
<if test="manufacturerId != null and manufacturerId != 0"> <if test="manufacturerId != null and manufacturerId != 0">
......
...@@ -47,11 +47,11 @@ ...@@ -47,11 +47,11 @@
</foreach> </foreach>
</delete> </delete>
<select id="selectByAbbr" resultMap="BaseResultMap"> <select id="selectByCode" resultMap="BaseResultMap">
select select
id,code,name,nick_name,address,maintenance_unit,gmt_create,gmt_modified id,code,name,nick_name,address,maintenance_unit,gmt_create,gmt_modified
from t_manufacturer_info from t_manufacturer_info
where code = #{abbr} where code = #{code}
</select> </select>
<select id="selectById" resultMap="BaseResultMap"> <select id="selectById" resultMap="BaseResultMap">
......
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