Browse Source

Merge branch 'dev_temp' into develop

# Conflicts:
#	epmet-admin/epmet-admin-server/pom.xml
dev_shibei_match
wxz 4 years ago
parent
commit
ac2a70b2b4
  1. 13
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/form/LogOperationListFormDTO.java
  2. 52
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/region/LogOperationResultDTO.java
  3. 44
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/enums/LogOperationTypeEnum.java
  4. 41
      epmet-admin/epmet-admin-server/pom.xml
  5. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/AdminApplication.java
  6. 46
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/LogOperationController.java
  7. 33
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/LogOperationDao.java
  8. 87
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java
  9. 68
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java
  10. 63
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/bean/log/LogOperationHelper.java
  11. 11
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/bean/log/OperatorInfo.java
  12. 94
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java
  13. 109
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/ProjectOperationLogListener.java
  14. 28
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/LogOperationService.java
  15. 176
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/LogOperationServiceImpl.java
  16. 3
      epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml
  17. 21
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.3__add_log_ope_table.sql
  18. 29
      epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml
  19. 14
      epmet-auth-client/pom.xml
  20. 9
      epmet-auth-client/src/main/java/com/epmet/auth/constants/AuthOperationConstants.java
  21. 43
      epmet-auth-client/src/main/java/com/epmet/auth/constants/AuthOperationEnum.java
  22. 5
      epmet-auth/pom.xml
  23. 3
      epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java
  24. 59
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  25. 10
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
  26. 8
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java
  27. 26
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/LoginMQMsg.java
  28. 19
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/ProjectChangedMQMsg.java
  29. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java
  30. 50
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/ResultDataResolver.java
  31. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java
  32. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  33. 1
      epmet-gateway/pom.xml
  34. 12
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/PartyMemberVanguardDetailResultDTO.java
  35. 131
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolDetailDTO.java
  36. 121
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/StaffPatrolRecordDTO.java
  37. 54
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java
  38. 32
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java
  39. 15
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectDTO.java
  40. 2
      epmet-module/data-aggregator/data-aggregator-server/pom.xml
  41. 40
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  42. 34
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolDetailDao.java
  43. 44
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java
  44. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java
  45. 101
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffPatrolDetailEntity.java
  46. 91
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/StaffPatrolRecordEntity.java
  47. 15
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectEntity.java
  48. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
  49. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  50. 33
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolDetailService.java
  51. 32
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolRecordService.java
  52. 52
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  53. 41
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolDetailServiceImpl.java
  54. 42
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolRecordServiceImpl.java
  55. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  56. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  57. 50
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml
  58. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolDetailDao.xml
  59. 52
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml
  60. 34
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
  61. 131
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/StaffPatrolDetailDTO.java
  62. 121
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/StaffPatrolRecordDTO.java
  63. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java
  64. 27
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/GridManagerListFormDTO.java
  65. 76
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/GridManagerListResultDTO.java
  66. 20
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/PatrolConstant.java
  67. 66
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java
  68. 21
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolRecordController.java
  69. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  70. 45
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolDetailDao.java
  71. 55
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/user/StaffPatrolRecordDao.java
  72. 101
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/user/StaffPatrolDetailEntity.java
  73. 91
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/user/StaffPatrolRecordEntity.java
  74. 23
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenOrgService.java
  75. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
  76. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java
  77. 44
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenOrgServiceImpl.java
  78. 44
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java
  79. 14
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolRecordService.java
  80. 194
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java
  81. 21
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolRecordServiceImpl.java
  82. 20
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  83. 16
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  84. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml
  85. 18
      epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolDetailDao.xml
  86. 41
      epmet-module/data-report/data-report-server/src/main/resources/mapper/user/StaffPatrolRecordDao.xml
  87. 29
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/OrgStaffDTO.java
  88. 9
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java
  89. 7
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectGridDailyDTO.java
  90. 18
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CenterPointForm.java
  91. 30
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java
  92. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  93. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/EIDimController.java
  94. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  95. 62
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java
  96. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java
  97. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/project/ProjectEntity.java
  98. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/EIDimService.java
  99. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
  100. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java

13
epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/form/LogOperationListFormDTO.java

@ -0,0 +1,13 @@
package com.epmet.dto.form;
import lombok.Data;
@Data
public class LogOperationListFormDTO {
private String condition;
private Integer pageNo = 1;
private Integer pageSize = 10;
}

52
epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/region/LogOperationResultDTO.java

@ -0,0 +1,52 @@
package com.epmet.dto.region;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import java.util.Date;
/**
*
*/
@Data
public class LogOperationResultDTO {
/**
* 大类别登录login项目流转project
*/
private String category;
/**
* 类型枚举,小类别登录loginlogout退出shift_project议题转项目等
*/
private String type;
/**
* 类型枚举名称
*/
private String typeDisplay;
/**
* 内容
*/
private String content;
/**
* 操作目标ID
*/
private String targetId;
/**
* 操作人ID
*/
private String operatorId;
private String operatorName;
private String operatorMobile;
/**
* 操作时间,该时间不是插入数据的时间而是操作发生的真实时间
*/
private Long operatingTime;
}

44
epmet-admin/epmet-admin-client/src/main/java/com/epmet/enums/LogOperationTypeEnum.java

@ -0,0 +1,44 @@
//package com.epmet.enums;
//
//import lombok.Data;
//
///**
// * 操作日志类型枚举
// */
//public enum LogOperationTypeEnum {
// LOGIN("login", "登录"),
// LOGOUT("logout", "退出登录");
//
// private String type;
// private String typeDisplay;
//
// public String getType() {
// return type;
// }
//
// public String getTypeDisplay() {
// return typeDisplay;
// }
//
// LogOperationTypeEnum(String type, String typeDisplay) {
// this.type = type;
// this.typeDisplay = typeDisplay;
// }
//
// public static LogOperationTypeEnum get(String type) {
// for (LogOperationTypeEnum t : LogOperationTypeEnum.values()) {
// if (t.type.equals(type)) {
// return t;
// }
// }
// return null;
// }
//
// public static String getDisplay(String type) {
// LogOperationTypeEnum object = get(type);
// if (object == null) {
// return null;
// }
// return object.typeDisplay;
// }
//}

41
epmet-admin/epmet-admin-server/pom.xml

@ -54,6 +54,31 @@
<artifactId>feign-httpclient</artifactId>
<version>10.3.0</version>
</dependency>
<!--rocketmq-->
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-rocketmq</artifactId>
<version>2.0.0</version>
</dependency>
<!--user-client-->
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-message-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-auth-client</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>
@ -109,6 +134,10 @@
<nacos.ip/>
<spring.flyway.enabled>false</spring.flyway.enabled>
<!--rocketmq-->
<rocketmq.nameserver>192.168.1.130:9876;192.168.1.132:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
</profile>
<profile>
@ -141,6 +170,10 @@
<nacos.ip/>
<spring.flyway.enabled>false</spring.flyway.enabled>
<!--rocketmq-->
<rocketmq.nameserver>192.168.1.130:9876;192.168.1.132:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
</profile>
<profile>
@ -170,6 +203,10 @@
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<!--rocketmq-->
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
</profile>
<profile>
@ -199,6 +236,10 @@
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<!--rocketmq-->
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
</profile>
</profiles>

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/AdminApplication.java

@ -10,6 +10,8 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* 管理后台
@ -18,6 +20,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @since 1.0.0
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class AdminApplication {
public static void main(String[] args) {

46
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/LogOperationController.java

@ -0,0 +1,46 @@
package com.epmet.controller;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.LogOperationListFormDTO;
import com.epmet.dto.region.LogOperationResultDTO;
import com.epmet.service.LogOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
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.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
@RequestMapping("log/operation")
@RestController
public class LogOperationController {
@Autowired
private LogOperationService logOperationService;
@Autowired
private LoginUserUtil loginUserUtil;
@PostMapping("/list")
public Result<List<LogOperationResultDTO>> listLogOperations(@RequestBody LogOperationListFormDTO input, HttpServletRequest request) {
ValidatorUtils.validateEntity(input);
String condition = input.getCondition();
Integer pageNo = input.getPageNo();
Integer pageSize = input.getPageSize();
String customerId = loginUserUtil.getLoginUserCustomerId();
List<LogOperationResultDTO> resultList = logOperationService.listOperationLogs(condition, customerId, pageNo, pageSize);
if (CollectionUtils.isEmpty(resultList)) {
resultList = new ArrayList<>();
}
return new Result<List<LogOperationResultDTO>>().ok(resultList);
}
}

33
epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/LogOperationDao.java

@ -0,0 +1,33 @@
/**
* 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.entity.LogOperationEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 操作日指标
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-06-07
*/
@Mapper
public interface LogOperationDao extends BaseDao<LogOperationEntity> {
}

87
epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java

@ -0,0 +1,87 @@
/**
* 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("log_operation")
public class LogOperationEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 大类别登录login项目流转project
*/
private String category;
/**
* 类型枚举,小类别登录loginlogout退出shift_project议题转项目等
*/
private String type;
private String typeDisplay;
private String ip;
private String fromApp;
private String fromClient;
/**
* 内容
*/
private String content;
/**
* 操作目标ID
*/
private String targetId;
/**
* 操作人ID
*/
private String operatorId;
/**
* 操作人姓名
*/
private String operatorName;
/**
* 操作人手机号
*/
private String operatorMobile;
/**
* 操作时间,该时间不是插入数据的时间而是操作发生的真实时间
*/
private Date operatingTime;
}

68
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java

@ -0,0 +1,68 @@
package com.epmet.mq.listener;
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.mq.listener.listener.AuthOperationLogListener;
import com.epmet.mq.listener.listener.ProjectOperationLogListener;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@Component
public class RocketMQConsumerRegister {
@Value("${spring.profiles.active}")
private String env;
@Value("${rocketmq.name-server}")
private String nameServer;
/**
* @return
* @Description 注册监听器
* @author wxz
* @date 2021.03.03 16:09
*/
@PostConstruct
public void registerAllListeners() {
try {
if (!EnvEnum.LOCAL.getCode().equals(env)) {
register(nameServer, ConsomerGroupConstants.AUTH_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.AUTH, "*", new AuthOperationLogListener());
register(nameServer, ConsomerGroupConstants.PROJECT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectOperationLogListener());
}
} catch (MQClientException e) {
e.printStackTrace();
}
}
public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListenerConcurrently listener) throws MQClientException {
// 实例化消费者
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group);
// 设置NameServer的地址
consumer.setNamesrvAddr(nameServer);
consumer.setMessageModel(messageModel);
consumer.setInstanceName(buildInstanceName());
// 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息
consumer.subscribe(topic, subException);
// 注册回调实现类来处理从broker拉取回来的消息
consumer.registerMessageListener(listener);
// 启动消费者实例
consumer.start();
}
private String buildInstanceName() {
String instanceName = "";
for (int i = 0; i < 4; i++) {
int t = (int) (Math.random() * 10);
instanceName = instanceName.concat(t + "");
}
return instanceName;
}
}

63
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/bean/log/LogOperationHelper.java

@ -0,0 +1,63 @@
package com.epmet.mq.listener.bean.log;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
/**
* 操作日志帮助类 单例
*/
public class LogOperationHelper implements ResultDataResolver {
private EpmetUserOpenFeignClient userOpenFeignClient;
private LogOperationHelper() {
}
/**
* @Description 利用类只能加载一次的特性保证类静态变量只能生成一份实现单例
* @return
* @author wxz
* @date 2021.06.09 16:55
*/
private static class SingletonInnerClass {
public static LogOperationHelper instance = new LogOperationHelper();
}
/**
* @Description 获取实例
* @return
* @author wxz
* @date 2021.06.09 16:54
*/
public static LogOperationHelper getInstance() {
return SingletonInnerClass.instance;
}
/**
* @Description 获取操作人信息
* @return
* @author wxz
* @date 2021.06.09 16:57
*/
public OperatorInfo getOperatorInfo(String userId) {
if (userOpenFeignClient == null) {
synchronized (this) {
if (userOpenFeignClient == null) {
userOpenFeignClient = SpringContextUtils.getBean(EpmetUserOpenFeignClient.class);
}
}
}
CustomerStaffDTO form = new CustomerStaffDTO();
form.setUserId(userId);
Result<CustomerStaffDTO> result = userOpenFeignClient.getCustomerStaffInfoByUserId(form);
CustomerStaffDTO staffInfo = getResultDataOrThrowsException(result, ServiceConstant.EPMET_ADMIN_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(),
"调用epmet-user服务获取staff信息发生异常");
return new OperatorInfo(staffInfo.getMobile(), staffInfo.getRealName());
}
}

11
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/bean/log/OperatorInfo.java

@ -0,0 +1,11 @@
package com.epmet.mq.listener.bean.log;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class OperatorInfo {
private String mobile;
private String name;
}

94
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java

@ -0,0 +1,94 @@
package com.epmet.mq.listener.listener;
import com.alibaba.fastjson.JSON;
import com.epmet.auth.constants.AuthOperationEnum;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.entity.LogOperationEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.mq.listener.bean.log.LogOperationHelper;
import com.epmet.mq.listener.bean.log.OperatorInfo;
import com.epmet.service.LogOperationService;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;
import org.redisson.api.RLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @author wxz
* @Description 登录操作日志监听器
* @return
* @date 2021.06.07 16:12
*/
public class AuthOperationLogListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass());
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
try {
msgs.forEach(msg -> consumeMessage(msg));
} catch (Exception e) {
logger.error(ExceptionUtils.getErrorStackTrace(e));
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
private void consumeMessage(MessageExt messageExt) {
String tags = messageExt.getTags();
String msg = new String(messageExt.getBody());
logger.info("认证操作日志监听器-收到消息内容:{}", msg);
LoginMQMsg msgObj = JSON.parseObject(msg, LoginMQMsg.class);
//获取操作人信息
OperatorInfo operatorInfo = LogOperationHelper.getInstance().getOperatorInfo(msgObj.getUserId());
LogOperationEntity logEntity = new LogOperationEntity();
logEntity.setCategory(messageExt.getTopic());
logEntity.setType(tags);
logEntity.setTypeDisplay(AuthOperationEnum.getDisplay(tags));
logEntity.setIp(msgObj.getIp());
logEntity.setFromApp(msgObj.getFromApp());
logEntity.setFromClient(msgObj.getFromClient());
logEntity.setTargetId("");
logEntity.setOperatorId(msgObj.getUserId());
logEntity.setOperatorName(operatorInfo.getName());
logEntity.setOperatorMobile(operatorInfo.getMobile());
logEntity.setOperatingTime(msgObj.getLoginTime());
logEntity.setContent("成功登录系统");
DistributedLock distributedLock = null;
RLock lock = null;
try {
distributedLock = SpringContextUtils.getBean(DistributedLock.class);
lock = distributedLock.getLock(String.format("lock:auth_operation_log:%s:%s", logEntity.getType(), logEntity.getOperatorId()),
30L, 30L, TimeUnit.SECONDS);
SpringContextUtils.getBean(LogOperationService.class).log(logEntity);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【RocketMQ】添加操作日志失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
} catch (Exception e) {
// 不是我们自己抛出的异常,可以让MQ重试
logger.error("【RocketMQ】添加操作日志失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
throw e;
} finally {
distributedLock.unLock(lock);
}
}
}

109
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/ProjectOperationLogListener.java

@ -0,0 +1,109 @@
package com.epmet.mq.listener.listener;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.entity.LogOperationEntity;
import com.epmet.mq.listener.bean.log.LogOperationHelper;
import com.epmet.mq.listener.bean.log.OperatorInfo;
import com.epmet.service.LogOperationService;
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;
import org.redisson.api.RLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @author wxz
* @Description 项目操作日志监听器
* @return
* @date 2021.06.08 22.21
*/
public class ProjectOperationLogListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass());
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
try {
msgs.forEach(msg -> consumeMessage(msg));
} catch (Exception e) {
logger.error(ExceptionUtils.getErrorStackTrace(e));
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
private void consumeMessage(MessageExt messageExt) {
//String tags = messageExt.getTags();
String msg = new String(messageExt.getBody());
logger.info("项目变动操作日志监听器-收到消息内容:{}", msg);
ProjectChangedMQMsg msgObj = JSON.parseObject(msg, ProjectChangedMQMsg.class);
String content = StringUtils.isBlank(msgObj.getOperationBrief()) ? "" : msgObj.getOperationBrief();
OperatorInfo operatorInfo = LogOperationHelper.getInstance().getOperatorInfo(msgObj.getOperatorId());
LogOperationEntity logEntity = new LogOperationEntity();
logEntity.setCategory(messageExt.getTopic());
logEntity.setType(msgObj.getOperation());
logEntity.setTypeDisplay(getOperationTypeDisplay(msgObj.getOperation()));
logEntity.setTargetId(msgObj.getProjectId());
logEntity.setIp(msgObj.getIp());
logEntity.setFromApp(msgObj.getFromApp());
logEntity.setFromClient(msgObj.getFromClient());
logEntity.setOperatorId(msgObj.getOperatorId());
logEntity.setOperatorMobile(operatorInfo.getMobile());
logEntity.setOperatorName(operatorInfo.getName());
logEntity.setOperatingTime(msgObj.getOperatingTime());
logEntity.setContent(content);
DistributedLock distributedLock = null;
RLock lock = null;
try {
distributedLock = SpringContextUtils.getBean(DistributedLock.class);
lock = distributedLock.getLock(String.format("lock:project_operation_log:%s:%s", logEntity.getType(), logEntity.getTargetId()),
30L, 30L, TimeUnit.SECONDS);
SpringContextUtils.getBean(LogOperationService.class).log(logEntity);
} catch (RenException e) {
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
logger.error("【RocketMQ】添加操作日志失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
} catch (Exception e) {
// 不是我们自己抛出的异常,可以让MQ重试
logger.error("【RocketMQ】添加操作日志失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
throw e;
} finally {
distributedLock.unLock(lock);
}
}
private String getOperationTypeDisplay(String type) {
switch (type) {
case "response":
return "项目响应处理";
case "issue_shift_project":
return "议题转项目";
case "close":
return "项目结案";
case "return":
return "项目退回";
case "transfer":
return "项目吹哨";
case "created":
return "项目立项";
default:
return null;
}
}
}

28
epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/LogOperationService.java

@ -0,0 +1,28 @@
package com.epmet.service;
import com.epmet.dto.region.LogOperationResultDTO;
import com.epmet.entity.LogOperationEntity;
import java.util.List;
/**
* 操作日志
*/
public interface LogOperationService {
/**
* @Description 记录日志
* @return
* @author wxz
* @date 2021.06.07 21:56
*/
void log(LogOperationEntity msg);
/**
* @Description 查询操作日志 列表
* @return
* @author wxz
* @date 2021.06.07 21:56
*/
List<LogOperationResultDTO> listOperationLogs(String condition, String customerId, Integer pageNo, Integer pageSize);
}

176
epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/LogOperationServiceImpl.java

@ -0,0 +1,176 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.auth.constants.AuthOperationEnum;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.LogOperationDao;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.dto.region.LogOperationResultDTO;
import com.epmet.entity.LogOperationEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.LogOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class LogOperationServiceImpl implements LogOperationService, ResultDataResolver {
@Autowired
private LogOperationDao logOperationDao;
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
@Override
public void log(LogOperationEntity msg) {
LambdaQueryWrapper<LogOperationEntity> w = new LambdaQueryWrapper<>();
w.eq(LogOperationEntity::getType, msg.getType());
w.eq(LogOperationEntity::getTargetId, msg.getTargetId());
w.eq(LogOperationEntity::getOperatorId, msg.getOperatorId());
w.eq(LogOperationEntity::getOperatingTime, msg.getOperatingTime());
Integer existsCount = logOperationDao.selectCount(w);
if (existsCount > 0) {
// 该日志已存在,不做任何操作
return;
}
logOperationDao.insert(msg);
}
@Override
public List<LogOperationResultDTO> listOperationLogs(String condition, String customerId, Integer pageNo, Integer pageSize) {
// 1.条件查询
List<LogOperationResultDTO> logDtos = listByOperatorMobile(condition, customerId, pageNo, pageSize);
if (CollectionUtils.isEmpty(logDtos)) {
logDtos = listByOperatorName(condition, pageNo, pageSize);
}
if (CollectionUtils.isEmpty(logDtos)) {
return new ArrayList<>();
}
// 2.直接分页查询
// 条件查询,排序
LambdaQueryWrapper<LogOperationEntity> w = new LambdaQueryWrapper<>();
w.orderByDesc(LogOperationEntity::getOperatingTime);
IPage<LogOperationEntity> iPage = logOperationDao.selectPage(new Page<>(pageNo, pageSize), w);
List<LogOperationEntity> logEntities = iPage.getRecords();
List<String> userIds = logEntities.stream().map(l -> l.getOperatorId()).collect(Collectors.toList());
return convertLogOperationEntity2DTO(logEntities, getStaffMapByUserIds(userIds));
}
private Map<String, CustomerStaffDTO> getStaffMapByUserIds(List<String> userIds) {
CustomerStaffFormDTO form = new CustomerStaffFormDTO();
form.setUserIds(userIds);
Result<List<CustomerStaffDTO>> result = userOpenFeignClient.list(form);
List<CustomerStaffDTO> staffs = getResultDataOrThrowsException(result, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用user服务发生异常");
HashMap<String, CustomerStaffDTO> staffMap = new HashMap<>();
staffs.forEach(s -> {
staffMap.put(s.getUserId(), s);
});
return staffMap;
}
/**
* 通过操作人手机号查询操作日志列表
*
* @param operatorMobile
* @param customerId
*/
private List<LogOperationResultDTO> listByOperatorMobile(String operatorMobile, String customerId, Integer pageNo, Integer pageSize) {
CustomerStaffFormDTO form = new CustomerStaffFormDTO();
form.setCustomerId(customerId);
form.setMobile(operatorMobile);
Result<List<CustomerStaffDTO>> result = userOpenFeignClient.list(form);
List<CustomerStaffDTO> staffs = getResultDataOrThrowsException(result, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用user服务发生异常");
if (staffs.size() == 0) {
return null;
}
CustomerStaffDTO staff = staffs.get(0);
QueryWrapper<LogOperationEntity> w = new QueryWrapper<>();
w.lambda()
.eq(LogOperationEntity::getOperatorId, staff.getUserId())
.eq(LogOperationEntity::getDelFlag, 0)
.orderByDesc(LogOperationEntity::getOperatingTime);
IPage<LogOperationEntity> iPage = logOperationDao.selectPage(new Page<>(pageNo, pageSize), w);
HashMap<String, CustomerStaffDTO> staffMap = new HashMap<>();
staffMap.put(staff.getUserId(), staff);
return convertLogOperationEntity2DTO(iPage.getRecords(), staffMap);
}
/**
* @Description 通过操作人姓名查询操作日志列表
* @return
* @author wxz
* @date 2021.06.08 11:12
*/
private List<LogOperationResultDTO> listByOperatorName(String operatorName, Integer pageNo, Integer pageSize) {
CustomerStaffFormDTO form = new CustomerStaffFormDTO();
form.setRealName(operatorName);
Result<List<CustomerStaffDTO>> result = userOpenFeignClient.list(form);
List<CustomerStaffDTO> staffs = getResultDataOrThrowsException(result, ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用user服务查询工作人员信息发生异常");
List<String> userIds = new ArrayList<>();
HashMap<String, CustomerStaffDTO> staffMap = new HashMap<String, CustomerStaffDTO>();
staffs.forEach(s -> {
staffMap.put(s.getUserId(), s);
userIds.add(s.getUserId());
});
if (CollectionUtils.isEmpty(userIds)) {
return new ArrayList<>();
}
LambdaQueryWrapper<LogOperationEntity> w = new LambdaQueryWrapper<>();
w.in(LogOperationEntity::getOperatorId, userIds);
w.eq(LogOperationEntity::getDelFlag, 0);
w.orderByDesc(LogOperationEntity::getOperatingTime);
IPage<LogOperationEntity> iPage = logOperationDao.selectPage(new Page<>(pageNo, pageSize), w);
return convertLogOperationEntity2DTO(iPage.getRecords(), staffMap);
}
/**
* @Description 将操作日志entity转化为dto列表
* @return
* @author wxz
* @date 2021.06.08 11:12
*/
private List<LogOperationResultDTO> convertLogOperationEntity2DTO(List<LogOperationEntity> logOperationEntities, Map<String, CustomerStaffDTO> staffMap) {
return logOperationEntities.stream().map(l -> {
LogOperationResultDTO ldto = new LogOperationResultDTO();
ldto.setCategory(l.getCategory());
ldto.setContent(l.getContent());
ldto.setOperatingTime(l.getOperatingTime().getTime()/1000);
ldto.setOperatorId(l.getOperatorId());
ldto.setTargetId(l.getTargetId());
ldto.setType(l.getType());
ldto.setTypeDisplay(l.getTypeDisplay());
ldto.setOperatorMobile(staffMap.get(l.getOperatorId()).getMobile());
ldto.setOperatorName(staffMap.get(l.getOperatorId()).getRealName());
return ldto;
}).collect(Collectors.toList());
}
}

3
epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml

@ -134,3 +134,6 @@ shutdown:
graceful:
enable: true #是否开启优雅停机
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
rocketmq:
name-server: @rocketmq.nameserver@

21
epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.3__add_log_ope_table.sql

@ -0,0 +1,21 @@
CREATE TABLE `log_operation` (
`ID` varchar(64) NOT NULL COMMENT '主键ID',
`TYPE` varchar(64) NOT NULL COMMENT '动作类型枚举',
`TYPE_DISPLAY` varchar(64) NOT NULL COMMENT '操作类型中文展示',
`CONTENT` varchar(512) NOT NULL COMMENT '内容',
`CATEGORY` varchar(64) NOT NULL COMMENT '操作类型大类。例如login和logout都属于login大类。项目立项,项目流转,项目结案都属于项目大类',
`IP` varchar(15) NOT NULL COMMENT 'IP地址',
`FROM_APP` varchar(10) NOT NULL COMMENT '所用的APP',
`FROM_CLIENT` varchar(10) NOT NULL COMMENT '所用的client',
`TARGET_ID` varchar(64) NOT NULL COMMENT '操作目标ID',
`OPERATOR_ID` varchar(64) NOT NULL COMMENT '操作人ID',
`OPERATOR_NAME` varchar(15) NOT NULL COMMENT '操作者姓名',
`OPERATOR_MOBILE` varchar(11) NOT NULL COMMENT '操作者电话',
`OPERATING_TIME` datetime NOT NULL COMMENT '操作时间,该时间不是插入数据的时间,而是操作发生的真实时间',
`DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='操作日指标'

29
epmet-admin/epmet-admin-server/src/main/resources/mapper/LogOperationDao.xml

@ -0,0 +1,29 @@
<?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.dao.LogOperationDao">
<resultMap type="com.epmet.entity.LogOperationEntity" id="logOperationMap">
<result property="id" column="ID"/>
<result property="type" column="TYPE"/>
<result property="typeDisplay" column="TYPE_DISPLAY"/>
<result property="content" column="CONTENT"/>
<result property="targetId" column="TARGET_ID"/>
<result property="ip" column="IP"/>
<result property="fromApp" column="FROM_APP"/>
<result property="fromClient" column="FROM_CLIENT"/>
<result property="category" column="CATEGORY"/>
<result property="operatorId" column="OPERATOR_ID"/>
<result property="operatorName" column="OPERATOR_NAME"/>
<result property="operatorMobile" column="OPERATOR_MOBILE"/>
<result property="operatingTime" column="OPERATING_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

14
epmet-auth-client/pom.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>epmet-cloud</artifactId>
<groupId>com.epmet</groupId>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>epmet-auth-client</artifactId>
</project>

9
epmet-auth-client/src/main/java/com/epmet/auth/constants/AuthOperationConstants.java

@ -0,0 +1,9 @@
package com.epmet.auth.constants;
/**
* 认证操作常量
*/
public interface AuthOperationConstants {
String LOGIN = "login";
String LOGOUT = "logout";
}

43
epmet-auth-client/src/main/java/com/epmet/auth/constants/AuthOperationEnum.java

@ -0,0 +1,43 @@
package com.epmet.auth.constants;
/**
* 认证操作枚举
*/
public enum AuthOperationEnum {
LOGIN(AuthOperationConstants.LOGIN, "登录"),
LOGOUT(AuthOperationConstants.LOGOUT, "退出");
private String operationType;
private String operationDisplay;
AuthOperationEnum(String operationType, String operationDisplay) {
this.operationType = operationType;
this.operationDisplay = operationDisplay;
}
public String getOperationType() {
return operationType;
}
public String getOperationDisplay() {
return operationDisplay;
}
public static AuthOperationEnum get(String operationType) {
for (AuthOperationEnum e : AuthOperationEnum.values()) {
if (e.getOperationType().equals(operationType)) {
return e;
}
}
return null;
}
public static String getDisplay(String operationType) {
AuthOperationEnum obj = get(operationType);
if (obj == null) {
return null;
}
return obj.getOperationDisplay();
}
}

5
epmet-auth/pom.xml

@ -133,6 +133,11 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-auth-client</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>

3
epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java

@ -1,7 +1,10 @@
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.UserDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;

59
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -5,14 +5,19 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.auth.constants.AuthOperationConstants;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.*;
import com.epmet.commons.tools.validator.PhoneValidatorUtils;
import com.epmet.constant.AuthHttpUrlConstant;
@ -34,7 +39,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;
@ -44,7 +52,7 @@ import java.util.stream.Collectors;
*/
@Slf4j
@Service
public class ThirdLoginServiceImpl implements ThirdLoginService {
public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResolver {
private static final Logger logger = LoggerFactory.getLogger(ThirdLoginServiceImpl.class);
@Autowired
@ -61,6 +69,10 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private EpmetMessageOpenFeignClient messageOpenFeignClient;
@Autowired
private LoginUserUtil loginUserUtil;
/**
* @param formDTO
@ -170,8 +182,17 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
this.saveLatestGovTokenDto(staffLatestAgencyResultDTO, userWechatDTO, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return userTokenResultDTO;
//7.发送登录事件
try {
sendLoginEvent(staffLatestAgencyResultDTO.getStaffId(), formDTO.getAppId(), AppClientConstant.APP_GOV, AppClientConstant.CLIENT_WXMP);
} catch (RenException e) {
log.error(e.getInternalMsg());
} catch (Exception e) {
log.error("【工作端workLogin登录】发送登录事件失败,程序继续执行。");
}
return userTokenResultDTO;
}
/**
@ -392,6 +413,15 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
//6.发送登录事件
try {
sendLoginEvent(customerStaff.getUserId(), formDTO.getAppId(), AppClientConstant.APP_GOV, AppClientConstant.CLIENT_WXMP);
} catch (RenException e) {
log.error(e.getInternalMsg());
} catch (Exception e) {
log.error("【工作端enterOrg登录】发送登录事件失败,程序继续执行。错误信息");
}
return userTokenResultDTO;
}
@ -635,4 +665,29 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
logger.info(String.format("发送短信验证码成功,手机号[%s]", formDTO.getMobile()));
}
/**
* @Description 发送登录事件
* @return
* @author wxz
* @date 2021.06.08 15:27
*/
private void sendLoginEvent(String userId, String appId, String fromApp, String fromClient) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
LoginMQMsg loginMQMsg = new LoginMQMsg();
loginMQMsg.setUserId(userId);
loginMQMsg.setLoginTime(new Date());
loginMQMsg.setAppId(appId);
loginMQMsg.setIp(IpUtils.getIpAddr(request));
loginMQMsg.setFromApp(fromApp);
loginMQMsg.setFromClient(fromClient);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(AuthOperationConstants.LOGIN);
form.setContent(loginMQMsg);
messageOpenFeignClient.sendSystemMsgByMQ(form);
//getResultDataOrThrowsException(result, ServiceConstant.EPMET_MESSAGE_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用Message服务,发送登录事件到MQ失败");
}
}

10
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java

@ -31,4 +31,14 @@ public interface ConsomerGroupConstants {
*/
String GROUP_ACHIEVEMENT_COMPONENTS_GROUP = "group_achievement_components_group";
/**
* 认证操作日志消费组
*/
String AUTH_OPERATION_LOG_GROUP = "auth_operation_log_group";
/**
* 项目操作日志小肥猪
*/
String PROJECT_OPERATION_LOG_GROUP = "project_operation_log_group";
}

8
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java

@ -1,5 +1,8 @@
package com.epmet.commons.rocketmq.constants;
/**
* 话题列表常量其他服务要想发送消息到mq则应当引入epmet-commons-rocketmq模块并且使用此常量
*/
public interface TopicConstants {
/**
* 初始化客户
@ -13,4 +16,9 @@ public interface TopicConstants {
* 小组成就
*/
String GROUP_ACHIEVEMENT = "group_achievement";
/**
* 认证
*/
String AUTH = "auth";
}

26
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/LoginMQMsg.java

@ -0,0 +1,26 @@
package com.epmet.commons.rocketmq.messages;
import lombok.Data;
import java.util.Date;
@Data
public class LoginMQMsg {
/**
* 谁登录
*/
private String userId;
private String appId;
/**
* 什么时间登录的
*/
private Date loginTime;
private String ip;
private String fromApp;
private String fromClient;
}

19
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/ProjectChangedMQMsg.java

@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* desc项目变动通知消息实体类
@ -18,4 +19,22 @@ public class ProjectChangedMQMsg implements Serializable {
* 操作类型 议题转项目issue_shift_project, 处理response, 结案close退回return部门流转transfer立项created
*/
private String operation;
// ============> new
private String projectId;
private String operatorId;
private Date operatingTime;
/**
* 操作简介
*/
private String operationBrief;
/**
* 操作者ip
*/
private String ip;
private String fromApp;
private String fromClient;
}

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

50
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/ResultDataResolver.java

@ -0,0 +1,50 @@
package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
import org.apache.commons.lang3.StringUtils;
/**
* Feign请求结果解析器
*/
public interface ResultDataResolver {
/**
* @Description 获取Result种的data如果失败(返回result为null或者result.success为false)那么返回null
* @return
* @author wxz
* @date 2021.06.07 22:45
*/
//default <R> R tryGetResultData(Result<R> result, String targetServiceName) {
// Logger logger = LoggerFactory.getLogger(ResultDataResolver.class);
// if (result == null) {
// logger.error("调用{}服务发生错误,返回Result为null", targetServiceName);
// return null;
// }
// if (!result.success()) {
// logger.error("调用{}服务发生错误,错误信息:{}", targetServiceName, result.getInternalMsg());
// return null;
// }
// return result.getData();
//}
/**
* @Description 获取Result种的data如果失败(返回result为null或者result.success为false)那么抛出异常
* @return
* @author wxz
* @date 2021.06.07 22:45
*/
default <R> R getResultDataOrThrowsException(Result<R> result, String targetServiceName, Integer errorCode, String errorInternalMsg) {
if (result == null) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), "调用{}服务发生错误,返回Result为null", targetServiceName);
}
if (!result.success()) {
Integer finalErrorCode = errorCode == null ? result.getCode() : errorCode;
String finalErrorInternalMsg = StringUtils.isBlank(errorInternalMsg) ? result.getInternalMsg() : errorInternalMsg;
throw new RenException(finalErrorCode, finalErrorInternalMsg);
}
return result.getData();
}
}

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java

@ -6,6 +6,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.List;
/**

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -818,4 +818,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);
}
}

1
epmet-gateway/pom.xml

@ -258,6 +258,7 @@
<!-- <gateway.routes.epmet-auth-server.uri>http://localhost:8081</gateway.routes.epmet-auth-server.uri>-->
<gateway.routes.epmet-auth-server.uri>lb://epmet-auth-server</gateway.routes.epmet-auth-server.uri>
<!-- 2、Admin服务 -->
<!--<gateway.routes.epmet-admin-server.uri>http://localhost:8082</gateway.routes.epmet-admin-server.uri>-->
<gateway.routes.epmet-admin-server.uri>lb://epmet-admin-server</gateway.routes.epmet-admin-server.uri>
<!-- 4、OSS服务 -->
<gateway.routes.epmet-oss-server.uri>lb://epmet-oss-server</gateway.routes.epmet-oss-server.uri>

12
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/PartyMemberVanguardDetailResultDTO.java

@ -30,7 +30,7 @@ public class PartyMemberVanguardDetailResultDTO implements Serializable {
/**
* 党员建组数
*/
private Integer groupCount;
private Integer groupCount = 0;
/**
* 党员建组数占比
*/
@ -38,7 +38,7 @@ public class PartyMemberVanguardDetailResultDTO implements Serializable {
/**
* 组内党员人数
*/
private Integer groupMemberCount;
private Integer groupMemberCount = 0;
/**
* 组内党员人数占比
*/
@ -46,7 +46,7 @@ public class PartyMemberVanguardDetailResultDTO implements Serializable {
/**
* 党员发布话题数
*/
private Integer topicCount;
private Integer topicCount = 0;
/**
* 党员发布话题数占比
*/
@ -54,7 +54,7 @@ public class PartyMemberVanguardDetailResultDTO implements Serializable {
/**
* 党员发布话题转议题数
*/
private Integer issueCount;
private Integer issueCount = 0;
/**
* 党员发布话题转议题数占比
*/
@ -62,7 +62,7 @@ public class PartyMemberVanguardDetailResultDTO implements Serializable {
/**
* 党员发布话题转项目数
*/
private Integer projectCount;
private Integer projectCount = 0;
/**
* 党员发布话题转项目数占比
*/
@ -70,7 +70,7 @@ public class PartyMemberVanguardDetailResultDTO implements Serializable {
/**
* 党员发布话题转项目结案数
*/
private Integer projectClosedCount;
private Integer projectClosedCount = 0;
/**
* 党员发布话题转项目结案数占比
*/

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

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

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

15
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectDTO.java

@ -90,6 +90,21 @@ public class ProjectDTO implements Serializable {
*/
private String orgIdPath;
/**
* 定位地址[立项项目指的项目发生位置议题转的项目指的话题发生位置]
* */
private String locateAddress;
/**
* 定位经度
* */
private String locateLongitude;
/**
* 定位纬度
* */
private String locateDimension;
/**
* 删除标识:0.未删除 1.已删除
*/

2
epmet-module/data-aggregator/data-aggregator-server/pom.xml

@ -446,7 +446,7 @@
<datasource.druid.stats.url>
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_data_statistical?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.stats.url>
<datasource.druid.stats.username>epmet_data_statistical_user</datasource.druid.stats.username>
<datasource.druid.stats.username>epmet_data_statistical</datasource.druid.stats.username>
<datasource.druid.stats.password>EpmEt-db-UsEr</datasource.druid.stats.password>
<!-- epmet_evaluation_index -->

40
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -1,8 +1,24 @@
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.datastats.form.SubAgencyFormDTO;
import com.epmet.dataaggre.dto.datastats.result.SubAgencyUserResultDTO;
import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO;
import com.epmet.dataaggre.service.datastats.DataStatsService;
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 +26,28 @@ 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));
}
}

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

15
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govproject/ProjectEntity.java

@ -83,4 +83,19 @@ public class ProjectEntity extends BaseEpmetEntity {
*/
private String orgIdPath;
/**
* 定位地址[立项项目指的项目发生位置议题转的项目指的话题发生位置]
* */
private String locateAddress;
/**
* 定位经度
* */
private String locateLongitude;
/**
* 定位纬度
* */
private String locateDimension;
}

6
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

@ -1011,6 +1011,9 @@ public class DataStatsServiceImpl implements DataStatsService {
public PartyMemberVanguardRankResultDTO vanguardRank(PartyMemberVanguardFormDTO formDTO) {
//获取组织级别
DimAgencyEntity agency = dataStatsDao.getAgencyInfo(formDTO.getAgencyId());
if (null == agency) {
return new PartyMemberVanguardRankResultDTO();
}
//组织排行
List<PartyMemberVanguardDetailResultDTO> agencyRank = dataStatsDao.selectAgencyVanguardRank(formDTO.getAgencyId());
//网格排行
@ -1041,6 +1044,9 @@ public class DataStatsServiceImpl implements DataStatsService {
}
private BigDecimal transform(BigDecimal count) {
if (count == null){
count = NumConstant.ZERO_DECIMAL;
}
return count.multiply(new BigDecimal(NumConstant.ONE_HUNDRED) ).setScale(NumConstant.ONE,
RoundingMode.HALF_UP);
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -1,5 +1,7 @@
package com.epmet.dataaggre.service.epmetuser;
import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO;
import java.util.List;
@ -26,4 +28,10 @@ public interface EpmetUserService {
*/
List<String> selectUserIdByCustomerId(List<String> userIds);
/**
* @Param formDTO
* @Description 001各人员巡查记录列表查询
* @author sun
*/
List<StaffListResultDTO> staffList(StaffListFormDTO formDTO);
}

33
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolDetailService.java

@ -0,0 +1,33 @@
/**
* 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.entity.epmetuser.StaffPatrolDetailEntity;
/**
* 工作人员巡查记录明细
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-06-07
*/
public interface StaffPatrolDetailService extends BaseService<StaffPatrolDetailEntity> {
}

32
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/StaffPatrolRecordService.java

@ -0,0 +1,32 @@
/**
* 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.entity.epmetuser.StaffPatrolRecordEntity;
/**
* 工作人员巡查主记录
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-06-07
*/
public interface StaffPatrolRecordService extends BaseService<StaffPatrolRecordEntity> {
}

52
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -1,15 +1,25 @@
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.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
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 java.util.*;
import java.util.stream.Collectors;
/**
* @Author zxc
@ -22,6 +32,10 @@ public class EpmetUserServiceImpl implements EpmetUserService {
@Autowired
private UserBaseInfoDao userBaseInfoDao;
@Autowired
private GovOrgService govOrgService;
@Autowired
private StaffPatrolRecordDao staffPatrolRecordDao;
/**
* @Description 根据UserIds查询
@ -44,4 +58,40 @@ 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;
}
}

41
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolDetailServiceImpl.java

@ -0,0 +1,41 @@
/**
* 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.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.StaffPatrolDetailDao;
import com.epmet.dataaggre.entity.epmetuser.StaffPatrolDetailEntity;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 工作人员巡查记录明细
*
* @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 {
}

42
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/StaffPatrolRecordServiceImpl.java

@ -0,0 +1,42 @@
/**
* 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.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.StaffPatrolRecordDao;
import com.epmet.dataaggre.entity.epmetuser.StaffPatrolRecordEntity;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 工作人员巡查主记录
*
* @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 {
}

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

50
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml

@ -360,18 +360,18 @@
SELECT
orgId,
orgName,
GROUP_COUNT,
GROUP_RATIO,
GROUP_MEMBER_COUNT,
GROUP_MEMBER_RATIO,
TOPIC_COUNT,
TOPIC_RATIO,
ISSUE_COUNT,
ISSUE_RATIO,
PROJECT_COUNT,
PROJECT_RATIO,
PROJECT_CLOSED_COUNT,
PROJECT_CLOSED_RATIO
ifnull(GROUP_COUNT,0) AS GROUP_COUNT,
ifnull(GROUP_RATIO,0) AS GROUP_RATIO,
ifnull(GROUP_MEMBER_COUNT,0) AS GROUP_MEMBER_COUNT,
ifnull(GROUP_MEMBER_RATIO,0) AS GROUP_MEMBER_RATIO,
ifnull(TOPIC_COUNT,0) AS TOPIC_COUNT,
ifnull(TOPIC_RATIO,0) AS TOPIC_RATIO,
ifnull(ISSUE_COUNT,0) AS ISSUE_COUNT,
ifnull(ISSUE_RATIO,0) AS ISSUE_RATIO,
ifnull(PROJECT_COUNT,0) AS PROJECT_COUNT,
ifnull(PROJECT_RATIO,0) AS PROJECT_RATIO,
ifnull(PROJECT_CLOSED_COUNT,0) AS PROJECT_CLOSED_COUNT,
ifnull(PROJECT_CLOSED_RATIO,0) PROJECT_CLOSED_RATIO
FROM
(
SELECT
@ -403,18 +403,18 @@
SELECT
orgId,
orgName,
GROUP_COUNT,
GROUP_RATIO,
GROUP_MEMBER_COUNT,
GROUP_MEMBER_RATIO,
TOPIC_COUNT,
TOPIC_RATIO,
ISSUE_COUNT,
ISSUE_RATIO,
PROJECT_COUNT,
PROJECT_RATIO,
PROJECT_CLOSED_COUNT,
PROJECT_CLOSED_RATIO
ifnull(GROUP_COUNT,0) AS GROUP_COUNT,
ifnull(GROUP_RATIO,0) AS GROUP_RATIO,
ifnull(GROUP_MEMBER_COUNT,0) AS GROUP_MEMBER_COUNT,
ifnull(GROUP_MEMBER_RATIO,0) AS GROUP_MEMBER_RATIO,
ifnull(TOPIC_COUNT,0) AS TOPIC_COUNT,
ifnull(TOPIC_RATIO,0) AS TOPIC_RATIO,
ifnull(ISSUE_COUNT,0) AS ISSUE_COUNT,
ifnull(ISSUE_RATIO,0) AS ISSUE_RATIO,
ifnull(PROJECT_COUNT,0) AS PROJECT_COUNT,
ifnull(PROJECT_RATIO,0) AS PROJECT_RATIO,
ifnull(PROJECT_CLOSED_COUNT,0) AS PROJECT_CLOSED_COUNT,
ifnull(PROJECT_CLOSED_RATIO,0) AS PROJECT_CLOSED_RATIO
FROM
(
SELECT
@ -654,4 +654,4 @@
ORDER BY problem_resolved_count DESC
</select>
</mapper>
</mapper>

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

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/UserJoinIndicatorGrowthRateResultDTO.java

@ -15,6 +15,8 @@ import java.math.BigDecimal;
public class UserJoinIndicatorGrowthRateResultDTO implements Serializable {
private static final long serialVersionUID = -8830240350298414599L;
private String id;
private Integer total;
private BigDecimal monthIncr;

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

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java

@ -147,7 +147,7 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId);
//保证获取公众参与概率数据的最大可能性
int time = NumConstant.TWELVE;
while (null == latest && time > NumConstant.ONE) {
while ((null == latest || latest.getId() == null) && time > NumConstant.ONE) {
time--;
monthId = dateUtils.getPreviousMonthIdByDest(null, monthId);
latest = CollectionUtils.isEmpty(subCustomers)||StringUtils.isBlank(agencyInfo.getAreaCode()) ?

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java

@ -164,7 +164,7 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService
BranchBuildTrendResultDTO result = new BranchBuildTrendResultDTO();
//生成近十二个月的横坐标数组
Map<String,String> monthMap = dateUtils.getXpro();
result.setXAxis(monthMap.values().stream().collect(Collectors.toList()));
result.setXAxis(new ArrayList<>(monthMap.values()));
List<BranchTrendSeriesDataResultDTO> dataArray = new LinkedList<>();
List<BranchIssueDataResultDTO> yearlyDataList =

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>

16
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -238,19 +238,9 @@
FROM
screen_index_data_monthly dm
INNER JOIN screen_org_rank_data rd ON dm.org_id = rd.org_id
<if test="orgType != null and orgType != ''">
<choose>
<when test="orgType == 'grid'">
INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = dm.CUSTOMER_ID AND org.GRID_ID = dm.ORG_ID AND org.DEL_FLAG = '0'
</when>
<when test="orgType == 'agency'">
INNER JOIN screen_customer_agency org ON org.CUSTOMER_ID = dm.CUSTOMER_ID AND org.AGENCY_ID = dm.ORG_ID AND org.DEL_FLAG = '0'
</when>
<when test="orgType == 'department'">
INNER JOIN screen_customer_dept org ON org.CUSTOMER_ID = dm.CUSTOMER_ID AND org.DEPT_ID = dm.ORG_ID AND org.DEL_FLAG = '0'
</when>
</choose>
</if>
<!--查询的是网格的排行 下面条件是orgType = grid-->
INNER JOIN screen_customer_grid org ON org.CUSTOMER_ID = dm.CUSTOMER_ID AND org.GRID_ID = dm.ORG_ID AND org.DEL_FLAG = '0'
AND dm.month_id = rd.month_id
WHERE
dm.del_flag = '0'

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml

@ -28,6 +28,7 @@
<!-- 根据地区码查询用户参与数据 -->
<select id="selectUserJoinDataByAreaCode" resultType="com.epmet.evaluationindex.screen.dto.result.UserJoinIndicatorGrowthRateResultDTO">
SELECT
scj.ID,
IFNULL(avg( scj.JOIN_TOTAL ),0) AS total,
IFNULL(ROUND( avg( scj.AVG_JOIN ), 1 ),0) AS averageJoin,
IFNULL(avg( scj.JOIN_TOTAL_UP_RATE ),0) AS monthIncr,

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>

29
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/result/OrgStaffDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.org.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 返回每个网格每个组织下工作人员的userId
*
* @author yinzuomei@elink-cn.com
* @date 2021/6/3 9:49
*/
@Data
public class OrgStaffDTO implements Serializable {
/**
* 组织id或者网格id
*/
private String orgId;
/**
* agency or grid
*/
private String orgType;
/**
* 当前组织或者当前网格下的
*/
private List<String> staffIds;
}

9
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java

@ -17,11 +17,11 @@
package com.epmet.dto.screen;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 中央区-项目数据
@ -54,6 +54,11 @@ public class ScreenProjectDataDTO implements Serializable {
*/
private String orgId;
/**
* 来源议题issue组织agency
*/
private String origin;
/**
* 上级组织Id
*/

7
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
*/
@ -149,4 +154,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<>();
}

30
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/GridCenterPointForm.java

@ -0,0 +1,30 @@
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 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<>();
}*/
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -112,6 +112,8 @@ public class DemoController {
@Autowired
private FactOriginProjectCategoryDailyService originProjectCategoryDailyService;
@Autowired
private ScreenCentralZoneDataAbsorptionService screenCentralZoneDataAbsorptionService;
@Autowired
private StatsPartyMemberVanguardService statsPartyMemberVanguardService;
@Autowired
private FactGroupActDailyService factGroupActDailyService;
@ -897,6 +899,11 @@ public class DemoController {
return new Result().ok(ndddYhjfService.difficultyDataExtract(param));
}
@PostMapping("centralZoneDataHub")
public Result Test(@RequestBody ScreenCentralZoneDataFormDTO param){
screenCentralZoneDataAbsorptionService.centralZoneDataHub(param);
return new Result();
}
@PostMapping("vanguard")
public Result partyMemberVanguard(@RequestBody StatsFormDTO formDTO) {
statsPartyMemberVanguardService.agencyStats(formDTO);
@ -928,5 +935,4 @@ public class DemoController {
factAgencyGovernDailyService.extractFactAgencyGovernDaily(fromDTO.getCustomerId(), fromDTO.getDateId());
return new Result();
}
}

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

26
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -3,6 +3,7 @@ package com.epmet.dao.org;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.org.result.CustomerAreaCodeResultDTO;
import com.epmet.dto.org.result.OrgStaffDTO;
import com.epmet.entity.org.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -34,6 +35,31 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
CustomerAgencyEntity getRootAgencyInfo(String customerId);
/**
* 获取每个组织每个网格下工作人员userId集合
*
* @param customerId
* @return com.epmet.dto.org.result.OrgStaffResultDTO
*/
List<OrgStaffDTO> selectGridStaffIds(String customerId);
/**
* 根据客户id下,查询所有的组织
*
* @param customerId
* @return com.epmet.entity.org.CustomerAgencyEntity
*/
List<CustomerAgencyEntity> selectListByCustomerId(@Param("customerId")String customerId);
/**
* 查询agency下面的网格员注意向上汇聚的
*
* @param agencyId
* @param customerId
* @return java.lang.String
*/
List<String> selectAgencyStaffIds(@Param("customerId") String customerId,@Param("agencyId")String agencyId);
List<CustomerAgencyEntity> queryAgencyListByCustomerId(String customerId);
/**

62
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java

@ -22,97 +22,97 @@ import java.util.Set;
public interface UserDao {
/**
* @Description 查询注册用户的总量与增量
* @param
* @return
* @Description 查询注册用户的总量与增量
* @author wangc
* @date 2020.06.18 18:50
**/
CommonTotalAndIncCountResultDTO selectResiTotalAndIncrByLevel(@Param("regOrPartiFlag") String regOrPartiFlag, @Param("gridIds") Set<String> gridIds, @Param("targetDate")Date targetDate);
**/
CommonTotalAndIncCountResultDTO selectResiTotalAndIncrByLevel(@Param("regOrPartiFlag") String regOrPartiFlag, @Param("gridIds") Set<String> gridIds, @Param("targetDate") Date targetDate);
/**
* @Description 查询党员的总量与增量
* @param
* @return
* @Description 查询党员的总量与增量
* @author wangc
* @date 2020.06.18 18:50
**/
CommonTotalAndIncCountResultDTO selectPartyTotalAndIncr(@Param("userIds") List<String> userIds, @Param("incrUserIds") List<String> incrUserIds, @Param("targetDate") Date targetDate);
/**
* @Description 查询热心居民的总量与增量
* @param
* @return
* @Description 查询热心居民的总量与增量
* @author wangc
* @date 2020.06.18 18:50
**/
CommonTotalAndIncCountResultDTO selectWarmTotalAndIncr(@Param("userIds") List<String> userIds, @Param("incrUserIds") List<String> incrUserIds, @Param("gridIds") Set<String> gridIds, @Param("targetDate") Date targetDate);
/**
* @Description 查询指定网格范围下单位时间内新增的注册用户Id
* @param
* @return
* @Description 查询指定网格范围下单位时间内新增的注册用户Id
* @author wangc
* @date 2020.06.18 18:50
**/
List<String> selectIncrUserIds(@Param("regOrPartiFlag") String regOrPartiFlag, @Param("gridIds") Set<String> gridIds, @Param("targetDate") Date targetDate);
/**
* @Description 查询指定网格范围下截至指定位时间累计的注册用户Id
* @param
* @return
* @Description 查询指定网格范围下截至指定位时间累计的注册用户Id
* @author wangc
* @date 2020.06.18 18:50
**/
List<String> selectTotalUserIds(@Param("regOrPartiFlag") String regOrPartiFlag, @Param("gridIds") Set<String> gridIds, @Param("targetDate") Date targetDate);
/**
* @Description 查询指定时间范围内网格新增的注册/参与用户Id
* @param
* @return
* @Description 查询指定时间范围内网格新增的注册/参与用户Id
* @author wangc
* @date 2020.06.18 18:50
**/
List<String> selectIncrUserIdsWithinTimeRange(@Param("regOrPartiFlag") String regOrPartiFlag, @Param("gridIds") Set<String> gridIds, @Param("startDate")Date startDate,@Param("endDate")Date endDate);
List<String> selectIncrUserIdsWithinTimeRange(@Param("regOrPartiFlag") String regOrPartiFlag, @Param("gridIds") Set<String> gridIds, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
/**
* @Description 查询指定时间范围内注册/参与用户增量
* @param
* @return
* @Description 查询指定时间范围内注册/参与用户增量
* @author wangc
* @date 2020.06.18 18:50
**/
Integer selectResiIncrWithinTimeRange(@Param("regOrPartiFlag") String regOrPartiFlag, @Param("gridIds") Set<String> gridIds, @Param("startDate")Date startDate,@Param("endDate")Date endDate);
Integer selectResiIncrWithinTimeRange(@Param("regOrPartiFlag") String regOrPartiFlag, @Param("gridIds") Set<String> gridIds, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
/**
* @Description 查询指定时间范围内党员的增量
* @param
* @return
* @Description 查询指定时间范围内党员的增量
* @author wangc
* @date 2020.06.18 18:50
**/
Integer selectPartyIncrWithinTimeRange(@Param("incrUserIds")List<String> incrUserIds,@Param("startDate")Date startDate,@Param("endDate")Date endDate);
Integer selectPartyIncrWithinTimeRange(@Param("incrUserIds") List<String> incrUserIds, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
/**
* @Description 查询指定时间范围内热心居民的增量
* @param
* @return
* @Description 查询指定时间范围内热心居民的增量
* @author wangc
* @date 2020.06.18 18:50
**/
Integer selectWarmIncrWithinTimeRange(@Param("incrUserIds")List<String> incrUserIds,@Param("gridIds") Set<String> gridIds,@Param("startDate")Date startDate,@Param("endDate")Date endDate);
Integer selectWarmIncrWithinTimeRange(@Param("incrUserIds") List<String> incrUserIds, @Param("gridIds") Set<String> gridIds, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
/**
* @Description 查询用户是不是党员
* @param userIds
* @Description 查询用户是不是党员
* @author zxc
* @date 2020/9/15 4:23 下午
*/
List<UserPartyResultDTO> selectUserIsParty(@Param("userIds") List<String> userIds);
List<String> selectPartymembersByCustomerId(@Param("customerId")String customerId);
List<String> selectPartymembersByCustomerId(@Param("customerId") String customerId);
List<GridHeartedFormDTO> selectWarmHeartedByCustomerId(@Param("customerId")String customerId);
List<GridHeartedFormDTO> selectWarmHeartedByCustomerId(@Param("customerId") String customerId);
/**
* @param customerId
@ -125,21 +125,39 @@ public interface UserDao {
List<String> selectGridRegUserIds(@Param("customerId") String customerId, @Param("gridId") String gridId);
/**
* @Description 获取客户下的网格注册居民
* @param customerId
* @return
* @Description 获取客户下的网格注册居民
* @author wangc
* @date 2020.09.25 13:54
**/
List<ScreenPartyUserRankDataEntity> selectRegisteredUserByCustomerId(@Param("customerId") String customerId);
/**
* @Description 获取大屏项目相关信息 联系人
* @param list
* @param userIdList
* @return java.util.List<com.epmet.dto.screen.ScreenProjectDataDTO>
* @Description 获取大屏项目相关信息 联系人
* @author wangc
* @date 2021.03.08 17:16
*/
List<ScreenProjectDataDTO> selectScreenProjectData(@Param("list") List<ScreenProjectDataDTO> list);
List<ScreenProjectDataDTO> selectScreenProjectData(@Param("list") List<String> userIdList);
/**
* 根据工作员用户id, 返回这些人当中多少个网格员
*
* @param staffIds
* @return int
*/
int selectGridManagerTotal(@Param("customerId") String customerId, @Param("staffIds") List<String> staffIds);
/**
* desc: 根据Id获取工作人员 昵称及手机号
*
* @param staffUserIdList
* @return java.util.List<com.epmet.dto.screen.ScreenProjectDataDTO>
* @author LiuJanJun
* @date 2021/6/8 5:21 下午
*/
List<ScreenProjectDataDTO> selectStaffInfo(@Param("list") List<String> staffUserIdList);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserTotalDataEntity.java

@ -95,4 +95,8 @@ public class ScreenUserTotalDataEntity extends BaseEpmetEntity {
*/
private Integer projectTotal;
/**
* 06.01新增orgType=agency或者grid的时候此列赋值:当前组织或者当前网格内的网格员人数
*/
private Integer gridMemberTotal;
}

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/project/ProjectEntity.java

@ -46,7 +46,7 @@ public class ProjectEntity extends BaseEpmetEntity {
private String agencyId;
/**
* 来源议题issue
* 来源议题issue组织agency
*/
private String origin;
@ -80,4 +80,19 @@ public class ProjectEntity extends BaseEpmetEntity {
*/
private String orgIdPath;
/**
* 定位地址[立项项目指的项目发生位置议题转的项目指的话题发生位置]
* */
private String locateAddress;
/**
* 定位经度
* */
private String locateLongitude;
/**
* 定位纬度
* */
private String locateDimension;
}

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

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java

@ -361,13 +361,11 @@ public interface FactOriginProjectMainDailyService extends BaseService<FactOrigi
* @param customerId
* @param rows
* @param dateId
* @param exceedLimit 超期上线
* @param about2exceedLimit 即将超期参数
* @return java.util.List<com.epmet.dto.screen.ScreenProjectDataDTO>
* @author wangc
* @date 2021.03.04 22:56
*/
List<ScreenProjectDataDTO> initNewScreenProjectData(String customerId,Integer rows ,String dateId,Integer exceedLimit,Integer about2exceedLimit);
List<ScreenProjectDataDTO> initNewScreenProjectData(String customerId,Integer rows ,String dateId);
void computerIfExceed(List<ScreenProjectDataDTO> list,Integer exceedLimit,Integer about2exceedLimit);

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java

@ -20,7 +20,6 @@ package com.epmet.service.evaluationindex.extract.todata.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgTypeConstant;
@ -470,19 +469,12 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
* @param customerId
* @param rows
* @param dateId
* @param exceedLimit 超期上线
* @param about2exceedLimit 即将超期参数
* @return java.util.List<com.epmet.dto.screen.ScreenProjectDataDTO>
* @author wangc
* @date 2021.03.04 22:56
*/
@Override
public List<ScreenProjectDataDTO> initNewScreenProjectData(String customerId,Integer rows , String dateId,Integer exceedLimit,Integer about2exceedLimit) {
boolean ifBeforeYesterday = true;
int beforeDate = Integer.parseInt(DateUtils.getBeforeNDay(NumConstant.ONE));
if(beforeDate > Integer.parseInt(dateId)){
ifBeforeYesterday = false;
}
public List<ScreenProjectDataDTO> initNewScreenProjectData(String customerId,Integer rows , String dateId) {
List<ScreenProjectDataDTO> projects = baseDao.initNewScreenProjectData(customerId, rows <= NumConstant.ZERO ? "" : dateId, dateId);
projects.forEach(project -> {
if (ProjectConstant.CLOSED_CASE.equals(project.getProjectStatusCode())) {

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

Loading…
Cancel
Save