+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto.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;
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
index b47d3cc8ef..1037de6af4 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
@@ -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();
+ }
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActDailyDao.java
new file mode 100644
index 0000000000..37d3d4e144
--- /dev/null
+++ b/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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dao.evaluationindex.extract;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.evaluationindex.extract.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 {
+
+ int deleteBatch(@Param("customerId") String customerId,
+ @Param("dateId") String dateId,
+ @Param("limit") Integer limit,
+ @Param("orgType")String orgType);
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActMonthlyDao.java
new file mode 100644
index 0000000000..e7b179ef70
--- /dev/null
+++ b/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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dao.evaluationindex.extract;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.evaluationindex.extract.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 {
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java
index 80776d8798..2cbd65788c 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java
+++ b/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 selectCountGridCreateThreeMeets(@Param("customerId")String customerId, @Param("monthId")String monthId);
+
+ /**
+ * 网格相关:组织“三会一课”次数: 当前网格下 满足【未取消的活动 and 签到记录>1 and 活动开始时间在当前时间维度内】 +1
+ *
+ * @param customerId
+ * @return com.epmet.dto.group.ActCategoryDictDTO
+ */
+ List queryCustomerActCategoryDict(String customerId);
+
+ /**
+ * 查询某个分类截止到dateId,组织次数、参与人数、平均参与人数
+ *
+ * @param customerId
+ * @param dateId
+ * @param categoryCode
+ * @return com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity
+ */
+ List selectCountGridGroupActDaily(@Param("customerId") String customerId,
+ @Param("dateId") String dateId,
+ @Param("categoryCode") String categoryCode,
+ @Param("gridId")String gridId);
+
+ List selectCountAgencyGroupActDaily(@Param("customerId") String customerId,
+ @Param("agencyId")String agencyId,
+ @Param("dateId") String dateId,
+ @Param("categoryCode") String categoryCode);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
index 05a85d3d7c..aa0f78f087 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
+++ b/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 {
List selectCustomerAreaCodeById(@Param("customerIds") List customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
+
+ List queryAgencyListByCustomerId(String customerId);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGroupActDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGroupActDailyEntity.java
new file mode 100644
index 0000000000..f128f25d3c
--- /dev/null
+++ b/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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service.evaluationindex.extract.todata;
+
+import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
+
+/**
+ * 组织活动(参加人数、组织次数、平均参加人数)按天累计值分析
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-05-13
+ */
+public interface FactGroupActDailyService extends BaseService {
+
+ /**
+ * 当前客户截止到dateId,网格下 各个分类的 参加人数,组织次数,平均参加人数
+ *
+ * @param customerId
+ * @param dateId
+ * @return
+ */
+ void extractGridGroupActDaily(String customerId, String dateId);
+
+ /**
+ * 当前客户截止到dateId,组织下 各个分类的 参加人数,组织次数,平均参加人数
+ *
+ * @param customerId
+ * @param dateId
+ * @return
+ */
+ void extractAgencyGroupActDaily(String customerId, String dateId);
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGroupActMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGroupActMonthlyService.java
new file mode 100644
index 0000000000..1d7391b8b4
--- /dev/null
+++ b/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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service.evaluationindex.extract.todata;
+
+import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.entity.evaluationindex.extract.FactGroupActMonthlyEntity;
+
+/**
+ * 专项组活动(参加人数、组织次数、平均参加人数)按月增量分析
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-05-13
+ */
+public interface FactGroupActMonthlyService extends BaseService {
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGroupActDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGroupActDailyServiceImpl.java
new file mode 100644
index 0000000000..3212ad6dc0
--- /dev/null
+++ b/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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service.evaluationindex.extract.todata.impl;
+
+import com.epmet.commons.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 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 actCategoryDictDTOList = groupDataService.queryCustomerActCategoryDict(customerId);
+ if (CollectionUtils.isEmpty(actCategoryDictDTOList)) {
+ return;
+ }
+
+ // 2、当前客户下所有的网格
+ List gridInfoDTOList=customerGridService.queryGridInfoList(customerId);
+ // 2、遍历每个分类,查询组织次数、参与人数、平均参与人数
+ List insertList = new ArrayList<>();
+ for(GridInfoDTO gridInfoDTO:gridInfoDTOList){
+
+ for (ActCategoryDictDTO actCategoryDictDTO : actCategoryDictDTOList) {
+ List 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 actCategoryDictDTOList = groupDataService.queryCustomerActCategoryDict(customerId);
+ if (CollectionUtils.isEmpty(actCategoryDictDTOList)) {
+ return;
+ }
+ // 2、当前客户下所有的组织
+ List agencyEntityList=customerAgencyService.queryAgencyListByCustomerId(customerId);
+ List insertList = new ArrayList<>();
+ for(CustomerAgencyEntity agencyEntity:agencyEntityList){
+ for(ActCategoryDictDTO categoryDict:actCategoryDictDTOList){
+ List 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");
+ }
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGroupActMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGroupActMonthlyServiceImpl.java
new file mode 100644
index 0000000000..3cb14a7e31
--- /dev/null
+++ b/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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service.evaluationindex.extract.todata.impl;
+
+import com.epmet.commons.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 implements FactGroupActMonthlyService {
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java
index 1cd62fd24a..9b8a74548e 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java
+++ b/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);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java
index b1a07d9941..89cc949ea6 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java
+++ b/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 selectCountGridCreateThreeMeets(String customerId, String monthId);
+
+ /**
+ * 查询出当前客户的组织分类;如果没有直接返回
+ *
+ * @param customerId
+ */
+ List queryCustomerActCategoryDict(String customerId);
+
+ /**
+ * 查询某个分类截止到dateId,组织次数、参与人数、平均参与人数
+ * 网格按天
+ * @param customerId
+ * @param dateId
+ * @param categoryCode
+ * @return com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity
+ */
+ List 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 selectCountAgencyGroupActDaily(String customerId, String agencyId, String dateId, String categoryCode);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java
index d0a87ed295..a7a596ca10 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java
+++ b/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 queryCustomerActCategoryDict(String customerId) {
+ List 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 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 selectCountAgencyGroupActDaily(String customerId, String agencyId, String dateId, String categoryCode) {
+ return groupDataDao.selectCountAgencyGroupActDaily(customerId,agencyId,dateId,categoryCode);
+ }
+
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
index b3aa943ada..fd611edf23 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
@@ -20,4 +20,7 @@ public interface CustomerAgencyService {
List selectCustomerAreaCodeById(List customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
+
+
+ List queryAgencyListByCustomerId(String customerId);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
index 8a8fae83b8..5c6b5175b0 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
+++ b/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 queryAgencyListByCustomerId(String customerId) {
+ return customerAgencyDao.queryAgencyListByCustomerId(customerId);
+ }
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGroupActDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGroupActDailyDao.xml
new file mode 100644
index 0000000000..91897851f9
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGroupActDailyDao.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ delete from fact_group_act_daily
+ where CUSTOMER_ID = #{customerId}
+ AND DATE_ID = #{dateId}
+ and org_type=#{orgType}
+ limit #{limit}
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGroupActMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGroupActMonthlyDao.xml
new file mode 100644
index 0000000000..085c49ab2a
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactGroupActMonthlyDao.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml
index d8ed5a56df..ebd75dc9dd 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml
@@ -252,4 +252,65 @@
GROUP BY
ga.GRID_ID
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
index d5ead92c47..a7b6c09ae2 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
+++ b/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}
+
+
\ No newline at end of file