Commit ebc559ff5bdf9225498d1ac5c7d6e2dc82d56b91

Authored by 王富生
1 parent c3165b5b

测试bug修复+养护计划明细提交

Showing 19 changed files with 281 additions and 120 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitRespVO.java
... ... @@ -111,4 +111,11 @@ public class InspectionPlanCommitRespVO {
111 111 @ExcelProperty("更新者")
112 112 private String updaterName;
113 113  
  114 + @Schema(description = "归属(一级部门id)", example = "20800")
  115 + @ExcelProperty("归属(一级部门id)")
  116 + private String companyName;
  117 +
  118 + @ExcelProperty("部门(道路负责部门)")
  119 + private String deptName;
  120 +
114 121 }
115 122 \ No newline at end of file
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanPageReqVO.java
... ... @@ -34,6 +34,8 @@ public class InspectionPlanPageReqVO extends PageParam {
34 34 @Schema(description = "养护级别: 10:特级;11:一级:12:二级;13:三级", example = "8588")
35 35 private Integer levelId;
36 36  
  37 + @Schema(description = "周期ID")
  38 + private Integer cycleId;
37 39  
38 40 @Schema(description = "开始时间")
39 41 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/MaintainPlanCommitController.java
... ... @@ -83,8 +83,8 @@ public class MaintainPlanCommitController {
83 83 @Operation(summary = "获得养护计划明细分页")
84 84 @PreAuthorize("@ss.hasPermission('garden:maintain-plan-commit:query')")
85 85 public CommonResult<PageResult<MaintainPlanCommitRespVO>> getMaintainPlanCommitPage(@Valid MaintainPlanCommitPageReqVO pageReqVO) {
86   - PageResult<MaintainPlanCommitDO> pageResult = maintainPlanCommitService.getMaintainPlanCommitPage(pageReqVO);
87   - return success(BeanUtils.toBean(pageResult, MaintainPlanCommitRespVO.class));
  86 + PageResult<MaintainPlanCommitRespVO> pageResult = maintainPlanCommitService.getMaintainPlanCommitPage(pageReqVO);
  87 + return success(pageResult);
88 88 }
89 89  
90 90 @GetMapping("/export-excel")
... ... @@ -94,7 +94,7 @@ public class MaintainPlanCommitController {
94 94 public void exportMaintainPlanCommitExcel(@Valid MaintainPlanCommitPageReqVO pageReqVO,
95 95 HttpServletResponse response) throws IOException {
96 96 pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
97   - List<MaintainPlanCommitDO> list = maintainPlanCommitService.getMaintainPlanCommitPage(pageReqVO).getList();
  97 + List<MaintainPlanCommitRespVO> list = maintainPlanCommitService.getMaintainPlanCommitPage(pageReqVO).getList();
98 98 // 导出 Excel
99 99 ExcelUtils.write(response, "养护计划明细.xls", "数据", MaintainPlanCommitRespVO.class,
100 100 BeanUtils.toBean(list, MaintainPlanCommitRespVO.class));
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/vo/MaintainPlanCommitPageReqVO.java
... ... @@ -6,8 +6,9 @@ import java.time.LocalDate;
6 6 import io.swagger.v3.oas.annotations.media.Schema;
7 7 import com.zteits.urbanops.framework.common.pojo.PageParam;
8 8 import org.springframework.format.annotation.DateTimeFormat;
9   -import java.time.LocalDateTime;
  9 +import java.util.List;
10 10  
  11 +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
11 12 import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
12 13  
13 14 @Schema(description = "管理后台 - 养护计划明细分页 Request VO")
... ... @@ -20,6 +21,9 @@ public class MaintainPlanCommitPageReqVO extends PageParam {
20 21 @Schema(description = "计划编码")
21 22 private String planNo;
22 23  
  24 + @Schema(description = "计划名称")
  25 + private String planName;
  26 +
23 27 @Schema(description = "业务线: yl-园林;wy-物业:sz-市政")
24 28 private String busiLine;
25 29  
... ... @@ -32,33 +36,25 @@ public class MaintainPlanCommitPageReqVO extends PageParam {
32 36 @Schema(description = "部门ID(道路负责部门id)", example = "29117")
33 37 private Long deptId;
34 38  
35   - @Schema(description = "道路ID", example = "12084")
36   - private Long roadId;
37   -
38   - @Schema(description = "本次完成百分比")
39   - private Double finishPercent;
40   -
41   - @Schema(description = "照片host")
42   - private String imgHost;
43   -
44   - @Schema(description = "开始照片")
45   - private String beginImg;
  39 + @Schema(description = "计划属性:1:标准计划;2:临时计划", example = "1")
  40 + private Integer planAttr;
46 41  
47   - @Schema(description = "处理中照片")
48   - private String processImg;
  42 + @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", example = "2001")
  43 + private Integer planTypeId;
49 44  
50   - @Schema(description = "结束照片")
51   - private String endImg;
  45 + @Schema(description = "道路ID", example = "12084")
  46 + private Long roadId;
  47 + @Schema(description = "道路", example = "12917")
  48 + private String roadName;
52 49  
53   - @Schema(description = "养护面积:单位m²")
54   - private Double opArea;
  50 + @Schema(description = "角色名称", example = "12917")
  51 + private String roleName;
55 52  
56   - @Schema(description = "操作时长")
57   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
58   - private Double[] opTime;
  53 + @Schema(description = "养护级别: 10:特级;11:一级:12:二级;13:三级", example = "10")
  54 + private Integer levelId;
59 55  
60 56 @Schema(description = "完成时间")
61   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  57 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
62 58 private LocalDate[] finishTime;
63 59  
64 60 @Schema(description = "提交人用户", example = "19167")
... ... @@ -67,17 +63,6 @@ public class MaintainPlanCommitPageReqVO extends PageParam {
67 63 @Schema(description = "提交人用户ID", example = "王五")
68 64 private String userName;
69 65  
70   - @Schema(description = "备注", example = "你猜")
71   - private String remark;
72   -
73   - @Schema(description = "创建者", example = "张三")
74   - private String creatorName;
75   -
76   - @Schema(description = "创建时间")
77   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
78   - private LocalDateTime[] createTime;
79   -
80   - @Schema(description = "更新者", example = "赵六")
81   - private String updaterName;
  66 + private List<String> busiLineList;
82 67  
83 68 }
84 69 \ No newline at end of file
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/vo/MaintainPlanCommitRespVO.java
... ... @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.*;
5 5  
6 6 import java.time.LocalDateTime;
  7 +
7 8 import cn.idev.excel.annotation.*;
8 9  
9 10 @Schema(description = "管理后台 - 养护计划明细 Response VO")
... ... @@ -11,92 +12,93 @@ import cn.idev.excel.annotation.*;
11 12 @ExcelIgnoreUnannotated
12 13 public class MaintainPlanCommitRespVO {
13 14  
14   - @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26945")
15   - @ExcelProperty("ID")
16   - private Long id;
17   -
18   - @Schema(description = "批次号", requiredMode = Schema.RequiredMode.REQUIRED)
  15 + @Schema(description = "批次号")
19 16 @ExcelProperty("批次号")
20 17 private String batchNo;
21 18  
22   - @Schema(description = "计划编码", requiredMode = Schema.RequiredMode.REQUIRED)
  19 + @Schema(description = "计划编码")
23 20 @ExcelProperty("计划编码")
24 21 private String planNo;
25 22  
26   - @Schema(description = "业务线: yl-园林;wy-物业:sz-市政", requiredMode = Schema.RequiredMode.REQUIRED)
  23 + @Schema(description = "计划名称")
  24 + @ExcelProperty("计划名称")
  25 + private String planName;
  26 +
  27 + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政")
27 28 @ExcelProperty("业务线: yl-园林;wy-物业:sz-市政")
28 29 private String busiLine;
29 30  
30   - @Schema(description = "提交次序号", requiredMode = Schema.RequiredMode.REQUIRED)
  31 + @Schema(description = "提交次序号")
31 32 @ExcelProperty("提交次序号")
32 33 private Integer sortNum;
33 34  
34   - @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2759")
  35 + @Schema(description = "归属(一级部门id)", example = "2759")
35 36 @ExcelProperty("归属(一级部门id)")
36 37 private Long companyId;
37 38  
38   - @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "29117")
  39 + @Schema(description = "公司", requiredMode = Schema.RequiredMode.REQUIRED, example = "2759")
  40 + @ExcelProperty("公司")
  41 + private String companyName;
  42 +
  43 + @Schema(description = "部门ID(道路负责部门id)", example = "29117")
39 44 @ExcelProperty("部门ID(道路负责部门id)")
40 45 private Long deptId;
41 46  
42   - @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12084")
  47 + @Schema(description = "部门", example = "29117")
  48 + @ExcelProperty("部门")
  49 + private String deptName;
  50 +
  51 + @Schema(description = "道路ID", example = "12084")
43 52 @ExcelProperty("道路ID")
44 53 private Long roadId;
45 54  
46   - @Schema(description = "本次完成百分比", requiredMode = Schema.RequiredMode.REQUIRED)
47   - @ExcelProperty("本次完成百分比")
48   - private Double finishPercent;
  55 + @Schema(description = "道路名称", example = "12084")
  56 + @ExcelProperty("道路名称")
  57 + private String roadName;
49 58  
50   - @Schema(description = "照片host", requiredMode = Schema.RequiredMode.REQUIRED)
51   - @ExcelProperty("照片host")
52   - private String imgHost;
  59 + @Schema(description = "养护级别: 10:特级;11:一级:12:二级;13:三级", example = "10")
  60 + @ExcelProperty("养护级别")
  61 + private Integer levelId;
53 62  
54   - @Schema(description = "开始照片", requiredMode = Schema.RequiredMode.REQUIRED)
55   - @ExcelProperty("开始照片")
56   - private String beginImg;
  63 + @Schema(description = "计划属性:1:标准计划;2:临时计划", example = "1")
  64 + private Integer planAttr;
57 65  
58   - @Schema(description = "处理中照片", requiredMode = Schema.RequiredMode.REQUIRED)
59   - @ExcelProperty("处理中照片")
60   - private String processImg;
  66 + @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", example = "24742")
  67 + @ExcelProperty("养护类型")
  68 + private Integer planTypeId;
61 69  
62   - @Schema(description = "结束照片", requiredMode = Schema.RequiredMode.REQUIRED)
63   - @ExcelProperty("结束照片")
64   - private String endImg;
65 70  
66   - @Schema(description = "养护面积:单位m²", requiredMode = Schema.RequiredMode.REQUIRED)
67   - @ExcelProperty("养护面积:单位m²")
68   - private Double opArea;
69   -
70   - @Schema(description = "操作时长", requiredMode = Schema.RequiredMode.REQUIRED)
71   - @ExcelProperty("操作时长")
72   - private Double opTime;
  71 + @Schema(description = "本次完成百分比")
  72 + @ExcelProperty("本次完成百分比")
  73 + private Double finishPercent;
73 74  
74 75 @Schema(description = "完成时间")
75 76 @ExcelProperty("完成时间")
76 77 private LocalDateTime finishTime;
77 78  
78   - @Schema(description = "提交人用户", requiredMode = Schema.RequiredMode.REQUIRED, example = "19167")
  79 + @Schema(description = "提交人用户", example = "19167")
79 80 @ExcelProperty("提交人用户")
80 81 private Long userId;
81 82  
82   - @Schema(description = "提交人用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
  83 + @Schema(description = "提交人用户ID", example = "王五")
83 84 @ExcelProperty("提交人用户ID")
84 85 private String userName;
85 86  
86   - @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
  87 + @Schema(description = "角色ID", example = "你猜")
  88 + @ExcelProperty("角色ID")
  89 + private Long roleId;
  90 +
  91 + @Schema(description = "角色", example = "你猜")
  92 + @ExcelProperty("角色")
  93 + private String roleName;
  94 +
  95 + @Schema(description = "备注", example = "你猜")
87 96 @ExcelProperty("备注")
88 97 private String remark;
89 98  
90   - @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
  99 + @Schema(description = "创建者", example = "张三")
91 100 @ExcelProperty("创建者")
92 101 private String creatorName;
93 102  
94   - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
95   - @ExcelProperty("创建时间")
96   - private LocalDateTime createTime;
97   -
98   - @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
99   - @ExcelProperty("更新者")
100   - private String updaterName;
101 103  
102 104 }
103 105 \ No newline at end of file
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/vo/MaintainPlanPageReqVO.java
... ... @@ -27,6 +27,9 @@ public class MaintainPlanPageReqVO extends PageParam {
27 27 @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", example = "7439")
28 28 private Integer planTypeId;
29 29  
  30 + @Schema(description = "周期ID")
  31 + private Integer cycleId;
  32 +
30 33 @Schema(description = "归属(一级部门id)", example = "1713")
31 34 private Long companyId;
32 35  
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/RoadController.java
... ... @@ -88,7 +88,7 @@ public class RoadController {
88 88  
89 89 @PostMapping("/list")
90 90 @Operation(summary = "获得道路列表")
91   - @PreAuthorize("@ss.hasPermission('garden:road:query')")
  91 + //@PreAuthorize("@ss.hasPermission('garden:road:query')")
92 92 public CommonResult<List<RoadListRespVO>> getRoadList(@Valid @RequestBody RoadListReqVO reqVO) {
93 93 List<RoadDO> roadList = roadService.getRoadList(reqVO);
94 94 return success(BeanUtils.toBean(roadList, RoadListRespVO.class));
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/inspectionplan/InspectionPlanDetailMapper.java
... ... @@ -32,7 +32,7 @@ public interface InspectionPlanDetailMapper extends BaseMapperX&lt;InspectionPlanDe
32 32 .eqIfPresent(InspectionPlanDetailDO::getFinishState, reqVO.getFinishState())
33 33 .betweenIfPresent(InspectionPlanDetailDO::getCreateTime, reqVO.getCreateTime())
34 34 .eq(InspectionPlanDetailDO::getDeleted,0)
35   - .orderByDesc(InspectionPlanDetailDO::getId));
  35 + .orderByAsc(InspectionPlanDetailDO::getId));
36 36 }
37 37  
38 38 int deleteByBatchNo(@Param("batchNo") String batchNo);
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/maintainplan/MaintainPlanCommitMapper.java
1 1 package com.zteits.urbanops.module.garden.dal.mysql.maintainplan;
2 2  
3 3  
4   -import com.zteits.urbanops.framework.common.pojo.PageResult;
5   -import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX;
  4 +import com.baomidou.mybatisplus.core.metadata.IPage;
6 5 import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX;
7 6 import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanCommitDO;
8 7 import org.apache.ibatis.annotations.Mapper;
9 8 import com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo.*;
  9 +import org.apache.ibatis.annotations.Param;
10 10  
11 11 /**
12 12 * 养护计划明细 Mapper
... ... @@ -16,30 +16,12 @@ import com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo.*;
16 16 @Mapper
17 17 public interface MaintainPlanCommitMapper extends BaseMapperX<MaintainPlanCommitDO> {
18 18  
19   - default PageResult<MaintainPlanCommitDO> selectPage(MaintainPlanCommitPageReqVO reqVO) {
20   - return selectPage(reqVO, new LambdaQueryWrapperX<MaintainPlanCommitDO>()
21   - .eqIfPresent(MaintainPlanCommitDO::getBatchNo, reqVO.getBatchNo())
22   - .eqIfPresent(MaintainPlanCommitDO::getPlanNo, reqVO.getPlanNo())
23   - .eqIfPresent(MaintainPlanCommitDO::getBusiLine, reqVO.getBusiLine())
24   - .eqIfPresent(MaintainPlanCommitDO::getSortNum, reqVO.getSortNum())
25   - .eqIfPresent(MaintainPlanCommitDO::getCompanyId, reqVO.getCompanyId())
26   - .eqIfPresent(MaintainPlanCommitDO::getDeptId, reqVO.getDeptId())
27   - .eqIfPresent(MaintainPlanCommitDO::getRoadId, reqVO.getRoadId())
28   - .eqIfPresent(MaintainPlanCommitDO::getFinishPercent, reqVO.getFinishPercent())
29   - .eqIfPresent(MaintainPlanCommitDO::getImgHost, reqVO.getImgHost())
30   - .eqIfPresent(MaintainPlanCommitDO::getBeginImg, reqVO.getBeginImg())
31   - .eqIfPresent(MaintainPlanCommitDO::getProcessImg, reqVO.getProcessImg())
32   - .eqIfPresent(MaintainPlanCommitDO::getEndImg, reqVO.getEndImg())
33   - .eqIfPresent(MaintainPlanCommitDO::getOpArea, reqVO.getOpArea())
34   - .betweenIfPresent(MaintainPlanCommitDO::getOpTime, reqVO.getOpTime())
35   - .betweenIfPresent(MaintainPlanCommitDO::getFinishTime, reqVO.getFinishTime())
36   - .eqIfPresent(MaintainPlanCommitDO::getUserId, reqVO.getUserId())
37   - .likeIfPresent(MaintainPlanCommitDO::getUserName, reqVO.getUserName())
38   - .eqIfPresent(MaintainPlanCommitDO::getRemark, reqVO.getRemark())
39   - .likeIfPresent(MaintainPlanCommitDO::getCreatorName, reqVO.getCreatorName())
40   - .betweenIfPresent(MaintainPlanCommitDO::getCreateTime, reqVO.getCreateTime())
41   - .likeIfPresent(MaintainPlanCommitDO::getUpdaterName, reqVO.getUpdaterName())
42   - .orderByDesc(MaintainPlanCommitDO::getId));
43   - }
  19 + /* 自定义 SQL 分页查询(复杂联表场景,XML 方式)
  20 + * @param page 分页上下文
  21 + * @param reqDTO 查询条件
  22 + * @return 分页结果
  23 + */
  24 + IPage<MaintainPlanCommitRespVO> selectForPage(@Param("page") IPage<MaintainPlanCommitRespVO> page, @Param("req") MaintainPlanCommitPageReqVO req);
  25 +
44 26  
45 27 }
46 28 \ No newline at end of file
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanCommitServiceImpl.java
... ... @@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4 import com.zteits.urbanops.framework.common.util.string.StrUtils;
5 5 import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils;
6 6 import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils;
  7 +import com.zteits.urbanops.module.system.api.dept.DeptApi;
  8 +import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO;
7 9 import org.apache.commons.lang3.StringUtils;
8 10 import org.springframework.stereotype.Service;
9 11 import jakarta.annotation.Resource;
  12 +import org.springframework.util.CollectionUtils;
10 13 import org.springframework.validation.annotation.Validated;
11 14  
12 15 import java.util.*;
  16 +import java.util.stream.Collectors;
13 17  
14 18 import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*;
15 19 import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanCommitDO;
... ... @@ -31,6 +35,9 @@ public class InspectionPlanCommitServiceImpl implements InspectionPlanCommitServ
31 35 @Resource
32 36 private InspectionPlanCommitMapper inspectionPlanCommitMapper;
33 37  
  38 + @Resource
  39 + private DeptApi deptApi;
  40 +
34 41 @Override
35 42 public Long createInspectionPlanCommit(InspectionPlanCommitSaveReqVO createReqVO) {
36 43 // 插入
... ... @@ -91,10 +98,40 @@ public class InspectionPlanCommitServiceImpl implements InspectionPlanCommitServ
91 98 //分页
92 99 IPage<InspectionPlanCommitRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO);
93 100 IPage<InspectionPlanCommitRespVO> page = inspectionPlanCommitMapper.selectForPage(mpPage, pageReqVO);
  101 + addDataInspectionPlan(page.getRecords());
94 102 // 转换返回
95 103 return new PageResult<>(imgProcess(page.getRecords()), page.getTotal());
96 104 }
97 105  
  106 + /**
  107 + * 回填部门/公司/角色
  108 + * @param list 分页对象
  109 + */
  110 + private void addDataInspectionPlan(List<InspectionPlanCommitRespVO> list ){
  111 + if(CollectionUtils.isEmpty(list)){
  112 + return ;
  113 + }
  114 + //公司
  115 + Set<Long> companyIds = list.stream().map(InspectionPlanCommitRespVO::getCompanyId).collect(Collectors.toSet());
  116 + //部门
  117 + Set<Long> deptIds = list.stream().map(InspectionPlanCommitRespVO::getDeptId).collect(Collectors.toSet());
  118 + deptIds.addAll(companyIds);
  119 + /*1.获取部门*/
  120 + Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(deptIds);
  121 +
  122 + list.forEach(plan -> {
  123 + DeptRespDTO dept = deptMap.get(plan.getDeptId());
  124 + if (dept != null) {
  125 + plan.setDeptName(dept.getName());
  126 +
  127 + }
  128 + DeptRespDTO company = deptMap.get(plan.getCompanyId());
  129 + if(company != null){
  130 + plan.setCompanyName(company.getName());
  131 + }
  132 + });
  133 + }
  134 +
98 135 private List<InspectionPlanCommitRespVO> imgProcess(List<InspectionPlanCommitRespVO> list) {
99 136 list.forEach(e -> {
100 137 e.setImgList(StrUtils.imgProcess(e.getImg(), e.getImgHost()));
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
... ... @@ -102,7 +102,7 @@ public class InspectionPlanServiceImpl implements InspectionPlanService {
102 102 //按照道路创建计划
103 103 createReqVO.getRoadListReqVO().forEach(roadReqVO -> {
104 104 InspectionPlanDO inspectionPlan = BeanUtils.toBean(createReqVO, InspectionPlanDO.class);
105   - String batchNo = "BN" + System.currentTimeMillis() + RandomUtil.randomInt(10000) + roadReqVO.getRoadId();
  105 + String batchNo = "BN" + System.currentTimeMillis() + RandomUtil.randomInt(1000 , 9999) + roadReqVO.getRoadId();
106 106 inspectionPlan.setBatchNo(batchNo);
107 107 inspectionPlan.setPlanFinishNum(0);
108 108 inspectionPlan.setFinishState(FinishStateEnum.NOT_FINISHED.getStatus());
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanCommitService.java
... ... @@ -56,6 +56,6 @@ public interface MaintainPlanCommitService {
56 56 * @param pageReqVO 分页查询
57 57 * @return 养护计划明细分页
58 58 */
59   - PageResult<MaintainPlanCommitDO> getMaintainPlanCommitPage(MaintainPlanCommitPageReqVO pageReqVO);
  59 + PageResult<MaintainPlanCommitRespVO> getMaintainPlanCommitPage(MaintainPlanCommitPageReqVO pageReqVO);
60 60  
61 61 }
62 62 \ No newline at end of file
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanCommitServiceImpl.java
1 1 package com.zteits.urbanops.module.garden.service.maintainplan;
2 2  
  3 +import com.baomidou.mybatisplus.core.metadata.IPage;
  4 +import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils;
  5 +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils;
  6 +import com.zteits.urbanops.module.system.api.dept.DeptApi;
  7 +import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO;
  8 +import org.apache.commons.lang3.StringUtils;
3 9 import org.springframework.stereotype.Service;
4 10 import jakarta.annotation.Resource;
  11 +import org.springframework.util.CollectionUtils;
5 12 import org.springframework.validation.annotation.Validated;
6 13  
7 14 import java.util.*;
  15 +import java.util.stream.Collectors;
  16 +
8 17 import com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo.*;
9 18 import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanCommitDO;
10 19 import com.zteits.urbanops.framework.common.pojo.PageResult;
... ... @@ -25,6 +34,9 @@ public class MaintainPlanCommitServiceImpl implements MaintainPlanCommitService
25 34 @Resource
26 35 private MaintainPlanCommitMapper maintainPlanCommitMapper;
27 36  
  37 + @Resource
  38 + private DeptApi deptApi;
  39 +
28 40 @Override
29 41 public Long createMaintainPlanCommit(MaintainPlanCommitSaveReqVO createReqVO) {
30 42 // 插入
... ... @@ -71,8 +83,52 @@ public class MaintainPlanCommitServiceImpl implements MaintainPlanCommitService
71 83 }
72 84  
73 85 @Override
74   - public PageResult<MaintainPlanCommitDO> getMaintainPlanCommitPage(MaintainPlanCommitPageReqVO pageReqVO) {
75   - return maintainPlanCommitMapper.selectPage(pageReqVO);
  86 + public PageResult<MaintainPlanCommitRespVO> getMaintainPlanCommitPage(MaintainPlanCommitPageReqVO pageReqVO) {
  87 + String busiLine = SecurityFrameworkUtils.getBusiLine();
  88 + List<String> busiLineList = new ArrayList<>();
  89 + if (StringUtils.isNotEmpty(pageReqVO.getBusiLine())) {
  90 + busiLineList.add(pageReqVO.getBusiLine());
  91 + } else {
  92 + if (StringUtils.isNotEmpty(busiLine)) {
  93 + busiLineList.addAll(Arrays.asList(busiLine.split(",")));
  94 + }
  95 + }
  96 + pageReqVO.setBusiLineList(busiLineList);
  97 + //分页
  98 + IPage<MaintainPlanCommitRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO);
  99 + IPage<MaintainPlanCommitRespVO> page = maintainPlanCommitMapper.selectForPage(mpPage, pageReqVO);
  100 + addDataInspectionPlan(page.getRecords());
  101 + // 转换返回
  102 + return new PageResult<>(page.getRecords(), page.getTotal());
  103 + }
  104 +
  105 + /**
  106 + * 回填部门/公司/角色
  107 + * @param list 分页对象
  108 + */
  109 + private void addDataInspectionPlan(List<MaintainPlanCommitRespVO> list ){
  110 + if(CollectionUtils.isEmpty(list)){
  111 + return ;
  112 + }
  113 + //公司
  114 + Set<Long> companyIds = list.stream().map(MaintainPlanCommitRespVO::getCompanyId).collect(Collectors.toSet());
  115 + //部门
  116 + Set<Long> deptIds = list.stream().map(MaintainPlanCommitRespVO::getDeptId).collect(Collectors.toSet());
  117 + deptIds.addAll(companyIds);
  118 + /*1.获取部门*/
  119 + Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(deptIds);
  120 +
  121 + list.forEach(plan -> {
  122 + DeptRespDTO dept = deptMap.get(plan.getDeptId());
  123 + if (dept != null) {
  124 + plan.setDeptName(dept.getName());
  125 +
  126 + }
  127 + DeptRespDTO company = deptMap.get(plan.getCompanyId());
  128 + if(company != null){
  129 + plan.setCompanyName(company.getName());
  130 + }
  131 + });
76 132 }
77 133  
78 134 }
79 135 \ No newline at end of file
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java
... ... @@ -103,7 +103,7 @@ public class MaintainPlanServiceImpl implements MaintainPlanService {
103 103 //按照道路创建计划
104 104 createReqVO.getRoadListReqVO().forEach(roadReqVO -> {
105 105 MaintainPlanDO maintainPlan = BeanUtils.toBean(createReqVO, MaintainPlanDO.class);
106   - String batchNo = "BN" + System.currentTimeMillis() + RandomUtil.randomInt(10000) + roadReqVO.getRoadId();
  106 + String batchNo = "BN" + System.currentTimeMillis() + RandomUtil.randomInt(1000, 9999) + roadReqVO.getRoadId();
107 107 maintainPlan.setBatchNo(batchNo);
108 108 maintainPlan.setPlanFinishNum(0);
109 109 maintainPlan.setFinishState(FinishStateEnum.NOT_FINISHED.getStatus());
... ... @@ -138,7 +138,7 @@ public class MaintainPlanServiceImpl implements MaintainPlanService {
138 138 roleList.add(maintainPlanRoleDO);
139 139 });
140 140 /*3.插入巡查计划明细*/
141   - int index =1;
  141 + int index = 1;
142 142 for (PeriodResult periodResult : calculate) {
143 143 MaintainPlanDetailDO entity = getMaintainPlanDetailDO(batchNo, createReqVO, roadReqVO, now);
144 144 ThreadUtil.sleep(2);
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/road/RoadServiceImpl.java
... ... @@ -70,8 +70,14 @@ public class RoadServiceImpl implements RoadService {
70 70 public void updateRoad(RoadUpdateReqVO updateReqVO) {
71 71 // 校验存在
72 72 //validateRoadExists(updateReqVO.getId());
  73 + LocalDateTime now = LocalDateTime.now();
  74 + String userId = SecurityFrameworkUtils.getLoginUserId() + "";
  75 + String userName = SecurityFrameworkUtils.getLoginUserNickname();
73 76 // 更新
74 77 RoadDO updateObj = BeanUtils.toBean(updateReqVO, RoadDO.class);
  78 + updateObj.setUpdateTime(now);
  79 + updateObj.setUpdaterName(userName);
  80 + updateObj.setUpdater(userId);
75 81 roadMapper.updateById(updateObj);
76 82 }
77 83  
... ...
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanCommitMapper.xml
... ... @@ -64,7 +64,7 @@
64 64 AND b.road_name LIKE CONCAT(#{req.roadName},'%')
65 65 </if>
66 66 <if test="req.roleName != null and req.roleName !=''">
67   - AND a.role_name LIKE CONCAT(#{roleName},'%')
  67 + AND a.role_name LIKE CONCAT(#{req.roleName},'%')
68 68 </if>
69 69 <if test="req.companyId != null">
70 70 and b.company_id = #{req.companyId}
... ...
urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanCommitMapper.xml
... ... @@ -9,4 +9,74 @@
9 9 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
10 10 -->
11 11  
  12 + <select id="selectForPage" resultType="com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo.MaintainPlanCommitRespVO">
  13 + SELECT
  14 + a.batch_no,
  15 + a.plan_no,
  16 + b.plan_name,
  17 + b.road_id,
  18 + b.road_name,
  19 + b.level_id,
  20 + b.plan_attr,
  21 + b.plan_type_id,
  22 + b.cycle_id,
  23 + b.plan_num,
  24 + b.busi_line,
  25 + b.plan_finish_num,
  26 + a.begin_time,
  27 + a.end_time,
  28 + a.company_id,
  29 + a.dept_id,
  30 + a.finish_percent,
  31 + c.role_name,
  32 + c.finish_time,
  33 + c.user_name
  34 + FROM
  35 + garden_maintain_plan_detail a,
  36 + garden_maintain_plan b,
  37 + (SELECT plan_no, role_name , finish_time,user_id,user_name FROM garden_maintain_plan_commit ORDER BY id ASC LIMIT 1) c
  38 + WHERE
  39 + a.batch_no = b.batch_no
  40 + AND a.plan_no = c.plan_no
  41 + <if test="req.planNo != null and req.planNo !=''">
  42 + and a.plan_no = #{req.planNo}
  43 + </if>
  44 + <if test="req.planName != null and req.planName !=''">
  45 + and a.plan_name = #{req.planName}
  46 + </if>
  47 + <if test="req.roadName != null and req.roadName !=''">
  48 + AND b.road_name LIKE CONCAT(#{req.roadName},'%')
  49 + </if>
  50 + <if test="req.levelId != null">
  51 + and b.level_id = #{req.levelId}
  52 + </if>
  53 + <if test="req.busiLineList != null and req.busiLineList.size() > 0">
  54 + AND b.busi_line IN
  55 + <foreach collection="req.busiLineList" item="id" open="(" separator="," close=")">
  56 + #{id}
  57 + </foreach>
  58 + </if>
  59 + <if test="req.planTypeId != null">
  60 + and b.plan_type_id = #{req.planTypeId}
  61 + </if>
  62 + <if test="req.planAttr != null">
  63 + and b.plan_attr = #{req.planAttr}
  64 + </if>
  65 + <if test="req.companyId != null">
  66 + and a.company_id = #{req.companyId}
  67 + </if>
  68 + <if test="req.deptId != null">
  69 + and a.dept_id = #{req.deptId}
  70 + </if>
  71 + <if test="req.roleName != null and req.roleName !=''">
  72 + AND c.role_name LIKE CONCAT(#{req.roleName},'%')
  73 + </if>
  74 + <if test="req.userName != null and req.userName !=''">
  75 + AND c.user_name LIKE CONCAT(#{req.userName},'%')
  76 + </if>
  77 + <if test="req.finishTime != null">
  78 + AND DATE_FORMAT(c.finish_time, '%Y-%m-%d') = #{req.finishTime}
  79 + </if>
  80 + </select>
  81 +
12 82 </mapper>
13 83 \ No newline at end of file
... ...
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/controller/admin/dept/DeptController.java
... ... @@ -94,7 +94,7 @@ public class DeptController {
94 94  
95 95 @GetMapping("/sub-list")
96 96 @Operation(summary = "获取二级部门列表")
97   - @PreAuthorize("@ss.hasPermission('system:dept:query')")
  97 + //@PreAuthorize("@ss.hasPermission('system:dept:query')")
98 98 public CommonResult<List<DeptRespVO>> getSubDeptList() {
99 99 List<DeptDO> list = deptService.getSubDeptList();
100 100 return success(BeanUtils.toBean(list, DeptRespVO.class));
... ... @@ -102,7 +102,7 @@ public class DeptController {
102 102  
103 103 @GetMapping("/last-list")
104 104 @Operation(summary = "获取最末级部门列表")
105   - @PreAuthorize("@ss.hasPermission('system:dept:query')")
  105 + //@PreAuthorize("@ss.hasPermission('system:dept:query')")
106 106 public CommonResult<List<DeptRespVO>> getLastDeptList(@RequestParam("id") Long id) {
107 107 List<DeptDO> list = deptService.getLastDeptList(id);
108 108 return success(BeanUtils.toBean(list, DeptRespVO.class));
... ...
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/dept/DeptServiceImpl.java
... ... @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6 6 import com.zteits.urbanops.framework.common.enums.CommonStatusEnum;
7 7 import com.zteits.urbanops.framework.common.util.object.BeanUtils;
8 8 import com.zteits.urbanops.framework.datapermission.core.annotation.DataPermission;
  9 +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils;
9 10 import com.zteits.urbanops.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
10 11 import com.zteits.urbanops.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO;
11 12 import com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO;
... ... @@ -21,6 +22,7 @@ import org.springframework.validation.annotation.Validated;
21 22  
22 23 import jakarta.annotation.Resource;
23 24 import java.util.*;
  25 +import java.util.stream.Collectors;
24 26  
25 27 import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception;
26 28 import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertSet;
... ... @@ -181,7 +183,16 @@ public class DeptServiceImpl implements DeptService {
181 183  
182 184 @Override
183 185 public List<DeptDO> getSubDeptList() {
184   - return deptMapper.selectList(DeptDO::getParentId,100);
  186 + List<DeptDO> list = deptMapper.selectList(DeptDO::getParentId, 100);
  187 + Long companyId = SecurityFrameworkUtils.getCompanyId();
  188 + if(companyId == null){
  189 + return list;
  190 + }
  191 + //超级管理员全返回
  192 + if(companyId.equals(100L)){
  193 + return list;
  194 + }
  195 + return list.stream().filter(dept -> dept.getId().equals(companyId)).collect(Collectors.toList());
185 196 }
186 197  
187 198 @Override
... ...