Browse Source

小组组织活动按天累计值统计

dev_shibei_match
yinzuomei 5 years ago
parent
commit
b666def708
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java
  2. 70
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/ActCategoryDictDTO.java
  3. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  4. 38
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActDailyDao.java
  5. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActMonthlyDao.java
  6. 28
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java
  7. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  8. 100
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGroupActDailyEntity.java
  9. 100
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGroupActMonthlyEntity.java
  10. 48
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGroupActDailyService.java
  11. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGroupActMonthlyService.java
  12. 165
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGroupActDailyServiceImpl.java
  13. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGroupActMonthlyServiceImpl.java
  14. 42
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java
  15. 30
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java
  16. 53
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java
  17. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
  18. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
  19. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGroupActDailyDao.xml
  20. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGroupActMonthlyDao.xml
  21. 61
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml
  22. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java

@ -8,6 +8,7 @@
package com.epmet.commons.tools.constant;
/**
* 常量
*
@ -133,4 +134,6 @@ public interface Constant {
* 创建时间字段名
*/
String CREATED_TIME = "created_time";
String DEFAULT_CUSTOMER = "default";
}

70
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/ActCategoryDictDTO.java

@ -0,0 +1,70 @@
/**
* 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.group;
import lombok.Data;
import java.io.Serializable;
/**
* 活动类别字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-16
*/
@Data
public class ActCategoryDictDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 类别编码
*/
private String categoryCode;
/**
* 活动类别名称eg支部建设联建共建
*/
private String categoryName;
/**
* 等级1,2......
*/
private Integer level;
/**
* 排序
*/
private Integer sort;
/**
* 上级类别编码
*/
private String parentCode;
}

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

@ -35,6 +35,7 @@ import com.epmet.entity.stats.DimDateEntity;
import com.epmet.entity.stats.DimMonthEntity;
import com.epmet.service.StatsDemoService;
import com.epmet.service.evaluationindex.extract.dataToIndex.*;
import com.epmet.service.evaluationindex.extract.todata.FactGroupActDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService;
import com.epmet.service.evaluationindex.extract.toscreen.*;
@ -109,6 +110,8 @@ public class DemoController {
private ScreenProjectCategoryGridDailyService projectCategoryGridDailyService;
@Autowired
private FactOriginProjectCategoryDailyService originProjectCategoryDailyService;
@Autowired
private FactGroupActDailyService factGroupActDailyService;
@GetMapping("testAlarm")
public void testAlarm() {
@ -870,4 +873,10 @@ public class DemoController {
return new Result().ok(ndddYhjfService.difficultyDataExtract(param));
}
@PostMapping("extractgroupact")
public Result extractGroupAct(@RequestParam("customerId") String customerId,@RequestParam("dateId")String dateId){
factGroupActDailyService.extractGridGroupActDaily(customerId,dateId);
factGroupActDailyService.extractAgencyGroupActDaily(customerId,dateId);
return new Result();
}
}

38
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActDailyDao.java

@ -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.evaluationindex.extract;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 组织活动(参加人数组织次数平均参加人数)按天累计值分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
@Mapper
public interface FactGroupActDailyDao extends BaseDao<FactGroupActDailyEntity> {
int deleteBatch(@Param("customerId") String customerId,
@Param("dateId") String dateId,
@Param("limit") Integer limit,
@Param("orgType")String orgType);
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActMonthlyDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.evaluationindex.extract;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.extract.FactGroupActMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 专项组活动(参加人数组织次数平均参加人数)按月增量分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
@Mapper
public interface FactGroupActMonthlyDao extends BaseDao<FactGroupActMonthlyEntity> {
}

28
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java

@ -1,6 +1,7 @@
package com.epmet.dao.group;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.group.ActCategoryDictDTO;
import com.epmet.dto.group.form.GridGroupPeopleFormDTO;
import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO;
import com.epmet.dto.group.form.GridGroupTotalFormDTO;
@ -8,6 +9,7 @@ import com.epmet.dto.group.form.GroupIncrFormDTO;
import com.epmet.dto.group.result.*;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
import com.epmet.dto.indexcollect.result.GridIndexCommonDTO;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -110,4 +112,30 @@ public interface GroupDataDao {
* @return com.epmet.dto.indexcollect.result.CpcIndexCommonDTO
*/
List<GridIndexCommonDTO> selectCountGridCreateThreeMeets(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* 网格相关组织三会一课次数 当前网格下 满足未取消的活动 and 签到记录>1 and 活动开始时间在当前时间维度内 +1
*
* @param customerId
* @return com.epmet.dto.group.ActCategoryDictDTO
*/
List<ActCategoryDictDTO> queryCustomerActCategoryDict(String customerId);
/**
* 查询某个分类截止到dateId,组织次数参与人数平均参与人数
*
* @param customerId
* @param dateId
* @param categoryCode
* @return com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity
*/
List<FactGroupActDailyEntity> selectCountGridGroupActDaily(@Param("customerId") String customerId,
@Param("dateId") String dateId,
@Param("categoryCode") String categoryCode,
@Param("gridId")String gridId);
List<FactGroupActDailyEntity> selectCountAgencyGroupActDaily(@Param("customerId") String customerId,
@Param("agencyId")String agencyId,
@Param("dateId") String dateId,
@Param("categoryCode") String categoryCode);
}

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

@ -33,4 +33,6 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<CustomerAreaCodeResultDTO> selectCustomerAreaCodeById(@Param("customerIds") List<String> customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
List<CustomerAgencyEntity> queryAgencyListByCustomerId(String customerId);
}

100
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGroupActDailyEntity.java

@ -0,0 +1,100 @@
/**
* 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;
/**
* 组织活动(参加人数组织次数平均参加人数)按天累计值分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_group_act_daily")
public class FactGroupActDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 数据更新至日期IdyyyyMMdd
*/
private String dateId;
/**
* 网格id
*/
private String orgId;
/**
* 网格grid;组织agency
*/
private String orgType;
/**
* 1)orgType=grid: pid=网格所属组织id;
2)orgType=agency pid=当前组织的上级组织
*/
private String pid;
/**
* 1)orgType=grid: pids=网格所有上级组织包括pid;
2)orgType=agency pids=当前组织的所有上级组织包括pid.
*/
private String pids;
/**
* 活动分类编码
*/
private String categoryCode;
/**
* 上级分类编码
*/
private String parentCode;
/**
* 分类等级
*/
private Integer level;
/**
* 截止到dateId: 组织次数;包含dateId这一天的数据
*/
private Integer organizeTotal;
/**
* 截止到dateId: 参加人数;包含dateId这一天的数据
*/
private Integer participateUserTotal;
/**
* 截止到dateId: 平均参加人数;包含dateId这一天的数据
*/
private Integer avgParticipateUserTotal;
}

100
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGroupActMonthlyEntity.java

@ -0,0 +1,100 @@
/**
* 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;
/**
* 专项组活动(参加人数组织次数平均参加人数)按月增量分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_group_act_monthly")
public class FactGroupActMonthlyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 数据维度yyyyMM
*/
private String monthId;
/**
* 网格id
*/
private String orgId;
/**
* 网格grid;组织agency
*/
private String orgType;
/**
* 1)orgType=grid: pid=网格所属组织id;
2)orgType=agency pid=当前组织的上级组织
*/
private String pid;
/**
* 1)orgType=grid: pids=网格所有上级组织包括pid;
2)orgType=agency pids=当前组织的所有上级组织包括pid.
*/
private String pids;
/**
* 活动分类编码
*/
private String categoryCode;
/**
* 上级分类编码
*/
private String parentCode;
/**
* 分类等级
*/
private Integer level;
/**
* 本月内活动组织次数
*/
private Integer organizeIncr;
/**
* 本月内活动签到人数参加人数
*/
private Integer participateUserIncr;
/**
* 本月内平均参加人数
*/
private Integer avgParticipateUserIncr;
}

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

@ -0,0 +1,48 @@
/**
* 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.FactGroupActDailyEntity;
/**
* 组织活动(参加人数组织次数平均参加人数)按天累计值分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
public interface FactGroupActDailyService extends BaseService<FactGroupActDailyEntity> {
/**
* 当前客户截止到dateId,网格下 各个分类的 参加人数组织次数平均参加人数
*
* @param customerId
* @param dateId
* @return
*/
void extractGridGroupActDaily(String customerId, String dateId);
/**
* 当前客户截止到dateId,组织下 各个分类的 参加人数组织次数平均参加人数
*
* @param customerId
* @param dateId
* @return
*/
void extractAgencyGroupActDaily(String customerId, String dateId);
}

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

@ -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.FactGroupActMonthlyEntity;
/**
* 专项组活动(参加人数组织次数平均参加人数)按月增量分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
public interface FactGroupActMonthlyService extends BaseService<FactGroupActMonthlyEntity> {
}

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

@ -0,0 +1,165 @@
/**
* 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.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.extract.FactGroupActDailyDao;
import com.epmet.dto.group.ActCategoryDictDTO;
import com.epmet.dto.org.GridInfoDTO;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.service.evaluationindex.extract.todata.FactGroupActDailyService;
import com.epmet.service.group.GroupDataService;
import com.epmet.service.org.CustomerAgencyService;
import com.epmet.service.org.CustomerGridService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 组织活动(参加人数组织次数平均参加人数)按天累计值分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
@Slf4j
@DataSource(DataSourceConstant.STATS)
@Service
public class FactGroupActDailyServiceImpl extends BaseServiceImpl<FactGroupActDailyDao, FactGroupActDailyEntity> implements FactGroupActDailyService {
@Autowired
private GroupDataService groupDataService;
@Autowired
private CustomerAgencyService customerAgencyService;
@Autowired
private CustomerGridService customerGridService;
/**
* 当前客户截止到dateId,网格下 各个分类的 参加人数组织次数平均参加人数
*
* @param customerId
* @param dateId
* @return
*/
@Override
public void extractGridGroupActDaily(String customerId, String dateId) {
if(StringUtils.isBlank(customerId)||StringUtils.isBlank(dateId)){
return;
}
// 1、查询出当前客户的组织分类;如果没有直接返回
List<ActCategoryDictDTO> actCategoryDictDTOList = groupDataService.queryCustomerActCategoryDict(customerId);
if (CollectionUtils.isEmpty(actCategoryDictDTOList)) {
return;
}
// 2、当前客户下所有的网格
List<GridInfoDTO> gridInfoDTOList=customerGridService.queryGridInfoList(customerId);
// 2、遍历每个分类,查询组织次数、参与人数、平均参与人数
List<FactGroupActDailyEntity> insertList = new ArrayList<>();
for(GridInfoDTO gridInfoDTO:gridInfoDTOList){
for (ActCategoryDictDTO actCategoryDictDTO : actCategoryDictDTOList) {
List<FactGroupActDailyEntity> list = groupDataService.selectCountGridGroupActDaily(customerId, dateId, actCategoryDictDTO.getCategoryCode(),gridInfoDTO.getGridId());
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(dto->{
dto.setCategoryCode(actCategoryDictDTO.getCategoryCode());
dto.setParentCode(actCategoryDictDTO.getParentCode());
dto.setLevel(actCategoryDictDTO.getLevel());
dto.setOrgType("grid");
dto.setDateId(dateId);
});
insertList.addAll(list);
}
}
}
// 3、批量删除
int deleteNum;
do {
deleteNum = baseDao.deleteBatch(customerId, dateId, NumConstant.TWO_HUNDRED,"grid");
} while (deleteNum > NumConstant.ZERO);
// 4、插入数据
insertList.forEach(insertEntity -> {
baseDao.insert(insertEntity);
});
log.info("extractGridGroupActDaily completed");
}
/**
* 当前客户截止到dateId,组织下 各个分类的 参加人数组织次数平均参加人数
*
* @param customerId
* @param dateId
* @return
*/
@Override
public void extractAgencyGroupActDaily(String customerId, String dateId) {
// 1、查询出当前客户的组织分类;如果没有直接返回
List<ActCategoryDictDTO> actCategoryDictDTOList = groupDataService.queryCustomerActCategoryDict(customerId);
if (CollectionUtils.isEmpty(actCategoryDictDTOList)) {
return;
}
// 2、当前客户下所有的组织
List<CustomerAgencyEntity> agencyEntityList=customerAgencyService.queryAgencyListByCustomerId(customerId);
List<FactGroupActDailyEntity> insertList = new ArrayList<>();
for(CustomerAgencyEntity agencyEntity:agencyEntityList){
for(ActCategoryDictDTO categoryDict:actCategoryDictDTOList){
List<FactGroupActDailyEntity> list = groupDataService.selectCountAgencyGroupActDaily(customerId,
agencyEntity.getId(),
dateId,
categoryDict.getCategoryCode());
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(dto->{
dto.setCategoryCode(categoryDict.getCategoryCode());
dto.setParentCode(categoryDict.getParentCode());
dto.setLevel(categoryDict.getLevel());
dto.setOrgId(agencyEntity.getId());
dto.setOrgType("agency");
dto.setPid(agencyEntity.getPid());
dto.setPids(agencyEntity.getPids());
dto.setDateId(dateId);
});
insertList.addAll(list);
}
}
}
// 3、批量删除
int deleteNum;
do {
deleteNum = baseDao.deleteBatch(customerId, dateId, NumConstant.TWO_HUNDRED,"agency");
} while (deleteNum > NumConstant.ZERO);
// 4、插入数据
insertList.forEach(insertEntity->{
baseDao.insert(insertEntity);
});
log.info("extractAgencyGroupActDaily completed");
}
}

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

@ -0,0 +1,41 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.evaluationindex.extract.todata.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.extract.FactGroupActMonthlyDao;
import com.epmet.entity.evaluationindex.extract.FactGroupActMonthlyEntity;
import com.epmet.service.evaluationindex.extract.todata.FactGroupActMonthlyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 专项组活动(参加人数组织次数平均参加人数)按月增量分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
@DataSource(DataSourceConstant.STATS)
@Slf4j
@Service
public class FactGroupActMonthlyServiceImpl extends BaseServiceImpl<FactGroupActMonthlyDao, FactGroupActMonthlyEntity> implements FactGroupActMonthlyService {
}

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

@ -48,6 +48,9 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService {
private DimCustomerPartymemberService dimCustomerPartymemberService;
@Autowired
private FactOriginProjectCategoryDailyService originProjectCategoryDailyService;
@Autowired
private FactGroupActDailyService factGroupActDailyService;
@Override
public void extractAll(ExtractOriginFormDTO extractOriginFormDTO) {
@ -188,6 +191,45 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService {
}
}
});
//小组活动
threadPool.submit(() -> {
ExtractOriginFormDTO extractOriginFormDTO = ConvertUtils.sourceToTarget(param, ExtractOriginFormDTO.class);
if (!isRange) {
//截止到当前dateId
try {
factGroupActDailyService.extractGridGroupActDaily(extractOriginFormDTO.getCustomerId(), extractOriginFormDTO.getDateId());
} catch (Exception e) {
log.error("抽取【fact_group_act_daily】发生异常,参数:" + JSON.toJSONString(extractOriginFormDTO), e);
}
try {
factGroupActDailyService.extractAgencyGroupActDaily(extractOriginFormDTO.getCustomerId(), extractOriginFormDTO.getDateId());
} catch (Exception e) {
log.error("抽取【fact_group_act_daily】发生异常,参数:" + JSON.toJSONString(extractOriginFormDTO), e);
}
} else {
//参数指定日期内,比如startDate=20210501,endDate=20210513;依次计算截止到20210501的数据.....截止到20210513的数据
try {
for (int i = 0; i < finalDaysBetween.size(); i++) {
String dateDimId = finalDaysBetween.get(i);
extractOriginFormDTO.setDateId(dateDimId);
factGroupActDailyService.extractGridGroupActDaily(extractOriginFormDTO.getCustomerId(), extractOriginFormDTO.getDateId());
}
} catch (Exception e) {
log.error("抽取【fact_group_act_daily】发生异常,参数:" + JSON.toJSONString(extractOriginFormDTO), e);
}
try {
for (int i = 0; i < finalDaysBetween.size(); i++) {
String dateDimId = finalDaysBetween.get(i);
extractOriginFormDTO.setDateId(dateDimId);
factGroupActDailyService.extractAgencyGroupActDaily(extractOriginFormDTO.getCustomerId(), extractOriginFormDTO.getDateId());
}
} catch (Exception e) {
log.error("抽取【fact_group_act_daily】发生异常,参数:" + JSON.toJSONString(extractOriginFormDTO), e);
}
}
});
submitProjectRelationData(param, finalDaysBetween);
}

30
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java

@ -1,9 +1,11 @@
package com.epmet.service.group;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.group.ActCategoryDictDTO;
import com.epmet.dto.group.result.*;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
import com.epmet.dto.indexcollect.result.GridIndexCommonDTO;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
import com.epmet.util.DimIdGenerator;
import org.apache.ibatis.annotations.Param;
@ -85,4 +87,32 @@ public interface GroupDataService {
* @return com.epmet.dto.indexcollect.result.CpcIndexCommonDTO
*/
List<GridIndexCommonDTO> selectCountGridCreateThreeMeets(String customerId, String monthId);
/**
* 查询出当前客户的组织分类如果没有直接返回
*
* @param customerId
*/
List<ActCategoryDictDTO> queryCustomerActCategoryDict(String customerId);
/**
* 查询某个分类截止到dateId,组织次数参与人数平均参与人数
* 网格按天
* @param customerId
* @param dateId
* @param categoryCode
* @return com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity
*/
List<FactGroupActDailyEntity> selectCountGridGroupActDaily(String customerId, String dateId, String categoryCode,String gridId);
/**
* 查询某个分类截止到dateId,组织次数参与人数平均参与人数
* 组织按天
* @param customerId
* @param agencyId
* @param dateId
* @param categoryCode
* @return com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity
*/
List<FactGroupActDailyEntity> selectCountAgencyGroupActDaily(String customerId, String agencyId, String dateId, String categoryCode);
}

53
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java

@ -1,10 +1,12 @@
package com.epmet.service.group.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.group.GroupDataDao;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.group.ActCategoryDictDTO;
import com.epmet.dto.group.form.GridGroupPeopleFormDTO;
import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO;
import com.epmet.dto.group.form.GridGroupTotalFormDTO;
@ -12,8 +14,11 @@ import com.epmet.dto.group.form.GroupIncrFormDTO;
import com.epmet.dto.group.result.*;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
import com.epmet.dto.indexcollect.result.GridIndexCommonDTO;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
import com.epmet.service.group.GroupDataService;
import com.epmet.util.DimIdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -25,6 +30,7 @@ import java.util.stream.Collectors;
* @Author zxc
* @CreateTime 2020/6/16 13:23
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.RESI_GROUP)
public class GroupDataServiceImpl implements GroupDataService {
@ -235,5 +241,52 @@ public class GroupDataServiceImpl implements GroupDataService {
return groupDataDao.selectCountGridCreateThreeMeets(customerId,monthId);
}
/**
* 查询出当前客户的组织分类如果没有直接返回
*
* @param customerId
*/
@DataSource(DataSourceConstant.RESI_GROUP)
@Override
public List<ActCategoryDictDTO> queryCustomerActCategoryDict(String customerId) {
List<ActCategoryDictDTO> resultList=groupDataDao.queryCustomerActCategoryDict(customerId);
if(CollectionUtils.isNotEmpty(resultList)){
log.info("当前客户下有自己的项目分类");
return resultList;
}
log.info("----------------------------------------------------");
return groupDataDao.queryCustomerActCategoryDict(Constant.DEFAULT_CUSTOMER);
}
/**
* 查询某个分类截止到dateId,组织次数参与人数平均参与人数
*
* @param customerId
* @param dateId
* @param categoryCode
* @return
*/
@DataSource(DataSourceConstant.RESI_GROUP)
@Override
public List<FactGroupActDailyEntity> selectCountGridGroupActDaily(String customerId, String dateId, String categoryCode,String gridId) {
return groupDataDao.selectCountGridGroupActDaily(customerId,dateId,categoryCode,gridId);
}
/**
* 查询某个分类截止到dateId,组织次数参与人数平均参与人数
* 组织按天
*
* @param customerId
* @param agencyId
* @param dateId
* @param categoryCode
* @return com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity
*/
@DataSource(DataSourceConstant.RESI_GROUP)
@Override
public List<FactGroupActDailyEntity> selectCountAgencyGroupActDaily(String customerId, String agencyId, String dateId, String categoryCode) {
return groupDataDao.selectCountAgencyGroupActDaily(customerId,agencyId,dateId,categoryCode);
}
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

@ -20,4 +20,7 @@ public interface CustomerAgencyService {
List<CustomerAreaCodeResultDTO> selectCustomerAreaCodeById(List<String> customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
List<CustomerAgencyEntity> queryAgencyListByCustomerId(String customerId);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java

@ -50,4 +50,9 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
public CustomerAgencyEntity getRootAgencyInfo(String customerId) {
return customerAgencyDao.getRootAgencyInfo(customerId);
}
@Override
public List<CustomerAgencyEntity> queryAgencyListByCustomerId(String customerId) {
return customerAgencyDao.queryAgencyListByCustomerId(customerId);
}
}

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGroupActDailyDao.xml

@ -0,0 +1,15 @@
<?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.FactGroupActDailyDao">
<delete id="deleteBatch" parameterType="map">
delete from fact_group_act_daily
where CUSTOMER_ID = #{customerId}
AND DATE_ID = #{dateId}
and org_type=#{orgType}
limit #{limit}
</delete>
</mapper>

8
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGroupActMonthlyDao.xml

@ -0,0 +1,8 @@
<?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.FactGroupActMonthlyDao">
</mapper>

61
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml

@ -252,4 +252,65 @@
GROUP BY
ga.GRID_ID
</select>
<!-- 查询出当前客户的组织分类;如果没有直接返回 -->
<select id="queryCustomerActCategoryDict" resultType="com.epmet.dto.group.ActCategoryDictDTO">
SELECT
*
FROM
act_category_dict acd
WHERE
acd.DEL_FLAG = '0'
AND acd.CUSTOMER_ID = #{customerId}
ORDER BY
acd.`LEVEL` DESC,
acd.PARENT_CODE ASC,
acd.SORT ASC
</select>
<select id="selectCountGridGroupActDaily" parameterType="map" resultType="com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity">
SELECT
gai.CUSTOMER_ID AS customerId,
gai.GRID_ID AS orgId,
gai.AGENCY_ID AS pid,
gai.GRID_PIDS AS pids,
count(1) AS organizeTotal,
sum(gai.SIGNED_IN_NUM)as participateUserTotal,
round(sum(gai.SIGNED_IN_NUM)/count(1)) as avgParticipateUserTotal
FROM
group_act_info gai
WHERE
gai.DEL_FLAG = '0'
AND gai.CUSTOMER_ID = #{customerId}
AND gai.`STATUS` != 'canceled'
AND gai.SIGNED_IN_NUM > 0
and DATE_FORMAT(gai.CREATED_TIME,'%Y%m%d') &lt; #{dateId}
and gai.CATEGORY_CODE like concat(#{categoryCode},'%')
and gai.GRID_ID=#{gridId}
GROUP BY
gai.CUSTOMER_ID,
gai.GRID_ID,
gai.AGENCY_ID,
gai.GRID_PIDS
</select>
<select id="selectCountAgencyGroupActDaily" parameterType="map" resultType="com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity">
SELECT
gai.CUSTOMER_ID AS customerId,
count(1) AS organizeTotal,
sum(gai.SIGNED_IN_NUM)as participateUserTotal,
round(sum(gai.SIGNED_IN_NUM)/count(1)) as avgParticipateUserTotal
FROM
group_act_info gai
WHERE
gai.DEL_FLAG = '0'
AND gai.CUSTOMER_ID = #{customerId}
AND gai.`STATUS` != 'canceled'
AND gai.SIGNED_IN_NUM > 0
and gai.GRID_PIDS like concat('%',#{agencyId},'%')
and DATE_FORMAT(gai.CREATED_TIME,'%Y%m%d') &lt; #{dateId}
and gai.CATEGORY_CODE like concat(#{categoryCode},'%')
GROUP BY
gai.CUSTOMER_ID
</select>
</mapper>

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -125,4 +125,11 @@
and ca.pid='0'
and ca.CUSTOMER_ID=#{customerId}
</select>
<select id="queryAgencyListByCustomerId" parameterType="java.lang.String" resultType="com.epmet.entity.org.CustomerAgencyEntity">
select *
from customer_agency ca
where ca.del_flag='0'
and ca.CUSTOMER_ID=#{customerId}
</select>
</mapper>
Loading…
Cancel
Save