diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitPageReqVO.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitPageReqVO.java index 09b9f89..eb5d232 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitPageReqVO.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitPageReqVO.java @@ -3,6 +3,8 @@ package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; import lombok.*; import java.time.LocalDate; +import java.util.List; + import io.swagger.v3.oas.annotations.media.Schema; import com.zteits.urbanops.framework.common.pojo.PageParam; import org.springframework.format.annotation.DateTimeFormat; @@ -35,9 +37,12 @@ public class InspectionPlanCommitPageReqVO extends PageParam { @Schema(description = "部门ID(道路负责部门id)", example = "2714") private Long deptId; - @Schema(description = "道路ID", example = "12917") + @Schema(description = "道路", example = "12917") private String roadName; + @Schema(description = "角色名称", example = "12917") + private String roleName; + @Schema(description = "养护级别: 10:特级;11:一级:12:二级;13:三级", example = "10") private Integer levelId; @@ -56,4 +61,6 @@ public class InspectionPlanCommitPageReqVO extends PageParam { @Schema(description = "备注", example = "你猜") private String remark; + + private List busiLineList; } \ No newline at end of file diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/oldtrees/vo/OldtreesRespVO.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/oldtrees/vo/OldtreesRespVO.java index 6279bdc..276f447 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/oldtrees/vo/OldtreesRespVO.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/oldtrees/vo/OldtreesRespVO.java @@ -1,5 +1,9 @@ package com.zteits.urbanops.module.garden.controller.admin.oldtrees.vo; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fhs.core.trans.anno.Trans; +import com.fhs.core.trans.constant.TransType; +import com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -33,9 +37,12 @@ public class OldtreesRespVO { private String location; @Schema(description = "养护单位") - @ExcelProperty("养护单位") private String maintainunit; + @Schema(description = "养护单位名称") + @ExcelProperty("养护单位") + private String maintainUnitName; + @Schema(description = "权属分类--数据字典:专业绿地和单位(居住区)") @ExcelProperty("权属分类--数据字典:专业绿地和单位(居住区)") private String oldtreeownership; @@ -180,4 +187,8 @@ public class OldtreesRespVO { @ExcelProperty("部门id") private Long deptId; + private List treeImgList; + + private List nameplatephotoList; + } \ No newline at end of file diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/oldtreeschangelog/vo/OldtreesChangeLogRespVO.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/oldtreeschangelog/vo/OldtreesChangeLogRespVO.java index b5264f1..2fa733f 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/oldtreeschangelog/vo/OldtreesChangeLogRespVO.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/oldtreeschangelog/vo/OldtreesChangeLogRespVO.java @@ -1,183 +1,188 @@ -package com.zteits.urbanops.module.garden.controller.admin.oldtreeschangelog.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import org.springframework.format.annotation.DateTimeFormat; -import java.time.LocalDateTime; -import cn.idev.excel.annotation.*; - -@Schema(description = "管理后台 - 古树名木修改记录 Response VO") -@Data -@ExcelIgnoreUnannotated -public class OldtreesChangeLogRespVO { - - @Schema(description = "id", example = "148") - @ExcelProperty("id") - private String id; - - @Schema(description = "garden_oldtrees 的主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32596") - @ExcelProperty("garden_oldtrees 的主键") - private String oldtreeid; - - @Schema(description = "编号") - @ExcelProperty("编号") - private String famoustreenumber; - - @Schema(description = "级别--数据字典:一级、两级") - @ExcelProperty("级别--数据字典:一级、两级") - private String treelevel; - - @Schema(description = "树种", example = "2") - @ExcelProperty("树种") - private String treetype; - - @Schema(description = "所在地") - @ExcelProperty("所在地") - private String location; - - @Schema(description = "养护单位") - @ExcelProperty("养护单位") - private String maintainunit; - - @Schema(description = "权属分类--数据字典:专业绿地和单位(居住区)") - @ExcelProperty("权属分类--数据字典:专业绿地和单位(居住区)") - private String oldtreeownership; - - @Schema(description = "生长地点") - @ExcelProperty("生长地点") - private String growlocation; - - @Schema(description = "拉丁名", example = "张三") - @ExcelProperty("拉丁名") - private String latinname; - - @Schema(description = "树高") - @ExcelProperty("树高") - private String treeheight; - - @Schema(description = "估测树龄") - @ExcelProperty("估测树龄") - private String estimationtreeage; - - @Schema(description = "胸径") - @ExcelProperty("胸径") - private String dbh; - - @Schema(description = "经度") - @ExcelProperty("经度") - private String longitude; - - @Schema(description = "纬度") - @ExcelProperty("纬度") - private String latitude; - - @Schema(description = "冠幅东西") - @ExcelProperty("冠幅东西") - private String canopyeastwest; - - @Schema(description = "冠幅南北") - @ExcelProperty("冠幅南北") - private String canopysouthnorth; - - @Schema(description = "管护责任单位") - @ExcelProperty("管护责任单位") - private String managedutyunit; - - @Schema(description = "干周") - @ExcelProperty("干周") - private String weekday; - - @Schema(description = "生长势--数据字典:正常,衰弱,濒危,死亡") - @ExcelProperty("生长势--数据字典:正常,衰弱,濒危,死亡") - private String growthvigor; - - @Schema(description = "生长环境") - @ExcelProperty("生长环境") - private String growthenvironment; - - @Schema(description = "古树照片一") - @ExcelProperty("古树照片一") - private String treephotoone; - - @Schema(description = "春季养护管理措施") - @ExcelProperty("春季养护管理措施") - private String springmaintenance; - - @Schema(description = "夏季养护管理措施") - @ExcelProperty("夏季养护管理措施") - private String summermaintenance; - - @Schema(description = "秋季养护管理措施") - @ExcelProperty("秋季养护管理措施") - private String autumnmaintenance; - - @Schema(description = "冬季养护管理措施") - @ExcelProperty("冬季养护管理措施") - private String wintermaintenance; - - @Schema(description = "年度") - @ExcelProperty("年度") - private String annual; - - @Schema(description = "养护记录备注", example = "你说的对") - @ExcelProperty("养护记录备注") - private String curingremark; - - @Schema(description = "古树照片二") - @ExcelProperty("古树照片二") - private String treephototwo; - - @Schema(description = "古树照片三") - @ExcelProperty("古树照片三") - private String treephotothree; - - @Schema(description = "古树铭牌照片") - @ExcelProperty("古树铭牌照片") - private String nameplatephoto; - - @Schema(description = "数据状态(已更新、未更新)") - @ExcelProperty("数据状态(已更新、未更新)") - private String datastate; - - @Schema(description = "养护员工--作业队下派古树时选择的派发员工") - @ExcelProperty("养护员工--作业队下派古树时选择的派发员工") - private String curingstaff; - - @Schema(description = "状态(驳回/确认)") - @ExcelProperty("状态(驳回/确认)") - private String state; - - @Schema(description = "平台驳回状态(平台驳回)") - @ExcelProperty("平台驳回状态(平台驳回)") - private String platformstate; - - @Schema(description = "所属街道") - @ExcelProperty("所属街道") - private String street; - - @Schema(description = "负责人姓名", example = "芋艿") - @ExcelProperty("负责人姓名") - private String responsibleusername; - - @Schema(description = "负责人电话") - @ExcelProperty("负责人电话") - private String responsibleuserphone; - - @Schema(description = "创建者") - @ExcelProperty("创建者") - private String createby; - - @Schema(description = "创建时间") - @ExcelProperty("创建时间") - private LocalDateTime createtime; - - @Schema(description = "更新者") - @ExcelProperty("更新者") - private String updateby; - - @Schema(description = "更新时间") - @ExcelProperty("更新时间") - private String updatetime; - -} \ No newline at end of file +package com.zteits.urbanops.module.garden.controller.admin.oldtreeschangelog.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import cn.idev.excel.annotation.*; + +@Schema(description = "管理后台 - 古树名木修改记录 Response VO") +@Data +@ExcelIgnoreUnannotated +public class OldtreesChangeLogRespVO { + + @Schema(description = "id", example = "148") + @ExcelProperty("id") + private String id; + + @Schema(description = "garden_oldtrees 的主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32596") + @ExcelProperty("garden_oldtrees 的主键") + private String oldtreeid; + + @Schema(description = "编号") + @ExcelProperty("编号") + private String famoustreenumber; + + @Schema(description = "级别--数据字典:一级、两级") + @ExcelProperty("级别--数据字典:一级、两级") + private String treelevel; + + @Schema(description = "树种", example = "2") + @ExcelProperty("树种") + private String treetype; + + @Schema(description = "所在地") + @ExcelProperty("所在地") + private String location; + + @Schema(description = "养护单位") + @ExcelProperty("养护单位") + private String maintainunit; + + @Schema(description = "权属分类--数据字典:专业绿地和单位(居住区)") + @ExcelProperty("权属分类--数据字典:专业绿地和单位(居住区)") + private String oldtreeownership; + + @Schema(description = "生长地点") + @ExcelProperty("生长地点") + private String growlocation; + + @Schema(description = "拉丁名", example = "张三") + @ExcelProperty("拉丁名") + private String latinname; + + @Schema(description = "树高") + @ExcelProperty("树高") + private String treeheight; + + @Schema(description = "估测树龄") + @ExcelProperty("估测树龄") + private String estimationtreeage; + + @Schema(description = "胸径") + @ExcelProperty("胸径") + private String dbh; + + @Schema(description = "经度") + @ExcelProperty("经度") + private String longitude; + + @Schema(description = "纬度") + @ExcelProperty("纬度") + private String latitude; + + @Schema(description = "冠幅东西") + @ExcelProperty("冠幅东西") + private String canopyeastwest; + + @Schema(description = "冠幅南北") + @ExcelProperty("冠幅南北") + private String canopysouthnorth; + + @Schema(description = "管护责任单位") + @ExcelProperty("管护责任单位") + private String managedutyunit; + + @Schema(description = "干周") + @ExcelProperty("干周") + private String weekday; + + @Schema(description = "生长势--数据字典:正常,衰弱,濒危,死亡") + @ExcelProperty("生长势--数据字典:正常,衰弱,濒危,死亡") + private String growthvigor; + + @Schema(description = "生长环境") + @ExcelProperty("生长环境") + private String growthenvironment; + + @Schema(description = "古树照片一") + @ExcelProperty("古树照片一") + private String treephotoone; + + @Schema(description = "春季养护管理措施") + @ExcelProperty("春季养护管理措施") + private String springmaintenance; + + @Schema(description = "夏季养护管理措施") + @ExcelProperty("夏季养护管理措施") + private String summermaintenance; + + @Schema(description = "秋季养护管理措施") + @ExcelProperty("秋季养护管理措施") + private String autumnmaintenance; + + @Schema(description = "冬季养护管理措施") + @ExcelProperty("冬季养护管理措施") + private String wintermaintenance; + + @Schema(description = "年度") + @ExcelProperty("年度") + private String annual; + + @Schema(description = "养护记录备注", example = "你说的对") + @ExcelProperty("养护记录备注") + private String curingremark; + + @Schema(description = "古树照片二") + @ExcelProperty("古树照片二") + private String treephototwo; + + @Schema(description = "古树照片三") + @ExcelProperty("古树照片三") + private String treephotothree; + + @Schema(description = "古树铭牌照片") + @ExcelProperty("古树铭牌照片") + private String nameplatephoto; + + @Schema(description = "数据状态(已更新、未更新)") + @ExcelProperty("数据状态(已更新、未更新)") + private String datastate; + + @Schema(description = "养护员工--作业队下派古树时选择的派发员工") + @ExcelProperty("养护员工--作业队下派古树时选择的派发员工") + private String curingstaff; + + @Schema(description = "状态(驳回/确认)") + @ExcelProperty("状态(驳回/确认)") + private String state; + + @Schema(description = "平台驳回状态(平台驳回)") + @ExcelProperty("平台驳回状态(平台驳回)") + private String platformstate; + + @Schema(description = "所属街道") + @ExcelProperty("所属街道") + private String street; + + @Schema(description = "负责人姓名", example = "芋艿") + @ExcelProperty("负责人姓名") + private String responsibleusername; + + @Schema(description = "负责人电话") + @ExcelProperty("负责人电话") + private String responsibleuserphone; + + @Schema(description = "创建者") + @ExcelProperty("创建者") + private String createby; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createtime; + + @Schema(description = "更新者") + @ExcelProperty("更新者") + private String updateby; + + @Schema(description = "更新时间") + @ExcelProperty("更新时间") + private String updatetime; + + private List treeImgList; + + private List nameplatephotoList; + +} diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/RoadSaveReqVO.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/RoadSaveReqVO.java index 8018a60..387f5c5 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/RoadSaveReqVO.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/RoadSaveReqVO.java @@ -90,11 +90,9 @@ public class RoadSaveReqVO { private Long deptId; @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") - @NotEmpty(message = "创建者不能为空") private String creatorName; @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") - @NotEmpty(message = "更新者不能为空") private String updaterName; -} \ No newline at end of file +} diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/tree/vo/TreeRespVO.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/tree/vo/TreeRespVO.java index 3df77ec..182bd19 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/tree/vo/TreeRespVO.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/tree/vo/TreeRespVO.java @@ -1,155 +1,168 @@ -package com.zteits.urbanops.module.garden.controller.admin.tree.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import org.springframework.format.annotation.DateTimeFormat; -import java.time.LocalDateTime; -import cn.idev.excel.annotation.*; - -@Schema(description = "管理后台 - 一树一档案 Response VO") -@Data -@ExcelIgnoreUnannotated -public class TreeRespVO { - - @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28236") - @ExcelProperty("id") - private Long id; - - @Schema(description = "编号") - @ExcelProperty("编号") - private String treenumber; - - @Schema(description = "拉丁名", example = "李四") - @ExcelProperty("拉丁名") - private String latinname; - - @Schema(description = "树种", example = "2") - @ExcelProperty("树种") - private String treetype; - - @Schema(description = "树高") - @ExcelProperty("树高") - private String treeheight; - - @Schema(description = "冠幅") - @ExcelProperty("冠幅") - private String canopy; - - @Schema(description = "胸径") - @ExcelProperty("胸径") - private String dbh; - - @Schema(description = "生长势--数据字典:正常,衰弱,濒危,死亡") - @ExcelProperty("生长势--数据字典:正常,衰弱,濒危,死亡") - private String growthvigor; - - @Schema(description = "级别--数据字典:一级、两级") - @ExcelProperty("级别--数据字典:一级、两级") - private String treelevel; - - @Schema(description = "经度") - @ExcelProperty("经度") - private String longitude; - - @Schema(description = "纬度") - @ExcelProperty("纬度") - private String latitude; - - @Schema(description = "所在地") - @ExcelProperty("所在地") - private String location; - - @Schema(description = "养护单位") - @ExcelProperty("养护单位") - private String maintainunit; - - @Schema(description = "管护单位") - @ExcelProperty("管护单位") - private String managedutyunit; - - @Schema(description = "道路id") - @ExcelProperty("道路id") - private Long road; - - @Schema(description = "所属街道") - @ExcelProperty("所属街道") - private String street; - - @Schema(description = "权属分类--数据字典:专业绿地和单位(居住区)") - @ExcelProperty("权属分类--数据字典:专业绿地和单位(居住区)") - private String oldtreeownership; - - @Schema(description = "数据状态(已更新、未更新)") - @ExcelProperty("数据状态(已更新、未更新)") - private String datastate; - - @Schema(description = "估测树龄") - @ExcelProperty("估测树龄") - private String estimationtreeage; - - @Schema(description = "冠幅东西") - @ExcelProperty("冠幅东西") - private String canopyeastwest; - - @Schema(description = "冠幅南北") - @ExcelProperty("冠幅南北") - private String canopysouthnorth; - - @Schema(description = "干周") - @ExcelProperty("干周") - private String weekday; - - @Schema(description = "生长地点") - @ExcelProperty("生长地点") - private String growlocation; - - @Schema(description = "生长环境") - @ExcelProperty("生长环境") - private String growthenvironment; - - @Schema(description = "树木照片一") - @ExcelProperty("树木照片一") - private String treephotoone; - - @Schema(description = "古树照片二") - @ExcelProperty("古树照片二") - private String treephototwo; - - @Schema(description = "古树照片三") - @ExcelProperty("古树照片三") - private String treephotothree; - - @Schema(description = "古树照片四") - @ExcelProperty("古树照片四") - private String treephotofour; - - @Schema(description = "古树照片五") - @ExcelProperty("古树照片五") - private String treephotofive; - - @Schema(description = "创建者") - @ExcelProperty("创建者") - private String createby; - - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) - @ExcelProperty("创建时间") - private LocalDateTime createtime; - - @Schema(description = "更新者") - @ExcelProperty("更新者") - private String updateby; - - @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) - @ExcelProperty("更新时间") - private LocalDateTime updatetime; - - @Schema(description = "备注", example = "你说的对") - @ExcelProperty("备注") - private String remark; - - @Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17101") - @ExcelProperty("部门id") - private Long deptId; - -} \ No newline at end of file +package com.zteits.urbanops.module.garden.controller.admin.tree.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fhs.core.trans.anno.Trans; +import com.fhs.core.trans.constant.TransType; +import com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import cn.idev.excel.annotation.*; + +@Schema(description = "管理后台 - 一树一档案 Response VO") +@Data +@ExcelIgnoreUnannotated +public class TreeRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28236") + @ExcelProperty("id") + private Long id; + + @Schema(description = "编号") + @ExcelProperty("编号") + private String treenumber; + + @Schema(description = "拉丁名", example = "李四") + @ExcelProperty("拉丁名") + private String latinname; + + @Schema(description = "树种", example = "2") + @ExcelProperty("树种") + private String treetype; + + @Schema(description = "树高") + @ExcelProperty("树高") + private String treeheight; + + @Schema(description = "冠幅") + @ExcelProperty("冠幅") + private String canopy; + + @Schema(description = "胸径") + @ExcelProperty("胸径") + private String dbh; + + @Schema(description = "生长势--数据字典:正常,衰弱,濒危,死亡") + @ExcelProperty("生长势--数据字典:正常,衰弱,濒危,死亡") + private String growthvigor; + + @Schema(description = "级别--数据字典:一级、两级") + @ExcelProperty("级别--数据字典:一级、两级") + private String treelevel; + + @Schema(description = "经度") + @ExcelProperty("经度") + private String longitude; + + @Schema(description = "纬度") + @ExcelProperty("纬度") + private String latitude; + + @Schema(description = "所在地") + @ExcelProperty("所在地") + private String location; + + @Schema(description = "养护单位") + @Trans(type = TransType.SIMPLE, targetClassName = "com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO", + key = "id", fields = "name", ref = "maintainUnitName") + private String maintainunit; + + @Schema(description = "养护单位名称") + @ExcelProperty("养护单位") + private String maintainUnitName; + + @Schema(description = "管护单位") + @ExcelProperty("管护单位") + private String managedutyunit; + + @Schema(description = "道路id") + @ExcelProperty("道路id") + private Long road; + + @Schema(description = "所属街道") + @ExcelProperty("所属街道") + private String street; + + @Schema(description = "权属分类--数据字典:专业绿地和单位(居住区)") + @ExcelProperty("权属分类--数据字典:专业绿地和单位(居住区)") + private String oldtreeownership; + + @Schema(description = "数据状态(已更新、未更新)") + @ExcelProperty("数据状态(已更新、未更新)") + private String datastate; + + @Schema(description = "估测树龄") + @ExcelProperty("估测树龄") + private String estimationtreeage; + + @Schema(description = "冠幅东西") + @ExcelProperty("冠幅东西") + private String canopyeastwest; + + @Schema(description = "冠幅南北") + @ExcelProperty("冠幅南北") + private String canopysouthnorth; + + @Schema(description = "干周") + @ExcelProperty("干周") + private String weekday; + + @Schema(description = "生长地点") + @ExcelProperty("生长地点") + private String growlocation; + + @Schema(description = "生长环境") + @ExcelProperty("生长环境") + private String growthenvironment; + + @Schema(description = "树木照片一") + @ExcelProperty("树木照片一") + private String treephotoone; + + @Schema(description = "古树照片二") + @ExcelProperty("古树照片二") + private String treephototwo; + + @Schema(description = "古树照片三") + @ExcelProperty("古树照片三") + private String treephotothree; + + @Schema(description = "古树照片四") + @ExcelProperty("古树照片四") + private String treephotofour; + + @Schema(description = "古树照片五") + @ExcelProperty("古树照片五") + private String treephotofive; + + @Schema(description = "创建者") + @ExcelProperty("创建者") + private String createby; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createtime; + + @Schema(description = "更新者") + @ExcelProperty("更新者") + private String updateby; + + @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("更新时间") + private LocalDateTime updatetime; + + @Schema(description = "备注", example = "你说的对") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17101") + @ExcelProperty("部门id") + private Long deptId; + + private List treeImgList; + + private List treeImgListFile; + +} diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/oldtrees/OldtreesDO.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/oldtrees/OldtreesDO.java index b27fcc3..8ef5e42 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/oldtrees/OldtreesDO.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/oldtrees/OldtreesDO.java @@ -240,5 +240,4 @@ public class OldtreesDO { } return this; } - } \ No newline at end of file diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/inspectionplan/InspectionPlanCommitMapper.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/inspectionplan/InspectionPlanCommitMapper.java index d279d59..f7c6dca 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/inspectionplan/InspectionPlanCommitMapper.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/inspectionplan/InspectionPlanCommitMapper.java @@ -22,7 +22,7 @@ public interface InspectionPlanCommitMapper extends BaseMapperX selectForPage(IPage page, @Param("req") InspectionPlanCommitPageReqVO reqDTO, @Param("busiLineList") List busiLineList); + IPage selectForPage(@Param("page") IPage page, @Param("req") InspectionPlanCommitPageReqVO reqDTO); } \ No newline at end of file diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/oldtrees/OldtreesMapper.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/oldtrees/OldtreesMapper.java index 0e0567b..053bec1 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/oldtrees/OldtreesMapper.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/oldtrees/OldtreesMapper.java @@ -5,9 +5,12 @@ import java.util.*; import com.zteits.urbanops.framework.common.pojo.PageResult; import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; +import com.zteits.urbanops.framework.mybatis.core.query.MPJLambdaWrapperX; import com.zteits.urbanops.module.garden.dal.dataobject.oldtrees.OldtreesDO; +import com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO; import org.apache.ibatis.annotations.Mapper; import com.zteits.urbanops.module.garden.controller.admin.oldtrees.vo.*; +import org.springframework.util.ObjectUtils; /** * 古树名木 Mapper @@ -18,7 +21,10 @@ import com.zteits.urbanops.module.garden.controller.admin.oldtrees.vo.*; public interface OldtreesMapper extends BaseMapperX { default PageResult selectPage(OldtreesPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() + MPJLambdaWrapperX wrapper = new MPJLambdaWrapperX() + .selectAs(DeptDO::getName, OldtreesDO::getMaintainunit) + .selectAll(OldtreesDO.class) + .leftJoin(DeptDO.class, DeptDO::getId, OldtreesDO::getMaintainunit) .eqIfPresent(OldtreesDO::getFamoustreenumber, reqVO.getFamoustreenumber()) .eqIfPresent(OldtreesDO::getTreelevel, reqVO.getTreelevel()) .eqIfPresent(OldtreesDO::getTreetype, reqVO.getTreetype()) @@ -60,7 +66,9 @@ public interface OldtreesMapper extends BaseMapperX { .eqIfPresent(OldtreesDO::getUpdateby, reqVO.getUpdateby()) .betweenIfPresent(OldtreesDO::getUpdatetime, reqVO.getUpdatetime()) .eqIfPresent(OldtreesDO::getDeptId, reqVO.getDeptId()) - .orderByDesc(OldtreesDO::getId)); + .orderByDesc(OldtreesDO::getCreatetime); + + return selectJoinPage(reqVO, OldtreesDO.class, wrapper); } default OldtreesDO selectByFamoustreenumber(String famoustreenumber) { diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/oldtreeschangelog/OldtreesChangeLogMapper.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/oldtreeschangelog/OldtreesChangeLogMapper.java index f95f375..10845f4 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/oldtreeschangelog/OldtreesChangeLogMapper.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/oldtreeschangelog/OldtreesChangeLogMapper.java @@ -5,7 +5,9 @@ import java.util.*; import com.zteits.urbanops.framework.common.pojo.PageResult; import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; +import com.zteits.urbanops.framework.mybatis.core.query.MPJLambdaWrapperX; import com.zteits.urbanops.module.garden.dal.dataobject.oldtreeschangelog.OldtreesChangeLogDO; +import com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO; import org.apache.ibatis.annotations.Mapper; import com.zteits.urbanops.module.garden.controller.admin.oldtreeschangelog.vo.*; @@ -18,8 +20,11 @@ import com.zteits.urbanops.module.garden.controller.admin.oldtreeschangelog.vo.* public interface OldtreesChangeLogMapper extends BaseMapperX { default PageResult selectPage(OldtreesChangeLogPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(OldtreesChangeLogDO::getOldtreeid, reqVO.getOldtreeid()) + + MPJLambdaWrapperX wrapper = new MPJLambdaWrapperX() + .selectAs(DeptDO::getName, OldtreesChangeLogDO::getMaintainunit) + .selectAll(OldtreesChangeLogDO.class) + .leftJoin(DeptDO.class, DeptDO::getId, OldtreesChangeLogDO::getMaintainunit) .eqIfPresent(OldtreesChangeLogDO::getFamoustreenumber, reqVO.getFamoustreenumber()) .eqIfPresent(OldtreesChangeLogDO::getTreelevel, reqVO.getTreelevel()) .eqIfPresent(OldtreesChangeLogDO::getTreetype, reqVO.getTreetype()) @@ -60,7 +65,10 @@ public interface OldtreesChangeLogMapper extends BaseMapperX { default PageResult selectPage(TreePageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() + + MPJLambdaWrapperX wrapper = new MPJLambdaWrapperX() + .selectAs(DeptDO::getName, TreeDO::getMaintainunit) + .selectAll(TreeDO.class) + .leftJoin(DeptDO.class, DeptDO::getId, TreeDO::getMaintainunit) .eqIfPresent(TreeDO::getTreenumber, reqVO.getTreenumber()) .likeIfPresent(TreeDO::getLatinname, reqVO.getLatinname()) .eqIfPresent(TreeDO::getTreetype, reqVO.getTreetype()) @@ -48,12 +54,13 @@ public interface TreeMapper extends BaseMapperX { .eqIfPresent(TreeDO::getTreephotofour, reqVO.getTreephotofour()) .eqIfPresent(TreeDO::getTreephotofive, reqVO.getTreephotofive()) .eqIfPresent(TreeDO::getCreateby, reqVO.getCreateby()) - .betweenIfPresent(TreeDO::getCreatetime, reqVO.getCreatetime()) .eqIfPresent(TreeDO::getUpdateby, reqVO.getUpdateby()) .betweenIfPresent(TreeDO::getUpdatetime, reqVO.getUpdatetime()) .eqIfPresent(TreeDO::getRemark, reqVO.getRemark()) .eqIfPresent(TreeDO::getDeptId, reqVO.getDeptId()) - .orderByDesc(TreeDO::getId)); + .orderByDesc(TreeDO::getId); + + return selectJoinPage(reqVO, TreeDO.class, wrapper); } default TreeDO selectByTreeNumber(String treeNumber) { diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/treechangelog/TreeChangeLogMapper.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/treechangelog/TreeChangeLogMapper.java index 06380c7..17752bd 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/treechangelog/TreeChangeLogMapper.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/treechangelog/TreeChangeLogMapper.java @@ -5,7 +5,9 @@ import java.util.*; import com.zteits.urbanops.framework.common.pojo.PageResult; import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; +import com.zteits.urbanops.framework.mybatis.core.query.MPJLambdaWrapperX; import com.zteits.urbanops.module.garden.dal.dataobject.treechangelog.TreeChangeLogDO; +import com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO; import org.apache.ibatis.annotations.Mapper; import com.zteits.urbanops.module.garden.controller.admin.treechangelog.vo.*; @@ -18,7 +20,11 @@ import com.zteits.urbanops.module.garden.controller.admin.treechangelog.vo.*; public interface TreeChangeLogMapper extends BaseMapperX { default PageResult selectPage(TreeChangeLogPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() + + MPJLambdaWrapperX wrapper = new MPJLambdaWrapperX() + .selectAs(DeptDO::getName, TreeChangeLogDO::getMaintainunit) + .selectAll(TreeChangeLogDO.class) + .leftJoin(DeptDO.class, DeptDO::getId, TreeChangeLogDO::getMaintainunit) .eqIfPresent(TreeChangeLogDO::getTreeid, reqVO.getTreeid()) .eqIfPresent(TreeChangeLogDO::getTreenumber, reqVO.getTreenumber()) .likeIfPresent(TreeChangeLogDO::getLatinname, reqVO.getLatinname()) @@ -53,7 +59,10 @@ public interface TreeChangeLogMapper extends BaseMapperX { .eqIfPresent(TreeChangeLogDO::getUpdateby, reqVO.getUpdateby()) .betweenIfPresent(TreeChangeLogDO::getUpdatetime, reqVO.getUpdatetime()) .eqIfPresent(TreeChangeLogDO::getRemark, reqVO.getRemark()) - .orderByDesc(TreeChangeLogDO::getId)); + .orderByDesc(TreeChangeLogDO::getId); + + return selectJoinPage(reqVO, TreeChangeLogDO.class, wrapper); + } } \ No newline at end of file diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanCommitServiceImpl.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanCommitServiceImpl.java index 9d4e69a..82094a0 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanCommitServiceImpl.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanCommitServiceImpl.java @@ -87,9 +87,10 @@ public class InspectionPlanCommitServiceImpl implements InspectionPlanCommitServ busiLineList.addAll(Arrays.asList(busiLine.split(","))); } } + pageReqVO.setBusiLineList(busiLineList); //分页 IPage mpPage = MyBatisUtils.buildPage(pageReqVO); - IPage page = inspectionPlanCommitMapper.selectForPage(mpPage, pageReqVO, busiLineList); + IPage page = inspectionPlanCommitMapper.selectForPage(mpPage, pageReqVO); // 转换返回 return new PageResult<>(imgProcess(page.getRecords()), page.getTotal()); } diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java index e9fb9e0..ab8d771 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java @@ -13,7 +13,8 @@ import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlan import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanRoleMapper; import com.zteits.urbanops.module.garden.enums.FinishStateEnum; import com.zteits.urbanops.module.garden.enums.PlanConstants; -import com.zteits.urbanops.module.garden.util.TimeIntervalCalculatorUtil; +import com.zteits.urbanops.module.garden.util.timeinterval.PeriodResult; +import com.zteits.urbanops.module.garden.util.timeinterval.TimeIntervalFrequencyUtil; import com.zteits.urbanops.module.system.api.dept.DeptApi; import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; import com.zteits.urbanops.module.system.api.permission.RoleApi; @@ -26,7 +27,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; -import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; @@ -78,20 +78,20 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { LocalDateTime now = LocalDateTime.now(); String userId = SecurityFrameworkUtils.getLoginUserId() + ""; String userName = SecurityFrameworkUtils.getLoginUserNickname(); - int rateValue; + String rateValue; if (createReqVO.getRateValue().contains("/")) { - rateValue = Integer.parseInt(createReqVO.getRateValue().split("/")[1]); + rateValue = createReqVO.getRateValue().trim(); } else { - rateValue = Integer.parseInt(createReqVO.getRateValue()); + rateValue = createReqVO.getRateValue().trim()+"/1"; } //计算开始和计算时间 在间隔周期下每天的次数 - List betweenDayList = TimeIntervalCalculatorUtil.calculateIntervals(createReqVO.getBeginTime(), createReqVO.getEndTime(), createReqVO.getCycleId(), rateValue); - if (CollectionUtils.isEmpty(betweenDayList)) { + List calculate = TimeIntervalFrequencyUtil.calculate(createReqVO.getBeginTime().toString(), createReqVO.getEndTime().toString(), rateValue, createReqVO.getCycleId()); + if (CollectionUtils.isEmpty(calculate)) { log.warn("获取两个时间之间间隔天数错误"); return CommonResult.error(INSPECTION_CYCLE_ERROR); } //计算计划次数 - Integer planNum = betweenDayList.size(); + Integer planNum = calculate.size(); //巡检计划list @@ -139,13 +139,12 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { }); /*3.插入巡查计划明细*/ - for (int i = 0; i < betweenDayList.size(); i++) { - String[] dateStr = betweenDayList.get(i).split("/"); + for (PeriodResult periodResult : calculate) { InspectionPlanDetailDO entity = getInspectionPlanDetailDO(batchNo, createReqVO, roadReqVO, now); ThreadUtil.sleep(2); - entity.setSortNum(i + 1); - entity.setBeginTime(LocalDateTime.parse(dateStr[0], DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00"))); - entity.setEndTime(LocalDateTime.parse(dateStr[1], DateTimeFormatter.ofPattern("yyyy-MM-dd 23:59:59"))); + entity.setSortNum(periodResult.getCount()); + entity.setBeginTime(LocalDateTime.parse(periodResult.getStart() + " 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + entity.setEndTime(LocalDateTime.parse(periodResult.getEnd() + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); detailDOList.add(entity); } }); @@ -179,6 +178,7 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { return entity; } + @Override public void updateInspectionPlan(InspectionPlanUpdateReqVO updateReqVO) { // 校验存在 diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java index 1a2c928..249ffcd 100644 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java @@ -5,9 +5,9 @@ import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.util.RandomUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.zteits.urbanops.framework.common.pojo.CommonResult; -import com.zteits.urbanops.framework.common.util.collection.CollectionUtils; import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils; import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanDetailDO; import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanRoleDO; import com.zteits.urbanops.module.garden.dal.mysql.maintainplan.MaintainPlanDetailMapper; @@ -15,7 +15,8 @@ import com.zteits.urbanops.module.garden.dal.mysql.maintainplan.MaintainPlanInte import com.zteits.urbanops.module.garden.dal.mysql.maintainplan.MaintainPlanRoleMapper; import com.zteits.urbanops.module.garden.enums.FinishStateEnum; import com.zteits.urbanops.module.garden.enums.PlanConstants; -import com.zteits.urbanops.module.garden.util.TimeIntervalCalculatorUtil; +import com.zteits.urbanops.module.garden.util.timeinterval.PeriodResult; +import com.zteits.urbanops.module.garden.util.timeinterval.TimeIntervalFrequencyUtil; import com.zteits.urbanops.module.system.api.dept.DeptApi; import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; import com.zteits.urbanops.module.system.api.permission.RoleApi; @@ -24,13 +25,12 @@ import jodd.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; +import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; -import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; -import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo.*; @@ -81,20 +81,21 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { LocalDateTime now = LocalDateTime.now(); String userId = SecurityFrameworkUtils.getLoginUserId()+""; String userName = SecurityFrameworkUtils.getLoginUserNickname(); - int rateValue; + String rateValue; if (createReqVO.getRateValue().contains("/")) { - rateValue = Integer.parseInt(createReqVO.getRateValue().split("/")[1]); + rateValue = createReqVO.getRateValue().trim(); } else { - rateValue = Integer.parseInt(createReqVO.getRateValue()); + rateValue = createReqVO.getRateValue().trim()+"/1"; } //计算开始和计算时间 在间隔周期下每天的次数 - List betweenDayList = TimeIntervalCalculatorUtil.calculateIntervals(createReqVO.getBeginTime(), createReqVO.getEndTime(), createReqVO.getCycleId(), rateValue); - if (CollectionUtils.isAnyEmpty(betweenDayList)) { + //计算开始和计算时间 在间隔周期下每天的次数 + List calculate = TimeIntervalFrequencyUtil.calculate(createReqVO.getBeginTime().toString(), createReqVO.getEndTime().toString(), rateValue, createReqVO.getCycleId()); + if (CollectionUtils.isEmpty(calculate)) { log.warn("获取两个时间之间间隔天数错误"); return CommonResult.error(INSPECTION_CYCLE_ERROR); } //计算计划次数 - Integer planNum = betweenDayList.size(); + Integer planNum = calculate.size(); //巡检计划list @@ -141,14 +142,12 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { roleList.add(maintainPlanRoleDO); }); /*3.插入巡查计划明细*/ - - for (int i = 0; i < betweenDayList.size(); i++) { - String[] dateStr = betweenDayList.get(i).split("/"); + for (PeriodResult periodResult : calculate) { MaintainPlanDetailDO entity = getMaintainPlanDetailDO(batchNo, createReqVO, roadReqVO, now); ThreadUtil.sleep(2); - entity.setSortNum(i+1); - entity.setBeginTime(LocalDateTime.parse(dateStr[0], DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00"))); - entity.setEndTime(LocalDateTime.parse(dateStr[1], DateTimeFormatter.ofPattern("yyyy-MM-dd 23:59:59"))); + entity.setSortNum(periodResult.getCount()); + entity.setBeginTime(LocalDateTime.parse(periodResult.getStart() + " 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + entity.setEndTime(LocalDateTime.parse(periodResult.getEnd() + " 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); detailDOList.add(entity); } }); diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/TimeIntervalCalculatorUtil.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/TimeIntervalCalculatorUtil.java deleted file mode 100644 index 6f0fa26..0000000 --- a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/TimeIntervalCalculatorUtil.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.zteits.urbanops.module.garden.util; - - -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.List; - -import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.INSPECTION_CYCLE_ID_ERROR; - -public class TimeIntervalCalculatorUtil { - enum IntervalUnit { - DAY, WEEK, MONTH, YEAR - } - - public static void main(String[] args) { - - System.out.println("请输入开始日期(yyyy-MM-dd):"); - LocalDate startDate = LocalDate.of(2025,10,1); - - System.out.println("请输入结束日期(yyyy-MM-dd):"); - LocalDate endDate = LocalDate.of(2025,10,7); - - System.out.println("请选择间隔单位(1.天 2.周 3.月 4.年):"); - IntervalUnit unit = IntervalUnit.DAY; - - System.out.println("请输入间隔数量(如2表示每2天/周/月/年):"); - int intervalCount =2; - - List intervals = calculateIntervals(startDate, endDate, 1, intervalCount); - - System.out.println("\n执行周期:"); - intervals.forEach(System.out::println); - } - - /** - * 执行次数计算 - * @param start - * @param end - * @param cycleId 1:日/次;2:周/次;3:月/次;4:年/次 - * @param intervalCount - * @return - */ - public static List calculateIntervals(LocalDate start, LocalDate end, Integer cycleId, int intervalCount) { - List intervals = new ArrayList<>(); - LocalDate currentStart = start; - IntervalUnit unit = getIntervalUnit(cycleId); - - while (currentStart.isBefore(end) || currentStart.isEqual(end)) { - LocalDate currentEnd = calculateEndDate(currentStart, end, unit, intervalCount); - intervals.add(currentStart + "/" + currentEnd); - currentStart = currentEnd.plusDays(1); - } - - return intervals; - } - - private static LocalDate calculateEndDate(LocalDate currentStart, LocalDate endDate, - IntervalUnit unit, int intervalCount) { - switch (unit) { - case DAY: - LocalDate dayEnd = currentStart.plusDays(intervalCount - 1); - return dayEnd.isAfter(endDate) ? endDate : dayEnd; - case WEEK: - LocalDate weekEnd = currentStart.plusDays(7 * intervalCount - 1); - return weekEnd.isAfter(endDate) ? endDate : weekEnd; - case MONTH: - LocalDate monthEnd = currentStart.plusMonths(intervalCount) - .withDayOfMonth(1).minusDays(1); - return monthEnd.isAfter(endDate) ? endDate : monthEnd; - case YEAR: - LocalDate yearEnd = currentStart.plusYears(intervalCount) - .withDayOfYear(1).minusDays(1); - return yearEnd.isAfter(endDate) ? endDate : yearEnd; - default: - return endDate; - } - } - - /** - * 转换枚举 - * @param cycleId 1:日/次;2:周/次;3:月/次;4:年/次 - * @return - */ - public static IntervalUnit getIntervalUnit(Integer cycleId) { - switch (cycleId) { - case 1: - return IntervalUnit.DAY; - case 2: - return IntervalUnit.WEEK; - case 3: - return IntervalUnit.MONTH; - case 4: - return IntervalUnit.YEAR; - default: - throw exception(INSPECTION_CYCLE_ID_ERROR); - } - } - -} diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/timeinterval/PeriodResult.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/timeinterval/PeriodResult.java new file mode 100644 index 0000000..7d03205 --- /dev/null +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/timeinterval/PeriodResult.java @@ -0,0 +1,35 @@ +package com.zteits.urbanops.module.garden.util.timeinterval; + +import lombok.Data; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +@Data +public class PeriodResult { + private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + + /** + * 开始时间 + */ + private final String start; + /** + * 结束时间 + */ + private final String end; + /** + * 执行次数 + */ + private final int count; + + public PeriodResult(LocalDate start, LocalDate end, int count) { + this.start = start.format(FORMATTER); + this.end = end.format(FORMATTER); + this.count = count; + } + + @Override + public String toString() { + return start + " " + end + " " + count + "次"; + } +} diff --git a/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/timeinterval/TimeIntervalFrequencyUtil.java b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/timeinterval/TimeIntervalFrequencyUtil.java new file mode 100644 index 0000000..f4dbcf1 --- /dev/null +++ b/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/util/timeinterval/TimeIntervalFrequencyUtil.java @@ -0,0 +1,155 @@ +package com.zteits.urbanops.module.garden.util.timeinterval; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.INSPECTION_CYCLE_ID_ERROR; + +/** + * 时间区间拆分+频次计算工具类 + * 支持:按日/周/月/年拆分,区间临界点重叠,动态计算每个区间的执行频次 + */ +public class TimeIntervalFrequencyUtil { + + private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + + public enum IntervalUnit { + DAY, WEEK, MONTH, YEAR; + } + + /** + * 转换枚举 + * @param cycleId 1:日/次;2:周/次;3:月/次;4:年/次 + * @return + */ + public static IntervalUnit getIntervalUnit(Integer cycleId) { + switch (cycleId) { + case 1: + return IntervalUnit.DAY; + case 2: + return IntervalUnit.WEEK; + case 3: + return IntervalUnit.MONTH; + case 4: + return IntervalUnit.YEAR; + default: + throw exception(INSPECTION_CYCLE_ID_ERROR); + } + } + + /** + * 计算时间段划分结果 + * + * @param startStr 开始日期 (yyyy-MM-dd) + * @param endStr 结束日期 (yyyy-MM-dd) + * @param freq 频次值,格式 "x/y" + * @param cycleId cycleId 1:日/次;2:周/次;3:月/次;4:年/次 + * @return 划分结果列表 + */ + public static List calculate(String startStr, String endStr, String freq, Integer cycleId) { + LocalDate start = LocalDate.parse(startStr, FORMATTER); + LocalDate end = LocalDate.parse(endStr, FORMATTER); + + if (start.isAfter(end)) { + return Collections.emptyList(); + } + + String[] parts = freq.split("/", 2); + if (parts.length != 2) { + throw new IllegalArgumentException("频次值格式错误,应为 'x/y': " + freq); + } + int x = Integer.parseInt(parts[0]); + int y = Integer.parseInt(parts[1]); + + IntervalUnit unit = getIntervalUnit(cycleId); + + List results = new ArrayList<>(); + LocalDate currentStart = start; + + while (!currentStart.isAfter(end)) { + // 计算当前周期的理论结束日期(包含 y 个单位) + LocalDate periodEnd = calculatePeriodEnd(currentStart, y, unit); + + // 实际段结束 = min(periodEnd, end) + LocalDate segEnd = periodEnd.isAfter(end) ? end : periodEnd; + + results.add(new PeriodResult(currentStart, segEnd, x)); + + // 下一段从当前段结束的第二天开始 + LocalDate nextStart = segEnd.plusDays(1); + + // 如果已经超过总结束时间,则终止 + if (nextStart.isAfter(end)) { + break; + } + + currentStart = nextStart; + } + + return results; + } + + /** + * 计算从 start 开始,经过 y 个单位周期后的结束日期(包含) + */ + private static LocalDate calculatePeriodEnd(LocalDate start, int y, IntervalUnit unit) { + switch (unit) { + case DAY: + return start.plusDays(y - 1); // 包含 y 天:start 到 start+y-1 + case WEEK: + return start.plusDays((long) y * 7 - 1); // y周 = y*7天,减1得包含结束 + case MONTH: + return addMonthsSafely(start, y).minusDays(1); + case YEAR: + return start.plusYears(y).minusDays(1); + default: + throw new UnsupportedOperationException("未支持的单位: " + unit); + } + } + + + + /** + * 安全地加上 y 个月(避免3月31日+1月变成异常) + * 这里使用 Java 8+ 的 plusMonths 自动调整规则 + */ + private static LocalDate addMonthsSafely(LocalDate date, int months) { + return date.plusMonths(months); + // Java 会自动处理:如 1月31日 +1月 → 2月28/29日(不会抛异常) + } + + + + + // ====================== 测试用例 ====================== + //cycleId 1:日/次;2:周/次;3:月/次;4:年/次 + public static void main(String[] args) { + System.out.println("=== 示例1:每3天一次,按日 ==="); + List r1 = calculate("2025-01-01", "2025-01-07", "1/3", 1); + r1.forEach(System.out::println); + + System.out.println("\n=== 示例2:每3周一次(21天),按周 ==="); + List r2 = calculate("2025-01-01", "2025-02-01", "1/3", 2); + r2.forEach(System.out::println); + + System.out.println("\n=== 示例3:每2个月一次,按月 ==="); + List r3 = calculate("2025-01-01", "2025-12-31", "1/2", 3); + r3.forEach(System.out::println); + + System.out.println("\n=== 示例4:每3年一次,按年 ==="); + List r4 = calculate("2025-01-01", "2035-06-01", "1/3", 3); + r4.forEach(System.out::println); + + System.out.println("\n=== 示例5:每2天2次,按日 ==="); + List r5 = calculate("2025-01-01", "2025-01-05", "2/2", 1); + r5.forEach(System.out::println); + + System.out.println("\n=== 示例5:每2年1次,按年 ==="); + List r6 = calculate("2025-01-01", "2028-01-05", "1/2", 4); + r6.forEach(System.out::println); + } +} \ No newline at end of file diff --git a/urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanCommitMapper.xml b/urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanCommitMapper.xml index 32a3d7c..ab2edb2 100644 --- a/urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanCommitMapper.xml +++ b/urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanCommitMapper.xml @@ -9,7 +9,7 @@ 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ --> - SELECT a.plan_no, b.plan_name, @@ -44,9 +44,9 @@ AND b.plan_name LIKE CONCAT(#{req.planName},'%') - + AND a.busi_line IN - + #{id} @@ -64,9 +64,8 @@ AND b.road_name LIKE CONCAT(#{req.roadName},'%') - AND a.role_name LIKE CONCAT(#{req.roleName},'%') + AND a.role_name LIKE CONCAT(#{roleName},'%') - and b.company_id = #{req.companyId} @@ -77,7 +76,7 @@ AND a.user_name LIKE CONCAT('%', #{req.userName},'%') - and a.inspection_state = #{req.transState} + and a.trans_state = #{req.transState} AND DATE_FORMAT(a.finish_time, '%Y-%m-%d') = #{req.finishTime}