From a9541d7a0ea793e6494b83f4517f13cf2cb64c85 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 20 六月 2025 17:24:48 +0800 Subject: [PATCH] 保洁巡检本周代码 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 23 +++++++---- ruoyi-system/src/main/resources/mapper/system/TCleanerMapper.xml | 3 - ruoyi-admin/src/main/java/com/ruoyi/web/util/MainApp.java | 17 +++++++- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTemplateController.java | 8 +++- ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml | 2 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDeptController.java | 7 +++ ruoyi-admin/src/main/java/com/ruoyi/web/util/AmapApiClient.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/model/TCleaner.java | 7 +++ ruoyi-system/src/main/java/com/ruoyi/system/model/TTemplateDetail.java | 7 +-- 9 files changed, 54 insertions(+), 22 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDeptController.java index 37ea860..c77132b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDeptController.java @@ -21,6 +21,7 @@ import javax.annotation.Resource; import java.util.Arrays; +import java.util.List; /** * <p> @@ -43,6 +44,12 @@ public R<PageInfo<DeptListVO>> pageList(@RequestBody DeptListQuery query) { return R.ok(deptService.pageList(query)); } + @ApiOperation(value = "部门不分页列表") + @PostMapping(value = "/listAll") + public R<List<TDept>> listAll() { + List<TDept> depts = deptService.list(); + return R.ok(depts); + } @Log(title = "新增部门", businessType = BusinessType.INSERT) @ApiOperation(value = "新增部门") @PostMapping(value = "/add") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTemplateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTemplateController.java index 8aa1082..19ab507 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTemplateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTemplateController.java @@ -58,6 +58,11 @@ public R<PageInfo<TemplateListVO>> pageList(@RequestBody TemplateListQuery query) { return R.ok(templateService.pageList(query)); } + @ApiOperation(value = "任务模板不分页列表") + @PostMapping(value = "/listAllTemplate") + public R<List<TTemplate>> listAllTemplate() { + return R.ok(templateService.list()); + } @ApiOperation(value = "点位类型不分页列表") @PostMapping(value = "/listAll") public R<List<TLocationType>> pageList() { @@ -145,8 +150,7 @@ res.add(jsonObject); } String num4 = tTemplateDetail.getNum4(); - JSONObject jsonObject = JSONObject.parseObject(num4); - JSONArray num5Array = jsonObject.getJSONArray("num5"); + JSONArray num5Array = JSONArray.parseArray(num4); for (Object o : num5Array) { JSONObject jsonObject1 = (JSONObject) o; String string = jsonObject1.getString("id"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/util/AmapApiClient.java b/ruoyi-admin/src/main/java/com/ruoyi/web/util/AmapApiClient.java index 3ea9c5c..b8546df 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/util/AmapApiClient.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/util/AmapApiClient.java @@ -11,7 +11,7 @@ private static final OkHttpClient client = new OkHttpClient(); public static String getDrivingRoute(double startLat, double startLon, double endLat, double endLon) throws IOException { - String url = "https://restapi.amap.com/v3/direction/walking?" + + String url = "https://restapi.amap.com/v3/direction/driving?" + "origin=" + startLon + "," + startLat + "&destination=" + endLon + "," + endLat + "&key=" + KEY; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/util/MainApp.java b/ruoyi-admin/src/main/java/com/ruoyi/web/util/MainApp.java index 14d3c66..e48c99c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/util/MainApp.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/util/MainApp.java @@ -1,13 +1,18 @@ package com.ruoyi.web.util; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.google.gson.JsonObject; + +import java.math.BigDecimal; import java.util.List; public class MainApp { public static void main(String[] args) { double startLat = 39.9042; - double startLon = 116.4074; + double startLon = 118.4074; double endLat = 39.9042; - double endLon = 116.4074; + double endLon = 119.4074; double userLat = 39.9042; double userLon = 116.4074; @@ -16,6 +21,14 @@ int segments = 4; // 四段,共 5 个点 try { String routeJson = AmapApiClient.getDrivingRoute(startLat, startLon, endLat, endLon); + // 转化为json对象 + JSONObject jsonObject = JSONObject.parseObject(routeJson); + JSONObject route = jsonObject.getJSONObject("route"); + JSONArray paths = route.getJSONArray("paths"); + JSONObject o = (JSONObject)paths.get(0); + BigDecimal distance = o.getBigDecimal("distance"); + System.err.println( paths); + List<double[]> fivePoints = PathParser.parseAndInterpolate(routeJson, segments,startLat, startLon, endLat, endLon); if (GeoChecker.isInAnyCircle(userLat, userLon, fivePoints, radius)) { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/TCleaner.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/TCleaner.java index ae8add0..9d5fd81 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/model/TCleaner.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/TCleaner.java @@ -42,4 +42,11 @@ private String projectId; + @ApiModelProperty(value = "部门级编号") + @TableField("dept_code") + private String deptCode; + + @ApiModelProperty(value = "项目级编号") + @TableField("project_code") + private String projectCode; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/TTemplateDetail.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/TTemplateDetail.java index 3a1923f..902692e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/model/TTemplateDetail.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/TTemplateDetail.java @@ -49,17 +49,14 @@ @TableField("num3") private Integer num3; - @ApiModelProperty(value = "点位类型覆盖率json {\n" + - "\t\"num5\": [{\n" + + @ApiModelProperty(value = "点位类型覆盖率json [{\n" + "\t\t\"id\": \"18678093453\",\n" + "\t\t\"value\": 18\n" + "\n" + "\t}, {\n" + "\t\t\"id\": \"18678093453\",\n" + "\t\t\"value\": 18\n" + - "\t}]\n" + - "\n" + - "}") + "\t}]\n") @TableField("num4") private String num4; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 357f769..d9408c4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -692,16 +692,21 @@ } Integer deptType = sysUserVO.getDeptType(); if (1==deptType){ - TProjectDept tProjectDept = projectDeptMapper.selectById(sysUserVO.getDeptId()); - if (!tProjectDept.getParentId().equals("0")){ - TProjectDept tProjectDept1 = projectDeptMapper.selectById(tProjectDept.getParentId()); - sysUserVO.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName()); - }else{ - sysUserVO.setDeptName(tProjectDept.getProjectName()); - } + TProjectDept tProjectDept = projectDeptMapper.selectById(sysUserVO.getDeptId()); + if (!tProjectDept.getParentId().equals("0")){ + TProjectDept tProjectDept1 = projectDeptMapper.selectById(tProjectDept.getParentId()); + sysUserVO.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName()); + }else{ + sysUserVO.setDeptName(tProjectDept.getProjectName()); + } }else{ - TDept tDept = deptMapper.selectById(sysUserVO.getDeptId()); - sysUserVO.setDeptName(tDept.getDeptName()); + if (sysUserVO.getUserId()==1){ + sysUserVO.setDeptName("公司"); + }else{ + TDept tDept = deptMapper.selectById(sysUserVO.getDeptId()); + sysUserVO.setDeptName(tDept.getDeptName()); + } + } } pageInfo.setTotal(list.size()); diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml index dd67f7d..fd1e2af 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -99,7 +99,7 @@ select a.role_id AS roleId, a.role_name AS roleName, a.role_key AS roleKey, a.role_sort AS roleSort, a.data_scope AS dataScope, a.menu_check_strictly AS menuCheckStrictly, a.dept_check_strictly AS deptCheckStrictly,a.status AS status, a.del_flag AS delFlag, a.create_time AS createTime,a.create_by AS createBy,a.postType AS postType,a.removeDays AS removeDays, - a.role_type as roleType,a.remark + a.role_type as roleType,a.remark, IFNULL(b.userCount,0) as userCount from sys_role a LEFT JOIN diff --git a/ruoyi-system/src/main/resources/mapper/system/TCleanerMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TCleanerMapper.xml index 8116ca2..bb58a15 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TCleanerMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TCleanerMapper.xml @@ -31,9 +31,8 @@ <if test="query.projectId != null and query.projectId != ''"> and t1.projectId = #{query.projectId} </if> + and t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} </where> - and t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} order by t1.create_time desc </select> - </mapper> -- Gitblit v1.7.1