Commit 134ed11256b66ad570490fb02c1bc207add283a0
Merge branch 'dev' of http://gitlab1.renniting.cn/JCSS/urbanops into dev
Showing
13 changed files
with
394 additions
and
104 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/assigntasks/vo/AssignTasksRespVO.java
| ... | ... | @@ -26,7 +26,7 @@ public class AssignTasksRespVO { |
| 26 | 26 | private String taskName; |
| 27 | 27 | |
| 28 | 28 | @Schema(description = "任务类型(关联数据字典,1=日常任务,2=古树任务,3=屋顶绿化)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 29 | - private String taskType; | |
| 29 | + private Integer taskType; | |
| 30 | 30 | @ExcelProperty(value = "任务类型") |
| 31 | 31 | private String taskTypeName; |
| 32 | 32 | |
| ... | ... | @@ -82,17 +82,17 @@ public class AssignTasksRespVO { |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public void setTaskType(String taskType) { | |
| 85 | + public void setTaskType(Integer taskType) { | |
| 86 | 86 | this.taskType = taskType; |
| 87 | 87 | //1=日常任务,2=古树任务,3=屋顶绿化 |
| 88 | 88 | switch (taskType) { |
| 89 | - case "1": | |
| 89 | + case 1: | |
| 90 | 90 | this.taskTypeName = "日常任务"; |
| 91 | 91 | break; |
| 92 | - case "2": | |
| 92 | + case 2: | |
| 93 | 93 | this.taskTypeName = "古树任务"; |
| 94 | 94 | break; |
| 95 | - case "3": | |
| 95 | + case 3: | |
| 96 | 96 | this.taskTypeName = "屋顶绿化"; |
| 97 | 97 | break; |
| 98 | 98 | default: | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/assigntasks/vo/AssignTasksSaveReqVO.java
| ... | ... | @@ -23,8 +23,8 @@ public class AssignTasksSaveReqVO { |
| 23 | 23 | private String taskName; |
| 24 | 24 | |
| 25 | 25 | @Schema(description = "任务类型(关联数据字典,如:日常巡检、紧急维修等)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 26 | - @NotEmpty(message = "任务类型(关联数据字典,如:日常巡检、紧急维修等)不能为空") | |
| 27 | - private String taskType; | |
| 26 | + @NotNull(message = "任务类型(关联数据字典,如:日常巡检、紧急维修等)不能为空") | |
| 27 | + private Integer taskType; | |
| 28 | 28 | |
| 29 | 29 | @Schema(description = "任务截止时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 30 | 30 | @NotNull(message = "任务截止时间不能为空") | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/assigntasksinfo/vo/AssignTasksInfoRespVO.java
| ... | ... | @@ -29,7 +29,7 @@ public class AssignTasksInfoRespVO { |
| 29 | 29 | private String taskName; |
| 30 | 30 | |
| 31 | 31 | @Schema(description = "任务类型(关联数据字典,1=日常任务,2=古树任务,3=屋顶绿化)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 32 | - private String taskType; | |
| 32 | + private Integer taskType; | |
| 33 | 33 | @ExcelProperty(value = "任务类型") |
| 34 | 34 | private String taskTypeName; |
| 35 | 35 | |
| ... | ... | @@ -119,17 +119,17 @@ public class AssignTasksInfoRespVO { |
| 119 | 119 | @ExcelProperty("0:正常1:停用") |
| 120 | 120 | private Integer status; |
| 121 | 121 | |
| 122 | - public void setTaskType(String taskType) { | |
| 122 | + public void setTaskType(Integer taskType) { | |
| 123 | 123 | this.taskType = taskType; |
| 124 | 124 | //1=日常任务,2=古树任务,3=屋顶绿化 |
| 125 | 125 | switch (taskType) { |
| 126 | - case "1": | |
| 126 | + case 1: | |
| 127 | 127 | this.taskTypeName = "日常任务"; |
| 128 | 128 | break; |
| 129 | - case "2": | |
| 129 | + case 2: | |
| 130 | 130 | this.taskTypeName = "古树任务"; |
| 131 | 131 | break; |
| 132 | - case "3": | |
| 132 | + case 3: | |
| 133 | 133 | this.taskTypeName = "屋顶绿化"; |
| 134 | 134 | break; |
| 135 | 135 | default: | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/tree/TreeController.java
| ... | ... | @@ -118,20 +118,6 @@ public class TreeController { |
| 118 | 118 | BeanUtils.toBean(list, TreeRespVO.class)); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - @GetMapping("/dept/list") | |
| 122 | - @PreAuthorize("@ss.hasPermission('garden:tree:list')") | |
| 123 | - public CommonResult<List<CompanyDeptRoadVO>> list(@RequestParam Long companyId,@RequestParam(required = false) String roadName) { | |
| 124 | - LoginUser user = SecurityFrameworkUtils.getLoginUser(); | |
| 125 | - if (null == user) { | |
| 126 | - return null; | |
| 127 | - } | |
| 128 | - TreeVO tree = new TreeVO(); | |
| 129 | - tree.setBelongCompanyId(companyId); | |
| 130 | - tree.setRoadName(roadName); | |
| 131 | - tree.setDeptId(null); | |
| 132 | - return success(treeService.getCompanyDeptRoadTreeData(tree)); | |
| 133 | - } | |
| 134 | - | |
| 135 | 121 | @GetMapping("/road/list") |
| 136 | 122 | @PreAuthorize("@ss.hasPermission('garden:tree:list')") |
| 137 | 123 | public CommonResult<PageResult<RoadTreeVO>> listTreesByRoad(@RequestParam(required = false) Long road) { | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/treechangelog/TreeChangeLogController.java
| ... | ... | @@ -85,6 +85,7 @@ public class TreeChangeLogController { |
| 85 | 85 | @GetMapping({"/page","/list"}) |
| 86 | 86 | @Operation(summary = "查询一树一档案修改记录列表") |
| 87 | 87 | @PreAuthorize("@ss.hasPermission('garden:tree-change-log:query')") |
| 88 | + @TransMethodResult | |
| 88 | 89 | public CommonResult<PageResult<TreeChangeLogRespVO>> getTreeChangeLogPage(@Valid TreeChangeLogPageReqVO pageReqVO) { |
| 89 | 90 | PageResult<TreeChangeLogDO> pageResult = treeChangeLogService.getTreeChangeLogPage(pageReqVO); |
| 90 | 91 | return success(BeanUtils.toBean(pageResult, TreeChangeLogRespVO.class)); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/tree/AppTreeController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.app.tree; | |
| 2 | + | |
| 3 | +import com.fhs.core.trans.anno.TransMethodResult; | |
| 4 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 5 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 8 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 9 | +import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils; | |
| 10 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 11 | +import com.zteits.urbanops.framework.security.core.LoginUser; | |
| 12 | +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | |
| 13 | +import com.zteits.urbanops.module.garden.controller.admin.tree.vo.*; | |
| 14 | +import com.zteits.urbanops.module.garden.dal.dataobject.tree.TreeDO; | |
| 15 | +import com.zteits.urbanops.module.garden.service.tree.TreeService; | |
| 16 | +import io.swagger.v3.oas.annotations.Operation; | |
| 17 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 18 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 19 | +import jakarta.annotation.Resource; | |
| 20 | +import jakarta.servlet.http.HttpServletResponse; | |
| 21 | +import jakarta.validation.Valid; | |
| 22 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 23 | +import org.springframework.validation.annotation.Validated; | |
| 24 | +import org.springframework.web.bind.annotation.*; | |
| 25 | + | |
| 26 | +import java.io.IOException; | |
| 27 | +import java.time.LocalDateTime; | |
| 28 | +import java.util.List; | |
| 29 | + | |
| 30 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 31 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 32 | + | |
| 33 | +@Tag(name = "App - 一树一档案") | |
| 34 | +@RestController | |
| 35 | +@RequestMapping({"/garden/tree","/business/tree"}) | |
| 36 | +@Validated | |
| 37 | +public class AppTreeController { | |
| 38 | + | |
| 39 | + @Resource | |
| 40 | + private TreeService treeService; | |
| 41 | + | |
| 42 | + @PostMapping({"/create",""}) | |
| 43 | + @Operation(summary = "创建一树一档案") | |
| 44 | + public CommonResult<Long> createTree(@Valid @RequestBody TreeSaveReqVO createReqVO) { | |
| 45 | + Long userId = SecurityFrameworkUtils.getLoginUserId(); | |
| 46 | + Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId(); | |
| 47 | + createReqVO.setCreateby(String.valueOf(userId)); | |
| 48 | + createReqVO.setCreatetime(LocalDateTime.now()); | |
| 49 | + createReqVO.setUpdateby(String.valueOf(userId)); | |
| 50 | + createReqVO.setUpdatetime(LocalDateTime.now()); | |
| 51 | + createReqVO.setDeptId(loginUserDeptId); | |
| 52 | + return success(treeService.createTree(createReqVO)); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @PutMapping({"/update",""}) | |
| 56 | + @Operation(summary = "更新一树一档案") | |
| 57 | + public CommonResult<Boolean> updateTree(@Valid @RequestBody TreeSaveReqVO updateReqVO) { | |
| 58 | + updateReqVO.setUpdateby(String.valueOf(SecurityFrameworkUtils.getLoginUserId())); | |
| 59 | + updateReqVO.setUpdatetime(LocalDateTime.now()); | |
| 60 | + treeService.updateTree(updateReqVO); | |
| 61 | + return success(true); | |
| 62 | + } | |
| 63 | + | |
| 64 | + @GetMapping("/get") | |
| 65 | + @Operation(summary = "获得一树一档案") | |
| 66 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 67 | + @TransMethodResult | |
| 68 | + public CommonResult<TreeRespVO> getTree(@RequestParam("id") Long id) { | |
| 69 | + TreeDO tree = treeService.getTree(id); | |
| 70 | + return success(BeanUtils.toBean(tree, TreeRespVO.class)); | |
| 71 | + } | |
| 72 | + | |
| 73 | + | |
| 74 | + @GetMapping("/dept/list") | |
| 75 | + public CommonResult<List<CompanyDeptRoadVO>> list(@RequestParam Long companyId,@RequestParam(required = false) String roadName) { | |
| 76 | + LoginUser user = SecurityFrameworkUtils.getLoginUser(); | |
| 77 | + if (null == user) { | |
| 78 | + return null; | |
| 79 | + } | |
| 80 | + TreeVO tree = new TreeVO(); | |
| 81 | + tree.setBelongCompanyId(companyId); | |
| 82 | + tree.setRoadName(roadName); | |
| 83 | + tree.setDeptId(null); | |
| 84 | + return success(treeService.getCompanyDeptRoadTreeData(tree)); | |
| 85 | + } | |
| 86 | + | |
| 87 | + @GetMapping("/road/list") | |
| 88 | + public CommonResult<PageResult<RoadTreeVO>> listTreesByRoad(@RequestParam(required = false) Long road) { | |
| 89 | + TreePageReqVO pageReqVO = new TreePageReqVO(); | |
| 90 | + pageReqVO.setRoad(road); | |
| 91 | + PageResult<RoadTreeVO> pageResult = treeService.getTreesByRoadId(pageReqVO); | |
| 92 | + return success(pageResult); | |
| 93 | + } | |
| 94 | + | |
| 95 | + | |
| 96 | + private void fillDictData(List<TreeDO> list) { | |
| 97 | + for (TreeDO gardenTree : list) { | |
| 98 | + String street = DictFrameworkUtils.parseDictDataLabel("street_belong", gardenTree.getStreet()); | |
| 99 | + gardenTree.setStreet(street); | |
| 100 | + | |
| 101 | + String ownership = DictFrameworkUtils.parseDictDataLabel("tree_ownership", gardenTree.getOldtreeownership()); | |
| 102 | + gardenTree.setOldtreeownership(ownership); | |
| 103 | + | |
| 104 | + String growthVigor = DictFrameworkUtils.parseDictDataLabel("growth_vigor", gardenTree.getGrowthvigor()); | |
| 105 | + gardenTree.setGrowthvigor(growthVigor); | |
| 106 | + String treeLevel = DictFrameworkUtils.parseDictDataLabel("tree_level", gardenTree.getTreelevel()); | |
| 107 | + gardenTree.setTreelevel(treeLevel); | |
| 108 | + String dataState = DictFrameworkUtils.parseDictDataLabel("data_state", gardenTree.getDatastate()); | |
| 109 | + gardenTree.setDatastate(dataState); | |
| 110 | + } | |
| 111 | + } | |
| 112 | + | |
| 113 | +} | |
| 0 | 114 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/treechangelog/AppTreeChangeLogController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.app.treechangelog; | |
| 2 | + | |
| 3 | +import com.fhs.core.trans.anno.TransMethodResult; | |
| 4 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 5 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 8 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 9 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 10 | +import com.zteits.urbanops.module.garden.controller.admin.treechangelog.vo.TreeChangeLogPageReqVO; | |
| 11 | +import com.zteits.urbanops.module.garden.controller.admin.treechangelog.vo.TreeChangeLogRespVO; | |
| 12 | +import com.zteits.urbanops.module.garden.controller.admin.treechangelog.vo.TreeChangeLogSaveReqVO; | |
| 13 | +import com.zteits.urbanops.module.garden.dal.dataobject.treechangelog.TreeChangeLogDO; | |
| 14 | +import com.zteits.urbanops.module.garden.service.treechangelog.TreeChangeLogService; | |
| 15 | +import io.swagger.v3.oas.annotations.Operation; | |
| 16 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 17 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 18 | +import jakarta.annotation.Resource; | |
| 19 | +import jakarta.servlet.http.HttpServletResponse; | |
| 20 | +import jakarta.validation.Valid; | |
| 21 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 22 | +import org.springframework.validation.annotation.Validated; | |
| 23 | +import org.springframework.web.bind.annotation.*; | |
| 24 | + | |
| 25 | +import java.io.IOException; | |
| 26 | +import java.util.List; | |
| 27 | + | |
| 28 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 29 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 30 | + | |
| 31 | +@Tag(name = "App - 一树一档案修改记录") | |
| 32 | +@RestController | |
| 33 | +@RequestMapping({"/garden/tree-change-log","/gardentree/logs"}) | |
| 34 | +@Validated | |
| 35 | +public class AppTreeChangeLogController { | |
| 36 | + | |
| 37 | + @Resource | |
| 38 | + private TreeChangeLogService treeChangeLogService; | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + @GetMapping("/get") | |
| 43 | + @Operation(summary = "获得一树一档案修改记录") | |
| 44 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 45 | + @PreAuthorize("@ss.hasPermission('garden:tree-change-log:query')") | |
| 46 | + @TransMethodResult | |
| 47 | + public CommonResult<TreeChangeLogRespVO> getTreeChangeLog(@RequestParam("id") Long id) { | |
| 48 | + TreeChangeLogDO treeChangeLog = treeChangeLogService.getTreeChangeLog(id); | |
| 49 | + return success(BeanUtils.toBean(treeChangeLog, TreeChangeLogRespVO.class)); | |
| 50 | + } | |
| 51 | + | |
| 52 | + @GetMapping({"/page","/list"}) | |
| 53 | + @Operation(summary = "查询一树一档案修改记录列表") | |
| 54 | + public CommonResult<PageResult<TreeChangeLogRespVO>> getTreeChangeLogPage(@Valid TreeChangeLogPageReqVO pageReqVO) { | |
| 55 | + PageResult<TreeChangeLogDO> pageResult = treeChangeLogService.getTreeChangeLogPage(pageReqVO); | |
| 56 | + return success(BeanUtils.toBean(pageResult, TreeChangeLogRespVO.class)); | |
| 57 | + } | |
| 58 | + | |
| 59 | + @GetMapping("/export-excel") | |
| 60 | + @Operation(summary = "导出一树一档案修改记录 Excel") | |
| 61 | + @PreAuthorize("@ss.hasPermission('garden:tree-change-log:export')") | |
| 62 | + @ApiAccessLog(operateType = EXPORT) | |
| 63 | + public void exportTreeChangeLogExcel(@Valid TreeChangeLogPageReqVO pageReqVO, | |
| 64 | + HttpServletResponse response) throws IOException { | |
| 65 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 66 | + List<TreeChangeLogDO> list = treeChangeLogService.getTreeChangeLogPage(pageReqVO).getList(); | |
| 67 | + // 导出 Excel | |
| 68 | + ExcelUtils.write(response, "一树一档案修改记录.xls", "数据", TreeChangeLogRespVO.class, | |
| 69 | + BeanUtils.toBean(list, TreeChangeLogRespVO.class)); | |
| 70 | + } | |
| 71 | + | |
| 72 | +} | |
| 0 | 73 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/assigntasks/AssignTasksDO.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/assigntasksinfo/AssignTasksInfoDO.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/tree/TreeMapper.java
| ... | ... | @@ -7,9 +7,12 @@ import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | 7 | import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; |
| 8 | 8 | import com.zteits.urbanops.framework.mybatis.core.query.MPJLambdaWrapperX; |
| 9 | 9 | import com.zteits.urbanops.module.garden.dal.dataobject.tree.TreeDO; |
| 10 | +import com.zteits.urbanops.module.garden.dal.dataobject.road.RoadDO; | |
| 10 | 11 | import com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO; |
| 11 | 12 | import org.apache.ibatis.annotations.Mapper; |
| 12 | 13 | import com.zteits.urbanops.module.garden.controller.admin.tree.vo.*; |
| 14 | +import com.baomidou.mybatisplus.extension.toolkit.Db; | |
| 15 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 13 | 16 | |
| 14 | 17 | /** |
| 15 | 18 | * 一树一档案 Mapper |
| ... | ... | @@ -71,4 +74,112 @@ public interface TreeMapper extends BaseMapperX<TreeDO> { |
| 71 | 74 | } |
| 72 | 75 | |
| 73 | 76 | List<CompanyDeptRoadVO> selectCompanyDeptRoadTreeData(TreeVO tree); |
| 74 | -} | |
| 75 | 77 | \ No newline at end of file |
| 78 | + | |
| 79 | +// default List<CompanyDeptRoadVO> selectCompanyDeptRoadTreeData(TreeVO tree) { | |
| 80 | +// List<DeptDO> companies = Db.lambdaQuery(DeptDO.class) | |
| 81 | +// .eq(DeptDO::getStatus, 0) | |
| 82 | +// .eq(DeptDO::getParentId, 100L) | |
| 83 | +// .list(); | |
| 84 | +// Long belongCompanyId = tree.getBelongCompanyId(); | |
| 85 | +// if (belongCompanyId != null) { | |
| 86 | +// companies.removeIf(c -> !Objects.equals(c.getId(), belongCompanyId)); | |
| 87 | +// } | |
| 88 | +// if (companies.isEmpty()) { | |
| 89 | +// return Collections.emptyList(); | |
| 90 | +// } | |
| 91 | +// List<Long> companyIds = new ArrayList<>(); | |
| 92 | +// for (DeptDO c : companies) { | |
| 93 | +// companyIds.add(c.getId()); | |
| 94 | +// } | |
| 95 | +// Long deptIdFilter = tree.getDeptId(); | |
| 96 | +// List<DeptDO> depts; | |
| 97 | +// if (deptIdFilter != null) { | |
| 98 | +// depts = Db.lambdaQuery(DeptDO.class) | |
| 99 | +// .eq(DeptDO::getStatus, 0) | |
| 100 | +// .eq(DeptDO::getId, deptIdFilter) | |
| 101 | +// .list(); | |
| 102 | +// depts.removeIf(d -> !companyIds.contains(d.getParentId())); | |
| 103 | +// } else { | |
| 104 | +// depts = Db.lambdaQuery(DeptDO.class) | |
| 105 | +// .eq(DeptDO::getStatus, 0) | |
| 106 | +// .in(DeptDO::getParentId, companyIds) | |
| 107 | +// .list(); | |
| 108 | +// } | |
| 109 | +// List<Long> deptIds = new ArrayList<>(); | |
| 110 | +// for (DeptDO d : depts) { | |
| 111 | +// deptIds.add(d.getId()); | |
| 112 | +// } | |
| 113 | +// String roadNameFilter = tree.getRoadName(); | |
| 114 | +// List<RoadDO> roads = deptIds.isEmpty() ? Collections.emptyList() | |
| 115 | +// : Db.lambdaQuery(RoadDO.class) | |
| 116 | +// .in(RoadDO::getDeptId, deptIds) | |
| 117 | +// .like(roadNameFilter != null && !roadNameFilter.isEmpty(), RoadDO::getRoadName, roadNameFilter) | |
| 118 | +// .list(); | |
| 119 | +// List<Long> roadIds = new ArrayList<>(); | |
| 120 | +// for (RoadDO r : roads) { | |
| 121 | +// roadIds.add(r.getId()); | |
| 122 | +// } | |
| 123 | +// Map<Long, Integer> recordedCountMap = new HashMap<>(); | |
| 124 | +// if (!roadIds.isEmpty()) { | |
| 125 | +// List<Map<String, Object>> countMaps = selectMaps(new QueryWrapper<TreeDO>() | |
| 126 | +// .select("road", "COUNT(id) AS cnt") | |
| 127 | +// .in("road", roadIds) | |
| 128 | +// .eq("deleted", 0) | |
| 129 | +// .groupBy("road")); | |
| 130 | +// for (Map<String, Object> m : countMaps) { | |
| 131 | +// Object roadVal = m.get("road"); | |
| 132 | +// Object cntVal = m.get("cnt"); | |
| 133 | +// if (roadVal != null && cntVal != null) { | |
| 134 | +// Long rid = ((Number) roadVal).longValue(); | |
| 135 | +// Integer cnt = ((Number) cntVal).intValue(); | |
| 136 | +// recordedCountMap.put(rid, cnt); | |
| 137 | +// } | |
| 138 | +// } | |
| 139 | +// } | |
| 140 | +// Map<Long, List<DeptDO>> deptsByCompany = new HashMap<>(); | |
| 141 | +// for (DeptDO d : depts) { | |
| 142 | +// List<DeptDO> list = deptsByCompany.computeIfAbsent(d.getParentId(), k -> new ArrayList<>()); | |
| 143 | +// list.add(d); | |
| 144 | +// } | |
| 145 | +// Map<Long, List<RoadDO>> roadsByDept = new HashMap<>(); | |
| 146 | +// for (RoadDO r : roads) { | |
| 147 | +// List<RoadDO> list = roadsByDept.computeIfAbsent(r.getDeptId(), k -> new ArrayList<>()); | |
| 148 | +// list.add(r); | |
| 149 | +// } | |
| 150 | +// List<CompanyDeptRoadVO> result = new ArrayList<>(); | |
| 151 | +// for (DeptDO company : companies) { | |
| 152 | +// CompanyDeptRoadVO companyVO = new CompanyDeptRoadVO(); | |
| 153 | +// companyVO.setCompanyId(company.getId()); | |
| 154 | +// companyVO.setCompanyName(company.getName()); | |
| 155 | +// List<DeptDO> companyDepts = deptsByCompany.getOrDefault(company.getId(), Collections.emptyList()); | |
| 156 | +// List<CompanyDeptRoadVO.DeptVO> deptVOs = new ArrayList<>(); | |
| 157 | +// for (DeptDO dept : companyDepts) { | |
| 158 | +// CompanyDeptRoadVO.DeptVO deptVO = new CompanyDeptRoadVO.DeptVO(); | |
| 159 | +// deptVO.setDeptId(dept.getId()); | |
| 160 | +// deptVO.setDeptName(dept.getName()); | |
| 161 | +// List<RoadDO> deptRoads = roadsByDept.getOrDefault(dept.getId(), Collections.emptyList()); | |
| 162 | +// List<CompanyDeptRoadVO.RoadVO> roadVOs = new ArrayList<>(); | |
| 163 | +// for (RoadDO road : deptRoads) { | |
| 164 | +// CompanyDeptRoadVO.RoadVO roadVO = new CompanyDeptRoadVO.RoadVO(); | |
| 165 | +// roadVO.setRoadId(road.getId()); | |
| 166 | +// roadVO.setRoadName(road.getRoadName()); | |
| 167 | +// roadVO.setStartRemark(road.getStartingRemark()); | |
| 168 | +// roadVO.setEndRemark(road.getEndRemark()); | |
| 169 | +// Integer treeCount = road.getTreeArea() == null ? 0 : road.getTreeArea().intValue(); | |
| 170 | +// roadVO.setTreeCount(treeCount); | |
| 171 | +// Integer recordedCount = recordedCountMap.getOrDefault(road.getId(), 0); | |
| 172 | +// roadVO.setRecordedCount(recordedCount); | |
| 173 | +// roadVOs.add(roadVO); | |
| 174 | +// } | |
| 175 | +// roadVOs.sort(Comparator | |
| 176 | +// .comparing(CompanyDeptRoadVO.RoadVO::getTreeCount, Comparator.nullsFirst(Comparator.naturalOrder())).reversed() | |
| 177 | +// .thenComparing(CompanyDeptRoadVO.RoadVO::getRecordedCount, Comparator.nullsFirst(Comparator.naturalOrder())).reversed()); | |
| 178 | +// deptVO.setRoads(roadVOs); | |
| 179 | +// deptVOs.add(deptVO); | |
| 180 | +// } | |
| 181 | +// companyVO.setDepts(deptVOs); | |
| 182 | +// result.add(companyVO); | |
| 183 | +// } | |
| 184 | +// return result; | |
| 185 | +// } | |
| 186 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/assigntasks/AssignTasksServiceImpl.java
| ... | ... | @@ -26,6 +26,7 @@ import org.springframework.util.CollectionUtils; |
| 26 | 26 | import org.springframework.validation.annotation.Validated; |
| 27 | 27 | |
| 28 | 28 | import java.time.LocalDateTime; |
| 29 | +import java.time.ZoneId; | |
| 29 | 30 | import java.util.*; |
| 30 | 31 | import java.util.function.Function; |
| 31 | 32 | import java.util.stream.Collectors; |
| ... | ... | @@ -95,7 +96,7 @@ public class AssignTasksServiceImpl implements AssignTasksService { |
| 95 | 96 | List<Long> companyIds = updateReqVO.getCompanyIds(); |
| 96 | 97 | // add by wq 20251116 |
| 97 | 98 | List<AssignTasksInfoDO> assignTaskInfoList = assignTasksInfoMapper.selectList(AssignTasksInfoDO::getTaskId, updateObj.getId()); |
| 98 | - if (CollectionUtils.isEmpty(assignTaskInfoList)) { | |
| 99 | + if (!CollectionUtils.isEmpty(assignTaskInfoList)) { | |
| 99 | 100 | // 检查当前派单的公司ID是否不在保留列表中 |
| 100 | 101 | for (AssignTasksInfoDO taskInfo : assignTaskInfoList) { |
| 101 | 102 | // 检查当前派单的公司ID是否不在保留列表中 |
| ... | ... | @@ -107,6 +108,12 @@ public class AssignTasksServiceImpl implements AssignTasksService { |
| 107 | 108 | // 未读状态,执行删除操作 |
| 108 | 109 | assignTasksInfoService.deleteAssignTasksInfo(taskInfo.getId()); |
| 109 | 110 | } |
| 111 | + } else { | |
| 112 | + //修改派单信息 | |
| 113 | + taskInfo.setTaskName(updateReqVO.getTaskName()); | |
| 114 | + taskInfo.setTaskType(updateReqVO.getTaskType()); | |
| 115 | + taskInfo.setDeadline(updateReqVO.getDeadline().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); | |
| 116 | + assignTasksInfoMapper.updateById(taskInfo); | |
| 110 | 117 | } |
| 111 | 118 | } |
| 112 | 119 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/tree/TreeServiceImpl.java
| ... | ... | @@ -129,6 +129,7 @@ public class TreeServiceImpl implements TreeService { |
| 129 | 129 | |
| 130 | 130 | TreeChangeLogDO changeLog = new TreeChangeLogDO(); |
| 131 | 131 | org.springframework.beans.BeanUtils.copyProperties(updateObj, changeLog); |
| 132 | + changeLog.setId(null); | |
| 132 | 133 | changeLog.setTreeid(updateObj.getId()); |
| 133 | 134 | changeLog.setCreateby(updateReqVO.getUpdateby()); |
| 134 | 135 | changeLog.setCreatetime(updateReqVO.getUpdatetime()); |
| ... | ... | @@ -176,80 +177,80 @@ public class TreeServiceImpl implements TreeService { |
| 176 | 177 | |
| 177 | 178 | @Override |
| 178 | 179 | public List<CompanyDeptRoadVO> getCompanyDeptRoadTreeData(TreeVO tree) { |
| 179 | - List<DeptDO> sysDepts = deptMapper.selectList(); | |
| 180 | +// List<DeptDO> sysDepts = deptMapper.selectList(); | |
| 180 | 181 | |
| 181 | 182 | List<CompanyDeptRoadVO> companyDeptRoadVOS = treeMapper.selectCompanyDeptRoadTreeData(tree); |
| 182 | 183 | |
| 183 | 184 | |
| 184 | - // 按公司分组所有部门 | |
| 185 | - Map<Long, List<DeptDO>> companyDeptsMap = sysDepts.stream() | |
| 186 | - .filter(d -> d.getParentId() != null) | |
| 187 | - .collect(Collectors.groupingBy(DeptDO::getParentId)); | |
| 188 | - | |
| 189 | - // 过滤出叶子部门(没有子部门的部门) | |
| 190 | - Map<Long, List<DeptDO>> companyLeafDeptsMap = new HashMap<>(); | |
| 191 | - for (Map.Entry<Long, List<DeptDO>> entry : companyDeptsMap.entrySet()) { | |
| 192 | - Long companyId = entry.getKey(); | |
| 193 | - List<DeptDO> depts = entry.getValue(); | |
| 194 | - | |
| 195 | - // 构建部门ID到部门的映射 | |
| 196 | - Map<Long, DeptDO> deptMap = depts.stream() | |
| 197 | - .collect(Collectors.toMap(DeptDO::getId, d -> d)); | |
| 198 | - | |
| 199 | - // 找出叶子部门(其parentId不在deptMap中的部门,或者其parentId为0的部门) | |
| 200 | - List<DeptDO> leafDepts = depts.stream() | |
| 201 | - .filter(d -> d.getParentId() == 0 || !deptMap.containsKey(d.getParentId())) | |
| 202 | - .collect(Collectors.toList()); | |
| 203 | - | |
| 204 | - companyLeafDeptsMap.put(companyId, leafDepts); | |
| 205 | - } | |
| 206 | - | |
| 207 | - // 建立现有结果的映射: 公司ID -> CompanyDeptRoadVO | |
| 208 | - Map<Long, CompanyDeptRoadVO> existingCompanyMap = companyDeptRoadVOS.stream() | |
| 209 | - .collect(Collectors.toMap( | |
| 210 | - CompanyDeptRoadVO::getCompanyId, | |
| 211 | - vo -> vo, | |
| 212 | - (existing, replacement) -> existing | |
| 213 | - )); | |
| 214 | - | |
| 215 | - // 遍历所有公司,补充缺失的公司和部门 | |
| 216 | - for (Map.Entry<Long, List<DeptDO>> entry : companyLeafDeptsMap.entrySet()) { | |
| 217 | - Long companyId = entry.getKey(); | |
| 218 | - List<DeptDO> depts = entry.getValue(); | |
| 219 | - | |
| 220 | - CompanyDeptRoadVO companyVO; | |
| 221 | - if (!existingCompanyMap.containsKey(companyId)) { | |
| 222 | - // 如果公司不存在,创建新的公司对象 | |
| 223 | - companyVO = new CompanyDeptRoadVO(); | |
| 224 | - companyVO.setCompanyId(companyId); | |
| 225 | - companyVO.setCompanyName(DictFrameworkUtils.parseDictDataValue("belongCompanyId", companyId + "")); | |
| 226 | - companyVO.setDepts(new ArrayList<>()); | |
| 227 | - companyDeptRoadVOS.add(companyVO); | |
| 228 | - } else { | |
| 229 | - companyVO = existingCompanyMap.get(companyId); | |
| 230 | - } | |
| 231 | - | |
| 232 | - // 建立该公司下已存在的部门映射: 部门ID -> DeptVO | |
| 233 | - Map<Long, CompanyDeptRoadVO.DeptVO> existingDeptMap = companyVO.getDepts().stream() | |
| 234 | - .collect(Collectors.toMap( | |
| 235 | - deptVO -> Long.valueOf(deptVO.getDeptId()), | |
| 236 | - deptVO -> deptVO, | |
| 237 | - (existing, replacement) -> existing | |
| 238 | - )); | |
| 239 | - | |
| 240 | - // 补充缺失的部门(仅叶子部门) | |
| 241 | - for (DeptDO sysDept : depts) { | |
| 242 | - Long deptId = sysDept.getId(); | |
| 243 | - if (!existingDeptMap.containsKey(deptId)) { | |
| 244 | - // 创建缺失的部门对象 | |
| 245 | - CompanyDeptRoadVO.DeptVO missingDept = new CompanyDeptRoadVO.DeptVO(); | |
| 246 | - missingDept.setDeptId(deptId); | |
| 247 | - missingDept.setDeptName(sysDept.getName()); | |
| 248 | - missingDept.setRoads(new ArrayList<>()); | |
| 249 | - companyVO.getDepts().add(missingDept); | |
| 250 | - } | |
| 251 | - } | |
| 252 | - } | |
| 185 | +// // 按公司分组所有部门 | |
| 186 | +// Map<Long, List<DeptDO>> companyDeptsMap = sysDepts.stream() | |
| 187 | +// .filter(d -> d.getParentId() != null) | |
| 188 | +// .collect(Collectors.groupingBy(DeptDO::getParentId)); | |
| 189 | +// | |
| 190 | +// // 过滤出叶子部门(没有子部门的部门) | |
| 191 | +// Map<Long, List<DeptDO>> companyLeafDeptsMap = new HashMap<>(); | |
| 192 | +// for (Map.Entry<Long, List<DeptDO>> entry : companyDeptsMap.entrySet()) { | |
| 193 | +// Long companyId = entry.getKey(); | |
| 194 | +// List<DeptDO> depts = entry.getValue(); | |
| 195 | +// | |
| 196 | +// // 构建部门ID到部门的映射 | |
| 197 | +// Map<Long, DeptDO> deptMap = depts.stream() | |
| 198 | +// .collect(Collectors.toMap(DeptDO::getId, d -> d)); | |
| 199 | +// | |
| 200 | +// // 找出叶子部门(其parentId不在deptMap中的部门,或者其parentId为0的部门) | |
| 201 | +// List<DeptDO> leafDepts = depts.stream() | |
| 202 | +// .filter(d -> d.getParentId() == 0 || !deptMap.containsKey(d.getParentId())) | |
| 203 | +// .collect(Collectors.toList()); | |
| 204 | +// | |
| 205 | +// companyLeafDeptsMap.put(companyId, leafDepts); | |
| 206 | +// } | |
| 207 | +// | |
| 208 | +// // 建立现有结果的映射: 公司ID -> CompanyDeptRoadVO | |
| 209 | +// Map<Long, CompanyDeptRoadVO> existingCompanyMap = companyDeptRoadVOS.stream() | |
| 210 | +// .collect(Collectors.toMap( | |
| 211 | +// CompanyDeptRoadVO::getCompanyId, | |
| 212 | +// vo -> vo, | |
| 213 | +// (existing, replacement) -> existing | |
| 214 | +// )); | |
| 215 | +// | |
| 216 | +// // 遍历所有公司,补充缺失的公司和部门 | |
| 217 | +// for (Map.Entry<Long, List<DeptDO>> entry : companyLeafDeptsMap.entrySet()) { | |
| 218 | +// Long companyId = entry.getKey(); | |
| 219 | +// List<DeptDO> depts = entry.getValue(); | |
| 220 | +// | |
| 221 | +// CompanyDeptRoadVO companyVO; | |
| 222 | +// if (!existingCompanyMap.containsKey(companyId)) { | |
| 223 | +// // 如果公司不存在,创建新的公司对象 | |
| 224 | +// companyVO = new CompanyDeptRoadVO(); | |
| 225 | +// companyVO.setCompanyId(companyId); | |
| 226 | +// companyVO.setCompanyName(DictFrameworkUtils.parseDictDataValue("belongCompanyId", companyId + "")); | |
| 227 | +// companyVO.setDepts(new ArrayList<>()); | |
| 228 | +// companyDeptRoadVOS.add(companyVO); | |
| 229 | +// } else { | |
| 230 | +// companyVO = existingCompanyMap.get(companyId); | |
| 231 | +// } | |
| 232 | +// | |
| 233 | +// // 建立该公司下已存在的部门映射: 部门ID -> DeptVO | |
| 234 | +// Map<Long, CompanyDeptRoadVO.DeptVO> existingDeptMap = companyVO.getDepts().stream() | |
| 235 | +// .collect(Collectors.toMap( | |
| 236 | +// deptVO -> Long.valueOf(deptVO.getDeptId()), | |
| 237 | +// deptVO -> deptVO, | |
| 238 | +// (existing, replacement) -> existing | |
| 239 | +// )); | |
| 240 | +// | |
| 241 | +// // 补充缺失的部门(仅叶子部门) | |
| 242 | +// for (DeptDO sysDept : depts) { | |
| 243 | +// Long deptId = sysDept.getId(); | |
| 244 | +// if (!existingDeptMap.containsKey(deptId)) { | |
| 245 | +// // 创建缺失的部门对象 | |
| 246 | +// CompanyDeptRoadVO.DeptVO missingDept = new CompanyDeptRoadVO.DeptVO(); | |
| 247 | +// missingDept.setDeptId(deptId); | |
| 248 | +// missingDept.setDeptName(sysDept.getName()); | |
| 249 | +// missingDept.setRoads(new ArrayList<>()); | |
| 250 | +// companyVO.getDepts().add(missingDept); | |
| 251 | +// } | |
| 252 | +// } | |
| 253 | +// } | |
| 253 | 254 | return companyDeptRoadVOS; |
| 254 | 255 | } |
| 255 | 256 | ... | ... |
urbanops-module-garden/src/main/resources/mapper/tree/TreeMapper.xml
| ... | ... | @@ -43,8 +43,7 @@ |
| 43 | 43 | LEFT JOIN garden_road r ON d.id = r.dept_id |
| 44 | 44 | LEFT JOIN garden_tree t ON r.id = t.road AND t.deleted = 0 |
| 45 | 45 | WHERE |
| 46 | - c.status = 0 | |
| 47 | - AND d.id NOT IN (SELECT DISTINCT parent_id FROM system_dept WHERE parent_id IS NOT NULL) | |
| 46 | + c.status = 0 and c.parent_id = 100 | |
| 48 | 47 | <if test="belongCompanyId != null"> |
| 49 | 48 | AND d.parent_id = #{belongCompanyId} |
| 50 | 49 | </if> |
| ... | ... | @@ -54,8 +53,8 @@ |
| 54 | 53 | <if test="deptId != null"> |
| 55 | 54 | AND d.id = #{deptId} |
| 56 | 55 | </if> |
| 57 | - GROUP BY c.id, d.id, | |
| 56 | + GROUP BY c.id, c.name, d.id, d.name, | |
| 58 | 57 | r.id, r.road_name, r.starting_remark, r.end_remark, r.tree_area |
| 59 | - ORDER BY treeCount DESC, recordedCount DESC; | |
| 58 | + ORDER BY treeCount DESC, recordedCount DESC | |
| 60 | 59 | </select> |
| 61 | 60 | </mapper> |
| 62 | 61 | \ No newline at end of file | ... | ... |