Browse Source

Merge remote-tracking branch 'remotes/origin/dev'

# Conflicts:
#	epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
master
jianjun 4 years ago
parent
commit
d63331103a
  1. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java
  2. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  3. 29
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  4. 131
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolDetailDTO.java
  5. 121
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolRecordDTO.java
  6. 25
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolDateListFormDTO.java
  7. 35
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/PatrolRecordListFormDTO.java
  8. 54
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java
  9. 21
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolDateListResultDTO.java
  10. 37
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordDetailDTO.java
  11. 48
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PatrolRecordListResultDTO.java
  12. 32
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java
  13. 67
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  14. 34
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolDetailDao.java
  15. 44
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java
  16. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java
  17. 101
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffPatrolDetailEntity.java
  18. 91
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffPatrolRecordEntity.java
  19. 30
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  20. 44
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolDetailService.java
  21. 55
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolRecordService.java
  22. 136
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  23. 71
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolDetailServiceImpl.java
  24. 93
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolRecordServiceImpl.java
  25. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  26. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  27. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolDetailDao.xml
  28. 52
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml
  29. 34
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
  30. 131
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/StaffPatrolDetailDTO.java
  31. 121
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/StaffPatrolRecordDTO.java
  32. 27
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/GridManagerListFormDTO.java
  33. 76
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/GridManagerListResultDTO.java
  34. 20
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java
  35. 66
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java
  36. 21
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolRecordController.java
  37. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  38. 45
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolDetailDao.java
  39. 55
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolRecordDao.java
  40. 101
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/user/StaffPatrolDetailEntity.java
  41. 91
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/user/StaffPatrolRecordEntity.java
  42. 23
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenOrgService.java
  43. 44
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenOrgServiceImpl.java
  44. 44
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java
  45. 14
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolRecordService.java
  46. 194
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java
  47. 21
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolRecordServiceImpl.java
  48. 20
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  49. 18
      epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolDetailDao.xml
  50. 41
      epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolRecordDao.xml
  51. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectGridDailyDTO.java
  52. 18
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CenterPointForm.java
  53. 31
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java
  54. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java
  55. 67
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  56. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java
  57. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java
  58. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  59. 39
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/EIDimServiceImpl.java
  60. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  61. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java
  62. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
  63. 14
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml
  64. 21
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridStaffResultDTO.java
  65. 9
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  66. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  67. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java
  68. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java
  69. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java
  70. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  71. 35
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java
  72. 14
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml
  73. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/PatrolConstant.java
  74. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolRecordDetailFormDTO.java
  75. 23
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolTrackFormDTO.java
  76. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadDetailFormDTO.java
  77. 55
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolUploadFormDTO.java
  78. 26
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RecordListFormDTO.java
  79. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffPatrolInitFormDTO.java
  80. 42
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StartPatrolFormDTO.java
  81. 65
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridManagerUserListResultDTO.java
  82. 20
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GridStaffUserResultDTO.java
  83. 39
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRecordDetailResultDTO.java
  84. 26
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolTrackResultDTO.java
  85. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolUploadResultDTO.java
  86. 36
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RecordListResultDTO.java
  87. 30
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffPatrolInitResultDTO.java
  88. 26
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StartPatrolResultDTO.java
  89. 33
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameAndLLResultDTO.java
  90. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserNameResultDTO.java
  91. 36
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  92. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  93. 144
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffPatrolController.java
  94. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  95. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  96. 45
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolDetailDao.java
  97. 55
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolRecordDao.java
  98. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  99. 101
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolDetailEntity.java
  100. 91
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolRecordEntity.java

10
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","更多:系统:系统日志:列表","系统日志列表"),
/**
* 项目立项
*/

1
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,"您已表态"),

29
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);
}
}

131
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

121
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

25
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;
}

35
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;
}

54
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<String> 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 {}
}

21
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<String> list;
}

37
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;
}

48
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<PatrolRecordDetailDTO> details;
}

32
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 = "";
}

67
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<List<StaffListResultDTO>> 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<List<StaffListResultDTO>>().ok(epmetUserService.staffList(formDTO));
}
/**
* 巡查记录列表查询
* @author zhaoqifeng
* @date 2021/6/9 14:48
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO>>
*/
@PostMapping("recordlist")
public Result<List<PatrolRecordListResultDTO>> recordList(@RequestBody PatrolRecordListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<PatrolRecordListResultDTO>>().ok(epmetUserService.recordList(formDTO));
}
/**
* 历史巡查日期查询
* @author zhaoqifeng
* @date 2021/6/10 14:36
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO>
*/
@PostMapping("patrolleddatelist")
public Result<PatrolDateListResultDTO> patrolDateList(@RequestBody PatrolDateListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<PatrolDateListResultDTO>().ok(epmetUserService.patrolDateList(formDTO));
}
}

34
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffPatrolDetailEntity> {
}

44
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffPatrolRecordEntity> {
/**
* @Description 按条件查询巡查业务数据
* @author sun
*/
List<StaffListResultDTO> selectPatrolList(StaffListFormDTO formDTO);
}

8
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<CustomerGridEntity> {
* @Description 根据组织Id查询当前组织下所有网格列表
**/
List<GridInfoResultDTO> selectGridListByAgencyId(@Param("agencyId") String agencyId);
/**
* @param staffId
* @Author sun
* @Description 查询工作人员所属组织下网格列表
**/
List<CustomerGridDTO> gridListByStaffId(@Param("staffId") String staffId);
}

101
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

91
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

30
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<String> selectUserIdByCustomerId(List<String> userIds);
/**
* @Param formDTO
* @Description 001各人员巡查记录列表查询
* @author sun
*/
List<StaffListResultDTO> staffList(StaffListFormDTO formDTO);
/**
* 巡查记录列表查询
* @author zhaoqifeng
* @date 2021/6/9 14:49
* @param formDTO
* @return java.util.List<com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO>
*/
List<PatrolRecordListResultDTO> 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);
}

44
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffPatrolDetailEntity> {
/**
* 获取记录明细
* @author zhaoqifeng
* @date 2021/6/9 15:09
* @param recordIds
* @return java.util.Map<java.lang.String,java.util.List<com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO>>
*/
Map<String, List<StaffPatrolDetailDTO>> getDetailByRecordIds(List<String> recordIds);
}

55
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffPatrolRecordEntity> {
/**
* 获取巡查记录列表
*
* @param gridId
* @param userId
* @param patrolDate
* @return java.util.List<com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO>
* @author zhaoqifeng
* @date 2021/6/9 14:55
*/
List<StaffPatrolRecordDTO> getRecordList(String gridId, String userId, String patrolDate);
/**
* 获取日期列表
* @author zhaoqifeng
* @date 2021/6/10 14:49
* @param gridId
* @param staffId
* @return java.util.List<java.lang.String>
*/
List<String> getDateList(String gridId, String staffId);
}

136
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<String> selectUserIdByCustomerId(List<String> userIds) {
return userBaseInfoDao.selectUserIdByCustomerId(userIds);
}
/**
* @Param formDTO
* @Description 001各人员巡查记录列表查询
* @author sun
*/
@Override
public List<StaffListResultDTO> staffList(StaffListFormDTO formDTO) {
List<StaffListResultDTO> resultList = new ArrayList<>();
//1.设置分页参数
int num = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
formDTO.setPageNo(num);
//2.查询当前人员所属组织下网格列表数据,供后续使用
List<CustomerGridDTO> 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<com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO>
* @author zhaoqifeng
* @date 2021/6/9 14:49
*/
@Override
public List<PatrolRecordListResultDTO> recordList(PatrolRecordListFormDTO formDTO) {
List<StaffPatrolRecordDTO> recordList = staffPatrolRecordService.getRecordList(formDTO.getGridId(), formDTO.getUserId(), formDTO.getPatrolDate());
if (CollectionUtils.isEmpty(recordList)) {
return Collections.emptyList();
}
List<String> recordIds = recordList.stream().map(StaffPatrolRecordDTO :: getId).collect(Collectors.toList());
Map<String, List<StaffPatrolDetailDTO>> details = staffPatrolDetailService.getDetailByRecordIds(recordIds);
List<PatrolRecordListResultDTO> 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<StaffPatrolDetailDTO> detailList = details.get(record.getId());
List<PatrolRecordDetailDTO> 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<String> 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;
}
}

71
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffPatrolDetailDao, StaffPatrolDetailEntity> implements StaffPatrolDetailService {
/**
* 获取记录明细
*
* @param recordIds
* @return java.util.Map<java.lang.String, java.util.List < com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO>>
* @author zhaoqifeng
* @date 2021/6/9 15:09
*/
@Override
public Map<String, List<StaffPatrolDetailDTO>> getDetailByRecordIds(List<String> 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<StaffPatrolDetailEntity> wrapper = new QueryWrapper<>();
wrapper.apply(sql.toString());
List<StaffPatrolDetailDTO> list = ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), StaffPatrolDetailDTO.class);
return list.stream().collect(Collectors.groupingBy(StaffPatrolDetailDTO::getStaffPatrolRecId));
}
}

93
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffPatrolRecordDao, StaffPatrolRecordEntity> implements StaffPatrolRecordService {
/**
* 获取巡查记录列表
*
* @param gridId
* @param userId
* @param patrolDate
* @return java.util.List<com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO>
* @author zhaoqifeng
* @date 2021/6/9 14:55
*/
@Override
public List<StaffPatrolRecordDTO> getRecordList(String gridId, String userId, String patrolDate) {
QueryWrapper<StaffPatrolRecordEntity> 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<java.lang.String>
* @author zhaoqifeng
* @date 2021/6/10 14:49
*/
@Override
public List<String> getDateList(String gridId, String staffId) {
QueryWrapper<StaffPatrolRecordEntity> 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<StaffPatrolRecordEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(StaffPatrolRecordEntity::getId).collect(Collectors.toList());
}
}

8
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<NextAreaCodeResultDTO> queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO);
List<OrgInfoCommonDTO> queryNextOrgInfoDTO(String customerId, String orgId);
/**
* @param staffId
* @Author sun
* @Description 查询工作人员所属组织下网格列表
**/
List<CustomerGridDTO> gridListByStaffId(String staffId);
}

12
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<CustomerGridDTO> gridListByStaffId(String staffId) {
//网格名是拼接上两级组织名称
List<CustomerGridDTO> resultList = customerGridDao.gridListByStaffId(staffId);
return resultList;
}
}

9
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolDetailDao.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.epmetuser.StaffPatrolDetailDao">
</mapper>

52
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.epmetuser.StaffPatrolRecordDao">
<select id="selectPatrolList" resultType="com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO">
SELECT
spr.grid AS "gridId",
spr.staff_id AS "staffId",
MAX(spr.patrol_start_time) AS "patrolStartTime",
COUNT(spr.staff_id) AS "patrolTotal",
(
select
`status`
from
staff_patrol_record
where
grid = spr.grid
and staff_id = spr.staff_id
order by
patrol_start_time desc
limit 1
) AS "status",
cs.real_name AS "staffName",
cs.gender AS "gender"
FROM
staff_patrol_record spr
LEFT JOIN customer_staff cs ON spr.staff_id = cs.user_id
WHERE
spr.del_flag = '0'
<if test='patrolStartTime != "" and patrolStartTime != null'>
AND spr.patrol_start_time <![CDATA[ >= ]]> #{patrolStartTime}
</if>
<if test='staffName != "" and staffName != null'>
AND cs.real_name LIKE CONCAT('%',#{staffName},'%')
</if>
<foreach collection="gridIds" item="gridId" open="AND( " separator=" OR " close=")">
spr.GRID = #{gridId}
</foreach>
GROUP BY
spr.grid, spr.staff_id
<if test='sortCode != "" and sortCode != null and sortCode == "patrolTotal" '>
ORDER BY COUNT(spr.staff_id) DESC
</if>
<if test='sortCode != "" and sortCode != null and sortCode == "latestPatrolledTime" '>
ORDER BY MAX(spr.patrol_start_time) DESC
</if>
LIMIT
#{pageNo}, #{pageSize}
</select>
</mapper>

34
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml

@ -52,4 +52,38 @@
AND pid = #{agencyId}
</select>
<select id="gridListByStaffId" resultType="com.epmet.dataaggre.dto.govorg.CustomerGridDTO">
SELECT
cg.id AS 'id',
IF (
ca.pid = '0',
IF (
ca.organization_name = '',
cg.grid_name,
CONCAT(ca.organization_name,'-',cg.grid_name)
),
CONCAT(
(select organization_name from customer_agency where id = ca.pid),
'-',
IF (
ca.organization_name = '',
cg.grid_name,
CONCAT(ca.organization_name,'-',cg.grid_name)
)
)
)AS 'gridName'
FROM
customer_grid cg
INNER JOIN customer_agency ca ON cg.pid = ca.id
WHERE
cg.del_flag = '0'
AND ca.del_flag = '0'
AND cg.pid = (
select agency_id
from customer_staff_agency
where del_flag = '0'
AND user_id = #{staffId}
)
</select>
</mapper>

131
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

121
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

27
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;
}

76
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;
}
}

20
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";
}

66
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<List<GridManagerListResultDTO>> gridManagerList(@RequestBody GridManagerListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, GridManagerListFormDTO.GridManagerListForm.class);
return new Result<List<GridManagerListResultDTO>>().ok(staffPatrolService.gridManagerList(formDTO));
}
/**
* @Description 002查看巡查记录
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:25 下午
*/
@PostMapping("recordlist")
public Result<List<RecordListResultDTO>> recordList(@RequestBody RecordListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, RecordListFormDTO.RecordListForm.class);
return new Result<List<RecordListResultDTO>>().ok(staffPatrolService.recordList(formDTO));
}
/**
* @Description 003巡查轨迹
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:35 下午
*/
@PostMapping("patroltrack")
public Result<List<PatrolTrackResultDTO>> patrolTrack(@RequestBody PatrolTrackFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, PatrolTrackFormDTO.PatrolTrackForm.class);
return new Result<List<PatrolTrackResultDTO>>().ok(staffPatrolService.patrolTrack(formDTO));
}
}

21
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;
}

9
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<String> getNextAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId);
List<String> selectSubAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId);
/**
* @Description 根据agencyId查询网格
* @Param agencyId
* @author zxc
* @date 2021/6/8 1:27 下午
*/
List<GridManagerListResultDTO> selectGrid(@Param("agencyId")String agencyId,@Param("areaCode")String areaCode);
}

45
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffPatrolDetailEntity> {
/**
* @Description 查询巡查轨迹
* @Param staffPatrolRecId
* @author zxc
* @date 2021/6/7 5:13 下午
*/
List<PatrolTrackResultDTO> selectPatrolTrack(@Param("staffPatrolRecId") String staffPatrolRecId);
}

55
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffPatrolRecordEntity> {
/**
* @Description 巡查记录查询
* @Param formDTO
* @author zxc
* @date 2021/6/7 5:29 下午
*/
List<RecordListResultDTO> recordList(RecordListFormDTO formDTO);
/**
* @Description 查询经纬度
* @Param userIds
* @author zxc
* @date 2021/6/9 10:24 上午
*/
List<GridManagerListResultDTO> selectLL(@Param("userIds")List<String> userIds);
}

101
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

91
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

23
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<GridManagerListResultDTO> selectAllGrid(String agencyId,String areaCode);
}

44
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<GridManagerListResultDTO> selectAllGrid(String agencyId,String areaCode) {
List<GridManagerListResultDTO> result = agencyDao.selectGrid(agencyId, areaCode);
if (!CollectionUtils.isEmpty(result)){
return result;
}
return new ArrayList<>();
}
}

44
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<GridManagerListResultDTO> gridManagerList(GridManagerListFormDTO formDTO);
/**
* @Description 002查看巡查记录
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:25 下午
*/
List<RecordListResultDTO> recordList(RecordListFormDTO formDTO);
/**
* @Description 003巡查轨迹
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:35 下午
*/
List<PatrolTrackResultDTO> patrolTrack(PatrolTrackFormDTO formDTO);
}

14
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<StaffPatrolRecordEntity> {
}

194
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<GridManagerListResultDTO> gridManagerList(GridManagerListFormDTO formDTO) {
List<GridManagerListResultDTO> 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<String> gridIds = grids.stream().map(m -> m.getGridId()).collect(Collectors.toList());
// 查询网格下的网格员
Result<List<GridStaffResultDTO>> resultData = govOrgOpenFeignClient.selectGridStaffByGridIds(gridIds);
if(!resultData.success()){
throw new RenException("查询网格下的网格员失败【"+resultData.getMsg()+"】");
}
List<GridStaffResultDTO> data = resultData.getData();
if (CollectionUtils.isEmpty(data)){
return new ArrayList<>();
}
List<GridManagerListResultDTO> result = ConvertUtils.sourceToTarget(data, GridManagerListResultDTO.class);
// 查询经纬度
Result<UserNameAndLLResultDTO> 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<GridManagerListResultDTO> 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<RecordListResultDTO> recordList(RecordListFormDTO formDTO) {
Result<List<RecordListResultDTO>> listResult = epmetUserOpenFeignClient.recordList(formDTO);
if (!listResult.success()){
throw new RenException("查询巡查记录失败【"+listResult.getMsg()+"】");
}
List<RecordListResultDTO> 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<PatrolTrackResultDTO> patrolTrack(PatrolTrackFormDTO formDTO) {
Result<List<PatrolTrackResultDTO>> result = epmetUserOpenFeignClient.patrolTrack(formDTO);
if (!result.success()){
throw new RenException("查询 巡查轨迹失败【"+result.getMsg()+"】");
}
List<PatrolTrackResultDTO> results = result.getData();
if (!CollectionUtils.isEmpty(results)){
return results;
}
return new ArrayList<>();
}
}

21
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<StaffPatrolRecordDao, StaffPatrolRecordEntity> implements StaffPatrolRecordService {
}

20
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -320,4 +320,24 @@
</otherwise>
</choose>
</select>
<!-- 根据agencyId查询网格 -->
<select id="selectGrid" resultType="com.epmet.user.result.GridManagerListResultDTO">
SELECT
CONCAT(IF(ISNULL(ca2.AGENCY_NAME),'',CONCAT(ca2.AGENCY_NAME,'-')),
IF(ISNULL(ca.AGENCY_NAME),'',CONCAT(ca.AGENCY_NAME,'-')),
IF(ISNULL(cg.GRID_NAME),'',cg.GRID_NAME)) AS gridName,
cg.GRID_ID,
IFNULL(cg.CENTER_MARK,'') AS centerMark
FROM epmet_evaluation_index.screen_customer_grid cg
LEFT JOIN epmet_evaluation_index.screen_customer_agency ca ON ca.AGENCY_ID = cg.PARENT_AGENCY_ID AND ca.DEL_FLAG = 0
LEFT JOIN epmet_evaluation_index.screen_customer_agency ca2 ON ca2.AGENCY_ID = ca.PID AND ca2.DEL_FLAG = 0
WHERE cg.DEL_FLAG = 0
<if test="agencyId == null">
AND cg.AREA_CODE LIKE CONCAT(#{areaCode},'%')
</if>
<if test="areaCode == null">
AND cg.PARENT_AGENCY_ID = #{agencyId}
</if>
</select>
</mapper>

18
epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolDetailDao.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.user.StaffPatrolDetailDao">
<!-- 查询巡查轨迹 -->
<select id="selectPatrolTrack" resultType="com.epmet.dto.result.PatrolTrackResultDTO">
SELECT
LATITUDE,
LONGITUDE
FROM
staff_patrol_detail
WHERE
STAFF_PATROL_REC_ID = #{staffPatrolRecId}
AND DEL_FLAG = 0
ORDER BY SERIAL_NUM
</select>
</mapper>

41
epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolRecordDao.xml

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.user.StaffPatrolRecordDao">
<!-- 巡查记录查询 -->
<select id="recordList" resultType="com.epmet.dto.result.RecordListResultDTO">
SELECT
ID AS staffPatrolRecId,
DATE_FORMAT(PATROL_START_TIME,'%Y-%m-%d %H:%i:%s') AS patrolStartTime,
DATE_FORMAT(PATROL_END_TIME,'%Y-%m-%d %H:%i:%s') AS patrolEndTime,
`STATUS`
FROM staff_patrol_record
WHERE DEL_FLAG = 0
AND GRID_ID = #{gridId}
AND STAFF_ID = #{staffId}
ORDER BY CREATED_TIME DESC
</select>
<!-- 查询经纬度 -->
<select id="selectLL" resultType="com.epmet.user.result.GridManagerListResultDTO">
SELECT t.* FROM
(SELECT
distinct(pr.ID) AS ID,
pr.GRID AS gridId,
pr.STAFF_ID,
pr.`STATUS`,
pd.LATITUDE,
pd.LONGITUDE,
pd.SERIAL_NUM
FROM staff_patrol_record pr
LEFT JOIN staff_patrol_detail pd ON pd.STAFF_PATROL_REC_ID = pr.ID AND pd.DEL_FLAG = 0
WHERE pr.DEL_FLAG = 0
AND (
<foreach collection="userIds" item="userId" separator=" OR ">
pr.STAFF_ID = #{userId}
</foreach>
)
ORDER BY pd.SERIAL_NUM DESC)t GROUP BY ID
</select>
</mapper>

12
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;
}
}
}

18
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<Double> center = new ArrayList<>();
}

31
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<CenterPointForm> centerDataList = new ArrayList<>();
/* @Data
public class CenterData implements Serializable{
private static final long serialVersionUID = 6425114459278919896L;
private String title;
private List<Double> center = new ArrayList<>();
}*/
}

14
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<String,Integer> effectRow = eiDimService.updateCenterPointByName(param);
return new Result().ok(effectRow);
}
}

67
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<ScreenCustomerGridEntity> {
/**
*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<ScreenCustomerGridEntity>
/**
* 15网格信息上传
* 2) 在批量新增
* 2) 在批量新增
*
* @param list
* @param customerId
* @Author zhangyong
* @Date 10:52 2020-08-18
**/
void batchInsertCustomerGrid(@Param("list") List<CustomerGridFormDTO> list, @Param("customerId")String customerId);
void batchInsertCustomerGrid(@Param("list") List<CustomerGridFormDTO> 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<ScreenCustomerGridEntity>
Integer selectCountByCustomerId(@Param("customerId") String customerId);
/**
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>
* @param customerId
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>
* @author yinzuomei
* @description 查询客户下网格信息
* @Date 2020/8/26 15:33
**/
List<ScreenCustomerGridDTO> selectListByCustomerId(@Param("customerId")String customerId);
List<ScreenCustomerGridDTO> selectListByCustomerId(@Param("customerId") String customerId);
/**
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>
* @param formDTO
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>
* @author yinzuomei
* @description 分页查询网格列表
* @Date 2020/8/27 14:42
@ -89,7 +89,7 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
List<ScreenCustomerGridDTO> 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<ScreenCustomerGridEntity>
* @Date 10:45 2020-09-04
**/
List<ScreenCustomerGridDTO> selectListMismatchGridInfo(@Param("customerId") String customerId,
@Param("gridIds") String[] gridIds,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
@Param("gridIds") String[] gridIds,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds") List<String> subCustomerIds);
/**
* 根据客户id 查询网格(党支部)详细信息
*
* @param customerId
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
List<ScreenCustomerGridDTO> selectListGridInfo(@Param("customerId")String customerId,
List<ScreenCustomerGridDTO> selectListGridInfo(@Param("customerId") String customerId,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
@Param("subCustomerIds") List<String> subCustomerIds);
/**
* @Description 根据agencyId查询网格ID
* @param agencyId
* @Description 根据agencyId查询网格ID
* @author zxc
* @date 2020/9/22 2:16 下午
*/
List<String> selectGridIdByAgencyId(@Param("agencyId")String agencyId);
List<String> selectGridIdByAgencyId(@Param("agencyId") String agencyId);
ScreenCustomerGridEntity getLastAddGrid();
@ -137,58 +138,59 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
ScreenCustomerGridEntity getByGridId(String gridId);
/**
* @Description 查询客户下所有网格ID
* @param customerId
* @param dateId
* @Description 查询客户下所有网格ID
* @author zxc
* @date 2020/9/23 3:10 下午
*/
List<PartyBaseInfoFormDTO> selectAllGridIdToParty(String customerId, String dateId);
/**
* @Description 查询客户下所有网格ID
* @Description 查询客户下所有网格ID
* @Param customerId
* @Param monthId
* @author zxc
* @date 2020/9/25 10:43 上午
*/
List<ScreenPartyLinkMassesDataFormDTO> selectAllGridIdToPartyLinkMessage(@Param("customerId") String customerId,@Param("monthId") String monthId);
List<ScreenPartyBranchDataFormDTO> selectAllGridIdToOrganize(@Param("customerId") String customerId,@Param("monthId") String monthId);
List<ScreenPartyLinkMassesDataFormDTO> selectAllGridIdToPartyLinkMessage(@Param("customerId") String customerId, @Param("monthId") String monthId);
List<ScreenPartyBranchDataFormDTO> selectAllGridIdToOrganize(@Param("customerId") String customerId, @Param("monthId") String monthId);
/**
* @Description 查询org名称
* @param gridIds
* @Description 查询org名称
* @author zxc
* @date 2020/9/24 1:27 下午
*/
List<OrgNameResultDTO> selectOrgName(@Param("gridIds") List<String> gridIds);
/**
* @Description 查询机关的直属网格
* @param agencyIds
* @Description 查询机关的直属网格
* @author zxc
* @date 2020/9/24 2:33 下午
*/
List<GridInfoResultDTO> selectDirectGrid(@Param("agencyIds") List<String> agencyIds);
/**
* @Description 查询全部网格信息
* @param customerId
* @Description 查询全部网格信息
* @author zxc
* @date 2020/9/19 10:50 上午
*/
List<PartyAbilityGridMonthlyFormDTO> selectAllGridInfoToParty(String customerId);
/**
* @Description 查询全部网格信息
* @param customerId
* @Description 查询全部网格信息
* @author zxc
* @date 2020/9/18 10:47 上午
*/
List<GovernAbilityGridMonthlyFormDTO> 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<ScreenCustomerGridEntity>
List<ScreenProjectGridDailyDTO> selectGridInfoByCustomerId(@Param("customerId") String customerId);
/**
* @Description 查询直属网格信息
* @Description 查询直属网格信息
* @Param customerId
* @Param level
* @author zxc
* @date 2021/3/23 下午4:03
*/
List<ScreenCustomerGridDTO> selectBelongGridInfo(@Param("customerId") String customerId,@Param("level") String level);
List<ScreenCustomerGridDTO> selectBelongGridInfo(@Param("customerId") String customerId, @Param("level") String level);
/**
* desc: 根据客户Id 和pids 获取该客户下及该组织下的网格列表
*
* @param customerId
* @param pids
* @return java.util.List<com.epmet.dto.screen.ScreenProjectGridDailyDTO>
* @author LiuJanJun
* @date 2021/6/10 10:45 上午
*/
List<ScreenProjectGridDailyDTO> selectGridInfoList(@Param("customerId") String customerId, @Param("pids") String pids);
}

13
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<String,Integer> updateCenterPointByName(GridCenterPointForm param);
}

9
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<ScreenCustomerGri
* @date 2021/3/23 下午4:02
*/
List<ScreenCustomerGridDTO> selectBelongGridInfo(String customerId,String level);
}
Integer updateCenterPointByName(String customerId, String title, List<Double> center);
List<ScreenProjectGridDailyDTO> selectGridInfoByCustomerId(String customerId);
List<ScreenProjectGridDailyDTO> selectGridInfoList(String customerId, String pids);
}

26
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java

@ -19,6 +19,7 @@ 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;
@ -29,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;
@ -38,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;
@ -186,4 +189,25 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
public List<ScreenCustomerGridDTO> selectBelongGridInfo(String customerId, String level) {
return baseDao.selectBelongGridInfo(customerId, level);
}
}
@Override
public Integer updateCenterPointByName(String customerId, String title, List<Double> center) {
LambdaUpdateWrapper<ScreenCustomerGridEntity> tWrapper = new LambdaUpdateWrapper<>();
String val = center.toString();
List<String> 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<ScreenProjectGridDailyDTO> selectGridInfoByCustomerId(String customerId) {
return baseDao.selectGridInfoByCustomerId(customerId);
}
@Override
public List<ScreenProjectGridDailyDTO> selectGridInfoList(String customerId, String pids) {
return baseDao.selectGridInfoList(customerId,pids);
}
}

39
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<CustomerAgencyEntity> listAgencies2Update() {
@ -69,6 +71,7 @@ public class EIDimServiceImpl implements EIDimService {
/**
* 查询可增加的单位
*
* @return
*/
private List<CustomerAgencyEntity> listAgencies2Add() {
@ -92,6 +95,7 @@ public class EIDimServiceImpl implements EIDimService {
/**
* 查询需要更新的部门列表
*
* @return
*/
private List<CustomerDepartmentEntity> listDepts2Update() {
@ -109,6 +113,7 @@ public class EIDimServiceImpl implements EIDimService {
/**
* 查询需要新增的部门列表
*
* @return
*/
private List<CustomerDepartmentEntity> listDepts2Add() {
@ -126,10 +131,34 @@ public class EIDimServiceImpl implements EIDimService {
@Override
public void initGrids() {
List<CustomerGridEntity> grids2Add = listGrids2Add();
List<CustomerGridEntity> grids2Update =listGrids2Update();
List<CustomerGridEntity> grids2Update = listGrids2Update();
screenCustomerGridService.addAndUpdateGrids(grids2Add, grids2Update);
}
@Override
public Map<String, Integer> updateCenterPointByName(GridCenterPointForm param) {
List<ScreenProjectGridDailyDTO> gridInfos = screenCustomerGridService.selectGridInfoList(param.getCustomerId(),param.getPids());
Map<String, Integer> 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<CustomerGridEntity> listGrids2Update() {
ScreenCustomerGridEntity lastUpdateGrid = screenCustomerGridService.getLastUpdateGrid();
if (lastUpdateGrid != null) {

8
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<AgencyGridGroupPeopleTotalResultDTO> 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(

6
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;
}

2
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));
}
/**

14
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}
</select>
<select id="selectGridInfoList" resultType="com.epmet.dto.screen.ScreenProjectGridDailyDTO">
SELECT
cg.CUSTOMER_ID,
cg.GRID_ID,
cg.GRID_NAME,
cg.PARENT_AGENCY_ID AS pid,
cg.AREA_CODE,
cg.CENTER_MARK
FROM screen_customer_grid cg
WHERE cg.DEL_FLAG = 0
AND cg.CUSTOMER_ID = #{customerId}
AND cg.ALL_PARENT_IDS like concat(#{pids},'%')
</select>
</mapper>

21
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;
}

9
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<ProcessorListResultDTO> getProcessorList(@PathVariable("agencyId") String agencyId);
/**
* @Description 查询网格下的网格员
* @Param gridIds
* @author zxc
* @date 2021/6/8 3:36 下午
*/
@PostMapping("/gov/org/customerstaffgrid/gridstaff")
Result<List<GridStaffResultDTO>> selectGridStaffByGridIds(@RequestBody List<String> gridIds);
}

5
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<ProcessorListResultDTO> getProcessorList(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getProcessorList", agencyId);
}
@Override
public Result<List<GridStaffResultDTO>> selectGridStaffByGridIds(List<String> gridIds) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridStaffByGridIds", gridIds);
}
}

12
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<List<GridStaffResultDTO>> selectGridStaffByGridIds(@RequestBody List<String> gridIds){
return new Result<List<GridStaffResultDTO>>().ok(customerStaffGridService.selectGridStaffByGridIds(gridIds));
}
}

9
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<CustomerStaffGridEntity> {
* @Description 查询人员在客户下参与的网格列表
*/
List<CustomerStaffGridDTO> selectStaffGridList(CustomerStaffGridDTO staffGridDTO);
/**
* @Description 查询网格下的人
* @Param gridIds
* @author zxc
* @date 2021/6/8 3:36 下午
*/
List<GridStaffResultDTO> selectGridStaffByGridIds(@Param("gridIds") List<String> gridIds);
}

9
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<CustomerStaffGridE
* @date 2020.04.29 22:59
**/
Result<List<String>> getAllGridStaffs(CommonGridIdFormDTO gridIdFormDTO);
/**
* @Description 查询网格下的人
* @Param gridIds
* @author zxc
* @date 2021/6/8 3:36 下午
*/
List<GridStaffResultDTO> selectGridStaffByGridIds(List<String> gridIds);
}

2
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<CustomerGridDao, Cu
@Override
public Result<CustomerGridDTO> getBaseInfo(CustomerGridFormDTO customerGridFormDTO) {
return new Result<CustomerGridDTO>().ok(baseDao.getGridBaseInfoById(customerGridFormDTO.getGridId()));
return new Result<CustomerGridDTO>().ok(ConvertUtils.sourceToTarget(baseDao.selectById(customerGridFormDTO.getGridId()), CustomerGridDTO.class));
}
}

35
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<CustomerStaffG
@Autowired
private CustomerStaffGridRedis customerStaffGridRedis;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
public PageData<CustomerStaffGridDTO> page(Map<String, Object> params) {
@ -146,4 +153,32 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl<CustomerStaffG
)
);
}
/**
* @Description 查询网格下的人
* @Param gridIds
* @author zxc
* @date 2021/6/8 3:36 下午
*/
@Override
public List<GridStaffResultDTO> selectGridStaffByGridIds(List<String> gridIds) {
if (CollectionUtils.isEmpty(gridIds)){
return new ArrayList<>();
}
// 查询网格下所有的人
List<GridStaffResultDTO> gridStaff = baseDao.selectGridStaffByGridIds(gridIds);
if (CollectionUtils.isEmpty(gridStaff)){
return new ArrayList<>();
}
// 拿着网格下所有人去筛选网格员
Result<List<GridStaffResultDTO>> result = epmetUserOpenFeignClient.staffGridRole(gridStaff);
if (!result.success()){
throw new RenException("查询网格下的网格员失败【"+result.getMsg()+"】");
}
List<GridStaffResultDTO> data = result.getData();
if (CollectionUtils.isEmpty(data)){
return new ArrayList<>();
}
return data;
}
}

14
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml

@ -88,6 +88,20 @@
AND customer_id = #{customerId}
</select>
<!-- 查询网格下的人 -->
<select id="selectGridStaffByGridIds" resultType="com.epmet.dto.result.GridStaffResultDTO">
SELECT
USER_ID AS staffId,
GRID_ID
FROM customer_staff_grid
WHERE DEL_FLAG = '0'
AND (
<foreach collection="gridIds" item="gridId" separator=" OR ">
GRID_ID = #{gridId}
</foreach>
)
</select>
<!-- 批量插入网格工作人员 -->
<insert id="insertBatch" parameterType="java.util.List">
insert into customer_staff_grid

13
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查看。";
}

21
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;
}

23
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;
}

21
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<PatrolUploadFormDTO> details;
}

55
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;
}

26
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;
}

19
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;
}

42
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;
}

65
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;
}

20
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;
}

39
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;
}

26
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;
}

19
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;
}

36
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;
}

30
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;
/**
* 巡查记录idstatus=patrolling时此列有值
*/
private String staffPatrolRecId;
/**
* patrolling返回最大的序号status=end时此列返回-1
*/
private Integer latestSerialNum;
}

26
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;
}

33
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<UserNameResultDTO> userNames;
/**
* 经纬度
*/
private List<GridManagerUserListResultDTO> ll;
public UserNameAndLLResultDTO() {
this.userNames = new ArrayList<>();
this.ll = new ArrayList<>();
}
}

19
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;
}

36
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<List<UserBadgesResultDTO>> userBadges(@RequestBody UserBadgesFormDTO formDTO);
/**
* @Description 查询网格员角色
* @Param forms
* @author zxc
* @date 2021/6/8 4:42 下午
*/
@PostMapping("/epmetuser/staffrole/staffgridrole")
Result<List<GridStaffResultDTO>> staffGridRole(@RequestBody List<GridStaffResultDTO> forms);
/**
* @Description 查询经纬度
* @Param userIds
* @author zxc
* @date 2021/6/9 10:40 上午
*/
@PostMapping("/epmetuser/staffpatrol/getll")
Result<UserNameAndLLResultDTO> selectll(@RequestBody List<String> userIds);
/**
* @Description 002查看巡查记录
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:25 下午
*/
@PostMapping("/epmetuser/staffpatrol/recordlist")
Result<List<RecordListResultDTO>> recordList(@RequestBody RecordListFormDTO formDTO);
/**
* @Description 003巡查轨迹
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:35 下午
*/
@PostMapping("/epmetuser/staffpatrol/patroltrack")
Result<List<PatrolTrackResultDTO>> patrolTrack(@RequestBody PatrolTrackFormDTO formDTO);
}

21
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<List<UserBadgesResultDTO>> userBadges(UserBadgesFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "userBadges", formDTO);
}
@Override
public Result<List<GridStaffResultDTO>> staffGridRole(List<GridStaffResultDTO> forms) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "staffGridRole", forms);
}
@Override
public Result<UserNameAndLLResultDTO> selectll(List<String> userIds) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectll", userIds);
}
@Override
public Result<List<RecordListResultDTO>> recordList(RecordListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "recordList", formDTO);
}
@Override
public Result<List<PatrolTrackResultDTO>> patrolTrack(PatrolTrackFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "patrolTrack", formDTO);
}
}

144
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<com.epmet.dto.result.StaffPatrolInitResultDTO>
* @author zhaoqifeng
* @date 2021/6/7 16:40
*/
@PostMapping("init")
public Result<StaffPatrolInitResultDTO> init(@LoginUser TokenDto tokenDto, @RequestBody StaffPatrolInitFormDTO formDTO) {
StaffPatrolInitResultDTO result = staffPatrolRecordService.init(tokenDto, formDTO);
return new Result<StaffPatrolInitResultDTO>().ok(result);
}
/**
* 开始巡查
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.StartPatrolResultDTO>
* @author zhaoqifeng
* @date 2021/6/7 16:46
*/
@PostMapping("startpatrol")
public Result<StartPatrolResultDTO> startPatrol(@LoginUser TokenDto tokenDto, @RequestBody StartPatrolFormDTO formDTO) {
StartPatrolResultDTO result = staffPatrolRecordService.startPatrol(tokenDto, formDTO);
return new Result<StartPatrolResultDTO>().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<com.epmet.dto.result.PatrolUploadResultDTO>
* @author zhaoqifeng
* @date 2021/6/7 16:46
*/
@PostMapping("uploaddetail")
public Result<PatrolUploadResultDTO> uploadDetail(@LoginUser TokenDto tokenDto, @RequestBody PatrolUploadFormDTO formDTO) {
PatrolUploadResultDTO result = staffPatrolRecordService.uploadDetail(tokenDto, formDTO);
return new Result<PatrolUploadResultDTO>().ok(result);
}
@PostMapping("uploaddetails")
public Result<PatrolUploadResultDTO> uploadDetails(@LoginUser TokenDto tokenDto, @RequestBody PatrolUploadDetailFormDTO formDTO) {
PatrolUploadResultDTO result = staffPatrolRecordService.uploadDetails(tokenDto, formDTO);
return new Result<PatrolUploadResultDTO>().ok(result);
}
/**
* @Description 查询经纬度
* @Param userIds
* @author zxc
* @date 2021/6/9 10:40 上午
*/
@PostMapping("getll")
public Result<UserNameAndLLResultDTO> selectll(@RequestBody List<String> userIds){
return new Result<UserNameAndLLResultDTO>().ok(staffPatrolRecordService.selectLL(userIds));
}
/**
* @Description 002查看巡查记录
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:25 下午
*/
@PostMapping("recordlist")
public Result<List<RecordListResultDTO>> recordList(@RequestBody RecordListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, RecordListFormDTO.RecordListForm.class);
return new Result<List<RecordListResultDTO>>().ok(staffPatrolRecordService.recordList(formDTO));
}
/**
* @Description 003巡查轨迹
* @Param formDTO
* @author zxc
* @date 2021/6/7 3:35 下午
*/
@PostMapping("patroltrack")
public Result<List<PatrolTrackResultDTO>> patrolTrack(@RequestBody PatrolTrackFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, PatrolTrackFormDTO.PatrolTrackForm.class);
return new Result<List<PatrolTrackResultDTO>>().ok(staffPatrolRecordService.patrolTrack(formDTO));
}
}

16
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<List<GridStaffResultDTO>> staffGridRole(@RequestBody List<GridStaffResultDTO> forms){
return new Result<List<GridStaffResultDTO>>().ok(staffRoleService.staffGridRole(forms));
}
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -197,4 +197,12 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @return
*/
BasicInfoResultDTO getStaffBasicInfo(StaffBasicInfoFromDTO fromDTO);
/**
* @Description 查询用户名字
* @Param userIds
* @author zxc
* @date 2021/6/9 1:36 下午
*/
List<UserNameResultDTO> selectUserName(@Param("userIds")List<String> userIds);
}

45
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolDetailDao.java

@ -0,0 +1,45 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffPatrolDetailEntity> {
/**
* @Description 查询巡查轨迹
* @Param staffPatrolRecId
* @author zxc
* @date 2021/6/7 5:13 下午
*/
List<PatrolTrackResultDTO> selectPatrolTrack(@Param("staffPatrolRecId") String staffPatrolRecId);
}

55
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffPatrolRecordDao.java

@ -0,0 +1,55 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<StaffPatrolRecordEntity> {
/**
* @Description 查询经纬度
* @Param userIds
* @author zxc
* @date 2021/6/9 10:24 上午
*/
List<GridManagerUserListResultDTO> selectLL(@Param("userIds")List<String> userIds);
/**
* @Description 巡查记录查询
* @Param formDTO
* @author zxc
* @date 2021/6/7 5:29 下午
*/
List<RecordListResultDTO> recordList(RecordListFormDTO formDTO);
}

13
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<StaffRoleEntity> {
* @Description 工作端-查询用户角色key列表
**/
List<String> selectStaffRoleKeyList(GetRoleKeyListFormDTO formDTO);
/**
* @Description 查询是网格员的人
* @Param forms
* @author zxc
* @date 2021/6/8 4:53 下午
*/
List<GridStaffResultDTO> staffGridRole(@Param("forms") List<GridStaffResultDTO> forms);
}

101
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolDetailEntity.java

@ -0,0 +1,101 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

91
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffPatrolRecordEntity.java

@ -0,0 +1,91 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save