Commit 888c642c118ada60f721af6ad2192b5ce380deda
1 parent
4255a75d
工单管理代码提交
Showing
6 changed files
with
139 additions
and
1 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/api/road/RoadApi.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.api.road; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.module.garden.api.road.dto.RoadReqDTO; | ||
| 4 | +import com.zteits.urbanops.module.garden.api.road.dto.RoadRespDTO; | ||
| 5 | + | ||
| 6 | +import java.util.List; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @author yanhuiqing | ||
| 10 | + * @version 1.0 | ||
| 11 | + * @description: 道路api 通过经纬度 系统编码获取道路信息 | ||
| 12 | + * @date 2025/12/9 22:12 | ||
| 13 | + */ | ||
| 14 | +public interface RoadApi { | ||
| 15 | + public List<RoadRespDTO> getRoadInfoBy(RoadReqDTO reqDTO); | ||
| 16 | +} |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/api/road/RoadApiImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.api.road; | ||
| 2 | + | ||
| 3 | +import cn.hutool.json.JSONObject; | ||
| 4 | +import cn.hutool.json.JSONUtil; | ||
| 5 | +import com.alibaba.fastjson.JSON; | ||
| 6 | +import com.zteits.urbanops.framework.common.util.http.HttpUtils; | ||
| 7 | +import com.zteits.urbanops.module.garden.api.road.dto.RoadReqDTO; | ||
| 8 | +import com.zteits.urbanops.module.garden.api.road.dto.RoadRespDTO; | ||
| 9 | +import lombok.extern.slf4j.Slf4j; | ||
| 10 | +import org.springframework.beans.factory.annotation.Value; | ||
| 11 | +import org.springframework.stereotype.Service; | ||
| 12 | + | ||
| 13 | +import java.util.ArrayList; | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.List; | ||
| 16 | +import java.util.Map; | ||
| 17 | +import java.util.stream.Collectors; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * @author yanhuiqing | ||
| 21 | + * @version 1.0 | ||
| 22 | + * @description: 道路api实现类 | ||
| 23 | + * @date 2025/12/9 22:18 | ||
| 24 | + */ | ||
| 25 | +@Slf4j | ||
| 26 | +@Service | ||
| 27 | +public class RoadApiImpl implements RoadApi{ | ||
| 28 | + | ||
| 29 | + @Value("${siot.roadUrl}") | ||
| 30 | + private String roadInfoUrl; | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public List<RoadRespDTO> getRoadInfoBy(RoadReqDTO reqDTO) { | ||
| 34 | + Map<String, Object> param = new HashMap<>(); | ||
| 35 | + param.put("companyCode", reqDTO.getCompanyCode()); | ||
| 36 | + param.put("longitude", reqDTO.getLongitude()); | ||
| 37 | + param.put("latitude", reqDTO.getLatitude()); | ||
| 38 | + | ||
| 39 | + String responseBody = HttpUtils.post(roadInfoUrl, null, JSON.toJSONString(param)); | ||
| 40 | + log.info("获取道路信息接口,系统:{},经度:{},维度:{},返回结果:{}", reqDTO.getCompanyCode(), reqDTO.getLongitude(), reqDTO.getLatitude(), responseBody); | ||
| 41 | + JSONObject response = JSONUtil.parseObj(responseBody); | ||
| 42 | + if (response.getInt("code") != 200) { | ||
| 43 | + return new ArrayList<>(); | ||
| 44 | + } | ||
| 45 | + JSONObject data = response.getJSONObject("data"); | ||
| 46 | + if (data == null) { | ||
| 47 | + return new ArrayList<>(); | ||
| 48 | + } | ||
| 49 | + return data.getJSONArray("roadList").stream().map(item -> { | ||
| 50 | + JSONObject entries = JSONUtil.parseObj(item); | ||
| 51 | + RoadRespDTO roadInfo = new RoadRespDTO(); | ||
| 52 | + roadInfo.setRoadCode(entries.getStr("roadCode")); | ||
| 53 | + roadInfo.setRoadName(entries.getStr("roadName")); | ||
| 54 | + return roadInfo; | ||
| 55 | + }).collect(Collectors.toList()); | ||
| 56 | + } | ||
| 57 | +} |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/api/road/dto/RoadReqDTO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.api.road.dto; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @author yanhuiqing | ||
| 9 | + * @version 1.0 | ||
| 10 | + * @description: TODO | ||
| 11 | + * @date 2025/12/9 22:43 | ||
| 12 | + */ | ||
| 13 | +@Data | ||
| 14 | +public class RoadReqDTO { | ||
| 15 | + @NotNull | ||
| 16 | + @Schema(description = "系统编码", example = "sls") | ||
| 17 | + private String companyCode; | ||
| 18 | + @NotNull | ||
| 19 | + @Schema(description = "经度", example = "44.962685") | ||
| 20 | + private String longitude; | ||
| 21 | + @NotNull | ||
| 22 | + @Schema(description = "维度", example = "121.40476") | ||
| 23 | + private String latitude; | ||
| 24 | + | ||
| 25 | +} |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/api/road/dto/RoadRespDTO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.api.road.dto; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @author yanhuiqing | ||
| 7 | + * @version 1.0 | ||
| 8 | + * @description: TODO | ||
| 9 | + * @date 2025/12/9 22:21 | ||
| 10 | + */ | ||
| 11 | +@Data | ||
| 12 | +public class RoadRespDTO { | ||
| 13 | + /** | ||
| 14 | + * 道路编码 | ||
| 15 | + */ | ||
| 16 | + private String roadCode; | ||
| 17 | + /** | ||
| 18 | + * 道路名称 | ||
| 19 | + */ | ||
| 20 | + private String roadName; | ||
| 21 | +} |
urbanops-module-workorder/pom.xml
| @@ -131,7 +131,12 @@ | @@ -131,7 +131,12 @@ | ||
| 131 | <artifactId>urbanops-module-bpm</artifactId> | 131 | <artifactId>urbanops-module-bpm</artifactId> |
| 132 | <version>${revision}</version> | 132 | <version>${revision}</version> |
| 133 | </dependency> | 133 | </dependency> |
| 134 | - | 134 | + <dependency> |
| 135 | + <groupId>com.zteits.boot</groupId> | ||
| 136 | + <artifactId>urbanops-module-garden</artifactId> | ||
| 137 | + <version>${revision}</version> | ||
| 138 | + <scope>compile</scope> | ||
| 139 | + </dependency> | ||
| 135 | </dependencies> | 140 | </dependencies> |
| 136 | 141 | ||
| 137 | </project> | 142 | </project> |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/AppGardenWorkOrderController.java
| @@ -3,6 +3,9 @@ package com.zteits.urbanops.module.workorder.controller.app.garden; | @@ -3,6 +3,9 @@ package com.zteits.urbanops.module.workorder.controller.app.garden; | ||
| 3 | import com.zteits.urbanops.framework.common.pojo.CommonResult; | 3 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 4 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 4 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 5 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; | 5 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 6 | +import com.zteits.urbanops.module.garden.api.road.RoadApi; | ||
| 7 | +import com.zteits.urbanops.module.garden.api.road.dto.RoadReqDTO; | ||
| 8 | +import com.zteits.urbanops.module.garden.api.road.dto.RoadRespDTO; | ||
| 6 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; | 9 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; |
| 7 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderRespVO; | 10 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderRespVO; |
| 8 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.AppGardenWorkOrderPageReqVO; | 11 | import com.zteits.urbanops.module.workorder.controller.app.garden.vo.AppGardenWorkOrderPageReqVO; |
| @@ -18,6 +21,8 @@ import jakarta.validation.Valid; | @@ -18,6 +21,8 @@ import jakarta.validation.Valid; | ||
| 18 | import org.springframework.security.access.prepost.PreAuthorize; | 21 | import org.springframework.security.access.prepost.PreAuthorize; |
| 19 | import org.springframework.web.bind.annotation.*; | 22 | import org.springframework.web.bind.annotation.*; |
| 20 | 23 | ||
| 24 | +import java.util.List; | ||
| 25 | + | ||
| 21 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | 26 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; |
| 22 | import static com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 27 | import static com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 23 | 28 | ||
| @@ -33,6 +38,8 @@ import static com.zteits.urbanops.framework.security.core.util.SecurityFramework | @@ -33,6 +38,8 @@ import static com.zteits.urbanops.framework.security.core.util.SecurityFramework | ||
| 33 | public class AppGardenWorkOrderController { | 38 | public class AppGardenWorkOrderController { |
| 34 | @Resource | 39 | @Resource |
| 35 | private BpmGardenService gardenService; | 40 | private BpmGardenService gardenService; |
| 41 | + @Resource | ||
| 42 | + private RoadApi roadApi; | ||
| 36 | 43 | ||
| 37 | @PostMapping("/create") | 44 | @PostMapping("/create") |
| 38 | //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:create')") | 45 | //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:create')") |
| @@ -65,4 +72,11 @@ public class AppGardenWorkOrderController { | @@ -65,4 +72,11 @@ public class AppGardenWorkOrderController { | ||
| 65 | return success(BeanUtils.toBean(pageResult, AppGardenWorkOrderRespVO.class)); | 72 | return success(BeanUtils.toBean(pageResult, AppGardenWorkOrderRespVO.class)); |
| 66 | } | 73 | } |
| 67 | 74 | ||
| 75 | + @GetMapping("/listRoadInfo") | ||
| 76 | + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:query')") | ||
| 77 | + @Operation(summary = "app-获取道路信息") | ||
| 78 | + public List<RoadRespDTO> getRoadInfoBy(@Valid RoadReqDTO reqDTO) { | ||
| 79 | + return roadApi.getRoadInfoBy(reqDTO); | ||
| 80 | + } | ||
| 81 | + | ||
| 68 | } | 82 | } |