diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/tree/vo/TreeSaveReqVO.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/tree/vo/TreeSaveReqVO.java index d94eb09..726212b 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/tree/vo/TreeSaveReqVO.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/tree/vo/TreeSaveReqVO.java @@ -106,21 +106,18 @@ public class TreeSaveReqVO { private String createby; @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "创建时间不能为空") private LocalDateTime createtime; @Schema(description = "更新者") private String updateby; @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "更新时间不能为空") private LocalDateTime updatetime; @Schema(description = "备注", example = "你说的对") private String remark; @Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17101") - @NotNull(message = "部门id不能为空") private Long deptId; private List treeImgList; diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/tree/TreeServiceImpl.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/tree/TreeServiceImpl.java index 1d7da96..9f6d2ef 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/tree/TreeServiceImpl.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/tree/TreeServiceImpl.java @@ -89,17 +89,17 @@ public class TreeServiceImpl implements TreeService { tree.setTreenumber(treeNum); } + treeMapper.insert(tree); + TreeChangeLogDO changeLog = new TreeChangeLogDO(); org.springframework.beans.BeanUtils.copyProperties(createReqVO, changeLog); - changeLog.setTreeid(createReqVO.getId()); + changeLog.setTreeid(tree.getId()); changeLog.setCreateby(createReqVO.getCreateby()); changeLog.setCreatetime(LocalDateTime.now()); changeLog.setUpdateby(createReqVO.getCreateby()); changeLog.setUpdatetime(LocalDateTime.now()); gardenTreeChangeLogMapper.insert(changeLog); - treeMapper.insert(tree); - // 返回 return tree.getId(); } diff --git a/urbanops-module-gloabl/src/main/java/com/zteits/urbanops/module/gloabl/api/ProblemsApiController.java b/urbanops-module-gloabl/src/main/java/com/zteits/urbanops/module/gloabl/api/ProblemsApiController.java index ed2870c..ea3b366 100644 --- a/urbanops-module-gloabl/src/main/java/com/zteits/urbanops/module/gloabl/api/ProblemsApiController.java +++ b/urbanops-module-gloabl/src/main/java/com/zteits/urbanops/module/gloabl/api/ProblemsApiController.java @@ -1,92 +1,92 @@ -package com.zteits.urbanops.module.gloabl.api; - -import com.zteits.urbanops.framework.common.pojo.CommonResult; -import com.zteits.urbanops.framework.common.util.object.BeanUtils; -import com.zteits.urbanops.module.gloabl.constants.SysMappingEnum; -import com.zteits.urbanops.module.gloabl.controller.admin.problems.vo.ProblemsApiSaveReqVO; -import com.zteits.urbanops.module.gloabl.controller.admin.problems.vo.ProblemsSaveReqVO; -import com.zteits.urbanops.module.gloabl.service.geocode.GeoCodeService; -import com.zteits.urbanops.module.gloabl.service.problems.ProblemsService; -import io.swagger.v3.oas.annotations.Operation; -import jakarta.annotation.Resource; -import jakarta.annotation.security.PermitAll; -import jakarta.validation.Valid; -import lombok.RequiredArgsConstructor; -import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.time.LocalDateTime; - -import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; - - -/** - * Description:

- *

- * Author: gelinghu - * Date: 2025年6月15 11:56 - */ -@RestController -@RequestMapping({"/gloabl/problems","/problems"}) -@RequiredArgsConstructor -public class ProblemsApiController { - - @Resource - private ProblemsService problemsService; - - @Resource - private GeoCodeService geoCodeService; - - /** - * { - * "problemName": "问题名称", - * "userConfrimRemark": "问题描述", - * "userConfrimImgs": [], //问题照片 - * "userConfrimLat": "经度", - * "userConfrimLon": "维度", - * "companyCode": "", //业务系统编码,和统一认证保持一致,智慧园林:sls,智慧市政:sms - * } - * @param createReqVO - * @return - */ - @PostMapping("") - @Operation(summary = "创建事件表--问题单") - @PermitAll - public CommonResult createProblems(@Valid @RequestBody ProblemsApiSaveReqVO createReqVO) { - createReqVO.setProblemSourceId(6); - String companyCode = createReqVO.getCompanyCode(); - if (!StringUtils.hasText(companyCode)) { - return CommonResult.error(BAD_REQUEST, "子系统编码不能为空"); - } - - SysMappingEnum sys = SysMappingEnum.getBySysCode(companyCode); - createReqVO.setCompanyCode(sys.name().toLowerCase()); - createReqVO.setCompanyName(sys.getDescription()); - createReqVO.setCreateBy("ai"); - createReqVO.setCreateTime(LocalDateTime.now()); - createReqVO.setUpdateBy("ai"); - createReqVO.setUpdateTime(LocalDateTime.now()); - - ProblemsSaveReqVO vo = new ProblemsSaveReqVO(); - BeanUtils.copyProperties(createReqVO, vo); - vo.setCompanyNo(createReqVO.getCompanyCode()); - // 调用高德API根据经纬度查询地址 - if (createReqVO.getUserConfrimLat() != null && createReqVO.getUserConfrimLon() != null) { - try { - String address = geoCodeService.getAddressByLocation(createReqVO.getUserConfrimLat(), createReqVO.getUserConfrimLon()); - if (StringUtils.hasText(address)) { - vo.setUserConfrimAddr(address); - } - } catch (Exception e) { - // 地址查询失败时不影响主流程,记录日志即可 - // log.warn("根据经纬度查询地址失败: lat={}, lon={}", createReqVO.getUserConfrimLat(), createReqVO.getUserConfrimLon(), e); - } - } - return CommonResult.success(problemsService.createProblemsWithProblemNo(vo)); - } -} - - +//package com.zteits.urbanops.module.gloabl.api; +// +//import com.zteits.urbanops.framework.common.pojo.CommonResult; +//import com.zteits.urbanops.framework.common.util.object.BeanUtils; +//import com.zteits.urbanops.module.gloabl.constants.SysMappingEnum; +//import com.zteits.urbanops.module.gloabl.controller.admin.problems.vo.ProblemsApiSaveReqVO; +//import com.zteits.urbanops.module.gloabl.controller.admin.problems.vo.ProblemsSaveReqVO; +//import com.zteits.urbanops.module.gloabl.service.geocode.GeoCodeService; +//import com.zteits.urbanops.module.gloabl.service.problems.ProblemsService; +//import io.swagger.v3.oas.annotations.Operation; +//import jakarta.annotation.Resource; +//import jakarta.annotation.security.PermitAll; +//import jakarta.validation.Valid; +//import lombok.RequiredArgsConstructor; +//import org.springframework.util.StringUtils; +//import org.springframework.web.bind.annotation.PostMapping; +//import org.springframework.web.bind.annotation.RequestBody; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RestController; +// +//import java.time.LocalDateTime; +// +//import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; +// +// +///** +// * Description:

+// *

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