Commit c5573592f34dee4f52686dceaa09f24d3bc8da8a

Authored by 戈灵虎
1 parent 60ebb332

feat(workorder): 优化事件信息创建和道路查询功能

urbanops-module-api/urbanops-module-garden-api/src/main/java/com/zteits/urbanops/module/garden/dto/road/RoadReqDTO.java
... ... @@ -22,4 +22,6 @@ public class RoadReqDTO {
22 22 @Schema(description = "维度", example = "121.40476")
23 23 private String latitude;
24 24  
  25 + @Schema(description = "道路名称", example = "中国")
  26 + private String roadName;
25 27 }
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/api/road/RoadApiImpl.java
... ... @@ -14,6 +14,7 @@ import jakarta.annotation.Resource;
14 14 import lombok.extern.slf4j.Slf4j;
15 15 import org.springframework.beans.factory.annotation.Value;
16 16 import org.springframework.stereotype.Service;
  17 +import org.springframework.util.StringUtils;
17 18  
18 19 import java.util.ArrayList;
19 20 import java.util.HashMap;
... ... @@ -44,9 +45,12 @@ public class RoadApiImpl implements RoadApi {
44 45 param.put("companyCode", reqDTO.getBusiLine());
45 46 param.put("longitude", reqDTO.getLongitude());
46 47 param.put("latitude", reqDTO.getLatitude());
  48 + if (StringUtils.hasText(reqDTO.getRoadName())) {
  49 + param.put("roadName", reqDTO.getRoadName());
  50 + }
47 51  
48 52 String responseBody = HttpUtils.post(roadInfoUrl, null, JSON.toJSONString(param));
49   - log.info("获取道路信息接口,系统:{},经度:{},维度:{},返回结果:{}", reqDTO.getBusiLine(), reqDTO.getLongitude(), reqDTO.getLatitude(), responseBody);
  53 + log.info("获取道路信息接口,系统:{},经度:{},维度:{},roadName:{},返回结果:{}", reqDTO.getBusiLine(), reqDTO.getLongitude(), reqDTO.getLatitude(), reqDTO.getRoadName(), responseBody);
50 54 JSONObject response = JSONUtil.parseObj(responseBody);
51 55 if (response.getInt("code") != 200) {
52 56 return new ArrayList<>();
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/eventinfo/AppEventInfoController.java
... ... @@ -61,13 +61,13 @@ public class AppEventInfoController {
61 61 return CommonResult.error(BAD_REQUEST, "子系统编码不能为空");
62 62 }
63 63  
64   - SysMappingEnum sys = SysMappingEnum.getBySysCode(companyCode);
  64 + String sys = SysMappingEnum.getNameBySysCode(companyCode);
65 65  
66 66 EventInfoSaveReqVO vo = new EventInfoSaveReqVO();
67 67 String eventNo = workOrderApi.generateWONum(EVENT_INFO_PREFFIX_UNIVERSE);
68 68 vo.setEventNo(eventNo);
69 69 vo.setEventStatus(EventStatusEnum.PENDING.getCode());
70   - vo.setBusiLine(sys.name().toLowerCase());
  70 + vo.setBusiLine(sys);
71 71 vo.setLon(createReqVO.getUserConfrimLon());
72 72 vo.setLat(createReqVO.getUserConfrimLat());
73 73 vo.setConfrimImgs(createReqVO.getUserConfrimImgs());
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/mysql/eventinfo/EventInfoMapper.java
... ... @@ -36,6 +36,7 @@ public interface EventInfoMapper extends BaseMapperX&lt;EventInfoDO&gt; {
36 36 .eqIfPresent(EventInfoDO::getEventStatus, reqVO.getEventStatus())
37 37 .likeIfPresent(EventInfoDO::getRemark, reqVO.getRemark())
38 38 .betweenIfPresent(EventInfoDO::getCreateTime, reqVO.getCreateTime())
  39 + .ne(EventInfoDO::getBusiLine, "sz")
39 40 .orderByDesc(EventInfoDO::getId));
40 41 }
41 42  
... ...
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/SysMappingEnum.java
... ... @@ -40,4 +40,14 @@ public enum SysMappingEnum {
40 40 }
41 41 throw new IllegalArgumentException("未知的系统: " + sysCode);
42 42 }
  43 +
  44 + public static String getNameBySysCode(String sysCode) {
  45 + for (SysMappingEnum node : values()) {
  46 + if (node.getSysCode().equals(sysCode) ) {
  47 + return node.name().toLowerCase();
  48 + }
  49 + }
  50 + return sysCode.toLowerCase();
  51 + }
  52 +
43 53 }
... ...