From b3307783b98e5128a08ef46a965b3e7f676b7f82 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 22 Dec 2021 09:32:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BE=8B=E8=A1=8C=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...WorkDTO.java => PatrolRoutineWorkDTO.java} | 78 ++++------- .../epmet/dto/PatrolRoutineWorkTypeDTO.java | 91 ++++++++++++ .../epmet/dto/form/GridUserWorkFormDTO.java | 53 ++++--- ....java => PatrolRoutineWorkController.java} | 20 +-- ...WorkDao.java => PatrolRoutineWorkDao.java} | 8 +- .../epmet/dao/PatrolRoutineWorkTypeDao.java | 33 +++++ .../com/epmet/entity/GridUserWorkEntity.java | 70 +++------- .../epmet/entity/PatrolRoutineWorkEntity.java | 88 ++++++++++++ .../entity/PatrolRoutineWorkTypeEntity.java | 61 ++++++++ .../epmet/service/GridUserWorkService.java | 87 ------------ .../service/PatrolRoutineWorkService.java | 38 +++++ .../service/PatrolRoutineWorkTypeService.java | 31 ++++ .../service/impl/GridUserWorkServiceImpl.java | 119 ---------------- .../impl/PatrolRoutineWorkServiceImpl.java | 132 ++++++++++++++++++ .../PatrolRoutineWorkTypeServiceImpl.java | 36 +++++ .../main/resources/mapper/GridUserWorkDao.xml | 7 - .../resources/mapper/PatrolRoutineWorkDao.xml | 27 ++++ .../mapper/PatrolRoutineWorkTypeDao.xml | 21 +++ 18 files changed, 653 insertions(+), 347 deletions(-) rename epmet-user/epmet-user-client/src/main/java/com/epmet/dto/{GridUserWorkDTO.java => PatrolRoutineWorkDTO.java} (58%) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/PatrolRoutineWorkTypeDTO.java rename epmet-user/epmet-user-server/src/main/java/com/epmet/controller/{GridUserWorkController.java => PatrolRoutineWorkController.java} (67%) rename epmet-user/epmet-user-server/src/main/java/com/epmet/dao/{GridUserWorkDao.java => PatrolRoutineWorkDao.java} (83%) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkTypeDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkTypeEntity.java delete mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridUserWorkService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkTypeService.java delete mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridUserWorkServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkTypeServiceImpl.java delete mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/GridUserWorkDao.xml create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkDao.xml create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkTypeDao.xml diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridUserWorkDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/PatrolRoutineWorkDTO.java similarity index 58% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridUserWorkDTO.java rename to epmet-user/epmet-user-client/src/main/java/com/epmet/dto/PatrolRoutineWorkDTO.java index 78701ffd9a..d0c66c1a07 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridUserWorkDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/PatrolRoutineWorkDTO.java @@ -17,113 +17,87 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** - * 网格员例行工作 + * 巡查例行工作 * * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-19 + * @since v1.0.0 2021-12-21 */ @Data -public class GridUserWorkDTO implements Serializable { +public class PatrolRoutineWorkDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 主键 + * 唯一标识 */ private String id; /** - * 客户ID + * 客户Id customer.id */ private String customerId; /** - * 网格ID + * 网格表Id(CUSTOMER_GRID.id)【居民党员角色值为all,热心居民角色对应的网格Id】 */ private String gridId; /** - * 网格名称 - */ - private String gridName; - - /** - * 组织ID - */ - private String parentOrgId; - - /** - * 组织名称 - */ - private String orgName; - - /** - * PIDS + * 网格所有上级id */ private String pids; /** - * 网格编码 + * 用户Id user.id */ - private String gridCode; + private String userId; /** - * 例行工作类型 -01:重点巡查 -0101:出租房巡查 -0102:新增流动人口 -0103:重点场所巡查 -0104:宗教活动 -0199:其他 -02:特殊人群 -0201:刑满释放人员 -0202:社区矫正 -0203:吸毒人员 -0204:信访人员 + * 事项名称 */ - private String workType; + private String title; /** - * 例行工作类型名字 + * 工作日期 格式为“YYYY-MM-DD” */ - private String workTypeName; + private String happenTime; /** - * 发生日期 格式为“YYYY-MM-DD” + * 有无变动(异常)1:是、0:否 */ - private Date happenTime; + private Integer isNormal; /** - * 基础信息主键 -出租房巡查、重点场所巡查、刑满释放人员、社区矫正、吸毒人员、信访人员重点青少年和精神障碍者必填 + * 工作内容 */ - private String baseInfoId; + private String workContent; /** - * 有无变动(异常)Y:是、N:否 + * 经度 */ - private String workResult; + private String longitude; /** - * 备注说明 + * 纬度 */ - private String workContent; + private String latitude; /** - * + * 删除标识:0.未删除 1.已删除 */ private Integer delFlag; /** * 乐观锁 */ - private String revision; + private Integer revision; /** * 创建人 @@ -145,4 +119,4 @@ public class GridUserWorkDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/PatrolRoutineWorkTypeDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/PatrolRoutineWorkTypeDTO.java new file mode 100644 index 0000000000..505384ec36 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/PatrolRoutineWorkTypeDTO.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Data +public class PatrolRoutineWorkTypeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 例行工作Id + */ + private String routineWorkId; + + /** + * 例行工作字典项值;type:patrol_work_type + */ + private String workTypeCode; + + /** + * 所有上级类别code组合 + */ + private String allPCode; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridUserWorkFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridUserWorkFormDTO.java index 5841f761f4..f9b029d423 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridUserWorkFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridUserWorkFormDTO.java @@ -1,11 +1,14 @@ package com.epmet.dto.form; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.hibernate.validator.constraints.Range; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.io.Serializable; -import java.util.Date; +import java.util.List; /** * @Author zxc @@ -15,35 +18,47 @@ import java.util.Date; @Data public class GridUserWorkFormDTO implements Serializable { - private static final long serialVersionUID = -2328321123796674558L; - public interface GridUserWorkForm{} + private static final long serialVersionUID = 3411355616849866888L; - @NotBlank(message = "网格ID不能为空",groups = GridUserWorkForm.class) + public interface AddOrUpdateForm {} + + private String customerId; + + @NotBlank(message = "网格ID不能为空",groups = AddOrUpdateForm.class) private String gridId; - @NotBlank(message = "例行工作类型不能为空",groups = GridUserWorkForm.class) - private String workType; + @NotBlank(message = "事项名称不能为空",groups = AddOrUpdateForm.class) + private String title; - @NotBlank(message = "例行工作类型名字不能为空",groups = GridUserWorkForm.class) - private String workTypeName; + @NotEmpty(message = "例行工作类型不能为空",groups = AddOrUpdateForm.class) + private List workTypeList; - /** - * Y:是、N:否 - */ - @NotBlank(message = "有无变动(异常)不能为空",groups = GridUserWorkForm.class) - private String workResult; + @Range(min = 0,max = 1, message = "有无变动(异常)不能为空",groups = AddOrUpdateForm.class) + private Integer isNormal; - @NotNull(message = "发生时间不能为空",groups = GridUserWorkForm.class) - private Date happenTime; + @JsonFormat(pattern = "yyyy-MM-dd") + @NotNull(message = "发生时间不能为空",groups = AddOrUpdateForm.class) + private String happenTime; - /** - * 备注说明 - */ + @NotBlank(message = "工作简介不能为空",groups = AddOrUpdateForm.class) private String workContent; + @NotBlank(message = "工作地点不能为空",groups = AddOrUpdateForm.class) + private String address; /** - * 基础信息ID【相关信息】 + * 基础信息ID【相关信息】暂时没有 */ private String baseInfoId; + /** + * 经度 + */ + private String longitude; + /** + * 纬度 + */ + private String latitude; + + + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridUserWorkController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java similarity index 67% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridUserWorkController.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java index 2f32331d0f..fada3dca9a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridUserWorkController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java @@ -4,7 +4,7 @@ import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.GridUserWorkFormDTO; -import com.epmet.service.GridUserWorkService; +import com.epmet.service.PatrolRoutineWorkService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -15,11 +15,11 @@ import org.springframework.web.bind.annotation.*; * @since v1.0.0 2021-10-19 */ @RestController -@RequestMapping("griduserwork") -public class GridUserWorkController { - +@RequestMapping("patrolroutinework") +public class PatrolRoutineWorkController { + @Autowired - private GridUserWorkService gridUserWorkService; + private PatrolRoutineWorkService gridUserWorkService; /** * @Description 网格员例行工作 @@ -28,11 +28,11 @@ public class GridUserWorkController { * @date 2021/10/19 1:35 下午 */ @NoRepeatSubmit - @PostMapping("griduserwork") - public Result gridUserWork(@RequestBody GridUserWorkFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, GridUserWorkFormDTO.GridUserWorkForm.class); + @PostMapping("add") + public Result gridUserWork( @RequestBody GridUserWorkFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GridUserWorkFormDTO.AddOrUpdateForm.class); gridUserWorkService.gridUserWork(formDTO); - return new Result(); + return new Result().ok(true); } -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridUserWorkDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkDao.java similarity index 83% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridUserWorkDao.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkDao.java index 468a6ab5b5..02ba968895 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridUserWorkDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkDao.java @@ -18,16 +18,16 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.GridUserWorkEntity; +import com.epmet.entity.PatrolRoutineWorkEntity; import org.apache.ibatis.annotations.Mapper; /** - * 网格员例行工作 + * 巡查例行工作 * * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-19 + * @since v1.0.0 2021-12-21 */ @Mapper -public interface GridUserWorkDao extends BaseDao { +public interface PatrolRoutineWorkDao extends BaseDao { } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkTypeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkTypeDao.java new file mode 100644 index 0000000000..924c91eaeb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkTypeDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PatrolRoutineWorkTypeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Mapper +public interface PatrolRoutineWorkTypeDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java index 25469ff30d..0167079052 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java @@ -33,7 +33,7 @@ import java.util.Date; */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("grid_user_work") +@TableName("patrol_routine_work") public class GridUserWorkEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; @@ -49,50 +49,19 @@ public class GridUserWorkEntity extends BaseEpmetEntity { private String gridId; /** - * 网格名称 - */ - private String gridName; - - /** - * 组织ID - */ - private String parentOrgId; - - /** - * 组织名称 - */ - private String orgName; - - /** - * PIDS + * gridId的PID */ private String pids; - /** - * 网格编码 - */ - private String gridCode; - - /** - * 例行工作类型 -01:重点巡查 -0101:出租房巡查 -0102:新增流动人口 -0103:重点场所巡查 -0104:宗教活动 -0199:其他 -02:特殊人群 -0201:刑满释放人员 -0202:社区矫正 -0203:吸毒人员 -0204:信访人员 - */ - private String workType; + /** + * 用户Id user.id 谁创建的 + */ + private String userId; - /** - * 例行工作类型名字 - */ - private String workTypeName; + /** + * 事项名称 + */ + private String title; /** * 发生日期 格式为“YYYY-MM-DD” @@ -100,19 +69,22 @@ public class GridUserWorkEntity extends BaseEpmetEntity { private Date happenTime; /** - * 基础信息主键 -出租房巡查、重点场所巡查、刑满释放人员、社区矫正、吸毒人员、信访人员重点青少年和精神障碍者必填 + * 有无变动(异常)1:是、0:否 */ - private String baseInfoId; - - /** - * 有无变动(异常)Y:是、N:否 - */ - private String workResult; + private Integer isNormal; /** * 备注说明 */ private String workContent; + /** + * 经度 + */ + private String longitude; + /** + * 纬度 + */ + private String latitude; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkEntity.java new file mode 100644 index 0000000000..94bde0e1ba --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkEntity.java @@ -0,0 +1,88 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("patrol_routine_work") +public class PatrolRoutineWorkEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 网格表Id(CUSTOMER_GRID.id)【居民党员角色值为all,热心居民角色对应的网格Id】 + */ + private String gridId; + + /** + * 网格所有上级id + */ + private String pids; + + /** + * 用户Id user.id + */ + private String userId; + + /** + * 事项名称 + */ + private String title; + + /** + * 工作日期 格式为“YYYY-MM-DD” + */ + private String happenTime; + + /** + * 有无变动(异常)1:是、0:否 + */ + private Integer isNormal; + + /** + * 工作内容 + */ + private String workContent; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkTypeEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkTypeEntity.java new file mode 100644 index 0000000000..bf18e08bee --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkTypeEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("patrol_routine_work_type") +public class PatrolRoutineWorkTypeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 例行工作Id + */ + private String routineWorkId; + + /** + * 例行工作字典项值;type:patrol_work_type + */ + private String workTypeCode; + + /** + * 所有上级类别code组合 + */ + private String allPCode; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridUserWorkService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridUserWorkService.java deleted file mode 100644 index 8ce3cc5a10..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridUserWorkService.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.epmet.service; - -import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.GridUserWorkDTO; -import com.epmet.dto.form.GridUserWorkFormDTO; -import com.epmet.entity.GridUserWorkEntity; - -import java.util.List; -import java.util.Map; - -/** - * 网格员例行工作 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-19 - */ -public interface GridUserWorkService extends BaseService { - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2021-10-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2021-10-19 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return GridUserWorkDTO - * @author generator - * @date 2021-10-19 - */ - GridUserWorkDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2021-10-19 - */ - void save(GridUserWorkDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2021-10-19 - */ - void update(GridUserWorkDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2021-10-19 - */ - void delete(String[] ids); - - /** - * @Description 网格员例行工作 - * @param formDTO - * @author zxc - * @date 2021/10/19 1:35 下午 - */ - void gridUserWork(GridUserWorkFormDTO formDTO); -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkService.java new file mode 100644 index 0000000000..f463510d5f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkService.java @@ -0,0 +1,38 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PatrolRoutineWorkDTO; +import com.epmet.dto.form.GridUserWorkFormDTO; +import com.epmet.entity.PatrolRoutineWorkEntity; + +import java.util.List; +import java.util.Map; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +public interface PatrolRoutineWorkService extends BaseService { + + void gridUserWork(GridUserWorkFormDTO formDTO); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkTypeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkTypeService.java new file mode 100644 index 0000000000..f15123239f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkTypeService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.PatrolRoutineWorkTypeEntity; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +public interface PatrolRoutineWorkTypeService extends BaseService { + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridUserWorkServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridUserWorkServiceImpl.java deleted file mode 100644 index 0a4df06acc..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridUserWorkServiceImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.epmet.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dao.GridUserWorkDao; -import com.epmet.dto.CustomerGridDTO; -import com.epmet.dto.GridUserWorkDTO; -import com.epmet.dto.form.CustomerGridFormDTO; -import com.epmet.dto.form.GridUserWorkFormDTO; -import com.epmet.entity.GridUserWorkEntity; -import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.service.GridUserWorkService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/** - * 网格员例行工作 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2021-10-19 - */ -@Service -public class GridUserWorkServiceImpl extends BaseServiceImpl implements GridUserWorkService { - - @Autowired - private GovOrgOpenFeignClient govOrgOpenFeignClient; - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, GridUserWorkDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, GridUserWorkDTO.class); - } - - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } - - @Override - public GridUserWorkDTO get(String id) { - GridUserWorkEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, GridUserWorkDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(GridUserWorkDTO dto) { - GridUserWorkEntity entity = ConvertUtils.sourceToTarget(dto, GridUserWorkEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(GridUserWorkDTO dto) { - GridUserWorkEntity entity = ConvertUtils.sourceToTarget(dto, GridUserWorkEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - - /** - * @Description 网格员例行工作 - * @param formDTO - * @author zxc - * @date 2021/10/19 1:35 下午 - */ - @Transactional(rollbackFor = Exception.class) - @Override - public void gridUserWork(GridUserWorkFormDTO formDTO) { - GridUserWorkEntity entity = ConvertUtils.sourceToTarget(formDTO, GridUserWorkEntity.class); - CustomerGridFormDTO gridFormDTO = new CustomerGridFormDTO(); - gridFormDTO.setGridId(formDTO.getGridId()); - Result gridBaseInfoData = govOrgOpenFeignClient.getGridBaseInfoByGridId(gridFormDTO); - if (!gridBaseInfoData.success()){ - throw new RenException("查询网格基本信息失败......"); - } - CustomerGridDTO gridBaseInfo = gridBaseInfoData.getData(); - entity.setGridName(gridBaseInfo.getGridName()); - // 暂时为 哈哈,后期缓存加上 gridCode在修改 - entity.setGridCode("哈哈"); - entity.setCustomerId(gridBaseInfo.getCustomerId()); - entity.setParentOrgId(gridBaseInfo.getPid()); - entity.setOrgName(gridBaseInfo.getAgencyName()); - entity.setPids(gridBaseInfo.getPids()); - baseDao.insert(entity); - } - -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java new file mode 100644 index 0000000000..9a4b73bb26 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java @@ -0,0 +1,132 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.form.DictListFormDTO; +import com.epmet.commons.tools.dto.result.DictListResultDTO; +import com.epmet.commons.tools.enums.DictTypeEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.PatrolRoutineWorkDao; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.GridUserWorkFormDTO; +import com.epmet.entity.PatrolRoutineWorkEntity; +import com.epmet.entity.PatrolRoutineWorkTypeEntity; +import com.epmet.feign.EpmetAdminOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.service.PatrolRoutineWorkService; +import com.epmet.service.PatrolRoutineWorkTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Service +public class PatrolRoutineWorkServiceImpl extends BaseServiceImpl implements PatrolRoutineWorkService { + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired + private EpmetAdminOpenFeignClient adminOpenFeignClient; + @Autowired + private LoginUserUtil loginUserUtil; + @Autowired + PatrolRoutineWorkTypeService patrolRoutineWorkTypeService; + + /** + * @Description 网格员例行工作 + * @param formDTO + * @author zxc + * @date 2021/10/19 1:35 下午 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void gridUserWork(GridUserWorkFormDTO formDTO) { + PatrolRoutineWorkEntity entity = ConvertUtils.sourceToTarget(formDTO, PatrolRoutineWorkEntity.class); + + CustomerGridFormDTO gridFormDTO = new CustomerGridFormDTO(); + gridFormDTO.setGridId(formDTO.getGridId()); + Result gridBaseInfoData = govOrgOpenFeignClient.getGridBaseInfoByGridId(gridFormDTO); + if (!gridBaseInfoData.success()){ + throw new EpmetException("查询网格基本信息失败......"); + } + CustomerGridDTO gridBaseInfo = gridBaseInfoData.getData(); + entity.setPids(gridBaseInfo.getPids()); + //entity.setUserId(loginUserUtil.getLoginUserId()); + //entity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + + entity.setUserId("loginUserUtil.getLoginUserId()"); + entity.setCustomerId("loginUserUtil.getLoginUserCustomerId()"); + baseDao.insert(entity); + + DictListFormDTO param = new DictListFormDTO(); + param.setDictType(DictTypeEnum.PATROL_WORK_TYPE.getCode()); + Result> mapResult = adminOpenFeignClient.dictList(param); + if (mapResult == null || !mapResult.success() || CollectionUtils.isEmpty(mapResult.getData())){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"例行工作类型字典获取失败!"); + } + Map> dictMap = mapResult.getData().stream().collect(Collectors.groupingBy(DictListResultDTO::getPValue)); + + Map allPCodeMap = new HashMap<>(); + dictMap.forEach((pCode,list)->{ + if (NumConstant.ZERO_STR.equals(pCode)){ + return; + } + list.forEach(dict->{ + String code = dict.getValue(); + StringBuilder stringBuilder = allPCodeMap.get(code); + if (stringBuilder == null){ + stringBuilder = new StringBuilder(); + allPCodeMap.put(code, stringBuilder); + } + stringBuilder.insert(dict.getPValue().length()/2,code).append(StrConstant.COLON); + }); + + }); + List workTypeList = new ArrayList<>(); + formDTO.getWorkTypeList().forEach(code->{ + PatrolRoutineWorkTypeEntity typeEntity = new PatrolRoutineWorkTypeEntity(); + typeEntity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + typeEntity.setRoutineWorkId(entity.getId()); + typeEntity.setWorkTypeCode(code); + typeEntity.setAllPCode(allPCodeMap.get(code).toString()); + workTypeList.add(typeEntity); + }); + patrolRoutineWorkTypeService.insertBatch(workTypeList); + + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkTypeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkTypeServiceImpl.java new file mode 100644 index 0000000000..185d69ac4d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkTypeServiceImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.PatrolRoutineWorkTypeDao; +import com.epmet.entity.PatrolRoutineWorkTypeEntity; +import com.epmet.service.PatrolRoutineWorkTypeService; +import org.springframework.stereotype.Service; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Service +public class PatrolRoutineWorkTypeServiceImpl extends BaseServiceImpl implements PatrolRoutineWorkTypeService { + + +} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GridUserWorkDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GridUserWorkDao.xml deleted file mode 100644 index 70467112b6..0000000000 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GridUserWorkDao.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkDao.xml new file mode 100644 index 0000000000..15dfb4836c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkDao.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkTypeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkTypeDao.xml new file mode 100644 index 0000000000..cec9ea0941 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkTypeDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file