diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java index ef71399b7d..1399fe6a13 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java @@ -4,6 +4,7 @@ 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.PointOperationLogListener; import com.epmet.mq.listener.listener.ProjectOperationLogListener; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; @@ -33,6 +34,7 @@ public class RocketMQConsumerRegister { 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()); + register(nameServer, ConsomerGroupConstants.POINT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.POINT, "*", new PointOperationLogListener()); } } catch (MQClientException e) { e.printStackTrace(); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/PointOperationLogListener.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/PointOperationLogListener.java new file mode 100644 index 0000000000..f953c35edc --- /dev/null +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/PointOperationLogListener.java @@ -0,0 +1,91 @@ +package com.epmet.mq.listener.listener; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.messages.PointRuleChangedMQMsg; +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.enums.SystemMessageTypeEnum; +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.21 10:13 + */ +public class PointOperationLogListener implements MessageListenerConcurrently { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public ConsumeConcurrentlyStatus consumeMessage(List 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 opeType = messageExt.getTags(); + String msg = new String(messageExt.getBody()); + logger.info("积分操作日志监听器-收到消息内容:{}", msg); + PointRuleChangedMQMsg msgObj = JSON.parseObject(msg, PointRuleChangedMQMsg.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(opeType); + logEntity.setTypeDisplay(SystemMessageTypeEnum.getTypeDisplay(opeType)); + logEntity.setTargetId(msgObj.getRuleId()); + logEntity.setIp(msgObj.getIp()); + logEntity.setFromApp(msgObj.getFromApp()); + logEntity.setFromClient(msgObj.getFromClient()); + logEntity.setCustomerId(operatorInfo.getCustomerId()); + 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:point_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); + } + } +} diff --git a/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java b/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java index caad8b0869..14d4210afa 100644 --- a/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java +++ b/epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java @@ -2,7 +2,6 @@ package io.renren; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; - @SpringBootApplication public class GeneratorApplication { diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java index ef5970dbb3..890d19acf1 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java @@ -37,8 +37,12 @@ public interface ConsomerGroupConstants { String AUTH_OPERATION_LOG_GROUP = "auth_operation_log_group"; /** - * 项目操作日志小肥猪 + * 项目操作日志消费组 */ String PROJECT_OPERATION_LOG_GROUP = "project_operation_log_group"; + /** + * 积分操作消费组 + */ + String POINT_OPERATION_LOG_GROUP = "point_operation_log_group"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java index 70d4e006f8..8fe36aa53a 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java @@ -2,6 +2,7 @@ package com.epmet.commons.rocketmq.constants; /** * 话题列表常量,其他服务要想发送消息到mq,则应当引入epmet-commons-rocketmq模块,并且使用此常量 + * 用于mq中的topic */ public interface TopicConstants { /** @@ -21,4 +22,9 @@ public interface TopicConstants { * 认证 */ String AUTH = "auth"; + + /** + * 积分系统话题 + */ + String POINT = "point"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/PointRuleChangedMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/PointRuleChangedMQMsg.java new file mode 100644 index 0000000000..073d18821c --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/PointRuleChangedMQMsg.java @@ -0,0 +1,33 @@ +package com.epmet.commons.rocketmq.messages; + +import lombok.Data; + +import java.util.Date; + +/** + * 积分规则变动消息体 + */ +@Data +public class PointRuleChangedMQMsg { + /** + * 操作简介 + */ + private String operationBrief; + + /** + * 规则的id + */ + private String ruleId; + /** + * 谁操作的 + */ + private String operatorId; + + private String ip; + + private String fromApp; + + private String fromClient; + + private Date operatingTime; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index 25cfa3e0b2..c601d2fd71 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -86,4 +86,14 @@ public interface StrConstant { String SPECIAL_CUSTOMER = "150282ed25c14ff0785e7e06283b6283"; //平音客户 String PY_CUSTOMER = "6f203e30de1a65aab7e69c058826cd80"; + + /** + * 单位积分,积分上限,积分说明,积分事件 + */ + String POINT_CHANGE = "将%s调整为%s"; + + /** + * 积分规则修改的头 + */ + String POINT_CHANGE_HEAD = "修改了%s规则,"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java index ff5e18b091..92d29521e2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java @@ -171,6 +171,7 @@ public enum RequirePermissionEnum { */ MORE_PATROL_RECORD_LIST("more_patrol_record_list","更多:日志记录:巡查记录:列表","巡查记录列表"), MORE_SYSTEM_LOG_LIST("MORE_SYSTEM_LOG_LIST","更多:日志记录:系统日志:列表","系统日志列表"), + MORE_GRID_MEMBER_STATS_ANALYSIS("more_grid_member_stats_analysis", "更多:网格员数据分析", "更多:网格员数据分析"), /** diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index cef713e4b7..80885587be 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -187,7 +187,10 @@ public enum EpmetErrorCode { SIGN_IN_TIME_PASSED(8912,"当前时间已超过签到时间"), INVITATION_NOT_EXIST(8913,"链接不存在"), NOTICE_EXPIRATION_TIME(8914,"通知过期时间不能早于当前时间"), - NOTICE_BE_OVERDUE(8915,"通知已过期不允许再次变更"); + NOTICE_BE_OVERDUE(8915,"通知已过期不允许再次变更"), + + SAME_RULE_NAME(8916,"该积分事件已存在,请重新调整保存"), + UP_LIMIT_POINT(8917,"积分上限需为单位积分倍数,请重新调整保存"); private int code; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index 3a556da632..b47d56574c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -847,4 +847,15 @@ public class DateUtils { return DateUtils.format(date,DateUtils.DATE_TIME_PATTERN); } + /** + * @Author sun + * @Description 获取当前日期几个自然月之前的日期(yyyy-MM-dd HH:mm:ss) + **/ + public static String getBeforeMonthDate(int beforMonth, String dateType){ + Calendar c = Calendar.getInstance(); + c.add(Calendar.MONTH, - beforMonth); + Date date = c.getTime(); + return DateUtils.format(date,dateType); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/GridMemberStatsFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/GridMemberStatsFormDTO.java new file mode 100644 index 0000000000..45ad8c8d62 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/GridMemberStatsFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description 网格员相关统计formdto + * @author wxz + * @date 2021.07.05 15:46:23 +*/ +@Data +public class GridMemberStatsFormDTO { + + public interface IssueProjectStats {} + + @NotBlank(message = "网格ID不能为空", groups = {IssueProjectStats.class}) + private String gridId; + + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java index 4945b5de46..4de304f917 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffListFormDTO.java @@ -24,7 +24,7 @@ public class StaffListFormDTO implements Serializable { @NotNull(message = "最近时间不能为空", groups = StaffListFormDTO.Staff.class) private Integer time; /** - * 排序字段【巡查总次数:patrolTotal;最近开始巡查时间:latestPatrolledTime】 + * 排序字段【巡查总次数:patrolTotal;最近开始巡查时间:latestPatrolledTime;上报项目数: reportProjectCount;巡查总时长:totalTime】 */ @NotBlank(message = "排序条件不能为空", groups = StaffListFormDTO.Staff.class) private String sortCode; diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java new file mode 100644 index 0000000000..8e99eec996 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/PersonalPatrolListResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 个人中心-网格员巡查记录-接口入参 + * @Auth sun + */ +@Data +public class PersonalPatrolListResultDTO implements Serializable { + private static final long serialVersionUID = 7129564173128153335L; + + //巡查总次数;巡查总时长;立项事件数 + private String key; + //key对应值 + private String value; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java index 15f2647e88..53bf3715c1 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffListResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.dataaggre.dto.epmetuser.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -28,5 +29,11 @@ public class StaffListResultDTO implements Serializable { private String gender = "0"; //正在巡查中:patrolling;否则返回空字符串 private String status = ""; + //上报项目数 + private Integer reportProjectCount; + //巡查总时长 + private String totalTime = ""; + @JsonIgnore + private Integer timeNum; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridMemberDataAnalysisFromDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridMemberDataAnalysisFromDTO.java new file mode 100644 index 0000000000..1803db4c96 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridMemberDataAnalysisFromDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dataaggre.dto.govorg.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +@Data +public class GridMemberDataAnalysisFromDTO { + + public interface listGridMemberDatas {} + + private List gridIds; + + // 搜索的人员姓名 + private String searchedStaffName; + private String month; + @NotBlank(message = "排序规则不能为空", groups = { listGridMemberDatas.class }) + private String sort; + private Integer pageNo = 1; + private Integer pageSize = 10; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridMemberDataAnalysisResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridMemberDataAnalysisResultDTO.java new file mode 100644 index 0000000000..b431cfafab --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/GridMemberDataAnalysisResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dataaggre.dto.govorg.result; + +import lombok.Data; + +@Data +public class GridMemberDataAnalysisResultDTO { + + private String gridId; + private String staffId; + private String staffName; + private String orgName; + + private Integer projectCount; + private Integer issueToProjectCount; + private Integer closedIssueCount; + private Integer projectResponseCount; + private Integer projectTransferCount; + private Integer projectClosedCount; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/enums/GridMemberDataAnalysisEnums.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/enums/GridMemberDataAnalysisEnums.java new file mode 100644 index 0000000000..2dfc6a5c1b --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/enums/GridMemberDataAnalysisEnums.java @@ -0,0 +1,39 @@ +package com.epmet.dataaggre.enums; + +import java.util.ArrayList; +import java.util.List; + +public enum GridMemberDataAnalysisEnums { + + SORT_SORT_PROJECT_COUNT("projectCount", "project_count"), + SORT_ISSUE_TO_PROJECT_COUNT("issueToProjectCount", "issue_to_project_count"), + SORT_CLOSED_ISSUE_COUNT("closedIssueCount", "closed_issue_count"), + SORT_PROJECT_RESPONSE_COUNT("projectResponseCount", "project_response_count"), + SORT_PROJECT_TRANSFER_COUNT("projectTransferCount", "project_transfer_count"), + SORT_PROJECT_CLOSED_COUNT("projectClosedCount", "project_closed_count"); + + private String key; + private String value; + + GridMemberDataAnalysisEnums(String key, String value) { + this.key = key; + this.value = value; + } + + public static GridMemberDataAnalysisEnums get(String key) { + for (GridMemberDataAnalysisEnums gm : GridMemberDataAnalysisEnums.values()) { + if (gm.key.equals(key)) { + return gm; + } + } + return null; + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java index bd535ae77c..f63ccdcc2c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java @@ -7,12 +7,16 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.epmetuser.form.GridMemberStatsFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.PersonalPatrolListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +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; @@ -20,7 +24,10 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @Author zxc @@ -33,6 +40,9 @@ public class EpmetUserController { @Autowired private EpmetUserService epmetUserService; + @Autowired + private DataStatsService dataStatsService; + /** * @Param formDTO @@ -79,5 +89,102 @@ public class EpmetUserController { return new Result().ok(epmetUserService.patrolDateList(formDTO)); } + /** + * @Param formDTO + * @Description 【更多-巡查记录-人员巡查记录列表】 + * @author sun + */ + @PostMapping("staffpatrollist") + @RequirePermission(requirePermission = RequirePermissionEnum.MORE_PATROL_RECORD_LIST) + public Result> staffPatrolList(@LoginUser TokenDto tokenDto, @RequestBody StaffListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, StaffListFormDTO.Staff.class); + if (!"patrolTotal".equals(formDTO.getSortCode()) && !"latestPatrolledTime".equals(formDTO.getSortCode()) + && !"reportProjectCount".equals(formDTO.getSortCode()) && !"totalTime".equals(formDTO.getSortCode())) { + throw new RenException("参数错误,排序条件值错误"); + } + if (formDTO.getTime() != 1 && formDTO.getTime() != 3) { + throw new RenException("参数错误,最近时间值不正确"); + } + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(epmetUserService.staffPatrolList(formDTO)); + } + + /** + * @Description 个人中心-网格员巡查记录 + * @author sun + */ + @PostMapping("personalpatrollist") + public Result> personalPatrolList(@LoginUser TokenDto tokenDto) { + return new Result>().ok(epmetUserService.personalPatrolList(tokenDto.getUserId())); + } + + /** + * @Description 网格员项目议题统计数据 + * @return + * @author wxz + * @date 2021.07.05 15:49 + */ + @PostMapping("/gridmember/issueprojectstats") + public Result>> getGridMemberIssueProjectStats(@LoginUser TokenDto loginUser) { + String userId = loginUser.getUserId(); + + GridMemberDataAnalysisResultDTO data = dataStatsService.getGridMemberIssueProjectStats(userId); + List> result = convertToMapList(data); + return new Result>>().ok(result); + } + + /** + * @Description 将议题项目统计数据转为前端需要的格式 + * @return + * @author wxz + * @date 2021.07.05 16:35 + */ + private List> convertToMapList(GridMemberDataAnalysisResultDTO data) { + Integer projectCount = data == null ? 0 : data.getProjectCount(); + Integer closedIssueCount = data == null ? 0 : data.getClosedIssueCount(); + Integer issueToProjectCount = data == null ? 0 : data.getIssueToProjectCount(); + Integer projectClosedCount = data == null ? 0 : data.getProjectClosedCount(); + Integer projectResponseCount = data == null ? 0 : data.getProjectResponseCount(); + Integer projectTransferCount = data == null ? 0 : data.getProjectTransferCount(); + + HashMap projectCountMap = new HashMap<>(); + projectCountMap.put("key", "直接立项数"); + projectCountMap.put("value", projectCount); + projectCountMap.put("type", "project"); + + HashMap closedIssueCountMap = new HashMap<>(); + closedIssueCountMap.put("key", "议题转项目数"); + closedIssueCountMap.put("value", issueToProjectCount); + closedIssueCountMap.put("type", "project"); + + HashMap issueClosedCountMap = new HashMap<>(); + issueClosedCountMap.put("key", "议题关闭数"); + issueClosedCountMap.put("value", closedIssueCount); + issueClosedCountMap.put("type", "issue"); + + HashMap projectResponseCountMap = new HashMap<>(); + projectResponseCountMap.put("key", "项目响应数"); + projectResponseCountMap.put("value", projectResponseCount); + projectResponseCountMap.put("type", "project"); + + HashMap projectTransferCountMap = new HashMap<>(); + projectTransferCountMap.put("key", "项目吹哨数"); + projectTransferCountMap.put("value", projectTransferCount); + projectTransferCountMap.put("type", "project"); + + HashMap projectClosedCountMap = new HashMap<>(); + projectClosedCountMap.put("key", "项目结案数"); + projectClosedCountMap.put("value", projectClosedCount); + projectClosedCountMap.put("type", "project"); + + ArrayList> maps = new ArrayList<>(6); + maps.add(projectCountMap); + maps.add(closedIssueCountMap); + maps.add(issueClosedCountMap); + maps.add(projectResponseCountMap); + maps.add(projectTransferCountMap); + maps.add(projectClosedCountMap); + return maps; + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 262aff38c3..6f52f37e7c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -1,20 +1,35 @@ package com.epmet.dataaggre.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.RequirePermission; +import com.epmet.commons.tools.enums.RequirePermissionEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.govorg.form.GridMemberDataAnalysisFromDTO; import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; import com.epmet.dataaggre.dto.govorg.result.AgencyGridListResultDTO; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO; +import com.epmet.dataaggre.enums.GridMemberDataAnalysisEnums; +import com.epmet.dataaggre.service.AggreGridService; import com.epmet.dataaggre.service.govorg.GovOrgService; +import com.epmet.dto.result.PublicAndInternalFileResultDTO; +import org.apache.commons.lang3.StringUtils; +import org.apache.xmlbeans.impl.xb.xsdschema.Public; 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 java.util.ArrayList; import java.util.List; +import java.util.PriorityQueue; /** * @Author zxc @@ -27,6 +42,12 @@ public class GovOrgController { @Autowired private GovOrgService govOrgService; + @Autowired + private LoginUserUtil loginUserUtil; + + @Autowired + private AggreGridService aggreGridService; + /** * @param tokenDTO @@ -51,4 +72,51 @@ public class GovOrgController { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(govOrgService.queryNextLevelAreaCodeList(formDTO)); } + + /** + * @Description 网格员统计,列表查询 + * @return + * @author wxz + * @date 2021.07.05 11:14 + */ + @PostMapping("gridmemberdataanalysis") + //@RequirePermission(requirePermission = RequirePermissionEnum.MORE_GRID_MEMBER_STATS_ANALYSIS) + public Result getGridMemberDataAnalysis(@RequestBody GridMemberDataAnalysisFromDTO input) { + ValidatorUtils.validateEntity(input, GridMemberDataAnalysisFromDTO.listGridMemberDatas.class); + + List gridIds = input.getGridIds(); + String month = input.getMonth(); + Integer pageNo = input.getPageNo(); + Integer pageSize = input.getPageSize(); + String sort = input.getSort(); + String searchedStaffName = input.getSearchedStaffName(); + String loginUserId = loginUserUtil.getLoginUserId(); + + // 排序字段检验 + GridMemberDataAnalysisEnums sortType; + if ((sortType = GridMemberDataAnalysisEnums.get(sort)) == null ) { + throw new RenException(EpmetErrorCode.OPEN_API_PARAMS_MISSING.getCode(), "未知的排序方式"); + } + + // 用户登录状态判断 + if (StringUtils.isBlank(loginUserId)) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询网格员统计数据失败"); + } + + // 月份格式判断 + if (StringUtils.isNotBlank(month)) { + if (!month.matches("\\d{4}/\\d{2}")) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), "月份格式错误:" + month); + } else { + month = month.replace("/", ""); + } + } + + // 网格id为空处理 + if (CollectionUtils.isEmpty(gridIds)) { + gridIds = new ArrayList<>(); + } + List resultList = aggreGridService.getGridMemberDataAnalysis(gridIds, searchedStaffName, loginUserId, month, sortType.getValue(), pageNo, pageSize); + return new Result().ok(resultList); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/FactGridMemberStatisticsDailyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/FactGridMemberStatisticsDailyDao.java new file mode 100644 index 0000000000..a8ea0bcc94 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/FactGridMemberStatisticsDailyDao.java @@ -0,0 +1,55 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.dao.datastats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity; +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-07-05 + */ +@Mapper +public interface FactGridMemberStatisticsDailyDao extends BaseDao { + + /** + * @Description 查询网格员统计数据 + * @return + * @author wxz + * @date 2021.07.05 13:19 + */ + List listGridMemberDataStats(@Param("gridIds") List gridIds, + @Param("searchedStaffName") String searchedStaffName, + @Param("month") String month, + @Param("sort") String sort); + + /** + * @Description 查询网格员议题项目统计数据 + * @return + * @author wxz + * @date 2021.07.05 16:17 + */ + GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(@Param("staffId") String staffId); +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java index 5c6cb03bdb..36385a7cbd 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffPatrolRecordDao.java @@ -23,6 +23,7 @@ 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 org.apache.ibatis.annotations.Param; import java.util.List; @@ -41,4 +42,15 @@ public interface StaffPatrolRecordDao extends BaseDao { */ List selectPatrolList(StaffListFormDTO formDTO); + /** + * @Description 按条件查询巡查业务数据V2 + * @author sun + */ + List selectStaffPatrolList(StaffListFormDTO formDTO); + + /** + * @Description 汇总查询当前工作人员所有巡查记录数据 + * @author sun + */ + StaffListResultDTO selectPersonalPatrolList(@Param("staffId") String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java index cc73cc2c1f..3fcc8655ed 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java @@ -62,4 +62,10 @@ public interface CustomerGridDao extends BaseDao { * @Description 查询工作人员所属组织下网格列表 **/ List gridListByStaffId(@Param("staffId") String staffId); + + /** + * @Description 有网格列表的查询网格基本信息,没有的查询工作人员所属组织级下级所有的网格信息 + * @author sun + */ + List getGridInfoList(@Param("gridIds") List gridIds, @Param("staffId") String staffId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java new file mode 100644 index 0000000000..63214c950a --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/FactGridMemberStatisticsDailyEntity.java @@ -0,0 +1,121 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.entity.datastats; + +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-07-05 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_member_statistics_daily") +public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * yyyyMMdd + */ + private String dateId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格I + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/AggreGridService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/AggreGridService.java new file mode 100644 index 0000000000..3702bbb319 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/AggreGridService.java @@ -0,0 +1,20 @@ +package com.epmet.dataaggre.service; + +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; + +import java.util.List; + +/** + * @Description 聚合的网格相关service,不指定具体的数据源,它调用其他子service,子service中指定具体数据源 + * @author wxz + * @date 2021.07.05 13:06:35 +*/ +public interface AggreGridService { + /** + * @Description 网格员数据统计列表查询 + * @return + * @author wxz + * @date 2021.07.05 11:17 + */ + List getGridMemberDataAnalysis(List gridIds, String searchedStaffName, String currStaffId, String month, String sort, Integer pageNo, Integer pageSize); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java index 8b08a765d2..36ec2943db 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java @@ -3,9 +3,11 @@ package com.epmet.dataaggre.service.datastats; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; import com.epmet.dataaggre.dto.datastats.form.*; import com.epmet.dataaggre.dto.datastats.result.*; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; +import java.security.PrivateKey; import java.util.List; /** @@ -159,4 +161,25 @@ public interface DataStatsService { * @author sun */ GovrnRatioResultDTO governRatio(GovrnRatioFormDTO formDTO); + + /** + * @Description 查询网格员统计数据列表 + * @return + * @author wxz + * @date 2021.07.05 13:13 + */ + List listGridMemberDataStats(List gridIds, + String searchedStaffName, + String month, + String sort, + Integer pageNo, + Integer pageSize); + + /** + * @Description 单个网格员议题项目统计数据 + * @return + * @author wxz + * @date 2021.07.05 16:05 + */ + GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index b61338b163..e290386e71 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -1,20 +1,25 @@ package com.epmet.dataaggre.service.datastats.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.constant.OrgConstant; import com.epmet.dataaggre.dao.datastats.DataStatsDao; +import com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao; import com.epmet.dataaggre.dto.datastats.FactGroupActDailyDTO; import com.epmet.dataaggre.dto.datastats.form.*; import com.epmet.dataaggre.dto.datastats.result.*; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.dto.resigroup.ActCategoryDictDTO; import com.epmet.dataaggre.dto.resigroup.result.GroupActRankDetailDTO; import com.epmet.dataaggre.entity.datastats.DimAgencyEntity; import com.epmet.dataaggre.entity.datastats.DimGridEntity; +import com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity; import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; +import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -43,6 +48,9 @@ public class DataStatsServiceImpl implements DataStatsService { @Autowired private EvaluationIndexService indexService; + @Autowired + private FactGridMemberStatisticsDailyDao factGridMemberStatisticsDailyDao; + /** * @Param formDTO @@ -1302,4 +1310,20 @@ public class DataStatsServiceImpl implements DataStatsService { return resultDTO; } + @Override + public List listGridMemberDataStats(List gridIds, + String searchedStaffName, + String month, + String sort, + Integer pageNo, + Integer pageSize) { + + PageHelper.startPage(pageNo, pageSize); + return factGridMemberStatisticsDailyDao.listGridMemberDataStats(gridIds, searchedStaffName, month, sort); + } + + @Override + public GridMemberDataAnalysisResultDTO getGridMemberIssueProjectStats(String staffId) { + return factGridMemberStatisticsDailyDao.getGridMemberIssueProjectStats( staffId); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index 359fcbe7a0..f548e47d4e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -3,10 +3,7 @@ package com.epmet.dataaggre.service.epmetuser; import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; -import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO; -import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO; -import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO; -import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; +import com.epmet.dataaggre.dto.epmetuser.result.*; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import java.util.List; @@ -64,4 +61,16 @@ public interface EpmetUserService { */ List staffGridRole(List forms, String staffName); + /** + * @Param formDTO + * @Description 【更多-巡查记录-人员巡查记录列表】 + * @author sun + */ + List staffPatrolList(StaffListFormDTO formDTO); + + /** + * @Description 个人中心-网格员巡查记录 + * @author sun + */ + List personalPatrolList(String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 175525d16d..09b12685be 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -25,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.NumberFormat; import java.util.*; import java.util.stream.Collectors; @@ -247,5 +249,85 @@ public class EpmetUserServiceImpl implements EpmetUserService { return result; } + /** + * @Param formDTO + * @Description 【更多-巡查记录-人员巡查记录列表】 + * @author sun + */ + @Override + public List staffPatrolList(StaffListFormDTO formDTO) { + List resultList = new ArrayList<>(); + //1.查询网格信息供后续封装数据使用 + List list = govOrgService.getGridInfoList(formDTO.getGridIds(), formDTO.getUserId()); + if (CollectionUtils.isEmpty(formDTO.getGridIds())) { + formDTO.setGridIds(list.stream().map(CustomerGridDTO::getId).collect(Collectors.toList())); + } + + //2.按条件分页查询业务数据 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + //起始查询日期 + formDTO.setPatrolStartTime(DateUtils.getBeforeMonthDate(formDTO.getTime(), "yyyyMMdd")); + resultList = staffPatrolRecordDao.selectStaffPatrolList(formDTO); + + //3.封装数据并返回 + resultList.forEach(re -> list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName()))); + //NumberFormat numberFormat = NumberFormat.getInstance(); + //numberFormat.setMaximumFractionDigits(NumConstant.ZERO); + resultList.forEach(re -> { + String totalTime = "0分钟"; + if (re.getTimeNum() > NumConstant.ZERO) { + int num = re.getTimeNum() / 60; + int hour = num / 60; + int minute = num % 60; + totalTime = (hour < 1 ? "" : hour + "小时") + (minute < 1 ? "" : minute + "分钟"); + } + re.setTotalTime(totalTime == "" ? "0分钟" : totalTime); + //re.setTotalTime(re.getTimeNum() < 1 ? BigDecimal.ZERO + "h" : new BigDecimal(numberFormat.format((float) re.getTimeNum() / (float) 3600)) + "h"); + //re.setTotalTime(re.getTimeNum() / 60 + "分钟"); + list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName())); + }); + + return resultList; + } + + /** + * @Description 个人中心-网格员巡查记录 + * @author sun + */ + @Override + public List personalPatrolList(String staffId) { + LinkedList resultList = new LinkedList<>(); + //1.汇总查询当前工作人员所有巡查记录数据 + StaffListResultDTO resultDTO = staffPatrolRecordDao.selectPersonalPatrolList(staffId); + if (null == resultDTO) { + return resultList; + } + //2.封装数据并返回 + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.ZERO); + PersonalPatrolListResultDTO personal1 = new PersonalPatrolListResultDTO(); + personal1.setKey("总次数"); + personal1.setValue(resultDTO.getPatrolTotal().toString()); + resultList.add(personal1); + PersonalPatrolListResultDTO personal2 = new PersonalPatrolListResultDTO(); + personal2.setKey("总时长"); + //personal2.setValue(resultDTO.getTimeNum() / 60 + "分钟"); + String totalTime = "0分钟"; + if (resultDTO.getTimeNum() > NumConstant.ZERO) { + int num = resultDTO.getTimeNum() / 60; + int hour = num / 60; + int minute = num % 60; + totalTime = (hour < 1 ? "" : hour + "小时") + (minute < 1 ? "" : minute + "分钟"); + } + personal2.setValue(totalTime == "" ? "0分钟" : totalTime); + resultList.add(personal2); + PersonalPatrolListResultDTO personal3 = new PersonalPatrolListResultDTO(); + personal3.setKey("事件数"); + personal3.setValue(resultDTO.getReportProjectCount().toString()); + resultList.add(personal3); + + return resultList; + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java index 8008242d5f..bd28ef2b26 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java @@ -59,4 +59,10 @@ public interface GovOrgService { * @author sun */ List selectGridStaffByGridIds(List gridIds, String staffName); + + /** + * @Description 查询网格信息或查询当前人员所属组织下所有网格信息 + * @author sun + */ + List getGridInfoList(List gridIds, String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index 29ed9208cf..38b29c2c12 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -264,4 +264,15 @@ public class GovOrgServiceImpl implements GovOrgService { return result; } + /** + * @Description 查询网格信息或查询当前人员所属组织下所有网格信息 + * @author sun + */ + @Override + public List getGridInfoList(List gridIds, String staffId) { + //1.有网格列表的查询网格基本信息,没有的查询工作人员所属组织级下级所有的网格信息 + List list = customerGridDao.getGridInfoList(gridIds, staffId); + return list; + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java new file mode 100644 index 0000000000..d2fc60ad35 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java @@ -0,0 +1,51 @@ +package com.epmet.dataaggre.service.impl; + +import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; +import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.service.AggreGridService; +import com.epmet.dataaggre.service.datastats.DataStatsService; +import com.epmet.dataaggre.service.govorg.GovOrgService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class AggreGridServiceImpl implements AggreGridService { + + @Autowired + private GovOrgService govOrgService; + + @Autowired + private DataStatsService dataStatsService; + + @Override + public List getGridMemberDataAnalysis( + List gridIds, + String searchedStaffName, + String currStaffId, + String month, + String sort, + Integer pageNo, + Integer pageSize) { + + //1.得到网格id列表 + Map gridIdAndName = new HashMap<>(); + List grids = govOrgService.getGridInfoList(gridIds, currStaffId); + grids.forEach(g -> { + gridIds.add(g.getId()); + gridIdAndName.put(g.getId(), g.getGridName()); + }); + + //2.查询列表,并且填充内容 + List records = dataStatsService.listGridMemberDataStats(gridIds, searchedStaffName, month, sort, pageNo, pageSize); + records.forEach(r -> r.setOrgName(gridIdAndName.get(r.getGridId()))); + return records; + } + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml new file mode 100644 index 0000000000..6795b4cd23 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/FactGridMemberStatisticsDailyDao.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + member.id, + member.date_id, + member.month_id, + member.year_id, + member.customer_id, + member.agency_id, + member.grid_id, + member.pid, + member.pids, + member.staff_id, + member.staff_name, + member.project_count, + member.issue_to_project_count, + member.closed_issue_count, + member.project_response_count, + member.project_transfer_count, + member.project_closed_count, + member.project_incr, + member.issue_to_project_incr, + member.closed_issue_incr, + member.project_response_incr, + member.project_transfer_incr, + member.project_closed_incr, + member.del_flag, + member.revision, + member.created_by, + member.created_time, + member.updated_by, + member.updated_time + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml index 662ce08625..08a1699368 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml @@ -51,4 +51,62 @@ --> + + + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml index 92cffd9271..2ca96e0edd 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml @@ -99,4 +99,52 @@ ) + + diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/BizDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/BizDataFormDTO.java new file mode 100644 index 0000000000..23f164afe3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/BizDataFormDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.extract.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * desc: 从业务数据抽取到统计库 dto + * + * @Author zxc + * @DateTime 2020/9/16 6:01 下午 + */ +@Data +public class BizDataFormDTO implements Serializable { + + + private static final long serialVersionUID = 2860395703825549825L; + + public interface ExtractForm extends CustomerClientShowGroup { + } + + @NotBlank(message = "客户ID不能为空", groups = ExtractForm.class) + private String customerId; + + @NotBlank(message = "dateId不能为空", groups = ExtractForm.class) + private String dateId; + + private String userId; + private String gridId; + + /** + * 开始时间 + */ + private String startDate; + /** + * 结束时间 + */ + private String endDate; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/StaffPatrolStatsFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/StaffPatrolStatsFormDTO.java new file mode 100644 index 0000000000..a3386e6e37 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/StaffPatrolStatsFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.extract.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc: 工作人员巡查统计参数 + * + * @author LiuJanJun + * @date 2021/6/29 10:19 上午 + */ +@Data +public class StaffPatrolStatsFormDTO implements Serializable { + + private static final long serialVersionUID = -3639860733213306581L; + private String customerId; + private String dateId; + private String staffId; + private String gridId; + /** + * 角色key + */ + private String roleKey; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java index f57927f65d..16a972293e 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgStatisticsResultDTO.java @@ -15,6 +15,7 @@ public class OrgStatisticsResultDTO implements Serializable { private static final long serialVersionUID = 9221060553279124719L; private String customerId; private String agencyId; + private String staffId; private String level; private String orgId; private Integer count; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java new file mode 100644 index 0000000000..b792e6ea15 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java @@ -0,0 +1,62 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.org; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 网格人员关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Data +public class CustomerStaffGridDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + /** + * 组织ID + */ + private String agencyId; + /** + * 网格ID + */ + private String gridId; + /** + * 上级组织ID + */ + private String pid; + /** + * 所有上级组织ID + */ + private String pids; + /** + * 用户id, user.id + */ + private String staffId; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java new file mode 100644 index 0000000000..071d00753c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsDailyDTO.java @@ -0,0 +1,181 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Data +public class FactGridMemberStatisticsDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * yyyyMMdd + */ + private String dateId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格I + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + + /** + * 项目立项数日增量 + */ + private Integer projectCountIncr; + + /** + * 议题转项目数日增量 + */ + private Integer issueToProjectIncr; + + /** + * 议题关闭数日增量 + */ + private Integer closedIssueIncr; + + /** + * 项目响应数日增量 + */ + private Integer projectResponseIncr; + + /** + * 项目吹哨数日增量 + */ + private Integer projectTransferIncr; + + /** + * 项目结案数日增量 + */ + private Integer projectClosedIncr; + + /** + * 删除状态,0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsMonthlyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsMonthlyDTO.java new file mode 100644 index 0000000000..c5d1e237a7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridMemberStatisticsMonthlyDTO.java @@ -0,0 +1,146 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Data +public class FactGridMemberStatisticsMonthlyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + + /** + * 删除状态,0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerGridStaffDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerGridStaffDTO.java new file mode 100644 index 0000000000..defbb16696 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerGridStaffDTO.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 政府工作人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-18 + */ +@Data +public class CustomerGridStaffDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格id + */ + private String gridId; + + /** + * 网格所属组织id + */ + private String agencyId; + + /** + * 网格所属的所有组织id + */ + private String gridPids; + + /** + * 关联User表的主键Id + */ + private String userId; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerStaffDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerStaffDTO.java new file mode 100644 index 0000000000..a5458793dd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/CustomerStaffDTO.java @@ -0,0 +1,137 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 政府工作人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-18 + */ +@Data +public class CustomerStaffDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 关联User表的主键Id + */ + private String userId; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 性别0.未知,1男,2.女 + */ + private Integer gender; + + /** + * 邮箱 + */ + private String email; + + /** + * 手机号-唯一键 + */ + private String mobile; + + /** + * 地址 + */ + private String address; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * fulltime专职parttime兼职 + */ + private String workType; + + /** + * 头像 + */ + private String headPhoto; + + /** + * inactive未激活,active已激活 + */ + private String activeFlag; + + /** + * 激活时间 + */ + private Date activeTime; + + /** + * 未禁用enable,已禁用diabled + */ + private String enableFlag; + + /** + * 客户id + */ + private String customerId; + + /** + * 角色名称 + */ + private String roleName; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffPatrolRecordResult.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffPatrolRecordResult.java new file mode 100644 index 0000000000..7239e34792 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffPatrolRecordResult.java @@ -0,0 +1,122 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 工作人员巡查主记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-07 + */ +@Data +public class StaffPatrolRecordResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格id + */ + private String grid; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 巡查开始时间 + */ + private Date patrolStartTime; + + /** + * 巡查结束时间,前端传入 + */ + private Date patrolEndTime; + + /** + * 实际结束时间=操作结束巡查的时间 + */ + private Date actrualEndTime; + + /** + * 本次巡查总耗时,单位秒;结束巡查时写入 + */ + private Integer totalTime; + + /** + * 正在巡查中:patrolling;结束:end + */ + private String status; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffRoleInfoDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffRoleInfoDTO.java new file mode 100644 index 0000000000..ba18432357 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StaffRoleInfoDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/7/5 9:49 + */ +@Data +public class StaffRoleInfoDTO implements Serializable { + private static final long serialVersionUID = 5005209786187370928L; + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 用户ID + */ + private String staffId; + + /** + * 用户名 + */ + private String staffName; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java new file mode 100644 index 0000000000..ad8c156e77 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/user/result/StatsStaffPatrolRecordDailyDTO.java @@ -0,0 +1,147 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.user.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-29 + */ +@Data +public class StatsStaffPatrolRecordDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 巡查次数 + */ + private Integer patrolTotal; + + /** + * 巡查时长 单位:秒 + */ + private Integer totalTime; + + /** + * 巡查期间直接立项项目数 + */ + private Integer reportProjectCount; + + /** + * 最新的巡查开始时间 + */ + private Date latestPatrolTime; + + /** + * 最新的巡查状态 正在巡查中:patrolling;结束:end + */ + private String latestPatrolStatus; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index dfafe94a1e..ee5daf2a47 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -3,9 +3,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; -import com.epmet.dto.extract.form.ExtractIndexFormDTO; -import com.epmet.dto.extract.form.ExtractOriginFormDTO; -import com.epmet.dto.extract.form.ExtractScreenFormDTO; +import com.epmet.dto.extract.form.*; import com.epmet.dto.group.form.GroupStatsFormDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; @@ -256,4 +254,14 @@ public interface DataStatisticalOpenFeignClient { @PostMapping("/data/stats/vanguard/gridvanguardstats") Result gridVanguardStats(@RequestBody StatsFormDTO formDTO); + /** + * desc: 业务库按天统计 统一入库 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author LiuJanJun + * @date 2021/7/2 3:04 下午 + */ + @PostMapping("/data/stats/bizData/stats/daily") + Result exeStatsDaily(@RequestBody BizDataFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index d842746b35..4846a3e557 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -4,9 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; -import com.epmet.dto.extract.form.ExtractIndexFormDTO; -import com.epmet.dto.extract.form.ExtractOriginFormDTO; -import com.epmet.dto.extract.form.ExtractScreenFormDTO; +import com.epmet.dto.extract.form.*; import com.epmet.dto.group.form.GroupStatsFormDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; @@ -256,4 +254,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result gridVanguardStats(StatsFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "gridVanguardStats", formDTO); } + + @Override + public Result exeStatsDaily(BizDataFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "exeStatsDaily", formDTO); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml index 670c9b1d5c..6e0f1082aa 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml @@ -9,10 +9,10 @@ services: volumes: - "/opt/epmet-cloud-logs/prod:/logs" environment: - RUN_INSTRUCT: "java -Xms256m -Xmx1024m -jar ./data-stats.jar" + RUN_INSTRUCT: "java -Xms256m -Xmx1524m -jar ./data-stats.jar" restart: "unless-stopped" deploy: resources: limits: cpus: '0.1' - memory: 1100M + memory: 1600M diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BizDataStatsController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BizDataStatsController.java new file mode 100644 index 0000000000..7fe1add999 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BizDataStatsController.java @@ -0,0 +1,46 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.BizDataFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.service.evaluationindex.extract.biz.BizDataStatsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Description 用户统计 + * @ClassName StatsUserController + * @Auth wangc + * @Date 2020-06-23 15:18 + */ +@RestController +@RequestMapping("bizData/stats") +public class BizDataStatsController { + + @Autowired + private BizDataStatsService bizDataStatsService; + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @description 业务库统计数据 统一入库 + * @Date 2021/3/26 13:27 + **/ + @RequestMapping("daily") + public Result execute(@RequestBody BizDataFormDTO formDTO) { + bizDataStatsService.exeDailyAll(formDTO); + return new Result(); + } /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @description 工作端数据一期,用户分析:参与用户、注册用户分析 + * @Date 2021/3/26 13:27 + **/ + @RequestMapping("patrol") + public Result execute(@RequestBody StaffPatrolStatsFormDTO formDTO) { + bizDataStatsService.executeStaffPatrolStats(formDTO); + return new Result(); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index a5317f5ba2..202dac9013 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -121,6 +121,8 @@ public class DemoController { private FactGridGovernDailyService factGridGovernDailyService; @Autowired private FactAgencyGovernDailyService factAgencyGovernDailyService; + @Autowired + private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService; @GetMapping("testAlarm") public void testAlarm() { @@ -936,4 +938,10 @@ public class DemoController { return new Result(); } + @PostMapping("extractFactGridMemberDaily") + public Result extractFactGridMemberDaily(@RequestBody ExtractFactGridGovernDailyFromDTO fromDTO){ + factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(fromDTO.getCustomerId(), fromDTO.getDateId()); + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java index 2cce1d4a19..49d462eaa0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.service.evaluationindex.extract.todata.*; +import com.epmet.service.stats.DimCustomerService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -35,6 +36,8 @@ public class FactOriginExtractController { private ProjectExtractService projectExtractService; @Autowired private GroupExtractService groupExtractService; + @Autowired + private DimCustomerService dimCustomerService; /** * desc:抽取业务数据到统计库 @@ -92,7 +95,12 @@ public class FactOriginExtractController { @PostMapping("project") public Result projectData(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { - projectExtractService.saveOriginProjectDaily(extractOriginFormDTO); + List customerIds = dimCustomerService.selectCustomerIdPage(1, 100); + customerIds.forEach(customerId -> { + ExtractOriginFormDTO dto = new ExtractOriginFormDTO(); + dto.setCustomerId(customerId); + projectExtractService.saveOriginProjectDaily(dto); + }); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsDailyDao.java new file mode 100644 index 0000000000..111f4d923a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsDailyDao.java @@ -0,0 +1,34 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.evaluationindex.extract; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Mapper +public interface FactGridMemberStatisticsDailyDao extends BaseDao { + int deleteDataByCustomer(@Param("customerId") String customerId, @Param("dateId") String dateId, @Param("deleteSize") Integer deleteSize); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.java new file mode 100644 index 0000000000..9d15a1cab5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.evaluationindex.extract; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsMonthlyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Mapper +public interface FactGridMemberStatisticsMonthlyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java index 7154f5997e..5e9177adf7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java @@ -20,6 +20,7 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.form.IssueLogDailyFormDTO; import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.PartyActiveResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -130,4 +131,43 @@ public interface FactOriginIssueLogDailyDao extends BaseDao + */ + List getIssueToProjectCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 议题转项目增量 + * @author zhaoqifeng + * @date 2021/7/5 15:55 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getIssueToProjectIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 关闭议题数总量 + * @author zhaoqifeng + * @date 2021/7/5 16:37 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getClosedIssueCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 关闭议题数增量 + * @author zhaoqifeng + * @date 2021/7/5 16:38 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getClosedIssueIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java index 3bdbc200bd..45f3ba2350 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java @@ -326,4 +326,59 @@ public interface FactOriginProjectLogDailyDao extends BaseDao + */ + List getProjectResponseCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目响应增量 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectResponseIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目吹哨数 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectTransferCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目吹哨数增量 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectTransferIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目结案数 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectClosedCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 项目结案数增量 + * @author zhaoqifeng + * @date 2021/7/5 17:01 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getProjectClosedIncr(@Param("customerId") String customerId, @Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index 1c4aa60c18..32178e4da7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -506,4 +506,24 @@ public interface FactOriginProjectMainDailyDao extends BaseDao + */ + List getMemberProjectCountIncr(@Param("customerId")String customerId, @Param("dateId") String dateId); + + /** + * 获取项目立项数 + * @author zhaoqifeng + * @date 2021/7/5 14:49 + * @param customerId + * @param dateId + * @return java.util.List + */ + List getMemberProjectCount(@Param("customerId")String customerId, @Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java index b8d9093631..93b72c077a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -77,4 +78,13 @@ public interface CustomerGridDao extends BaseDao { * @Date 2020/9/16 14:03 **/ List selectListGridInfo(String customerId); + + /** + * 查询工作人员网格关系 + * @author zhaoqifeng + * @date 2021/7/5 10:25 + * @param customerId + * @return java.util.List + */ + List getCustomerStaffGridList(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerStaffGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerStaffGridDao.java new file mode 100644 index 0000000000..20e3c6310a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerStaffGridDao.java @@ -0,0 +1,38 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.org; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.CustomerGridStaffDTO; +import com.epmet.entity.org.CustomerStaffGridEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 客户网格人员关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Mapper +public interface CustomerStaffGridDao extends BaseDao { + + List selectGridStaffList(StaffPatrolStatsFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java index 44e47f6f92..c4047cb0b3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java @@ -18,16 +18,12 @@ package com.epmet.dao.project; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.ProjectDTO; -import com.epmet.dto.ProjectSatisfactionStatisticsDTO; import com.epmet.dto.project.ProjectAgencyDTO; import com.epmet.dto.project.ProjectCategoryDTO; import com.epmet.dto.project.ProjectGridDTO; import com.epmet.dto.project.ProjectPointDTO; import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; -import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; -import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; import com.epmet.entity.project.ProjectEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -52,110 +48,119 @@ public interface ProjectDao extends BaseDao { /** * 已结案项目统计 - * @author zhaoqifeng - * @date 2020/6/18 17:01 + * * @param customerId * @param date * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 17:01 */ List selectAgencyClosedProjectTotal(@Param("customerId") String customerId, @Param("date") String date); /** * 已结案项目增量 - * @author zhaoqifeng - * @date 2020/6/18 17:01 + * * @param customerId * @param date * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 17:01 */ List selectAgencyClosedProjectInc(@Param("customerId") String customerId, @Param("date") String date); /** * 已结案项目统计 - * @author zhaoqifeng - * @date 2020/6/18 17:01 + * * @param customerId * @param date * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 17:01 */ List selectGridClosedProjectTotal(@Param("customerId") String customerId, @Param("date") String date); /** * 已结案项目增量 - * @author zhaoqifeng - * @date 2020/6/18 17:01 + * * @param customerId * @param date * @return java.util.List + * @author zhaoqifeng + * @date 2020/6/18 17:01 */ List selectGridClosedProjectInc(@Param("customerId") String customerId, @Param("date") String date); /** * 获取项目信息 - * @author zhaoqifeng - * @date 2020/9/15 16:13 + * * @param customerId * @param date * @return java.util.List + * @author zhaoqifeng + * @date 2020/9/15 16:13 */ List selectProjectInfo(@Param("customerId") String customerId, @Param("date") String date); /** * 获取用户可滞留天数 - * @author zhaoqifeng - * @date 2020/9/28 10:16 + * * @param customerId * @return java.lang.String + * @author zhaoqifeng + * @date 2020/9/28 10:16 */ String selectParameterValueByKey(@Param("customerId") String customerId); /** - * @Description 查找客户项目超期参数 - * * @param customerId * @return java.util.List + * @Description 查找客户项目超期参数 * @author wangc * @date 2021.03.05 17:52 - */ + */ List selectProjectExceedParams(@Param("customerId") String customerId); /** - * @Description 批量查询项目信息 * @param ids * @return java.util.List + * @Description 批量查询项目信息 * @author wangc * @date 2021.03.08 10:32 - */ - List batchSelectProjectInfo(@Param("ids")List ids); + */ + List batchSelectProjectInfo(@Param("ids") List ids); /** - * @Description 查询项目的分类信息 * @param list * @return java.util.List + * @Description 查询项目的分类信息 * @author wangc * @date 2021.03.08 23:44 - */ - List selectProjectCategory(@Param("list")List list); + */ + List selectProjectCategory(@Param("list") List list); List getProjectCategoryData(@Param("customerId") String customerId, @Param("dateId") String dateId); /** * 获取项目满意度 - * @author zhaoqifeng - * @date 2021/5/21 10:06 + * * @param customerId * @return java.util.List + * @author zhaoqifeng + * @date 2021/5/21 10:06 */ List selectProjectSatisfaction(@Param("customerId") String customerId); /** * 根据key查找value - * @author zhaoqifeng - * @date 2021/5/21 10:58 + * * @param customerId * @param parameterKey * @return java.lang.String + * @author zhaoqifeng + * @date 2021/5/21 10:58 */ String selectValueByKey(@Param("customerId") String customerId, @Param("parameterKey") String parameterKey); + + List selectProjectListByDateId(@Param("customerId") String customerId, @Param("dateId") String dateId, @Param("projectOrigin") String projectOrigin); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java new file mode 100644 index 0000000000..1a25f9cfdf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/StatsStaffPatrolRecordDailyDao.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.user; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.entity.user.StatsStaffPatrolRecordDailyEntity; +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-29 + */ +@Mapper +public interface StatsStaffPatrolRecordDailyDao extends BaseDao { + + Integer insertBatch(@Param("list") List insertList); + + int delete(StaffPatrolStatsFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java index dabacfd7da..9ad54a48e6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java @@ -1,9 +1,14 @@ package com.epmet.dao.user; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; +import com.epmet.dto.user.result.StaffRoleInfoDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StaffPatrolRecordResult; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -159,5 +164,21 @@ public interface UserDao { * @date 2021/6/8 5:21 下午 */ List selectStaffInfo(@Param("list") List staffUserIdList); + + List getStaffByRoleKey(@Param("customerId") String customerId, @Param("roleKey") String roleKey); + + /** + * desc: 根据角色key条件获取所有的人 + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/6/29 2:58 下午 + */ + List selectUserByRoleKey(StaffPatrolStatsFormDTO formDTO); + + List selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO); + + List selectStaffPatrolListByDateId(@Param("customerId") String customerId, @Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java new file mode 100644 index 0000000000..76ff908449 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsDailyEntity.java @@ -0,0 +1,151 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.extract; + +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-07-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_member_statistics_daily") +public class FactGridMemberStatisticsDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * yyyyMMdd + */ + private String dateId; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格I + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + + /** + * 项目立项数日增量 + */ + private Integer projectIncr; + + /** + * 议题转项目数日增量 + */ + private Integer issueToProjectIncr; + + /** + * 议题关闭数日增量 + */ + private Integer closedIssueIncr; + + /** + * 项目响应数日增量 + */ + private Integer projectResponseIncr; + + /** + * 项目吹哨数日增量 + */ + private Integer projectTransferIncr; + + /** + * 项目结案数日增量 + */ + private Integer projectClosedIncr; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsMonthlyEntity.java new file mode 100644 index 0000000000..86f5fa647c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGridMemberStatisticsMonthlyEntity.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.extract; + +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-07-02 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_member_statistics_monthly") +public class FactGridMemberStatisticsMonthlyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 月份ID + */ + private String monthId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 上级ID(项目来源Agency的上级组织Id) + */ + private String pid; + + /** + * 所有agencyId的上级组织ID(包含agencyId) + */ + private String pids; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 工作人员姓名 + */ + private String staffName; + + /** + * 项目立项数 + */ + private Integer projectCount; + + /** + * 议题转项目数 + */ + private Integer issueToProjectCount; + + /** + * 议题关闭数 + */ + private Integer closedIssueCount; + + /** + * 项目响应数 + */ + private Integer projectResponseCount; + + /** + * 项目吹哨数 + */ + private Integer projectTransferCount; + + /** + * 项目结案数 + */ + private Integer projectClosedCount; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java index be69a89f3d..aa3f6e3ca2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectMainDailyEntity.java @@ -148,4 +148,9 @@ public class FactOriginProjectMainDailyEntity extends BaseEpmetEntity { */ private String finishOrgIds; + /** + * 项目创建人(议题转项目或立项人) + */ + private String projectCreator; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerStaffGridEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerStaffGridEntity.java new file mode 100644 index 0000000000..bb94ef3ff2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerStaffGridEntity.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.org; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_staff_grid") +public class CustomerStaffGridEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + private String customerId; + private String gridId; + private String userId; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java new file mode 100644 index 0000000000..9425887126 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/StatsStaffPatrolRecordDailyEntity.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.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-29 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("stats_staff_patrol_record_daily") +public class StatsStaffPatrolRecordDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 巡查次数 + */ + private Integer patrolTotal; + + /** + * 巡查时长 单位:秒 + */ + private Integer totalTime; + + /** + * 巡查期间直接立项项目数 + */ + private Integer reportProjectCount; + + /** + * 最新的巡查开始时间 + */ + private Date latestPatrolTime; + + /** + * 最新的巡查状态 正在巡查中:patrolling;结束:end + */ + private String latestPatrolStatus; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java index ecc2d38a9b..a9f266edf4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/ProjectChangedCustomListener.java @@ -2,6 +2,7 @@ package com.epmet.mq; import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.SpringContextUtils; @@ -9,6 +10,8 @@ import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.service.evaluationindex.extract.todata.FactOriginExtractService; import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; import com.epmet.util.DimIdGenerator; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; @@ -38,13 +41,25 @@ import java.util.stream.Collectors; public class ProjectChangedCustomListener implements MessageListenerConcurrently { private Logger logger = LoggerFactory.getLogger(getClass()); + /** + * 控制通知类型消息的消费频率 + */ + private static final Cache customerIdCache = CacheBuilder.newBuilder().maximumSize(NumConstant.ONE_HUNDRED) + .expireAfterWrite(NumConstant.THIRTY,TimeUnit.SECONDS).build(); @Override public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { long start = System.currentTimeMillis(); try { List customerIds = msgs.stream().map(messageExt -> new String(messageExt.getBody())).distinct().collect(Collectors.toList()); - customerIds.forEach(this::consumeMessage); + for (String customerId : customerIds) { + //获取缓存 如果不存在缓存中 则执行消费 并放入缓存中 + String ifPresent = customerIdCache.getIfPresent(customerId); + if (StringUtils.isBlank(ifPresent)){ + consumeMessage(customerId); + customerIdCache.put(customerId,customerId); + } + } } catch (Exception e) { //失败不重发 logger.error("consumeMessage fail,msg:{}",e.getMessage()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/BizDataStatsService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/BizDataStatsService.java new file mode 100644 index 0000000000..062bd2c49c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/BizDataStatsService.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.biz; + +import com.epmet.dto.extract.form.BizDataFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-29 + */ +public interface BizDataStatsService { + + /** + * desc:抽取所有业务数据到统计库 + * + * @param dataFormDTO + */ + void exeDailyAll(BizDataFormDTO dataFormDTO); + + void executeStaffPatrolStats(StaffPatrolStatsFormDTO formDTO); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java new file mode 100644 index 0000000000..29cca916f7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/biz/impl/BizDataStatsServiceImpl.java @@ -0,0 +1,300 @@ +package com.epmet.service.evaluationindex.extract.biz.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.ProjectConstant; +import com.epmet.dto.ProjectDTO; +import com.epmet.dto.extract.form.BizDataFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.CustomerGridStaffDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StaffPatrolRecordResult; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.service.evaluationindex.extract.biz.BizDataStatsService; +import com.epmet.service.org.CustomerStaffService; +import com.epmet.service.project.ProjectService; +import com.epmet.service.stats.DimCustomerService; +import com.epmet.service.user.StatsStaffPatrolService; +import com.epmet.service.user.UserService; +import com.epmet.util.DimIdGenerator; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.concurrent.*; +import java.util.stream.Collectors; + +/** + * desc:【天】业务库里的统计 + * + * @author: LiuJanJun + * @date: 2021/6/29 3:08 下午 + * @version: 1.0 + */ +@Slf4j +@Service +public class BizDataStatsServiceImpl implements BizDataStatsService { + ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() + .setNameFormat("bizDataStats-pool-%d").build(); + ExecutorService threadPool = new ThreadPoolExecutor(3, 6, + 10L, TimeUnit.MINUTES, + new LinkedBlockingQueue<>(500), namedThreadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); + @Autowired + private CustomerStaffService customerStaffService; + @Autowired + private UserService userService; + @Autowired + private ProjectService projectService; + @Autowired + private StatsStaffPatrolService statsStaffPatrolService; + @Autowired + private DimCustomerService dimCustomerService; + + @Override + public void exeDailyAll(BizDataFormDTO dataFormDTO) { + String customerId = dataFormDTO.getCustomerId(); + + List customerIds = new ArrayList<>(); + if (StringUtils.isNotBlank(customerId)) { + //指定某个客户 + customerIds.add(customerId); + } else { + //查询全部客户 + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; + customerIds = dimCustomerService.selectCustomerIdPage(pageNo, pageSize); + if (org.springframework.util.CollectionUtils.isEmpty(customerIds)) { + log.error("exeDailyAll 获取客户Id为空"); + return; + } + } + customerIds.forEach(cId -> { + dataFormDTO.setCustomerId(cId); + log.info("exeDailyAll param:{}", JSON.toJSONString(dataFormDTO)); + submitJob(dataFormDTO); + }); + } + + @Override + public void executeStaffPatrolStats(StaffPatrolStatsFormDTO formDTO) { + //校正参数里的前一天日期的数据 + //获取所有网格员 + List allGridMembers = getAllGridMembers(formDTO); + if (CollectionUtils.isEmpty(allGridMembers)){ + log.warn("executeStaffPatrolStats have any gridMembers,param:{}",JSON.toJSONString(formDTO)); + return; + } + String yesterdayStr = getYesterdayString(formDTO); + StaffPatrolStatsFormDTO yesterdayParam = ConvertUtils.sourceToTarget(formDTO, StaffPatrolStatsFormDTO.class); + yesterdayParam.setDateId(yesterdayStr); + reloadStaffPatrolStatsData(yesterdayParam, allGridMembers); + + //初始化参数里日期的数据 如果当前时间在1分钟内 则初始化 + String todayDateDimId = DimIdGenerator.getDateDimId(new Date()); + if (todayDateDimId.equals(formDTO.getDateId())){ + //如果当前时间-1分钟还等于今天 则进行初始化操作 否则执行数据纠正 + String dateDimId = DimIdGenerator.getDateDimId(new Date(System.currentTimeMillis() - 1 * 60 * 1000)); + if (!dateDimId.equals(todayDateDimId)){ + initStaffPatrolTodayData(formDTO, allGridMembers); + }else{ + reloadStaffPatrolStatsData(formDTO, allGridMembers); + } + } + + } + + private void reloadStaffPatrolStatsData(StaffPatrolStatsFormDTO formDTO, List allGridMembers) { + log.info("reloadStaffPatrolStatsData param:{}",JSON.toJSONString(formDTO)); + //获取昨日的巡查统计记录 + + //遍历网格员重新初始化数据 + List insertList = buildInitPatrolStatsData(formDTO, allGridMembers); + + Map yesterdayStatsMap = insertList.stream().collect(Collectors.toMap(o -> o.getGridId() + o.getStaffId(), o -> o, (o1, o2) -> o1)); + //获取昨日的巡查记录 + List yesterdayPatrolList = userService.selectStaffPatrolListByDateId(formDTO.getCustomerId(), formDTO.getDateId()); + + //获取昨日的立项项目数 + List yesterdayProjectList = projectService.selectProjectListByDateId(formDTO.getCustomerId(), formDTO.getDateId(), ProjectConstant.PROJECT_ORIGIN_AGENCY); + + //遍历网格员 设置其 巡查次数 巡查时常 上报项目数 + yesterdayPatrolList.forEach(patrolRecord -> { + String key = patrolRecord.getGrid().concat(patrolRecord.getStaffId()); + StatsStaffPatrolRecordDailyDTO patrolRecordDailyDTO = yesterdayStatsMap.get(key); + if (patrolRecordDailyDTO != null) { + long total = (patrolRecord.getPatrolEndTime().getTime() - patrolRecord.getPatrolStartTime().getTime()) / 1000; + if (patrolRecordDailyDTO.getTotalTime() == null) { + patrolRecordDailyDTO.setTotalTime(NumConstant.ZERO); + } + patrolRecordDailyDTO.setTotalTime(patrolRecordDailyDTO.getTotalTime() + (int) total); + if (patrolRecordDailyDTO.getPatrolTotal() == null) { + patrolRecordDailyDTO.setPatrolTotal(NumConstant.ZERO); + } + patrolRecordDailyDTO.setPatrolTotal(patrolRecordDailyDTO.getPatrolTotal() + NumConstant.ONE); + //如果巡查记录时间小于统计里的最新的时间 则更新 + if (patrolRecordDailyDTO.getLatestPatrolTime() == null || patrolRecordDailyDTO.getLatestPatrolTime().getTime() < patrolRecord.getPatrolStartTime().getTime()) { + patrolRecordDailyDTO.setLatestPatrolTime(patrolRecord.getPatrolStartTime()); + patrolRecordDailyDTO.setLatestPatrolStatus(patrolRecord.getStatus()); + } + } + }); + //填充项目数 + yesterdayProjectList.forEach(projectDTO -> { + + yesterdayPatrolList.forEach(patrol -> { + //项目立项时间 在巡查期间时 总数加1 + long projectCreateTime = projectDTO.getCreatedTime().getTime(); + //创建人为网格员 且时间在巡查期间的 则上报的项目数加1 + if (projectDTO.getCreatedBy().equals(patrol.getStaffId()) && projectCreateTime >= patrol.getPatrolStartTime().getTime() && projectCreateTime <= patrol.getPatrolEndTime().getTime()) { + String unqPatrolKey = getUnqPatrolKey(patrol.getGrid(), patrol.getStaffId()); + StatsStaffPatrolRecordDailyDTO recordDailyDTO = yesterdayStatsMap.get(unqPatrolKey); + if (recordDailyDTO == null) { + log.error("have project data but have any patrolRecordDaily,gridId:{},staffId:{}", patrol.getGrid(), patrol.getStaffId()); + return; + } + + recordDailyDTO.setReportProjectCount(recordDailyDTO.getReportProjectCount() + 1); + } + }); + }); + + Integer effectRow = statsStaffPatrolService.delAndInsertBatch(formDTO, insertList); + log.debug("initStaffPatrolStats insert rows:{}", effectRow); + } + + /** + * desc: 获取key + * + * @param gridId + * @param staffId + * @return java.lang.String + * @author LiuJanJun + * @date 2021/7/2 8:32 上午 + */ + private String getUnqPatrolKey(String gridId, String staffId) { + return gridId.concat(staffId); + } + + + @Nullable + private String getYesterdayString(StaffPatrolStatsFormDTO formDTO) { + Date dateParam = DateUtils.parse(formDTO.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD); + Date yesterdayDate = DateUtils.addDateDays(dateParam, -1); + return DateUtils.format(yesterdayDate, DateUtils.DATE_PATTERN_YYYYMMDD); + } + + private void initStaffPatrolTodayData(StaffPatrolStatsFormDTO formDTO, List allGridMembers) { + log.info("initStaffPatrolTodayData param:{}",JSON.toJSONString(formDTO)); + List insertList = buildInitPatrolStatsData(formDTO, allGridMembers); + Integer effectRow = statsStaffPatrolService.delAndInsertBatch(formDTO, insertList); + log.debug("initStaffPatrolStats insert rows:{}", effectRow); + } + + @NotNull + private List buildInitPatrolStatsData(StaffPatrolStatsFormDTO formDTO, List allGridMembers) { + List lastStaffPatrolList = userService.selectLastStaffPatrolList(formDTO); + Map lastPatrolMap = lastStaffPatrolList.stream().collect(Collectors.toMap(o -> o.getGridId() + o.getStaffId(), o -> o, (o1, o2) -> o1)); + //构建数据 插入 + List insertList = new ArrayList<>(); + Date date = DateUtils.parse(formDTO.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD); + DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(date); + allGridMembers.forEach(gridMember -> { + StatsStaffPatrolRecordDailyDTO record = new StatsStaffPatrolRecordDailyDTO(); + record.setCustomerId(gridMember.getCustomerId()); + record.setGridId(gridMember.getGridId()); + record.setAgencyId(gridMember.getAgencyId()); + record.setGridPids(gridMember.getGridPids()); + record.setStaffId(gridMember.getUserId()); + record.setDateId(dimIdBean.getDateId()); + record.setWeekId(dimIdBean.getWeekId()); + record.setQuarterId(dimIdBean.getQuarterId()); + record.setYearId(dimIdBean.getYearId()); + record.setMonthId(dimIdBean.getMonthId()); + StatsStaffPatrolRecordDailyDTO recordDailyDTO = lastPatrolMap.get(gridMember.getGridId().concat(gridMember.getUserId())); + + record.setTotalTime(NumConstant.ZERO); + record.setPatrolTotal(NumConstant.ZERO); + record.setLatestPatrolStatus("end"); + record.setReportProjectCount(NumConstant.ZERO); + //最后巡查时间 + record.setLatestPatrolTime(null); + if (recordDailyDTO != null) { + record.setLatestPatrolStatus(recordDailyDTO.getLatestPatrolStatus()); + record.setLatestPatrolTime(recordDailyDTO.getLatestPatrolTime()); + } + + insertList.add(record); + + }); + return insertList; + } + + private List getAllGridMembers(StaffPatrolStatsFormDTO formDTO) { + //获取所有的网格员 + //1.获取所有网格用户 + List allStaffList = customerStaffService.selectStaffGridList(formDTO); + if (CollectionUtils.isEmpty(allStaffList)) { + log.warn("reloadStaffPatrolStats customerId:{} have any staff,param:{}", formDTO.getCustomerId(), JSON.toJSONString(formDTO)); + return allStaffList; + } + //获取所有含有网格员角色的用户 + List gridMemberList = userService.selectUserListByRoleKey(formDTO); + if (CollectionUtils.isEmpty(gridMemberList)) { + log.warn("reloadStaffPatrolStats customerId:{} have any gridMembers,param:{}", formDTO.getCustomerId(), JSON.toJSONString(formDTO)); + return allStaffList; + } + List insertList = new ArrayList<>(); + + allStaffList.forEach(gridStaff -> gridMemberList.forEach(gridMember -> { + if (gridStaff.getUserId().equals(gridMember.getUserId())) { + insertList.add(gridStaff); + } + })); + log.debug("getAllGridMembers result:{},param:{}", JSON.toJSONString(insertList), JSON.toJSONString(formDTO)); + return insertList; + } + + private void submitJob(BizDataFormDTO param) { + if (StringUtils.isBlank(param.getDateId()) && (StringUtils.isBlank(param.getStartDate()) && StringUtils.isBlank(param.getEndDate()))) { + //如果没有设置开始日期、结束日期,默认查询今天 + param.setDateId(DimIdGenerator.getDateDimId(new Date())); + } + StaffPatrolStatsFormDTO formDTO = ConvertUtils.sourceToTarget(param, StaffPatrolStatsFormDTO.class); + boolean isRange = StringUtils.isBlank(formDTO.getDateId()); + List daysBetween = null; + if (isRange) { + daysBetween = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate()); + } + List finalDaysBetween = daysBetween; + threadPool.submit(() -> { + if (!isRange) { + try { + //初始化form里的今天的数据 并纠正昨日的数据 + this.executeStaffPatrolStats(formDTO); + } catch (Exception e) { + log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(formDTO), e); + } + } else { + try { + for (String dateDimId : finalDaysBetween) { + formDTO.setDateId(dateDimId); + this.executeStaffPatrolStats(formDTO); + } + } catch (Exception e) { + log.error("【网格员巡查数据统计】发生异常,参数:" + JSON.toJSONString(param), e); + } + } + }); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsDailyService.java new file mode 100644 index 0000000000..da2f35ce6f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsDailyService.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +public interface FactGridMemberStatisticsDailyService extends BaseService { + /** + * 网格员数据统计 + * + * @param customerId + * @param dateId + * @return void + * @author zhaoqifeng + * @date 2021/7/5 9:29 + */ + void extractGridMemberStatisticsDaily(String customerId, String dateId); + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsMonthlyService.java new file mode 100644 index 0000000000..a8e08fc1f9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGridMemberStatisticsMonthlyService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsMonthlyEntity; + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +public interface FactGridMemberStatisticsMonthlyService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java index 5bb46392f6..755b53adb1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java @@ -19,9 +19,11 @@ package com.epmet.service.evaluationindex.extract.todata; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import java.util.List; +import java.util.Map; /** * 议题记录附表 @@ -77,4 +79,26 @@ public interface FactOriginIssueLogDailyService extends BaseService> + */ + Map> getIssueToProjectCount(String customerId, String dateId, Integer type); + + /** + * 工作人员关闭议题数 + * @author zhaoqifeng + * @date 2021/7/5 16:40 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getClosedIssueCount(String customerId, String dateId, Integer type); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java index b925cc31e4..2d95509fca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java @@ -330,4 +330,37 @@ public interface FactOriginProjectLogDailyService extends BaseService */ Map getAgencyGridSelfDaily(String customerId, String dateId); + + /** + * 项目响应数 + * @author zhaoqifeng + * @date 2021/7/5 16:56 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getProjectResponseCount(String customerId, String dateId, Integer type); + + /** + * 项目吹哨数 + * @author zhaoqifeng + * @date 2021/7/5 16:57 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getProjectTransferCount(String customerId, String dateId, Integer type); + + /** + * 项目结案数 + * @author zhaoqifeng + * @date 2021/7/5 16:57 + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + */ + Map> getProjectClosedCount(String customerId, String dateId, Integer type); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index 0f55775b23..ac0389164d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -475,4 +475,16 @@ public interface FactOriginProjectMainDailyService extends BaseService> + */ + Map> getMemberProjectCount(String customerId, String dateId, Integer type); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java new file mode 100644 index 0000000000..e7f436de06 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsDailyServiceImpl.java @@ -0,0 +1,407 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.IndexCalConstant; +import com.epmet.constant.RoleKeyConstants; +import com.epmet.dao.evaluationindex.extract.FactGridMemberStatisticsDailyDao; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; +import com.epmet.dto.user.result.StaffRoleInfoDTO; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity; +import com.epmet.service.evaluationindex.extract.todata.FactGridMemberStatisticsDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; +import com.epmet.service.org.CustomerGridService; +import com.epmet.service.user.UserService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * 网格员数据统计_日统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Service +@Slf4j +public class FactGridMemberStatisticsDailyServiceImpl extends BaseServiceImpl implements FactGridMemberStatisticsDailyService { + + @Resource + private UserService userService; + @Resource + private CustomerGridService customerGridService; + @Resource + private FactOriginProjectMainDailyService factOriginProjectMainDailyService; + @Resource + private FactOriginIssueLogDailyService factOriginIssueLogDailyService; + @Resource + private FactOriginProjectLogDailyService factOriginProjectLogDailyService; + + + /** + * 网格员数据统计 + * + * @param customerId + * @param dateId + * @return void + * @author zhaoqifeng + * @date 2021/7/5 9:29 + */ + @Override + public void extractGridMemberStatisticsDaily(String customerId, String dateId) { + log.info("客户" + customerId + ",时间" + dateId + ",网格员数据统计开始"); + List staffGridList = customerGridService.getCustomerStaffGridList(customerId); + List staffInfoList = userService.getStaffByRoleKey(customerId, RoleKeyConstants.ROLE_KEY_GRID_MEMBER); + if (CollectionUtils.isEmpty(staffGridList) || CollectionUtils.isEmpty(staffInfoList)) { + return; + } + Map staffMap = staffInfoList.stream().collect(Collectors.toMap(StaffRoleInfoDTO :: getStaffId, + Function.identity())); + List list = staffGridList.stream().filter(p -> null != staffMap.get(p.getStaffId())).map(item -> { + StaffRoleInfoDTO staffInfo = staffMap.get(item.getStaffId()); + return initEntity(customerId, dateId, item, staffInfo); + }).collect(Collectors.toList()); + + //数据统计 + GetGridMemberData getGridMemberData = new GetGridMemberData(customerId, dateId).invoke(); + Map> projectCountMap = getGridMemberData.getProjectCountMap(); + Map> projectIncrMap = getGridMemberData.getProjectIncrMap(); + Map> issueToProjectCountMap = getGridMemberData.getIssueToProjectCountMap(); + Map> issueToProjectIncrMap = getGridMemberData.getIssueToProjectIncrMap(); + Map> closedIssueCountMap = getGridMemberData.getClosedIssueCountMap(); + Map> closedIssueIncrMap = getGridMemberData.getClosedIssueIncrMap(); + Map> projectResponseCountMap = getGridMemberData.getProjectResponseCountMap(); + Map> projectResponseIncrMap = getGridMemberData.getProjectResponseIncrMap(); + Map> projectTransferCountMap = getGridMemberData.getProjectTransferCountMap(); + Map> projectTransferIncrMap = getGridMemberData.getProjectTransferIncrMap(); + Map> projectClosedCountMap = getGridMemberData.getProjectClosedCountMap(); + Map> projectClosedIncrMap = getGridMemberData.getProjectClosedIncrMap(); + + list.forEach(item -> { + //赋值 + setEntityData(projectCountMap, projectIncrMap, issueToProjectCountMap, issueToProjectIncrMap, closedIssueCountMap, closedIssueIncrMap, + projectResponseCountMap, projectResponseIncrMap, projectTransferCountMap, projectTransferIncrMap, projectClosedCountMap, + projectClosedIncrMap, item); + + }); + + if (CollectionUtils.isNotEmpty(list)) { + int deleteNum; + do { + deleteNum = baseDao.deleteDataByCustomer(customerId, dateId, IndexCalConstant.DELETE_SIZE); + } while (deleteNum != NumConstant.ZERO); + //删除旧数据 + insertBatch(list); + } + log.info("客户" + customerId + ",时间" + dateId + ",网格员数据统计结束"); + } + + /** + * 数据赋值 + * @author zhaoqifeng + * @date 2021/7/7 10:57 + * @param projectCountMap + * @param projectIncrMap + * @param issueToProjectCountMap + * @param issueToProjectIncrMap + * @param closedIssueCountMap + * @param closedIssueIncrMap + * @param projectResponseCountMap + * @param projectResponseIncrMap + * @param projectTransferCountMap + * @param projectTransferIncrMap + * @param projectClosedCountMap + * @param projectClosedIncrMap + * @param item + * @return void + */ + private void setEntityData(Map> projectCountMap, Map> projectIncrMap, + Map> issueToProjectCountMap, Map> issueToProjectIncrMap, + Map> closedIssueCountMap, Map> closedIssueIncrMap, + Map> projectResponseCountMap, Map> projectResponseIncrMap, + Map> projectTransferCountMap, Map> projectTransferIncrMap, + Map> projectClosedCountMap, Map> projectClosedIncrMap, + FactGridMemberStatisticsDailyEntity item) { + //项目立项数 + List projectCount = projectCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectCount)) { + projectCount.forEach(dto -> { + if (item.getAgencyId().equals(dto.getAgencyId())) { + item.setProjectCount(dto.getCount()); + } + }); + } + //项目立项日增量 + List projectIncr = projectIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectIncr)) { + projectIncr.forEach(dto -> { + if (item.getAgencyId().equals(dto.getAgencyId())) { + item.setProjectIncr(dto.getCount()); + } + }); + } + //议题转项目数 + List issueToProjectCount = issueToProjectCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(issueToProjectCount)) { + issueToProjectCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setIssueToProjectCount(dto.getCount()); + } + }); + } + //议题转项目日增量 + List issueToProjectIncr = issueToProjectIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(issueToProjectIncr)) { + issueToProjectIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setIssueToProjectIncr(dto.getCount()); + } + }); + } + //议题关闭数 + List closedIssueCount = closedIssueCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(closedIssueCount)) { + closedIssueCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setClosedIssueCount(dto.getCount()); + } + }); + } + //议题关闭数日增量 + List closedIssueIncr = closedIssueIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(closedIssueIncr)) { + closedIssueIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setClosedIssueIncr(dto.getCount()); + } + }); + } + //项目响应数 + List projectResponseCount = projectResponseCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectResponseCount)) { + projectResponseCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectResponseCount(dto.getCount()); + } + }); + } + //项目响应数日增量 + List projectResponseIncr = projectResponseIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectResponseIncr)) { + projectResponseIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectResponseIncr(dto.getCount()); + } + }); + } + //项目吹哨数 + List projectTransferCount = projectTransferCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectTransferCount)) { + projectTransferCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectTransferCount(dto.getCount()); + } + }); + } + //项目吹哨数日增量 + List projectTransferIncr = projectTransferIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectTransferIncr)) { + projectTransferIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectTransferIncr(dto.getCount()); + } + }); + } + //项目响应数 + List projectClosedCount = projectClosedCountMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectClosedCount)) { + projectClosedCount.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectClosedCount(dto.getCount()); + } + }); + } + //项目响应数日增量 + List projectClosedIncr = projectClosedIncrMap.get(item.getStaffId()); + if (CollectionUtils.isNotEmpty(projectClosedIncr)) { + projectClosedIncr.forEach(dto -> { + if (item.getGridId().equals(dto.getOrgId())) { + item.setProjectClosedIncr(dto.getCount()); + } + }); + } + } + + /** + * 初始化Entity + * @author zhaoqifeng + * @date 2021/7/7 10:55 + * @param customerId + * @param dateId + * @param item + * @param staffInfo + * @return com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity + */ + private FactGridMemberStatisticsDailyEntity initEntity(String customerId, String dateId, CustomerStaffGridDTO item, StaffRoleInfoDTO staffInfo) { + FactGridMemberStatisticsDailyEntity entity = new FactGridMemberStatisticsDailyEntity(); + entity.setCustomerId(customerId); + entity.setAgencyId(item.getAgencyId()); + entity.setGridId(item.getGridId()); + entity.setPid(item.getPid()); + entity.setPids(item.getPids()); + entity.setGridId(item.getGridId()); + entity.setYearId(dateId.substring(NumConstant.ZERO, NumConstant.FOUR)); + entity.setMonthId(dateId.substring(NumConstant.ZERO, NumConstant.SIX)); + entity.setDateId(dateId); + entity.setStaffId(item.getStaffId()); + entity.setStaffName(staffInfo.getStaffName()); + entity.setProjectCount(NumConstant.ZERO); + entity.setProjectIncr(NumConstant.ZERO); + entity.setIssueToProjectCount(NumConstant.ZERO); + entity.setIssueToProjectIncr(NumConstant.ZERO); + entity.setClosedIssueCount(NumConstant.ZERO); + entity.setClosedIssueIncr(NumConstant.ZERO); + entity.setProjectClosedCount(NumConstant.ZERO); + entity.setProjectClosedIncr(NumConstant.ZERO); + entity.setProjectResponseCount(NumConstant.ZERO); + entity.setProjectResponseIncr(NumConstant.ZERO); + entity.setProjectTransferCount(NumConstant.ZERO); + entity.setProjectTransferIncr(NumConstant.ZERO); + return entity; + } + + /** + * 网格员数据统计 + * @author zhaoqifeng + * @date 2021/7/7 10:55 + */ + private class GetGridMemberData { + private String customerId; + private String dateId; + private Map> projectCountMap; + private Map> projectIncrMap; + private Map> issueToProjectCountMap; + private Map> issueToProjectIncrMap; + private Map> closedIssueCountMap; + private Map> closedIssueIncrMap; + private Map> projectResponseCountMap; + private Map> projectResponseIncrMap; + private Map> projectTransferCountMap; + private Map> projectTransferIncrMap; + private Map> projectClosedCountMap; + private Map> projectClosedIncrMap; + + GetGridMemberData(String customerId, String dateId) { + this.customerId = customerId; + this.dateId = dateId; + } + + Map> getProjectCountMap() { + return projectCountMap; + } + + Map> getProjectIncrMap() { + return projectIncrMap; + } + + Map> getIssueToProjectCountMap() { + return issueToProjectCountMap; + } + + Map> getIssueToProjectIncrMap() { + return issueToProjectIncrMap; + } + + Map> getClosedIssueCountMap() { + return closedIssueCountMap; + } + + Map> getClosedIssueIncrMap() { + return closedIssueIncrMap; + } + + Map> getProjectResponseCountMap() { + return projectResponseCountMap; + } + + Map> getProjectResponseIncrMap() { + return projectResponseIncrMap; + } + + Map> getProjectTransferCountMap() { + return projectTransferCountMap; + } + + Map> getProjectTransferIncrMap() { + return projectTransferIncrMap; + } + + Map> getProjectClosedCountMap() { + return projectClosedCountMap; + } + + Map> getProjectClosedIncrMap() { + return projectClosedIncrMap; + } + + GetGridMemberData invoke() { + //项目立项数 + projectCountMap = factOriginProjectMainDailyService.getMemberProjectCount(customerId, dateId, + NumConstant.ZERO); + projectIncrMap = factOriginProjectMainDailyService.getMemberProjectCount(customerId, dateId, + NumConstant.ONE); + //议题转项目数 + issueToProjectCountMap = factOriginIssueLogDailyService.getIssueToProjectCount(customerId, dateId, + NumConstant.ZERO); + issueToProjectIncrMap = factOriginIssueLogDailyService.getIssueToProjectCount(customerId, dateId, + NumConstant.ONE); + //议题关闭数 + closedIssueCountMap = factOriginIssueLogDailyService.getClosedIssueCount(customerId, dateId, + NumConstant.ZERO); + closedIssueIncrMap = factOriginIssueLogDailyService.getClosedIssueCount(customerId, dateId, + NumConstant.ONE); + //项目响应数 + projectResponseCountMap = factOriginProjectLogDailyService.getProjectResponseCount(customerId, + dateId, NumConstant.ZERO); + projectResponseIncrMap = factOriginProjectLogDailyService.getProjectResponseCount(customerId, dateId + , NumConstant.ONE); + //项目吹哨数 + projectTransferCountMap = factOriginProjectLogDailyService.getProjectTransferCount(customerId, + dateId, NumConstant.ZERO); + projectTransferIncrMap = factOriginProjectLogDailyService.getProjectTransferCount(customerId, dateId + , NumConstant.ONE); + //项目结案数 + projectClosedCountMap = factOriginProjectLogDailyService.getProjectClosedCount(customerId, + dateId, NumConstant.ZERO); + projectClosedIncrMap = factOriginProjectLogDailyService.getProjectClosedCount(customerId, dateId + , NumConstant.ONE); + return this; + } + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsMonthlyServiceImpl.java new file mode 100644 index 0000000000..19f4e54698 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGridMemberStatisticsMonthlyServiceImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.extract.todata.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.evaluationindex.extract.FactGridMemberStatisticsMonthlyDao; +import com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsMonthlyEntity; +import com.epmet.service.evaluationindex.extract.todata.FactGridMemberStatisticsMonthlyService; +import org.springframework.stereotype.Service; + +/** + * 网格员数据统计_月统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-02 + */ +@Service +public class FactGridMemberStatisticsMonthlyServiceImpl extends BaseServiceImpl implements FactGridMemberStatisticsMonthlyService { + + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java index 9bde7a5a94..e05775938e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgTypeConstant; import com.epmet.dao.evaluationindex.extract.FactOriginIssueLogDailyDao; import com.epmet.dto.extract.result.IssueVoteUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; @@ -32,8 +33,12 @@ import com.epmet.service.stats.DimAgencyService; 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.Collections; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 议题记录附表 @@ -115,4 +120,52 @@ public class FactOriginIssueLogDailyServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/5 15:52 + */ + @Override + public Map> getIssueToProjectCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getIssueToProjectCount(customerId, dateId); + } else { + list = baseDao.getIssueToProjectIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + + /** + * 工作人员关闭议题数 + * + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + * @author zhaoqifeng + * @date 2021/7/5 16:40 + */ + @Override + public Map> getClosedIssueCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getClosedIssueCount(customerId, dateId); + } else { + list = baseDao.getClosedIssueIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java index 73de4eb905..311da04715 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java @@ -433,5 +433,77 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/5 16:56 + */ + @Override + public Map> getProjectResponseCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getProjectResponseCount(customerId, dateId); + } else { + list = baseDao.getProjectResponseIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + + /** + * 项目吹哨数 + * + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + * @author zhaoqifeng + * @date 2021/7/5 16:57 + */ + @Override + public Map> getProjectTransferCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getProjectTransferCount(customerId, dateId); + } else { + list = baseDao.getProjectTransferIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + + /** + * 项目结案数 + * + * @param customerId + * @param dateId + * @param type + * @return java.util.Map> + * @author zhaoqifeng + * @date 2021/7/5 16:57 + */ + @Override + public Map> getProjectClosedCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getProjectClosedCount(customerId, dateId); + } else { + list = baseDao.getProjectClosedIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index 3e8b210781..65980d157a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -711,5 +711,29 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/5 14:48 + */ + @Override + public Map> getMemberProjectCount(String customerId, String dateId, Integer type) { + List list; + if (type == NumConstant.ZERO) { + list = baseDao.getMemberProjectCount(customerId, dateId); + } else { + list = baseDao.getMemberProjectCountIncr(customerId, dateId); + } + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId)); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java index 0ec9de39bb..d5dcfc50ed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java @@ -89,38 +89,39 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { List pendingList = factOriginProjectMainDailyService.getPendingList(customerId); List finishOrgList = projectProcessService.getFinishOrg(customerId, dateString); if (!CollectionUtils.isEmpty(closedList)) { - List closeProjects = - pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> { - FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); - entity.setId(process.getProjectId()); - entity.setProjectStatus(ProjectConstant.CLOSED); - entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD)); - entity.setUpdatedTime(process.getUpdatedTime()); - entity.setIsResolved(process.getIsResolved()); - return entity; - })).collect(Collectors.toList()); - - if (!CollectionUtils.isEmpty(finishOrgList)) { - closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { - String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); - String org = ""; - //取最短的ordIds中最后一个 则为最高级的那个orgIds - if (orgIds.length > NumConstant.ONE) { - org = orgIds[orgIds.length - 1]; - } else { - org = orgIds[0]; - } - if (StringUtils.isNotEmpty(dto.getGridId())) { - org = org + StrConstant.COLON + dto.getGridId(); - } else if (StringUtils.isNotEmpty(dto.getDepartmentId())) { - org = org + StrConstant.COLON + dto.getDepartmentId(); - } - close.setFinishOrgIds(org); - })); - } - //更新状态 - if (!closeProjects.isEmpty()) { - factOriginProjectMainDailyService.updateBatchById(closeProjects); + if(!CollectionUtils.isEmpty(pendingList)) { + List closeProjects = + pendingList.stream().flatMap(pending -> closedList.stream().filter(closed -> pending.getId().equals(closed.getProjectId())).map(process -> { + FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity(); + entity.setId(process.getProjectId()); + entity.setProjectStatus(ProjectConstant.CLOSED); + entity.setCreatedTime(DateUtils.stringToDate(pending.getDateId(), DateUtils.DATE_PATTERN_YYYYMMDD)); + entity.setUpdatedTime(process.getUpdatedTime()); + entity.setIsResolved(process.getIsResolved()); + return entity; + })).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(finishOrgList)) { + closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { + String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); + String org = ""; + //取最短的ordIds中最后一个 则为最高级的那个orgIds + if (orgIds.length > NumConstant.ONE) { + org = orgIds[orgIds.length - 1]; + } else { + org = orgIds[0]; + } + if (StringUtils.isNotEmpty(dto.getGridId())) { + org = org + StrConstant.COLON + dto.getGridId(); + } else if (StringUtils.isNotEmpty(dto.getDepartmentId())) { + org = org + StrConstant.COLON + dto.getDepartmentId(); + } + close.setFinishOrgIds(org); + })); + } + //更新状态 + if (!closeProjects.isEmpty()) { + factOriginProjectMainDailyService.updateBatchById(closeProjects); + } } } //获取项目信息 @@ -177,6 +178,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { } entity.setIsParty(NumConstant.ZERO_STR); entity.setIsOverdue(NumConstant.ZERO_STR); + entity.setProjectCreator(project.getCreatedBy()); return entity; }).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(issueList)) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index d2d37a4693..73f801ef3d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -12,6 +12,7 @@ import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.service.evaluationindex.extract.todata.FactAgencyGovernDailyService; import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; +import com.epmet.service.evaluationindex.extract.todata.FactGridMemberStatisticsDailyService; import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.IndexCalculateService; import com.epmet.service.evaluationindex.screen.*; @@ -76,6 +77,8 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { private FactGridGovernDailyService factGridGovernDailyService; @Autowired private FactAgencyGovernDailyService factAgencyGovernDailyService; + @Autowired + private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService; /** * @param extractOriginFormDTO @@ -264,6 +267,12 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { }catch(Exception e){ log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); } + + try{ + factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId); + }catch(Exception e){ + log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } extractPartData(customerId, dateId); log.info("===== extractDaily method end ======"); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java index 2cdee8ccad..b25ff45b5f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java @@ -3,6 +3,7 @@ package com.epmet.service.org; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; @@ -50,4 +51,13 @@ public interface CustomerGridService { * @Date 2020/9/16 14:02 **/ List queryGridInfoList(String customerId); + + /** + * 查询工作人员网格关系 + * @author zhaoqifeng + * @date 2021/7/5 10:21 + * @param customerId + * @return java.util.List + */ + List getCustomerStaffGridList(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerStaffService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerStaffService.java new file mode 100644 index 0000000000..6f03097838 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerStaffService.java @@ -0,0 +1,22 @@ +package com.epmet.service.org; + +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.CustomerGridStaffDTO; + +import java.util.List; + +/** + * @author liujianjun + */ +public interface CustomerStaffService { + + /** + * desc: 条件获取 网格下的所有人 + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/6/29 3:13 下午 + */ + List selectStaffGridList(StaffPatrolStatsFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index fa8018e1e1..b3474f5574 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -6,6 +6,7 @@ import com.epmet.dao.org.CustomerGridDao; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.service.org.CustomerGridService; @@ -64,4 +65,17 @@ public class CustomerGridServiceImpl implements CustomerGridService { public List queryGridInfoList(String customerId) { return customerGridDao.selectListGridInfo(customerId); } + + /** + * 查询工作人员网格关系 + * + * @param customerId + * @return java.util.List + * @author zhaoqifeng + * @date 2021/7/5 10:21 + */ + @Override + public List getCustomerStaffGridList(String customerId) { + return customerGridDao.getCustomerStaffGridList(customerId); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerStaffServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerStaffServiceImpl.java new file mode 100644 index 0000000000..fba61dd8bf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerStaffServiceImpl.java @@ -0,0 +1,39 @@ +package com.epmet.service.org.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.org.CustomerStaffGridDao; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.CustomerGridStaffDTO; +import com.epmet.service.org.CustomerStaffService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2021/6/29 3:14 下午 + * @version: 1.0 + */ +@Service +@DataSource(DataSourceConstant.GOV_ORG) +public class CustomerStaffServiceImpl implements CustomerStaffService { + @Autowired + private CustomerStaffGridDao customerStaffGridDao; + + /** + * desc: 条件获取 网格下的所有人 + * + * @param formDTO + * @return java.util.List + * @author LiuJanJun + * @date 2021/6/29 3:13 下午 + */ + @Override + public List selectStaffGridList(StaffPatrolStatsFormDTO formDTO) { + return customerStaffGridDao.selectGridStaffList(formDTO); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java index 36c3ebd05b..db9a4add14 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java @@ -162,4 +162,5 @@ public interface ProjectService extends BaseService { */ List getProjectSatisfaction(String customerId); + List selectProjectListByDateId(String customerId, String yesterdayStr, String projectOriginAgency); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index 3581f920b1..f7aa9d8754 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -196,5 +196,10 @@ public class ProjectServiceImpl extends BaseServiceImpl selectProjectListByDateId(String customerId, String dateId, String projectOrigin) { + return baseDao.selectProjectListByDateId(customerId,dateId,projectOrigin); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/StatsStaffPatrolService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/StatsStaffPatrolService.java new file mode 100644 index 0000000000..1f1f9cefff --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/StatsStaffPatrolService.java @@ -0,0 +1,16 @@ +package com.epmet.service.user; + +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; + +import java.util.List; + +/** + * @author liujianjun + */ +public interface StatsStaffPatrolService { + + Integer delAndInsertBatch(StaffPatrolStatsFormDTO formDTO, List insertList); + + List selectData(String customerId, String yesterdayStr); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index ebc01ebdb3..f53f544575 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -2,9 +2,14 @@ package com.epmet.service.user; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; +import com.epmet.dto.user.result.StaffRoleInfoDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StaffPatrolRecordResult; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.util.DimIdGenerator; @@ -94,4 +99,29 @@ public interface UserService { * @return com.epmet.dto.user.OrgGridManagerTotalDTO */ Map queryOrgGridManager(String customerId,List orgStaffDTOList); + + /** + * 根据角色key查找工作人员 + * + * @author zhaoqifeng + * @date 2021/7/5 9:52 + * @param customerId + * @param roleKey + * @return java.util.List + */ + List getStaffByRoleKey(String customerId, String roleKey); + + /** + * desc: 请描述类的业务用途 + * + * @param formDTO + * @return + * @author LiuJanJun + * @date 2021/6/29 10:15 上午 + */ + List selectUserListByRoleKey(StaffPatrolStatsFormDTO formDTO); + + List selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO); + + List selectStaffPatrolListByDateId(String customerId, String yesterdayStr); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java new file mode 100644 index 0000000000..0da9e3eea6 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/StatsStaffPatrolServiceImpl.java @@ -0,0 +1,48 @@ +package com.epmet.service.user.impl; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.user.StatsStaffPatrolRecordDailyDao; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; +import com.epmet.entity.user.StatsStaffPatrolRecordDailyEntity; +import com.epmet.service.user.StatsStaffPatrolService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2021/6/30 8:33 上午 + * @version: 1.0 + */ +@Slf4j +@DataSource(DataSourceConstant.EPMET_USER) +@Service +public class StatsStaffPatrolServiceImpl implements StatsStaffPatrolService { + @Autowired + private StatsStaffPatrolRecordDailyDao statsStaffPatrolRecordDailyDao; + + @Override + public Integer delAndInsertBatch(StaffPatrolStatsFormDTO formDTO, List insertList) { + int delete = statsStaffPatrolRecordDailyDao.delete(formDTO); + log.debug("delAndInsertBatch delete:{},param:{}", delete, JSON.toJSONString(formDTO)); + return statsStaffPatrolRecordDailyDao.insertBatch(insertList); + } + + @Override + public List selectData(String customerId, String yesterdayStr) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(StatsStaffPatrolRecordDailyEntity::getCustomerId, customerId) + .eq(StatsStaffPatrolRecordDailyEntity::getDateId, yesterdayStr); + List list = statsStaffPatrolRecordDailyDao.selectList(queryWrapper); + return ConvertUtils.sourceToTarget(list, StatsStaffPatrolRecordDailyDTO.class); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index 59897628e3..22a454fcb2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -6,15 +6,21 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.ExtractConstant; import com.epmet.constant.ProjectConstant; +import com.epmet.constant.RoleKeyConstants; import com.epmet.dao.user.UserDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.org.result.OrgStaffDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.*; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; +import com.epmet.dto.user.result.StaffRoleInfoDTO; +import com.epmet.dto.user.result.CustomerStaffDTO; +import com.epmet.dto.user.result.StaffPatrolRecordResult; +import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.service.user.UserService; import com.epmet.util.DimIdGenerator; @@ -797,4 +803,34 @@ public class UserServiceImpl implements UserService { return resultMap; } + /** + * 根据角色key查找工作人员 + * + * @param customerId + * @param roleKey + * @return java.util.List + * @author zhaoqifeng + * @date 2021/7/5 9:52 + */ + @Override + public List getStaffByRoleKey(String customerId, String roleKey) { + return userDao.getStaffByRoleKey(customerId, roleKey); + } + + @Override + public List selectUserListByRoleKey(StaffPatrolStatsFormDTO formDTO) { + formDTO.setRoleKey(RoleKeyConstants.ROLE_KEY_GRID_MEMBER); + return userDao.selectUserByRoleKey(formDTO); + } + + @Override + public List selectLastStaffPatrolList(StaffPatrolStatsFormDTO formDTO) { + return userDao.selectLastStaffPatrolList(formDTO); + } + + @Override + public List selectStaffPatrolListByDateId(String customerId, String yesterdayStr) { + return userDao.selectStaffPatrolListByDateId(customerId,yesterdayStr); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql new file mode 100644 index 0000000000..c8c90b5370 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.21__grid_member_statistics.sql @@ -0,0 +1,41 @@ +#网格员数据分析需求 脚本 2021-07-06 +CREATE TABLE `fact_grid_member_statistics_daily` +( + `ID` varchar(64) NOT NULL COMMENT '主键(t-1)', + `DATE_ID` varchar(32) NOT NULL COMMENT 'yyyyMMdd', + `MONTH_ID` varchar(32) NOT NULL COMMENT '月份ID', + `YEAR_ID` varchar(32) NOT NULL COMMENT '年度ID', + `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(32) NOT NULL COMMENT '组织ID', + `GRID_ID` varchar(32) NOT NULL COMMENT '网格I', + `PID` varchar(32) NOT NULL COMMENT '上级ID(网格所属Agency的上级组织Id)', + `PIDS` varchar(512) NOT NULL COMMENT '所有agencyId的上级组织ID(包含agencyId)', + `STAFF_ID` varchar(32) NOT NULL COMMENT '工作人员ID', + `STAFF_NAME` varchar(32) DEFAULT NULL COMMENT '工作人员姓名', + `PROJECT_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目立项数', + `ISSUE_TO_PROJECT_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '议题转项目数', + `CLOSED_ISSUE_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '议题关闭数', + `PROJECT_RESPONSE_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目响应数', + `PROJECT_TRANSFER_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目吹哨数', + `PROJECT_CLOSED_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT '项目结案数', + `PROJECT_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目立项数日增量', + `ISSUE_TO_PROJECT_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '议题转项目数日增量', + `CLOSED_ISSUE_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '议题关闭数日增量', + `PROJECT_RESPONSE_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目响应数日增量', + `PROJECT_TRANSFER_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目吹哨数日增量', + `PROJECT_CLOSED_INCR` int(11) NOT NULL DEFAULT '0' COMMENT '项目结案数日增量', + `DEL_FLAG` int(11) DEFAULT NULL COMMENT '删除状态,0:正常,1:删除', + `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='网格员数据统计_日统计'; +#添加唯一索引 +ALTER TABLE `epmet_data_statistical`.`fact_grid_member_statistics_daily` + ADD UNIQUE INDEX `unx_staff`(`DATE_ID`, `STAFF_ID`, `GRID_ID`) USING BTREE; + +ALTER TABLE `epmet_data_statistical`.`fact_origin_project_main_daily` + ADD COLUMN `PROJECT_CREATOR` varchar(32) NULL COMMENT '项目创建人(议题转项目或立项人)' AFTER `IS_SATISFIED`; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsDailyDao.xml new file mode 100644 index 0000000000..8a43152a4b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsDailyDao.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from fact_grid_member_statistics_daily + where CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + limit #{deleteSize} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.xml new file mode 100644 index 0000000000..dc8760fab8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGridMemberStatisticsMonthlyDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index 521ef174e4..995c6cebad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -177,4 +177,64 @@ and M.IS_PARTY=#{isParty} + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml index b5a2fe362f..a5c0960f9c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml @@ -737,4 +737,106 @@ GROUP BY da.ID + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index e55e3b5076..8dd740bf05 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -1069,4 +1069,39 @@ AND m.IS_RESOLVED=#{isResolved} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index ce72f989f2..59219341a1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -241,7 +241,7 @@ i.DEL_FLAG = '0' AND ip.DEL_FLAG = '0' AND i.CUSTOMER_ID = #{customerId} - AND DATE_FORMAT(i.CREATED_TIME,'%Y%m%d') = #{dateId} + AND DATE_FORMAT(ip.CREATED_TIME,'%Y%m%d') = #{dateId} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index 7aa2bf3422..c80de35a85 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -86,4 +86,22 @@ CG.CUSTOMER_ID =#{customerId} and cg.del_flag='0' + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml new file mode 100644 index 0000000000..75b9aa5b40 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerStaffGridDao.xml @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index 3c5ebd884f..f73f12eb5f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -86,6 +86,7 @@ STATUS, CLOSED_STATUS, ORG_ID_PATH, + CREATED_BY, CREATED_TIME, UPDATED_TIME FROM project @@ -162,4 +163,11 @@ and CUSTOMER_ID = #{customerId} and PARAMETER_KEY = #{parameterKey} + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml new file mode 100644 index 0000000000..d3ea3d3f9a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/StatsStaffPatrolRecordDailyDao.xml @@ -0,0 +1,69 @@ + + + + + + insert into stats_staff_patrol_record_daily + ( + ID, + CUSTOMER_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + YEAR_ID, + QUARTER_ID, + GRID_ID, + AGENCY_ID, + GRID_PIDS, + STAFF_ID, + PATROL_TOTAL, + TOTAL_TIME, + REPORT_PROJECT_COUNT, + LATEST_PATROL_TIME, + LATEST_PATROL_STATUS, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.yearId}, + #{item.quarterId}, + #{item.gridId}, + #{item.agencyId}, + #{item.gridPids}, + #{item.staffId}, + #{item.patrolTotal}, + #{item.totalTime}, + #{item.reportProjectCount}, + #{item.latestPatrolTime}, + #{item.latestPatrolStatus}, + '0', + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + + DELETE FROM stats_staff_patrol_record_daily + WHERE CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + + AND GRID_ID = #{gridId} + + + AND STAFF_ID = #{staffId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index acb6c9feb3..e04a6931bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -570,4 +570,60 @@ user_id = #{userId} + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index f57bb25da3..50efc65a6e 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -3,6 +3,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActInfoDTO; +import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.feign.fallback.EpmetHeartOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -41,4 +42,14 @@ public interface EpmetHeartOpenFeignClient { */ @PostMapping("/heart/resi/act/published/{staffId}") Result> getPublishedAct(@PathVariable("staffId") String staffId); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param userId + * @author yinzuomei + * @description 根据用户id,查询用户的注册志愿者信息 + * @Date 2021/6/28 9:30 + **/ + @PostMapping("/heart/resi/volunteer/queryuservolunteerinfo/{userId}") + Result queryUserVolunteerInfo(@PathVariable("userId") String userId); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index 8c4f0be34a..9e4d671a3b 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActInfoDTO; +import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.feign.EpmetHeartOpenFeignClient; import org.springframework.stereotype.Component; @@ -35,4 +36,16 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli public Result> getPublishedAct(String staffId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getPublishedAct", staffId); } + + /** + * @param userId + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 根据用户id,查询用户的注册志愿者信息 + * @Date 2021/6/28 9:30 + **/ + @Override + public Result queryUserVolunteerInfo(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "queryUserVolunteerInfo", userId); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java index 4f31298977..00a07440ca 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -21,16 +21,14 @@ 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.VolunteerInfoDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; import com.epmet.service.VolunteerInfoService; 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 org.springframework.web.bind.annotation.*; import java.util.List; @@ -102,4 +100,16 @@ public class ResiVolunteerController { ValidatorUtils.validateEntity(customerFormDTO,CommonCustomerFormDTO.CustomerIdGroup.class); return new Result>().ok(volunteerInfoService.getVolunteerIds(customerFormDTO)); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param userId + * @author yinzuomei + * @description 根据用户id,查询用户的注册志愿者信息 + * @Date 2021/6/28 9:34 + **/ + @PostMapping("queryuservolunteerinfo/{userId}") + public Result queryUserVolunteerInfo(@PathVariable("userId")String userId){ + return new Result().ok(volunteerInfoService.queryUserVolunteerInfo(userId)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java index 398d48aa5b..53ac849cb8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java @@ -18,7 +18,6 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.VolunteerInfoDTO; @@ -29,7 +28,6 @@ import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; import com.epmet.entity.VolunteerInfoEntity; import java.util.List; -import java.util.Map; /** * 志愿者信息 @@ -78,4 +76,12 @@ public interface VolunteerInfoService extends BaseService { * @date 2020.08.13 10:22 **/ List getVolunteerIds(CommonCustomerFormDTO customerFormDTO); + + /** + * 根据用户id,查询用户的注册志愿者信息 + * + * @param userId + * @return com.epmet.dto.VolunteerInfoDTO + */ + VolunteerInfoDTO queryUserVolunteerInfo(String userId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index 6949505c9f..71b318ba0a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java @@ -208,4 +208,16 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpljar - + + com.epmet + epmet-message-client + 2.0.0 + com.epmet epmet-commons-tools @@ -93,6 +97,12 @@ 2.0.0 compile + + com.epmet + epmet-heart-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java index 9027eac8e1..6b097270d7 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java @@ -75,7 +75,7 @@ public class PointRuleController { } /** - * desc:根据功能id获取积分规则 + * desc:修改积分规则 * * @param formDTO * @return @@ -84,7 +84,7 @@ public class PointRuleController { @RequirePermission( requirePermission = RequirePermissionEnum.MORE_POINT_RULE_SAVE) public Result update(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) { formDTO.setCustomerId(tokenDTO.getCustomerId()); - ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + ValidatorUtils.validateEntity(formDTO, PointRuleFormDTO.UserShowGroup.class,UpdateGroup.class); pointRuleService.update(tokenDTO,formDTO); return new Result().ok(true); } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java index 5c3b666fa1..b52a602ede 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java @@ -2,20 +2,22 @@ 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.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.CommonPageUserFormDTO; -import com.epmet.dto.form.CommonUserFormDTO; -import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO; -import com.epmet.dto.form.ResiPointRankFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.service.PointVerificationLogService; import com.epmet.service.UserPointActionLogService; import com.epmet.service.UserPointStatisticalDailyService; import com.epmet.service.UserPointTotalService; import com.epmet.utils.ModuleConstant; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +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; @@ -156,4 +158,24 @@ public class ResiPointController { List resultDTOS = userPointStatisticalDailyService.listAroundPartyPointRank(formDTO); return new Result>().ok(resultDTOS); } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param tokenDto + * @param formDTO + * @author yinzuomei + * @description 积分任务列表 + * @Date 2021/6/18 14:19 + **/ + @PostMapping("mytasklist") + public Result> queryMyPointTaskList(@LoginUser TokenDto tokenDto,@RequestBody MyPointTaskFormDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + //默认查询当天 + if(StringUtils.isBlank(formDTO.getDateId())){ + formDTO.setDateId(DateUtils.getBeforeNDay(0)); + } + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(pointActionLogService.queryMyPointTaskList(formDTO)); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java index 9d5dbecdd3..0d304b8ae3 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java @@ -56,4 +56,13 @@ public interface PointRuleDao extends BaseDao { List selectCustomerIds(); + /** + * @Description 校验重名的规则 + * @Param ruleName + * @Param customerId + * @author zxc + * @date 2021/6/18 1:39 下午 + */ + Integer checkSameName(@Param("ruleName")String ruleName,@Param("customerId") String customerId,@Param("ruleId")String ruleId); + } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java index a2c1963e85..1db465d453 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.MyPointTaskResultDTO; import com.epmet.dto.result.ResiPointLogPeriodResultDTO; import com.epmet.entity.UserPointActionLogEntity; import org.apache.ibatis.annotations.Mapper; @@ -63,4 +64,9 @@ public interface UserPointActionLogDao extends BaseDao * @return java.lang.Integer */ Integer selectIncrease(@Param("type")String type, @Param("objectId")String objectId); + + List queryMyPointTaskList(@Param("customerId")String customerId, + @Param("userId")String userId, + @Param("type")String type, + @Param("dateId")String dateId); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleDefaultEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleDefaultEntity.java index bbb6055148..9b5cd7f6bc 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleDefaultEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleDefaultEntity.java @@ -94,4 +94,19 @@ public class PointRuleDefaultEntity extends BaseEpmetEntity { * 是否启用 0-否,1-是 */ private String enabledFlag; + + /** + * 规则显示顺序 + */ + private Integer sort; + + /** + * 链接页面 + */ + private String linkPage; + + /** + * 一次性任务?1:是;0:不是 + */ + private String disposable; } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java index 6468d86afb..7191215345 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java @@ -102,6 +102,21 @@ public class PointRuleEntity extends BaseEpmetEntity { */ private String enabledFlag; + /** + * 规则显示顺序 + */ + private Integer sort; + + /** + * 链接页面 + */ + private String linkPage; + + /** + * 一次性任务?1:是;0:不是 + */ + private String disposable; + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java index 892fd67a11..314b9b46db 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java @@ -22,6 +22,8 @@ import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.UserPointActionLogDTO; import com.epmet.dto.form.CommonPageUserFormDTO; +import com.epmet.dto.form.MyPointTaskFormDTO; +import com.epmet.dto.result.MyPointTaskResultDTO; import com.epmet.dto.result.ResiPointLogListResultDTO; import com.epmet.entity.UserPointActionLogEntity; import dto.form.SendPointFormDTO; @@ -133,4 +135,12 @@ public interface UserPointActionLogService extends BaseService + */ + List queryMyPointTaskList(MyPointTaskFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java index de0f13ac4d..1291a777e2 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java @@ -21,15 +21,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.common.enu.PointUnitEnum; import com.epmet.common.enu.SysResponseEnum; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.rocketmq.messages.PointRuleChangedMQMsg; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.enums.CommonOperateTypeEnum; import com.epmet.commons.tools.enums.EventEnum; +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.security.dto.TokenDto; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.dao.PointRuleDao; @@ -38,17 +42,16 @@ import com.epmet.dao.RuleOperateLogDao; import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.InitPointRuleResultDTO; -import com.epmet.dto.form.CustomerFunctionListFormDTO; -import com.epmet.dto.form.PointDetailFormDTO; -import com.epmet.dto.form.PointRuleFormDTO; -import com.epmet.dto.form.PointRuleListFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.PointRuleDefaultEntity; import com.epmet.entity.PointRuleEntity; import com.epmet.entity.RuleOperateLogEntity; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.send.SendMqMsgUtil; import com.epmet.service.PointRuleService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -56,7 +59,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; 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.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; @@ -81,6 +87,10 @@ public class PointRuleServiceImpl extends BaseServiceImpl getFunctionList(String customerId) { @@ -145,15 +155,31 @@ public class PointRuleServiceImpl extends BaseServiceImpl NumConstant.ZERO){ + throw new RenException(EpmetErrorCode.SAME_RULE_NAME.getCode()); + } + // 检验积分上限是不是单位积分的整数倍 + Integer remainder = formDTO.getUpLimit() % formDTO.getPoint(); + if (remainder > NumConstant.ZERO){ + throw new RenException(EpmetErrorCode.UP_LIMIT_POINT.getCode()); + } PointRuleEntity entityNew = ConvertUtils.sourceToTarget(formDTO, PointRuleEntity.class); entityNew.setId(formDTO.getRuleId()); entityNew.setEnabledFlag(StrConstant.TRUE.equals(formDTO.getEnabledFlag()) ? "1" : "0"); @@ -163,6 +189,70 @@ public class PointRuleServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -512,4 +521,42 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl + */ + @Override + public List queryMyPointTaskList(MyPointTaskFormDTO formDTO) { + List list=baseDao.queryMyPointTaskList(formDTO.getCustomerId(),formDTO.getUserId(),formDTO.getType(), formDTO.getDateId()); + list.forEach(dto->{ + if(NumConstant.ZERO==dto.getUpLimit()){ + //无上限 + dto.setFinishTotalDesc("完成"+dto.getFinishedCount()); + dto.setFinishFlag("去完成"); + }else{ + dto.setFinishTotalDesc("完成".concat(String.valueOf(dto.getFinishedCount())).concat("/").concat(String.valueOf(dto.getUpLimitCount()))); + if (dto.getUpLimitCount().equals(dto.getFinishedCount()) || dto.getFinishedCount() > dto.getUpLimitCount()) { + dto.setFinishFlag("已完成"); + } else { + dto.setFinishFlag("去完成"); + } + } + //一次性任务,已完成。 + if("1".equals(dto.getDisposable())&&dto.getFinishedCount().equals(NumConstant.ONE)){ + dto.setFinishFlag("已完成"); + } + //如果是注册志愿者 + if ("register_volunteer".equals(dto.getEventCode())){ + Result volunteerInfoDTOResult= epmetHeartOpenFeignClient.queryUserVolunteerInfo(formDTO.getUserId()); + if(volunteerInfoDTOResult.success()&&null!=volunteerInfoDTOResult.getData()){ + dto.setFinishFlag("已完成"); + dto.setFinishTotalDesc("完成1"); + } + } + }); + return list; + } } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.11__point_rule_sort.sql b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.11__point_rule_sort.sql new file mode 100644 index 0000000000..76f4b2addd --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.11__point_rule_sort.sql @@ -0,0 +1,29 @@ +alter table point_rule_default add COLUMN SORT INT(11) COMMENT '规则显示顺序' AFTER ENABLED_FLAG ; +alter table point_rule add COLUMN SORT INT(11) COMMENT '规则显示顺序' AFTER ENABLED_FLAG ; +alter table point_rule_default add COLUMN LINK_PAGE VARCHAR(32) COMMENT '链接页面' AFTER SORT ; +alter table point_rule add COLUMN LINK_PAGE VARCHAR(32) COMMENT '链接页面' AFTER SORT ; +alter table point_rule_default add COLUMN DISPOSABLE varchar(1) not null default '0' comment '一次性任务?1:是;0:不是' AFTER LINK_PAGE; +alter table point_rule add COLUMN DISPOSABLE varchar(1) not null default '0' comment '一次性任务?1:是;0:不是' AFTER LINK_PAGE; + +update point_rule_default set sort='1001',LINK_PAGE='group' where EVENT_CODE='participate_one_topic' and DEL_FLAG='0'; +update point_rule_default set sort='1002',LINK_PAGE='group' where EVENT_CODE='publish_one_topic' and DEL_FLAG='0'; +update point_rule_default set sort='1003',LINK_PAGE='group' where EVENT_CODE='invite_resi_into_group' and DEL_FLAG='0'; +update point_rule_default set sort='1004',LINK_PAGE='group' where EVENT_CODE='invite_new_into_group' and DEL_FLAG='0'; +update point_rule_default set sort='1005',LINK_PAGE='group' where EVENT_CODE='leader_resolve_topic' and DEL_FLAG='0'; +update point_rule_default set sort='1006',LINK_PAGE='group' where EVENT_CODE='shift_topic_to_issue' and DEL_FLAG='0'; +update point_rule_default set sort='1007',LINK_PAGE='group' where EVENT_CODE='topic_to_issue' and DEL_FLAG='0'; +update point_rule_default set sort='1008',LINK_PAGE='group' where EVENT_CODE='topic_to_project' and DEL_FLAG='0'; +update point_rule_default set sort='2001',LINK_PAGE='heart',DISPOSABLE='1' where EVENT_CODE='register_volunteer' and DEL_FLAG='0'; +update point_rule_default set sort='2002',LINK_PAGE='heart' where EVENT_CODE='active_insert_live' and DEL_FLAG='0'; + + +update point_rule set sort='1001',LINK_PAGE='group' where EVENT_CODE='participate_one_topic' and DEL_FLAG='0'; +update point_rule set sort='1002',LINK_PAGE='group' where EVENT_CODE='publish_one_topic' and DEL_FLAG='0'; +update point_rule set sort='1003',LINK_PAGE='group' where EVENT_CODE='invite_resi_into_group' and DEL_FLAG='0'; +update point_rule set sort='1004',LINK_PAGE='group' where EVENT_CODE='invite_new_into_group' and DEL_FLAG='0'; +update point_rule set sort='1005',LINK_PAGE='group' where EVENT_CODE='leader_resolve_topic' and DEL_FLAG='0'; +update point_rule set sort='1006',LINK_PAGE='group' where EVENT_CODE='shift_topic_to_issue' and DEL_FLAG='0'; +update point_rule set sort='1007',LINK_PAGE='group' where EVENT_CODE='topic_to_issue' and DEL_FLAG='0'; +update point_rule set sort='1008',LINK_PAGE='group' where EVENT_CODE='topic_to_project' and DEL_FLAG='0'; +update point_rule set sort='2001',LINK_PAGE='heart' ,DISPOSABLE='1' where EVENT_CODE='register_volunteer' and DEL_FLAG='0'; +update point_rule set sort='2002',LINK_PAGE='heart' where EVENT_CODE='active_insert_live' and DEL_FLAG='0'; \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml index 916c58edbb..319395e4f4 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml @@ -138,7 +138,7 @@ - + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml index c18c78976b..4bde53c962 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointRuleDao.xml @@ -33,13 +33,16 @@ CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND FUNCTION_ID = #{functionId,jdbcType=VARCHAR} AND DEL_FLAG = '0' + order by sort asc UPDATE point_rule SET POINT = #{point,jdbcType=INTEGER}, ENABLED_FLAG = #{enabledFlag,jdbcType=VARCHAR}, - UP_LIMIT = #{upLimit,jdbcType=INTEGER} + UP_LIMIT = #{upLimit,jdbcType=INTEGER}, + RULE_NAME = #{ruleName}, + RULE_DESC = #{ruleDesc} WHERE id = #{id,jdbcType=VARCHAR} and CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} @@ -54,4 +57,15 @@ + + + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml index c7c6bf89c2..d2a4f0f212 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml @@ -73,4 +73,73 @@ AND OBJECT_ID = #{objectId} AND DATE_FORMAT(CREATED_TIME, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d') + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml index bcf4735cb8..e9fb92c22f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml @@ -35,7 +35,15 @@ + SELECT + COUNT(1) + FROM + project + WHERE DEL_FLAG = '0' + AND CREATED_TIME BETWEEN #{patrolStartTime} AND #{patrolEndTime} + AND ORIGIN = 'agency' + AND CREATED_BY = #{userId} + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 773eeda261..a53442897c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -1757,7 +1757,17 @@ public class ResiTopicServiceImpl extends BaseServiceImpl 议题服务) Date now = new Date(); //2.调用gov-org获取数据权限 - ResiTopicAndGroupResultDTO group = baseDao.getGroupInfoByTopicId(topicTurnIssueFromDTO.getTopicId()); - if(null == group) { - throw new RenException(ModuleConstant.FAILURE_TO_TURN_ISSUE); - } - TopicInfoFormDTO topicId = new TopicInfoFormDTO(); - topicId.setTopicId(topicTurnIssueFromDTO.getTopicId()); - Integer issueCount = govIssueFeignClient.checkTopicShiftIssue(topicId).getData(); - if (issueCount != NumConstant.ZERO){ - throw new RenException(ModuleConstant.ALREADY_SHIFT_ISSUE); - } CommonGridIdFormDTO dataFilterParam = new CommonGridIdFormDTO(); dataFilterParam.setUserId(topicTurnIssueFromDTO.getUserId()); dataFilterParam.setGridId(group.getGridId()); diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java index 21d940ec2c..c75bca8a46 100644 --- a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/MyResiUserInfoResultDTO.java @@ -47,4 +47,9 @@ public class MyResiUserInfoResultDTO implements Serializable { * */ private Integer point; + /** + * 今日已获得积分,用于积分任务列表显示 + * */ + private Integer todayObtainedPoint; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java new file mode 100644 index 0000000000..43a8cdf336 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StatsStaffPatrolRecordDailyDTO.java @@ -0,0 +1,146 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +@Data +public class StatsStaffPatrolRecordDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 巡查次数 + */ + private Integer patrolTotal; + + /** + * 巡查时长 单位:秒 + */ + private Integer totalTime; + + /** + * 巡查期间直接立项项目数 + */ + private Integer reportProjectCount; + + /** + * 最新的巡查开始时间 + */ + private Date latestPatrolTime; + + /** + * 最新的巡查状态 正在巡查中:patrolling;结束:end + */ + private String latestPatrolStatus; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java index 4201a109a3..5b26ee9150 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyResiUserInfoResultDTO.java @@ -48,4 +48,8 @@ public class MyResiUserInfoResultDTO implements Serializable { * */ private Integer point; + /** + * 今日已获得积分,用于积分任务列表显示 + * */ + private Integer todayObtainedPoint; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsStaffPatrolRecordDailyController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsStaffPatrolRecordDailyController.java new file mode 100644 index 0000000000..b2dad2bce4 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsStaffPatrolRecordDailyController.java @@ -0,0 +1,32 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.StatsStaffPatrolRecordDailyDTO; +import com.epmet.service.StatsStaffPatrolRecordDailyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +@RestController +@RequestMapping("statsstaffpatrolrecorddaily") +public class StatsStaffPatrolRecordDailyController { + + @Autowired + private StatsStaffPatrolRecordDailyService statsStaffPatrolRecordDailyService; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java new file mode 100644 index 0000000000..458a171d00 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java @@ -0,0 +1,64 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.StatsStaffPatrolRecordDailyEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +@Mapper +public interface StatsStaffPatrolRecordDailyDao extends BaseDao { + + /** + * @Description 校验今天某人是不是有数据 + * @Param staffId + * @Param dateId + * @author zxc + * @date 2021/6/30 2:41 下午 + */ + String checkStatsCount(@Param("staffId")String staffId, @Param("dateId")String dateId,@Param("gridId")String gridId); + + /** + * @Description 更新最近巡查时间和巡查状态 + * @Param id + * @Param patrolStartTime 最近巡查时间 + * @author zxc + * @date 2021/7/1 9:15 上午 + */ + void updateStatsRecord(@Param("id")String id,@Param("patrolStartTime") Date patrolStartTime); + + /** + * @Description 巡查关闭时更新 + * @Param userId + * @Param patrolStartTime + * @author zxc + * @date 2021/7/1 10:36 上午 + */ + void updateStatsRecordEnd(@Param("userId")String userId,@Param("totalTime") Integer totalTime, + @Param("projectCount")Integer projectCount,@Param("dateId")String dateId,@Param("gridId")String gridId); + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java new file mode 100644 index 0000000000..2bb2e583e3 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StatsStaffPatrolRecordDailyEntity.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("stats_staff_patrol_record_daily") +public class StatsStaffPatrolRecordDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 统计日期 关联日期dim表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员所属组织id=网格所属的组织id + */ + private String agencyId; + + /** + * 网格所有上级id + */ + private String gridPids; + + /** + * 工作人员用户id + */ + private String staffId; + + /** + * 巡查次数 + */ + private Integer patrolTotal; + + /** + * 巡查时长 单位:秒 + */ + private Integer totalTime; + + /** + * 巡查期间直接立项项目数 + */ + private Integer reportProjectCount; + + /** + * 最新的巡查开始时间 + */ + private Date latestPatrolTime; + + /** + * 最新的巡查状态 正在巡查中:patrolling;结束:end + */ + private String latestPatrolStatus; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsStaffPatrolRecordDailyService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsStaffPatrolRecordDailyService.java new file mode 100644 index 0000000000..4eb51384d9 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsStaffPatrolRecordDailyService.java @@ -0,0 +1,15 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.StatsStaffPatrolRecordDailyEntity; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +public interface StatsStaffPatrolRecordDailyService extends BaseService { + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java index fd9e5891cd..8751acbb5f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java @@ -15,15 +15,19 @@ import com.epmet.constant.PatrolConstant; import com.epmet.dao.CustomerStaffDao; import com.epmet.dao.StaffPatrolDetailDao; import com.epmet.dao.StaffPatrolRecordDao; +import com.epmet.dao.StatsStaffPatrolRecordDailyDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.StaffPatrolDetailDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.StaffPatrolDetailEntity; import com.epmet.entity.StaffPatrolRecordEntity; +import com.epmet.entity.StatsStaffPatrolRecordDailyEntity; import com.epmet.feign.GovOrgFeignClient; +import com.epmet.feign.GovProjectOpenFeignClient; import com.epmet.service.StaffPatrolDetailService; import com.epmet.service.StaffPatrolRecordService; +import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -61,6 +65,12 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl patrolProject = govProjectOpenFeignClient.selectPatrolProject(formDTO); + if (!patrolProject.success()){ + throw new RenException("查询巡查期间立项数失败【"+patrolProject.getInternalMsg()+"】"); + } + Integer data = patrolProject.getData(); + statsStaffPatrolRecordDailyDao.updateStatsRecordEnd(userId,totalTime,data,dateId,gridId); } /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java new file mode 100644 index 0000000000..a53fc8e3a5 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java @@ -0,0 +1,32 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.StatsStaffPatrolRecordDailyDao; +import com.epmet.dto.StatsStaffPatrolRecordDailyDTO; +import com.epmet.entity.StatsStaffPatrolRecordDailyEntity; +import com.epmet.service.StatsStaffPatrolRecordDailyService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * [天]工作人员巡查记录统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-06-30 + */ +@Service +@Slf4j +public class StatsStaffPatrolRecordDailyServiceImpl extends BaseServiceImpl implements StatsStaffPatrolRecordDailyService { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java index 58a48ca9ac..b8ee97c440 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java @@ -209,6 +209,8 @@ public class UserServiceImpl extends BaseServiceImpl implem if(pointResult.success() && null != pointResult.getData()){ //累计积分 result.setPoint(pointResult.getData().getUsablePoint()); + //今日已获得积分,用于积分任务列表显示 + result.setTodayObtainedPoint(pointResult.getData().getTodayObtainedPoint()); } return result; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/DimIdGenerator.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/DimIdGenerator.java new file mode 100644 index 0000000000..35e1f6d99b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/DimIdGenerator.java @@ -0,0 +1,91 @@ +package com.epmet.util; + +import com.epmet.commons.tools.utils.DateUtils; +import lombok.Data; + +import java.util.Calendar; +import java.util.Date; + +public class DimIdGenerator { + + /** + * 生成日期维度ID + * @param targetDate + * @return + */ + public static String getDateDimId(Date targetDate) { + return DateUtils.format(targetDate, DateUtils.DATE_PATTERN_YYYYMMDD); + } + + /** + * 获取月维度ID + * @param date + * @return + */ + public static String getMonthDimId(Date date) { + return DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMM); + } + + /** + * 获取周维度ID ,每周的星期一为 周的开始 + * @param date + * @return + */ + public static String getWeekDimId(Date date) { + String yyyy = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); + Calendar calendar = Calendar.getInstance(); + calendar.setFirstDayOfWeek(Calendar.MONDAY); + calendar.setTime(date); + return yyyy.concat("W").concat(calendar.get(Calendar.WEEK_OF_YEAR)+""); + } + + /** + * 获取季度维度ID + * @param date + * @return + */ + public static String getQuarterDimId(Date date) { + String yyyy = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); + return yyyy.concat("Q").concat(DateUtils.getQuarterIndex(date) + ""); + } + + /** + * 获取年维度ID + * @param date + * @return + */ + public static String getYearDimId(Date date) { + return DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY); + } + + /** + * 获取封装了所有ID的对象 + * @return + */ + public static DimIdBean getDimIdBean(Date date) { + DimIdBean dimIdBean = new DimIdBean(); + dimIdBean.setDateId(getDateDimId(date)); + dimIdBean.setMonthId(getMonthDimId(date)); + dimIdBean.setWeekId(getWeekDimId(date)); + dimIdBean.setQuarterId(getQuarterDimId(date)); + dimIdBean.setYearId(getYearDimId(date)); + return dimIdBean; + } + + public static void main(String[] args) { + DimIdBean dimIdBean = getDimIdBean(DateUtils.stringToDate("2020-06-14",DateUtils.DATE_PATTERN)); + System.out.println(dimIdBean); + } + + @Data + public static class DimIdBean { + private String dateId; + private String monthId; + private String quarterId; + private String yearId; + private String weekId; + + public DimIdBean() { + } + } +} diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.14__add_patrol_stats.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.14__add_patrol_stats.sql new file mode 100644 index 0000000000..38cd6b93d8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.14__add_patrol_stats.sql @@ -0,0 +1,26 @@ +CREATE TABLE `stats_staff_patrol_record_daily` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `DATE_ID` varchar(32) NOT NULL COMMENT '统计日期 关联日期dim表', + `WEEK_ID` varchar(32) NOT NULL COMMENT '周ID', + `MONTH_ID` varchar(32) NOT NULL COMMENT '月ID', + `QUARTER_ID` varchar(32) NOT NULL COMMENT '季ID', + `YEAR_ID` varchar(32) NOT NULL COMMENT '年ID', + `GRID_ID` varchar(64) NOT NULL COMMENT '网格id', + `AGENCY_ID` varchar(64) DEFAULT NULL COMMENT '工作人员所属组织id=网格所属的组织id', + `GRID_PIDS` varchar(512) DEFAULT NULL COMMENT '网格所有上级id', + `STAFF_ID` varchar(64) DEFAULT NULL COMMENT '工作人员用户id', + `PATROL_TOTAL` int(11) DEFAULT NULL COMMENT '巡查次数', + `TOTAL_TIME` int(11) DEFAULT NULL COMMENT '巡查时长 单位:秒', + `REPORT_PROJECT_COUNT` int(11) DEFAULT NULL COMMENT '巡查期间直接立项项目数', + `LATEST_PATROL_TIME` datetime DEFAULT NULL COMMENT '最新的巡查开始时间', + `LATEST_PATROL_STATUS` varchar(32) DEFAULT NULL COMMENT '最新的巡查状态 正在巡查中:patrolling;结束:end', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`), + UNIQUE KEY `unx_staff` (`DATE_ID`,`GRID_ID`,`STAFF_ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='[天]工作人员巡查记录统计'; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.15__update_patrol_stats.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.15__update_patrol_stats.sql new file mode 100644 index 0000000000..a97fdfaf7e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.15__update_patrol_stats.sql @@ -0,0 +1,3 @@ +ALTER TABLE `epmet_user`.`stats_staff_patrol_record_daily` + DROP INDEX `unx_staff`, + ADD UNIQUE INDEX `unx_staff`(`DATE_ID`, `STAFF_ID`, `GRID_ID`) USING BTREE; diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml new file mode 100644 index 0000000000..da96fba412 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml @@ -0,0 +1,43 @@ + + + + + + + + update stats_staff_patrol_record_daily + set LATEST_PATROL_TIME = #{patrolStartTime}, + LATEST_PATROL_STATUS = 'patrolling', + UPDATED_TIME = NOW() + where DEL_FLAG = 0 + and ID = #{id} + + + + + update stats_staff_patrol_record_daily + SET TOTAL_TIME = (TOTAL_TIME + #{totalTime}), + PATROL_TOTAL = (PATROL_TOTAL + 1), + REPORT_PROJECT_COUNT = (REPORT_PROJECT_COUNT + #{projectCount}), + LATEST_PATROL_STATUS = 'end', + UPDATED_TIME = NOW() + WHERE DEL_FLAG = 0 + AND STAFF_ID = #{userId} + AND DATE_ID = #{dateId} + AND GRID_ID = #{gridId} + + + + + + \ No newline at end of file