diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java index 72d2e072b4..ca3e901d44 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java @@ -166,6 +166,16 @@ public enum RequirePermissionEnum { MORE_BADGE_MANAGE_EDIT("more_badge_manage_edit","更多:徽章:徽章管理:编辑","编辑徽章"), MORE_BADGE_MANAGE_DELETE("more_badge_manage_delete","更多:徽章:徽章管理:删除","删除徽章"), + /** + * 更多-日志记录 + */ + MORE_PATROL_RECORD_LIST("more_patrol_record_list","更多:日志记录:巡查记录:列表","巡查记录列表"), + /** + * 更多-系统 + */ + MORE_SYSTEM_LOG_LIST("MORE_SYSTEM_LOG_LIST","更多:系统:系统日志:列表","系统日志列表"), + + /** * 项目立项 */ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index a38c4cbb0e..3faf895eb5 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -87,6 +87,7 @@ public enum EpmetErrorCode { EXIT_PEND_PROJECT(8408,"该工作人员有项目尚在处理,处理完毕方可操作"), EXIT_PUBLISHED_ACTIVITY(8409,"该工作人员有活动尚在进行,等活动完成方可操作"), CAN_NOT_SELF(8410,"无法对自己进行操作"), + PATROL_IS_NOT_OVER(8520,"巡查尚未结束"), ALREADY_EVALUATE(8501,"您已评价"), ALREADY_VOTE(8502,"您已表态"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index a2f88e4133..3a556da632 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -608,6 +608,24 @@ public class DateUtils { return minutes; } + + /** + * @return java.lang.Integer + * @param startDate + * @param endDate + * @author yinzuomei + * @description 计算两个时间点之间相隔秒数 + * @Date 2020/7/29 13:38 + **/ + public static Integer calculateSecond(Date startDate,Date endDate){ + long start=startDate.getTime(); + long end=endDate.getTime(); + // 计算差多少分钟 + int second = (int) ((end - start) / 1000); + System.out.println("两个时间之间的分钟差为:" + second); + return second; + } + /** * @return java.lang.String * @param dateOne @@ -818,4 +836,15 @@ public class DateUtils { return date; } + /** + * @Author sun + * @Description 获取当前日期几个自然月之前的日期(yyyy-MM-dd HH:mm:ss) + **/ + public static String getBeforeMonthDate(int beforMonth){ + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, - beforMonth); + Date date = c.getTime(); + return DateUtils.format(date,DateUtils.DATE_TIME_PATTERN); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolDetailDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolDetailDTO.java new file mode 100644 index 0000000000..def0db685a --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolDetailDTO.java @@ -0,0 +1,131 @@ +/** + * 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.dataaggre.dto.epmetuser; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Data +public class StaffPatrolDetailDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * staff_patrol_record.ID + */ + private String staffPatrolRecId; + + /** + * 前端给的序号 + */ + private Integer serialNum; + + /** + * 上传时间,后台自动插入该时间 + */ + private Date uploadTime; + + /** + * 纬度 + */ + private String latitude; + + /** + * 经度 + */ + private String longitude; + + /** + * 速度,单位m/s;开始和结束时默认0 + */ + private String speed; + + /** + * 位置的精确度 + */ + private String accuracy; + + /** + * 高度,单位米 + */ + private String altitude; + + /** + * 垂直经度,单位m + */ + private String verticalaccuracy; + + /** + * 水平经度,单位m + */ + private String horizontalaccuracy; + + /** + * 地址;暂时不用 + */ + private String address; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolRecordDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolRecordDTO.java new file mode 100644 index 0000000000..be8e0300f3 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolRecordDTO.java @@ -0,0 +1,121 @@ +/** + * 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.dataaggre.dto.epmetuser; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Data +public class StaffPatrolRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格id + */ + private String grid; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 巡查开始时间 + */ + private Date patrolStartTime; + + /** + * 巡查结束时间,前端传入 + */ + private Date patrolEndTime; + + /** + * 实际结束时间=操作结束巡查的时间 + */ + private Date actrualEndTime; + + /** + * 本次巡查总耗时,单位秒;结束巡查时写入 + */ + private Integer totalTime; + + /** + * 正在巡查中:patrolling;结束:end + */ + private String status; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolDateListFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolDateListFormDTO.java new file mode 100644 index 0000000000..9ee50f8930 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolDateListFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/10 14:31 + */ +@NoArgsConstructor +@Data +public class PatrolDateListFormDTO implements Serializable { + + private static final long serialVersionUID = -3120791500214908595L; + public interface PatrolDateListGroup {} + + @NotBlank(message = "网格Id不能为空",groups = PatrolDateListGroup.class) + private String gridId; + @NotBlank(message = "工作人员ID不能为空",groups = PatrolDateListGroup.class) + private String staffId; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolRecordListFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolRecordListFormDTO.java new file mode 100644 index 0000000000..c9cc99344b --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolRecordListFormDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 16:23 + */ +@Data +@NoArgsConstructor +public class PatrolRecordListFormDTO implements Serializable { + private static final long serialVersionUID = 7496587490046732883L; + public interface PatrolRecordListGroup {} + + /** + * 巡查日期,格式:yyyy-MM-dd + */ + @NotBlank(message = "巡查日期不能为空",groups = PatrolRecordListGroup.class) + private String patrolDate; + /** + * 网格Id + */ + @NotBlank(message = "网格Id不能为空",groups = PatrolRecordListGroup.class) + private String gridId; + /** + * 用户ID + */ + @NotBlank(message = "用户ID不能为空",groups = PatrolRecordListGroup.class) + private String userId; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java new file mode 100644 index 0000000000..4945b5de46 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java @@ -0,0 +1,54 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Description 巡查-各人员巡查记录列表查询-接口入参 + * @Auth sun + */ +@Data +public class StaffListFormDTO implements Serializable { + + private static final long serialVersionUID = -3381286960911634231L; + /** + * 近1一个月传1; 近3个月传3【自然月分】 + */ + @NotNull(message = "最近时间不能为空", groups = StaffListFormDTO.Staff.class) + private Integer time; + /** + * 排序字段【巡查总次数:patrolTotal;最近开始巡查时间:latestPatrolledTime】 + */ + @NotBlank(message = "排序条件不能为空", groups = StaffListFormDTO.Staff.class) + private String sortCode; + /** + * 网格id集合,为空则查询当前组织下所有网格数据 + */ + private List gridIds; + /** + * 工作人员姓名;可空 + */ + private String staffName; + /** + * 页码 + * */ + @Min(1) + private Integer pageNo; + /** + * 每页多少条 + * */ + private Integer pageSize = 20; + //token中用户Id + private String userId; + //起止巡查开始时间 + private String patrolStartTime; + public interface Staff extends CustomerClientShowGroup {} + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDateListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDateListResultDTO.java new file mode 100644 index 0000000000..e51ce38b2a --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDateListResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/10 14:32 + */ +@NoArgsConstructor +@Data +public class PatrolDateListResultDTO implements Serializable { + + private static final long serialVersionUID = -1516170049255588336L; + private String startDate; + private List list; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordDetailDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordDetailDTO.java new file mode 100644 index 0000000000..922f21867b --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordDetailDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/9 14:38 + */ +@NoArgsConstructor +@Data +public class PatrolRecordDetailDTO implements Serializable { + private static final long serialVersionUID = 757994412954699222L; + /** + * 上传时间;yyyy-MM-dd HH:mm + */ + private String uploadTime; + /** + * 纬度 + */ + private String latitude; + /** + * 经度 + */ + private String longitude; + /** + * 速度,单位m/s + */ + private String speed; + /** + * 后端返回:开始巡查;结束巡查;此列只有集合第一条,和最后一条有值 + */ + private String flag; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordListResultDTO.java new file mode 100644 index 0000000000..d59abe39de --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordListResultDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 16:24 + */ +@NoArgsConstructor +@Data +public class PatrolRecordListResultDTO implements Serializable { + + private static final long serialVersionUID = -8808482239766626564L; + /** + * 巡查记录id + */ + private String staffPatrolRecId; + /** + * 总时长描述,后端返回格式:XX小时XX分;前端直接展示 + */ + private String totalTimeDesc; + /** + * 开始时间;yyyy-MM-dd HH:mm + */ + private String patrolStartTime; + /** + * 结束时间;yyyy-MM-dd HH:mm + */ + private String patrolEndTime; + /** + * 巡查中:patrolling;已结束:end;如果是巡查中,界面不展示结束时间这一行 + */ + private String status; + /** + * 后端返回:巡查员最近地址变动是XX分钟前 + */ + private String latestChangeDesc; + /** + * 巡查记录详情 + */ + private List details; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java new file mode 100644 index 0000000000..15f2647e88 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 巡查-各人员巡查记录列表查询-接口入参 + * @Auth sun + */ +@Data +public class StaffListResultDTO implements Serializable { + private static final long serialVersionUID = 7129564173128153335L; + + //工作人员所属网格id + private String gridId = ""; + //工作人员所在网格名称,最多显示到网格的上两级 + private String gridName = ""; + //工作人员用户id + private String staffId = ""; + //真名 + private String staffName = ""; + //最近巡查时间[最近一次进行中或已结束巡查的开始时间] + private String patrolStartTime = ""; + //巡查总次数 + private Integer patrolTotal = 0; + //性别0.未知,1男,2.女前端默认头像用 + private String gender = "0"; + //正在巡查中:patrolling;否则返回空字符串 + private String status = ""; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java index 583b66f4f1..f01ef8a3d4 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java @@ -1,8 +1,25 @@ package com.epmet.dataaggre.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; +import com.epmet.dataaggre.service.epmetuser.EpmetUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * @Author zxc * @DateTime 2020/12/25 上午9:45 @@ -10,4 +27,54 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("epmetuser") public class EpmetUserController { + + @Autowired + private EpmetUserService epmetUserService; + + + /** + * @Param formDTO + * @Description 001、各人员巡查记录列表查询 + * @author sun + */ + @PostMapping("stafflist") + public Result> staffList(@LoginUser TokenDto tokenDto, @RequestBody StaffListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, StaffListFormDTO.Staff.class); + if (!"patrolTotal".equals(formDTO.getSortCode()) && !"latestPatrolledTime".equals(formDTO.getSortCode())) { + throw new RenException("参数错误,排序条件值错误"); + } + if (formDTO.getTime() != 1 && formDTO.getTime() != 3) { + throw new RenException("参数错误,最近时间值不正确"); + } + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(epmetUserService.staffList(formDTO)); + } + + /** + * 巡查记录列表查询 + * @author zhaoqifeng + * @date 2021/6/9 14:48 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("recordlist") + public Result> recordList(@RequestBody PatrolRecordListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(epmetUserService.recordList(formDTO)); + } + + /** + * 历史巡查日期查询 + * @author zhaoqifeng + * @date 2021/6/10 14:36 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("patrolleddatelist") + public Result patrolDateList(@RequestBody PatrolDateListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(epmetUserService.patrolDateList(formDTO)); + } + + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolDetailDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolDetailDao.java new file mode 100644 index 0000000000..bb2247f220 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolDetailDao.java @@ -0,0 +1,34 @@ +/** + * 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.dataaggre.dao.epmetuser; + + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.entity.epmetuser.StaffPatrolDetailEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Mapper +public interface StaffPatrolDetailDao extends BaseDao { + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java new file mode 100644 index 0000000000..5c6cb03bdb --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java @@ -0,0 +1,44 @@ +/** + * 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.dataaggre.dao.epmetuser; + + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; +import com.epmet.dataaggre.entity.epmetuser.StaffPatrolRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Mapper +public interface StaffPatrolRecordDao extends BaseDao { + + /** + * @Description 按条件查询巡查业务数据 + * @author sun + */ + List selectPatrolList(StaffListFormDTO formDTO); + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java index 1da9910104..cc73cc2c1f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java @@ -18,6 +18,7 @@ package com.epmet.dataaggre.dao.govorg; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.result.GridInfoResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO; import com.epmet.dataaggre.entity.govorg.CustomerGridEntity; @@ -54,4 +55,11 @@ public interface CustomerGridDao extends BaseDao { * @Description 根据组织Id查询当前组织下所有网格列表 **/ List selectGridListByAgencyId(@Param("agencyId") String agencyId); + + /** + * @param staffId + * @Author sun + * @Description 查询工作人员所属组织下网格列表 + **/ + List gridListByStaffId(@Param("staffId") String staffId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffPatrolDetailEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffPatrolDetailEntity.java new file mode 100644 index 0000000000..c74f88b459 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffPatrolDetailEntity.java @@ -0,0 +1,101 @@ +/** + * 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.dataaggre.entity.epmetuser; + +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-06-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_patrol_detail") +public class StaffPatrolDetailEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * staff_patrol_record.ID + */ + private String staffPatrolRecId; + + /** + * 前端给的序号 + */ + private Integer serialNum; + + /** + * 上传时间,后台自动插入该时间 + */ + private Date uploadTime; + + /** + * 纬度 + */ + private String latitude; + + /** + * 经度 + */ + private String longitude; + + /** + * 速度,单位m/s;开始和结束时默认0 + */ + private String speed; + + /** + * 位置的精确度 + */ + private String accuracy; + + /** + * 高度,单位米 + */ + private String altitude; + + /** + * 垂直经度,单位m + */ + private String verticalaccuracy; + + /** + * 水平经度,单位m + */ + private String horizontalaccuracy; + + /** + * 地址;暂时不用 + */ + private String address; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffPatrolRecordEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffPatrolRecordEntity.java new file mode 100644 index 0000000000..f15187a712 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffPatrolRecordEntity.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.dataaggre.entity.epmetuser; + +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-06-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_patrol_record") +public class StaffPatrolRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格id + */ + private String grid; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 巡查开始时间 + */ + private Date patrolStartTime; + + /** + * 巡查结束时间,前端传入 + */ + private Date patrolEndTime; + + /** + * 实际结束时间=操作结束巡查的时间 + */ + private Date actrualEndTime; + + /** + * 本次巡查总耗时,单位秒;结束巡查时写入 + */ + private Integer totalTime; + + /** + * 正在巡查中:patrolling;结束:end + */ + private String status; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index d6e03f7f40..2a27686184 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -1,5 +1,11 @@ package com.epmet.dataaggre.service.epmetuser; +import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; import java.util.List; @@ -26,4 +32,28 @@ public interface EpmetUserService { */ List selectUserIdByCustomerId(List userIds); + /** + * @Param formDTO + * @Description 001、各人员巡查记录列表查询 + * @author sun + */ + List staffList(StaffListFormDTO formDTO); + + /** + * 巡查记录列表查询 + * @author zhaoqifeng + * @date 2021/6/9 14:49 + * @param formDTO + * @return java.util.List + */ + List recordList(PatrolRecordListFormDTO formDTO); + + /** + * 历史巡查日期查询 + * @author zhaoqifeng + * @date 2021/6/10 14:36 + * @param formDTO + * @return com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO + */ + PatrolDateListResultDTO patrolDateList(PatrolDateListFormDTO formDTO); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolDetailService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolDetailService.java new file mode 100644 index 0000000000..54dccbe854 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolDetailService.java @@ -0,0 +1,44 @@ +/** + * 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.dataaggre.service.epmetuser; + + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO; +import com.epmet.dataaggre.entity.epmetuser.StaffPatrolDetailEntity; + +import java.util.List; +import java.util.Map; + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +public interface StaffPatrolDetailService extends BaseService { + + /** + * 获取记录明细 + * @author zhaoqifeng + * @date 2021/6/9 15:09 + * @param recordIds + * @return java.util.Map> + */ + Map> getDetailByRecordIds(List recordIds); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolRecordService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolRecordService.java new file mode 100644 index 0000000000..a7bf7d5155 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolRecordService.java @@ -0,0 +1,55 @@ +/** + * 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.dataaggre.service.epmetuser; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO; +import com.epmet.dataaggre.entity.epmetuser.StaffPatrolRecordEntity; + +import java.util.List; + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +public interface StaffPatrolRecordService extends BaseService { + + /** + * 获取巡查记录列表 + * + * @param gridId + * @param userId + * @param patrolDate + * @return java.util.List + * @author zhaoqifeng + * @date 2021/6/9 14:55 + */ + List getRecordList(String gridId, String userId, String patrolDate); + + /** + * 获取日期列表 + * @author zhaoqifeng + * @date 2021/6/10 14:49 + * @param gridId + * @param staffId + * @return java.util.List + */ + List getDateList(String gridId, String staffId); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 2dac9b0ccd..fdbb43843b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -1,15 +1,31 @@ package com.epmet.dataaggre.service.epmetuser.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.epmetuser.StaffPatrolRecordDao; import com.epmet.dataaggre.dao.epmetuser.UserBaseInfoDao; -import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; +import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO; +import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO; +import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.result.*; +import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; +import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService; +import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService; +import com.epmet.dataaggre.service.govorg.GovOrgService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; /** * @Author zxc @@ -22,6 +38,14 @@ public class EpmetUserServiceImpl implements EpmetUserService { @Autowired private UserBaseInfoDao userBaseInfoDao; + @Autowired + private GovOrgService govOrgService; + @Autowired + private StaffPatrolRecordDao staffPatrolRecordDao; + @Resource + private StaffPatrolDetailService staffPatrolDetailService; + @Resource + private StaffPatrolRecordService staffPatrolRecordService; /** * @Description 根据UserIds查询 @@ -44,4 +68,112 @@ public class EpmetUserServiceImpl implements EpmetUserService { public List selectUserIdByCustomerId(List userIds) { return userBaseInfoDao.selectUserIdByCustomerId(userIds); } + + /** + * @Param formDTO + * @Description 001、各人员巡查记录列表查询 + * @author sun + */ + @Override + public List staffList(StaffListFormDTO formDTO) { + List resultList = new ArrayList<>(); + //1.设置分页参数 + int num = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(num); + + //2.查询当前人员所属组织下网格列表数据,供后续使用 + List list = govOrgService.gridListByStaffId(formDTO.getUserId()); + if (list.size() < NumConstant.ONE) { + return resultList; + } + //网格集合为空则查询当前人员所属组织下网格列表 + if (CollectionUtils.isEmpty(formDTO.getGridIds())) { + formDTO.setGridIds(list.stream().map(CustomerGridDTO::getId).collect(Collectors.toList())); + } + + //3.按条件查询巡查业务数据 + formDTO.setPatrolStartTime(DateUtils.getBeforeMonthDate(formDTO.getTime())); + resultList = staffPatrolRecordDao.selectPatrolList(formDTO); + if (resultList.size() < NumConstant.ONE) { + return new ArrayList<>(); + } + + //4.封装数据并返回 + resultList.forEach(re -> list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName()))); + return resultList; + } + + /** + * 巡查记录列表查询 + * + * @param formDTO + * @return java.util.List + * @author zhaoqifeng + * @date 2021/6/9 14:49 + */ + @Override + public List recordList(PatrolRecordListFormDTO formDTO) { + List recordList = staffPatrolRecordService.getRecordList(formDTO.getGridId(), formDTO.getUserId(), formDTO.getPatrolDate()); + if (CollectionUtils.isEmpty(recordList)) { + return Collections.emptyList(); + } + List recordIds = recordList.stream().map(StaffPatrolRecordDTO :: getId).collect(Collectors.toList()); + Map> details = staffPatrolDetailService.getDetailByRecordIds(recordIds); + + List result = recordList.stream().map(record -> { + PatrolRecordListResultDTO dto = new PatrolRecordListResultDTO(); + dto.setStaffPatrolRecId(record.getId()); + dto.setStatus(record.getStatus()); + dto.setPatrolStartTime(DateUtils.format(record.getPatrolStartTime(), DateUtils.DATE_TIME_PATTERN)); + dto.setPatrolEndTime(DateUtils.format(record.getPatrolEndTime(), DateUtils.DATE_TIME_PATTERN)); + Integer minutes; + if (("patrolling").equals(record.getStatus())) { + minutes = DateUtils.calculateMin(record.getPatrolStartTime(), new Date()); + String latestChangeDesc = "后端返回:巡查员最近地址变动是" + minutes + "分钟前"; + dto.setLatestChangeDesc(latestChangeDesc); + } else { + minutes = record.getTotalTime() / 60; + } + String totalTimeDesc = minutes / 60 + "小时"+ minutes % 60 + "分"; + dto.setTotalTimeDesc(totalTimeDesc); + List detailList = details.get(record.getId()); + List recordDetails = + detailList.stream().sorted(Comparator.comparing(StaffPatrolDetailDTO::getSerialNum).reversed()).collect(Collectors.toList()).stream().map( detail -> { + PatrolRecordDetailDTO detailDTO = new PatrolRecordDetailDTO(); + detailDTO.setLatitude(detail.getLatitude()); + detailDTO.setLongitude(detail.getLongitude()); + detailDTO.setSpeed(detail.getSpeed()); + detailDTO.setUploadTime(DateUtils.format(detail.getUploadTime(), DateUtils.DATE_TIME_PATTERN)); + return detailDTO; + }).collect(Collectors.toList()); + if (("end").equals(record.getStatus())) { + recordDetails.get(NumConstant.ZERO).setFlag("结束巡查"); + } + recordDetails.get(recordDetails.size() - 1).setFlag("开始巡查"); + dto.setDetails(recordDetails); + return dto; + }).collect(Collectors.toList()); + return result; + } + + /** + * 历史巡查日期查询 + * + * @param formDTO + * @return com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO + * @author zhaoqifeng + * @date 2021/6/10 14:36 + */ + @Override + public PatrolDateListResultDTO patrolDateList(PatrolDateListFormDTO formDTO) { + List list = staffPatrolRecordService.getDateList(formDTO.getGridId(), formDTO.getStaffId()); + PatrolDateListResultDTO dto = new PatrolDateListResultDTO(); + if (CollectionUtils.isNotEmpty(list)) { + dto.setStartDate(list.get(NumConstant.ZERO)); + } + dto.setList(list); + return dto; + } + + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolDetailServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolDetailServiceImpl.java new file mode 100644 index 0000000000..98f41f75a3 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolDetailServiceImpl.java @@ -0,0 +1,71 @@ +/** + * 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.dataaggre.service.epmetuser.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.epmetuser.StaffPatrolDetailDao; +import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO; +import com.epmet.dataaggre.entity.epmetuser.StaffPatrolDetailEntity; +import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@DataSource(DataSourceConstant.EPMET_USER) +@Slf4j +@Service +public class StaffPatrolDetailServiceImpl extends BaseServiceImpl implements StaffPatrolDetailService { + + + /** + * 获取记录明细 + * + * @param recordIds + * @return java.util.Map> + * @author zhaoqifeng + * @date 2021/6/9 15:09 + */ + @Override + public Map> getDetailByRecordIds(List recordIds) { + if (CollectionUtils.isEmpty(recordIds)) { + return Collections.emptyMap(); + } + StringBuilder sql = new StringBuilder("( STAFF_PATROL_REC_ID = '' "); + for (String id : recordIds) { + sql.append("OR STAFF_PATROL_REC_ID = '").append(id).append("' "); + } + sql.append(")"); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.apply(sql.toString()); + List list = ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), StaffPatrolDetailDTO.class); + return list.stream().collect(Collectors.groupingBy(StaffPatrolDetailDTO::getStaffPatrolRecId)); + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolRecordServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolRecordServiceImpl.java new file mode 100644 index 0000000000..67eb153f04 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolRecordServiceImpl.java @@ -0,0 +1,93 @@ +/** + * 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.dataaggre.service.epmetuser.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.epmetuser.StaffPatrolRecordDao; +import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO; +import com.epmet.dataaggre.entity.epmetuser.StaffPatrolRecordEntity; +import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@DataSource(DataSourceConstant.EPMET_USER) +@Slf4j +@Service +public class StaffPatrolRecordServiceImpl extends BaseServiceImpl implements StaffPatrolRecordService { + + + /** + * 获取巡查记录列表 + * + * @param gridId + * @param userId + * @param patrolDate + * @return java.util.List + * @author zhaoqifeng + * @date 2021/6/9 14:55 + */ + @Override + public List getRecordList(String gridId, String userId, String patrolDate) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("GRID", gridId) + .eq("STAFF_ID", userId) + .eq("DATE_FORMAT(PATROL_START_TIME,'%Y-%m-%d') ", patrolDate) + .orderByDesc("PATROL_START_TIME"); + + return ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), StaffPatrolRecordDTO.class); + } + + /** + * 获取日期列表 + * + * @param gridId + * @param staffId + * @return java.util.List + * @author zhaoqifeng + * @date 2021/6/10 14:49 + */ + @Override + public List getDateList(String gridId, String staffId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.select("DISTINCT DATE_FORMAT(PATROL_START_TIME,'%Y-%m-%d') AS ID") + .eq("GRID", gridId) + .eq("STAFF_ID", staffId) + .orderByAsc("PATROL_START_TIME"); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + + return list.stream().map(StaffPatrolRecordEntity::getId).collect(Collectors.toList()); + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java index 916044b1f3..c79837ec60 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java @@ -1,5 +1,6 @@ package com.epmet.dataaggre.service.govorg; +import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridInfoResultDTO; @@ -48,4 +49,11 @@ public interface GovOrgService { List queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO); List queryNextOrgInfoDTO(String customerId, String orgId); + + /** + * @param staffId + * @Author sun + * @Description 查询工作人员所属组织下网格列表 + **/ + List gridListByStaffId(String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index ec45f0419f..e3c9752a00 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -9,6 +9,7 @@ import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.dao.govorg.CustomerAgencyDao; import com.epmet.dataaggre.dao.govorg.CustomerGridDao; import com.epmet.dataaggre.dao.govorg.CustomerStaffAgencyDao; +import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO; import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO; @@ -225,5 +226,16 @@ public class GovOrgServiceImpl implements GovOrgService { System.out.println(JSON.toJSONString(allList, true)); } + /** + * @param staffId + * @Author sun + * @Description 查询工作人员所属组织下网格列表 + **/ + @Override + public List gridListByStaffId(String staffId) { + //网格名是拼接上两级组织名称 + List resultList = customerGridDao.gridListByStaffId(staffId); + return resultList; + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolDetailDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolDetailDao.xml new file mode 100644 index 0000000000..c06344967c --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolDetailDao.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml new file mode 100644 index 0000000000..a0f8a495e0 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml @@ -0,0 +1,52 @@ + + + + + + + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml index 331246a2f5..3d00ea3cd4 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml @@ -52,4 +52,38 @@ AND pid = #{agencyId} + + diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/StaffPatrolDetailDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/StaffPatrolDetailDTO.java new file mode 100644 index 0000000000..a5f33265d5 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/StaffPatrolDetailDTO.java @@ -0,0 +1,131 @@ +/** + * 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-06-07 + */ +@Data +public class StaffPatrolDetailDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * staff_patrol_record.ID + */ + private String staffPatrolRecId; + + /** + * 前端给的序号 + */ + private Integer serialNum; + + /** + * 上传时间,后台自动插入该时间 + */ + private Date uploadTime; + + /** + * 纬度 + */ + private String latitude; + + /** + * 经度 + */ + private String longitude; + + /** + * 速度,单位m/s;开始和结束时默认0 + */ + private String speed; + + /** + * 位置的精确度 + */ + private String accuracy; + + /** + * 高度,单位米 + */ + private String altitude; + + /** + * 垂直经度,单位m + */ + private String verticalaccuracy; + + /** + * 水平经度,单位m + */ + private String horizontalaccuracy; + + /** + * 地址;暂时不用 + */ + private String address; + + /** + * 删除标识 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-module/data-report/data-report-client/src/main/java/com/epmet/dto/StaffPatrolRecordDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/StaffPatrolRecordDTO.java new file mode 100644 index 0000000000..ef6b517d61 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/StaffPatrolRecordDTO.java @@ -0,0 +1,121 @@ +/** + * 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-06-07 + */ +@Data +public class StaffPatrolRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格id + */ + private String grid; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 巡查开始时间 + */ + private Date patrolStartTime; + + /** + * 巡查结束时间,前端传入 + */ + private Date patrolEndTime; + + /** + * 实际结束时间=操作结束巡查的时间 + */ + private Date actrualEndTime; + + /** + * 本次巡查总耗时,单位秒;结束巡查时写入 + */ + private Integer totalTime; + + /** + * 正在巡查中:patrolling;结束:end + */ + private String status; + + /** + * 删除标识 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-module/data-report/data-report-client/src/main/java/com/epmet/user/form/GridManagerListFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/GridManagerListFormDTO.java new file mode 100644 index 0000000000..7f2e582ef3 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/GridManagerListFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.user.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/7 2:57 下午 + * @DESC + */ +@Data +public class GridManagerListFormDTO implements Serializable { + + private static final long serialVersionUID = -7624307754570242679L; + + public interface GridManagerListForm{} + + @NotBlank(message = "组织ID不能为空",groups = GridManagerListForm.class) + private String agencyId; + + /** + * 行政区域编码 【平阴传】 + */ + private String areaCode; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/GridManagerListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/GridManagerListResultDTO.java new file mode 100644 index 0000000000..986350e424 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/GridManagerListResultDTO.java @@ -0,0 +1,76 @@ +package com.epmet.user.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/7 2:57 下午 + * @DESC + */ +@Data +public class GridManagerListResultDTO implements Serializable { + + private static final long serialVersionUID = 3606724812822179356L; + + /** + * 工作人员id + */ + private String staffId; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + + /** + * 网格ID + */ + private String gridId; + + /** + * 正在巡查:patrolling;否则返回空字符串 + */ + private String status; + + /** + * 网格名称,最多显示上两级 + */ + private String gridName; + + /** + * 姓名 + */ + private String staffName; + + /** + * 中心点位 + */ + @JsonIgnore + private String centerMark; + + /** + * 经纬度赋值状态 + */ + @JsonIgnore + private Boolean llStatus; + + public GridManagerListResultDTO() { + this.staffId = ""; + this.longitude = ""; + this.latitude = ""; + this.gridId = ""; + this.status = ""; + this.gridName = ""; + this.staffName = ""; + this.centerMark = ""; + this.llStatus = false; + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java new file mode 100644 index 0000000000..eff0bdd451 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java @@ -0,0 +1,20 @@ +package com.epmet.datareport.constant; + +/** + * @Author zxc + * @DateTime 2021/6/9 1:49 下午 + * @DESC + */ +public interface PatrolConstant { + + /** + * 经度 + */ + String LONGITUDE = "longitude"; + + /** + * 纬度 + */ + String LATITUDE = "latitude"; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java new file mode 100644 index 0000000000..72329ea1a1 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java @@ -0,0 +1,66 @@ +package com.epmet.datareport.controller.user; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.datareport.service.user.StaffPatrolDetailService; +import com.epmet.user.form.GridManagerListFormDTO; +import com.epmet.dto.form.PatrolTrackFormDTO; +import com.epmet.dto.form.RecordListFormDTO; +import com.epmet.user.result.GridManagerListResultDTO; +import com.epmet.dto.result.PatrolTrackResultDTO; +import com.epmet.dto.result.RecordListResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@RestController +@RequestMapping("staffpatrol") +public class StaffPatrolDetailController { + + @Autowired + private StaffPatrolDetailService staffPatrolService; + + /** + * @Description 001、网格员分布 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:06 下午 + */ + @PostMapping("gridmanagerlist") + public Result> gridManagerList(@RequestBody GridManagerListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GridManagerListFormDTO.GridManagerListForm.class); + return new Result>().ok(staffPatrolService.gridManagerList(formDTO)); + } + + /** + * @Description 002、查看巡查记录 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:25 下午 + */ + @PostMapping("recordlist") + public Result> recordList(@RequestBody RecordListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, RecordListFormDTO.RecordListForm.class); + return new Result>().ok(staffPatrolService.recordList(formDTO)); + } + + /** + * @Description 003、巡查轨迹 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:35 下午 + */ + @PostMapping("patroltrack") + public Result> patrolTrack(@RequestBody PatrolTrackFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, PatrolTrackFormDTO.PatrolTrackForm.class); + return new Result>().ok(staffPatrolService.patrolTrack(formDTO)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolRecordController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolRecordController.java new file mode 100644 index 0000000000..90a99c3d64 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolRecordController.java @@ -0,0 +1,21 @@ +package com.epmet.datareport.controller.user; + +import com.epmet.datareport.service.user.StaffPatrolRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@RestController +@RequestMapping("staffpatrolrecord") +public class StaffPatrolRecordController { + + @Autowired + private StaffPatrolRecordService staffPatrolRecordService; + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index a0992f8d97..986a880aac 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -22,6 +22,7 @@ import com.epmet.dto.result.plugins.AgencyNodeDTO; import com.epmet.dto.result.plugins.DeptNodeDTO; import com.epmet.dto.result.plugins.GridNodeDTO; import com.epmet.evaluationindex.screen.dto.result.*; +import com.epmet.user.result.GridManagerListResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -161,4 +162,12 @@ public interface ScreenCustomerAgencyDao { List getNextAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId); List selectSubAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId); + + /** + * @Description 根据agencyId查询网格 + * @Param agencyId + * @author zxc + * @date 2021/6/8 1:27 下午 + */ + List selectGrid(@Param("agencyId")String agencyId,@Param("areaCode")String areaCode); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolDetailDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolDetailDao.java new file mode 100644 index 0000000000..fafcc77d6e --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolDetailDao.java @@ -0,0 +1,45 @@ +/** + * 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.datareport.dao.user; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.datareport.entity.user.StaffPatrolDetailEntity; +import com.epmet.dto.result.PatrolTrackResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Mapper +public interface StaffPatrolDetailDao extends BaseDao { + + /** + * @Description 查询巡查轨迹 + * @Param staffPatrolRecId + * @author zxc + * @date 2021/6/7 5:13 下午 + */ + List selectPatrolTrack(@Param("staffPatrolRecId") String staffPatrolRecId); + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolRecordDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolRecordDao.java new file mode 100644 index 0000000000..19849b856b --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolRecordDao.java @@ -0,0 +1,55 @@ +/** + * 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.datareport.dao.user; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.datareport.entity.user.StaffPatrolRecordEntity; +import com.epmet.dto.form.RecordListFormDTO; +import com.epmet.user.result.GridManagerListResultDTO; +import com.epmet.dto.result.RecordListResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Mapper +public interface StaffPatrolRecordDao extends BaseDao { + + /** + * @Description 巡查记录查询 + * @Param formDTO + * @author zxc + * @date 2021/6/7 5:29 下午 + */ + List recordList(RecordListFormDTO formDTO); + + /** + * @Description 查询经纬度 + * @Param userIds + * @author zxc + * @date 2021/6/9 10:24 上午 + */ + List selectLL(@Param("userIds")List userIds); + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/user/StaffPatrolDetailEntity.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/user/StaffPatrolDetailEntity.java new file mode 100644 index 0000000000..fd00e1b58f --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/user/StaffPatrolDetailEntity.java @@ -0,0 +1,101 @@ +/** + * 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.datareport.entity.user; + +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-06-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_patrol_detail") +public class StaffPatrolDetailEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * staff_patrol_record.ID + */ + private String staffPatrolRecId; + + /** + * 前端给的序号 + */ + private Integer serialNum; + + /** + * 上传时间,后台自动插入该时间 + */ + private Date uploadTime; + + /** + * 纬度 + */ + private String latitude; + + /** + * 经度 + */ + private String longitude; + + /** + * 速度,单位m/s;开始和结束时默认0 + */ + private String speed; + + /** + * 位置的精确度 + */ + private String accuracy; + + /** + * 高度,单位米 + */ + private String altitude; + + /** + * 垂直经度,单位m + */ + private String verticalaccuracy; + + /** + * 水平经度,单位m + */ + private String horizontalaccuracy; + + /** + * 地址;暂时不用 + */ + private String address; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/user/StaffPatrolRecordEntity.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/user/StaffPatrolRecordEntity.java new file mode 100644 index 0000000000..7c37dd2813 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/user/StaffPatrolRecordEntity.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.datareport.entity.user; + +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-06-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_patrol_record") +public class StaffPatrolRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格id + */ + private String grid; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 巡查开始时间 + */ + private Date patrolStartTime; + + /** + * 巡查结束时间,前端传入 + */ + private Date patrolEndTime; + + /** + * 实际结束时间=操作结束巡查的时间 + */ + private Date actrualEndTime; + + /** + * 本次巡查总耗时,单位秒;结束巡查时写入 + */ + private Integer totalTime; + + /** + * 正在巡查中:patrolling;结束:end + */ + private String status; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenOrgService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenOrgService.java new file mode 100644 index 0000000000..3de2656f69 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenOrgService.java @@ -0,0 +1,23 @@ +package com.epmet.datareport.service.evaluationindex.screen; + +import com.epmet.user.result.GridManagerListResultDTO; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/6/8 10:45 上午 + * @DESC + */ +public interface ScreenOrgService { + + /** + * @Description 查询组织下的所有网格 + * @Param agencyId + * @Param areaCode + * @author zxc + * @date 2021/6/8 10:46 上午 + */ + List selectAllGrid(String agencyId,String areaCode); + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenOrgServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenOrgServiceImpl.java new file mode 100644 index 0000000000..c387350d34 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenOrgServiceImpl.java @@ -0,0 +1,44 @@ +package com.epmet.datareport.service.evaluationindex.screen.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; +import com.epmet.datareport.service.evaluationindex.screen.ScreenOrgService; +import com.epmet.user.result.GridManagerListResultDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/6/8 10:45 上午 + * @DESC + */ +@Service +@Slf4j +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class ScreenOrgServiceImpl implements ScreenOrgService { + + @Autowired + private ScreenCustomerAgencyDao agencyDao; + + /** + * @Description 查询组织下的所有网格 + * @Param agencyId + * @Param areaCode + * @author zxc + * @date 2021/6/8 10:46 上午 + */ + @Override + public List selectAllGrid(String agencyId,String areaCode) { + List result = agencyDao.selectGrid(agencyId, areaCode); + if (!CollectionUtils.isEmpty(result)){ + return result; + } + return new ArrayList<>(); + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java new file mode 100644 index 0000000000..98260990a3 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java @@ -0,0 +1,44 @@ +package com.epmet.datareport.service.user; + +import com.epmet.user.form.GridManagerListFormDTO; +import com.epmet.dto.form.PatrolTrackFormDTO; +import com.epmet.dto.form.RecordListFormDTO; +import com.epmet.user.result.GridManagerListResultDTO; +import com.epmet.dto.result.PatrolTrackResultDTO; +import com.epmet.dto.result.RecordListResultDTO; + +import java.util.List; + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +public interface StaffPatrolDetailService{ + + /** + * @Description 001、网格员分布 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:06 下午 + */ + List gridManagerList(GridManagerListFormDTO formDTO); + + /** + * @Description 002、查看巡查记录 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:25 下午 + */ + List recordList(RecordListFormDTO formDTO); + + /** + * @Description 003、巡查轨迹 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:35 下午 + */ + List patrolTrack(PatrolTrackFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolRecordService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolRecordService.java new file mode 100644 index 0000000000..e1d15008e5 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolRecordService.java @@ -0,0 +1,14 @@ +package com.epmet.datareport.service.user; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.datareport.entity.user.StaffPatrolRecordEntity; + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +public interface StaffPatrolRecordService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java new file mode 100644 index 0000000000..fb205ff276 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java @@ -0,0 +1,194 @@ +package com.epmet.datareport.service.user.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.datareport.constant.PatrolConstant; +import com.epmet.datareport.dao.user.StaffPatrolDetailDao; +import com.epmet.datareport.dao.user.StaffPatrolRecordDao; +import com.epmet.datareport.service.evaluationindex.screen.ScreenOrgService; +import com.epmet.datareport.service.user.StaffPatrolDetailService; +import com.epmet.dto.result.GridStaffResultDTO; +import com.epmet.dto.result.UserNameAndLLResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.user.form.GridManagerListFormDTO; +import com.epmet.dto.form.PatrolTrackFormDTO; +import com.epmet.dto.form.RecordListFormDTO; +import com.epmet.user.result.GridManagerListResultDTO; +import com.epmet.dto.result.PatrolTrackResultDTO; +import com.epmet.dto.result.RecordListResultDTO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Service +@Slf4j +public class StaffPatrolDetailServiceImpl implements StaffPatrolDetailService { + + @Autowired + private StaffPatrolDetailDao staffPatrolDetailDao; + + @Autowired + private StaffPatrolRecordDao staffPatrolRecordDao; + + @Autowired + private ScreenOrgService screenOrgService; + + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + + /** + * @Description 001、网格员分布 + * 1.根据agencyId或者areaCode查询出网格 + * 2.根据查出来的网格ID去查网格下边的人【人只要网格员】 + * 3.根据userId查询巡查记录表 + * 4.数据补全 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:06 下午 + */ + @Override + public List gridManagerList(GridManagerListFormDTO formDTO) { + List grids = new ArrayList<>(); + if (StringUtils.isEmpty(formDTO.getAreaCode())){ + // 根据agencyId查询网格 + grids = screenOrgService.selectAllGrid(formDTO.getAgencyId(), null); + }else { + // 根据areaCode查询网格 + grids = screenOrgService.selectAllGrid(null, formDTO.getAreaCode()); + } + if (CollectionUtils.isEmpty(grids)){ + return new ArrayList<>(); + } + List gridIds = grids.stream().map(m -> m.getGridId()).collect(Collectors.toList()); + // 查询网格下的网格员 + Result> resultData = govOrgOpenFeignClient.selectGridStaffByGridIds(gridIds); + if(!resultData.success()){ + throw new RenException("查询网格下的网格员失败【"+resultData.getMsg()+"】"); + } + List data = resultData.getData(); + if (CollectionUtils.isEmpty(data)){ + return new ArrayList<>(); + } + List result = ConvertUtils.sourceToTarget(data, GridManagerListResultDTO.class); + // 查询经纬度 + Result selectll = epmetUserOpenFeignClient.selectll(result.stream().map(m -> m.getStaffId()).collect(Collectors.toList())); + if (!selectll.success()){ + throw new RenException("查询经纬度和姓名失败【"+selectll.getMsg()+"】"); + } + UserNameAndLLResultDTO llAndNameData = selectll.getData(); + List finalGrids = grids; + result.forEach(r -> { + // 经纬度赋值 巡查状态赋值 + if (!CollectionUtils.isEmpty(llAndNameData.getLl())) { + llAndNameData.getLl().forEach(l -> { + if (r.getStaffId().equals(l.getStaffId()) && r.getGridId().equals(l.getGridId())) { + r.setLatitude(l.getLatitude()); + r.setLongitude(l.getLongitude()); + r.setStatus(l.getStatus()); + r.setLlStatus(true); + } + }); + } + // 姓名赋值 + if (!CollectionUtils.isEmpty(llAndNameData.getUserNames())){ + llAndNameData.getUserNames().forEach(n -> { + if (r.getStaffId().equals(n.getUserId())){ + r.setStaffName(n.getUserName()); + } + }); + } + finalGrids.forEach(g -> { + if (r.getGridId().equals(g.getGridId())){ + r.setGridName(g.getGridName()); + } + }); + }); + result.forEach(r -> { + if (!r.getLlStatus()){ + finalGrids.forEach(g -> { + if (StringUtils.isNotBlank(g.getCenterMark())){ + r.setLongitude(getLL(g.getCenterMark(),PatrolConstant.LONGITUDE)); + r.setLatitude(getLL(g.getCenterMark(),PatrolConstant.LATITUDE)); + } + }); + } + }); + return result; + } + + /** + * @Description 根据中心点位截取经纬度 + * @Param centMark + * @Param ll + * @author zxc + * @date 2021/6/9 2:08 下午 + */ + public String getLL(String centMark,String ll){ + if (ll.equals(PatrolConstant.LONGITUDE)){ + String longitude = centMark.substring(NumConstant.TWO, centMark.indexOf(",")); + return longitude; + }else { + String s = centMark.substring(NumConstant.ZERO, centMark.indexOf(",")); + String latitude = centMark.substring(s.length() + NumConstant.ONE, centMark.length() - NumConstant.TWO); + return latitude; + } + } + + /** + * @Description 002、查看巡查记录 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:25 下午 + */ + @Override + public List recordList(RecordListFormDTO formDTO) { + Result> listResult = epmetUserOpenFeignClient.recordList(formDTO); + if (!listResult.success()){ + throw new RenException("查询巡查记录失败【"+listResult.getMsg()+"】"); + } + List result = listResult.getData(); + if (!CollectionUtils.isEmpty(result)){ + return result; + } + return new ArrayList<>(); + } + + /** + * @Description 003、巡查轨迹 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:35 下午 + */ + @Override + public List patrolTrack(PatrolTrackFormDTO formDTO) { + Result> result = epmetUserOpenFeignClient.patrolTrack(formDTO); + if (!result.success()){ + throw new RenException("查询 巡查轨迹失败【"+result.getMsg()+"】"); + } + List results = result.getData(); + if (!CollectionUtils.isEmpty(results)){ + return results; + } + return new ArrayList<>(); + } + + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolRecordServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolRecordServiceImpl.java new file mode 100644 index 0000000000..35351b5746 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolRecordServiceImpl.java @@ -0,0 +1,21 @@ +package com.epmet.datareport.service.user.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.datareport.dao.user.StaffPatrolRecordDao; +import com.epmet.datareport.entity.user.StaffPatrolRecordEntity; +import com.epmet.datareport.service.user.StaffPatrolRecordService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Service +@Slf4j +public class StaffPatrolRecordServiceImpl extends BaseServiceImpl implements StaffPatrolRecordService { + + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 328bb2f753..4397b99fd6 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -320,4 +320,24 @@ + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolDetailDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolDetailDao.xml new file mode 100644 index 0000000000..2bf91e89f2 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolDetailDao.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolRecordDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolRecordDao.xml new file mode 100644 index 0000000000..02e4069ff7 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolRecordDao.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectGridDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectGridDailyDTO.java index c1f5f2ed12..fefcc025bb 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectGridDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectGridDailyDTO.java @@ -55,6 +55,11 @@ public class ScreenProjectGridDailyDTO implements Serializable { */ private String gridId; + /** + * 网格id + */ + private String gridName; + /** * 网格所属的组织id */ @@ -65,6 +70,11 @@ public class ScreenProjectGridDailyDTO implements Serializable { */ private String pids; + /** + * 网格所有的父级id,以英文:或者英文,隔开 + */ + private String centerMark; + /** * 截止到当前日期,网格内项目总数 */ @@ -149,4 +159,4 @@ public class ScreenProjectGridDailyDTO implements Serializable { this.delFlag = NumConstant.ZERO_STR; this.revision = NumConstant.ZERO; } -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CenterPointForm.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CenterPointForm.java new file mode 100644 index 0000000000..59cf43ebf1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CenterPointForm.java @@ -0,0 +1,18 @@ +package com.epmet.dto.screen.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * desc:修改组织中心点 + * @author liujianjun + */ +@Data +public class CenterPointForm implements Serializable { + private static final long serialVersionUID = 6425114459278919896L; + private String title; + private List center = new ArrayList<>(); +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java new file mode 100644 index 0000000000..22d1e569d3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java @@ -0,0 +1,31 @@ +package com.epmet.dto.screen.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * desc:修改组织中心点 + * @author liujianjun + */ +@Data +public class GridCenterPointForm implements Serializable { + + private static final long serialVersionUID = -6988009829971668860L; + + private String customerId; + private String pids; + + private List centerDataList = new ArrayList<>(); + + + /* @Data + public class CenterData implements Serializable{ + + private static final long serialVersionUID = 6425114459278919896L; + private String title; + private List center = new ArrayList<>(); + }*/ +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java index 761c62bb0b..e15b66e188 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java @@ -2,14 +2,18 @@ package com.epmet.controller; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.screen.form.GridCenterPointForm; import com.epmet.service.EIDimService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.Map; + /** * epmet_evaluation_index库的维度controller */ @@ -45,4 +49,14 @@ public class EIDimController { return new Result(); } + /** + * desc 更新网格的中心点位 + * @return + */ + @PostMapping("update/gridcenterpoint") + public Result upsertOrgCenterPoint(@RequestBody GridCenterPointForm param) { + Map effectRow = eiDimService.updateCenterPointByName(param); + return new Result().ok(effectRow); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java index 1d5099bc67..6aa2aacc1c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -40,8 +40,8 @@ import java.util.List; @Mapper public interface ScreenCustomerGridDao extends BaseDao { /** - *15、网格信息上传 - * 1) 根据CUSTOMER_ID 进行查询,如果有数据,则先进行物理删除, 一次删除1000条 + * 15、网格信息上传 + * 1) 根据CUSTOMER_ID 进行查询,如果有数据,则先进行物理删除, 一次删除1000条 * * @param customerId * @return java.util.Integer @@ -52,18 +52,18 @@ public interface ScreenCustomerGridDao extends BaseDao /** * 15、网格信息上传 - * 2) 在批量新增 + * 2) 在批量新增 * * @param list * @param customerId * @Author zhangyong * @Date 10:52 2020-08-18 **/ - void batchInsertCustomerGrid(@Param("list") List list, @Param("customerId")String customerId); + void batchInsertCustomerGrid(@Param("list") List list, @Param("customerId") String customerId); /** - * @return java.lang.Integer * @param customerId + * @return java.lang.Integer * @author yinzuomei * @description 查询客户下网格总数 * @Date 2020/8/26 15:33 @@ -71,17 +71,17 @@ public interface ScreenCustomerGridDao extends BaseDao Integer selectCountByCustomerId(@Param("customerId") String customerId); /** - * @return java.util.List * @param customerId + * @return java.util.List * @author yinzuomei * @description 查询客户下网格信息 * @Date 2020/8/26 15:33 **/ - List selectListByCustomerId(@Param("customerId")String customerId); + List selectListByCustomerId(@Param("customerId") String customerId); /** - * @return java.util.List * @param formDTO + * @return java.util.List * @author yinzuomei * @description 分页查询网格列表 * @Date 2020/8/27 14:42 @@ -89,7 +89,7 @@ public interface ScreenCustomerGridDao extends BaseDao List pageListByCustomerId(PageQueryGridFormDTO formDTO); /** - * @param gridId 网格id + * @param gridId 网格id * @return java.lang.String * @author yinzuomei * @description 查询网格所属的组织id @@ -107,28 +107,29 @@ public interface ScreenCustomerGridDao extends BaseDao * @Date 10:45 2020-09-04 **/ List selectListMismatchGridInfo(@Param("customerId") String customerId, - @Param("gridIds") String[] gridIds, - @Param("customerAreaCode") String customerAreaCode, - @Param("subCustomerIds")List subCustomerIds); + @Param("gridIds") String[] gridIds, + @Param("customerAreaCode") String customerAreaCode, + @Param("subCustomerIds") List subCustomerIds); /** * 根据客户id 查询网格(党支部)详细信息 + * * @param customerId * @return java.util.List * @Author zhangyong * @Date 16:57 2020-09-03 **/ - List selectListGridInfo(@Param("customerId")String customerId, + List selectListGridInfo(@Param("customerId") String customerId, @Param("customerAreaCode") String customerAreaCode, - @Param("subCustomerIds")List subCustomerIds); + @Param("subCustomerIds") List subCustomerIds); /** - * @Description 根据agencyId查询网格ID * @param agencyId + * @Description 根据agencyId查询网格ID * @author zxc * @date 2020/9/22 2:16 下午 */ - List selectGridIdByAgencyId(@Param("agencyId")String agencyId); + List selectGridIdByAgencyId(@Param("agencyId") String agencyId); ScreenCustomerGridEntity getLastAddGrid(); @@ -137,58 +138,59 @@ public interface ScreenCustomerGridDao extends BaseDao ScreenCustomerGridEntity getByGridId(String gridId); /** - * @Description 查询客户下所有网格ID * @param customerId * @param dateId + * @Description 查询客户下所有网格ID * @author zxc * @date 2020/9/23 3:10 下午 */ List selectAllGridIdToParty(String customerId, String dateId); /** - * @Description 查询客户下所有网格ID + * @Description 查询客户下所有网格ID * @Param customerId * @Param monthId * @author zxc * @date 2020/9/25 10:43 上午 */ - List selectAllGridIdToPartyLinkMessage(@Param("customerId") String customerId,@Param("monthId") String monthId); - List selectAllGridIdToOrganize(@Param("customerId") String customerId,@Param("monthId") String monthId); + List selectAllGridIdToPartyLinkMessage(@Param("customerId") String customerId, @Param("monthId") String monthId); + + List selectAllGridIdToOrganize(@Param("customerId") String customerId, @Param("monthId") String monthId); /** - * @Description 查询org名称 * @param gridIds + * @Description 查询org名称 * @author zxc * @date 2020/9/24 1:27 下午 */ List selectOrgName(@Param("gridIds") List gridIds); /** - * @Description 查询机关的直属网格 * @param agencyIds + * @Description 查询机关的直属网格 * @author zxc * @date 2020/9/24 2:33 下午 */ List selectDirectGrid(@Param("agencyIds") List agencyIds); /** - * @Description 查询全部网格信息 * @param customerId + * @Description 查询全部网格信息 * @author zxc * @date 2020/9/19 10:50 上午 */ List selectAllGridInfoToParty(String customerId); /** - * @Description 查询全部网格信息 * @param customerId + * @Description 查询全部网格信息 * @author zxc * @date 2020/9/18 10:47 上午 */ List selectAllGridInfo(@Param("customerId") String customerId); /** - * @Description 查询客户下的网格信息 + * @Description 查询客户下的网格信息 * @Param customerId * @author zxc * @date 2021/1/28 下午3:18 @@ -196,11 +198,22 @@ public interface ScreenCustomerGridDao extends BaseDao List selectGridInfoByCustomerId(@Param("customerId") String customerId); /** - * @Description 查询直属网格信息 + * @Description 查询直属网格信息 * @Param customerId * @Param level * @author zxc * @date 2021/3/23 下午4:03 */ - List selectBelongGridInfo(@Param("customerId") String customerId,@Param("level") String level); + List selectBelongGridInfo(@Param("customerId") String customerId, @Param("level") String level); + + /** + * desc: 根据客户Id 和pids 获取该客户下及该组织下的网格列表 + * + * @param customerId + * @param pids + * @return java.util.List + * @author LiuJanJun + * @date 2021/6/10 10:45 上午 + */ + List selectGridInfoList(@Param("customerId") String customerId, @Param("pids") String pids); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java index 64ba669caf..f74e041940 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java @@ -1,7 +1,10 @@ package com.epmet.service; +import com.epmet.dto.screen.form.GridCenterPointForm; import org.springframework.stereotype.Service; +import java.util.Map; + /** * epmet_evaluation_index 维度的service */ @@ -10,4 +13,14 @@ public interface EIDimService { void initAgencies(); void initDepartments(); void initGrids(); + + /** + * desc: 更新中心点位 + * + * @param param + * @return java.lang.Integer + * @author LiuJanJun + * @date 2021/6/7 3:52 下午 + */ + Map updateCenterPointByName(GridCenterPointForm param); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java index ef39e1b781..f2a40b11c0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java @@ -23,6 +23,7 @@ import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; +import com.epmet.dto.screen.ScreenProjectGridDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.org.CustomerGridEntity; @@ -102,4 +103,10 @@ public interface ScreenCustomerGridService extends BaseService selectBelongGridInfo(String customerId,String level); -} \ No newline at end of file + + Integer updateCenterPointByName(String customerId, String title, List center); + + List selectGridInfoByCustomerId(String customerId); + + List selectGridInfoList(String customerId, String pids); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index 67dae90b1c..b012accfe0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java @@ -18,6 +18,8 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.utils.DateUtils; @@ -28,6 +30,7 @@ import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; +import com.epmet.dto.screen.ScreenProjectGridDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; @@ -37,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.List; @@ -94,6 +98,12 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl w = new LambdaQueryWrapper<>(); + w.eq(ScreenCustomerGridEntity::getGridId, grid.getId()); + screenCustomerGridDao.delete(w); + } } } } @@ -179,4 +189,25 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl selectBelongGridInfo(String customerId, String level) { return baseDao.selectBelongGridInfo(customerId, level); } -} \ No newline at end of file + + @Override + public Integer updateCenterPointByName(String customerId, String title, List center) { + LambdaUpdateWrapper tWrapper = new LambdaUpdateWrapper<>(); + String val = center.toString(); + List array = new ArrayList<>(Collections.singleton(val)); + tWrapper.eq(ScreenCustomerGridEntity::getCustomerId,customerId) + .likeRight(ScreenCustomerGridEntity::getGridName,title) + .set(ScreenCustomerGridEntity::getCenterMark, array.toString()); + return baseDao.update(null,tWrapper); + } + + @Override + public List selectGridInfoByCustomerId(String customerId) { + return baseDao.selectGridInfoByCustomerId(customerId); + } + + @Override + public List selectGridInfoList(String customerId, String pids) { + return baseDao.selectGridInfoList(customerId,pids); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java index d35aa6bec6..696b6fb221 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java @@ -1,5 +1,7 @@ package com.epmet.service.impl; +import com.epmet.dto.screen.ScreenProjectGridDailyDTO; +import com.epmet.dto.screen.form.GridCenterPointForm; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; @@ -13,13 +15,12 @@ import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; import com.epmet.service.org.CustomerAgencyService; import com.epmet.service.org.CustomerDepartmentService; import com.epmet.service.org.CustomerGridService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; @Service public class EIDimServiceImpl implements EIDimService { @@ -52,6 +53,7 @@ public class EIDimServiceImpl implements EIDimService { /** * 查询可更新的单位 + * * @return */ private List listAgencies2Update() { @@ -69,6 +71,7 @@ public class EIDimServiceImpl implements EIDimService { /** * 查询可增加的单位 + * * @return */ private List listAgencies2Add() { @@ -92,6 +95,7 @@ public class EIDimServiceImpl implements EIDimService { /** * 查询需要更新的部门列表 + * * @return */ private List listDepts2Update() { @@ -109,6 +113,7 @@ public class EIDimServiceImpl implements EIDimService { /** * 查询需要新增的部门列表 + * * @return */ private List listDepts2Add() { @@ -126,10 +131,34 @@ public class EIDimServiceImpl implements EIDimService { @Override public void initGrids() { List grids2Add = listGrids2Add(); - List grids2Update =listGrids2Update(); + List grids2Update = listGrids2Update(); screenCustomerGridService.addAndUpdateGrids(grids2Add, grids2Update); } + @Override + public Map updateCenterPointByName(GridCenterPointForm param) { + List gridInfos = screenCustomerGridService.selectGridInfoList(param.getCustomerId(),param.getPids()); + Map result = new HashMap<>(); + + gridInfos.forEach(grid -> { + //客户id 和组织id 都相等 且 名字 包含关系时才修改 + if (grid.getCustomerId().equals(param.getCustomerId())) { + AtomicInteger integer = new AtomicInteger(0); + if ("[]".equals(grid.getCenterMark()) || StringUtils.isBlank(grid.getCenterMark())){ + param.getCenterDataList().forEach(o -> { + String title = o.getTitle().replace("委会",""); + if (grid.getGridName().startsWith(title)) { + Integer effectRow = screenCustomerGridService.updateCenterPointByName(param.getCustomerId(), title, o.getCenter()); + integer.addAndGet(effectRow); + } + result.put(grid.getGridId(), integer.intValue()); + }); + } + } + }); + return result; + } + private List listGrids2Update() { ScreenCustomerGridEntity lastUpdateGrid = screenCustomerGridService.getLastUpdateGrid(); if (lastUpdateGrid != null) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java index e75870980f..a6cc1d5c1d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java @@ -1,7 +1,6 @@ package com.epmet.service.impl; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.convert.DateConverter; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.GroupConstant; import com.epmet.dto.AgencySubTreeDto; @@ -11,7 +10,6 @@ import com.epmet.dto.group.form.GroupTotalFormDTO; import com.epmet.dto.group.result.*; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; -import com.epmet.entity.group.ResiGroupEntity; import com.epmet.entity.stats.DimAgencyEntity; import com.epmet.entity.stats.DimGridEntity; import com.epmet.entity.stats.FactGroupTotalAgencyDailyEntity; @@ -24,14 +22,12 @@ import com.epmet.service.stats.*; import com.epmet.util.DimIdGenerator; import com.epmet.util.ModuleConstant; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.ZoneId; @@ -213,7 +209,7 @@ public class StatsGroupServiceImpl implements StatsGroupService { } }); }); - Integer groupCount = approvedResult.stream().collect(Collectors.summingInt(AgencyGroupTotalCountResultDTO::getGridGroupCount)); + Integer groupCount = approvedResult.stream().mapToInt(AgencyGroupTotalCountResultDTO::getGridGroupCount).sum(); agencyResult.setGroupTotalCount(groupCount); // 3. 机关下所有组内人数和(不需要去重) 人员状态 != "removed" List peopleTotal = new ArrayList<>(); @@ -225,7 +221,7 @@ public class StatsGroupServiceImpl implements StatsGroupService { } }); }); - Integer groupPeopleCount = peopleTotal.stream().collect(Collectors.summingInt(AgencyGridGroupPeopleTotalResultDTO::getGridGroupPeopleTotal)); + Integer groupPeopleCount = peopleTotal.stream().mapToInt(AgencyGridGroupPeopleTotalResultDTO::getGridGroupPeopleTotal).sum(); agencyResult.setGroupMemberTotalCount(groupPeopleCount); // 4. 机关下小组平均人数 agencyResult.setGroupMemberAvgCount( diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java index ff368ab5da..36511421f3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java @@ -182,11 +182,7 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon o.setDataEndTime(dimId); //For:06.01新增:orgType=agency或者grid的时候,此列赋值:当前组织或者当前网格内的网格员人数 - if(gridManagerMap.containsKey(orgId)){ - o.setGridMemberTotal(gridManagerMap.get(orgId)); - }else{ - o.setGridMemberTotal(NumConstant.ZERO); - } + o.setGridMemberTotal(gridManagerMap.getOrDefault(orgId, NumConstant.ZERO)); }); return result; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index 9be10286b6..59897628e3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -773,12 +773,10 @@ public class UserServiceImpl implements UserService { userDTO = topicUserMap.get(project.getLinkName()); } if (userDTO != null) { - logger.info("fillScreenProjectData every user data:{}", JSON.toJSONString(userDTO)); project.setLinkName(userDTO.getLinkName()); project.setLinkMobile(userDTO.getLinkMobile()); } } - logger.info("fillScreenProjectData result list:{}", JSON.toJSONString(list)); } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index e5d0c1a183..0fca6febf5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -352,6 +352,7 @@ cg.GRID_NAME, cg.PARENT_AGENCY_ID AS pid, cg.AREA_CODE, + cg.CENTER_MARK, ca.pids FROM screen_customer_grid cg LEFT JOIN screen_customer_agency ca ON ca.AGENCY_ID = cg.PARENT_AGENCY_ID @@ -371,5 +372,18 @@ AND scg.DEL_FLAG = 0 AND scg.CUSTOMER_ID = #{customerId} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridStaffResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridStaffResultDTO.java new file mode 100644 index 0000000000..d74af6d7f6 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridStaffResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/8 3:23 下午 + * @DESC + */ +@Data +public class GridStaffResultDTO implements Serializable { + + private static final long serialVersionUID = -5910427385795368242L; + + private String gridId; + + private String staffId; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 6cefd55a53..4e28d10dc1 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -333,4 +333,13 @@ public interface GovOrgOpenFeignClient { **/ @PostMapping(value = "/gov/org/customeragency/getprocessorlist/{agencyId}") Result getProcessorList(@PathVariable("agencyId") String agencyId); + + /** + * @Description 查询网格下的网格员 + * @Param gridIds + * @author zxc + * @date 2021/6/8 3:36 下午 + */ + @PostMapping("/gov/org/customerstaffgrid/gridstaff") + Result> selectGridStaffByGridIds(@RequestBody List gridIds); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index f34b6f53ae..4976297323 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -192,4 +192,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result getProcessorList(String agencyId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getProcessorList", agencyId); } + + @Override + public Result> selectGridStaffByGridIds(List gridIds) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridStaffByGridIds", gridIds); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java index 72b6dabe25..53e6330d06 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java @@ -29,6 +29,7 @@ import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.GridStaffResultDTO; import com.epmet.excel.CustomerStaffGridExcel; import com.epmet.service.CustomerStaffGridService; import org.springframework.beans.factory.annotation.Autowired; @@ -119,4 +120,15 @@ public class CustomerStaffGridController { ValidatorUtils.validateEntity(gridIdFormDTO); return customerStaffGridService.getAllGridStaffs(gridIdFormDTO); } + + /** + * @Description 查询网格下的人 + * @Param gridIds + * @author zxc + * @date 2021/6/8 3:36 下午 + */ + @PostMapping("gridstaff") + public Result> selectGridStaffByGridIds(@RequestBody List gridIds){ + return new Result>().ok(customerStaffGridService.selectGridStaffByGridIds(gridIds)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java index 54cad95662..d9ce1b0e61 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java @@ -22,6 +22,7 @@ import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerStaffDepartmentDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.GridStaffResultDTO; import com.epmet.entity.CustomerStaffGridEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -97,4 +98,12 @@ public interface CustomerStaffGridDao extends BaseDao { * @Description 查询人员在客户下参与的网格列表 */ List selectStaffGridList(CustomerStaffGridDTO staffGridDTO); + + /** + * @Description 查询网格下的人 + * @Param gridIds + * @author zxc + * @date 2021/6/8 3:36 下午 + */ + List selectGridStaffByGridIds(@Param("gridIds") List gridIds); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java index 7813dd3b06..0cf4041cce 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java @@ -26,6 +26,7 @@ import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.GridStaffResultDTO; import com.epmet.entity.CustomerStaffGridEntity; import java.util.List; @@ -117,4 +118,12 @@ public interface CustomerStaffGridService extends BaseService> getAllGridStaffs(CommonGridIdFormDTO gridIdFormDTO); + + /** + * @Description 查询网格下的人 + * @Param gridIds + * @author zxc + * @date 2021/6/8 3:36 下午 + */ + List selectGridStaffByGridIds(List gridIds); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 2a7dd704f8..c0a987206b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -705,6 +705,6 @@ public class CustomerGridServiceImpl extends BaseServiceImpl getBaseInfo(CustomerGridFormDTO customerGridFormDTO) { - return new Result().ok(baseDao.getGridBaseInfoById(customerGridFormDTO.getGridId())); + return new Result().ok(ConvertUtils.sourceToTarget(baseDao.selectById(customerGridFormDTO.getGridId()), CustomerGridDTO.class)); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java index 2eb0873cc8..ac8abc82fc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java @@ -21,6 +21,7 @@ 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.constant.FieldConstant; +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.utils.Result; @@ -30,13 +31,16 @@ import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.GridStaffResultDTO; import com.epmet.entity.CustomerStaffGridEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.CustomerStaffGridRedis; import com.epmet.service.CustomerStaffGridService; 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 org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; @@ -56,6 +60,9 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl page(Map params) { @@ -146,4 +153,32 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl selectGridStaffByGridIds(List gridIds) { + if (CollectionUtils.isEmpty(gridIds)){ + return new ArrayList<>(); + } + // 查询网格下所有的人 + List gridStaff = baseDao.selectGridStaffByGridIds(gridIds); + if (CollectionUtils.isEmpty(gridStaff)){ + return new ArrayList<>(); + } + // 拿着网格下所有人去筛选网格员 + Result> result = epmetUserOpenFeignClient.staffGridRole(gridStaff); + if (!result.success()){ + throw new RenException("查询网格下的网格员失败【"+result.getMsg()+"】"); + } + List data = result.getData(); + if (CollectionUtils.isEmpty(data)){ + return new ArrayList<>(); + } + return data; + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml index 7f1a8d3220..5e08a59b97 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml @@ -88,6 +88,20 @@ AND customer_id = #{customerId} + + + insert into customer_staff_grid diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/PatrolConstant.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/PatrolConstant.java new file mode 100644 index 0000000000..b6f27bbd62 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/PatrolConstant.java @@ -0,0 +1,13 @@ +package com.epmet.constant; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/8 15:28 + */ +public interface PatrolConstant { + String PATROLLING = "patrolling"; + String END = "end"; + + String NOT_END_MSG = "%s巡查尚未结束,请切换至%s查看。"; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolRecordDetailFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolRecordDetailFormDTO.java new file mode 100644 index 0000000000..2f87874dd5 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolRecordDetailFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 16:23 + */ +@NoArgsConstructor +@Data +public class PatrolRecordDetailFormDTO implements Serializable { + private static final long serialVersionUID = 7496587490046732883L; + /** + * 巡查记录id + */ + private String staffPatrolRecId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolTrackFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolTrackFormDTO.java new file mode 100644 index 0000000000..6c0dfb8478 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolTrackFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/7 3:27 下午 + * @DESC + */ +@Data +public class PatrolTrackFormDTO implements Serializable { + + private static final long serialVersionUID = 5074643104620363029L; + + public interface PatrolTrackForm{} + + @NotBlank(message = "巡查记录ID不能为空",groups = PatrolTrackForm.class) + private String staffPatrolRecId; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadDetailFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadDetailFormDTO.java new file mode 100644 index 0000000000..4484f45f30 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadDetailFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/9 16:31 + */ +@Data +public class PatrolUploadDetailFormDTO implements Serializable { + private static final long serialVersionUID = 1527344810917196996L; + /** + * 巡查主记录id, 开始巡查反参 + */ + private String staffPatrolRecId; + private List details; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadFormDTO.java new file mode 100644 index 0000000000..a6f564dca7 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadFormDTO.java @@ -0,0 +1,55 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 16:05 + */ +@NoArgsConstructor +@Data +public class PatrolUploadFormDTO implements Serializable { + + private static final long serialVersionUID = 4665110896043941317L; + /** + * 巡查主记录id, 开始巡查反参 + */ + private String staffPatrolRecId; + /** + * 纬度 + */ + private String latitude; + /** + * 经度 + */ + private String longitude; + /** + * 速度 + */ + private String speed; + /** + * 位置的精确度 + */ + private String accuracy; + /** + * 高度,单位m + */ + private String altitude; + /** + * 垂直经度,单位m + */ + private String verticalAccuracy; + /** + * 水平经度,单位m + */ + private String horizontalAccuracy; + /** + * 序号,前端生成,后端记录 + */ + private Integer serialNum; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RecordListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RecordListFormDTO.java new file mode 100644 index 0000000000..cfaf7a62c4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RecordListFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/7 3:09 下午 + * @DESC + */ +@Data +public class RecordListFormDTO implements Serializable { + + private static final long serialVersionUID = 1034587652692011650L; + + public interface RecordListForm{} + + @NotBlank(message = "staffId不能为空",groups = RecordListForm.class) + private String staffId; + + @NotBlank(message = "网格ID不能为空",groups = RecordListForm.class) + private String gridId; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffPatrolInitFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffPatrolInitFormDTO.java new file mode 100644 index 0000000000..fb895e8c90 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffPatrolInitFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 16:16 + */ +@NoArgsConstructor +@Data +public class StaffPatrolInitFormDTO { + + /** + * 当前工作人员基层治理所在网格id;可为空 + */ + private String gridId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java new file mode 100644 index 0000000000..1bf9d55e25 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 16:32 + */ +@NoArgsConstructor +@Data +public class StartPatrolFormDTO implements Serializable { + + private static final long serialVersionUID = -2765639550834711582L; + /** + * 网格id + */ + private String gridId; + /** + * 纬度 + */ + private String latitude; + /** + * 经度 + */ + private String longitude; + /** + * 速度,如果拿不到默认0 + */ + private String speed; + /** + * 序号;前端生成,后端负责记录,开始巡查赋值0 + */ + private Integer serialNum; + + private String staffPatrolRecId; + + private String patrolEndTime; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridManagerUserListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridManagerUserListResultDTO.java new file mode 100644 index 0000000000..8a8e51887b --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridManagerUserListResultDTO.java @@ -0,0 +1,65 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/7 2:57 下午 + * @DESC + */ +@Data +public class GridManagerUserListResultDTO implements Serializable { + + private static final long serialVersionUID = 3606766812822179356L; + + /** + * 工作人员id + */ + private String staffId; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + + /** + * 网格ID + */ + private String gridId; + + /** + * 正在巡查:patrolling;否则返回空字符串 + */ + private String status; + + /** + * 网格名称,最多显示上两级 + */ + private String gridName; + + /** + * 姓名 + */ + private String staffName; + + /** + * 中心点位 + */ + @JsonIgnore + private String centerMark; + + /** + * 经纬度赋值状态 + */ + @JsonIgnore + private Boolean llStatus; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUserResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUserResultDTO.java new file mode 100644 index 0000000000..da70a707fe --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUserResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/8 4:30 下午 + * @DESC + */ +@Data +public class GridStaffUserResultDTO implements Serializable { + + private static final long serialVersionUID = 7715622585539953368L; + + private String gridId; + + private String staffId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRecordDetailResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRecordDetailResultDTO.java new file mode 100644 index 0000000000..ee1b9e172d --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRecordDetailResultDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 16:24 + */ +@NoArgsConstructor +@Data +public class PatrolRecordDetailResultDTO implements Serializable { + + private static final long serialVersionUID = -1812674284508241468L; + /** + * 上传时间;yyyy-MM-dd HH:mm + */ + private String uploadTime; + /** + * 纬度 + */ + private String latitude; + /** + * 经度 + */ + private String longitude; + /** + * 速度,单位m/s + */ + private String speed; + /** + * 后端返回:开始巡查;结束巡查;此列只有集合第一条,和最后一条有值 + */ + private String flag; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolTrackResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolTrackResultDTO.java new file mode 100644 index 0000000000..d20d951367 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolTrackResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/7 3:29 下午 + * @DESC + */ +@Data +public class PatrolTrackResultDTO implements Serializable { + + private static final long serialVersionUID = 5147586435344204616L; + + /** + * 纬度 + */ + private String latitude; + + /** + * 经度 + */ + private String longitude; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolUploadResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolUploadResultDTO.java new file mode 100644 index 0000000000..50882ef37a --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolUploadResultDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 16:14 + */ +@Data +public class PatrolUploadResultDTO implements Serializable { + private static final long serialVersionUID = -1750373142795803118L; + /** + * 巡查主记录id + */ + private String staffPatrolRecId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RecordListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RecordListResultDTO.java new file mode 100644 index 0000000000..078586c69d --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RecordListResultDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/7 3:14 下午 + * @DESC + */ +@Data +public class RecordListResultDTO implements Serializable { + + private static final long serialVersionUID = -1021736989973649009L; + + /** + * 巡查记录id + */ + private String staffPatrolRecId; + + /** + * 开始时间;yyyy-MM-dd HH:mm + */ + private String patrolStartTime; + + /** + * 结束时间;yyyy-MM-dd HH:mm + */ + private String patrolEndTime; + + /** + * 正在巡查:patrolling;已结束:end + */ + private String status; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffPatrolInitResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffPatrolInitResultDTO.java new file mode 100644 index 0000000000..56b2589341 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffPatrolInitResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 16:17 + */ +@NoArgsConstructor +@Data +public class StaffPatrolInitResultDTO implements Serializable { + + private static final long serialVersionUID = -1752690564468072256L; + /** + * 存在正在巡查中记录返回:patrolling;不存在:end + */ + private String status; + /** + * 巡查记录id,status=patrolling时此列有值 + */ + private String staffPatrolRecId; + /** + * patrolling:返回最大的序号;status=end时,此列返回-1 + */ + private Integer latestSerialNum; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StartPatrolResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StartPatrolResultDTO.java new file mode 100644 index 0000000000..06d323df11 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StartPatrolResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 16:34 + */ +@NoArgsConstructor +@Data +public class StartPatrolResultDTO implements Serializable { + + private static final long serialVersionUID = -8064467225255970920L; + /** + * 巡查记录id + */ + private String staffPatrolRecId; + /** + * 最小时间间隔,单位s;默认30,后面可以做成客户可配置参数 + */ + private Integer carmDown; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameAndLLResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameAndLLResultDTO.java new file mode 100644 index 0000000000..ac255b7c56 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameAndLLResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/6/9 11:12 上午 + * @DESC + */ +@Data +public class UserNameAndLLResultDTO implements Serializable { + + private static final long serialVersionUID = 8997436689118596889L; + + /** + * 用户名字 + */ + private List userNames; + + /** + * 经纬度 + */ + private List ll; + + public UserNameAndLLResultDTO() { + this.userNames = new ArrayList<>(); + this.ll = new ArrayList<>(); + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameResultDTO.java new file mode 100644 index 0000000000..286fc17ea7 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameResultDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/6/9 11:12 上午 + * @DESC + */ +@Data +public class UserNameResultDTO implements Serializable { + + private static final long serialVersionUID = 5383959788021394553L; + + private String userId; + private String userName; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index f85ba6d782..95c98adfa6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -530,4 +530,40 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("/epmetuser/badge/userbadges") Result> userBadges(@RequestBody UserBadgesFormDTO formDTO); + + /** + * @Description 查询网格员角色 + * @Param forms + * @author zxc + * @date 2021/6/8 4:42 下午 + */ + @PostMapping("/epmetuser/staffrole/staffgridrole") + Result> staffGridRole(@RequestBody List forms); + + /** + * @Description 查询经纬度 + * @Param userIds + * @author zxc + * @date 2021/6/9 10:40 上午 + */ + @PostMapping("/epmetuser/staffpatrol/getll") + Result selectll(@RequestBody List userIds); + + /** + * @Description 002、查看巡查记录 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:25 下午 + */ + @PostMapping("/epmetuser/staffpatrol/recordlist") + Result> recordList(@RequestBody RecordListFormDTO formDTO); + + /** + * @Description 003、巡查轨迹 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:35 下午 + */ + @PostMapping("/epmetuser/staffpatrol/patroltrack") + Result> patrolTrack(@RequestBody PatrolTrackFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 518cca9cef..2263284f8e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -373,4 +373,25 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> userBadges(UserBadgesFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "userBadges", formDTO); } + + @Override + public Result> staffGridRole(List forms) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "staffGridRole", forms); + } + + @Override + public Result selectll(List userIds) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectll", userIds); + } + + @Override + public Result> recordList(RecordListFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "recordList", formDTO); + } + + @Override + public Result> patrolTrack(PatrolTrackFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "patrolTrack", formDTO); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java new file mode 100644 index 0000000000..4948e36d7a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java @@ -0,0 +1,144 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; +import com.epmet.service.StaffPatrolDetailService; +import com.epmet.service.StaffPatrolRecordService; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/6/7 15:49 +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/6/9 10:32 上午 + * @DESC + */ +@RestController +@RequestMapping("staffpatrol") +public class StaffPatrolController { + @Resource + private StaffPatrolDetailService staffPatrolDetailService; + @Resource + private StaffPatrolRecordService staffPatrolRecordService; + + /** + * 巡查界面初始化 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/6/7 16:40 + */ + @PostMapping("init") + public Result init(@LoginUser TokenDto tokenDto, @RequestBody StaffPatrolInitFormDTO formDTO) { + StaffPatrolInitResultDTO result = staffPatrolRecordService.init(tokenDto, formDTO); + return new Result().ok(result); + + } + + /** + * 开始巡查 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/6/7 16:46 + */ + @PostMapping("startpatrol") + public Result startPatrol(@LoginUser TokenDto tokenDto, @RequestBody StartPatrolFormDTO formDTO) { + StartPatrolResultDTO result = staffPatrolRecordService.startPatrol(tokenDto, formDTO); + return new Result().ok(result); + + } + + /** + * 结束巡查 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/6/7 16:46 + */ + @PostMapping("endpatrol") + public Result endPatrol(@LoginUser TokenDto tokenDto, @RequestBody StartPatrolFormDTO formDTO) { + staffPatrolRecordService.endPatrol(tokenDto, formDTO); + return new Result(); + + } + + /** + * 上传巡查记录 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/6/7 16:46 + */ + @PostMapping("uploaddetail") + public Result uploadDetail(@LoginUser TokenDto tokenDto, @RequestBody PatrolUploadFormDTO formDTO) { + PatrolUploadResultDTO result = staffPatrolRecordService.uploadDetail(tokenDto, formDTO); + return new Result().ok(result); + + } + + @PostMapping("uploaddetails") + public Result uploadDetails(@LoginUser TokenDto tokenDto, @RequestBody PatrolUploadDetailFormDTO formDTO) { + PatrolUploadResultDTO result = staffPatrolRecordService.uploadDetails(tokenDto, formDTO); + return new Result().ok(result); + + } + + /** + * @Description 查询经纬度 + * @Param userIds + * @author zxc + * @date 2021/6/9 10:40 上午 + */ + @PostMapping("getll") + public Result selectll(@RequestBody List userIds){ + return new Result().ok(staffPatrolRecordService.selectLL(userIds)); + } + + /** + * @Description 002、查看巡查记录 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:25 下午 + */ + @PostMapping("recordlist") + public Result> recordList(@RequestBody RecordListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, RecordListFormDTO.RecordListForm.class); + return new Result>().ok(staffPatrolRecordService.recordList(formDTO)); + } + + /** + * @Description 003、巡查轨迹 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:35 下午 + */ + @PostMapping("patroltrack") + public Result> patrolTrack(@RequestBody PatrolTrackFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, PatrolTrackFormDTO.PatrolTrackForm.class); + return new Result>().ok(staffPatrolRecordService.patrolTrack(formDTO)); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java index 60b4d5400e..00d3cd154e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java @@ -10,11 +10,8 @@ import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.form.CustomerRoleFormDTO; import com.epmet.dto.form.RolesUsersListFormDTO; import com.epmet.dto.form.StaffRoleFormDTO; -import com.epmet.dto.result.CustomerStaffRoleResultDTO; +import com.epmet.dto.result.*; import com.epmet.dto.form.*; -import com.epmet.dto.result.CustomerStaffRoleListResultDTO; -import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.StaffRolesResultDTO; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; import com.epmet.service.StaffRoleService; @@ -181,4 +178,15 @@ public class StaffRoleController { staffRoleService.changeRoleOrg(formDTO); return new Result(); } + + /** + * @Description 查询网格员角色 + * @Param forms + * @author zxc + * @date 2021/6/8 4:42 下午 + */ + @PostMapping("staffgridrole") + public Result> staffGridRole(@RequestBody List forms){ + return new Result>().ok(staffRoleService.staffGridRole(forms)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index acffa2840e..6a580a6372 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -197,4 +197,12 @@ public interface CustomerStaffDao extends BaseDao { * @return */ BasicInfoResultDTO getStaffBasicInfo(StaffBasicInfoFromDTO fromDTO); + + /** + * @Description 查询用户名字 + * @Param userIds + * @author zxc + * @date 2021/6/9 1:36 下午 + */ + List selectUserName(@Param("userIds")List userIds); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolDetailDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolDetailDao.java new file mode 100644 index 0000000000..2d7ed83136 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolDetailDao.java @@ -0,0 +1,45 @@ +/** + * 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.dto.result.PatrolTrackResultDTO; +import com.epmet.entity.StaffPatrolDetailEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Mapper +public interface StaffPatrolDetailDao extends BaseDao { + + /** + * @Description 查询巡查轨迹 + * @Param staffPatrolRecId + * @author zxc + * @date 2021/6/7 5:13 下午 + */ + List selectPatrolTrack(@Param("staffPatrolRecId") String staffPatrolRecId); + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolRecordDao.java new file mode 100644 index 0000000000..a476cfd3a5 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolRecordDao.java @@ -0,0 +1,55 @@ +/** + * 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.dto.form.RecordListFormDTO; +import com.epmet.dto.result.GridManagerUserListResultDTO; +import com.epmet.dto.result.RecordListResultDTO; +import com.epmet.entity.StaffPatrolRecordEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Mapper +public interface StaffPatrolRecordDao extends BaseDao { + + /** + * @Description 查询经纬度 + * @Param userIds + * @author zxc + * @date 2021/6/9 10:24 上午 + */ + List selectLL(@Param("userIds")List userIds); + + /** + * @Description 巡查记录查询 + * @Param formDTO + * @author zxc + * @date 2021/6/7 5:29 下午 + */ + List recordList(RecordListFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java index 3124fc68c7..6d10c5fe23 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java @@ -24,10 +24,7 @@ import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.form.CustomerStaffRoleListFormDTO; import com.epmet.dto.form.GetRoleKeyListFormDTO; -import com.epmet.dto.result.CustomerStaffRoleListResultDTO; -import com.epmet.dto.result.CustomerStaffRoleResultDTO; -import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.StaffRolesResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.StaffRoleEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -131,4 +128,12 @@ public interface StaffRoleDao extends BaseDao { * @Description 工作端-查询用户角色key列表 **/ List selectStaffRoleKeyList(GetRoleKeyListFormDTO formDTO); + + /** + * @Description 查询是网格员的人 + * @Param forms + * @author zxc + * @date 2021/6/8 4:53 下午 + */ + List staffGridRole(@Param("forms") List forms); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolDetailEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolDetailEntity.java new file mode 100644 index 0000000000..fbc81edd1a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolDetailEntity.java @@ -0,0 +1,101 @@ +/** + * 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-06-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_patrol_detail") +public class StaffPatrolDetailEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * staff_patrol_record.ID + */ + private String staffPatrolRecId; + + /** + * 前端给的序号 + */ + private Integer serialNum; + + /** + * 上传时间,后台自动插入该时间 + */ + private Date uploadTime; + + /** + * 纬度 + */ + private String latitude; + + /** + * 经度 + */ + private String longitude; + + /** + * 速度,单位m/s;开始和结束时默认0 + */ + private String speed; + + /** + * 位置的精确度 + */ + private String accuracy; + + /** + * 高度,单位米 + */ + private String altitude; + + /** + * 垂直经度,单位m + */ + private String verticalaccuracy; + + /** + * 水平经度,单位m + */ + private String horizontalaccuracy; + + /** + * 地址;暂时不用 + */ + private String address; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolRecordEntity.java new file mode 100644 index 0000000000..2eed573090 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolRecordEntity.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.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-06-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_patrol_record") +public class StaffPatrolRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格id + */ + private String grid; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 巡查开始时间 + */ + private Date patrolStartTime; + + /** + * 巡查结束时间,前端传入 + */ + private Date patrolEndTime; + + /** + * 实际结束时间=操作结束巡查的时间 + */ + private Date actrualEndTime; + + /** + * 本次巡查总耗时,单位秒;结束巡查时写入 + */ + private Integer totalTime; + + /** + * 正在巡查中:patrolling;结束:end + */ + private String status; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolDetailService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolDetailService.java new file mode 100644 index 0000000000..0ceb24625f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolDetailService.java @@ -0,0 +1,53 @@ +/** + * 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.dto.StaffPatrolDetailDTO; +import com.epmet.entity.StaffPatrolDetailEntity; + +import java.util.List; + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +public interface StaffPatrolDetailService extends BaseService { + + /** + * 获取最后一次记录明细 + * @author zhaoqifeng + * @date 2021/6/8 15:13 + * @param staffPatrolRecId + * @return com.epmet.dto.StaffPatrolDetailDTO + */ + StaffPatrolDetailDTO getLastDetail(String staffPatrolRecId); + + /** + * 获取所以记录明细 + * @author zhaoqifeng + * @date 2021/6/8 15:13 + * @param staffPatrolRecId + * @return java.util.List + */ + List getDetailList(String staffPatrolRecId); + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java new file mode 100644 index 0000000000..7eae381718 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffPatrolRecordService.java @@ -0,0 +1,120 @@ +/** + * 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.security.dto.TokenDto; +import com.epmet.dto.form.*; +import com.epmet.dto.result.PatrolUploadResultDTO; +import com.epmet.dto.result.StaffPatrolInitResultDTO; +import com.epmet.dto.result.StartPatrolResultDTO; +import com.epmet.dto.result.PatrolTrackResultDTO; +import com.epmet.dto.result.RecordListResultDTO; +import com.epmet.dto.result.UserNameAndLLResultDTO; +import com.epmet.entity.StaffPatrolRecordEntity; + +import java.util.List; + + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +public interface StaffPatrolRecordService extends BaseService { + + /** + * 巡查界面初始化 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.StaffPatrolInitResultDTO + * @author zhaoqifeng + * @date 2021/6/7 16:47 + */ + StaffPatrolInitResultDTO init(TokenDto tokenDto, StaffPatrolInitFormDTO formDTO); + + /** + * 开始巡查 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.StartPatrolResultDTO + * @author zhaoqifeng + * @date 2021/6/7 16:49 + */ + StartPatrolResultDTO startPatrol(TokenDto tokenDto, StartPatrolFormDTO formDTO); + + /** + * 结束巡查 + * + * @param tokenDto + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2021/6/7 16:49 + */ + void endPatrol(TokenDto tokenDto, StartPatrolFormDTO formDTO); + + /** + * 上传巡查记录 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.PatrolUploadResultDTO + * @author zhaoqifeng + * @date 2021/6/7 16:49 + */ + PatrolUploadResultDTO uploadDetail(TokenDto tokenDto, PatrolUploadFormDTO formDTO); + + /** + * 上传巡查记录 + * @author zhaoqifeng + * @date 2021/6/9 16:32 + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.PatrolUploadResultDTO + */ + PatrolUploadResultDTO uploadDetails(TokenDto tokenDto, PatrolUploadDetailFormDTO formDTO); + + /** + * @Description 查询经纬度 + * @Param userIds + * @author zxc + * @date 2021/6/9 10:40 上午 + */ + UserNameAndLLResultDTO selectLL(List userIds); + + /** + * @Description 002、查看巡查记录 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:25 下午 + */ + List recordList(RecordListFormDTO formDTO); + + /** + * @Description 003、巡查轨迹 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:35 下午 + */ + List patrolTrack(PatrolTrackFormDTO formDTO); + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java index 5e260dd3c3..31a9883a4f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java @@ -25,10 +25,7 @@ import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.form.CustomerStaffRoleListFormDTO; import com.epmet.dto.form.RolesUsersListFormDTO; -import com.epmet.dto.result.CustomerStaffRoleResultDTO; -import com.epmet.dto.result.CustomerStaffRoleListResultDTO; -import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.StaffRolesResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.StaffRoleEntity; import java.util.List; @@ -159,4 +156,12 @@ public interface StaffRoleService extends BaseService { * @return void */ void changeRoleOrg(StaffRoleDTO formDTO); + + /** + * @Description 查询网格员角色 + * @Param forms + * @author zxc + * @date 2021/6/8 4:42 下午 + */ + List staffGridRole(List forms); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolDetailServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolDetailServiceImpl.java new file mode 100644 index 0000000000..2c3e9a8460 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolDetailServiceImpl.java @@ -0,0 +1,75 @@ +/** + * 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.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.StaffPatrolDetailDao; +import com.epmet.dto.StaffPatrolDetailDTO; +import com.epmet.entity.StaffPatrolDetailEntity; +import com.epmet.service.StaffPatrolDetailService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 工作人员巡查记录明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Service +public class StaffPatrolDetailServiceImpl extends BaseServiceImpl implements StaffPatrolDetailService { + + + /** + * 获取最后一次记录明细 + * + * @param staffPatrolRecId + * @return com.epmet.dto.StaffPatrolDetailDTO + * @author zhaoqifeng + * @date 2021/6/8 15:13 + */ + @Override + public StaffPatrolDetailDTO getLastDetail(String staffPatrolRecId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("STAFF_PATROL_REC_ID", staffPatrolRecId); + wrapper.orderByDesc("SERIAL_NUM"); + wrapper.last("limit 1"); + StaffPatrolDetailEntity entity = baseDao.selectOne(wrapper); + return ConvertUtils.sourceToTarget(entity, StaffPatrolDetailDTO.class); + } + + /** + * 获取所以记录明细 + * + * @param staffPatrolRecId + * @return java.util.List + * @author zhaoqifeng + * @date 2021/6/8 15:13 + */ + @Override + public List getDetailList(String staffPatrolRecId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("STAFF_PATROL_REC_ID", staffPatrolRecId); + wrapper.orderByDesc("SERIAL_NUM"); + List entity = baseDao.selectList(wrapper); + return ConvertUtils.sourceToTarget(entity, StaffPatrolDetailDTO.class); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java new file mode 100644 index 0000000000..f72166928b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java @@ -0,0 +1,315 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.PatrolConstant; +import com.epmet.dao.CustomerStaffDao; +import com.epmet.dao.StaffPatrolDetailDao; +import com.epmet.dao.StaffPatrolRecordDao; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.StaffPatrolDetailDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; +import com.epmet.entity.StaffPatrolDetailEntity; +import com.epmet.entity.StaffPatrolRecordEntity; +import com.epmet.feign.GovOrgFeignClient; +import com.epmet.service.StaffPatrolDetailService; +import com.epmet.service.StaffPatrolRecordService; +import lombok.extern.slf4j.Slf4j; +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 org.apache.commons.collections4.CollectionUtils; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Service +@Slf4j +public class StaffPatrolRecordServiceImpl extends BaseServiceImpl implements StaffPatrolRecordService { + + @Resource + private StaffPatrolDetailService staffPatrolDetailService; + @Resource + private GovOrgFeignClient govOrgFeignClient; + @Autowired + private CustomerStaffDao customerStaffDao; + + @Autowired + private StaffPatrolRecordDao staffPatrolRecordDao; + + @Autowired + private StaffPatrolDetailDao staffPatrolDetailDao; + + + /** + * 巡查界面初始化 + * + * @param tokenDto token + * @param formDTO 入参 + * @return com.epmet.dto.result.StaffPatrolInitResultDTO + * @author zhaoqifeng + * @date 2021/6/7 16:47 + */ + @Override + public StaffPatrolInitResultDTO init(TokenDto tokenDto, StaffPatrolInitFormDTO formDTO) { + StaffPatrolInitResultDTO result = new StaffPatrolInitResultDTO(); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(formDTO.getGridId()), "GRID", formDTO.getGridId()) + .eq("STAFF_ID", tokenDto.getUserId()) + .orderByDesc("PATROL_START_TIME") + .last("limit 1"); + StaffPatrolRecordEntity entity = baseDao.selectOne(wrapper); + if (null == entity) { + result.setLatestSerialNum(NumConstant.ONE_NEG); + result.setStatus(PatrolConstant.END); + result.setStaffPatrolRecId(StrConstant.EPMETY_STR); + return result; + } + StaffPatrolDetailDTO detail = staffPatrolDetailService.getLastDetail(entity.getId()); + result.setStaffPatrolRecId(entity.getId()); + result.setStatus(entity.getStatus()); + result.setLatestSerialNum(PatrolConstant.END.equals(entity.getStatus()) ? NumConstant.ONE_NEG : detail.getSerialNum()); + return result; + } + + /** + * 开始巡查 + * + * @param tokenDto token + * @param formDTO 入参 + * @return com.epmet.dto.result.StartPatrolResultDTO + * @author zhaoqifeng + * @date 2021/6/7 16:49 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public StartPatrolResultDTO startPatrol(TokenDto tokenDto, StartPatrolFormDTO formDTO) { + //获取最新的巡查记录 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(formDTO.getGridId()), "GRID", formDTO.getGridId()) + .eq("STAFF_ID", tokenDto.getUserId()) + .orderByDesc("PATROL_START_TIME") + .last("limit 1"); + StaffPatrolRecordEntity entity = baseDao.selectOne(wrapper); + + CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); + customerGridFormDTO.setGridId(formDTO.getGridId()); + Result gridResult = govOrgFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); + if (!gridResult.success() || null == gridResult.getData()) { + //查询网格名称失败 + log.error(String.format("查找网格信息失败,网格Id:【%s】", formDTO.getGridId())); + throw new RenException(gridResult.getCode(), gridResult.getMsg()); + } + CustomerGridDTO grid = gridResult.getData(); + + //判断巡查是否结束,如果未结束,返回消息提示 + if (null != entity && PatrolConstant.PATROLLING.equals(entity.getStatus())) { + throw new RenException(EpmetErrorCode.PATROL_IS_NOT_OVER.getCode(), String.format(PatrolConstant.NOT_END_MSG, grid.getGridName(), + grid.getGridName())); + } + //创建巡查记录 + StaffPatrolRecordEntity record = new StaffPatrolRecordEntity(); + record.setCustomerId(grid.getCustomerId()); + record.setAgencyId(grid.getPid()); + record.setGridPids(grid.getPids()); + record.setGrid(formDTO.getGridId()); + record.setStaffId(tokenDto.getUserId()); + record.setPatrolStartTime(new Date()); + record.setStatus(PatrolConstant.PATROLLING); + insert(record); + + //保存记录明细 + StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity(); + detailEntity.setStaffPatrolRecId(record.getId()); + detailEntity.setCustomerId(grid.getCustomerId()); + detailEntity.setSerialNum(formDTO.getSerialNum()); + detailEntity.setUploadTime(new Date()); + detailEntity.setLatitude(formDTO.getLatitude()); + detailEntity.setLongitude(formDTO.getLongitude()); + detailEntity.setSpeed(formDTO.getSpeed()); + staffPatrolDetailService.insert(detailEntity); + + StartPatrolResultDTO result = new StartPatrolResultDTO(); + result.setStaffPatrolRecId(record.getId()); + result.setCarmDown(NumConstant.THIRTY); + return result; + } + + /** + * 结束巡查 + * + * @param tokenDto + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2021/6/7 16:49 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void endPatrol(TokenDto tokenDto, StartPatrolFormDTO formDTO) { + StaffPatrolRecordEntity record = baseDao.selectById(formDTO.getStaffPatrolRecId()); + if (null == record) { + throw new RenException("巡查记录不存在"); + } + if (PatrolConstant.END.equals(record.getStatus())) { + throw new RenException("巡查已结束,请勿重复提交"); + } + + record.setActrualEndTime(new Date()); + record.setUpdatedTime(null); + record.setPatrolEndTime(DateUtils.parse(formDTO.getPatrolEndTime(), DateUtils.DATE_TIME_PATTERN)); + record.setTotalTime(DateUtils.calculateSecond(record.getPatrolStartTime(), record.getPatrolEndTime())); + record.setStatus(PatrolConstant.END); + baseDao.updateById(record); + //保存记录明细 + StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity(); + detailEntity.setStaffPatrolRecId(record.getId()); + detailEntity.setCustomerId(record.getCustomerId()); + detailEntity.setSerialNum(formDTO.getSerialNum()); + detailEntity.setUploadTime(new Date()); + detailEntity.setLatitude(formDTO.getLatitude()); + detailEntity.setLongitude(formDTO.getLongitude()); + detailEntity.setSpeed(formDTO.getSpeed()); + staffPatrolDetailService.insert(detailEntity); + } + + /** + * 上传巡查记录 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.PatrolUploadResultDTO + * @author zhaoqifeng + * @date 2021/6/7 16:49 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public PatrolUploadResultDTO uploadDetail(TokenDto tokenDto, PatrolUploadFormDTO formDTO) { + StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity(); + detailEntity.setStaffPatrolRecId(formDTO.getStaffPatrolRecId()); + detailEntity.setCustomerId(tokenDto.getCustomerId()); + detailEntity.setSerialNum(formDTO.getSerialNum()); + detailEntity.setUploadTime(new Date()); + detailEntity.setLatitude(formDTO.getLatitude()); + detailEntity.setLongitude(formDTO.getLongitude()); + detailEntity.setSpeed(formDTO.getSpeed()); + detailEntity.setAccuracy(formDTO.getAccuracy()); + detailEntity.setAltitude(formDTO.getAltitude()); + detailEntity.setVerticalaccuracy(formDTO.getVerticalAccuracy()); + detailEntity.setHorizontalaccuracy(formDTO.getHorizontalAccuracy()); + staffPatrolDetailService.insert(detailEntity); + + PatrolUploadResultDTO dto = new PatrolUploadResultDTO(); + dto.setStaffPatrolRecId(formDTO.getStaffPatrolRecId()); + return dto; + } + + /** + * 上传巡查记录 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.PatrolUploadResultDTO + * @author zhaoqifeng + * @date 2021/6/9 16:32 + */ + @Override + public PatrolUploadResultDTO uploadDetails(TokenDto tokenDto, PatrolUploadDetailFormDTO formDTO) { + if (CollectionUtils.isNotEmpty(formDTO.getDetails())) { + List list = formDTO.getDetails().stream().map(detail -> { + StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity(); + detailEntity.setStaffPatrolRecId(formDTO.getStaffPatrolRecId()); + detailEntity.setCustomerId(tokenDto.getCustomerId()); + detailEntity.setSerialNum(detail.getSerialNum()); + detailEntity.setUploadTime(new Date()); + detailEntity.setLatitude(detail.getLatitude()); + detailEntity.setLongitude(detail.getLongitude()); + detailEntity.setSpeed(detail.getSpeed()); + detailEntity.setAccuracy(detail.getAccuracy()); + detailEntity.setAltitude(detail.getAltitude()); + detailEntity.setVerticalaccuracy(detail.getVerticalAccuracy()); + detailEntity.setHorizontalaccuracy(detail.getHorizontalAccuracy()); + return detailEntity; + }).collect(Collectors.toList()); + + staffPatrolDetailService.insertBatch(list); + } + + PatrolUploadResultDTO dto = new PatrolUploadResultDTO(); + dto.setStaffPatrolRecId(formDTO.getStaffPatrolRecId()); + return dto; + } + + /** + * @Description 查询经纬度 + * @Param userIds + * @author zxc + * @date 2021/6/9 10:40 上午 + */ + @Override + public UserNameAndLLResultDTO selectLL(List userIds) { + UserNameAndLLResultDTO result = new UserNameAndLLResultDTO(); + if (CollectionUtils.isEmpty(userIds)){ + return result; + } + // 经纬度查询 + List llResult = baseDao.selectLL(userIds); + if (!CollectionUtils.isEmpty(llResult)){ + result.setLl(llResult); + } + // 姓名查询 + List nameResult = customerStaffDao.selectUserName(userIds); + if (!CollectionUtils.isEmpty(nameResult)){ + result.setUserNames(nameResult); + } + return result; + } + + /** + * @Description 002、查看巡查记录 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:25 下午 + */ + @Override + public List recordList(RecordListFormDTO formDTO) { + List result = staffPatrolRecordDao.recordList(formDTO); + if (!CollectionUtils.isEmpty(result)){ + return result; + } + return new ArrayList<>(); + } + + /** + * @Description 003、巡查轨迹 + * @Param formDTO + * @author zxc + * @date 2021/6/7 3:35 下午 + */ + @Override + public List patrolTrack(PatrolTrackFormDTO formDTO) { + List results = staffPatrolDetailDao.selectPatrolTrack(formDTO.getStaffPatrolRecId()); + if (!CollectionUtils.isEmpty(results)){ + return results; + } + return new ArrayList<>(); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java index bb85550f3c..0e65e701b2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java @@ -32,10 +32,7 @@ import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.form.CustomerStaffRoleListFormDTO; import com.epmet.dto.form.RolesUsersListFormDTO; -import com.epmet.dto.result.CustomerStaffRoleResultDTO; -import com.epmet.dto.result.CustomerStaffRoleListResultDTO; -import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.StaffRolesResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.StaffRoleEntity; import com.epmet.redis.StaffRoleRedis; import com.epmet.service.StaffRoleService; @@ -43,6 +40,7 @@ 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 org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; @@ -188,4 +186,22 @@ public class StaffRoleServiceImpl extends BaseServiceImpl staffGridRole(List forms) { + if (CollectionUtils.isEmpty(forms)){ + return new ArrayList<>(); + } + List result = baseDao.staffGridRole(forms); + if (CollectionUtils.isEmpty(result)){ + return new ArrayList<>(); + } + return result; + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.12__add_user_patrol.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.12__add_user_patrol.sql new file mode 100644 index 0000000000..80a59beb1d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.12__add_user_patrol.sql @@ -0,0 +1,46 @@ +CREATE TABLE `staff_patrol_detail` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `STAFF_PATROL_REC_ID` varchar(64) NOT NULL COMMENT 'staff_patrol_record.ID', + `SERIAL_NUM` int(11) NOT NULL COMMENT '前端给的序号', + `UPLOAD_TIME` datetime NOT NULL COMMENT '上传时间,后台自动插入该时间', + `LATITUDE` varchar(64) NOT NULL COMMENT '纬度', + `LONGITUDE` varchar(64) NOT NULL COMMENT '经度', + `SPEED` varchar(64) NOT NULL DEFAULT '0' COMMENT '速度,单位m/s;开始和结束时默认0', + `ACCURACY` varchar(64) DEFAULT NULL COMMENT '位置的精确度', + `ALTITUDE` varchar(64) DEFAULT NULL COMMENT '高度,单位米', + `VERTICALACCURACY` varchar(64) DEFAULT NULL COMMENT '垂直经度,单位m', + `HORIZONTALACCURACY` varchar(64) DEFAULT NULL COMMENT '水平经度,单位m', + `ADDRESS` varchar(255) DEFAULT NULL COMMENT '地址;暂时不用', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作人员巡查记录明细'; + +-- ---------------------------- +-- Table structure for staff_patrol_record +-- ---------------------------- +CREATE TABLE `staff_patrol_record` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `GRID` varchar(64) NOT NULL COMMENT '网格id', + `GRID_PIDS` varchar(512) NOT NULL COMMENT '网格所有上级id', + `STAFF_ID` varchar(64) NOT NULL COMMENT '工作人员用户id', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '工作人员所属组织id=网格所属的组织id', + `PATROL_START_TIME` datetime NOT NULL COMMENT '巡查开始时间', + `PATROL_END_TIME` datetime DEFAULT NULL COMMENT '巡查结束时间,前端传入', + `ACTRUAL_END_TIME` datetime DEFAULT NULL COMMENT '实际结束时间=操作结束巡查的时间', + `TOTAL_TIME` int(11) DEFAULT NULL COMMENT '本次巡查总耗时,单位秒;结束巡查时写入', + `STATUS` varchar(10) NOT NULL DEFAULT 'patrolling' COMMENT '正在巡查中:patrolling;结束:end', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作人员巡查主记录'; diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index eab3a42191..e6db9c61a6 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -357,4 +357,21 @@ AND user_id = #{staffId} LIMIT 1 + + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolDetailDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolDetailDao.xml new file mode 100644 index 0000000000..0168ef7042 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolDetailDao.xml @@ -0,0 +1,19 @@ + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml new file mode 100644 index 0000000000..2e760a499e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml index 0b39b350b7..fe378570ec 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -193,4 +193,18 @@ AND gsr.del_flag = '0' AND sr.staff_id = #{userId} + + +