Commit b3c0caf4fa8d0c69e90d37238afb3c16edb0fdba
1 parent
e9a02470
巡查计划明细及巡查计划创建优化
Showing
20 changed files
with
360 additions
and
172 deletions
urbanops-framework/urbanops-common/src/main/java/com/zteits/urbanops/framework/common/util/string/StrUtils.java
| ... | ... | @@ -3,12 +3,11 @@ package com.zteits.urbanops.framework.common.util.string; |
| 3 | 3 | import cn.hutool.core.text.StrPool; |
| 4 | 4 | import cn.hutool.core.util.ArrayUtil; |
| 5 | 5 | import cn.hutool.core.util.StrUtil; |
| 6 | +import com.alibaba.fastjson.JSON; | |
| 6 | 7 | import org.aspectj.lang.JoinPoint; |
| 8 | +import org.springframework.util.StringUtils; | |
| 7 | 9 | |
| 8 | -import java.util.Arrays; | |
| 9 | -import java.util.Collection; | |
| 10 | -import java.util.List; | |
| 11 | -import java.util.Set; | |
| 10 | +import java.util.*; | |
| 12 | 11 | import java.util.stream.Collectors; |
| 13 | 12 | |
| 14 | 13 | /** |
| ... | ... | @@ -104,4 +103,23 @@ public class StrUtils { |
| 104 | 103 | }); |
| 105 | 104 | } |
| 106 | 105 | |
| 106 | + /** | |
| 107 | + * 图片处理 | |
| 108 | + * @param img 图片 | |
| 109 | + * @param url 地址 | |
| 110 | + * @return 图片列表 | |
| 111 | + */ | |
| 112 | + public static List<String> imgProcess(String img, String url) { | |
| 113 | + List<String> list = new ArrayList<>(); | |
| 114 | + if (StringUtils.isEmpty(img)) { | |
| 115 | + return list; | |
| 116 | + } | |
| 117 | + List<String> imgs = JSON.parseArray(img, String.class); | |
| 118 | + for (String imgStr : imgs) { | |
| 119 | + list.add(url + imgStr); | |
| 120 | + } | |
| 121 | + | |
| 122 | + return list; | |
| 123 | + } | |
| 124 | + | |
| 107 | 125 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanCommitController.java
| ... | ... | @@ -30,7 +30,7 @@ import com.zteits.urbanops.module.garden.service.inspectionplan.InspectionPlanCo |
| 30 | 30 | |
| 31 | 31 | @Tag(name = "管理后台 - 巡检计划提交明细") |
| 32 | 32 | @RestController |
| 33 | -@RequestMapping("/garden/inspection-plan-commit") | |
| 33 | +@RequestMapping("/garden/inspection-plan-commit/") | |
| 34 | 34 | @Validated |
| 35 | 35 | public class InspectionPlanCommitController { |
| 36 | 36 | |
| ... | ... | @@ -83,7 +83,7 @@ public class InspectionPlanCommitController { |
| 83 | 83 | @Operation(summary = "获得巡检计划提交明细分页") |
| 84 | 84 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan-commit:query')") |
| 85 | 85 | public CommonResult<PageResult<InspectionPlanCommitRespVO>> getInspectionPlanCommitPage(@Valid InspectionPlanCommitPageReqVO pageReqVO) { |
| 86 | - PageResult<InspectionPlanCommitDO> pageResult = inspectionPlanCommitService.getInspectionPlanCommitPage(pageReqVO); | |
| 86 | + PageResult<InspectionPlanCommitRespVO> pageResult = inspectionPlanCommitService.getInspectionPlanCommitPage(pageReqVO); | |
| 87 | 87 | return success(BeanUtils.toBean(pageResult, InspectionPlanCommitRespVO.class)); |
| 88 | 88 | } |
| 89 | 89 | |
| ... | ... | @@ -94,7 +94,7 @@ public class InspectionPlanCommitController { |
| 94 | 94 | public void exportInspectionPlanCommitExcel(@Valid InspectionPlanCommitPageReqVO pageReqVO, |
| 95 | 95 | HttpServletResponse response) throws IOException { |
| 96 | 96 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 97 | - List<InspectionPlanCommitDO> list = inspectionPlanCommitService.getInspectionPlanCommitPage(pageReqVO).getList(); | |
| 97 | + List<InspectionPlanCommitRespVO> list = inspectionPlanCommitService.getInspectionPlanCommitPage(pageReqVO).getList(); | |
| 98 | 98 | // 导出 Excel |
| 99 | 99 | ExcelUtils.write(response, "巡检计划提交明细.xls", "数据", InspectionPlanCommitRespVO.class, |
| 100 | 100 | BeanUtils.toBean(list, InspectionPlanCommitRespVO.class)); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.inspectionplan; |
| 2 | 2 | |
| 3 | 3 | import jakarta.validation.constraints.NotBlank; |
| 4 | +import lombok.extern.slf4j.Slf4j; | |
| 4 | 5 | import org.springframework.web.bind.annotation.*; |
| 5 | 6 | import jakarta.annotation.Resource; |
| 6 | 7 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -18,12 +19,16 @@ import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 18 | 19 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 19 | 20 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 20 | 21 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 22 | + | |
| 23 | +import static com.alibaba.druid.util.FnvHash.Constants.LOG; | |
| 24 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.error; | |
| 21 | 25 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; |
| 22 | 26 | |
| 23 | 27 | import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; |
| 24 | 28 | |
| 25 | 29 | import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; |
| 26 | 30 | import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; |
| 31 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.PLAN_RATE_VALUE_ERROR; | |
| 27 | 32 | |
| 28 | 33 | import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; |
| 29 | 34 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; |
| ... | ... | @@ -33,6 +38,7 @@ import com.zteits.urbanops.module.garden.service.inspectionplan.InspectionPlanSe |
| 33 | 38 | @RestController |
| 34 | 39 | @RequestMapping("/garden/inspection-plan") |
| 35 | 40 | @Validated |
| 41 | +@Slf4j | |
| 36 | 42 | public class InspectionPlanController { |
| 37 | 43 | |
| 38 | 44 | @Resource |
| ... | ... | @@ -41,7 +47,12 @@ public class InspectionPlanController { |
| 41 | 47 | @PostMapping("/create") |
| 42 | 48 | @Operation(summary = "创建巡检计划汇总") |
| 43 | 49 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan:create')") |
| 44 | - public CommonResult<Long> createInspectionPlan(@Valid @RequestBody InspectionPlanSaveReqVO createReqVO) { | |
| 50 | + public CommonResult<Integer> createInspectionPlan(@Valid @RequestBody InspectionPlanSaveReqVO createReqVO) { | |
| 51 | + if(!createReqVO.verify()){ | |
| 52 | + log.warn("次数值范围:1-20或者分数格式:1/3, rateValue={}", createReqVO.getRateValue()); | |
| 53 | + return error(PLAN_RATE_VALUE_ERROR); | |
| 54 | + } | |
| 55 | + | |
| 45 | 56 | return inspectionPlanService.createInspectionPlan(createReqVO); |
| 46 | 57 | } |
| 47 | 58 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitPageReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; |
| 2 | 2 | |
| 3 | 3 | import lombok.*; |
| 4 | + | |
| 5 | +import java.time.LocalDate; | |
| 4 | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 7 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 6 | 8 | import org.springframework.format.annotation.DateTimeFormat; |
| 7 | -import java.time.LocalDateTime; | |
| 8 | 9 | |
| 9 | -import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; | |
| 10 | 11 | |
| 11 | 12 | @Schema(description = "管理后台 - 巡检计划提交明细分页 Request VO") |
| 12 | 13 | @Data |
| 13 | 14 | public class InspectionPlanCommitPageReqVO extends PageParam { |
| 14 | 15 | |
| 15 | - @Schema(description = "批次号") | |
| 16 | - private String batchNo; | |
| 17 | 16 | |
| 18 | 17 | @Schema(description = "计划编码") |
| 19 | 18 | private String planNo; |
| 20 | 19 | |
| 20 | + @Schema(description = "计划名称") | |
| 21 | + private String planName; | |
| 22 | + | |
| 21 | 23 | @Schema(description = "业务线: yl-园林;wy-物业:sz-市政") |
| 22 | 24 | private String busiLine; |
| 23 | 25 | |
| 24 | - @Schema(description = "归属(一级部门id)", example = "18172") | |
| 26 | + @Schema(description = "计划属性:1:标准计划;2:临时计划", example = "1") | |
| 27 | + private Integer planAttr; | |
| 28 | + | |
| 29 | + @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", example = "2001") | |
| 30 | + private Integer planTypeId; | |
| 31 | + | |
| 32 | + @Schema(description = "归属(一级部门id)", example = "20621") | |
| 25 | 33 | private Long companyId; |
| 26 | 34 | |
| 27 | - @Schema(description = "部门ID(道路负责部门id)", example = "9510") | |
| 35 | + @Schema(description = "部门ID(道路负责部门id)", example = "2714") | |
| 28 | 36 | private Long deptId; |
| 29 | 37 | |
| 30 | - @Schema(description = "道路ID", example = "21939") | |
| 31 | - private Long roadId; | |
| 38 | + @Schema(description = "道路ID", example = "12917") | |
| 39 | + private String roadName; | |
| 32 | 40 | |
| 33 | - @Schema(description = "图片地址host") | |
| 34 | - private String imgHost; | |
| 41 | + @Schema(description = "养护级别: 10:特级;11:一级:12:二级;13:三级", example = "10") | |
| 42 | + private Integer levelId; | |
| 35 | 43 | |
| 36 | - @Schema(description = "巡检照片") | |
| 37 | - private String img; | |
| 44 | + @Schema(description = "提交人", example = "芋艿") | |
| 45 | + private String userName; | |
| 38 | 46 | |
| 39 | 47 | @Schema(description = "巡检结果: 1:正常;2:异常") |
| 40 | 48 | private Integer inspectionState; |
| ... | ... | @@ -42,30 +50,10 @@ public class InspectionPlanCommitPageReqVO extends PageParam { |
| 42 | 50 | @Schema(description = "转交状态: 1:未转交;2:已转交") |
| 43 | 51 | private Integer transState; |
| 44 | 52 | |
| 45 | - @Schema(description = "转交问题单编码") | |
| 46 | - private String transWorkNo; | |
| 47 | - | |
| 48 | 53 | @Schema(description = "完成时间") |
| 49 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 50 | - private LocalDateTime[] finishTime; | |
| 51 | - | |
| 52 | - @Schema(description = "提交人用户ID", example = "30987") | |
| 53 | - private Long userId; | |
| 54 | - | |
| 55 | - @Schema(description = "提交人", example = "赵六") | |
| 56 | - private String userName; | |
| 54 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | |
| 55 | + private LocalDate finishTime; | |
| 57 | 56 | |
| 58 | 57 | @Schema(description = "备注", example = "你猜") |
| 59 | 58 | private String remark; |
| 60 | - | |
| 61 | - @Schema(description = "创建者", example = "张三") | |
| 62 | - private String creatorName; | |
| 63 | - | |
| 64 | - @Schema(description = "创建时间") | |
| 65 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 66 | - private LocalDateTime[] createTime; | |
| 67 | - | |
| 68 | - @Schema(description = "更新者", example = "赵六") | |
| 69 | - private String updaterName; | |
| 70 | - | |
| 71 | 59 | } |
| 72 | 60 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitRespVO.java
| ... | ... | @@ -2,6 +2,7 @@ package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.*; |
| 5 | +import java.util.*; | |
| 5 | 6 | import java.time.LocalDateTime; |
| 6 | 7 | import cn.idev.excel.annotation.*; |
| 7 | 8 | |
| ... | ... | @@ -10,51 +11,67 @@ import cn.idev.excel.annotation.*; |
| 10 | 11 | @ExcelIgnoreUnannotated |
| 11 | 12 | public class InspectionPlanCommitRespVO { |
| 12 | 13 | |
| 13 | - @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25349") | |
| 14 | - @ExcelProperty("ID") | |
| 15 | - private Long id; | |
| 16 | - | |
| 17 | - @Schema(description = "批次号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 18 | - @ExcelProperty("批次号") | |
| 19 | - private String batchNo; | |
| 20 | - | |
| 21 | - @Schema(description = "计划编码", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 14 | + @Schema(description = "计划编码") | |
| 22 | 15 | @ExcelProperty("计划编码") |
| 23 | 16 | private String planNo; |
| 24 | 17 | |
| 25 | - @Schema(description = "业务线: yl-园林;wy-物业:sz-市政", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 18 | + @Schema(description = "计划名称") | |
| 19 | + @ExcelProperty("计划名称") | |
| 20 | + private String planName; | |
| 21 | + | |
| 22 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政") | |
| 26 | 23 | @ExcelProperty("业务线: yl-园林;wy-物业:sz-市政") |
| 27 | 24 | private String busiLine; |
| 28 | 25 | |
| 29 | - @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "18172") | |
| 26 | + @Schema(description = "道路ID", example = "12917") | |
| 27 | + @ExcelProperty("道路ID") | |
| 28 | + private Long roadId; | |
| 29 | + | |
| 30 | + @Schema(description = "道路名称", example = "") | |
| 31 | + @ExcelProperty("道路名称") | |
| 32 | + private String roadName; | |
| 33 | + | |
| 34 | + @Schema(description = "养护级别: 10:特级;11:一级:12:二级;13:三级", example = "10") | |
| 35 | + @ExcelProperty("养护级别") | |
| 36 | + private Integer levelId; | |
| 37 | + | |
| 38 | + @Schema(description = "计划属性:1:标准计划;2:临时计划", example = "1") | |
| 39 | + private Integer planAttr; | |
| 40 | + | |
| 41 | + @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", example = "24742") | |
| 42 | + @ExcelProperty("养护类型") | |
| 43 | + private Integer planTypeId; | |
| 44 | + | |
| 45 | + | |
| 46 | + @Schema(description = "归属(一级部门id)", example = "20621") | |
| 30 | 47 | @ExcelProperty("归属(一级部门id)") |
| 31 | 48 | private Long companyId; |
| 32 | 49 | |
| 33 | - @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "9510") | |
| 50 | + @Schema(description = "部门ID(道路负责部门id)", example = "2714") | |
| 34 | 51 | @ExcelProperty("部门ID(道路负责部门id)") |
| 35 | 52 | private Long deptId; |
| 36 | 53 | |
| 37 | - @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21939") | |
| 38 | - @ExcelProperty("道路ID") | |
| 39 | - private Long roadId; | |
| 40 | - | |
| 41 | - @Schema(description = "图片地址host", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 54 | + @Schema(description = "图片地址host") | |
| 42 | 55 | @ExcelProperty("图片地址host") |
| 43 | 56 | private String imgHost; |
| 44 | 57 | |
| 45 | - @Schema(description = "巡检照片", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 58 | + @Schema(description = "巡检照片") | |
| 46 | 59 | @ExcelProperty("巡检照片") |
| 47 | 60 | private String img; |
| 48 | 61 | |
| 49 | - @Schema(description = "巡检结果: 1:正常;2:异常", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 62 | + @Schema(description = "巡检照片") | |
| 63 | + @ExcelProperty("巡检照片") | |
| 64 | + private List<String> imgList; | |
| 65 | + | |
| 66 | + @Schema(description = "巡检结果: 1:正常;2:异常") | |
| 50 | 67 | @ExcelProperty("巡检结果: 1:正常;2:异常") |
| 51 | 68 | private Integer inspectionState; |
| 52 | 69 | |
| 53 | - @Schema(description = "转交状态: 1:未转交;2:已转交", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 70 | + @Schema(description = "转交状态: 1:未转交;2:已转交") | |
| 54 | 71 | @ExcelProperty("转交状态: 1:未转交;2:已转交") |
| 55 | 72 | private Integer transState; |
| 56 | 73 | |
| 57 | - @Schema(description = "转交问题单编码", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 74 | + @Schema(description = "转交问题单编码") | |
| 58 | 75 | @ExcelProperty("转交问题单编码") |
| 59 | 76 | private String transWorkNo; |
| 60 | 77 | |
| ... | ... | @@ -62,27 +79,35 @@ public class InspectionPlanCommitRespVO { |
| 62 | 79 | @ExcelProperty("完成时间") |
| 63 | 80 | private LocalDateTime finishTime; |
| 64 | 81 | |
| 65 | - @Schema(description = "提交人用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30987") | |
| 82 | + @Schema(description = "提交人用户ID", example = "32294") | |
| 66 | 83 | @ExcelProperty("提交人用户ID") |
| 67 | 84 | private Long userId; |
| 68 | 85 | |
| 69 | - @Schema(description = "提交人", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 86 | + @Schema(description = "提交人", example = "芋艿") | |
| 70 | 87 | @ExcelProperty("提交人") |
| 71 | 88 | private String userName; |
| 72 | 89 | |
| 73 | - @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | |
| 90 | + @Schema(description = "角色ID", example = "23375") | |
| 91 | + @ExcelProperty("角色ID") | |
| 92 | + private Long roleId; | |
| 93 | + | |
| 94 | + @Schema(description = "角色名称", example = "王五") | |
| 95 | + @ExcelProperty("角色名称") | |
| 96 | + private String roleName; | |
| 97 | + | |
| 98 | + @Schema(description = "备注", example = "你猜") | |
| 74 | 99 | @ExcelProperty("备注") |
| 75 | 100 | private String remark; |
| 76 | 101 | |
| 77 | - @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 102 | + @Schema(description = "创建者", example = "芋艿") | |
| 78 | 103 | @ExcelProperty("创建者") |
| 79 | 104 | private String creatorName; |
| 80 | 105 | |
| 81 | - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 106 | + @Schema(description = "创建时间") | |
| 82 | 107 | @ExcelProperty("创建时间") |
| 83 | 108 | private LocalDateTime createTime; |
| 84 | 109 | |
| 85 | - @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 110 | + @Schema(description = "更新者", example = "芋艿") | |
| 86 | 111 | @ExcelProperty("更新者") |
| 87 | 112 | private String updaterName; |
| 88 | 113 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitSaveReqVO.java
| ... | ... | @@ -2,14 +2,15 @@ package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.*; |
| 5 | + | |
| 6 | +import java.time.LocalDate; | |
| 5 | 7 | import jakarta.validation.constraints.*; |
| 6 | -import java.time.LocalDateTime; | |
| 7 | 8 | |
| 8 | 9 | @Schema(description = "管理后台 - 巡检计划提交明细新增/修改 Request VO") |
| 9 | 10 | @Data |
| 10 | 11 | public class InspectionPlanCommitSaveReqVO { |
| 11 | 12 | |
| 12 | - @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25349") | |
| 13 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6813") | |
| 13 | 14 | private Long id; |
| 14 | 15 | |
| 15 | 16 | @Schema(description = "批次号", requiredMode = Schema.RequiredMode.REQUIRED) |
| ... | ... | @@ -24,15 +25,15 @@ public class InspectionPlanCommitSaveReqVO { |
| 24 | 25 | @NotEmpty(message = "业务线: yl-园林;wy-物业:sz-市政不能为空") |
| 25 | 26 | private String busiLine; |
| 26 | 27 | |
| 27 | - @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "18172") | |
| 28 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "20621") | |
| 28 | 29 | @NotNull(message = "归属(一级部门id)不能为空") |
| 29 | 30 | private Long companyId; |
| 30 | 31 | |
| 31 | - @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "9510") | |
| 32 | + @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2714") | |
| 32 | 33 | @NotNull(message = "部门ID(道路负责部门id)不能为空") |
| 33 | 34 | private Long deptId; |
| 34 | 35 | |
| 35 | - @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21939") | |
| 36 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12917") | |
| 36 | 37 | @NotNull(message = "道路ID不能为空") |
| 37 | 38 | private Long roadId; |
| 38 | 39 | |
| ... | ... | @@ -57,25 +58,33 @@ public class InspectionPlanCommitSaveReqVO { |
| 57 | 58 | private String transWorkNo; |
| 58 | 59 | |
| 59 | 60 | @Schema(description = "完成时间") |
| 60 | - private LocalDateTime finishTime; | |
| 61 | + private LocalDate finishTime; | |
| 61 | 62 | |
| 62 | - @Schema(description = "提交人用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30987") | |
| 63 | + @Schema(description = "提交人用户ID", example = "32294") | |
| 63 | 64 | @NotNull(message = "提交人用户ID不能为空") |
| 64 | 65 | private Long userId; |
| 65 | 66 | |
| 66 | - @Schema(description = "提交人", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 67 | + @Schema(description = "提交人", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 67 | 68 | @NotEmpty(message = "提交人不能为空") |
| 68 | 69 | private String userName; |
| 69 | 70 | |
| 71 | + @Schema(description = "角色ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23375") | |
| 72 | + @NotNull(message = "角色ID不能为空") | |
| 73 | + private Long roleId; | |
| 74 | + | |
| 75 | + @Schema(description = "角色名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | |
| 76 | + @NotEmpty(message = "角色名称不能为空") | |
| 77 | + private String roleName; | |
| 78 | + | |
| 70 | 79 | @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") |
| 71 | 80 | @NotEmpty(message = "备注不能为空") |
| 72 | 81 | private String remark; |
| 73 | 82 | |
| 74 | - @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 83 | + @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 75 | 84 | @NotEmpty(message = "创建者不能为空") |
| 76 | 85 | private String creatorName; |
| 77 | 86 | |
| 78 | - @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 87 | + @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 79 | 88 | @NotEmpty(message = "更新者不能为空") |
| 80 | 89 | private String updaterName; |
| 81 | 90 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanSaveReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; |
| 2 | 2 | |
| 3 | +import com.zteits.urbanops.module.garden.util.StringValidateUtil; | |
| 3 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 5 | import jakarta.validation.Valid; |
| 5 | 6 | import lombok.*; |
| ... | ... | @@ -66,4 +67,7 @@ public class InspectionPlanSaveReqVO { |
| 66 | 67 | @Size(min = 1) |
| 67 | 68 | private Set<Long> roleIds; |
| 68 | 69 | |
| 70 | + public boolean verify(){ | |
| 71 | + return StringValidateUtil.validate(rateValue); | |
| 72 | + } | |
| 69 | 73 | } |
| 70 | 74 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanUpdateReqVO.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/MaintainPlanController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.maintainplan; |
| 2 | 2 | |
| 3 | 3 | import jakarta.validation.constraints.NotBlank; |
| 4 | +import lombok.extern.slf4j.Slf4j; | |
| 4 | 5 | import org.springframework.web.bind.annotation.*; |
| 5 | 6 | import jakarta.annotation.Resource; |
| 6 | 7 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -18,12 +19,15 @@ import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 18 | 19 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 19 | 20 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 20 | 21 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 22 | + | |
| 23 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.error; | |
| 21 | 24 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; |
| 22 | 25 | |
| 23 | 26 | import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; |
| 24 | 27 | |
| 25 | 28 | import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; |
| 26 | 29 | import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; |
| 30 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.PLAN_RATE_VALUE_ERROR; | |
| 27 | 31 | |
| 28 | 32 | import com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo.*; |
| 29 | 33 | import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanDO; |
| ... | ... | @@ -33,6 +37,7 @@ import com.zteits.urbanops.module.garden.service.maintainplan.MaintainPlanServic |
| 33 | 37 | @RestController |
| 34 | 38 | @RequestMapping("/garden/maintain-plan") |
| 35 | 39 | @Validated |
| 40 | +@Slf4j | |
| 36 | 41 | public class MaintainPlanController { |
| 37 | 42 | |
| 38 | 43 | @Resource |
| ... | ... | @@ -41,9 +46,10 @@ public class MaintainPlanController { |
| 41 | 46 | @PostMapping("/create") |
| 42 | 47 | @Operation(summary = "创建养护计划汇总") |
| 43 | 48 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan:create')") |
| 44 | - public CommonResult<Long> createMaintainPlan(@Valid @RequestBody MaintainPlanSaveReqVO createReqVO) { | |
| 49 | + public CommonResult<Integer> createMaintainPlan(@Valid @RequestBody MaintainPlanSaveReqVO createReqVO) { | |
| 45 | 50 | if(!createReqVO.verify()){ |
| 46 | - | |
| 51 | + log.warn("次数值范围:1-20或者分数格式:1/3, rateValue={}", createReqVO.getRateValue()); | |
| 52 | + return error(PLAN_RATE_VALUE_ERROR); | |
| 47 | 53 | } |
| 48 | 54 | return maintainPlanService.createMaintainPlan(createReqVO); |
| 49 | 55 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/inspectionplan/InspectionPlanCommitDO.java
| ... | ... | @@ -82,6 +82,14 @@ public class InspectionPlanCommitDO extends BaseDO { |
| 82 | 82 | */ |
| 83 | 83 | private String userName; |
| 84 | 84 | /** |
| 85 | + * 角色ID | |
| 86 | + */ | |
| 87 | + private Long roleId; | |
| 88 | + /** | |
| 89 | + * 角色名称 | |
| 90 | + */ | |
| 91 | + private String roleName; | |
| 92 | + /** | |
| 85 | 93 | * 备注 |
| 86 | 94 | */ |
| 87 | 95 | private String remark; | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/inspectionplan/InspectionPlanCommitMapper.java
| 1 | 1 | package com.zteits.urbanops.module.garden.dal.mysql.inspectionplan; |
| 2 | 2 | |
| 3 | +import java.util.*; | |
| 3 | 4 | |
| 4 | -import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 5 | -import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 5 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
| 6 | 6 | import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; |
| 7 | 7 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanCommitDO; |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; |
| 10 | +import org.apache.ibatis.annotations.Param; | |
| 10 | 11 | |
| 11 | 12 | /** |
| 12 | 13 | * 巡检计划提交明细 Mapper |
| ... | ... | @@ -16,27 +17,12 @@ import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; |
| 16 | 17 | @Mapper |
| 17 | 18 | public interface InspectionPlanCommitMapper extends BaseMapperX<InspectionPlanCommitDO> { |
| 18 | 19 | |
| 19 | - default PageResult<InspectionPlanCommitDO> selectPage(InspectionPlanCommitPageReqVO reqVO) { | |
| 20 | - return selectPage(reqVO, new LambdaQueryWrapperX<InspectionPlanCommitDO>() | |
| 21 | - .eqIfPresent(InspectionPlanCommitDO::getBatchNo, reqVO.getBatchNo()) | |
| 22 | - .eqIfPresent(InspectionPlanCommitDO::getPlanNo, reqVO.getPlanNo()) | |
| 23 | - .eqIfPresent(InspectionPlanCommitDO::getBusiLine, reqVO.getBusiLine()) | |
| 24 | - .eqIfPresent(InspectionPlanCommitDO::getCompanyId, reqVO.getCompanyId()) | |
| 25 | - .eqIfPresent(InspectionPlanCommitDO::getDeptId, reqVO.getDeptId()) | |
| 26 | - .eqIfPresent(InspectionPlanCommitDO::getRoadId, reqVO.getRoadId()) | |
| 27 | - .eqIfPresent(InspectionPlanCommitDO::getImgHost, reqVO.getImgHost()) | |
| 28 | - .eqIfPresent(InspectionPlanCommitDO::getImg, reqVO.getImg()) | |
| 29 | - .eqIfPresent(InspectionPlanCommitDO::getInspectionState, reqVO.getInspectionState()) | |
| 30 | - .eqIfPresent(InspectionPlanCommitDO::getTransState, reqVO.getTransState()) | |
| 31 | - .eqIfPresent(InspectionPlanCommitDO::getTransWorkNo, reqVO.getTransWorkNo()) | |
| 32 | - .betweenIfPresent(InspectionPlanCommitDO::getFinishTime, reqVO.getFinishTime()) | |
| 33 | - .eqIfPresent(InspectionPlanCommitDO::getUserId, reqVO.getUserId()) | |
| 34 | - .likeIfPresent(InspectionPlanCommitDO::getUserName, reqVO.getUserName()) | |
| 35 | - .eqIfPresent(InspectionPlanCommitDO::getRemark, reqVO.getRemark()) | |
| 36 | - .likeIfPresent(InspectionPlanCommitDO::getCreatorName, reqVO.getCreatorName()) | |
| 37 | - .betweenIfPresent(InspectionPlanCommitDO::getCreateTime, reqVO.getCreateTime()) | |
| 38 | - .likeIfPresent(InspectionPlanCommitDO::getUpdaterName, reqVO.getUpdaterName()) | |
| 39 | - .orderByDesc(InspectionPlanCommitDO::getId)); | |
| 40 | - } | |
| 20 | + /* 自定义 SQL 分页查询(复杂联表场景,XML 方式) | |
| 21 | + * @param page 分页上下文 | |
| 22 | + * @param reqDTO 查询条件 | |
| 23 | + * @return 分页结果 | |
| 24 | + */ | |
| 25 | + IPage<InspectionPlanCommitRespVO> selectForPage(IPage<InspectionPlanCommitRespVO> page, @Param("req") InspectionPlanCommitPageReqVO reqDTO, @Param("busiLineList") List<String> busiLineList); | |
| 26 | + | |
| 41 | 27 | |
| 42 | 28 | } |
| 43 | 29 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ErrorCodeConstants.java
| ... | ... | @@ -82,20 +82,21 @@ public interface ErrorCodeConstants { |
| 82 | 82 | ErrorCode WATER_FEE_NOT_EXISTS = new ErrorCode(1-100-003-013, "水费录入信息不存在"); |
| 83 | 83 | |
| 84 | 84 | // ========== 巡检计划汇总 TODO 补充编号 ========== |
| 85 | - ErrorCode INSPECTION_PLAN_NOT_EXISTS = new ErrorCode(1-100-100-001, "巡检计划汇总不存在"); | |
| 86 | - ErrorCode INSPECTION_CYCLE_ID_ERROR = new ErrorCode(1-100-100-002, "周期id错误"); | |
| 85 | + ErrorCode INSPECTION_PLAN_NOT_EXISTS = new ErrorCode(1-100-007-001, "巡检计划汇总不存在"); | |
| 86 | + ErrorCode INSPECTION_CYCLE_ID_ERROR = new ErrorCode(1-100-007-002, "周期id错误"); | |
| 87 | 87 | ErrorCode INSPECTION_CYCLE_ERROR = new ErrorCode(1-200-100-003, "获取两个时间之间间隔天数错误"); |
| 88 | - ErrorCode INSPECTION_PLAN_EXISTS = new ErrorCode(1-200-100-004, "道路对应类型已存在记录"); | |
| 89 | - ErrorCode INSPECTION_PLAN_NOT_ALLOW_DELETE = new ErrorCode(1-200-100-005, "计划已开始执行不能删除"); | |
| 88 | + ErrorCode INSPECTION_PLAN_EXISTS = new ErrorCode(1-200-100-007, "道路对应类型已存在记录"); | |
| 89 | + ErrorCode INSPECTION_PLAN_NOT_ALLOW_DELETE = new ErrorCode(1-100-007-005, "计划已开始执行不能删除"); | |
| 90 | 90 | |
| 91 | 91 | // ========== 养护计划汇总 TODO 补充编号 ========== |
| 92 | - ErrorCode MAINTAIN_PLAN_NOT_EXISTS = new ErrorCode(1-200-200-001, "养护计划汇总不存在"); | |
| 92 | + ErrorCode MAINTAIN_PLAN_NOT_EXISTS = new ErrorCode(1-100-007-001, "养护计划汇总不存在"); | |
| 93 | 93 | |
| 94 | 94 | //========== 频次 TODO 补充编号 ========== |
| 95 | - ErrorCode PLAN_RATE_EXISTS = new ErrorCode(1-200-200-001, "养护频次已存在"); | |
| 96 | - ErrorCode PLAN_RATE_LEVEL_ID_DUPLICATE = new ErrorCode(1-200-200-002, "养护等级重复"); | |
| 97 | - ErrorCode PLAN_RATE_NOT_EXISTS = new ErrorCode(1-200-200-002, "未配置计划频次"); | |
| 98 | - ErrorCode PLAN_RATE_DETAIL_EXISTS = new ErrorCode(1-200-200-003, "计划频次已存在"); | |
| 95 | + ErrorCode PLAN_RATE_EXISTS = new ErrorCode(1-100-007-001, "养护频次已存在"); | |
| 96 | + ErrorCode PLAN_RATE_LEVEL_ID_DUPLICATE = new ErrorCode(1-100-007-002, "养护等级重复"); | |
| 97 | + ErrorCode PLAN_RATE_NOT_EXISTS = new ErrorCode(1-100-007-002, "未配置计划频次"); | |
| 98 | + ErrorCode PLAN_RATE_DETAIL_EXISTS = new ErrorCode(1-100-007-003, "计划频次已存在"); | |
| 99 | + ErrorCode PLAN_RATE_VALUE_ERROR = new ErrorCode(1-100-007-004, "次数值范围:1-20或者分数格式:1/3"); | |
| 99 | 100 | |
| 100 | 101 | ErrorCode MATERIAL_TYPE_NOT_EXISTS = new ErrorCode(1-100-004-001, "物料类型不存在"); |
| 101 | 102 | ErrorCode MATERIAL_TYPE_MANAGER_NOT_EXISTS = new ErrorCode(1-100-004-002, "耗材类别管理不存在"); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/PlanConstants.java
| ... | ... | @@ -11,4 +11,11 @@ public class PlanConstants { |
| 11 | 11 | /*养护级别-字典key*/ |
| 12 | 12 | public static final String CONSERVE_LEVEL = "conserve_level"; |
| 13 | 13 | |
| 14 | + /*巡查类型-绿地巡视/绿地保洁-字典key*/ | |
| 15 | + public static final String INSPECTION_MAINTAIN_TYPE = "inspection_maintain_type"; | |
| 16 | + | |
| 17 | + /*养护类型-浇水-字典key*/ | |
| 18 | + public static final String MAINTAIN_TYPE = "maintain_type"; | |
| 19 | + | |
| 20 | + | |
| 14 | 21 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanCommitService.java
| ... | ... | @@ -56,6 +56,6 @@ public interface InspectionPlanCommitService { |
| 56 | 56 | * @param pageReqVO 分页查询 |
| 57 | 57 | * @return 巡检计划提交明细分页 |
| 58 | 58 | */ |
| 59 | - PageResult<InspectionPlanCommitDO> getInspectionPlanCommitPage(InspectionPlanCommitPageReqVO pageReqVO); | |
| 59 | + PageResult<InspectionPlanCommitRespVO> getInspectionPlanCommitPage(InspectionPlanCommitPageReqVO 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/inspectionplan/InspectionPlanCommitServiceImpl.java
| 1 | 1 | package com.zteits.urbanops.module.garden.service.inspectionplan; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
| 4 | +import com.zteits.urbanops.framework.common.util.string.StrUtils; | |
| 5 | +import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils; | |
| 6 | +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | |
| 7 | +import org.apache.commons.lang3.StringUtils; | |
| 3 | 8 | import org.springframework.stereotype.Service; |
| 4 | 9 | import jakarta.annotation.Resource; |
| 5 | 10 | import org.springframework.validation.annotation.Validated; |
| 6 | 11 | |
| 7 | 12 | import java.util.*; |
| 13 | + | |
| 8 | 14 | import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; |
| 9 | 15 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanCommitDO; |
| 10 | 16 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| ... | ... | @@ -53,15 +59,15 @@ public class InspectionPlanCommitServiceImpl implements InspectionPlanCommitServ |
| 53 | 59 | } |
| 54 | 60 | |
| 55 | 61 | @Override |
| 56 | - public void deleteInspectionPlanCommitListByIds(List<Long> ids) { | |
| 62 | + public void deleteInspectionPlanCommitListByIds(List<Long> ids) { | |
| 57 | 63 | // 删除 |
| 58 | 64 | inspectionPlanCommitMapper.deleteByIds(ids); |
| 59 | - } | |
| 65 | + } | |
| 60 | 66 | |
| 61 | 67 | |
| 62 | 68 | private void validateInspectionPlanCommitExists(Long id) { |
| 63 | 69 | if (inspectionPlanCommitMapper.selectById(id) == null) { |
| 64 | - //throw exception(INSPECTION_PLAN_COMMIT_NOT_EXISTS); | |
| 70 | + // throw exception(INSPECTION_PLAN_COMMIT_NOT_EXISTS); | |
| 65 | 71 | } |
| 66 | 72 | } |
| 67 | 73 | |
| ... | ... | @@ -71,8 +77,28 @@ public class InspectionPlanCommitServiceImpl implements InspectionPlanCommitServ |
| 71 | 77 | } |
| 72 | 78 | |
| 73 | 79 | @Override |
| 74 | - public PageResult<InspectionPlanCommitDO> getInspectionPlanCommitPage(InspectionPlanCommitPageReqVO pageReqVO) { | |
| 75 | - return inspectionPlanCommitMapper.selectPage(pageReqVO); | |
| 80 | + public PageResult<InspectionPlanCommitRespVO> getInspectionPlanCommitPage(InspectionPlanCommitPageReqVO pageReqVO) { | |
| 81 | + String busiLine = SecurityFrameworkUtils.getBusiLine(); | |
| 82 | + List<String> busiLineList = new ArrayList<>(); | |
| 83 | + if (StringUtils.isNotEmpty(pageReqVO.getBusiLine())) { | |
| 84 | + busiLineList.add(pageReqVO.getBusiLine()); | |
| 85 | + } else { | |
| 86 | + if (StringUtils.isNotEmpty(busiLine)) { | |
| 87 | + busiLineList.addAll(Arrays.asList(busiLine.split(","))); | |
| 88 | + } | |
| 89 | + } | |
| 90 | + //分页 | |
| 91 | + IPage<InspectionPlanCommitRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO); | |
| 92 | + IPage<InspectionPlanCommitRespVO> page = inspectionPlanCommitMapper.selectForPage(mpPage, pageReqVO, busiLineList); | |
| 93 | + // 转换返回 | |
| 94 | + return new PageResult<>(imgProcess(page.getRecords()), page.getTotal()); | |
| 95 | + } | |
| 96 | + | |
| 97 | + private List<InspectionPlanCommitRespVO> imgProcess(List<InspectionPlanCommitRespVO> list) { | |
| 98 | + list.forEach(e -> { | |
| 99 | + e.setImgList(StrUtils.imgProcess(e.getImg(), e.getImgHost())); | |
| 100 | + }); | |
| 101 | + return list; | |
| 76 | 102 | } |
| 77 | 103 | |
| 78 | 104 | } |
| 79 | 105 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanService.java
| ... | ... | @@ -21,7 +21,7 @@ public interface InspectionPlanService { |
| 21 | 21 | * @param createReqVO 创建信息 |
| 22 | 22 | * @return 编号 |
| 23 | 23 | */ |
| 24 | - CommonResult<Long> createInspectionPlan(@Valid InspectionPlanSaveReqVO createReqVO); | |
| 24 | + CommonResult<Integer> createInspectionPlan(@Valid InspectionPlanSaveReqVO createReqVO); | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * 更新巡检计划汇总 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
| 1 | 1 | package com.zteits.urbanops.module.garden.service.inspectionplan; |
| 2 | 2 | |
| 3 | -import cn.hutool.core.date.DateUtil; | |
| 3 | +import cn.hutool.core.thread.ThreadUtil; | |
| 4 | 4 | import cn.hutool.core.util.RandomUtil; |
| 5 | 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 6 | 6 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| ... | ... | @@ -25,7 +25,6 @@ import java.time.LocalDate; |
| 25 | 25 | import java.time.LocalDateTime; |
| 26 | 26 | import java.time.format.DateTimeFormatter; |
| 27 | 27 | import java.util.*; |
| 28 | -import java.util.concurrent.atomic.AtomicInteger; | |
| 29 | 28 | import java.util.stream.Collectors; |
| 30 | 29 | |
| 31 | 30 | import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; |
| ... | ... | @@ -62,11 +61,11 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 62 | 61 | |
| 63 | 62 | @Transactional(rollbackFor = Exception.class) |
| 64 | 63 | @Override |
| 65 | - public CommonResult<Long> createInspectionPlan(InspectionPlanSaveReqVO createReqVO) { | |
| 64 | + public CommonResult<Integer> createInspectionPlan(InspectionPlanSaveReqVO createReqVO) { | |
| 66 | 65 | //存在性校验 |
| 67 | 66 | validateInspectionPlanExists(createReqVO); |
| 68 | 67 | LocalDateTime now = LocalDateTime.now(); |
| 69 | - String userId = SecurityFrameworkUtils.getLoginUserId()+""; | |
| 68 | + String userId = SecurityFrameworkUtils.getLoginUserId() + ""; | |
| 70 | 69 | String userName = SecurityFrameworkUtils.getLoginUserNickname(); |
| 71 | 70 | int rateValue; |
| 72 | 71 | if (createReqVO.getRateValue().contains("/")) { |
| ... | ... | @@ -82,12 +81,18 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 82 | 81 | } |
| 83 | 82 | //计算计划次数 |
| 84 | 83 | Integer planNum = betweenDayList.size(); |
| 85 | - InspectionPlanDO inspectionPlan = BeanUtils.toBean(createReqVO, InspectionPlanDO.class); | |
| 86 | - AtomicInteger count = new AtomicInteger(); | |
| 87 | 84 | |
| 85 | + | |
| 86 | + //巡检计划list | |
| 87 | + List<InspectionPlanDO> inspectionPlanList = new ArrayList<>(); | |
| 88 | + //角色列表 | |
| 89 | + List<InspectionPlanRoleDO> roleList = new ArrayList<>(); | |
| 90 | + //计划明细 | |
| 91 | + List<InspectionPlanDetailDO> detailDOList = new ArrayList<>(); | |
| 88 | 92 | //按照道路创建计划 |
| 89 | 93 | createReqVO.getRoadListReqVO().forEach(roadReqVO -> { |
| 90 | - String batchNo = "BN" + DateUtil.format(new Date(), "yyyyMMddHHmmssSSS") + RandomUtil.randomInt(1000); | |
| 94 | + InspectionPlanDO inspectionPlan = BeanUtils.toBean(createReqVO, InspectionPlanDO.class); | |
| 95 | + String batchNo = "BN" + System.currentTimeMillis() + RandomUtil.randomInt(10000) + roadReqVO.getRoadId(); | |
| 91 | 96 | inspectionPlan.setBatchNo(batchNo); |
| 92 | 97 | inspectionPlan.setPlanFinishNum(0); |
| 93 | 98 | inspectionPlan.setFinishState(FinishStateEnum.NOT_FINISHED.getStatus()); |
| ... | ... | @@ -103,9 +108,9 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 103 | 108 | inspectionPlan.setRoadName(roadReqVO.getRoadName()); |
| 104 | 109 | //计划属性label |
| 105 | 110 | String planAttrLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.GARDEN_PLAN_ATTR_REDIS_KEY, createReqVO.getPlanAttr()); |
| 106 | - inspectionPlan.setPlanName(roadReqVO.getRoadName() + planAttrLabel + createReqVO.getPlanNameSuffix()); | |
| 107 | - /*1.插入巡查计划*/ | |
| 108 | - count.addAndGet(inspectionPlanMapper.insert(inspectionPlan)); | |
| 111 | + String planTypeIdLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.INSPECTION_MAINTAIN_TYPE, createReqVO.getPlanTypeId()); | |
| 112 | + inspectionPlan.setPlanName(roadReqVO.getRoadName() + planAttrLabel + planTypeIdLabel + createReqVO.getPlanNameSuffix()); | |
| 113 | + inspectionPlanList.add(inspectionPlan); | |
| 109 | 114 | /*2.插入角色*/ |
| 110 | 115 | createReqVO.getRoleIds().forEach(roleId -> { |
| 111 | 116 | InspectionPlanRoleDO inspectionPlanRoleDO = new InspectionPlanRoleDO(); |
| ... | ... | @@ -117,31 +122,36 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 117 | 122 | inspectionPlanRoleDO.setCreator(userName); |
| 118 | 123 | inspectionPlanRoleDO.setUpdater(userName); |
| 119 | 124 | inspectionPlanRoleDO.setRoleId(roleId); |
| 120 | - inspectionPlanRoleMapper.insert(inspectionPlanRoleDO); | |
| 125 | + roleList.add(inspectionPlanRoleDO); | |
| 121 | 126 | }); |
| 122 | 127 | /*3.插入巡查计划明细*/ |
| 128 | + | |
| 123 | 129 | for (int i = 0; i < betweenDayList.size(); i++) { |
| 124 | 130 | String[] dateStr = betweenDayList.get(i).split("/"); |
| 125 | 131 | InspectionPlanDetailDO entity = getInspectionPlanDetailDO(batchNo, createReqVO, roadReqVO, now); |
| 126 | - entity.setSortNum(i+1); | |
| 132 | + ThreadUtil.sleep(2); | |
| 133 | + entity.setSortNum(i + 1); | |
| 127 | 134 | entity.setBeginTime(LocalDate.parse(dateStr[0], DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| 128 | 135 | entity.setEndTime(LocalDate.parse(dateStr[1], DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| 129 | - | |
| 130 | - inspectionPlanDetailMapper.insert(entity); | |
| 136 | + detailDOList.add(entity); | |
| 131 | 137 | } |
| 132 | 138 | }); |
| 133 | 139 | |
| 140 | + /*1.插入巡查计划*/ | |
| 141 | + inspectionPlanMapper.insertBatch(inspectionPlanList); | |
| 142 | + inspectionPlanRoleMapper.insertBatch(roleList); | |
| 143 | + inspectionPlanDetailMapper.insertBatch(detailDOList); | |
| 134 | 144 | // 返回 |
| 135 | - return CommonResult.success(count.longValue()); | |
| 145 | + return CommonResult.success(createReqVO.getRoadListReqVO().size()); | |
| 136 | 146 | } |
| 137 | 147 | |
| 138 | 148 | private InspectionPlanDetailDO getInspectionPlanDetailDO(String batchNo, InspectionPlanSaveReqVO saveReqVO, |
| 139 | - InspectionPlanRoadReqVO roadReqVO, LocalDateTime now) { | |
| 140 | - String userId = SecurityFrameworkUtils.getLoginUserId()+""; | |
| 149 | + InspectionPlanRoadReqVO roadReqVO, LocalDateTime now) { | |
| 150 | + String userId = SecurityFrameworkUtils.getLoginUserId() + ""; | |
| 141 | 151 | String userName = SecurityFrameworkUtils.getLoginUserNickname(); |
| 142 | 152 | InspectionPlanDetailDO entity = new InspectionPlanDetailDO(); |
| 143 | 153 | entity.setBatchNo(batchNo); |
| 144 | - entity.setPlanNo("P" + DateUtil.format(new Date(), "yyyyMMddHHmmssSSS") + RandomUtil.randomInt(1000)); | |
| 154 | + entity.setPlanNo("P" + System.currentTimeMillis() + RandomUtil.randomInt(1000)); | |
| 145 | 155 | entity.setBusiLine(saveReqVO.getBusiLine()); |
| 146 | 156 | entity.setCompanyId(saveReqVO.getCompanyId()); |
| 147 | 157 | entity.setDeptId(roadReqVO.getDeptId()); |
| ... | ... | @@ -182,9 +192,9 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 182 | 192 | |
| 183 | 193 | private void validateInspectionPlanExists(InspectionPlanSaveReqVO req) { |
| 184 | 194 | Set<Long> roadIds = req.getRoadListReqVO().stream().map(InspectionPlanRoadReqVO::getRoadId).collect(Collectors.toSet()); |
| 185 | - Long count =0L; | |
| 195 | + Long count = 0L; | |
| 186 | 196 | //标准计划 |
| 187 | - if(req.getPlanAttr().equals(1)){ | |
| 197 | + if (req.getPlanAttr().equals(1)) { | |
| 188 | 198 | QueryWrapper<InspectionPlanDO> sql = new QueryWrapper<>(); |
| 189 | 199 | sql.lambda().eq(InspectionPlanDO::getPlanTypeId, req.getPlanTypeId()) |
| 190 | 200 | .in(InspectionPlanDO::getRoadId, roadIds) |
| ... | ... | @@ -192,7 +202,7 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 192 | 202 | .ge(InspectionPlanDO::getEndTime, req.getBeginTime()); // end_time >= startTime |
| 193 | 203 | |
| 194 | 204 | count = inspectionPlanMapper.selectCount(sql); |
| 195 | - }else{ | |
| 205 | + } else { | |
| 196 | 206 | QueryWrapper<InspectionPlanDO> sql = new QueryWrapper<>(); |
| 197 | 207 | sql.lambda().eq(InspectionPlanDO::getPlanTypeId, req.getPlanTypeId()) |
| 198 | 208 | .in(InspectionPlanDO::getRoadId, roadIds) |
| ... | ... | @@ -228,7 +238,7 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 228 | 238 | @Override |
| 229 | 239 | public void deleteInspectionPlanByBatchNo(String batchNo) { |
| 230 | 240 | InspectionPlanDO inspectionPlanDO = inspectionPlanMapper.selectOne(InspectionPlanDO::getBatchNo, batchNo); |
| 231 | - if(inspectionPlanDO !=null && inspectionPlanDO.getPlanFinishNum() >0){ | |
| 241 | + if (inspectionPlanDO != null && inspectionPlanDO.getPlanFinishNum() > 0) { | |
| 232 | 242 | throw exception(INSPECTION_PLAN_NOT_ALLOW_DELETE); |
| 233 | 243 | } |
| 234 | 244 | inspectionPlanMapper.deleteByBatchNo(batchNo); |
| ... | ... | @@ -239,7 +249,7 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 239 | 249 | @Override |
| 240 | 250 | public void stopPlanInspectionPlan(String batchNo) { |
| 241 | 251 | inspectionPlanMapper.delete(InspectionPlanDO::getBatchNo, batchNo); |
| 242 | - inspectionPlanDetailMapper.delete(InspectionPlanDetailDO::getBatchNo,batchNo); | |
| 252 | + inspectionPlanDetailMapper.delete(InspectionPlanDetailDO::getBatchNo, batchNo); | |
| 243 | 253 | inspectionPlanRoleMapper.delete(InspectionPlanRoleDO::getBatchNo, batchNo); |
| 244 | 254 | } |
| 245 | 255 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanService.java
| ... | ... | @@ -22,7 +22,7 @@ public interface MaintainPlanService { |
| 22 | 22 | * @param createReqVO 创建信息 |
| 23 | 23 | * @return 编号 |
| 24 | 24 | */ |
| 25 | - CommonResult<Long> createMaintainPlan(@Valid MaintainPlanSaveReqVO createReqVO); | |
| 25 | + CommonResult<Integer> createMaintainPlan(@Valid MaintainPlanSaveReqVO createReqVO); | |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * 更新养护计划汇总 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java
| ... | ... | @@ -2,12 +2,16 @@ package com.zteits.urbanops.module.garden.service.maintainplan; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.date.DateUtil; |
| 5 | +import cn.hutool.core.thread.ThreadUtil; | |
| 5 | 6 | import cn.hutool.core.util.RandomUtil; |
| 6 | 7 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 7 | 8 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 8 | 9 | import com.zteits.urbanops.framework.common.util.collection.CollectionUtils; |
| 9 | 10 | import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils; |
| 10 | 11 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 12 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; | |
| 13 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; | |
| 14 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanRoleDO; | |
| 11 | 15 | import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanDetailDO; |
| 12 | 16 | import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanRoleDO; |
| 13 | 17 | import com.zteits.urbanops.module.garden.dal.mysql.maintainplan.MaintainPlanDetailMapper; |
| ... | ... | @@ -58,7 +62,7 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 58 | 62 | private MaintainPlanRoleMapper maintainPlanRoleMapper; |
| 59 | 63 | |
| 60 | 64 | @Override |
| 61 | - public CommonResult<Long> createMaintainPlan(MaintainPlanSaveReqVO createReqVO) { | |
| 65 | + public CommonResult<Integer> createMaintainPlan(MaintainPlanSaveReqVO createReqVO) { | |
| 62 | 66 | //存在性校验 |
| 63 | 67 | validateMaintainPlanExists(createReqVO); |
| 64 | 68 | LocalDateTime now = LocalDateTime.now(); |
| ... | ... | @@ -78,30 +82,36 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 78 | 82 | } |
| 79 | 83 | //计算计划次数 |
| 80 | 84 | Integer planNum = betweenDayList.size(); |
| 81 | - MaintainPlanDO maintainPlanDO = BeanUtils.toBean(createReqVO, MaintainPlanDO.class); | |
| 82 | - AtomicInteger count = new AtomicInteger(); | |
| 83 | 85 | |
| 86 | + | |
| 87 | + //巡检计划list | |
| 88 | + List<MaintainPlanDO> maintainPlanList = new ArrayList<>(); | |
| 89 | + //角色列表 | |
| 90 | + List<MaintainPlanRoleDO> roleList = new ArrayList<>(); | |
| 91 | + //计划明细 | |
| 92 | + List<MaintainPlanDetailDO> detailDOList = new ArrayList<>(); | |
| 84 | 93 | //按照道路创建计划 |
| 85 | 94 | createReqVO.getRoadListReqVO().forEach(roadReqVO -> { |
| 86 | - String batchNo = "BN" + DateUtil.format(new Date(), "yyyyMMddHHmmssSSS") + RandomUtil.randomInt(1000); | |
| 87 | - maintainPlanDO.setBatchNo(batchNo); | |
| 88 | - maintainPlanDO.setPlanFinishNum(0); | |
| 89 | - maintainPlanDO.setFinishState(FinishStateEnum.NOT_FINISHED.getStatus()); | |
| 90 | - maintainPlanDO.setPlanNum(planNum); | |
| 91 | - maintainPlanDO.setCreateTime(now); | |
| 92 | - maintainPlanDO.setUpdateTime(now); | |
| 93 | - maintainPlanDO.setCreator(userId); | |
| 94 | - maintainPlanDO.setCreatorName(userName); | |
| 95 | - maintainPlanDO.setUpdater(userId); | |
| 96 | - maintainPlanDO.setUpdaterName(userName); | |
| 97 | - maintainPlanDO.setDeptId(roadReqVO.getDeptId()); | |
| 98 | - maintainPlanDO.setRoadId(roadReqVO.getRoadId()); | |
| 99 | - maintainPlanDO.setRoadName(roadReqVO.getRoadName()); | |
| 95 | + MaintainPlanDO maintainPlan = BeanUtils.toBean(createReqVO, MaintainPlanDO.class); | |
| 96 | + String batchNo = "BN" + System.currentTimeMillis() + RandomUtil.randomInt(10000)+roadReqVO.getRoadId(); | |
| 97 | + maintainPlan.setBatchNo(batchNo); | |
| 98 | + maintainPlan.setPlanFinishNum(0); | |
| 99 | + maintainPlan.setFinishState(FinishStateEnum.NOT_FINISHED.getStatus()); | |
| 100 | + maintainPlan.setPlanNum(planNum); | |
| 101 | + maintainPlan.setCreateTime(now); | |
| 102 | + maintainPlan.setUpdateTime(now); | |
| 103 | + maintainPlan.setCreator(userId); | |
| 104 | + maintainPlan.setCreatorName(userName); | |
| 105 | + maintainPlan.setUpdater(userId); | |
| 106 | + maintainPlan.setUpdaterName(userName); | |
| 107 | + maintainPlan.setDeptId(roadReqVO.getDeptId()); | |
| 108 | + maintainPlan.setRoadId(roadReqVO.getRoadId()); | |
| 109 | + maintainPlan.setRoadName(roadReqVO.getRoadName()); | |
| 100 | 110 | //计划属性label |
| 101 | 111 | String planAttrLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.GARDEN_PLAN_ATTR_REDIS_KEY, createReqVO.getPlanAttr()); |
| 102 | - maintainPlanDO.setPlanName(roadReqVO.getRoadName() + planAttrLabel + createReqVO.getPlanNameSuffix()); | |
| 103 | - /*1.插入巡查计划*/ | |
| 104 | - count.addAndGet(maintainPlanMapper.insert(maintainPlanDO)); | |
| 112 | + String planTypeIdLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.MAINTAIN_TYPE, createReqVO.getPlanTypeId()); | |
| 113 | + maintainPlan.setPlanName(roadReqVO.getRoadName() + planAttrLabel + planTypeIdLabel + createReqVO.getPlanNameSuffix()); | |
| 114 | + maintainPlanList.add(maintainPlan); | |
| 105 | 115 | /*2.插入角色*/ |
| 106 | 116 | createReqVO.getRoleIds().forEach(roleId -> { |
| 107 | 117 | MaintainPlanRoleDO maintainPlanRoleDO = new MaintainPlanRoleDO(); |
| ... | ... | @@ -110,25 +120,30 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 110 | 120 | maintainPlanRoleDO.setDeptId(roadReqVO.getDeptId()); |
| 111 | 121 | maintainPlanRoleDO.setCreateTime(now); |
| 112 | 122 | maintainPlanRoleDO.setUpdateTime(now); |
| 113 | - maintainPlanRoleDO.setCreator(userId); | |
| 114 | - maintainPlanRoleDO.setUpdater(userId); | |
| 123 | + maintainPlanRoleDO.setCreator(userName); | |
| 124 | + maintainPlanRoleDO.setUpdater(userName); | |
| 115 | 125 | maintainPlanRoleDO.setRoleId(roleId); |
| 116 | - maintainPlanRoleMapper.insert(maintainPlanRoleDO); | |
| 126 | + roleList.add(maintainPlanRoleDO); | |
| 117 | 127 | }); |
| 118 | 128 | /*3.插入巡查计划明细*/ |
| 129 | + | |
| 119 | 130 | for (int i = 0; i < betweenDayList.size(); i++) { |
| 120 | 131 | String[] dateStr = betweenDayList.get(i).split("/"); |
| 121 | 132 | MaintainPlanDetailDO entity = getMaintainPlanDetailDO(batchNo, createReqVO, roadReqVO, now); |
| 133 | + ThreadUtil.sleep(2); | |
| 122 | 134 | entity.setSortNum(i+1); |
| 123 | 135 | entity.setBeginTime(LocalDate.parse(dateStr[0], DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| 124 | 136 | entity.setEndTime(LocalDate.parse(dateStr[1], DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| 125 | - | |
| 126 | - maintainPlanDetailMapper.insert(entity); | |
| 137 | + detailDOList.add(entity); | |
| 127 | 138 | } |
| 128 | 139 | }); |
| 129 | 140 | |
| 141 | + /*1.插入巡查计划*/ | |
| 142 | + maintainPlanMapper.insertBatch(maintainPlanList); | |
| 143 | + maintainPlanRoleMapper.insertBatch(roleList); | |
| 144 | + maintainPlanDetailMapper.insertBatch(detailDOList); | |
| 130 | 145 | // 返回 |
| 131 | - return CommonResult.success(count.longValue()); | |
| 146 | + return CommonResult.success(createReqVO.getRoadListReqVO().size()); | |
| 132 | 147 | } |
| 133 | 148 | |
| 134 | 149 | private MaintainPlanDetailDO getMaintainPlanDetailDO(String batchNo, MaintainPlanSaveReqVO saveReqVO, | ... | ... |
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanCommitMapper.xml
| ... | ... | @@ -8,5 +8,80 @@ |
| 8 | 8 | 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 |
| 9 | 9 | 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ |
| 10 | 10 | --> |
| 11 | + <!-- 复杂联表分页查询 --> | |
| 12 | + <select id="selectForPage" resultType="com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanCommitRespVO"> | |
| 13 | + SELECT | |
| 14 | + a.plan_no, | |
| 15 | + b.plan_name, | |
| 16 | + a.busi_line, | |
| 17 | + b.road_id, | |
| 18 | + b.road_name, | |
| 19 | + b.level_id, | |
| 20 | + b.plan_attr as planAttr, | |
| 21 | + b.plan_type_id as planTypeId, | |
| 22 | + b.company_id, | |
| 23 | + b.dept_id, | |
| 24 | + a.img_host as imgHost, | |
| 25 | + a.img, | |
| 26 | + a.inspection_state as inspectionState, | |
| 27 | + a.trans_state as transState, | |
| 28 | + a.trans_work_no as transWorkNo, | |
| 29 | + a.finish_time as finishTime, | |
| 30 | + a.user_id, | |
| 31 | + a.user_name, | |
| 32 | + a.role_id, | |
| 33 | + a.role_name, | |
| 34 | + a.remark, | |
| 35 | + a.creator, | |
| 36 | + a.creator_name, | |
| 37 | + a.create_time | |
| 38 | + FROM | |
| 39 | + garden_inspection_plan_commit a, garden_inspection_plan b | |
| 40 | + where a.batch_no=b.batch_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 b.plan_name LIKE CONCAT(#{req.planName},'%') | |
| 46 | + </if> | |
| 47 | + <if test="busiLineList != null and busiLineList.size() > 0"> | |
| 48 | + AND a.busi_line IN | |
| 49 | + <foreach collection="busiLineList" item="id" open="(" separator="," close=")"> | |
| 50 | + #{id} | |
| 51 | + </foreach> | |
| 52 | + </if> | |
| 11 | 53 | |
| 54 | + <if test="req.planAttr != null"> | |
| 55 | + and b.plan_attr = #{req.planAttr} | |
| 56 | + </if> | |
| 57 | + <if test="req.planTypeId != null"> | |
| 58 | + and b.plan_type_id = #{req.planTypeId} | |
| 59 | + </if> | |
| 60 | + <if test="req.deptId != null"> | |
| 61 | + and b.dept_id = #{req.deptId} | |
| 62 | + </if> | |
| 63 | + <if test="req.roadName != null and req.roadName !=''"> | |
| 64 | + AND b.road_name LIKE CONCAT(#{req.roadName},'%') | |
| 65 | + </if> | |
| 66 | + <if test="req.companyId != null"> | |
| 67 | + and b.company_id = #{req.companyId} | |
| 68 | + </if> | |
| 69 | + <if test="req.levelId != null"> | |
| 70 | + and b.level_id = #{req.levelId} | |
| 71 | + </if> | |
| 72 | + <if test="req.userName != null and req.userName !=''"> | |
| 73 | + AND a.user_name LIKE CONCAT('%', #{req.userName},'%') | |
| 74 | + </if> | |
| 75 | + <if test="req.transState != null"> | |
| 76 | + and a.inspection_state = #{req.transState} | |
| 77 | + </if> | |
| 78 | + <if test="req.finishTime != null"> | |
| 79 | + AND DATE_FORMAT(a.finish_time, '%Y-%m-%d') = #{req.finishTime} | |
| 80 | + </if> | |
| 81 | + <if test="req.remark != null and req.remark !=''"> | |
| 82 | + AND a.remark LIKE CONCAT('%', #{req.remark} ,'%') | |
| 83 | + </if> | |
| 84 | + | |
| 85 | + order by a.id desc | |
| 86 | + </select> | |
| 12 | 87 | </mapper> |
| 13 | 88 | \ No newline at end of file | ... | ... |