Commit b1c66b3d52ff229a9c1a3a1c5ca3717119e6f954
全域巡查员流程 和业务线变动改造
Showing
46 changed files
with
2838 additions
and
384 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/tree/vo/TreeSaveReqVO.java
| @@ -106,21 +106,18 @@ public class TreeSaveReqVO { | @@ -106,21 +106,18 @@ public class TreeSaveReqVO { | ||
| 106 | private String createby; | 106 | private String createby; |
| 107 | 107 | ||
| 108 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 108 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 109 | - @NotNull(message = "创建时间不能为空") | ||
| 110 | private LocalDateTime createtime; | 109 | private LocalDateTime createtime; |
| 111 | 110 | ||
| 112 | @Schema(description = "更新者") | 111 | @Schema(description = "更新者") |
| 113 | private String updateby; | 112 | private String updateby; |
| 114 | 113 | ||
| 115 | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) | 114 | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 116 | - @NotNull(message = "更新时间不能为空") | ||
| 117 | private LocalDateTime updatetime; | 115 | private LocalDateTime updatetime; |
| 118 | 116 | ||
| 119 | @Schema(description = "备注", example = "你说的对") | 117 | @Schema(description = "备注", example = "你说的对") |
| 120 | private String remark; | 118 | private String remark; |
| 121 | 119 | ||
| 122 | @Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17101") | 120 | @Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17101") |
| 123 | - @NotNull(message = "部门id不能为空") | ||
| 124 | private Long deptId; | 121 | private Long deptId; |
| 125 | 122 | ||
| 126 | private List<String> treeImgList; | 123 | private List<String> treeImgList; |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/tree/TreeServiceImpl.java
| @@ -89,17 +89,17 @@ public class TreeServiceImpl implements TreeService { | @@ -89,17 +89,17 @@ public class TreeServiceImpl implements TreeService { | ||
| 89 | tree.setTreenumber(treeNum); | 89 | tree.setTreenumber(treeNum); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | + treeMapper.insert(tree); | ||
| 93 | + | ||
| 92 | TreeChangeLogDO changeLog = new TreeChangeLogDO(); | 94 | TreeChangeLogDO changeLog = new TreeChangeLogDO(); |
| 93 | org.springframework.beans.BeanUtils.copyProperties(createReqVO, changeLog); | 95 | org.springframework.beans.BeanUtils.copyProperties(createReqVO, changeLog); |
| 94 | - changeLog.setTreeid(createReqVO.getId()); | 96 | + changeLog.setTreeid(tree.getId()); |
| 95 | changeLog.setCreateby(createReqVO.getCreateby()); | 97 | changeLog.setCreateby(createReqVO.getCreateby()); |
| 96 | changeLog.setCreatetime(LocalDateTime.now()); | 98 | changeLog.setCreatetime(LocalDateTime.now()); |
| 97 | changeLog.setUpdateby(createReqVO.getCreateby()); | 99 | changeLog.setUpdateby(createReqVO.getCreateby()); |
| 98 | changeLog.setUpdatetime(LocalDateTime.now()); | 100 | changeLog.setUpdatetime(LocalDateTime.now()); |
| 99 | gardenTreeChangeLogMapper.insert(changeLog); | 101 | gardenTreeChangeLogMapper.insert(changeLog); |
| 100 | 102 | ||
| 101 | - treeMapper.insert(tree); | ||
| 102 | - | ||
| 103 | // 返回 | 103 | // 返回 |
| 104 | return tree.getId(); | 104 | return tree.getId(); |
| 105 | } | 105 | } |
urbanops-module-gloabl/src/main/java/com/zteits/urbanops/module/gloabl/api/ProblemsApiController.java
| 1 | -package com.zteits.urbanops.module.gloabl.api; | ||
| 2 | - | ||
| 3 | -import com.zteits.urbanops.framework.common.pojo.CommonResult; | ||
| 4 | -import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 5 | -import com.zteits.urbanops.module.gloabl.constants.SysMappingEnum; | ||
| 6 | -import com.zteits.urbanops.module.gloabl.controller.admin.problems.vo.ProblemsApiSaveReqVO; | ||
| 7 | -import com.zteits.urbanops.module.gloabl.controller.admin.problems.vo.ProblemsSaveReqVO; | ||
| 8 | -import com.zteits.urbanops.module.gloabl.service.geocode.GeoCodeService; | ||
| 9 | -import com.zteits.urbanops.module.gloabl.service.problems.ProblemsService; | ||
| 10 | -import io.swagger.v3.oas.annotations.Operation; | ||
| 11 | -import jakarta.annotation.Resource; | ||
| 12 | -import jakarta.annotation.security.PermitAll; | ||
| 13 | -import jakarta.validation.Valid; | ||
| 14 | -import lombok.RequiredArgsConstructor; | ||
| 15 | -import org.springframework.util.StringUtils; | ||
| 16 | -import org.springframework.web.bind.annotation.PostMapping; | ||
| 17 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 18 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 19 | -import org.springframework.web.bind.annotation.RestController; | ||
| 20 | - | ||
| 21 | -import java.time.LocalDateTime; | ||
| 22 | - | ||
| 23 | -import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; | ||
| 24 | - | ||
| 25 | - | ||
| 26 | -/** | ||
| 27 | - * Description: <p></p> | ||
| 28 | - * <p> | ||
| 29 | - * Author: gelinghu | ||
| 30 | - * Date: 2025年6月15 11:56 | ||
| 31 | - */ | ||
| 32 | -@RestController | ||
| 33 | -@RequestMapping({"/gloabl/problems","/problems"}) | ||
| 34 | -@RequiredArgsConstructor | ||
| 35 | -public class ProblemsApiController { | ||
| 36 | - | ||
| 37 | - @Resource | ||
| 38 | - private ProblemsService problemsService; | ||
| 39 | - | ||
| 40 | - @Resource | ||
| 41 | - private GeoCodeService geoCodeService; | ||
| 42 | - | ||
| 43 | - /** | ||
| 44 | - * { | ||
| 45 | - * "problemName": "问题名称", | ||
| 46 | - * "userConfrimRemark": "问题描述", | ||
| 47 | - * "userConfrimImgs": [], //问题照片 | ||
| 48 | - * "userConfrimLat": "经度", | ||
| 49 | - * "userConfrimLon": "维度", | ||
| 50 | - * "companyCode": "", //业务系统编码,和统一认证保持一致,智慧园林:sls,智慧市政:sms | ||
| 51 | - * } | ||
| 52 | - * @param createReqVO | ||
| 53 | - * @return | ||
| 54 | - */ | ||
| 55 | - @PostMapping("") | ||
| 56 | - @Operation(summary = "创建事件表--问题单") | ||
| 57 | - @PermitAll | ||
| 58 | - public CommonResult<String> createProblems(@Valid @RequestBody ProblemsApiSaveReqVO createReqVO) { | ||
| 59 | - createReqVO.setProblemSourceId(6); | ||
| 60 | - String companyCode = createReqVO.getCompanyCode(); | ||
| 61 | - if (!StringUtils.hasText(companyCode)) { | ||
| 62 | - return CommonResult.error(BAD_REQUEST, "子系统编码不能为空"); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - SysMappingEnum sys = SysMappingEnum.getBySysCode(companyCode); | ||
| 66 | - createReqVO.setCompanyCode(sys.name().toLowerCase()); | ||
| 67 | - createReqVO.setCompanyName(sys.getDescription()); | ||
| 68 | - createReqVO.setCreateBy("ai"); | ||
| 69 | - createReqVO.setCreateTime(LocalDateTime.now()); | ||
| 70 | - createReqVO.setUpdateBy("ai"); | ||
| 71 | - createReqVO.setUpdateTime(LocalDateTime.now()); | ||
| 72 | - | ||
| 73 | - ProblemsSaveReqVO vo = new ProblemsSaveReqVO(); | ||
| 74 | - BeanUtils.copyProperties(createReqVO, vo); | ||
| 75 | - vo.setCompanyNo(createReqVO.getCompanyCode()); | ||
| 76 | - // 调用高德API根据经纬度查询地址 | ||
| 77 | - if (createReqVO.getUserConfrimLat() != null && createReqVO.getUserConfrimLon() != null) { | ||
| 78 | - try { | ||
| 79 | - String address = geoCodeService.getAddressByLocation(createReqVO.getUserConfrimLat(), createReqVO.getUserConfrimLon()); | ||
| 80 | - if (StringUtils.hasText(address)) { | ||
| 81 | - vo.setUserConfrimAddr(address); | ||
| 82 | - } | ||
| 83 | - } catch (Exception e) { | ||
| 84 | - // 地址查询失败时不影响主流程,记录日志即可 | ||
| 85 | - // log.warn("根据经纬度查询地址失败: lat={}, lon={}", createReqVO.getUserConfrimLat(), createReqVO.getUserConfrimLon(), e); | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - return CommonResult.success(problemsService.createProblemsWithProblemNo(vo)); | ||
| 89 | - } | ||
| 90 | -} | ||
| 91 | - | ||
| 92 | - | 1 | +//package com.zteits.urbanops.module.gloabl.api; |
| 2 | +// | ||
| 3 | +//import com.zteits.urbanops.framework.common.pojo.CommonResult; | ||
| 4 | +//import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 5 | +//import com.zteits.urbanops.module.gloabl.constants.SysMappingEnum; | ||
| 6 | +//import com.zteits.urbanops.module.gloabl.controller.admin.problems.vo.ProblemsApiSaveReqVO; | ||
| 7 | +//import com.zteits.urbanops.module.gloabl.controller.admin.problems.vo.ProblemsSaveReqVO; | ||
| 8 | +//import com.zteits.urbanops.module.gloabl.service.geocode.GeoCodeService; | ||
| 9 | +//import com.zteits.urbanops.module.gloabl.service.problems.ProblemsService; | ||
| 10 | +//import io.swagger.v3.oas.annotations.Operation; | ||
| 11 | +//import jakarta.annotation.Resource; | ||
| 12 | +//import jakarta.annotation.security.PermitAll; | ||
| 13 | +//import jakarta.validation.Valid; | ||
| 14 | +//import lombok.RequiredArgsConstructor; | ||
| 15 | +//import org.springframework.util.StringUtils; | ||
| 16 | +//import org.springframework.web.bind.annotation.PostMapping; | ||
| 17 | +//import org.springframework.web.bind.annotation.RequestBody; | ||
| 18 | +//import org.springframework.web.bind.annotation.RequestMapping; | ||
| 19 | +//import org.springframework.web.bind.annotation.RestController; | ||
| 20 | +// | ||
| 21 | +//import java.time.LocalDateTime; | ||
| 22 | +// | ||
| 23 | +//import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; | ||
| 24 | +// | ||
| 25 | +// | ||
| 26 | +///** | ||
| 27 | +// * Description: <p></p> | ||
| 28 | +// * <p> | ||
| 29 | +// * Author: gelinghu | ||
| 30 | +// * Date: 2025年6月15 11:56 | ||
| 31 | +// */ | ||
| 32 | +//@RestController | ||
| 33 | +//@RequestMapping({"/gloabl/problems","/problems"}) | ||
| 34 | +//@RequiredArgsConstructor | ||
| 35 | +//public class ProblemsApiController { | ||
| 36 | +// | ||
| 37 | +// @Resource | ||
| 38 | +// private ProblemsService problemsService; | ||
| 39 | +// | ||
| 40 | +// @Resource | ||
| 41 | +// private GeoCodeService geoCodeService; | ||
| 42 | +// | ||
| 43 | +// /** | ||
| 44 | +// * { | ||
| 45 | +// * "problemName": "问题名称", | ||
| 46 | +// * "userConfrimRemark": "问题描述", | ||
| 47 | +// * "userConfrimImgs": [], //问题照片 | ||
| 48 | +// * "userConfrimLat": "经度", | ||
| 49 | +// * "userConfrimLon": "维度", | ||
| 50 | +// * "companyCode": "", //业务系统编码,和统一认证保持一致,智慧园林:sls,智慧市政:sms | ||
| 51 | +// * } | ||
| 52 | +// * @param createReqVO | ||
| 53 | +// * @return | ||
| 54 | +// */ | ||
| 55 | +// @PostMapping("") | ||
| 56 | +// @Operation(summary = "创建事件表--问题单") | ||
| 57 | +// @PermitAll | ||
| 58 | +// public CommonResult<String> createProblems(@Valid @RequestBody ProblemsApiSaveReqVO createReqVO) { | ||
| 59 | +// createReqVO.setProblemSourceId(6); | ||
| 60 | +// String companyCode = createReqVO.getCompanyCode(); | ||
| 61 | +// if (!StringUtils.hasText(companyCode)) { | ||
| 62 | +// return CommonResult.error(BAD_REQUEST, "子系统编码不能为空"); | ||
| 63 | +// } | ||
| 64 | +// | ||
| 65 | +// SysMappingEnum sys = SysMappingEnum.getBySysCode(companyCode); | ||
| 66 | +// createReqVO.setCompanyCode(sys.name().toLowerCase()); | ||
| 67 | +// createReqVO.setCompanyName(sys.getDescription()); | ||
| 68 | +// createReqVO.setCreateBy("ai"); | ||
| 69 | +// createReqVO.setCreateTime(LocalDateTime.now()); | ||
| 70 | +// createReqVO.setUpdateBy("ai"); | ||
| 71 | +// createReqVO.setUpdateTime(LocalDateTime.now()); | ||
| 72 | +// | ||
| 73 | +// ProblemsSaveReqVO vo = new ProblemsSaveReqVO(); | ||
| 74 | +// BeanUtils.copyProperties(createReqVO, vo); | ||
| 75 | +// vo.setCompanyNo(createReqVO.getCompanyCode()); | ||
| 76 | +// // 调用高德API根据经纬度查询地址 | ||
| 77 | +// if (createReqVO.getUserConfrimLat() != null && createReqVO.getUserConfrimLon() != null) { | ||
| 78 | +// try { | ||
| 79 | +// String address = geoCodeService.getAddressByLocation(createReqVO.getUserConfrimLat(), createReqVO.getUserConfrimLon()); | ||
| 80 | +// if (StringUtils.hasText(address)) { | ||
| 81 | +// vo.setUserConfrimAddr(address); | ||
| 82 | +// } | ||
| 83 | +// } catch (Exception e) { | ||
| 84 | +// // 地址查询失败时不影响主流程,记录日志即可 | ||
| 85 | +// // log.warn("根据经纬度查询地址失败: lat={}, lon={}", createReqVO.getUserConfrimLat(), createReqVO.getUserConfrimLon(), e); | ||
| 86 | +// } | ||
| 87 | +// } | ||
| 88 | +// return CommonResult.success(problemsService.createProblemsWithProblemNo(vo)); | ||
| 89 | +// } | ||
| 90 | +//} | ||
| 91 | +// | ||
| 92 | +// |
urbanops-module-gloabl/src/main/java/com/zteits/urbanops/module/gloabl/config/AmapConfiguration.java
| 1 | -package com.zteits.urbanops.module.gloabl.config; | ||
| 2 | - | ||
| 3 | -import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| 4 | -import org.springframework.context.annotation.Configuration; | ||
| 5 | - | ||
| 6 | -/** | ||
| 7 | - * 高德地图配置类 | ||
| 8 | - * | ||
| 9 | - * @author gelinghu | ||
| 10 | - */ | ||
| 11 | -@Configuration | ||
| 12 | -@EnableConfigurationProperties({AmapProperties.class}) | ||
| 13 | -public class AmapConfiguration { | ||
| 14 | -} | 1 | +//package com.zteits.urbanops.module.gloabl.config; |
| 2 | +// | ||
| 3 | +//import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| 4 | +//import org.springframework.context.annotation.Configuration; | ||
| 5 | +// | ||
| 6 | +///** | ||
| 7 | +// * 高德地图配置类 | ||
| 8 | +// * | ||
| 9 | +// * @author gelinghu | ||
| 10 | +// */ | ||
| 11 | +//@Configuration | ||
| 12 | +//@EnableConfigurationProperties({AmapProperties.class}) | ||
| 13 | +//public class AmapConfiguration { | ||
| 14 | +//} |
urbanops-module-gloabl/src/main/java/com/zteits/urbanops/module/gloabl/config/AmapProperties.java
| 1 | -package com.zteits.urbanops.module.gloabl.config; | ||
| 2 | - | ||
| 3 | -import jakarta.validation.constraints.NotBlank; | ||
| 4 | -import lombok.Data; | ||
| 5 | -import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| 6 | -import org.springframework.validation.annotation.Validated; | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * 高德地图 API 配置属性 | ||
| 11 | - * | ||
| 12 | - * @author gelinghu | ||
| 13 | - */ | ||
| 14 | -@Data | ||
| 15 | -@Validated | ||
| 16 | -@ConfigurationProperties(prefix = "amap") | ||
| 17 | -public class AmapProperties { | ||
| 18 | - | ||
| 19 | - /** | ||
| 20 | - * 高德地图 Web 服务 API Key | ||
| 21 | - */ | ||
| 22 | - @NotBlank(message = "高德地图 API Key 不能为空") | ||
| 23 | - private String apiKey; | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * 私钥(用于数字签名,可选) | ||
| 27 | - * 注意:这不是必需的,高德API默认只需要Key | ||
| 28 | - * 只有在需要使用数字签名时才配置此参数 | ||
| 29 | - */ | ||
| 30 | - private String privateKey; | ||
| 31 | - | ||
| 32 | - /** | ||
| 33 | - * 是否启用数字签名 | ||
| 34 | - */ | ||
| 35 | - private Boolean enableSignature = false; | ||
| 36 | - | ||
| 37 | - /** | ||
| 38 | - * 地理编码 API 地址 | ||
| 39 | - */ | ||
| 40 | - private String geocodeUrl = "https://restapi.amap.com/v3/geocode/regeo"; | ||
| 41 | - | ||
| 42 | - /** | ||
| 43 | - * 超时时间(毫秒) | ||
| 44 | - */ | ||
| 45 | - private Integer timeout = 5000; | ||
| 46 | - | ||
| 47 | - /** | ||
| 48 | - * 是否启用 | ||
| 49 | - */ | ||
| 50 | - private Boolean enabled = true; | ||
| 51 | -} | 1 | +//package com.zteits.urbanops.module.gloabl.config; |
| 2 | +// | ||
| 3 | +//import jakarta.validation.constraints.NotBlank; | ||
| 4 | +//import lombok.Data; | ||
| 5 | +//import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| 6 | +//import org.springframework.validation.annotation.Validated; | ||
| 7 | +// | ||
| 8 | +// | ||
| 9 | +///** | ||
| 10 | +// * 高德地图 API 配置属性 | ||
| 11 | +// * | ||
| 12 | +// * @author gelinghu | ||
| 13 | +// */ | ||
| 14 | +//@Data | ||
| 15 | +//@Validated | ||
| 16 | +//@ConfigurationProperties(prefix = "amap") | ||
| 17 | +//public class AmapProperties { | ||
| 18 | +// | ||
| 19 | +// /** | ||
| 20 | +// * 高德地图 Web 服务 API Key | ||
| 21 | +// */ | ||
| 22 | +// @NotBlank(message = "高德地图 API Key 不能为空") | ||
| 23 | +// private String apiKey; | ||
| 24 | +// | ||
| 25 | +// /** | ||
| 26 | +// * 私钥(用于数字签名,可选) | ||
| 27 | +// * 注意:这不是必需的,高德API默认只需要Key | ||
| 28 | +// * 只有在需要使用数字签名时才配置此参数 | ||
| 29 | +// */ | ||
| 30 | +// private String privateKey; | ||
| 31 | +// | ||
| 32 | +// /** | ||
| 33 | +// * 是否启用数字签名 | ||
| 34 | +// */ | ||
| 35 | +// private Boolean enableSignature = false; | ||
| 36 | +// | ||
| 37 | +// /** | ||
| 38 | +// * 地理编码 API 地址 | ||
| 39 | +// */ | ||
| 40 | +// private String geocodeUrl = "https://restapi.amap.com/v3/geocode/regeo"; | ||
| 41 | +// | ||
| 42 | +// /** | ||
| 43 | +// * 超时时间(毫秒) | ||
| 44 | +// */ | ||
| 45 | +// private Integer timeout = 5000; | ||
| 46 | +// | ||
| 47 | +// /** | ||
| 48 | +// * 是否启用 | ||
| 49 | +// */ | ||
| 50 | +// private Boolean enabled = true; | ||
| 51 | +//} |
urbanops-module-gloabl/src/main/java/com/zteits/urbanops/module/gloabl/service/geocode/GeoCodeService.java
| 1 | -package com.zteits.urbanops.module.gloabl.service.geocode; | ||
| 2 | - | ||
| 3 | -import java.math.BigDecimal; | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * 地理编码服务接口 | ||
| 7 | - * | ||
| 8 | - * @author gelinghu | ||
| 9 | - */ | ||
| 10 | -public interface GeoCodeService { | ||
| 11 | - | ||
| 12 | - /** | ||
| 13 | - * 根据经纬度获取详细地址 | ||
| 14 | - * | ||
| 15 | - * @param latitude 纬度 | ||
| 16 | - * @param longitude 经度 | ||
| 17 | - * @return 详细地址,如果获取失败返回 null | ||
| 18 | - */ | ||
| 19 | - String getAddressByLocation(BigDecimal latitude, BigDecimal longitude); | ||
| 20 | -} | 1 | +//package com.zteits.urbanops.module.gloabl.service.geocode; |
| 2 | +// | ||
| 3 | +//import java.math.BigDecimal; | ||
| 4 | +// | ||
| 5 | +///** | ||
| 6 | +// * 地理编码服务接口 | ||
| 7 | +// * | ||
| 8 | +// * @author gelinghu | ||
| 9 | +// */ | ||
| 10 | +//public interface GeoCodeService { | ||
| 11 | +// | ||
| 12 | +// /** | ||
| 13 | +// * 根据经纬度获取详细地址 | ||
| 14 | +// * | ||
| 15 | +// * @param latitude 纬度 | ||
| 16 | +// * @param longitude 经度 | ||
| 17 | +// * @return 详细地址,如果获取失败返回 null | ||
| 18 | +// */ | ||
| 19 | +// String getAddressByLocation(BigDecimal latitude, BigDecimal longitude); | ||
| 20 | +//} |
urbanops-module-gloabl/src/main/java/com/zteits/urbanops/module/gloabl/service/geocode/impl/AmapGeoCodeServiceImpl.java
| 1 | -package com.zteits.urbanops.module.gloabl.service.geocode.impl; | ||
| 2 | - | ||
| 3 | -import cn.hutool.core.util.StrUtil; | ||
| 4 | -import cn.hutool.crypto.digest.MD5; | ||
| 5 | -import cn.hutool.json.JSONObject; | ||
| 6 | -import cn.hutool.json.JSONUtil; | ||
| 7 | - | ||
| 8 | -import com.zteits.urbanops.framework.common.util.http.HttpUtils; | ||
| 9 | -import com.zteits.urbanops.module.gloabl.config.AmapProperties; | ||
| 10 | -import com.zteits.urbanops.module.gloabl.service.geocode.GeoCodeService; | ||
| 11 | -import lombok.RequiredArgsConstructor; | ||
| 12 | -import lombok.extern.slf4j.Slf4j; | ||
| 13 | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
| 14 | -import org.springframework.stereotype.Service; | ||
| 15 | - | ||
| 16 | -import java.math.BigDecimal; | ||
| 17 | -import java.net.URLEncoder; | ||
| 18 | -import java.nio.charset.StandardCharsets; | ||
| 19 | -import java.util.HashMap; | ||
| 20 | -import java.util.Map; | ||
| 21 | -import java.util.TreeMap; | ||
| 22 | - | ||
| 23 | -/** | ||
| 24 | - * 高德地理编码服务实现 | ||
| 25 | - * | ||
| 26 | - * @author gelinghu | ||
| 27 | - */ | ||
| 28 | -@Slf4j | ||
| 29 | -@Service | ||
| 30 | -@RequiredArgsConstructor | ||
| 31 | -@ConditionalOnProperty(prefix = "amap", name = "enabled", havingValue = "true", matchIfMissing = true) | ||
| 32 | -public class AmapGeoCodeServiceImpl implements GeoCodeService { | ||
| 33 | - | ||
| 34 | - private final AmapProperties amapProperties; | ||
| 35 | - | ||
| 36 | - @Override | ||
| 37 | - public String getAddressByLocation(BigDecimal latitude, BigDecimal longitude) { | ||
| 38 | - if (latitude == null || longitude == null) { | ||
| 39 | - log.warn("[getAddressByLocation] 经纬度不能为空: lat={}, lon={}", latitude, longitude); | ||
| 40 | - return null; | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - try { | ||
| 44 | - // 将 BigDecimal 转换为 Double | ||
| 45 | - Double lat = latitude.doubleValue(); | ||
| 46 | - Double lon = longitude.doubleValue(); | ||
| 47 | - | ||
| 48 | - // 1. 构建请求参数 | ||
| 49 | - Map<String, String> params = buildRequestParams(lon, lat); | ||
| 50 | - | ||
| 51 | - // 2. 构建完整的请求 URL | ||
| 52 | - String url = buildRequestUrl(params); | ||
| 53 | - | ||
| 54 | - // 3. 发起 HTTP 请求 | ||
| 55 | - String responseBody = HttpUtils.get(url); | ||
| 56 | - if (StrUtil.isBlank(responseBody)) { | ||
| 57 | - log.warn("[getAddressByLocation] 高德API响应为空: lat={}, lon={}", latitude, longitude); | ||
| 58 | - return null; | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - // 4. 解析响应结果 | ||
| 62 | - return parseResponse(responseBody, latitude, longitude); | ||
| 63 | - | ||
| 64 | - } catch (Exception e) { | ||
| 65 | - log.error("[getAddressByLocation] 调用高德地理编码API异常: lat={}, lon={}", latitude, longitude, e); | ||
| 66 | - return null; | ||
| 67 | - } | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - /** | ||
| 71 | - * 构建请求参数 | ||
| 72 | - */ | ||
| 73 | - private Map<String, String> buildRequestParams(Double longitude, Double latitude) { | ||
| 74 | - Map<String, String> params = new HashMap<>(); | ||
| 75 | - params.put("key", amapProperties.getApiKey()); | ||
| 76 | - params.put("location", longitude + "," + latitude); | ||
| 77 | - params.put("poitype", ""); // 返回附近POI类型 | ||
| 78 | - params.put("radius", "1000"); // 搜索半径,单位:米 | ||
| 79 | - params.put("extensions", "base"); // 返回结果控制,base:返回基本地址信息;all:返回地址信息及附近POI、道路、交叉口等信息 | ||
| 80 | - params.put("batch", "false"); // 批量查询控制 | ||
| 81 | - params.put("roadlevel", "0"); // 道路等级 | ||
| 82 | - | ||
| 83 | - // 如果启用了数字签名,则添加签名参数 | ||
| 84 | - if (Boolean.TRUE.equals(amapProperties.getEnableSignature()) && | ||
| 85 | - StrUtil.isNotBlank(amapProperties.getPrivateKey())) { | ||
| 86 | - String signature = generateSignature(params, amapProperties.getPrivateKey()); | ||
| 87 | - params.put("sig", signature); | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - return params; | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - * 构建完整的请求 URL | ||
| 95 | - */ | ||
| 96 | - private String buildRequestUrl(Map<String, String> params) { | ||
| 97 | - StringBuilder url = new StringBuilder(amapProperties.getGeocodeUrl()); | ||
| 98 | - url.append("?"); | ||
| 99 | - | ||
| 100 | - boolean first = true; | ||
| 101 | - for (Map.Entry<String, String> entry : params.entrySet()) { | ||
| 102 | - if (!first) { | ||
| 103 | - url.append("&"); | ||
| 104 | - } | ||
| 105 | - try { | ||
| 106 | - url.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString())); | ||
| 107 | - } catch (Exception e) { | ||
| 108 | - url.append(entry.getKey()).append("=").append(entry.getValue()); | ||
| 109 | - } | ||
| 110 | - first = false; | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - return url.toString(); | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - /** | ||
| 117 | - * 生成数字签名 | ||
| 118 | - * 高德API数字签名算法: | ||
| 119 | - * 1. 将请求参数按ASCII码升序排列 | ||
| 120 | - * 2. 使用URL键值对的格式拼接 | ||
| 121 | - * 3. 在字符串最后拼接上私钥 | ||
| 122 | - * 4. 对整个字符串进行MD5加密 | ||
| 123 | - * | ||
| 124 | - * @param params 请求参数 | ||
| 125 | - * @param privateKey 私钥 | ||
| 126 | - * @return 签名字符串 | ||
| 127 | - */ | ||
| 128 | - private String generateSignature(Map<String, String> params, String privateKey) { | ||
| 129 | - try { | ||
| 130 | - // 使用TreeMap自动按key排序 | ||
| 131 | - TreeMap<String, String> sortedParams = new TreeMap<>(params); | ||
| 132 | - | ||
| 133 | - // 构建签名字符串 | ||
| 134 | - StringBuilder signStr = new StringBuilder(); | ||
| 135 | - boolean first = true; | ||
| 136 | - | ||
| 137 | - for (Map.Entry<String, String> entry : sortedParams.entrySet()) { | ||
| 138 | - if (!first) { | ||
| 139 | - signStr.append("&"); | ||
| 140 | - } | ||
| 141 | - signStr.append(entry.getKey()).append("=").append(entry.getValue()); | ||
| 142 | - first = false; | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | - // 在最后拼接私钥 | ||
| 146 | - signStr.append(privateKey); | ||
| 147 | - | ||
| 148 | - // 对整个字符串进行MD5加密 | ||
| 149 | - String signature = MD5.create().digestHex(signStr.toString()); | ||
| 150 | - | ||
| 151 | - log.debug("[generateSignature] 签名字符串: {}, 签名结果: {}", signStr.toString(), signature); | ||
| 152 | - | ||
| 153 | - return signature; | ||
| 154 | - | ||
| 155 | - } catch (Exception e) { | ||
| 156 | - log.error("[generateSignature] 生成数字签名异常", e); | ||
| 157 | - return ""; | ||
| 158 | - } | ||
| 159 | - } | ||
| 160 | - | ||
| 161 | - /** | ||
| 162 | - * 解析响应结果 | ||
| 163 | - */ | ||
| 164 | - private String parseResponse(String responseBody, BigDecimal latitude, BigDecimal longitude) { | ||
| 165 | - try { | ||
| 166 | - JSONObject response = JSONUtil.parseObj(responseBody); | ||
| 167 | - | ||
| 168 | - // 检查状态码 | ||
| 169 | - String status = response.getStr("status"); | ||
| 170 | - if (!"1".equals(status)) { | ||
| 171 | - String info = response.getStr("info"); | ||
| 172 | - log.warn("[getAddressByLocation] 高德API返回错误: status={}, info={}, lat={}, lon={}", | ||
| 173 | - status, info, latitude, longitude); | ||
| 174 | - return null; | ||
| 175 | - } | ||
| 176 | - | ||
| 177 | - // 解析地址信息 | ||
| 178 | - JSONObject regeocode = response.getJSONObject("regeocode"); | ||
| 179 | - if (regeocode == null) { | ||
| 180 | - log.warn("[getAddressByLocation] 高德API未返回地址信息: lat={}, lon={}", latitude, longitude); | ||
| 181 | - return null; | ||
| 182 | - } | ||
| 183 | - | ||
| 184 | - String formattedAddress = regeocode.getStr("formatted_address"); | ||
| 185 | - if (StrUtil.isNotBlank(formattedAddress)) { | ||
| 186 | - log.info("[getAddressByLocation] 成功获取地址: lat={}, lon={}, address={}", | ||
| 187 | - latitude, longitude, formattedAddress); | ||
| 188 | - return formattedAddress; | ||
| 189 | - } | ||
| 190 | - | ||
| 191 | - log.warn("[getAddressByLocation] 高德API返回的地址为空: lat={}, lon={}", latitude, longitude); | ||
| 192 | - return null; | ||
| 193 | - | ||
| 194 | - } catch (Exception e) { | ||
| 195 | - log.error("[getAddressByLocation] 解析高德API响应异常: lat={}, lon={}, response={}", | ||
| 196 | - latitude, longitude, responseBody, e); | ||
| 197 | - return null; | ||
| 198 | - } | ||
| 199 | - } | ||
| 200 | -} | 1 | +//package com.zteits.urbanops.module.gloabl.service.geocode.impl; |
| 2 | +// | ||
| 3 | +//import cn.hutool.core.util.StrUtil; | ||
| 4 | +//import cn.hutool.crypto.digest.MD5; | ||
| 5 | +//import cn.hutool.json.JSONObject; | ||
| 6 | +//import cn.hutool.json.JSONUtil; | ||
| 7 | +// | ||
| 8 | +//import com.zteits.urbanops.framework.common.util.http.HttpUtils; | ||
| 9 | +//import com.zteits.urbanops.module.gloabl.config.AmapProperties; | ||
| 10 | +//import com.zteits.urbanops.module.gloabl.service.geocode.GeoCodeService; | ||
| 11 | +//import lombok.RequiredArgsConstructor; | ||
| 12 | +//import lombok.extern.slf4j.Slf4j; | ||
| 13 | +//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
| 14 | +//import org.springframework.stereotype.Service; | ||
| 15 | +// | ||
| 16 | +//import java.math.BigDecimal; | ||
| 17 | +//import java.net.URLEncoder; | ||
| 18 | +//import java.nio.charset.StandardCharsets; | ||
| 19 | +//import java.util.HashMap; | ||
| 20 | +//import java.util.Map; | ||
| 21 | +//import java.util.TreeMap; | ||
| 22 | +// | ||
| 23 | +///** | ||
| 24 | +// * 高德地理编码服务实现 | ||
| 25 | +// * | ||
| 26 | +// * @author gelinghu | ||
| 27 | +// */ | ||
| 28 | +//@Slf4j | ||
| 29 | +//@Service | ||
| 30 | +//@RequiredArgsConstructor | ||
| 31 | +//@ConditionalOnProperty(prefix = "amap", name = "enabled", havingValue = "true", matchIfMissing = true) | ||
| 32 | +//public class AmapGeoCodeServiceImpl implements GeoCodeService { | ||
| 33 | +// | ||
| 34 | +// private final AmapProperties amapProperties; | ||
| 35 | +// | ||
| 36 | +// @Override | ||
| 37 | +// public String getAddressByLocation(BigDecimal latitude, BigDecimal longitude) { | ||
| 38 | +// if (latitude == null || longitude == null) { | ||
| 39 | +// log.warn("[getAddressByLocation] 经纬度不能为空: lat={}, lon={}", latitude, longitude); | ||
| 40 | +// return null; | ||
| 41 | +// } | ||
| 42 | +// | ||
| 43 | +// try { | ||
| 44 | +// // 将 BigDecimal 转换为 Double | ||
| 45 | +// Double lat = latitude.doubleValue(); | ||
| 46 | +// Double lon = longitude.doubleValue(); | ||
| 47 | +// | ||
| 48 | +// // 1. 构建请求参数 | ||
| 49 | +// Map<String, String> params = buildRequestParams(lon, lat); | ||
| 50 | +// | ||
| 51 | +// // 2. 构建完整的请求 URL | ||
| 52 | +// String url = buildRequestUrl(params); | ||
| 53 | +// | ||
| 54 | +// // 3. 发起 HTTP 请求 | ||
| 55 | +// String responseBody = HttpUtils.get(url); | ||
| 56 | +// if (StrUtil.isBlank(responseBody)) { | ||
| 57 | +// log.warn("[getAddressByLocation] 高德API响应为空: lat={}, lon={}", latitude, longitude); | ||
| 58 | +// return null; | ||
| 59 | +// } | ||
| 60 | +// | ||
| 61 | +// // 4. 解析响应结果 | ||
| 62 | +// return parseResponse(responseBody, latitude, longitude); | ||
| 63 | +// | ||
| 64 | +// } catch (Exception e) { | ||
| 65 | +// log.error("[getAddressByLocation] 调用高德地理编码API异常: lat={}, lon={}", latitude, longitude, e); | ||
| 66 | +// return null; | ||
| 67 | +// } | ||
| 68 | +// } | ||
| 69 | +// | ||
| 70 | +// /** | ||
| 71 | +// * 构建请求参数 | ||
| 72 | +// */ | ||
| 73 | +// private Map<String, String> buildRequestParams(Double longitude, Double latitude) { | ||
| 74 | +// Map<String, String> params = new HashMap<>(); | ||
| 75 | +// params.put("key", amapProperties.getApiKey()); | ||
| 76 | +// params.put("location", longitude + "," + latitude); | ||
| 77 | +// params.put("poitype", ""); // 返回附近POI类型 | ||
| 78 | +// params.put("radius", "1000"); // 搜索半径,单位:米 | ||
| 79 | +// params.put("extensions", "base"); // 返回结果控制,base:返回基本地址信息;all:返回地址信息及附近POI、道路、交叉口等信息 | ||
| 80 | +// params.put("batch", "false"); // 批量查询控制 | ||
| 81 | +// params.put("roadlevel", "0"); // 道路等级 | ||
| 82 | +// | ||
| 83 | +// // 如果启用了数字签名,则添加签名参数 | ||
| 84 | +// if (Boolean.TRUE.equals(amapProperties.getEnableSignature()) && | ||
| 85 | +// StrUtil.isNotBlank(amapProperties.getPrivateKey())) { | ||
| 86 | +// String signature = generateSignature(params, amapProperties.getPrivateKey()); | ||
| 87 | +// params.put("sig", signature); | ||
| 88 | +// } | ||
| 89 | +// | ||
| 90 | +// return params; | ||
| 91 | +// } | ||
| 92 | +// | ||
| 93 | +// /** | ||
| 94 | +// * 构建完整的请求 URL | ||
| 95 | +// */ | ||
| 96 | +// private String buildRequestUrl(Map<String, String> params) { | ||
| 97 | +// StringBuilder url = new StringBuilder(amapProperties.getGeocodeUrl()); | ||
| 98 | +// url.append("?"); | ||
| 99 | +// | ||
| 100 | +// boolean first = true; | ||
| 101 | +// for (Map.Entry<String, String> entry : params.entrySet()) { | ||
| 102 | +// if (!first) { | ||
| 103 | +// url.append("&"); | ||
| 104 | +// } | ||
| 105 | +// try { | ||
| 106 | +// url.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString())); | ||
| 107 | +// } catch (Exception e) { | ||
| 108 | +// url.append(entry.getKey()).append("=").append(entry.getValue()); | ||
| 109 | +// } | ||
| 110 | +// first = false; | ||
| 111 | +// } | ||
| 112 | +// | ||
| 113 | +// return url.toString(); | ||
| 114 | +// } | ||
| 115 | +// | ||
| 116 | +// /** | ||
| 117 | +// * 生成数字签名 | ||
| 118 | +// * 高德API数字签名算法: | ||
| 119 | +// * 1. 将请求参数按ASCII码升序排列 | ||
| 120 | +// * 2. 使用URL键值对的格式拼接 | ||
| 121 | +// * 3. 在字符串最后拼接上私钥 | ||
| 122 | +// * 4. 对整个字符串进行MD5加密 | ||
| 123 | +// * | ||
| 124 | +// * @param params 请求参数 | ||
| 125 | +// * @param privateKey 私钥 | ||
| 126 | +// * @return 签名字符串 | ||
| 127 | +// */ | ||
| 128 | +// private String generateSignature(Map<String, String> params, String privateKey) { | ||
| 129 | +// try { | ||
| 130 | +// // 使用TreeMap自动按key排序 | ||
| 131 | +// TreeMap<String, String> sortedParams = new TreeMap<>(params); | ||
| 132 | +// | ||
| 133 | +// // 构建签名字符串 | ||
| 134 | +// StringBuilder signStr = new StringBuilder(); | ||
| 135 | +// boolean first = true; | ||
| 136 | +// | ||
| 137 | +// for (Map.Entry<String, String> entry : sortedParams.entrySet()) { | ||
| 138 | +// if (!first) { | ||
| 139 | +// signStr.append("&"); | ||
| 140 | +// } | ||
| 141 | +// signStr.append(entry.getKey()).append("=").append(entry.getValue()); | ||
| 142 | +// first = false; | ||
| 143 | +// } | ||
| 144 | +// | ||
| 145 | +// // 在最后拼接私钥 | ||
| 146 | +// signStr.append(privateKey); | ||
| 147 | +// | ||
| 148 | +// // 对整个字符串进行MD5加密 | ||
| 149 | +// String signature = MD5.create().digestHex(signStr.toString()); | ||
| 150 | +// | ||
| 151 | +// log.debug("[generateSignature] 签名字符串: {}, 签名结果: {}", signStr.toString(), signature); | ||
| 152 | +// | ||
| 153 | +// return signature; | ||
| 154 | +// | ||
| 155 | +// } catch (Exception e) { | ||
| 156 | +// log.error("[generateSignature] 生成数字签名异常", e); | ||
| 157 | +// return ""; | ||
| 158 | +// } | ||
| 159 | +// } | ||
| 160 | +// | ||
| 161 | +// /** | ||
| 162 | +// * 解析响应结果 | ||
| 163 | +// */ | ||
| 164 | +// private String parseResponse(String responseBody, BigDecimal latitude, BigDecimal longitude) { | ||
| 165 | +// try { | ||
| 166 | +// JSONObject response = JSONUtil.parseObj(responseBody); | ||
| 167 | +// | ||
| 168 | +// // 检查状态码 | ||
| 169 | +// String status = response.getStr("status"); | ||
| 170 | +// if (!"1".equals(status)) { | ||
| 171 | +// String info = response.getStr("info"); | ||
| 172 | +// log.warn("[getAddressByLocation] 高德API返回错误: status={}, info={}, lat={}, lon={}", | ||
| 173 | +// status, info, latitude, longitude); | ||
| 174 | +// return null; | ||
| 175 | +// } | ||
| 176 | +// | ||
| 177 | +// // 解析地址信息 | ||
| 178 | +// JSONObject regeocode = response.getJSONObject("regeocode"); | ||
| 179 | +// if (regeocode == null) { | ||
| 180 | +// log.warn("[getAddressByLocation] 高德API未返回地址信息: lat={}, lon={}", latitude, longitude); | ||
| 181 | +// return null; | ||
| 182 | +// } | ||
| 183 | +// | ||
| 184 | +// String formattedAddress = regeocode.getStr("formatted_address"); | ||
| 185 | +// if (StrUtil.isNotBlank(formattedAddress)) { | ||
| 186 | +// log.info("[getAddressByLocation] 成功获取地址: lat={}, lon={}, address={}", | ||
| 187 | +// latitude, longitude, formattedAddress); | ||
| 188 | +// return formattedAddress; | ||
| 189 | +// } | ||
| 190 | +// | ||
| 191 | +// log.warn("[getAddressByLocation] 高德API返回的地址为空: lat={}, lon={}", latitude, longitude); | ||
| 192 | +// return null; | ||
| 193 | +// | ||
| 194 | +// } catch (Exception e) { | ||
| 195 | +// log.error("[getAddressByLocation] 解析高德API响应异常: lat={}, lon={}, response={}", | ||
| 196 | +// latitude, longitude, responseBody, e); | ||
| 197 | +// return null; | ||
| 198 | +// } | ||
| 199 | +// } | ||
| 200 | +//} |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/controller/admin/user/vo/user/UserPageReqVO.java
| @@ -41,4 +41,10 @@ public class UserPageReqVO extends PageParam { | @@ -41,4 +41,10 @@ public class UserPageReqVO extends PageParam { | ||
| 41 | @Schema(description = "业务线:yl-园林;wy-物业;sz-市政", example = "yl") | 41 | @Schema(description = "业务线:yl-园林;wy-物业;sz-市政", example = "yl") |
| 42 | private String busiLine; | 42 | private String busiLine; |
| 43 | 43 | ||
| 44 | + /** | ||
| 45 | + * 是否是内部员工 是否内部员工 1:是;2否 | ||
| 46 | + */ | ||
| 47 | + @Schema(description = "是否是内部员工 1:是;2否", example = "1") | ||
| 48 | + private Integer isInner; | ||
| 49 | + | ||
| 44 | } | 50 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/controller/admin/user/vo/user/UserRespVO.java
| @@ -74,4 +74,16 @@ public class UserRespVO{ | @@ -74,4 +74,16 @@ public class UserRespVO{ | ||
| 74 | private LocalDateTime createTime; | 74 | private LocalDateTime createTime; |
| 75 | @Schema(description = "业务线:yl-园林;wy-物业;sz-市政", example = "yl") | 75 | @Schema(description = "业务线:yl-园林;wy-物业;sz-市政", example = "yl") |
| 76 | private String busiLine; | 76 | private String busiLine; |
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 是否是内部员工 是否内部员工 1:是;2否 | ||
| 80 | + */ | ||
| 81 | + @Schema(description = "是否是内部员工 是否内部员工 1:是;2否", example = "时间戳格式") | ||
| 82 | + private Integer isInner; | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 供应商编码 | ||
| 86 | + */ | ||
| 87 | + @Schema(description = "供应商编码", example = "供应商编码") | ||
| 88 | + private String supplierCode; | ||
| 77 | } | 89 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/controller/admin/user/vo/user/UserSaveReqVO.java
| @@ -80,4 +80,16 @@ public class UserSaveReqVO { | @@ -80,4 +80,16 @@ public class UserSaveReqVO { | ||
| 80 | @DiffLogField(name = "业务线") | 80 | @DiffLogField(name = "业务线") |
| 81 | @NotNull(message = "业务线不能为空") | 81 | @NotNull(message = "业务线不能为空") |
| 82 | private String busiLine; | 82 | private String busiLine; |
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 是否是内部员工 是否内部员工 1:是;2否 | ||
| 86 | + */ | ||
| 87 | + @Schema(description = "是否是内部员工 1:是;2否", example = "1") | ||
| 88 | + private Integer isInner; | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * 供应商编码 | ||
| 92 | + */ | ||
| 93 | + @Schema(description = "供应商编码", example = "1") | ||
| 94 | + private String supplierCode; | ||
| 83 | } | 95 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/dal/dataobject/user/AdminUserDO.java
| @@ -105,4 +105,16 @@ public class AdminUserDO extends TenantBaseDO { | @@ -105,4 +105,16 @@ public class AdminUserDO extends TenantBaseDO { | ||
| 105 | */ | 105 | */ |
| 106 | private LocalDateTime loginDate; | 106 | private LocalDateTime loginDate; |
| 107 | 107 | ||
| 108 | + /** | ||
| 109 | + * 是否是内部员工 是否内部员工 1:是;2否 | ||
| 110 | + */ | ||
| 111 | + private Integer isInner; | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * 供应商编码 | ||
| 115 | + */ | ||
| 116 | + private String supplierCode; | ||
| 117 | + | ||
| 118 | + | ||
| 119 | + | ||
| 108 | } | 120 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/dal/mysql/user/AdminUserMapper.java
| @@ -33,6 +33,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> { | @@ -33,6 +33,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> { | ||
| 33 | .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime()) | 33 | .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime()) |
| 34 | .inIfPresent(AdminUserDO::getDeptId, deptIds) | 34 | .inIfPresent(AdminUserDO::getDeptId, deptIds) |
| 35 | .inIfPresent(AdminUserDO::getId, userIds) | 35 | .inIfPresent(AdminUserDO::getId, userIds) |
| 36 | + .eqIfPresent(AdminUserDO::getIsInner, reqVO.getIsInner()) | ||
| 36 | .orderByDesc(AdminUserDO::getId)); | 37 | .orderByDesc(AdminUserDO::getId)); |
| 37 | } | 38 | } |
| 38 | 39 |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/api/constant/BpmCommonConstant.java
| @@ -125,6 +125,10 @@ public class BpmCommonConstant { | @@ -125,6 +125,10 @@ public class BpmCommonConstant { | ||
| 125 | * 全域工单流程前缀 | 125 | * 全域工单流程前缀 |
| 126 | */ | 126 | */ |
| 127 | public static final String WORK_ORDER_PREFFIX_UNIVERSE = "UWO"; | 127 | public static final String WORK_ORDER_PREFFIX_UNIVERSE = "UWO"; |
| 128 | + /** | ||
| 129 | + * 全域工单事件前缀 | ||
| 130 | + */ | ||
| 131 | + public static final String EVENT_INFO_PREFFIX_UNIVERSE = "PRB"; | ||
| 128 | 132 | ||
| 129 | /** | 133 | /** |
| 130 | * 全域大区经理工单编号前缀 | 134 | * 全域大区经理工单编号前缀 |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/config/AmapConfiguration.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.config; | ||
| 2 | + | ||
| 3 | +import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| 4 | +import org.springframework.context.annotation.Configuration; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 高德地图配置类 | ||
| 8 | + * | ||
| 9 | + * @author gelinghu | ||
| 10 | + */ | ||
| 11 | +@Configuration | ||
| 12 | +@EnableConfigurationProperties({AmapProperties.class}) | ||
| 13 | +public class AmapConfiguration { | ||
| 14 | +} | ||
| 0 | \ No newline at end of file | 15 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/config/AmapProperties.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.config; | ||
| 2 | + | ||
| 3 | +import jakarta.validation.constraints.NotBlank; | ||
| 4 | +import lombok.Data; | ||
| 5 | +import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| 6 | +import org.springframework.validation.annotation.Validated; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 高德地图 API 配置属性 | ||
| 11 | + * | ||
| 12 | + * @author gelinghu | ||
| 13 | + */ | ||
| 14 | +@Data | ||
| 15 | +@Validated | ||
| 16 | +@ConfigurationProperties(prefix = "amap") | ||
| 17 | +public class AmapProperties { | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 高德地图 Web 服务 API Key | ||
| 21 | + */ | ||
| 22 | + @NotBlank(message = "高德地图 API Key 不能为空") | ||
| 23 | + private String apiKey; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 私钥(用于数字签名,可选) | ||
| 27 | + * 注意:这不是必需的,高德API默认只需要Key | ||
| 28 | + * 只有在需要使用数字签名时才配置此参数 | ||
| 29 | + */ | ||
| 30 | + private String privateKey; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 是否启用数字签名 | ||
| 34 | + */ | ||
| 35 | + private Boolean enableSignature = false; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 地理编码 API 地址 | ||
| 39 | + */ | ||
| 40 | + private String geocodeUrl = "https://restapi.amap.com/v3/geocode/regeo"; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 超时时间(毫秒) | ||
| 44 | + */ | ||
| 45 | + private Integer timeout = 5000; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 是否启用 | ||
| 49 | + */ | ||
| 50 | + private Boolean enabled = true; | ||
| 51 | +} | ||
| 0 | \ No newline at end of file | 52 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/EventInfoController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.eventinfo; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.module.garden.api.road.RoadApi; | ||
| 4 | +import com.zteits.urbanops.module.garden.dto.road.RoadReqDTO; | ||
| 5 | +import com.zteits.urbanops.module.garden.dto.road.RoadRespDTO; | ||
| 6 | +import org.springframework.web.bind.annotation.*; | ||
| 7 | +import jakarta.annotation.Resource; | ||
| 8 | +import org.springframework.validation.annotation.Validated; | ||
| 9 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 11 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 12 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 13 | + | ||
| 14 | +import jakarta.validation.constraints.*; | ||
| 15 | +import jakarta.validation.*; | ||
| 16 | +import jakarta.servlet.http.*; | ||
| 17 | +import java.util.*; | ||
| 18 | +import java.io.IOException; | ||
| 19 | + | ||
| 20 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 21 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 22 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | ||
| 23 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 24 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | ||
| 25 | + | ||
| 26 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | ||
| 27 | + | ||
| 28 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | ||
| 29 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | ||
| 30 | + | ||
| 31 | +import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.*; | ||
| 32 | +import com.zteits.urbanops.module.workorder.dal.dataobject.eventinfo.EventInfoDO; | ||
| 33 | +import com.zteits.urbanops.module.workorder.service.eventinfo.EventInfoService; | ||
| 34 | + | ||
| 35 | +@Tag(name = "管理后台 - 工单事件") | ||
| 36 | +@RestController | ||
| 37 | +@RequestMapping("/workorder/event-info") | ||
| 38 | +@Validated | ||
| 39 | +public class EventInfoController { | ||
| 40 | + | ||
| 41 | + @Resource | ||
| 42 | + private EventInfoService eventInfoService; | ||
| 43 | + | ||
| 44 | + @Resource | ||
| 45 | + private RoadApi roadApi; | ||
| 46 | + | ||
| 47 | + @GetMapping("/listRoadInfo") | ||
| 48 | + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:query')") | ||
| 49 | + @Operation(summary = "app-获取道路信息") | ||
| 50 | + public CommonResult<List<RoadRespDTO>> getRoadInfoBy(@Valid RoadReqDTO reqDTO) { | ||
| 51 | + return success(roadApi.getRoadInfoBy(reqDTO)); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @PostMapping("/create") | ||
| 55 | + @Operation(summary = "创建工单事件") | ||
| 56 | + @PreAuthorize("@ss.hasPermission('workorder:event-info:create')") | ||
| 57 | + public CommonResult<Long> createEventInfo(@Valid @RequestBody EventInfoSaveReqVO createReqVO) { | ||
| 58 | + return success(eventInfoService.createEventInfo(createReqVO)); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @PutMapping("/update") | ||
| 62 | + @Operation(summary = "更新工单事件") | ||
| 63 | + @PreAuthorize("@ss.hasPermission('workorder:event-info:update')") | ||
| 64 | + public CommonResult<Boolean> updateEventInfo(@Valid @RequestBody EventInfoSaveReqVO updateReqVO) { | ||
| 65 | + eventInfoService.updateEventInfo(updateReqVO); | ||
| 66 | + return success(true); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @PutMapping("/end") | ||
| 70 | + @Operation(summary = "结束工单事件") | ||
| 71 | + @PreAuthorize("@ss.hasPermission('workorder:event-info:end')") | ||
| 72 | + public CommonResult<Boolean> endEventInfo(@Valid @RequestParam("id") Long id) { | ||
| 73 | + eventInfoService.endEventInfo(id); | ||
| 74 | + return success(true); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @PostMapping("/order") | ||
| 78 | + @Operation(summary = "创建事件对应工单") | ||
| 79 | + @PreAuthorize("@ss.hasPermission('workorder:event-info:order')") | ||
| 80 | + public CommonResult<Boolean> createEventOrderInfo(@Valid @RequestBody EventOrderInfoSaveReqVO createReqVO) { | ||
| 81 | + eventInfoService.createEventOrderInfo(createReqVO); | ||
| 82 | + return success(true); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @DeleteMapping("/delete") | ||
| 86 | + @Operation(summary = "删除工单事件") | ||
| 87 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 88 | + @PreAuthorize("@ss.hasPermission('workorder:event-info:delete')") | ||
| 89 | + public CommonResult<Boolean> deleteEventInfo(@RequestParam("id") Long id) { | ||
| 90 | + eventInfoService.deleteEventInfo(id); | ||
| 91 | + return success(true); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @DeleteMapping("/delete-list") | ||
| 95 | + @Parameter(name = "ids", description = "编号", required = true) | ||
| 96 | + @Operation(summary = "批量删除工单事件") | ||
| 97 | + @PreAuthorize("@ss.hasPermission('workorder:event-info:delete')") | ||
| 98 | + public CommonResult<Boolean> deleteEventInfoList(@RequestParam("ids") List<Long> ids) { | ||
| 99 | + eventInfoService.deleteEventInfoListByIds(ids); | ||
| 100 | + return success(true); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + @GetMapping("/get") | ||
| 104 | + @Operation(summary = "获得工单事件") | ||
| 105 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 106 | + @PreAuthorize("@ss.hasPermission('workorder:event-info:query')") | ||
| 107 | + public CommonResult<EventInfoRespVO> getEventInfo(@RequestParam("id") Long id) { | ||
| 108 | + EventInfoDO eventInfo = eventInfoService.getEventInfo(id); | ||
| 109 | + return success(BeanUtils.toBean(eventInfo, EventInfoRespVO.class)); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + @GetMapping("/page") | ||
| 113 | + @Operation(summary = "获得工单事件分页") | ||
| 114 | + @PreAuthorize("@ss.hasPermission('workorder:event-info:query')") | ||
| 115 | + public CommonResult<PageResult<EventInfoRespVO>> getEventInfoPage(@Valid EventInfoPageReqVO pageReqVO) { | ||
| 116 | + PageResult<EventInfoDO> pageResult = eventInfoService.getEventInfoPage(pageReqVO); | ||
| 117 | + return success(BeanUtils.toBean(pageResult, EventInfoRespVO.class)); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + @GetMapping("/export-excel") | ||
| 121 | + @Operation(summary = "导出工单事件 Excel") | ||
| 122 | + @PreAuthorize("@ss.hasPermission('workorder:event-info:export')") | ||
| 123 | + @ApiAccessLog(operateType = EXPORT) | ||
| 124 | + public void exportEventInfoExcel(@Valid EventInfoPageReqVO pageReqVO, | ||
| 125 | + HttpServletResponse response) throws IOException { | ||
| 126 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 127 | + List<EventInfoDO> list = eventInfoService.getEventInfoPage(pageReqVO).getList(); | ||
| 128 | + // 导出 Excel | ||
| 129 | + ExcelUtils.write(response, "工单事件.xls", "数据", EventInfoRespVO.class, | ||
| 130 | + BeanUtils.toBean(list, EventInfoRespVO.class)); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | +} | ||
| 0 | \ No newline at end of file | 134 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/vo/EventInfoPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | + | ||
| 11 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - 工单事件分页 Request VO") | ||
| 14 | +@Data | ||
| 15 | +public class EventInfoPageReqVO extends PageParam { | ||
| 16 | + | ||
| 17 | + @Schema(description = "业务线:yl 园林,wy 物业,sz 市政 ") | ||
| 18 | + private String busiLine; | ||
| 19 | + | ||
| 20 | + @Schema(description = "事件编号") | ||
| 21 | + private String eventNo; | ||
| 22 | + | ||
| 23 | + @Schema(description = "事件名称", example = "王五") | ||
| 24 | + private String evetName; | ||
| 25 | + | ||
| 26 | + @Schema(description = "事件设备", example = "王五") | ||
| 27 | + private String eventDevice; | ||
| 28 | + | ||
| 29 | + @Schema(description = "事件设备编码", example = "王五") | ||
| 30 | + private String eventDeviceCode; | ||
| 31 | + | ||
| 32 | + @Schema(description = "提交时间") | ||
| 33 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 34 | + private LocalDateTime[] commitDate; | ||
| 35 | + | ||
| 36 | + @Schema(description = "完成时间") | ||
| 37 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 38 | + private LocalDateTime[] finishDate; | ||
| 39 | + | ||
| 40 | + @Schema(description = "经纬度类型: 1:国标; 2:百度;3:高德;4:腾讯", example = "1") | ||
| 41 | + private Integer latLonType; | ||
| 42 | + | ||
| 43 | + @Schema(description = "经度") | ||
| 44 | + private BigDecimal lat; | ||
| 45 | + | ||
| 46 | + @Schema(description = "维度") | ||
| 47 | + private BigDecimal lon; | ||
| 48 | + | ||
| 49 | + @Schema(description = "经纬度地址") | ||
| 50 | + private String lonLatAddress; | ||
| 51 | + | ||
| 52 | + @Schema(description = "用户提交照片") | ||
| 53 | + private String confrimImgs; | ||
| 54 | + | ||
| 55 | + @Schema(description = "事件状态", example = "1") | ||
| 56 | + private Integer eventStatus; | ||
| 57 | + | ||
| 58 | + @Schema(description = "事件描述", example = "你说的对") | ||
| 59 | + private String remark; | ||
| 60 | + | ||
| 61 | + @Schema(description = "创建时间") | ||
| 62 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 63 | + private LocalDateTime[] createTime; | ||
| 64 | + | ||
| 65 | +} | ||
| 0 | \ No newline at end of file | 66 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/vo/EventInfoRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import cn.idev.excel.annotation.*; | ||
| 10 | + | ||
| 11 | +@Schema(description = "管理后台 - 工单事件 Response VO") | ||
| 12 | +@Data | ||
| 13 | +@ExcelIgnoreUnannotated | ||
| 14 | +public class EventInfoRespVO { | ||
| 15 | + | ||
| 16 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24349") | ||
| 17 | + @ExcelProperty("ID") | ||
| 18 | + private Long id; | ||
| 19 | + | ||
| 20 | + @Schema(description = "业务线:yl 园林,wy 物业,sz 市政 ", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 21 | + @ExcelProperty("业务线:yl 园林,wy 物业,sz 市政 ") | ||
| 22 | + private String busiLine; | ||
| 23 | + | ||
| 24 | + @Schema(description = "事件编号", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 25 | + @ExcelProperty("事件编号") | ||
| 26 | + private String eventNo; | ||
| 27 | + | ||
| 28 | + @Schema(description = "事件名称", example = "王五") | ||
| 29 | + @ExcelProperty("事件名称") | ||
| 30 | + private String evetName; | ||
| 31 | + | ||
| 32 | + @Schema(description = "事件设备", example = "王五") | ||
| 33 | + @ExcelProperty("事件设备") | ||
| 34 | + private String eventDevice; | ||
| 35 | + | ||
| 36 | + @Schema(description = "事件设备编码", example = "王五") | ||
| 37 | + @ExcelProperty("事件设备编码") | ||
| 38 | + private String eventDeviceCode; | ||
| 39 | + | ||
| 40 | + @Schema(description = "提交时间") | ||
| 41 | + @ExcelProperty("提交时间") | ||
| 42 | + private LocalDateTime commitDate; | ||
| 43 | + | ||
| 44 | + @Schema(description = "完成时间") | ||
| 45 | + @ExcelProperty("完成时间") | ||
| 46 | + private LocalDateTime finishDate; | ||
| 47 | + | ||
| 48 | + @Schema(description = "经纬度类型: 1:国标; 2:百度;3:高德;4:腾讯", example = "1") | ||
| 49 | + @ExcelProperty("经纬度类型: 1:国标; 2:百度;3:高德;4:腾讯") | ||
| 50 | + private Integer latLonType; | ||
| 51 | + | ||
| 52 | + @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 53 | + @ExcelProperty("经度") | ||
| 54 | + private BigDecimal lat; | ||
| 55 | + | ||
| 56 | + @Schema(description = "维度", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 57 | + @ExcelProperty("维度") | ||
| 58 | + private BigDecimal lon; | ||
| 59 | + | ||
| 60 | + @Schema(description = "经纬度地址", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 61 | + @ExcelProperty("经纬度地址") | ||
| 62 | + private String lonLatAddress; | ||
| 63 | + | ||
| 64 | + @Schema(description = "用户提交照片", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 65 | + @ExcelProperty("用户提交照片") | ||
| 66 | + private String confrimImgs; | ||
| 67 | + | ||
| 68 | + @Schema(description = "事件状态", example = "1") | ||
| 69 | + @ExcelProperty("事件状态") | ||
| 70 | + private Integer eventStatus; | ||
| 71 | + | ||
| 72 | + @Schema(description = "事件描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | ||
| 73 | + @ExcelProperty("事件描述") | ||
| 74 | + private String remark; | ||
| 75 | + | ||
| 76 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 77 | + @ExcelProperty("创建时间") | ||
| 78 | + private LocalDateTime createTime; | ||
| 79 | + | ||
| 80 | + @Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 81 | + @ExcelProperty("创建人") | ||
| 82 | + private String creator; | ||
| 83 | + | ||
| 84 | + | ||
| 85 | + | ||
| 86 | +} | ||
| 0 | \ No newline at end of file | 87 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/vo/EventInfoSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import lombok.*; | ||
| 7 | +import java.util.*; | ||
| 8 | +import jakarta.validation.constraints.*; | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | + | ||
| 11 | +import org.apache.ibatis.type.JdbcType; | ||
| 12 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 13 | +import java.time.LocalDateTime; | ||
| 14 | + | ||
| 15 | +@Schema(description = "管理后台 - 工单事件新增/修改 Request VO") | ||
| 16 | +@Data | ||
| 17 | +public class EventInfoSaveReqVO { | ||
| 18 | + | ||
| 19 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24349") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "业务线:yl 园林,wy 物业,sz 市政 ", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 23 | + @NotEmpty(message = "业务线:yl 园林,wy 物业,sz 市政 不能为空") | ||
| 24 | + private String busiLine; | ||
| 25 | + | ||
| 26 | + @Schema(description = "事件编号", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 27 | + @NotEmpty(message = "事件编号不能为空") | ||
| 28 | + private String eventNo; | ||
| 29 | + | ||
| 30 | + @Schema(description = "事件名称", example = "王五") | ||
| 31 | + private String evetName; | ||
| 32 | + | ||
| 33 | + @Schema(description = "提交时间") | ||
| 34 | + private LocalDateTime commitDate; | ||
| 35 | + | ||
| 36 | + @Schema(description = "完成时间") | ||
| 37 | + private LocalDateTime finishDate; | ||
| 38 | + | ||
| 39 | + @Schema(description = "经纬度类型: 1:国标; 2:百度;3:高德;4:腾讯", example = "1") | ||
| 40 | + private Integer latLonType; | ||
| 41 | + | ||
| 42 | + @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 43 | + @NotNull(message = "经度不能为空") | ||
| 44 | + private BigDecimal lat; | ||
| 45 | + | ||
| 46 | + @Schema(description = "维度", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 47 | + @NotNull(message = "维度不能为空") | ||
| 48 | + private BigDecimal lon; | ||
| 49 | + | ||
| 50 | + @Schema(description = "经纬度地址", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 51 | + @NotEmpty(message = "经纬度地址不能为空") | ||
| 52 | + private String lonLatAddress; | ||
| 53 | + | ||
| 54 | + @Schema(description = "用户提交照片", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 55 | + @NotEmpty(message = "用户提交照片不能为空") | ||
| 56 | + private String[] confrimImgs; | ||
| 57 | + | ||
| 58 | + @Schema(description = "事件状态", example = "1") | ||
| 59 | + private Integer eventStatus; | ||
| 60 | + | ||
| 61 | + @Schema(description = "事件描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | ||
| 62 | + @NotEmpty(message = "事件描述不能为空") | ||
| 63 | + private String remark; | ||
| 64 | + | ||
| 65 | + private LocalDateTime createTime; | ||
| 66 | + | ||
| 67 | + private String creator; | ||
| 68 | + | ||
| 69 | +} | ||
| 0 | \ No newline at end of file | 70 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventinfo/vo/EventOrderInfoSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo; | ||
| 2 | + | ||
| 3 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import jakarta.validation.constraints.NotEmpty; | ||
| 6 | +import jakarta.validation.constraints.NotNull; | ||
| 7 | +import lombok.Data; | ||
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | + | ||
| 10 | +import java.math.BigDecimal; | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 14 | + | ||
| 15 | +@Schema(description = "管理后台 - 事件工单创建 Request VO") | ||
| 16 | +@Data | ||
| 17 | +public class EventOrderInfoSaveReqVO { | ||
| 18 | + | ||
| 19 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24349") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "业务线:yl 园林,wy 物业,sz 市政 ", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 23 | + @NotEmpty(message = "工单处理方不能为空") | ||
| 24 | + private String busiLine; | ||
| 25 | + | ||
| 26 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25903") | ||
| 27 | + @NotEmpty(message = "道路名称不能为空") | ||
| 28 | + private String roadId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "道路名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | ||
| 31 | + @ExcelProperty("道路名称") | ||
| 32 | + private String roadName; | ||
| 33 | + | ||
| 34 | + @Schema(description = "紧急程度:1:特急;2:紧急;3:一般", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 35 | + @NotNull(message = "紧急程度不能为空") | ||
| 36 | + private Integer pressingType; | ||
| 37 | + | ||
| 38 | + @Schema(description = "希望完成时间") | ||
| 39 | + private LocalDateTime expectedFinishDate; | ||
| 40 | + | ||
| 41 | +} | ||
| 0 | \ No newline at end of file | 42 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventmappinginfo/EventMappingInfoController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.eventmappinginfo; | ||
| 2 | + | ||
| 3 | +import org.springframework.web.bind.annotation.*; | ||
| 4 | +import jakarta.annotation.Resource; | ||
| 5 | +import org.springframework.validation.annotation.Validated; | ||
| 6 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 8 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 9 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 10 | + | ||
| 11 | +import jakarta.validation.constraints.*; | ||
| 12 | +import jakarta.validation.*; | ||
| 13 | +import jakarta.servlet.http.*; | ||
| 14 | +import java.util.*; | ||
| 15 | +import java.io.IOException; | ||
| 16 | + | ||
| 17 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 19 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | ||
| 20 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 21 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | ||
| 22 | + | ||
| 23 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | ||
| 24 | + | ||
| 25 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | ||
| 26 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | ||
| 27 | + | ||
| 28 | +import com.zteits.urbanops.module.workorder.controller.admin.eventmappinginfo.vo.*; | ||
| 29 | +import com.zteits.urbanops.module.workorder.dal.dataobject.eventmappinginfo.EventMappingInfoDO; | ||
| 30 | +import com.zteits.urbanops.module.workorder.service.eventmappinginfo.EventMappingInfoService; | ||
| 31 | + | ||
| 32 | +@Tag(name = "管理后台 - 工单事件映射") | ||
| 33 | +@RestController | ||
| 34 | +@RequestMapping("/workorder/event-mapping-info") | ||
| 35 | +@Validated | ||
| 36 | +public class EventMappingInfoController { | ||
| 37 | + | ||
| 38 | + @Resource | ||
| 39 | + private EventMappingInfoService eventMappingInfoService; | ||
| 40 | + | ||
| 41 | + @PostMapping("/create") | ||
| 42 | + @Operation(summary = "创建工单事件映射") | ||
| 43 | + @PreAuthorize("@ss.hasPermission('workorder:event-mapping-info:create')") | ||
| 44 | + public CommonResult<Long> createEventMappingInfo(@Valid @RequestBody EventMappingInfoSaveReqVO createReqVO) { | ||
| 45 | + return success(eventMappingInfoService.createEventMappingInfo(createReqVO)); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @PutMapping("/update") | ||
| 49 | + @Operation(summary = "更新工单事件映射") | ||
| 50 | + @PreAuthorize("@ss.hasPermission('workorder:event-mapping-info:update')") | ||
| 51 | + public CommonResult<Boolean> updateEventMappingInfo(@Valid @RequestBody EventMappingInfoSaveReqVO updateReqVO) { | ||
| 52 | + eventMappingInfoService.updateEventMappingInfo(updateReqVO); | ||
| 53 | + return success(true); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @DeleteMapping("/delete") | ||
| 57 | + @Operation(summary = "删除工单事件映射") | ||
| 58 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 59 | + @PreAuthorize("@ss.hasPermission('workorder:event-mapping-info:delete')") | ||
| 60 | + public CommonResult<Boolean> deleteEventMappingInfo(@RequestParam("id") Long id) { | ||
| 61 | + eventMappingInfoService.deleteEventMappingInfo(id); | ||
| 62 | + return success(true); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @DeleteMapping("/delete-list") | ||
| 66 | + @Parameter(name = "ids", description = "编号", required = true) | ||
| 67 | + @Operation(summary = "批量删除工单事件映射") | ||
| 68 | + @PreAuthorize("@ss.hasPermission('workorder:event-mapping-info:delete')") | ||
| 69 | + public CommonResult<Boolean> deleteEventMappingInfoList(@RequestParam("ids") List<Long> ids) { | ||
| 70 | + eventMappingInfoService.deleteEventMappingInfoListByIds(ids); | ||
| 71 | + return success(true); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @GetMapping("/get") | ||
| 75 | + @Operation(summary = "获得工单事件映射") | ||
| 76 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 77 | + @PreAuthorize("@ss.hasPermission('workorder:event-mapping-info:query')") | ||
| 78 | + public CommonResult<EventMappingInfoRespVO> getEventMappingInfo(@RequestParam("id") Long id) { | ||
| 79 | + EventMappingInfoDO eventMappingInfo = eventMappingInfoService.getEventMappingInfo(id); | ||
| 80 | + return success(BeanUtils.toBean(eventMappingInfo, EventMappingInfoRespVO.class)); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @GetMapping("/page") | ||
| 84 | + @Operation(summary = "获得工单事件映射分页") | ||
| 85 | + @PreAuthorize("@ss.hasPermission('workorder:event-mapping-info:query')") | ||
| 86 | + public CommonResult<PageResult<EventMappingInfoRespVO>> getEventMappingInfoPage(@Valid EventMappingInfoPageReqVO pageReqVO) { | ||
| 87 | + PageResult<EventMappingInfoDO> pageResult = eventMappingInfoService.getEventMappingInfoPage(pageReqVO); | ||
| 88 | + return success(BeanUtils.toBean(pageResult, EventMappingInfoRespVO.class)); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + @GetMapping("/export-excel") | ||
| 92 | + @Operation(summary = "导出工单事件映射 Excel") | ||
| 93 | + @PreAuthorize("@ss.hasPermission('workorder:event-mapping-info:export')") | ||
| 94 | + @ApiAccessLog(operateType = EXPORT) | ||
| 95 | + public void exportEventMappingInfoExcel(@Valid EventMappingInfoPageReqVO pageReqVO, | ||
| 96 | + HttpServletResponse response) throws IOException { | ||
| 97 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 98 | + List<EventMappingInfoDO> list = eventMappingInfoService.getEventMappingInfoPage(pageReqVO).getList(); | ||
| 99 | + // 导出 Excel | ||
| 100 | + ExcelUtils.write(response, "工单事件映射.xls", "数据", EventMappingInfoRespVO.class, | ||
| 101 | + BeanUtils.toBean(list, EventMappingInfoRespVO.class)); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | +} | ||
| 0 | \ No newline at end of file | 105 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventmappinginfo/vo/EventMappingInfoPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.eventmappinginfo.vo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 11 | + | ||
| 12 | +@Schema(description = "管理后台 - 工单事件映射分页 Request VO") | ||
| 13 | +@Data | ||
| 14 | +public class EventMappingInfoPageReqVO extends PageParam { | ||
| 15 | + | ||
| 16 | + @Schema(description = "业务线:yl 园林,wy 物业,sz 市政 ") | ||
| 17 | + private String busiLine; | ||
| 18 | + | ||
| 19 | + @Schema(description = "事件编号") | ||
| 20 | + private String eventNo; | ||
| 21 | + | ||
| 22 | + @Schema(description = "工单号") | ||
| 23 | + private String orderNo; | ||
| 24 | + | ||
| 25 | + @Schema(description = "道路ID", example = "25903") | ||
| 26 | + private Long roadId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "道路名称", example = "张三") | ||
| 29 | + private String roadName; | ||
| 30 | + | ||
| 31 | + @Schema(description = "紧急程度:1:特急;2:紧急;3:一般", example = "1") | ||
| 32 | + private Integer pressingType; | ||
| 33 | + | ||
| 34 | + @Schema(description = "养护级别ID", example = "12350") | ||
| 35 | + private Integer curingLevelId; | ||
| 36 | + | ||
| 37 | + @Schema(description = "养护级别", example = "赵六") | ||
| 38 | + private String curingLevelName; | ||
| 39 | + | ||
| 40 | + @Schema(description = "提交时间") | ||
| 41 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 42 | + private LocalDateTime[] commitDate; | ||
| 43 | + | ||
| 44 | + @Schema(description = "希望完成时间") | ||
| 45 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 46 | + private LocalDateTime[] expectedFinishDate; | ||
| 47 | + | ||
| 48 | + @Schema(description = "完成时间") | ||
| 49 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 50 | + private LocalDateTime[] finishDate; | ||
| 51 | + | ||
| 52 | + @Schema(description = "提交用户ID", example = "25064") | ||
| 53 | + private Long userId; | ||
| 54 | + | ||
| 55 | + @Schema(description = "提交用户名称", example = "李四") | ||
| 56 | + private String userName; | ||
| 57 | + | ||
| 58 | + @Schema(description = "提交用户的company_id", example = "26902") | ||
| 59 | + private Long companyId; | ||
| 60 | + | ||
| 61 | + @Schema(description = "部门id", example = "12715") | ||
| 62 | + private Long deptId; | ||
| 63 | + | ||
| 64 | + @Schema(description = "审批状态", example = "1") | ||
| 65 | + private Integer status; | ||
| 66 | + | ||
| 67 | + @Schema(description = "备注", example = "你猜") | ||
| 68 | + private String remark; | ||
| 69 | + | ||
| 70 | + @Schema(description = "创建时间") | ||
| 71 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 72 | + private LocalDateTime[] createTime; | ||
| 73 | + | ||
| 74 | +} | ||
| 0 | \ No newline at end of file | 75 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventmappinginfo/vo/EventMappingInfoRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.eventmappinginfo.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | +import cn.idev.excel.annotation.*; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - 工单事件映射 Response VO") | ||
| 11 | +@Data | ||
| 12 | +@ExcelIgnoreUnannotated | ||
| 13 | +public class EventMappingInfoRespVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5347") | ||
| 16 | + @ExcelProperty("ID") | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + @Schema(description = "业务线:yl 园林,wy 物业,sz 市政 ", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 20 | + @ExcelProperty("业务线:yl 园林,wy 物业,sz 市政 ") | ||
| 21 | + private String busiLine; | ||
| 22 | + | ||
| 23 | + @Schema(description = "事件编号", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 24 | + @ExcelProperty("事件编号") | ||
| 25 | + private String eventNo; | ||
| 26 | + | ||
| 27 | + @Schema(description = "工单号", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 28 | + @ExcelProperty("工单号") | ||
| 29 | + private String orderNo; | ||
| 30 | + | ||
| 31 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25903") | ||
| 32 | + @ExcelProperty("道路ID") | ||
| 33 | + private Long roadId; | ||
| 34 | + | ||
| 35 | + @Schema(description = "道路名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | ||
| 36 | + @ExcelProperty("道路名称") | ||
| 37 | + private String roadName; | ||
| 38 | + | ||
| 39 | + @Schema(description = "紧急程度:1:特急;2:紧急;3:一般", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 40 | + @ExcelProperty("紧急程度:1:特急;2:紧急;3:一般") | ||
| 41 | + private Integer pressingType; | ||
| 42 | + | ||
| 43 | + @Schema(description = "养护级别ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12350") | ||
| 44 | + @ExcelProperty("养护级别ID") | ||
| 45 | + private Integer curingLevelId; | ||
| 46 | + | ||
| 47 | + @Schema(description = "养护级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | ||
| 48 | + @ExcelProperty("养护级别") | ||
| 49 | + private String curingLevelName; | ||
| 50 | + | ||
| 51 | + @Schema(description = "提交时间") | ||
| 52 | + @ExcelProperty("提交时间") | ||
| 53 | + private LocalDateTime commitDate; | ||
| 54 | + | ||
| 55 | + @Schema(description = "希望完成时间") | ||
| 56 | + @ExcelProperty("希望完成时间") | ||
| 57 | + private LocalDateTime expectedFinishDate; | ||
| 58 | + | ||
| 59 | + @Schema(description = "完成时间") | ||
| 60 | + @ExcelProperty("完成时间") | ||
| 61 | + private LocalDateTime finishDate; | ||
| 62 | + | ||
| 63 | + @Schema(description = "提交用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25064") | ||
| 64 | + @ExcelProperty("提交用户ID") | ||
| 65 | + private Long userId; | ||
| 66 | + | ||
| 67 | + @Schema(description = "提交用户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | ||
| 68 | + @ExcelProperty("提交用户名称") | ||
| 69 | + private String userName; | ||
| 70 | + | ||
| 71 | + @Schema(description = "提交用户的company_id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26902") | ||
| 72 | + @ExcelProperty("提交用户的company_id") | ||
| 73 | + private Long companyId; | ||
| 74 | + | ||
| 75 | + @Schema(description = "部门id", example = "12715") | ||
| 76 | + @ExcelProperty("部门id") | ||
| 77 | + private Long deptId; | ||
| 78 | + | ||
| 79 | + @Schema(description = "审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 80 | + @ExcelProperty("审批状态") | ||
| 81 | + private Integer status; | ||
| 82 | + | ||
| 83 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | ||
| 84 | + @ExcelProperty("备注") | ||
| 85 | + private String remark; | ||
| 86 | + | ||
| 87 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 88 | + @ExcelProperty("创建时间") | ||
| 89 | + private LocalDateTime createTime; | ||
| 90 | + | ||
| 91 | +} | ||
| 0 | \ No newline at end of file | 92 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/eventmappinginfo/vo/EventMappingInfoSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.eventmappinginfo.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import jakarta.validation.constraints.*; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - 工单事件映射新增/修改 Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class EventMappingInfoSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5347") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "业务线:yl 园林,wy 物业,sz 市政 ", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 18 | + @NotEmpty(message = "业务线:yl 园林,wy 物业,sz 市政 不能为空") | ||
| 19 | + private String busiLine; | ||
| 20 | + | ||
| 21 | + @Schema(description = "事件编号", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 22 | + @NotEmpty(message = "事件编号不能为空") | ||
| 23 | + private String eventNo; | ||
| 24 | + | ||
| 25 | + @Schema(description = "工单号", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 26 | + @NotEmpty(message = "工单号不能为空") | ||
| 27 | + private String orderNo; | ||
| 28 | + | ||
| 29 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25903") | ||
| 30 | + @NotNull(message = "道路ID不能为空") | ||
| 31 | + private Long roadId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "道路名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | ||
| 34 | + @NotEmpty(message = "道路名称不能为空") | ||
| 35 | + private String roadName; | ||
| 36 | + | ||
| 37 | + @Schema(description = "紧急程度:1:特急;2:紧急;3:一般", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 38 | + @NotNull(message = "紧急程度:1:特急;2:紧急;3:一般不能为空") | ||
| 39 | + private Integer pressingType; | ||
| 40 | + | ||
| 41 | + @Schema(description = "养护级别ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12350") | ||
| 42 | + @NotNull(message = "养护级别ID不能为空") | ||
| 43 | + private Integer curingLevelId; | ||
| 44 | + | ||
| 45 | + @Schema(description = "养护级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | ||
| 46 | + @NotEmpty(message = "养护级别不能为空") | ||
| 47 | + private String curingLevelName; | ||
| 48 | + | ||
| 49 | + @Schema(description = "提交时间") | ||
| 50 | + private LocalDateTime commitDate; | ||
| 51 | + | ||
| 52 | + @Schema(description = "希望完成时间") | ||
| 53 | + private LocalDateTime expectedFinishDate; | ||
| 54 | + | ||
| 55 | + @Schema(description = "完成时间") | ||
| 56 | + private LocalDateTime finishDate; | ||
| 57 | + | ||
| 58 | + @Schema(description = "提交用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25064") | ||
| 59 | + @NotNull(message = "提交用户ID不能为空") | ||
| 60 | + private Long userId; | ||
| 61 | + | ||
| 62 | + @Schema(description = "提交用户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | ||
| 63 | + @NotEmpty(message = "提交用户名称不能为空") | ||
| 64 | + private String userName; | ||
| 65 | + | ||
| 66 | + @Schema(description = "提交用户的company_id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26902") | ||
| 67 | + @NotNull(message = "提交用户的company_id不能为空") | ||
| 68 | + private Long companyId; | ||
| 69 | + | ||
| 70 | + @Schema(description = "部门id", example = "12715") | ||
| 71 | + private Long deptId; | ||
| 72 | + | ||
| 73 | + @Schema(description = "审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 74 | + @NotNull(message = "审批状态不能为空") | ||
| 75 | + private Integer status; | ||
| 76 | + | ||
| 77 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | ||
| 78 | + @NotEmpty(message = "备注不能为空") | ||
| 79 | + private String remark; | ||
| 80 | + | ||
| 81 | +} | ||
| 0 | \ No newline at end of file | 82 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/garden/BpmGardenInspectController.java
| @@ -3,19 +3,34 @@ package com.zteits.urbanops.module.workorder.controller.admin.garden; | @@ -3,19 +3,34 @@ package com.zteits.urbanops.module.workorder.controller.admin.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.workorder.controller.admin.garden.vo.BpmGardenWorkOrderCreateReqVO; | 6 | +import com.zteits.urbanops.module.bpm.api.task.BpmTaskApi; |
| 7 | +import com.zteits.urbanops.module.bpm.api.task.dto.BpmUserSimpleReqDTO; | ||
| 8 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenTaskAssignReqVO; | ||
| 7 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; | 9 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; |
| 8 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderRespVO; | 10 | import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderRespVO; |
| 11 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.task.AdminGardenTaskApproveReqVO; | ||
| 12 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.task.AppGardenTaskApproveReqVO; | ||
| 13 | +import com.zteits.urbanops.module.workorder.dal.dataobject.attachment.AttachmentDO; | ||
| 9 | import com.zteits.urbanops.module.workorder.dal.dataobject.garden.BpmGardenWorkOrderDO; | 14 | import com.zteits.urbanops.module.workorder.dal.dataobject.garden.BpmGardenWorkOrderDO; |
| 15 | +import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoExtDO; | ||
| 16 | +import com.zteits.urbanops.module.workorder.service.attachment.AttachmentService; | ||
| 17 | +import com.zteits.urbanops.module.workorder.service.garden.BpmGardenAdminService; | ||
| 10 | import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService; | 18 | import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService; |
| 11 | import io.swagger.v3.oas.annotations.Operation; | 19 | import io.swagger.v3.oas.annotations.Operation; |
| 12 | import io.swagger.v3.oas.annotations.Parameter; | 20 | import io.swagger.v3.oas.annotations.Parameter; |
| 13 | import io.swagger.v3.oas.annotations.tags.Tag; | 21 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 14 | import jakarta.annotation.Resource; | 22 | import jakarta.annotation.Resource; |
| 15 | import jakarta.validation.Valid; | 23 | import jakarta.validation.Valid; |
| 24 | +import org.apache.commons.collections4.CollectionUtils; | ||
| 16 | import org.springframework.security.access.prepost.PreAuthorize; | 25 | import org.springframework.security.access.prepost.PreAuthorize; |
| 17 | import org.springframework.validation.annotation.Validated; | 26 | import org.springframework.validation.annotation.Validated; |
| 18 | import org.springframework.web.bind.annotation.*; | 27 | import org.springframework.web.bind.annotation.*; |
| 28 | +import com.zteits.urbanops.module.workorder.convert.garden.AdminGardenTaskConvert; | ||
| 29 | + | ||
| 30 | +import java.util.Collections; | ||
| 31 | +import java.util.List; | ||
| 32 | +import java.util.Map; | ||
| 33 | +import java.util.stream.Collectors; | ||
| 19 | 34 | ||
| 20 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | 35 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; |
| 21 | import static com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 36 | import static com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| @@ -34,6 +49,15 @@ public class BpmGardenInspectController { | @@ -34,6 +49,15 @@ public class BpmGardenInspectController { | ||
| 34 | @Resource | 49 | @Resource |
| 35 | private BpmGardenService gardenService; | 50 | private BpmGardenService gardenService; |
| 36 | 51 | ||
| 52 | + @Resource | ||
| 53 | + BpmGardenAdminService gardenAdminService; | ||
| 54 | + | ||
| 55 | + @Resource | ||
| 56 | + AttachmentService attachmentService; | ||
| 57 | + | ||
| 58 | + @Resource | ||
| 59 | + private BpmTaskApi bpmTaskApi; | ||
| 60 | + | ||
| 37 | /*@PostMapping("/create") | 61 | /*@PostMapping("/create") |
| 38 | @PreAuthorize("@ss.hasPermission('bpm:garden-inspection:create')") | 62 | @PreAuthorize("@ss.hasPermission('bpm:garden-inspection:create')") |
| 39 | @Operation(summary = "创建请求申请") | 63 | @Operation(summary = "创建请求申请") |
| @@ -57,4 +81,64 @@ public class BpmGardenInspectController { | @@ -57,4 +81,64 @@ public class BpmGardenInspectController { | ||
| 57 | PageResult<BpmGardenWorkOrderDO> pageResult = gardenService.getGardenInspectionPage(getLoginUserId(), pageVO); | 81 | PageResult<BpmGardenWorkOrderDO> pageResult = gardenService.getGardenInspectionPage(getLoginUserId(), pageVO); |
| 58 | return success(BeanUtils.toBean(pageResult, BpmGardenWorkOrderRespVO.class)); | 82 | return success(BeanUtils.toBean(pageResult, BpmGardenWorkOrderRespVO.class)); |
| 59 | } | 83 | } |
| 84 | + | ||
| 85 | + | ||
| 86 | + @GetMapping("todoBuzSimplePage") | ||
| 87 | + @Operation(summary = "PC - 获取工单业务待办任务分页") | ||
| 88 | + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:query')") | ||
| 89 | + public CommonResult<PageResult<BpmGardenWorkOrderRespVO>> getTaskTodoBuzSimplePage(@Valid BpmGardenWorkOrderPageReqVO pageVO) { | ||
| 90 | + PageResult<MainInfoExtDO> pageResult = gardenAdminService.getTaskTodoBuzSimplePage(pageVO); | ||
| 91 | + if (pageResult == null) { | ||
| 92 | + return success(PageResult.empty()); | ||
| 93 | + } | ||
| 94 | + // 2. 初始化附件映射(默认空Map,避免后续空指针) | ||
| 95 | + Map<String, AttachmentDO> attachmentMap = Collections.emptyMap(); | ||
| 96 | + | ||
| 97 | + // 3. 空值防护:分页结果非空且列表非空时,才查询附件 | ||
| 98 | + if (pageResult != null && !CollectionUtils.isEmpty(pageResult.getList())) { | ||
| 99 | + // 提取订单号列表 | ||
| 100 | + List<String> orderNoList = pageResult.getList().stream() | ||
| 101 | + .map(MainInfoExtDO::getOrderNo) | ||
| 102 | + .filter(orderNo -> orderNo != null && !orderNo.isBlank()) | ||
| 103 | + .collect(Collectors.toList()); | ||
| 104 | + | ||
| 105 | + // 若订单号列表非空,查询附件;否则跳过 | ||
| 106 | + if (!CollectionUtils.isEmpty(orderNoList)) { | ||
| 107 | + List<AttachmentDO> attachmentDOList = attachmentService.getAttachmentByOrderNo(orderNoList); | ||
| 108 | + // 构建订单号→附件对象的映射(处理重复key,取第一个对象) | ||
| 109 | + if (!CollectionUtils.isEmpty(attachmentDOList)) { | ||
| 110 | + attachmentMap = attachmentDOList.stream() | ||
| 111 | + .filter(attachmentDO -> "01".equals(attachmentDO.getBusiType())) | ||
| 112 | + .collect(Collectors.toMap( | ||
| 113 | + AttachmentDO::getOrderNo, // key:订单号 | ||
| 114 | + attachmentDO -> attachmentDO, // value:附件对象 | ||
| 115 | + (existing, replacement) -> existing // 重复key时保留已有值 | ||
| 116 | + )); | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + //4. 查询处理人 | ||
| 121 | + List<String> processInstanceIdList = pageResult.getList().stream() | ||
| 122 | + .map(MainInfoExtDO::getProcessInstanceId) | ||
| 123 | + .filter(orderNo -> orderNo != null && !orderNo.isBlank()) | ||
| 124 | + .collect(Collectors.toList()); | ||
| 125 | + | ||
| 126 | + //Map<String, BpmUserSimpleReqDTO> bpmTaskRespVOS = bpmTaskApi.getLastTaskMapByProcessInstanceId(processInstanceIdList); | ||
| 127 | + return success(AdminGardenTaskConvert.INSTANCE.buildMainInfoPage(pageResult, attachmentMap, null)); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + @PutMapping("assignWOrder") | ||
| 131 | + @Operation(summary = "分配工单提交任务") | ||
| 132 | + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:update')") | ||
| 133 | + public CommonResult<Boolean> assignWOrder(@Valid @RequestBody List<BpmGardenTaskAssignReqVO> reqVO) { | ||
| 134 | + return success(gardenAdminService.assignWOrder(reqVO)); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + @PutMapping("/approve") | ||
| 138 | + @Operation(summary = "app - 审批通过任务") | ||
| 139 | + //@PreAuthorize("@ss.hasPermission('bpm:garden-workorder:update')") | ||
| 140 | + public CommonResult<Boolean> approveTask(@Valid @RequestBody AdminGardenTaskApproveReqVO reqVO) { | ||
| 141 | + //gardenService.approveTask(reqVO); | ||
| 142 | + return success(true); | ||
| 143 | + } | ||
| 60 | } | 144 | } |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/garden/vo/BpmGardenTaskAssignReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.garden.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotEmpty; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @Author wangqian | ||
| 12 | + * @Description 分配任务请求reqVO | ||
| 13 | + * @Date 2025/12/20 10:14 | ||
| 14 | + * @Param null | ||
| 15 | + * @Return | ||
| 16 | + */ | ||
| 17 | +@Schema(description = "分配工单流程任务的 Request VO") | ||
| 18 | +@Data | ||
| 19 | +public class BpmGardenTaskAssignReqVO { | ||
| 20 | + | ||
| 21 | + @Schema(description = "工单表主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 22 | + @NotNull(message = "id不能为空") | ||
| 23 | + private Long id; | ||
| 24 | + | ||
| 25 | + @Schema(description = "工单处理方", requiredMode = Schema.RequiredMode.REQUIRED, example = "yl") | ||
| 26 | + @NotEmpty(message = "工单处理方不能为空") | ||
| 27 | + private String busiLine; | ||
| 28 | + | ||
| 29 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21128") | ||
| 30 | + @NotNull(message = "道路ID不能为空") | ||
| 31 | + private Long roadId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "道路名称", example = "测试道路") | ||
| 34 | + private String roadName; | ||
| 35 | + | ||
| 36 | + @Schema(description = "紧急程度:1:特急;2:紧急;3:一般", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 37 | + @NotNull(message = "紧急程度:1:特急;2:紧急;3:一般不能为空") | ||
| 38 | + private Integer pressingType; | ||
| 39 | + | ||
| 40 | + @Schema(description = "完成时间") | ||
| 41 | + private LocalDateTime finishDate; | ||
| 42 | + | ||
| 43 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/garden/vo/BpmGardenWorkOrderPageReqVO.java
| @@ -13,4 +13,25 @@ import lombok.Data; | @@ -13,4 +13,25 @@ import lombok.Data; | ||
| 13 | @Schema(description = "管理后台 - 园林工单申请分页 Request VO") | 13 | @Schema(description = "管理后台 - 园林工单申请分页 Request VO") |
| 14 | @Data | 14 | @Data |
| 15 | public class BpmGardenWorkOrderPageReqVO extends PageParam { | 15 | public class BpmGardenWorkOrderPageReqVO extends PageParam { |
| 16 | + | ||
| 17 | + @Schema(description = "工单号") | ||
| 18 | + private String orderNo; | ||
| 19 | + | ||
| 20 | + @Schema(description = "工单名称", example = "张三") | ||
| 21 | + private String orderName; | ||
| 22 | + @Schema(description = "工单描述", example = "你说的对") | ||
| 23 | + private String remark; | ||
| 24 | + @Schema(description = "来源ID", example = "1") | ||
| 25 | + private Integer sourceId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "街道ID", example = "27852") | ||
| 28 | + private String streetId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "养护级别ID", example = "1") | ||
| 31 | + private Integer curingLevelId; | ||
| 32 | + @Schema(description = "紧急程度:1:特急;2:紧急;3:一般", example = "2") | ||
| 33 | + private Integer pressingType; | ||
| 34 | + | ||
| 35 | + @Schema(description = "审批状态", example = "2") | ||
| 36 | + private Integer status; | ||
| 16 | } | 37 | } |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/garden/vo/BpmGardenWorkOrderRespVO.java
| 1 | package com.zteits.urbanops.module.workorder.controller.admin.garden.vo; | 1 | package com.zteits.urbanops.module.workorder.controller.admin.garden.vo; |
| 2 | 2 | ||
| 3 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 5 | import lombok.Data; |
| 5 | 6 | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import java.util.List; | ||
| 10 | +import java.util.Set; | ||
| 11 | + | ||
| 6 | /** | 12 | /** |
| 7 | * @author yanhuiqing | 13 | * @author yanhuiqing |
| 8 | * @version 1.0 | 14 | * @version 1.0 |
| @@ -12,4 +18,188 @@ import lombok.Data; | @@ -12,4 +18,188 @@ import lombok.Data; | ||
| 12 | @Schema(description = "管理后台 - 园林工单流程 Response VO") | 18 | @Schema(description = "管理后台 - 园林工单流程 Response VO") |
| 13 | @Data | 19 | @Data |
| 14 | public class BpmGardenWorkOrderRespVO { | 20 | public class BpmGardenWorkOrderRespVO { |
| 21 | + | ||
| 22 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7114") | ||
| 23 | + @ExcelProperty("ID") | ||
| 24 | + private Long id; | ||
| 25 | + | ||
| 26 | + @Schema(description = "业务线:yl 园林,wy 物业,sz 市政 ", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 27 | + @ExcelProperty("业务线:yl 园林,wy 物业,sz 市政 ") | ||
| 28 | + private String busiLine; | ||
| 29 | + | ||
| 30 | + @Schema(description = "工单号", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 31 | + @ExcelProperty("工单号") | ||
| 32 | + private String orderNo; | ||
| 33 | + | ||
| 34 | + @Schema(description = "工单名称", example = "张三") | ||
| 35 | + @ExcelProperty("工单名称") | ||
| 36 | + private String orderName; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 工单类型 Q:快速工单,C:普通工单,O:其他工单 | ||
| 40 | + */ | ||
| 41 | + private String orderType; | ||
| 42 | + | ||
| 43 | + @Schema(description = "来源ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1828") | ||
| 44 | + @ExcelProperty("来源ID 问题来源 1、巡查,2、游客居民,3、12345,4、网格 5、大区经理") | ||
| 45 | + private Integer sourceId; | ||
| 46 | + | ||
| 47 | + @Schema(description = "来源名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | ||
| 48 | + @ExcelProperty("来源名称") | ||
| 49 | + private String sourceName; | ||
| 50 | + | ||
| 51 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21128") | ||
| 52 | + @ExcelProperty("道路ID") | ||
| 53 | + private Long roadId; | ||
| 54 | + | ||
| 55 | + @Schema(description = "道路名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | ||
| 56 | + @ExcelProperty("道路名称") | ||
| 57 | + private String roadName; | ||
| 58 | + | ||
| 59 | + @Schema(description = "街道ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27852") | ||
| 60 | + @ExcelProperty("街道ID") | ||
| 61 | + private String streetId; | ||
| 62 | + | ||
| 63 | + @Schema(description = "街道名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | ||
| 64 | + @ExcelProperty("街道名称") | ||
| 65 | + private String streetName; | ||
| 66 | + | ||
| 67 | + @Schema(description = "养护级别ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28278") | ||
| 68 | + @ExcelProperty("养护级别ID") | ||
| 69 | + private Integer curingLevelId; | ||
| 70 | + | ||
| 71 | + @Schema(description = "养护级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | ||
| 72 | + @ExcelProperty("养护级别") | ||
| 73 | + private String curingLevelName; | ||
| 74 | + | ||
| 75 | + @Schema(description = "提交日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 76 | + @ExcelProperty("提交日期") | ||
| 77 | + private LocalDateTime commitDate; | ||
| 78 | + | ||
| 79 | + @Schema(description = "希望完成时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 80 | + @ExcelProperty("希望完成时间") | ||
| 81 | + private LocalDateTime expectedFinishDate; | ||
| 82 | + | ||
| 83 | + @Schema(description = "完成时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 84 | + @ExcelProperty("完成时间") | ||
| 85 | + private LocalDateTime finishDate; | ||
| 86 | + | ||
| 87 | + @Schema(description = "紧急程度:1:特急;2:紧急;3:一般", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 88 | + @ExcelProperty("紧急程度:1:特急;2:紧急;3:一般") | ||
| 89 | + private Integer pressingType; | ||
| 90 | + | ||
| 91 | + @Schema(description = "提交用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12757") | ||
| 92 | + private Long userId; | ||
| 93 | + | ||
| 94 | + @Schema(description = "提交用户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | ||
| 95 | + @ExcelProperty("提交用户名称") | ||
| 96 | + private String userName; | ||
| 97 | + | ||
| 98 | + @Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26936") | ||
| 99 | + private Long companyId; | ||
| 100 | + | ||
| 101 | + @Schema(description = "单位名称") | ||
| 102 | + @ExcelProperty("单位名称") | ||
| 103 | + private String companyName; | ||
| 104 | + | ||
| 105 | + @Schema(description = "经纬度类型: 1:国标; 2:百度;3:高德;4:腾讯", example = "2") | ||
| 106 | + @ExcelProperty("经纬度类型: 1:国标; 2:百度;3:高德;4:腾讯") | ||
| 107 | + private Integer latLonType; | ||
| 108 | + | ||
| 109 | + @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 110 | + @ExcelProperty("经度") | ||
| 111 | + private BigDecimal lat; | ||
| 112 | + | ||
| 113 | + @Schema(description = "维度", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 114 | + @ExcelProperty("维度") | ||
| 115 | + private BigDecimal lon; | ||
| 116 | + | ||
| 117 | + @Schema(description = "经纬度地址", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 118 | + @ExcelProperty("经纬度地址") | ||
| 119 | + private String lonLatAddress; | ||
| 120 | + | ||
| 121 | + @Schema(description = "三方工单ID") | ||
| 122 | + @ExcelProperty("三方工单ID") | ||
| 123 | + private String thirdWorkNo; | ||
| 124 | + | ||
| 125 | + @Schema(description = "三方工单结果上报状态:1:待推送;2:推送成功;3:推送失败") | ||
| 126 | + @ExcelProperty("三方工单结果上报状态:1:待推送;2:推送成功;3:推送失败") | ||
| 127 | + private Integer thirdPushState; | ||
| 128 | + | ||
| 129 | + @Schema(description = "业务状态", example = "1") | ||
| 130 | + @ExcelProperty("业务状态") | ||
| 131 | + private String buzStatus; | ||
| 132 | + | ||
| 133 | + @Schema(description = "审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 134 | + @ExcelProperty("审批状态") | ||
| 135 | + private Integer status; | ||
| 136 | + | ||
| 137 | + @Schema(description = "流程实例的编号", example = "9184") | ||
| 138 | + @ExcelProperty("流程实例的编号") | ||
| 139 | + private String processInstanceId; | ||
| 140 | + | ||
| 141 | + @Schema(description = "工单描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | ||
| 142 | + @ExcelProperty("工单描述") | ||
| 143 | + private String remark; | ||
| 144 | + | ||
| 145 | + @Schema(description = "工单完成结果描述", example = "已完成") | ||
| 146 | + @ExcelProperty("工单完成结果描述") | ||
| 147 | + private String handleResult; | ||
| 148 | + | ||
| 149 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 150 | + @ExcelProperty("创建时间") | ||
| 151 | + private LocalDateTime createTime; | ||
| 152 | + | ||
| 153 | + @Schema(description = "文件名称") | ||
| 154 | + private List<String> fileNames; | ||
| 155 | + | ||
| 156 | + @Schema(description = "共同处理人") | ||
| 157 | + private Set<Long> coHandlers; | ||
| 158 | + @Schema(description = "共同处理人名称,多个为数组") | ||
| 159 | + private List<String> coHandlersName; | ||
| 160 | + | ||
| 161 | + @Schema(description = "提交人电话") | ||
| 162 | + private String userMobile; | ||
| 163 | + | ||
| 164 | + @Schema(description = "养护员") | ||
| 165 | + private String workerName; | ||
| 166 | + | ||
| 167 | + @Schema(description = "实施人员部门id") | ||
| 168 | + private Long workerCompanyId; | ||
| 169 | + | ||
| 170 | + @Schema(description = "处理人") | ||
| 171 | + private String assigneeName; | ||
| 172 | + | ||
| 173 | + @Schema(description = "审批节点") | ||
| 174 | + private String approvalNode; | ||
| 175 | + | ||
| 176 | + | ||
| 177 | + /** | ||
| 178 | + * 任务id | ||
| 179 | + */ | ||
| 180 | + private String taskId; | ||
| 181 | + /** | ||
| 182 | + * 任务名称 | ||
| 183 | + */ | ||
| 184 | + private String taskName; | ||
| 185 | + /** | ||
| 186 | + * 任务key | ||
| 187 | + */ | ||
| 188 | + private String taskKey; | ||
| 189 | + /** | ||
| 190 | + * 流程定义名称 | ||
| 191 | + */ | ||
| 192 | + private String processDefinitionName; | ||
| 193 | + /** | ||
| 194 | + * 任务开始时间 | ||
| 195 | + */ | ||
| 196 | + private LocalDateTime startTime; | ||
| 197 | + /** | ||
| 198 | + * 任务结束时间 | ||
| 199 | + */ | ||
| 200 | + private LocalDateTime endTime; | ||
| 201 | + /** | ||
| 202 | + * 流程定义key | ||
| 203 | + */ | ||
| 204 | + private String key_; | ||
| 15 | } | 205 | } |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/garden/vo/task/AdminGardenTaskApproveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.admin.garden.vo.task; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotEmpty; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 类描述:园林pc端工单任务审批通过VO | ||
| 11 | + * 创建人:yanhuiqing | ||
| 12 | + * 创建时间:2025/12/13 21:33 | ||
| 13 | + * 修改人:yanhuiqing | ||
| 14 | + * 修改时间:2025/12/13 21:33 | ||
| 15 | + * 修改备注: | ||
| 16 | + * | ||
| 17 | + * @author yanhuiqing | ||
| 18 | + * @version 1.0 | ||
| 19 | + */ | ||
| 20 | +@Schema(description = "PC - 通过流程任务的 Request VO") | ||
| 21 | +@Data | ||
| 22 | +public class AdminGardenTaskApproveReqVO { | ||
| 23 | + | ||
| 24 | + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 25 | + @NotEmpty(message = "任务编号不能为空") | ||
| 26 | + private String id; | ||
| 27 | + | ||
| 28 | + @Schema(description = "审批意见", example = "通过!") | ||
| 29 | + private String reason; | ||
| 30 | + | ||
| 31 | + @Schema(description = "同意选择类型:0 同意,1 不同意", example = "0") | ||
| 32 | + //@NotNull(message = "同意选择类型不能为空") | ||
| 33 | + private Integer agree; | ||
| 34 | + | ||
| 35 | + @Schema(description = "工单的数据id", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 36 | + //@NotEmpty(message = "工单的数据id不能为空") | ||
| 37 | + private Long workerDataId; | ||
| 38 | + | ||
| 39 | + @Schema(description = "退回时的拍照图片") | ||
| 40 | + private List<String> returnImgs; | ||
| 41 | + | ||
| 42 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/eventinfo/AppEventInfoController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.app.eventinfo; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | ||
| 4 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 5 | +import com.zteits.urbanops.module.garden.api.road.RoadApi; | ||
| 6 | +import com.zteits.urbanops.module.workorder.api.WorkOrderApi; | ||
| 7 | +import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.EventInfoSaveReqVO; | ||
| 8 | +import com.zteits.urbanops.module.workorder.controller.app.eventinfo.vo.OrderEventApiSaveReqVO; | ||
| 9 | +import com.zteits.urbanops.module.workorder.enums.EventStatusEnum; | ||
| 10 | +import com.zteits.urbanops.module.workorder.enums.SysMappingEnum; | ||
| 11 | +import com.zteits.urbanops.module.workorder.service.eventinfo.EventInfoService; | ||
| 12 | +import com.zteits.urbanops.module.workorder.service.geocode.GeoCodeService; | ||
| 13 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 14 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 15 | +import jakarta.annotation.Resource; | ||
| 16 | +import jakarta.annotation.security.PermitAll; | ||
| 17 | +import jakarta.validation.Valid; | ||
| 18 | +import org.springframework.util.StringUtils; | ||
| 19 | +import org.springframework.validation.annotation.Validated; | ||
| 20 | +import org.springframework.web.bind.annotation.*; | ||
| 21 | + | ||
| 22 | +import java.time.LocalDateTime; | ||
| 23 | + | ||
| 24 | +import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; | ||
| 25 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | ||
| 26 | +import static com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant.EVENT_INFO_PREFFIX_UNIVERSE; | ||
| 27 | + | ||
| 28 | +@Tag(name = "管理后台 - 工单事件") | ||
| 29 | +@RestController | ||
| 30 | +@RequestMapping("/workorder/event-info") | ||
| 31 | +@Validated | ||
| 32 | +public class AppEventInfoController { | ||
| 33 | + | ||
| 34 | + @Resource | ||
| 35 | + private EventInfoService eventInfoService; | ||
| 36 | + | ||
| 37 | + @Resource | ||
| 38 | + private WorkOrderApi workOrderApi; | ||
| 39 | + | ||
| 40 | + @Resource | ||
| 41 | + private GeoCodeService geoCodeService; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * { | ||
| 45 | + * "problemName": "问题名称", | ||
| 46 | + * "userConfrimRemark": "问题描述", | ||
| 47 | + * "userConfrimImgs": [], //问题照片 | ||
| 48 | + * "userConfrimLat": "经度", | ||
| 49 | + * "userConfrimLon": "维度", | ||
| 50 | + * "companyCode": "", //业务系统编码,和统一认证保持一致,智慧园林:sls,智慧市政:sms | ||
| 51 | + * } | ||
| 52 | + * @param createReqVO | ||
| 53 | + * @return | ||
| 54 | + */ | ||
| 55 | + @PostMapping("") | ||
| 56 | + @Operation(summary = "工单事件创建") | ||
| 57 | + @PermitAll | ||
| 58 | + public CommonResult<String> createProblems(@Valid @RequestBody OrderEventApiSaveReqVO createReqVO) { | ||
| 59 | + String companyCode = createReqVO.getCompanyCode(); | ||
| 60 | + if (!StringUtils.hasText(companyCode)) { | ||
| 61 | + return CommonResult.error(BAD_REQUEST, "子系统编码不能为空"); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + SysMappingEnum sys = SysMappingEnum.getBySysCode(companyCode); | ||
| 65 | + | ||
| 66 | + EventInfoSaveReqVO vo = new EventInfoSaveReqVO(); | ||
| 67 | + String eventNo = workOrderApi.generateWONum(EVENT_INFO_PREFFIX_UNIVERSE); | ||
| 68 | + vo.setEventNo(eventNo); | ||
| 69 | + vo.setEventStatus(EventStatusEnum.PENDING.getCode()); | ||
| 70 | + vo.setBusiLine(sys.name().toLowerCase()); | ||
| 71 | + vo.setLon(createReqVO.getUserConfrimLon()); | ||
| 72 | + vo.setLat(createReqVO.getUserConfrimLat()); | ||
| 73 | + vo.setConfrimImgs(createReqVO.getUserConfrimImgs()); | ||
| 74 | + vo.setCommitDate(LocalDateTime.now()); | ||
| 75 | + vo.setEvetName(createReqVO.getProblemName()); | ||
| 76 | + vo.setLatLonType(3); | ||
| 77 | + vo.setCreator("设备"); | ||
| 78 | + vo.setRemark(createReqVO.getUserConfrimRemark()); | ||
| 79 | + // 调用高德API根据经纬度查询地址 | ||
| 80 | + if (createReqVO.getUserConfrimLat() != null && createReqVO.getUserConfrimLon() != null) { | ||
| 81 | + try { | ||
| 82 | + String address = geoCodeService.getAddressByLocation(createReqVO.getUserConfrimLat(), createReqVO.getUserConfrimLon()); | ||
| 83 | + if (StringUtils.hasText(address)) { | ||
| 84 | + vo.setLonLatAddress(address); | ||
| 85 | + } | ||
| 86 | + } catch (Exception e) { | ||
| 87 | + // 地址查询失败时不影响主流程,记录日志即可 | ||
| 88 | + // log.warn("根据经纬度查询地址失败: lat={}, lon={}", createReqVO.getUserConfrimLat(), createReqVO.getUserConfrimLon(), e); | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + eventInfoService.createEventInfo(vo); | ||
| 92 | + return success(eventNo); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | +} | ||
| 0 | \ No newline at end of file | 96 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/eventinfo/vo/OrderEventApiSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.controller.app.eventinfo.vo; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONArray; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import jakarta.validation.constraints.NotEmpty; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | + | ||
| 11 | +@Schema(description = "管理后台 - 事件表--问题单新增/修改 Request VO") | ||
| 12 | +@Data | ||
| 13 | +public class OrderEventApiSaveReqVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "问题名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | ||
| 16 | + @NotEmpty(message = "问题名称不能为空") | ||
| 17 | + private String problemName; | ||
| 18 | + | ||
| 19 | + @Schema(description = "设备编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123") | ||
| 20 | + private String deviceCode; | ||
| 21 | + | ||
| 22 | + @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | ||
| 23 | + private String device; | ||
| 24 | + | ||
| 25 | + @Schema(description = "用户提交问题描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | ||
| 26 | + @NotEmpty(message = "用户提交问题描述不能为空") | ||
| 27 | + private String userConfrimRemark; | ||
| 28 | + | ||
| 29 | + @Schema(description = "用户提交时间") | ||
| 30 | + private LocalDateTime userConfrimTime; | ||
| 31 | + | ||
| 32 | + @Schema(description = "用户提交照片", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 33 | + @NotEmpty(message = "用户提交照片不能为空") | ||
| 34 | + private String[] userConfrimImgs; | ||
| 35 | + | ||
| 36 | + @Schema(description = "用户提交经度", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 37 | + //@NotNull(message = "用户提交经度不能为空") | ||
| 38 | + private BigDecimal userConfrimLat; | ||
| 39 | + | ||
| 40 | + @Schema(description = "用户提交维度", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 41 | + //@NotNull(message = "用户提交维度不能为空") | ||
| 42 | + private BigDecimal userConfrimLon; | ||
| 43 | + | ||
| 44 | + @Schema(description = "子系统编码", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 45 | + private String companyCode; | ||
| 46 | + | ||
| 47 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/convert/garden/AdminGardenTaskConvert.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.convert.garden; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 4 | +import com.zteits.urbanops.framework.common.util.collection.CollectionUtils; | ||
| 5 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 6 | +import com.zteits.urbanops.module.bpm.api.task.dto.BpmUserSimpleReqDTO; | ||
| 7 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderRespVO; | ||
| 8 | +import com.zteits.urbanops.module.workorder.convert.maininfo.MainInfoConvert; | ||
| 9 | +import com.zteits.urbanops.module.workorder.dal.dataobject.attachment.AttachmentDO; | ||
| 10 | +import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoExtDO; | ||
| 11 | +import org.mapstruct.Mapper; | ||
| 12 | +import org.mapstruct.factory.Mappers; | ||
| 13 | + | ||
| 14 | +import java.util.Arrays; | ||
| 15 | +import java.util.List; | ||
| 16 | +import java.util.Map; | ||
| 17 | +import java.util.stream.Collectors; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * @Classname AdminGardenTaskConvert | ||
| 21 | + * @Description PC端代办 | ||
| 22 | + * @Date 2025/12/26 16:51 | ||
| 23 | + * @Created by wangqian | ||
| 24 | + */ | ||
| 25 | +@Mapper | ||
| 26 | +public class AdminGardenTaskConvert { | ||
| 27 | + public static final AdminGardenTaskConvert INSTANCE = Mappers.getMapper(AdminGardenTaskConvert.class); | ||
| 28 | + | ||
| 29 | + public PageResult<BpmGardenWorkOrderRespVO> buildMainInfoPage(PageResult<MainInfoExtDO> pageResult, Map<String, AttachmentDO> attachmentMap, Map<String, BpmUserSimpleReqDTO> bpmTaskRespVOS) { | ||
| 30 | + List<BpmGardenWorkOrderRespVO> mainInfoVOList = CollectionUtils.convertList(pageResult.getList(), mainInfoDO -> { | ||
| 31 | + BpmGardenWorkOrderRespVO mainInfoVo = BeanUtils.toBean(mainInfoDO, BpmGardenWorkOrderRespVO.class); | ||
| 32 | + if (attachmentMap != null && !attachmentMap.isEmpty()) { | ||
| 33 | + AttachmentDO attachmentDO = attachmentMap.get(mainInfoDO.getOrderNo()); | ||
| 34 | + if (attachmentDO != null) { | ||
| 35 | + String fileNamesStr = attachmentDO.getFileNames(); | ||
| 36 | + List<String> fileNameList = fileNamesStr == null | ||
| 37 | + ? List.of() | ||
| 38 | + : Arrays.stream(fileNamesStr.split(",")) | ||
| 39 | + .filter(fileName -> fileName != null && !fileName.trim().isEmpty()) // 过滤空字符串和空白 | ||
| 40 | + .collect(Collectors.toList()); | ||
| 41 | + mainInfoVo.setFileNames(fileNameList); | ||
| 42 | + } | ||
| 43 | + if (bpmTaskRespVOS != null && !bpmTaskRespVOS.isEmpty()) { | ||
| 44 | + BpmUserSimpleReqDTO bpmUserSimpleReqDTO = bpmTaskRespVOS.get(mainInfoDO.getProcessInstanceId()); | ||
| 45 | + if (bpmUserSimpleReqDTO != null) { | ||
| 46 | + mainInfoVo.setAssigneeName(bpmUserSimpleReqDTO.getAssigneeName()); | ||
| 47 | + mainInfoVo.setApprovalNode(bpmUserSimpleReqDTO.getName()); | ||
| 48 | + mainInfoVo.setStatus(bpmUserSimpleReqDTO.getTaskStatus()); | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + return mainInfoVo; | ||
| 53 | + }); | ||
| 54 | + return new PageResult<>(mainInfoVOList, pageResult.getTotal()); | ||
| 55 | + } | ||
| 56 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/dataobject/eventinfo/EventInfoDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.dal.dataobject.eventinfo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import java.time.LocalDateTime; | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 12 | +import com.zteits.urbanops.framework.mybatis.core.dataobject.BaseDO; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 工单事件 DO | ||
| 16 | + * | ||
| 17 | + * @author 超级管理员 | ||
| 18 | + */ | ||
| 19 | +@TableName("workorder_event_info") | ||
| 20 | +@KeySequence("workorder_event_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 21 | +@Data | ||
| 22 | +@EqualsAndHashCode(callSuper = true) | ||
| 23 | +@ToString(callSuper = true) | ||
| 24 | +@Builder | ||
| 25 | +@NoArgsConstructor | ||
| 26 | +@AllArgsConstructor | ||
| 27 | +public class EventInfoDO extends BaseDO { | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * ID | ||
| 31 | + */ | ||
| 32 | + @TableId | ||
| 33 | + private Long id; | ||
| 34 | + /** | ||
| 35 | + * 业务线:yl 园林,wy 物业,sz 市政 | ||
| 36 | + */ | ||
| 37 | + private String busiLine; | ||
| 38 | + /** | ||
| 39 | + * 事件编号 | ||
| 40 | + */ | ||
| 41 | + private String eventNo; | ||
| 42 | + /** | ||
| 43 | + * 事件名称 | ||
| 44 | + */ | ||
| 45 | + private String evetName; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 事件设备 | ||
| 49 | + */ | ||
| 50 | + private String eventDevice; | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 事件设备编码 | ||
| 54 | + */ | ||
| 55 | + private String eventDeviceCode; | ||
| 56 | + /** | ||
| 57 | + * 提交时间 | ||
| 58 | + */ | ||
| 59 | + private LocalDateTime commitDate; | ||
| 60 | + /** | ||
| 61 | + * 完成时间 | ||
| 62 | + */ | ||
| 63 | + private LocalDateTime finishDate; | ||
| 64 | + /** | ||
| 65 | + * 经纬度类型: 1:国标; 2:百度;3:高德;4:腾讯 | ||
| 66 | + */ | ||
| 67 | + private Integer latLonType; | ||
| 68 | + /** | ||
| 69 | + * 经度 | ||
| 70 | + */ | ||
| 71 | + private BigDecimal lat; | ||
| 72 | + /** | ||
| 73 | + * 维度 | ||
| 74 | + */ | ||
| 75 | + private BigDecimal lon; | ||
| 76 | + /** | ||
| 77 | + * 经纬度地址 | ||
| 78 | + */ | ||
| 79 | + private String lonLatAddress; | ||
| 80 | + /** | ||
| 81 | + * 用户提交照片 | ||
| 82 | + */ | ||
| 83 | + private String confrimImgs; | ||
| 84 | + /** | ||
| 85 | + * 事件状态 | ||
| 86 | + */ | ||
| 87 | + private Integer eventStatus; | ||
| 88 | + /** | ||
| 89 | + * 事件描述 | ||
| 90 | + */ | ||
| 91 | + private String remark; | ||
| 92 | + | ||
| 93 | + | ||
| 94 | +} | ||
| 0 | \ No newline at end of file | 95 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/dataobject/eventmappinginfo/EventMappingInfoDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.dal.dataobject.eventmappinginfo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import java.time.LocalDateTime; | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 11 | +import com.zteits.urbanops.framework.mybatis.core.dataobject.BaseDO; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 工单事件映射 DO | ||
| 15 | + * | ||
| 16 | + * @author 超级管理员 | ||
| 17 | + */ | ||
| 18 | +@TableName("workorder_event_mapping_info") | ||
| 19 | +@KeySequence("workorder_event_mapping_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 20 | +@Data | ||
| 21 | +@EqualsAndHashCode(callSuper = true) | ||
| 22 | +@ToString(callSuper = true) | ||
| 23 | +@Builder | ||
| 24 | +@NoArgsConstructor | ||
| 25 | +@AllArgsConstructor | ||
| 26 | +public class EventMappingInfoDO extends BaseDO { | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * ID | ||
| 30 | + */ | ||
| 31 | + @TableId | ||
| 32 | + private Long id; | ||
| 33 | + /** | ||
| 34 | + * 业务线:yl 园林,wy 物业,sz 市政 | ||
| 35 | + */ | ||
| 36 | + private String busiLine; | ||
| 37 | + /** | ||
| 38 | + * 事件编号 | ||
| 39 | + */ | ||
| 40 | + private String eventNo; | ||
| 41 | + /** | ||
| 42 | + * 工单号 | ||
| 43 | + */ | ||
| 44 | + private String orderNo; | ||
| 45 | + /** | ||
| 46 | + * 道路ID | ||
| 47 | + */ | ||
| 48 | + private String roadId; | ||
| 49 | + /** | ||
| 50 | + * 道路名称 | ||
| 51 | + */ | ||
| 52 | + private String roadName; | ||
| 53 | + /** | ||
| 54 | + * 紧急程度:1:特急;2:紧急;3:一般 | ||
| 55 | + */ | ||
| 56 | + private Integer pressingType; | ||
| 57 | + /** | ||
| 58 | + * 养护级别ID | ||
| 59 | + */ | ||
| 60 | + private Integer curingLevelId; | ||
| 61 | + /** | ||
| 62 | + * 养护级别 | ||
| 63 | + */ | ||
| 64 | + private String curingLevelName; | ||
| 65 | + /** | ||
| 66 | + * 提交时间 | ||
| 67 | + */ | ||
| 68 | + private LocalDateTime commitDate; | ||
| 69 | + /** | ||
| 70 | + * 希望完成时间 | ||
| 71 | + */ | ||
| 72 | + private LocalDateTime expectedFinishDate; | ||
| 73 | + /** | ||
| 74 | + * 完成时间 | ||
| 75 | + */ | ||
| 76 | + private LocalDateTime finishDate; | ||
| 77 | + /** | ||
| 78 | + * 提交用户ID | ||
| 79 | + */ | ||
| 80 | + private Long userId; | ||
| 81 | + /** | ||
| 82 | + * 提交用户名称 | ||
| 83 | + */ | ||
| 84 | + private String userName; | ||
| 85 | + /** | ||
| 86 | + * 提交用户的company_id | ||
| 87 | + */ | ||
| 88 | + private Long companyId; | ||
| 89 | + /** | ||
| 90 | + * 部门id | ||
| 91 | + */ | ||
| 92 | + private Long deptId; | ||
| 93 | + /** | ||
| 94 | + * 审批状态 | ||
| 95 | + */ | ||
| 96 | + private Integer status; | ||
| 97 | + /** | ||
| 98 | + * 备注 | ||
| 99 | + */ | ||
| 100 | + private String remark; | ||
| 101 | + | ||
| 102 | + | ||
| 103 | +} | ||
| 0 | \ No newline at end of file | 104 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/mysql/eventinfo/EventInfoMapper.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.dal.mysql.eventinfo; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | + | ||
| 5 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 6 | +import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 7 | +import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; | ||
| 8 | +import com.zteits.urbanops.module.workorder.dal.dataobject.eventinfo.EventInfoDO; | ||
| 9 | +import org.apache.ibatis.annotations.Mapper; | ||
| 10 | +import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.*; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 工单事件 Mapper | ||
| 14 | + * | ||
| 15 | + * @author 超级管理员 | ||
| 16 | + */ | ||
| 17 | +@Mapper | ||
| 18 | +public interface EventInfoMapper extends BaseMapperX<EventInfoDO> { | ||
| 19 | + | ||
| 20 | + default PageResult<EventInfoDO> selectPage(EventInfoPageReqVO reqVO) { | ||
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<EventInfoDO>() | ||
| 22 | + .eqIfPresent(EventInfoDO::getBusiLine, reqVO.getBusiLine()) | ||
| 23 | + .eqIfPresent(EventInfoDO::getEventNo, reqVO.getEventNo()) | ||
| 24 | + .likeIfPresent(EventInfoDO::getEvetName, reqVO.getEvetName()) | ||
| 25 | + .eqIfPresent(EventInfoDO::getEventDevice, reqVO.getEventDevice()) | ||
| 26 | + .eqIfPresent(EventInfoDO::getEventDeviceCode, reqVO.getEventDeviceCode()) | ||
| 27 | + .betweenIfPresent(EventInfoDO::getCommitDate, reqVO.getCommitDate()) | ||
| 28 | + .betweenIfPresent(EventInfoDO::getFinishDate, reqVO.getFinishDate()) | ||
| 29 | + .eqIfPresent(EventInfoDO::getLatLonType, reqVO.getLatLonType()) | ||
| 30 | + .eqIfPresent(EventInfoDO::getLat, reqVO.getLat()) | ||
| 31 | + .eqIfPresent(EventInfoDO::getLon, reqVO.getLon()) | ||
| 32 | + .eqIfPresent(EventInfoDO::getLonLatAddress, reqVO.getLonLatAddress()) | ||
| 33 | + .eqIfPresent(EventInfoDO::getConfrimImgs, reqVO.getConfrimImgs()) | ||
| 34 | + .eqIfPresent(EventInfoDO::getEventStatus, reqVO.getEventStatus()) | ||
| 35 | + .eqIfPresent(EventInfoDO::getRemark, reqVO.getRemark()) | ||
| 36 | + .betweenIfPresent(EventInfoDO::getCreateTime, reqVO.getCreateTime()) | ||
| 37 | + .orderByDesc(EventInfoDO::getId)); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | +} | ||
| 0 | \ No newline at end of file | 41 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/mysql/eventmappinginfo/EventMappingInfoMapper.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.dal.mysql.eventmappinginfo; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | + | ||
| 5 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 6 | +import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 7 | +import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; | ||
| 8 | +import com.zteits.urbanops.module.workorder.dal.dataobject.eventmappinginfo.EventMappingInfoDO; | ||
| 9 | +import org.apache.ibatis.annotations.Mapper; | ||
| 10 | +import com.zteits.urbanops.module.workorder.controller.admin.eventmappinginfo.vo.*; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 工单事件映射 Mapper | ||
| 14 | + * | ||
| 15 | + * @author 超级管理员 | ||
| 16 | + */ | ||
| 17 | +@Mapper | ||
| 18 | +public interface EventMappingInfoMapper extends BaseMapperX<EventMappingInfoDO> { | ||
| 19 | + | ||
| 20 | + default PageResult<EventMappingInfoDO> selectPage(EventMappingInfoPageReqVO reqVO) { | ||
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<EventMappingInfoDO>() | ||
| 22 | + .eqIfPresent(EventMappingInfoDO::getBusiLine, reqVO.getBusiLine()) | ||
| 23 | + .eqIfPresent(EventMappingInfoDO::getEventNo, reqVO.getEventNo()) | ||
| 24 | + .eqIfPresent(EventMappingInfoDO::getOrderNo, reqVO.getOrderNo()) | ||
| 25 | + .eqIfPresent(EventMappingInfoDO::getRoadId, reqVO.getRoadId()) | ||
| 26 | + .likeIfPresent(EventMappingInfoDO::getRoadName, reqVO.getRoadName()) | ||
| 27 | + .eqIfPresent(EventMappingInfoDO::getPressingType, reqVO.getPressingType()) | ||
| 28 | + .eqIfPresent(EventMappingInfoDO::getCuringLevelId, reqVO.getCuringLevelId()) | ||
| 29 | + .likeIfPresent(EventMappingInfoDO::getCuringLevelName, reqVO.getCuringLevelName()) | ||
| 30 | + .betweenIfPresent(EventMappingInfoDO::getCommitDate, reqVO.getCommitDate()) | ||
| 31 | + .betweenIfPresent(EventMappingInfoDO::getExpectedFinishDate, reqVO.getExpectedFinishDate()) | ||
| 32 | + .betweenIfPresent(EventMappingInfoDO::getFinishDate, reqVO.getFinishDate()) | ||
| 33 | + .eqIfPresent(EventMappingInfoDO::getUserId, reqVO.getUserId()) | ||
| 34 | + .likeIfPresent(EventMappingInfoDO::getUserName, reqVO.getUserName()) | ||
| 35 | + .eqIfPresent(EventMappingInfoDO::getCompanyId, reqVO.getCompanyId()) | ||
| 36 | + .eqIfPresent(EventMappingInfoDO::getDeptId, reqVO.getDeptId()) | ||
| 37 | + .eqIfPresent(EventMappingInfoDO::getStatus, reqVO.getStatus()) | ||
| 38 | + .eqIfPresent(EventMappingInfoDO::getRemark, reqVO.getRemark()) | ||
| 39 | + .betweenIfPresent(EventMappingInfoDO::getCreateTime, reqVO.getCreateTime()) | ||
| 40 | + .orderByDesc(EventMappingInfoDO::getId)); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | +} | ||
| 0 | \ No newline at end of file | 44 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/EventStatusEnum.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.enums; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonValue; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Getter; | ||
| 6 | + | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 9 | +@Schema(description = "工单事件状态枚举") | ||
| 10 | +@Getter | ||
| 11 | +public enum EventStatusEnum { | ||
| 12 | + PENDING(0, "待处理"), | ||
| 13 | + ORDER(1, "已转工单"), | ||
| 14 | + FINISHED(2, "已结束"); | ||
| 15 | + | ||
| 16 | + @JsonValue // 序列化时返回code(前端接收数字) | ||
| 17 | + private final Integer code; | ||
| 18 | + private final String desc; | ||
| 19 | + | ||
| 20 | + EventStatusEnum(Integer code, String desc) { | ||
| 21 | + this.code = code; | ||
| 22 | + this.desc = desc; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + // 根据code获取枚举(业务层转换用) | ||
| 26 | + public static EventStatusEnum getByCode(Integer code) { | ||
| 27 | + return Arrays.stream(values()) | ||
| 28 | + .filter(e -> e.getCode().equals(code)) | ||
| 29 | + .findFirst() | ||
| 30 | + .orElseThrow(() -> new IllegalArgumentException("无效的同意类型:" + code)); | ||
| 31 | + } | ||
| 32 | +} | ||
| 0 | \ No newline at end of file | 33 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/enums/SysMappingEnum.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.enums; | ||
| 2 | + | ||
| 3 | +import lombok.Getter; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 系统映射枚举 | ||
| 7 | + */ | ||
| 8 | +public enum SysMappingEnum { | ||
| 9 | + | ||
| 10 | + //智慧园林:sls,智慧市政:sms,智慧物业:smp" | ||
| 11 | + YL("sls", "智慧园林"), | ||
| 12 | + SZ("sms", "智慧市政"), | ||
| 13 | + WY("smp", "智慧物业"); | ||
| 14 | + | ||
| 15 | + @Getter | ||
| 16 | + private String sysCode; | ||
| 17 | + @Getter | ||
| 18 | + private String description; | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + SysMappingEnum(String sysCode, String description) { | ||
| 22 | + this.sysCode = sysCode; | ||
| 23 | + this.description = description; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public static SysMappingEnum getByName(String name) { | ||
| 27 | + for (SysMappingEnum node : values()) { | ||
| 28 | + if (node.name().equalsIgnoreCase(name) ) { | ||
| 29 | + return node; | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + throw new IllegalArgumentException("未知的系统: " + name); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public static SysMappingEnum getBySysCode(String sysCode) { | ||
| 36 | + for (SysMappingEnum node : values()) { | ||
| 37 | + if (node.getSysCode().equals(sysCode) ) { | ||
| 38 | + return node; | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + throw new IllegalArgumentException("未知的系统: " + sysCode); | ||
| 42 | + } | ||
| 43 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.eventinfo; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | +import jakarta.validation.*; | ||
| 5 | +import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.*; | ||
| 6 | +import com.zteits.urbanops.module.workorder.dal.dataobject.eventinfo.EventInfoDO; | ||
| 7 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 8 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 工单事件 Service 接口 | ||
| 12 | + * | ||
| 13 | + * @author 超级管理员 | ||
| 14 | + */ | ||
| 15 | +public interface EventInfoService { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 创建工单事件 | ||
| 19 | + * | ||
| 20 | + * @param createReqVO 创建信息 | ||
| 21 | + * @return 编号 | ||
| 22 | + */ | ||
| 23 | + Long createEventInfo(@Valid EventInfoSaveReqVO createReqVO); | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 更新工单事件 | ||
| 27 | + * | ||
| 28 | + * @param updateReqVO 更新信息 | ||
| 29 | + */ | ||
| 30 | + void updateEventInfo(@Valid EventInfoSaveReqVO updateReqVO); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 删除工单事件 | ||
| 34 | + * | ||
| 35 | + * @param id 编号 | ||
| 36 | + */ | ||
| 37 | + void deleteEventInfo(Long id); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 批量删除工单事件 | ||
| 41 | + * | ||
| 42 | + * @param ids 编号 | ||
| 43 | + */ | ||
| 44 | + void deleteEventInfoListByIds(List<Long> ids); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 获得工单事件 | ||
| 48 | + * | ||
| 49 | + * @param id 编号 | ||
| 50 | + * @return 工单事件 | ||
| 51 | + */ | ||
| 52 | + EventInfoDO getEventInfo(Long id); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 获得工单事件分页 | ||
| 56 | + * | ||
| 57 | + * @param pageReqVO 分页查询 | ||
| 58 | + * @return 工单事件分页 | ||
| 59 | + */ | ||
| 60 | + PageResult<EventInfoDO> getEventInfoPage(EventInfoPageReqVO pageReqVO); | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 结束工单事件 | ||
| 64 | + * | ||
| 65 | + * @param id 工单事件编号 | ||
| 66 | + */ | ||
| 67 | + void endEventInfo(@Valid Long id); | ||
| 68 | + | ||
| 69 | + void createEventOrderInfo(@Valid EventOrderInfoSaveReqVO createReqVO); | ||
| 70 | + | ||
| 71 | +} | ||
| 0 | \ No newline at end of file | 72 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventinfo/EventInfoServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.eventinfo; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import com.zteits.urbanops.module.workorder.enums.EventStatusEnum; | ||
| 5 | +import org.springframework.stereotype.Service; | ||
| 6 | +import jakarta.annotation.Resource; | ||
| 7 | +import org.springframework.validation.annotation.Validated; | ||
| 8 | +import org.springframework.transaction.annotation.Transactional; | ||
| 9 | + | ||
| 10 | +import java.util.*; | ||
| 11 | +import com.zteits.urbanops.module.workorder.controller.admin.eventinfo.vo.*; | ||
| 12 | +import com.zteits.urbanops.module.workorder.dal.dataobject.eventinfo.EventInfoDO; | ||
| 13 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 14 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 15 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 16 | + | ||
| 17 | +import com.zteits.urbanops.module.workorder.dal.mysql.eventinfo.EventInfoMapper; | ||
| 18 | + | ||
| 19 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 20 | +import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertList; | ||
| 21 | +import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.diffList; | ||
| 22 | +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * 工单事件 Service 实现类 | ||
| 26 | + * | ||
| 27 | + * @author 超级管理员 | ||
| 28 | + */ | ||
| 29 | +@Service | ||
| 30 | +@Validated | ||
| 31 | +public class EventInfoServiceImpl implements EventInfoService { | ||
| 32 | + | ||
| 33 | + @Resource | ||
| 34 | + private EventInfoMapper eventInfoMapper; | ||
| 35 | + | ||
| 36 | + @Override | ||
| 37 | + public Long createEventInfo(EventInfoSaveReqVO createReqVO) { | ||
| 38 | + // 插入 | ||
| 39 | + EventInfoDO eventInfo = BeanUtils.toBean(createReqVO, EventInfoDO.class); | ||
| 40 | + eventInfoMapper.insert(eventInfo); | ||
| 41 | + | ||
| 42 | + // 返回 | ||
| 43 | + return eventInfo.getId(); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @Override | ||
| 47 | + public void updateEventInfo(EventInfoSaveReqVO updateReqVO) { | ||
| 48 | + // 校验存在 | ||
| 49 | + validateEventInfoExists(updateReqVO.getId()); | ||
| 50 | + // 更新 | ||
| 51 | + EventInfoDO updateObj = BeanUtils.toBean(updateReqVO, EventInfoDO.class); | ||
| 52 | + eventInfoMapper.updateById(updateObj); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Override | ||
| 56 | + public void deleteEventInfo(Long id) { | ||
| 57 | + // 校验存在 | ||
| 58 | + validateEventInfoExists(id); | ||
| 59 | + // 删除 | ||
| 60 | + eventInfoMapper.deleteById(id); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public void deleteEventInfoListByIds(List<Long> ids) { | ||
| 65 | + // 删除 | ||
| 66 | + eventInfoMapper.deleteByIds(ids); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + | ||
| 70 | + private void validateEventInfoExists(Long id) { | ||
| 71 | + if (eventInfoMapper.selectById(id) == null) { | ||
| 72 | + throw exception(EVENT_INFO_NOT_EXISTS); | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @Override | ||
| 77 | + public EventInfoDO getEventInfo(Long id) { | ||
| 78 | + return eventInfoMapper.selectById(id); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @Override | ||
| 82 | + public PageResult<EventInfoDO> getEventInfoPage(EventInfoPageReqVO pageReqVO) { | ||
| 83 | + return eventInfoMapper.selectPage(pageReqVO); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + @Override | ||
| 87 | + public void endEventInfo(Long id) { | ||
| 88 | + // 校验存在 | ||
| 89 | + validateEventInfoExists(id); | ||
| 90 | + // 更新 | ||
| 91 | + EventInfoDO updateObj = new EventInfoDO(); | ||
| 92 | + updateObj.setId(id); | ||
| 93 | + updateObj.setEventStatus(EventStatusEnum.FINISHED.getCode()); | ||
| 94 | + eventInfoMapper.updateById(updateObj); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @Override | ||
| 98 | + public void createEventOrderInfo(EventOrderInfoSaveReqVO createReqVO) { | ||
| 99 | + //TODO @lesan:工单事件工单创建 | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | +} | ||
| 0 | \ No newline at end of file | 103 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventmappinginfo/EventMappingInfoService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.eventmappinginfo; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | +import jakarta.validation.*; | ||
| 5 | +import com.zteits.urbanops.module.workorder.controller.admin.eventmappinginfo.vo.*; | ||
| 6 | +import com.zteits.urbanops.module.workorder.dal.dataobject.eventmappinginfo.EventMappingInfoDO; | ||
| 7 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 8 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 工单事件映射 Service 接口 | ||
| 12 | + * | ||
| 13 | + * @author 超级管理员 | ||
| 14 | + */ | ||
| 15 | +public interface EventMappingInfoService { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 创建工单事件映射 | ||
| 19 | + * | ||
| 20 | + * @param createReqVO 创建信息 | ||
| 21 | + * @return 编号 | ||
| 22 | + */ | ||
| 23 | + Long createEventMappingInfo(@Valid EventMappingInfoSaveReqVO createReqVO); | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 更新工单事件映射 | ||
| 27 | + * | ||
| 28 | + * @param updateReqVO 更新信息 | ||
| 29 | + */ | ||
| 30 | + void updateEventMappingInfo(@Valid EventMappingInfoSaveReqVO updateReqVO); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 删除工单事件映射 | ||
| 34 | + * | ||
| 35 | + * @param id 编号 | ||
| 36 | + */ | ||
| 37 | + void deleteEventMappingInfo(Long id); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 批量删除工单事件映射 | ||
| 41 | + * | ||
| 42 | + * @param ids 编号 | ||
| 43 | + */ | ||
| 44 | + void deleteEventMappingInfoListByIds(List<Long> ids); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 获得工单事件映射 | ||
| 48 | + * | ||
| 49 | + * @param id 编号 | ||
| 50 | + * @return 工单事件映射 | ||
| 51 | + */ | ||
| 52 | + EventMappingInfoDO getEventMappingInfo(Long id); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 获得工单事件映射分页 | ||
| 56 | + * | ||
| 57 | + * @param pageReqVO 分页查询 | ||
| 58 | + * @return 工单事件映射分页 | ||
| 59 | + */ | ||
| 60 | + PageResult<EventMappingInfoDO> getEventMappingInfoPage(EventMappingInfoPageReqVO pageReqVO); | ||
| 61 | + | ||
| 62 | +} | ||
| 0 | \ No newline at end of file | 63 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/eventmappinginfo/EventMappingInfoServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.eventmappinginfo; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import org.springframework.stereotype.Service; | ||
| 5 | +import jakarta.annotation.Resource; | ||
| 6 | +import org.springframework.validation.annotation.Validated; | ||
| 7 | +import org.springframework.transaction.annotation.Transactional; | ||
| 8 | + | ||
| 9 | +import java.util.*; | ||
| 10 | +import com.zteits.urbanops.module.workorder.controller.admin.eventmappinginfo.vo.*; | ||
| 11 | +import com.zteits.urbanops.module.workorder.dal.dataobject.eventmappinginfo.EventMappingInfoDO; | ||
| 12 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 13 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 14 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 15 | + | ||
| 16 | +import com.zteits.urbanops.module.workorder.dal.mysql.eventmappinginfo.EventMappingInfoMapper; | ||
| 17 | + | ||
| 18 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 19 | +import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertList; | ||
| 20 | +import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.diffList; | ||
| 21 | +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.*; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * 工单事件映射 Service 实现类 | ||
| 25 | + * | ||
| 26 | + * @author 超级管理员 | ||
| 27 | + */ | ||
| 28 | +@Service | ||
| 29 | +@Validated | ||
| 30 | +public class EventMappingInfoServiceImpl implements EventMappingInfoService { | ||
| 31 | + | ||
| 32 | + @Resource | ||
| 33 | + private EventMappingInfoMapper eventMappingInfoMapper; | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public Long createEventMappingInfo(EventMappingInfoSaveReqVO createReqVO) { | ||
| 37 | + // 插入 | ||
| 38 | + EventMappingInfoDO eventMappingInfo = BeanUtils.toBean(createReqVO, EventMappingInfoDO.class); | ||
| 39 | + eventMappingInfoMapper.insert(eventMappingInfo); | ||
| 40 | + | ||
| 41 | + // 返回 | ||
| 42 | + return eventMappingInfo.getId(); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + public void updateEventMappingInfo(EventMappingInfoSaveReqVO updateReqVO) { | ||
| 47 | + // 校验存在 | ||
| 48 | + validateEventMappingInfoExists(updateReqVO.getId()); | ||
| 49 | + // 更新 | ||
| 50 | + EventMappingInfoDO updateObj = BeanUtils.toBean(updateReqVO, EventMappingInfoDO.class); | ||
| 51 | + eventMappingInfoMapper.updateById(updateObj); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @Override | ||
| 55 | + public void deleteEventMappingInfo(Long id) { | ||
| 56 | + // 校验存在 | ||
| 57 | + validateEventMappingInfoExists(id); | ||
| 58 | + // 删除 | ||
| 59 | + eventMappingInfoMapper.deleteById(id); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public void deleteEventMappingInfoListByIds(List<Long> ids) { | ||
| 64 | + // 删除 | ||
| 65 | + eventMappingInfoMapper.deleteByIds(ids); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + | ||
| 69 | + private void validateEventMappingInfoExists(Long id) { | ||
| 70 | + if (eventMappingInfoMapper.selectById(id) == null) { | ||
| 71 | + throw exception(EVENT_MAPPING_INFO_NOT_EXISTS); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @Override | ||
| 76 | + public EventMappingInfoDO getEventMappingInfo(Long id) { | ||
| 77 | + return eventMappingInfoMapper.selectById(id); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public PageResult<EventMappingInfoDO> getEventMappingInfoPage(EventMappingInfoPageReqVO pageReqVO) { | ||
| 82 | + return eventMappingInfoMapper.selectPage(pageReqVO); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | +} | ||
| 0 | \ No newline at end of file | 86 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenAdminService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.garden; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 4 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenTaskAssignReqVO; | ||
| 5 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; | ||
| 6 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderRespVO; | ||
| 7 | +import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoExtDO; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * @Classname BpmGardenAdminService | ||
| 13 | + * @Description PC端流程操作 | ||
| 14 | + * @Date 2025/12/20 10:27 | ||
| 15 | + * @Created by wangqian | ||
| 16 | + */ | ||
| 17 | +public interface BpmGardenAdminService { | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 工单业务待办 列表 -pc端 | ||
| 21 | + * @param pageVO | ||
| 22 | + * @return | ||
| 23 | + */ | ||
| 24 | + PageResult<MainInfoExtDO> getTaskTodoBuzSimplePage(BpmGardenWorkOrderPageReqVO pageVO); | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * @Author wangqian | ||
| 28 | + * @Description 分配工单 | ||
| 29 | + * @Date 2025/12/20 10:43 | ||
| 30 | + * @Param reqVO | ||
| 31 | + * @Return java.lang.Boolean | ||
| 32 | + */ | ||
| 33 | + public Boolean assignWOrder(List<BpmGardenTaskAssignReqVO> reqVO); | ||
| 34 | + | ||
| 35 | + | ||
| 36 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenAdminServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.garden; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 4 | +import com.zteits.urbanops.framework.common.util.object.ObjectUtils; | ||
| 5 | +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | ||
| 6 | +import com.zteits.urbanops.module.system.api.user.AdminUserApi; | ||
| 7 | +import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant; | ||
| 8 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenTaskAssignReqVO; | ||
| 9 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderPageReqVO; | ||
| 10 | +import com.zteits.urbanops.module.workorder.controller.admin.garden.vo.BpmGardenWorkOrderRespVO; | ||
| 11 | +import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoHasTaskPageReqVO; | ||
| 12 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.AppGardenWorkOrderPageReqVO; | ||
| 13 | +import com.zteits.urbanops.module.workorder.convert.garden.AppGardenTaskConvert; | ||
| 14 | +import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoDO; | ||
| 15 | +import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoExtDO; | ||
| 16 | +import com.zteits.urbanops.module.workorder.dal.mysql.attachment.AttachmentMapper; | ||
| 17 | +import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoExtMapper; | ||
| 18 | +import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoMapper; | ||
| 19 | +import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderRespVO; | ||
| 20 | +import com.zteits.urbanops.module.workorder.service.maininfo.MainInfoService; | ||
| 21 | +import jakarta.annotation.Resource; | ||
| 22 | +import org.apache.commons.collections4.CollectionUtils; | ||
| 23 | +import org.springframework.stereotype.Service; | ||
| 24 | +import org.springframework.transaction.annotation.Transactional; | ||
| 25 | + | ||
| 26 | +import java.util.List; | ||
| 27 | + | ||
| 28 | +import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; | ||
| 29 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception0; | ||
| 30 | + | ||
| 31 | +/** | ||
| 32 | + * @Classname BpmGardenAdminServiceImpl | ||
| 33 | + * @Description PC端流程操作 | ||
| 34 | + * @Date 2025/12/20 10:28 | ||
| 35 | + * @Created by wangqian | ||
| 36 | + */ | ||
| 37 | +@Service | ||
| 38 | +public class BpmGardenAdminServiceImpl implements BpmGardenAdminService { | ||
| 39 | + | ||
| 40 | + @Resource | ||
| 41 | + private MainInfoService mainInfoService; | ||
| 42 | + | ||
| 43 | + @Resource | ||
| 44 | + private MainInfoMapper mainInfoMapper; | ||
| 45 | + @Resource | ||
| 46 | + private MainInfoExtMapper workOrderExtMapper; | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public PageResult<MainInfoExtDO> getTaskTodoBuzSimplePage(BpmGardenWorkOrderPageReqVO pageVO) { | ||
| 50 | + MainInfoHasTaskPageReqVO taskBuzReqVO = new MainInfoHasTaskPageReqVO(); | ||
| 51 | + | ||
| 52 | + taskBuzReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId()); | ||
| 53 | + //只查普通工单 | ||
| 54 | + taskBuzReqVO.setOrderType(BpmCommonConstant.ORDER_TYPE_C); | ||
| 55 | + return workOrderExtMapper.selectWorkOrderTodoPage(pageVO,taskBuzReqVO); | ||
| 56 | + } | ||
| 57 | + /** | ||
| 58 | + * @Author wangqian | ||
| 59 | + * @Description 分配工单 | ||
| 60 | + * @Date 2025/12/20 10:32 | ||
| 61 | + * @Param reqVO | ||
| 62 | + * @Return void | ||
| 63 | + */ | ||
| 64 | + @Override | ||
| 65 | + @Transactional | ||
| 66 | + public Boolean assignWOrder(List<BpmGardenTaskAssignReqVO> reqVO) { | ||
| 67 | + if (CollectionUtils.isEmpty(reqVO) || reqVO.size() > 1) { | ||
| 68 | + throw exception0(BAD_REQUEST.getCode(),"分配工单参数异常"); | ||
| 69 | + } | ||
| 70 | + //获取工单信息 | ||
| 71 | + MainInfoDO mainInfo = mainInfoService.getMainInfo(reqVO.get(0).getId()); | ||
| 72 | + if (mainInfo == null) { | ||
| 73 | + throw exception0(BAD_REQUEST.getCode(),"工单信息不存在"); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + //分配工单 | ||
| 77 | + for (BpmGardenTaskAssignReqVO assignReqVO : reqVO) { | ||
| 78 | + //bmp推进工作流 | ||
| 79 | + | ||
| 80 | + //跟新工单信息 | ||
| 81 | + MainInfoDO mainInfoDO = new MainInfoDO(); | ||
| 82 | + mainInfoDO.setRoadId(assignReqVO.getRoadId()); | ||
| 83 | + mainInfoDO.setRoadName(assignReqVO.getRoadName()); | ||
| 84 | + mainInfoDO.setBusiLine(assignReqVO.getBusiLine()); | ||
| 85 | + mainInfoDO.setPressingType(assignReqVO.getPressingType()); | ||
| 86 | + mainInfoMapper.updateById(mainInfoDO); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + return Boolean.TRUE; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + | ||
| 93 | +} |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/geocode/GeoCodeService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.geocode; | ||
| 2 | + | ||
| 3 | +import java.math.BigDecimal; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 地理编码服务接口 | ||
| 7 | + * | ||
| 8 | + * @author gelinghu | ||
| 9 | + */ | ||
| 10 | +public interface GeoCodeService { | ||
| 11 | + | ||
| 12 | + /** | ||
| 13 | + * 根据经纬度获取详细地址 | ||
| 14 | + * | ||
| 15 | + * @param latitude 纬度 | ||
| 16 | + * @param longitude 经度 | ||
| 17 | + * @return 详细地址,如果获取失败返回 null | ||
| 18 | + */ | ||
| 19 | + String getAddressByLocation(BigDecimal latitude, BigDecimal longitude); | ||
| 20 | +} | ||
| 0 | \ No newline at end of file | 21 | \ No newline at end of file |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/geocode/impl/AmapGeoCodeServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.geocode.impl; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.util.StrUtil; | ||
| 4 | +import cn.hutool.crypto.digest.MD5; | ||
| 5 | +import cn.hutool.json.JSONObject; | ||
| 6 | +import cn.hutool.json.JSONUtil; | ||
| 7 | +import com.zteits.urbanops.framework.common.util.http.HttpUtils; | ||
| 8 | +import com.zteits.urbanops.module.workorder.config.AmapProperties; | ||
| 9 | +import com.zteits.urbanops.module.workorder.service.geocode.GeoCodeService; | ||
| 10 | +import lombok.RequiredArgsConstructor; | ||
| 11 | +import lombok.extern.slf4j.Slf4j; | ||
| 12 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
| 13 | +import org.springframework.stereotype.Service; | ||
| 14 | + | ||
| 15 | +import java.math.BigDecimal; | ||
| 16 | +import java.net.URLEncoder; | ||
| 17 | +import java.nio.charset.StandardCharsets; | ||
| 18 | +import java.util.HashMap; | ||
| 19 | +import java.util.Map; | ||
| 20 | +import java.util.TreeMap; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * 高德地理编码服务实现 | ||
| 24 | + * | ||
| 25 | + * @author gelinghu | ||
| 26 | + */ | ||
| 27 | +@Slf4j | ||
| 28 | +@Service | ||
| 29 | +@RequiredArgsConstructor | ||
| 30 | +@ConditionalOnProperty(prefix = "amap", name = "enabled", havingValue = "true", matchIfMissing = true) | ||
| 31 | +public class AmapGeoCodeServiceImpl implements GeoCodeService { | ||
| 32 | + | ||
| 33 | + private final AmapProperties amapProperties; | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public String getAddressByLocation(BigDecimal latitude, BigDecimal longitude) { | ||
| 37 | + if (latitude == null || longitude == null) { | ||
| 38 | + log.warn("[getAddressByLocation] 经纬度不能为空: lat={}, lon={}", latitude, longitude); | ||
| 39 | + return null; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + try { | ||
| 43 | + // 将 BigDecimal 转换为 Double | ||
| 44 | + Double lat = latitude.doubleValue(); | ||
| 45 | + Double lon = longitude.doubleValue(); | ||
| 46 | + | ||
| 47 | + // 1. 构建请求参数 | ||
| 48 | + Map<String, String> params = buildRequestParams(lon, lat); | ||
| 49 | + | ||
| 50 | + // 2. 构建完整的请求 URL | ||
| 51 | + String url = buildRequestUrl(params); | ||
| 52 | + | ||
| 53 | + // 3. 发起 HTTP 请求 | ||
| 54 | + String responseBody = HttpUtils.get(url); | ||
| 55 | + if (StrUtil.isBlank(responseBody)) { | ||
| 56 | + log.warn("[getAddressByLocation] 高德API响应为空: lat={}, lon={}", latitude, longitude); | ||
| 57 | + return null; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + // 4. 解析响应结果 | ||
| 61 | + return parseResponse(responseBody, latitude, longitude); | ||
| 62 | + | ||
| 63 | + } catch (Exception e) { | ||
| 64 | + log.error("[getAddressByLocation] 调用高德地理编码API异常: lat={}, lon={}", latitude, longitude, e); | ||
| 65 | + return null; | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 构建请求参数 | ||
| 71 | + */ | ||
| 72 | + private Map<String, String> buildRequestParams(Double longitude, Double latitude) { | ||
| 73 | + Map<String, String> params = new HashMap<>(); | ||
| 74 | + params.put("key", amapProperties.getApiKey()); | ||
| 75 | + params.put("location", longitude + "," + latitude); | ||
| 76 | + params.put("poitype", ""); // 返回附近POI类型 | ||
| 77 | + params.put("radius", "1000"); // 搜索半径,单位:米 | ||
| 78 | + params.put("extensions", "base"); // 返回结果控制,base:返回基本地址信息;all:返回地址信息及附近POI、道路、交叉口等信息 | ||
| 79 | + params.put("batch", "false"); // 批量查询控制 | ||
| 80 | + params.put("roadlevel", "0"); // 道路等级 | ||
| 81 | + | ||
| 82 | + // 如果启用了数字签名,则添加签名参数 | ||
| 83 | + if (Boolean.TRUE.equals(amapProperties.getEnableSignature()) && | ||
| 84 | + StrUtil.isNotBlank(amapProperties.getPrivateKey())) { | ||
| 85 | + String signature = generateSignature(params, amapProperties.getPrivateKey()); | ||
| 86 | + params.put("sig", signature); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + return params; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * 构建完整的请求 URL | ||
| 94 | + */ | ||
| 95 | + private String buildRequestUrl(Map<String, String> params) { | ||
| 96 | + StringBuilder url = new StringBuilder(amapProperties.getGeocodeUrl()); | ||
| 97 | + url.append("?"); | ||
| 98 | + | ||
| 99 | + boolean first = true; | ||
| 100 | + for (Map.Entry<String, String> entry : params.entrySet()) { | ||
| 101 | + if (!first) { | ||
| 102 | + url.append("&"); | ||
| 103 | + } | ||
| 104 | + try { | ||
| 105 | + url.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString())); | ||
| 106 | + } catch (Exception e) { | ||
| 107 | + url.append(entry.getKey()).append("=").append(entry.getValue()); | ||
| 108 | + } | ||
| 109 | + first = false; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + return url.toString(); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + /** | ||
| 116 | + * 生成数字签名 | ||
| 117 | + * 高德API数字签名算法: | ||
| 118 | + * 1. 将请求参数按ASCII码升序排列 | ||
| 119 | + * 2. 使用URL键值对的格式拼接 | ||
| 120 | + * 3. 在字符串最后拼接上私钥 | ||
| 121 | + * 4. 对整个字符串进行MD5加密 | ||
| 122 | + * | ||
| 123 | + * @param params 请求参数 | ||
| 124 | + * @param privateKey 私钥 | ||
| 125 | + * @return 签名字符串 | ||
| 126 | + */ | ||
| 127 | + private String generateSignature(Map<String, String> params, String privateKey) { | ||
| 128 | + try { | ||
| 129 | + // 使用TreeMap自动按key排序 | ||
| 130 | + TreeMap<String, String> sortedParams = new TreeMap<>(params); | ||
| 131 | + | ||
| 132 | + // 构建签名字符串 | ||
| 133 | + StringBuilder signStr = new StringBuilder(); | ||
| 134 | + boolean first = true; | ||
| 135 | + | ||
| 136 | + for (Map.Entry<String, String> entry : sortedParams.entrySet()) { | ||
| 137 | + if (!first) { | ||
| 138 | + signStr.append("&"); | ||
| 139 | + } | ||
| 140 | + signStr.append(entry.getKey()).append("=").append(entry.getValue()); | ||
| 141 | + first = false; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + // 在最后拼接私钥 | ||
| 145 | + signStr.append(privateKey); | ||
| 146 | + | ||
| 147 | + // 对整个字符串进行MD5加密 | ||
| 148 | + String signature = MD5.create().digestHex(signStr.toString()); | ||
| 149 | + | ||
| 150 | + log.debug("[generateSignature] 签名字符串: {}, 签名结果: {}", signStr.toString(), signature); | ||
| 151 | + | ||
| 152 | + return signature; | ||
| 153 | + | ||
| 154 | + } catch (Exception e) { | ||
| 155 | + log.error("[generateSignature] 生成数字签名异常", e); | ||
| 156 | + return ""; | ||
| 157 | + } | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + /** | ||
| 161 | + * 解析响应结果 | ||
| 162 | + */ | ||
| 163 | + private String parseResponse(String responseBody, BigDecimal latitude, BigDecimal longitude) { | ||
| 164 | + try { | ||
| 165 | + JSONObject response = JSONUtil.parseObj(responseBody); | ||
| 166 | + | ||
| 167 | + // 检查状态码 | ||
| 168 | + String status = response.getStr("status"); | ||
| 169 | + if (!"1".equals(status)) { | ||
| 170 | + String info = response.getStr("info"); | ||
| 171 | + log.warn("[getAddressByLocation] 高德API返回错误: status={}, info={}, lat={}, lon={}", | ||
| 172 | + status, info, latitude, longitude); | ||
| 173 | + return null; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + // 解析地址信息 | ||
| 177 | + JSONObject regeocode = response.getJSONObject("regeocode"); | ||
| 178 | + if (regeocode == null) { | ||
| 179 | + log.warn("[getAddressByLocation] 高德API未返回地址信息: lat={}, lon={}", latitude, longitude); | ||
| 180 | + return null; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + String formattedAddress = regeocode.getStr("formatted_address"); | ||
| 184 | + if (StrUtil.isNotBlank(formattedAddress)) { | ||
| 185 | + log.info("[getAddressByLocation] 成功获取地址: lat={}, lon={}, address={}", | ||
| 186 | + latitude, longitude, formattedAddress); | ||
| 187 | + return formattedAddress; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + log.warn("[getAddressByLocation] 高德API返回的地址为空: lat={}, lon={}", latitude, longitude); | ||
| 191 | + return null; | ||
| 192 | + | ||
| 193 | + } catch (Exception e) { | ||
| 194 | + log.error("[getAddressByLocation] 解析高德API响应异常: lat={}, lon={}, response={}", | ||
| 195 | + latitude, longitude, responseBody, e); | ||
| 196 | + return null; | ||
| 197 | + } | ||
| 198 | + } | ||
| 199 | +} | ||
| 0 | \ No newline at end of file | 200 | \ No newline at end of file |