158 changed files with 6250 additions and 131 deletions
@ -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<MessageExt> msgs, ConsumeConcurrentlyContext context) { |
|||
try { |
|||
msgs.forEach(msg -> consumeMessage(msg)); |
|||
} catch (Exception e) { |
|||
logger.error(ExceptionUtils.getErrorStackTrace(e)); |
|||
return ConsumeConcurrentlyStatus.RECONSUME_LATER; |
|||
} |
|||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; |
|||
} |
|||
|
|||
private void consumeMessage(MessageExt messageExt) { |
|||
String 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); |
|||
} |
|||
} |
|||
} |
@ -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; |
|||
} |
@ -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; |
|||
|
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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<String> gridIds; |
|||
|
|||
// 搜索的人员姓名
|
|||
private String searchedStaffName; |
|||
private String month; |
|||
@NotBlank(message = "排序规则不能为空", groups = { listGridMemberDatas.class }) |
|||
private String sort; |
|||
private Integer pageNo = 1; |
|||
private Integer pageSize = 10; |
|||
} |
@ -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; |
|||
|
|||
} |
@ -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; |
|||
} |
|||
} |
@ -0,0 +1,55 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dataaggre.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<FactGridMemberStatisticsDailyEntity> { |
|||
|
|||
/** |
|||
* @Description 查询网格员统计数据 |
|||
* @return |
|||
* @author wxz |
|||
* @date 2021.07.05 13:19 |
|||
*/ |
|||
List<GridMemberDataAnalysisResultDTO > listGridMemberDataStats(@Param("gridIds") List<String> 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); |
|||
} |
@ -0,0 +1,121 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dataaggre.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; |
|||
|
|||
} |
@ -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<GridMemberDataAnalysisResultDTO> getGridMemberDataAnalysis(List<String> gridIds, String searchedStaffName, String currStaffId, String month, String sort, Integer pageNo, Integer pageSize); |
|||
} |
@ -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<GridMemberDataAnalysisResultDTO> getGridMemberDataAnalysis( |
|||
List<String> gridIds, |
|||
String searchedStaffName, |
|||
String currStaffId, |
|||
String month, |
|||
String sort, |
|||
Integer pageNo, |
|||
Integer pageSize) { |
|||
|
|||
//1.得到网格id列表
|
|||
Map<String, String> gridIdAndName = new HashMap<>(); |
|||
List<CustomerGridDTO> grids = govOrgService.getGridInfoList(gridIds, currStaffId); |
|||
grids.forEach(g -> { |
|||
gridIds.add(g.getId()); |
|||
gridIdAndName.put(g.getId(), g.getGridName()); |
|||
}); |
|||
|
|||
//2.查询列表,并且填充内容
|
|||
List<GridMemberDataAnalysisResultDTO> records = dataStatsService.listGridMemberDataStats(gridIds, searchedStaffName, month, sort, pageNo, pageSize); |
|||
records.forEach(r -> r.setOrgName(gridIdAndName.get(r.getGridId()))); |
|||
return records; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,133 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dataaggre.dao.datastats.FactGridMemberStatisticsDailyDao"> |
|||
|
|||
<resultMap type="com.epmet.dataaggre.entity.datastats.FactGridMemberStatisticsDailyEntity" id="factGridMemberStatisticsDailyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="dateId" column="DATE_ID"/> |
|||
<result property="monthId" column="MONTH_ID"/> |
|||
<result property="yearId" column="YEAR_ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="pid" column="PID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="staffId" column="STAFF_ID"/> |
|||
<result property="staffName" column="STAFF_NAME"/> |
|||
<result property="projectCount" column="PROJECT_COUNT"/> |
|||
<result property="issueToProjectCount" column="ISSUE_TO_PROJECT_COUNT"/> |
|||
<result property="closedIssueCount" column="CLOSED_ISSUE_COUNT"/> |
|||
<result property="projectResponseCount" column="PROJECT_RESPONSE_COUNT"/> |
|||
<result property="projectTransferCount" column="PROJECT_TRANSFER_COUNT"/> |
|||
<result property="projectClosedCount" column="PROJECT_CLOSED_COUNT"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
<sql id="allColumns"> |
|||
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 |
|||
</sql> |
|||
|
|||
<!--查询网格员统计数据--> |
|||
<!--查询网格员统计数据--> |
|||
<select id="listGridMemberDataStats" |
|||
resultType="com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO"> |
|||
select 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, |
|||
|
|||
sum(member.project_incr) project_count, |
|||
sum(member.issue_to_project_incr) issue_to_project_count, |
|||
sum(member.closed_issue_incr) closed_issue_count, |
|||
sum(member.project_response_incr) project_response_count, |
|||
sum(member.project_transfer_incr) project_transfer_count, |
|||
sum(member.project_closed_incr) project_closed_count |
|||
from fact_grid_member_statistics_daily member |
|||
<where> |
|||
<if test="gridIds != null and gridIds.size() > 0"> |
|||
<foreach collection="gridIds" item="gridId" separator="OR" open="(" close=")"> |
|||
member.GRID_ID = #{gridId} |
|||
</foreach> |
|||
</if> |
|||
<if test="searchedStaffName != null and searchedStaffName != ''"> |
|||
and member.STAFF_NAME like CONCAT('%',#{searchedStaffName},'%') |
|||
</if> |
|||
<if test="month != null and month != ''"> |
|||
and member.MONTH_ID = #{month} |
|||
</if> |
|||
and del_flag = 0 |
|||
</where> |
|||
group by member.staff_id, member.grid_id |
|||
order by ${sort} desc |
|||
</select> |
|||
|
|||
<select id="getGridMemberIssueProjectStats" |
|||
resultType="com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO"> |
|||
SELECT 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, |
|||
sum(member.project_count) project_count, |
|||
sum(member.issue_to_project_count) issue_to_project_count, |
|||
sum(member.closed_issue_count) closed_issue_count, |
|||
sum(member.project_response_count) project_response_count, |
|||
sum(member.project_transfer_count) project_transfer_count, |
|||
sum(member.project_closed_count) project_closed_count |
|||
FROM fact_grid_member_statistics_daily member |
|||
inner join (select max(mt.DATE_ID) latest_date |
|||
from fact_grid_member_statistics_daily mt |
|||
where mt.STAFF_ID = #{staffId} and mt.del_flag=0) latest_record |
|||
on (member.DATE_ID = latest_record.latest_date) |
|||
WHERE member.STAFF_ID = #{staffId} |
|||
and member.DEL_FLAG = 0 |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -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; |
|||
} |
@ -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; |
|||
} |
@ -0,0 +1,62 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.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; |
|||
|
|||
} |
@ -0,0 +1,181 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.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; |
|||
|
|||
} |
@ -0,0 +1,146 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.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; |
|||
|
|||
} |
@ -0,0 +1,61 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.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; |
|||
|
|||
} |
@ -0,0 +1,137 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.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; |
|||
|
|||
} |
@ -0,0 +1,122 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.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; |
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -0,0 +1,147 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.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; |
|||
|
|||
} |
@ -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(); |
|||
} |
|||
} |
@ -0,0 +1,34 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.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<FactGridMemberStatisticsDailyEntity> { |
|||
int deleteDataByCustomer(@Param("customerId") String customerId, @Param("dateId") String dateId, @Param("deleteSize") Integer deleteSize); |
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.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<FactGridMemberStatisticsMonthlyEntity> { |
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.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<CustomerStaffGridEntity> { |
|||
|
|||
List<CustomerGridStaffDTO> selectGridStaffList(StaffPatrolStatsFormDTO formDTO); |
|||
} |
@ -0,0 +1,41 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.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<StatsStaffPatrolRecordDailyEntity> { |
|||
|
|||
Integer insertBatch(@Param("list") List<StatsStaffPatrolRecordDailyDTO> insertList); |
|||
|
|||
int delete(StaffPatrolStatsFormDTO formDTO); |
|||
} |
@ -0,0 +1,151 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.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; |
|||
|
|||
} |
@ -0,0 +1,116 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.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; |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.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; |
|||
} |
@ -0,0 +1,116 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.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; |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.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); |
|||
|
|||
} |
@ -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<String> 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<CustomerGridStaffDTO> 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<CustomerGridStaffDTO> allGridMembers) { |
|||
log.info("reloadStaffPatrolStatsData param:{}",JSON.toJSONString(formDTO)); |
|||
//获取昨日的巡查统计记录
|
|||
|
|||
//遍历网格员重新初始化数据
|
|||
List<StatsStaffPatrolRecordDailyDTO> insertList = buildInitPatrolStatsData(formDTO, allGridMembers); |
|||
|
|||
Map<String, StatsStaffPatrolRecordDailyDTO> yesterdayStatsMap = insertList.stream().collect(Collectors.toMap(o -> o.getGridId() + o.getStaffId(), o -> o, (o1, o2) -> o1)); |
|||
//获取昨日的巡查记录
|
|||
List<StaffPatrolRecordResult> yesterdayPatrolList = userService.selectStaffPatrolListByDateId(formDTO.getCustomerId(), formDTO.getDateId()); |
|||
|
|||
//获取昨日的立项项目数
|
|||
List<ProjectDTO> 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<CustomerGridStaffDTO> allGridMembers) { |
|||
log.info("initStaffPatrolTodayData param:{}",JSON.toJSONString(formDTO)); |
|||
List<StatsStaffPatrolRecordDailyDTO> insertList = buildInitPatrolStatsData(formDTO, allGridMembers); |
|||
Integer effectRow = statsStaffPatrolService.delAndInsertBatch(formDTO, insertList); |
|||
log.debug("initStaffPatrolStats insert rows:{}", effectRow); |
|||
} |
|||
|
|||
@NotNull |
|||
private List<StatsStaffPatrolRecordDailyDTO> buildInitPatrolStatsData(StaffPatrolStatsFormDTO formDTO, List<CustomerGridStaffDTO> allGridMembers) { |
|||
List<StatsStaffPatrolRecordDailyDTO> lastStaffPatrolList = userService.selectLastStaffPatrolList(formDTO); |
|||
Map<String, StatsStaffPatrolRecordDailyDTO> lastPatrolMap = lastStaffPatrolList.stream().collect(Collectors.toMap(o -> o.getGridId() + o.getStaffId(), o -> o, (o1, o2) -> o1)); |
|||
//构建数据 插入
|
|||
List<StatsStaffPatrolRecordDailyDTO> 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<CustomerGridStaffDTO> getAllGridMembers(StaffPatrolStatsFormDTO formDTO) { |
|||
//获取所有的网格员
|
|||
//1.获取所有网格用户
|
|||
List<CustomerGridStaffDTO> allStaffList = customerStaffService.selectStaffGridList(formDTO); |
|||
if (CollectionUtils.isEmpty(allStaffList)) { |
|||
log.warn("reloadStaffPatrolStats customerId:{} have any staff,param:{}", formDTO.getCustomerId(), JSON.toJSONString(formDTO)); |
|||
return allStaffList; |
|||
} |
|||
//获取所有含有网格员角色的用户
|
|||
List<CustomerStaffDTO> gridMemberList = userService.selectUserListByRoleKey(formDTO); |
|||
if (CollectionUtils.isEmpty(gridMemberList)) { |
|||
log.warn("reloadStaffPatrolStats customerId:{} have any gridMembers,param:{}", formDTO.getCustomerId(), JSON.toJSONString(formDTO)); |
|||
return allStaffList; |
|||
} |
|||
List<CustomerGridStaffDTO> 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<String> daysBetween = null; |
|||
if (isRange) { |
|||
daysBetween = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate()); |
|||
} |
|||
List<String> 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); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
} |
@ -0,0 +1,41 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.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<FactGridMemberStatisticsDailyEntity> { |
|||
/** |
|||
* 网格员数据统计 |
|||
* |
|||
* @param customerId |
|||
* @param dateId |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2021/7/5 9:29 |
|||
*/ |
|||
void extractGridMemberStatisticsDaily(String customerId, String dateId); |
|||
|
|||
} |
@ -0,0 +1,31 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.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<FactGridMemberStatisticsMonthlyEntity> { |
|||
|
|||
} |
@ -0,0 +1,407 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.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<FactGridMemberStatisticsDailyDao, FactGridMemberStatisticsDailyEntity> 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<CustomerStaffGridDTO> staffGridList = customerGridService.getCustomerStaffGridList(customerId); |
|||
List<StaffRoleInfoDTO> staffInfoList = userService.getStaffByRoleKey(customerId, RoleKeyConstants.ROLE_KEY_GRID_MEMBER); |
|||
if (CollectionUtils.isEmpty(staffGridList) || CollectionUtils.isEmpty(staffInfoList)) { |
|||
return; |
|||
} |
|||
Map<String, StaffRoleInfoDTO> staffMap = staffInfoList.stream().collect(Collectors.toMap(StaffRoleInfoDTO :: getStaffId, |
|||
Function.identity())); |
|||
List<FactGridMemberStatisticsDailyEntity> 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<String, List<OrgStatisticsResultDTO>> projectCountMap = getGridMemberData.getProjectCountMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> projectIncrMap = getGridMemberData.getProjectIncrMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> issueToProjectCountMap = getGridMemberData.getIssueToProjectCountMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> issueToProjectIncrMap = getGridMemberData.getIssueToProjectIncrMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> closedIssueCountMap = getGridMemberData.getClosedIssueCountMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> closedIssueIncrMap = getGridMemberData.getClosedIssueIncrMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> projectResponseCountMap = getGridMemberData.getProjectResponseCountMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> projectResponseIncrMap = getGridMemberData.getProjectResponseIncrMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> projectTransferCountMap = getGridMemberData.getProjectTransferCountMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> projectTransferIncrMap = getGridMemberData.getProjectTransferIncrMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> projectClosedCountMap = getGridMemberData.getProjectClosedCountMap(); |
|||
Map<String, List<OrgStatisticsResultDTO>> 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<String, List<OrgStatisticsResultDTO>> projectCountMap, Map<String, List<OrgStatisticsResultDTO>> projectIncrMap, |
|||
Map<String, List<OrgStatisticsResultDTO>> issueToProjectCountMap, Map<String, List<OrgStatisticsResultDTO>> issueToProjectIncrMap, |
|||
Map<String, List<OrgStatisticsResultDTO>> closedIssueCountMap, Map<String, List<OrgStatisticsResultDTO>> closedIssueIncrMap, |
|||
Map<String, List<OrgStatisticsResultDTO>> projectResponseCountMap, Map<String, List<OrgStatisticsResultDTO>> projectResponseIncrMap, |
|||
Map<String, List<OrgStatisticsResultDTO>> projectTransferCountMap, Map<String, List<OrgStatisticsResultDTO>> projectTransferIncrMap, |
|||
Map<String, List<OrgStatisticsResultDTO>> projectClosedCountMap, Map<String, List<OrgStatisticsResultDTO>> projectClosedIncrMap, |
|||
FactGridMemberStatisticsDailyEntity item) { |
|||
//项目立项数
|
|||
List<OrgStatisticsResultDTO> projectCount = projectCountMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(projectCount)) { |
|||
projectCount.forEach(dto -> { |
|||
if (item.getAgencyId().equals(dto.getAgencyId())) { |
|||
item.setProjectCount(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//项目立项日增量
|
|||
List<OrgStatisticsResultDTO> projectIncr = projectIncrMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(projectIncr)) { |
|||
projectIncr.forEach(dto -> { |
|||
if (item.getAgencyId().equals(dto.getAgencyId())) { |
|||
item.setProjectIncr(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//议题转项目数
|
|||
List<OrgStatisticsResultDTO> issueToProjectCount = issueToProjectCountMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(issueToProjectCount)) { |
|||
issueToProjectCount.forEach(dto -> { |
|||
if (item.getGridId().equals(dto.getOrgId())) { |
|||
item.setIssueToProjectCount(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//议题转项目日增量
|
|||
List<OrgStatisticsResultDTO> issueToProjectIncr = issueToProjectIncrMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(issueToProjectIncr)) { |
|||
issueToProjectIncr.forEach(dto -> { |
|||
if (item.getGridId().equals(dto.getOrgId())) { |
|||
item.setIssueToProjectIncr(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//议题关闭数
|
|||
List<OrgStatisticsResultDTO> closedIssueCount = closedIssueCountMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(closedIssueCount)) { |
|||
closedIssueCount.forEach(dto -> { |
|||
if (item.getGridId().equals(dto.getOrgId())) { |
|||
item.setClosedIssueCount(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//议题关闭数日增量
|
|||
List<OrgStatisticsResultDTO> closedIssueIncr = closedIssueIncrMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(closedIssueIncr)) { |
|||
closedIssueIncr.forEach(dto -> { |
|||
if (item.getGridId().equals(dto.getOrgId())) { |
|||
item.setClosedIssueIncr(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//项目响应数
|
|||
List<OrgStatisticsResultDTO> projectResponseCount = projectResponseCountMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(projectResponseCount)) { |
|||
projectResponseCount.forEach(dto -> { |
|||
if (item.getGridId().equals(dto.getOrgId())) { |
|||
item.setProjectResponseCount(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//项目响应数日增量
|
|||
List<OrgStatisticsResultDTO> projectResponseIncr = projectResponseIncrMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(projectResponseIncr)) { |
|||
projectResponseIncr.forEach(dto -> { |
|||
if (item.getGridId().equals(dto.getOrgId())) { |
|||
item.setProjectResponseIncr(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//项目吹哨数
|
|||
List<OrgStatisticsResultDTO> projectTransferCount = projectTransferCountMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(projectTransferCount)) { |
|||
projectTransferCount.forEach(dto -> { |
|||
if (item.getGridId().equals(dto.getOrgId())) { |
|||
item.setProjectTransferCount(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//项目吹哨数日增量
|
|||
List<OrgStatisticsResultDTO> projectTransferIncr = projectTransferIncrMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(projectTransferIncr)) { |
|||
projectTransferIncr.forEach(dto -> { |
|||
if (item.getGridId().equals(dto.getOrgId())) { |
|||
item.setProjectTransferIncr(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//项目响应数
|
|||
List<OrgStatisticsResultDTO> projectClosedCount = projectClosedCountMap.get(item.getStaffId()); |
|||
if (CollectionUtils.isNotEmpty(projectClosedCount)) { |
|||
projectClosedCount.forEach(dto -> { |
|||
if (item.getGridId().equals(dto.getOrgId())) { |
|||
item.setProjectClosedCount(dto.getCount()); |
|||
} |
|||
}); |
|||
} |
|||
//项目响应数日增量
|
|||
List<OrgStatisticsResultDTO> 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<String, List<OrgStatisticsResultDTO>> projectCountMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> projectIncrMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> issueToProjectCountMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> issueToProjectIncrMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> closedIssueCountMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> closedIssueIncrMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> projectResponseCountMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> projectResponseIncrMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> projectTransferCountMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> projectTransferIncrMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> projectClosedCountMap; |
|||
private Map<String, List<OrgStatisticsResultDTO>> projectClosedIncrMap; |
|||
|
|||
GetGridMemberData(String customerId, String dateId) { |
|||
this.customerId = customerId; |
|||
this.dateId = dateId; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getProjectCountMap() { |
|||
return projectCountMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getProjectIncrMap() { |
|||
return projectIncrMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getIssueToProjectCountMap() { |
|||
return issueToProjectCountMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getIssueToProjectIncrMap() { |
|||
return issueToProjectIncrMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getClosedIssueCountMap() { |
|||
return closedIssueCountMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getClosedIssueIncrMap() { |
|||
return closedIssueIncrMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getProjectResponseCountMap() { |
|||
return projectResponseCountMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getProjectResponseIncrMap() { |
|||
return projectResponseIncrMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getProjectTransferCountMap() { |
|||
return projectTransferCountMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getProjectTransferIncrMap() { |
|||
return projectTransferIncrMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> getProjectClosedCountMap() { |
|||
return projectClosedCountMap; |
|||
} |
|||
|
|||
Map<String, List<OrgStatisticsResultDTO>> 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; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.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<FactGridMemberStatisticsMonthlyDao, FactGridMemberStatisticsMonthlyEntity> implements FactGridMemberStatisticsMonthlyService { |
|||
|
|||
|
|||
} |
@ -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<com.epmet.dto.org.GridInfoDTO> |
|||
* @author LiuJanJun |
|||
* @date 2021/6/29 3:13 下午 |
|||
*/ |
|||
List<CustomerGridStaffDTO> selectStaffGridList(StaffPatrolStatsFormDTO formDTO); |
|||
} |
@ -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<com.epmet.dto.org.GridInfoDTO> |
|||
* @author LiuJanJun |
|||
* @date 2021/6/29 3:13 下午 |
|||
*/ |
|||
@Override |
|||
public List<CustomerGridStaffDTO> selectStaffGridList(StaffPatrolStatsFormDTO formDTO) { |
|||
return customerStaffGridDao.selectGridStaffList(formDTO); |
|||
} |
|||
} |
@ -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<StatsStaffPatrolRecordDailyDTO> insertList); |
|||
|
|||
List<StatsStaffPatrolRecordDailyDTO> selectData(String customerId, String yesterdayStr); |
|||
} |
@ -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<StatsStaffPatrolRecordDailyDTO> insertList) { |
|||
int delete = statsStaffPatrolRecordDailyDao.delete(formDTO); |
|||
log.debug("delAndInsertBatch delete:{},param:{}", delete, JSON.toJSONString(formDTO)); |
|||
return statsStaffPatrolRecordDailyDao.insertBatch(insertList); |
|||
} |
|||
|
|||
@Override |
|||
public List<StatsStaffPatrolRecordDailyDTO> selectData(String customerId, String yesterdayStr) { |
|||
LambdaQueryWrapper<StatsStaffPatrolRecordDailyEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(StatsStaffPatrolRecordDailyEntity::getCustomerId, customerId) |
|||
.eq(StatsStaffPatrolRecordDailyEntity::getDateId, yesterdayStr); |
|||
List<StatsStaffPatrolRecordDailyEntity> list = statsStaffPatrolRecordDailyDao.selectList(queryWrapper); |
|||
return ConvertUtils.sourceToTarget(list, StatsStaffPatrolRecordDailyDTO.class); |
|||
} |
|||
} |
@ -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`; |
@ -0,0 +1,39 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.evaluationindex.extract.FactGridMemberStatisticsDailyDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsDailyEntity" id="factGridMemberStatisticsDailyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="dateId" column="DATE_ID"/> |
|||
<result property="monthId" column="MONTH_ID"/> |
|||
<result property="yearId" column="YEAR_ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="pid" column="PID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="staffId" column="STAFF_ID"/> |
|||
<result property="staffName" column="STAFF_NAME"/> |
|||
<result property="projectCount" column="PROJECT_COUNT"/> |
|||
<result property="issueToProjectCount" column="ISSUE_TO_PROJECT_COUNT"/> |
|||
<result property="closedIssueCount" column="CLOSED_ISSUE_COUNT"/> |
|||
<result property="projectResponseCount" column="PROJECT_RESPONSE_COUNT"/> |
|||
<result property="projectTransferCount" column="PROJECT_TRANSFER_COUNT"/> |
|||
<result property="projectClosedCount" column="PROJECT_CLOSED_COUNT"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
<delete id="deleteDataByCustomer"> |
|||
delete from fact_grid_member_statistics_daily |
|||
where CUSTOMER_ID = #{customerId} |
|||
AND DATE_ID = #{dateId} |
|||
limit #{deleteSize} |
|||
</delete> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,32 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.evaluationindex.extract.FactGridMemberStatisticsMonthlyDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.evaluationindex.extract.FactGridMemberStatisticsMonthlyEntity" id="factGridMemberStatisticsMonthlyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="monthId" column="MONTH_ID"/> |
|||
<result property="yearId" column="YEAR_ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="pid" column="PID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="staffId" column="STAFF_ID"/> |
|||
<result property="staffName" column="STAFF_NAME"/> |
|||
<result property="projectCount" column="PROJECT_COUNT"/> |
|||
<result property="issueToProjectCount" column="ISSUE_TO_PROJECT_COUNT"/> |
|||
<result property="closedIssueCount" column="CLOSED_ISSUE_COUNT"/> |
|||
<result property="projectResponseCount" column="PROJECT_RESPONSE_COUNT"/> |
|||
<result property="projectTransferCount" column="PROJECT_TRANSFER_COUNT"/> |
|||
<result property="projectClosedCount" column="PROJECT_CLOSED_COUNT"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,31 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.org.CustomerStaffGridDao"> |
|||
|
|||
|
|||
|
|||
<!--排除掉pid为空的人--> |
|||
<select id="selectGridStaffList" resultType="com.epmet.dto.user.result.CustomerGridStaffDTO"> |
|||
SELECT * FROM ( |
|||
SELECT |
|||
sg.customer_id, |
|||
sg.grid_id, |
|||
sg.user_id, |
|||
grid.PID agencyId, |
|||
grid.PIDS gridPids |
|||
FROM |
|||
customer_staff_grid sg |
|||
LEFT JOIN customer_grid grid ON grid.id = sg.grid_id |
|||
WHERE |
|||
sg.del_flag = '0' |
|||
|
|||
<if test="customerId != null and customerId != ''"> |
|||
AND sg.customer_id = #{customerId} |
|||
</if> |
|||
<if test="gridId != null and gridId != ''"> |
|||
AND sg.GRID_ID = #{gridId} |
|||
</if> |
|||
) t WHERE t.agencyId IS NOT NULL |
|||
</select> |
|||
</mapper> |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue