Browse Source

Merge branch 'dev_third_data' into dev_temp

dev_shibei_match
sunyuchao 4 years ago
parent
commit
5b19aa56c0
  1. 19
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  2. 8
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java
  3. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java
  4. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java
  5. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java
  6. 8
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml
  7. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginGroupMainDailyDTO.java
  8. 24
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GroupTotalFormDTO.java
  9. 126
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupTotalAgencyDailyDTO.java
  10. 126
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupTotalGridDailyDTO.java
  11. 28
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java
  12. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java
  13. 38
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupTotalAgencyDailyDao.java
  14. 39
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupTotalGridDailyDao.java
  15. 95
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/group/ResiGroupEntity.java
  16. 96
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupTotalAgencyDailyEntity.java
  17. 96
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupTotalGridDailyEntity.java
  18. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsGroupService.java
  19. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
  20. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java
  21. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java
  22. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java
  23. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java
  24. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java
  25. 250
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  26. 101
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupTotalAgencyDailyService.java
  27. 101
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupTotalGridDailyService.java
  28. 108
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupTotalAgencyDailyServiceImpl.java
  29. 108
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupTotalGridDailyServiceImpl.java
  30. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.12__alter_fact_origin_group_main_daily.sql
  31. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml
  32. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml
  33. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupTotalAgencyDailyDao.xml
  34. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupTotalGridDailyDao.xml
  35. 3
      epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.11__groupAchievementRule.sql

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

@ -17,6 +17,7 @@ import org.joda.time.LocalDate;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
@ -781,4 +782,22 @@ public class DateUtils {
Date nowDate = c.getTime();
return com.epmet.commons.tools.utils.DateUtils.format(nowDate, com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN_YYYYMM);
}
/**
* @Author sun
* @Description 获取当前日期的前一天日期yyyy-mm-dd
**/
public static Date yesterDay() {
Date date = new Date();
try {
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, -24);
String str = sdf.format(calendar.getTime());
date = sdf.parse(str);
} catch (Exception e) {
e.printStackTrace();
}
return date;
}
}

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

@ -1,7 +1,6 @@
package com.epmet.evaluationindex.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@ -17,6 +16,9 @@ import java.util.List;
@Data
public class ScreenProjectDetailResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String customerId;
private String projectStatusCode;
/**
* 项目id
*/
@ -57,7 +59,6 @@ public class ScreenProjectDetailResultDTO implements Serializable {
@Data
public static class processDTO{
@JsonIgnore
private String processId;
/**
* 处理部门名称
@ -85,6 +86,9 @@ public class ScreenProjectDetailResultDTO implements Serializable {
@Data
public static class AttachmentDTO{
//ATTACHMENT_ID
private String attachmentId;
@JsonInclude(JsonInclude.Include.NON_NULL)
/**
* 文件名

5
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java

@ -17,6 +17,7 @@ import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -60,9 +61,9 @@ public class ScreenProjectController {
* @Date 2021/2/24 16:10
*/
@PostMapping("projectdistribution")
public Result projectDistribution(@RequestBody ScreenProjectDistributionFormDTO formDTO){
public Result<List<ScreenProjectDistributionResultDTO>> projectDistribution(@RequestBody ScreenProjectDistributionFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
return screenProjectService.projectDistribution(formDTO);
return new Result<List<ScreenProjectDistributionResultDTO>>().ok(screenProjectService.projectDistribution(formDTO));
}
/**

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java

@ -1,12 +1,13 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.commons.tools.utils.Result;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
import com.epmet.dto.form.screen.CategoryAnalysisFormDTO;
import com.epmet.dto.result.screen.CategoryAnalysisResultDTO;
import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import java.util.List;
@ -36,7 +37,7 @@ public interface ScreenProjectService {
*/
List<CategoryAnalysisResultDTO> categoryAnalysis(String customerId, CategoryAnalysisFormDTO formDTO);
Result projectDistribution(ScreenProjectDistributionFormDTO formDTO);
List<ScreenProjectDistributionResultDTO> projectDistribution(ScreenProjectDistributionFormDTO formDTO);
Result projectDistributionDetail(ScreenProjectDetailFormDTO formDTO);
}

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

@ -70,7 +70,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
*/
@Override
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public Result projectDistribution(ScreenProjectDistributionFormDTO formDTO) {
public List<ScreenProjectDistributionResultDTO> projectDistribution(ScreenProjectDistributionFormDTO formDTO) {
// 1:红色:为刚提交未做任何响应处理未结案的项目;
// 2:黄色: 至少做过一次响应处理答复但未结案的项目;
// 3:绿色:已经结案的项目。
@ -82,7 +82,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
formDTO.setPageSize(NumConstant.TWO_HUNDRED);
}
List<ScreenProjectDistributionResultDTO> resultDTOS = screenProjectDataDao.projectDistribution(formDTO.getAgencyId(),areaIds,formDTO.getLevel(),formDTO.getPageSize());
return new Result().ok(resultDTOS);
return resultDTOS;
}
@Override

8
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

@ -64,7 +64,9 @@
ALL_CATEGORY_NAME as categoryName,
LINK_NAME as reportUserName,
link_mobile as mobile,
project_address as reportAddress
project_address as reportAddress,
CUSTOMER_ID as customerId,
PROJECT_STATUS_CODE as projectStatusCode
FROM
screen_project_data
WHERE
@ -84,7 +86,7 @@
PUBLIC_REPLY as suggestion,
PROCESS_TIME as reponseTime,
operation as operation,
TRANSFER_DEPT_NAME as whistleDeptName
IFNULL(TRANSFER_DEPT_NAME,'') as whistleDeptName
from screen_project_process
where del_flag = '0'
and project_id = #{projectId}
@ -92,6 +94,7 @@
</select>
<select id="selectProjectProcessAttachments" resultType="com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO$processDTO$AttachmentDTO">
select
ATTACHMENT_ID as attachmentId,
file_name as fileName,
attachment_name as attachmentName,
attachment_size as attachmentSize,
@ -102,6 +105,7 @@
from screen_project_process_attachment
where del_flag = '0'
and file_place = 'public'
AND PROCESS_ID=#{processId}
order by sort asc
</select>
</mapper>

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginGroupMainDailyDTO.java

@ -150,6 +150,11 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审
*/
private Date updatedTime;
/**
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
private List<ExtractGroupMemberActionRecordResultDTO> members = new ArrayList();
}

24
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GroupTotalFormDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.group.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author sun
* 小组总数-网格日统计-接口入参
*/
@Data
public class GroupTotalFormDTO implements Serializable {
private static final long serialVersionUID = -4527492073390715391L;
/**
* 客户Id
*/
private String customerId = "";
/**
* 需要执行的日期格式yyyy-MM-dd2020-01-01
*/
private String date = "";
}

126
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupTotalAgencyDailyDTO.java

@ -0,0 +1,126 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 小组总数-机关日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-10
*/
@Data
public class FactGroupTotalAgencyDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 机构ID 关联机关dim表
*/
private String agencyId;
/**
* 父级机关ID
*/
private String pid;
/**
* 统计日期 关联日期dim表
*/
private String dateId;
/**
* 周ID
*/
private String weekId;
/**
* 月份ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年ID
*/
private String yearId;
/**
* 当前组织及下级小组总数
*/
private Integer groupTotal;
/**
* 当前组织及下级楼院小组总数
*/
private Integer ordinaryTotal;
/**
* 当前组织及下级支部小组总数
*/
private Integer branchTotal;
/**
* 删除标识 未删除0,已删除1
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

126
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGroupTotalGridDailyDTO.java

@ -0,0 +1,126 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 小组总数-网格日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-10
*/
@Data
public class FactGroupTotalGridDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 机构ID 关联机关dim表
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 统计日期 关联日期dim表
*/
private String dateId;
/**
* 周ID
*/
private String weekId;
/**
* 月份ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年ID
*/
private String yearId;
/**
* 网格下小组总数
*/
private Integer groupTotal;
/**
* 网格下楼院小组总数
*/
private Integer ordinaryTotal;
/**
* 网格下支部小组总数
*/
private Integer branchTotal;
/**
* 删除标识 未删除0,已删除1
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

28
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java

@ -1,10 +1,15 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.service.StatsGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author zxc
@ -56,4 +61,25 @@ public class StatsGroupController {
return new Result();
}
/**
* @Author sun
* @Description 小组总数-网格日统计
**/
@PostMapping("gridgrouptotal")
public Result gridGroupTotal(@RequestBody(required = false) GroupTotalFormDTO formDTO) {
statsGroupService.gridGroupTotal(formDTO);
return new Result();
}
/**
* @Author sun
* @Description 小组总数-机关日统计
**/
@PostMapping("agencygrouptotal")
public Result agencyGroupTotal(@RequestBody(required = false) GroupTotalFormDTO formDTO) {
statsGroupService.agencyGroupTotal(formDTO);
return new Result();
}
}

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

@ -6,6 +6,7 @@ import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO;
import com.epmet.dto.group.form.GridGroupTotalFormDTO;
import com.epmet.dto.group.form.GroupIncrFormDTO;
import com.epmet.dto.group.result.*;
import com.epmet.entity.group.ResiGroupEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -90,4 +91,10 @@ public interface GroupDataDao {
* @date 2020.09.18 22:45
**/
List<FactOriginGroupMainDailyDTO> groupExtracting(@Param("customerId")String customerId,@Param("dateId") String dateId);
/**
* @Author sun
* @Description 查询客户下有效群组列表
**/
List<ResiGroupEntity> selectCustomerGroupList(@Param("customerId")String customerId);
}

38
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupTotalAgencyDailyDao.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.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactGroupTotalAgencyDailyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 小组总数-机关日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-10
*/
@Mapper
public interface FactGroupTotalAgencyDailyDao extends BaseDao<FactGroupTotalAgencyDailyEntity> {
/**
* @Author sun
* @Description 根据客户Id日维度Id批量物理删除一下可能存在的历史数据
**/
void delDateGroupTotal(FactGroupTotalAgencyDailyEntity delEntity);
}

39
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupTotalGridDailyDao.java

@ -0,0 +1,39 @@
/**
* 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.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactGroupTotalGridDailyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 小组总数-网格日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-10
*/
@Mapper
public interface FactGroupTotalGridDailyDao extends BaseDao<FactGroupTotalGridDailyEntity> {
/**
* @Author sun
* @Description 根据客户Id日维度Id批量物理删除一下可能存在的历史数据
**/
void delDateGroupTotal(FactGroupTotalGridDailyEntity delEntity);
}

95
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/group/ResiGroupEntity.java

@ -0,0 +1,95 @@
/**
* 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.group;
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 2020-03-28
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("resi_group")
public class ResiGroupEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 群头像htt://地址)
*/
private String groupHeadPhoto;
/**
* 小组名称
*/
private String groupName;
/**
* 群介绍
*/
private String groupIntroduction;
/**
* 客户id
*/
private String customerId;
/**
* 网格id
*/
private String gridId;
/**
* 状态审核通过 - approved 审核中 - under_auditting 审核未通过 - rejected 已屏蔽 - hidden 已关闭 - closed
Ps: 如果一个小组被拒绝当前小组的状态将永久停留在审核未通过
*/
private String state;
/**
* 最新话题时间
*/
private Date latestTopicPublishDate;
/**
* 进组审核open开启close关闭
*/
private String auditSwitch;
/**
* VISIT_SWITCH 小组是否允许参观:允许open;不允许closed
*/
private String visitSwitch;
/**
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
/**
* 小组等级
*/
private Integer level;
}

96
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupTotalAgencyDailyEntity.java

@ -0,0 +1,96 @@
/**
* 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.stats;
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-05-10
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_group_total_agency_daily")
public class FactGroupTotalAgencyDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 机构ID 关联机关dim表
*/
private String agencyId;
/**
* 父级机关ID
*/
private String pid;
/**
* 统计日期 关联日期dim表
*/
private String dateId;
/**
* 周ID
*/
private String weekId;
/**
* 月份ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年ID
*/
private String yearId;
/**
* 当前组织及下级小组总数
*/
private Integer groupTotal;
/**
* 当前组织及下级楼院小组总数
*/
private Integer ordinaryTotal;
/**
* 当前组织及下级支部小组总数
*/
private Integer branchTotal;
}

96
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGroupTotalGridDailyEntity.java

@ -0,0 +1,96 @@
/**
* 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.stats;
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-05-10
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_group_total_grid_daily")
public class FactGroupTotalGridDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 机构ID 关联机关dim表
*/
private String agencyId;
/**
* 网格ID
*/
private String gridId;
/**
* 统计日期 关联日期dim表
*/
private String dateId;
/**
* 周ID
*/
private String weekId;
/**
* 月份ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年ID
*/
private String yearId;
/**
* 网格下小组总数
*/
private Integer groupTotal;
/**
* 网格下楼院小组总数
*/
private Integer ordinaryTotal;
/**
* 网格下支部小组总数
*/
private Integer branchTotal;
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsGroupService.java

@ -1,6 +1,7 @@
package com.epmet.service;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
/**
* @Author zxc
@ -26,4 +27,15 @@ public interface StatsGroupService {
*/
void groupAgencyMonthly(GroupStatsFormDTO formDTO);
/**
* @Author sun
* @Description 小组总数-网格日统计
**/
void gridGroupTotal(GroupTotalFormDTO formDTO);
/**
* @Author sun
* @Description 小组总数-机关日统计
**/
void agencyGroupTotal(GroupTotalFormDTO formDTO);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

@ -879,10 +879,10 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
m.setServiceAblity(monthCountBd.multiply(m.getServiceAblity()));
m.setGovernAblity(monthCountBd.multiply(m.getGovernAblity()));
}else {
m.setIndexTotal(monthCountBd.multiply(m.getIndexTotal()).divide(selfCount));
m.setPartyDevAblity(monthCountBd.multiply(m.getPartyDevAblity()).divide(selfCount));
m.setServiceAblity(monthCountBd.multiply(m.getServiceAblity()).divide(selfCount));
m.setGovernAblity(monthCountBd.multiply(m.getGovernAblity()).divide(selfCount));
m.setIndexTotal(monthCountBd.multiply(m.getIndexTotal()).divide(selfCount,NumConstant.SIX,BigDecimal.ROUND_HALF_UP));
m.setPartyDevAblity(monthCountBd.multiply(m.getPartyDevAblity()).divide(selfCount,NumConstant.SIX,BigDecimal.ROUND_HALF_UP));
m.setServiceAblity(monthCountBd.multiply(m.getServiceAblity()).divide(selfCount,NumConstant.SIX,BigDecimal.ROUND_HALF_UP));
m.setGovernAblity(monthCountBd.multiply(m.getGovernAblity()).divide(selfCount,NumConstant.SIX,BigDecimal.ROUND_HALF_UP));
}
}
});

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java

@ -123,12 +123,12 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
@Transactional(rollbackFor = Exception.class)
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public void collect(ScreenCollFormDTO<ScreenProjectDataInfoFormDTO> param) {
if (param.getIsFirst()) {
/*if (param.getIsFirst()) {
int affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId());
while (affectedRows > 0) {
affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId());
}
}
}*/
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date today = new Date();
param.getDataList().forEach(item -> {

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java

@ -35,6 +35,7 @@ import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessAttachmentEnt
import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessEntity;
import com.epmet.service.evaluationindex.screen.ScreenProjectProcessAttachmentService;
import com.epmet.service.evaluationindex.screen.ScreenProjectProcessService;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
@ -122,21 +123,24 @@ public class ScreenProjectProcessServiceImpl extends BaseServiceImpl<ScreenProje
if (CollectionUtils.isEmpty(param.getDataList())){
return;
}
if (param.getIsFirst()) {
/*if (param.getIsFirst()) {
int affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId());
while (affectedRows > 0) {
affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId());
}
}
}*/
List<String> processIdList =
param.getDataList().stream().map(ScreenProjectProcessFormDTO :: getProcessId).collect(Collectors.toList()).stream().distinct()
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(processIdList)){
return;
}
//删除旧数据
baseDao.deleteByProcessIds(param.getCustomerId(), processIdList);
screenProjectProcessAttachmentDao.deleteByProcessIds(param.getCustomerId(), processIdList);
Lists.partition(processIdList, NumConstant.TWO_HUNDRED).forEach(list -> {
//删除旧数据
baseDao.deleteByProcessIds(param.getCustomerId(), list);
screenProjectProcessAttachmentDao.deleteByProcessIds(param.getCustomerId(), list);
});
List<ScreenProjectProcessAttachmentEntity> attachmentList = new ArrayList<>();

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserJoinServiceImpl.java

@ -85,12 +85,14 @@ public class ScreenUserJoinServiceImpl extends BaseServiceImpl<ScreenUserJoinDao
for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) {
if (list.get(i).getOrgId().equals(lastMonthJoinList.get(j).getOrgId())) {
ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(list.get(i), ScreenUserJoinEntity.class);
ScreenUserJoinEntity lastJoinEntity = lastMonthJoinList.get(i);
if (lastJoinEntity == null){
ScreenUserJoinEntity lastJoinEntity = null;
if (i > lastMonthJoinList.size()){
lastJoinEntity = new ScreenUserJoinEntity();
lastJoinEntity.setJoinTotal(NumConstant.ZERO);
lastJoinEntity.setAvgIssue(NumConstant.ZERO_DECIMAL);
lastJoinEntity.setAvgJoin(NumConstant.ZERO_DECIMAL);
}else{
lastJoinEntity = lastMonthJoinList.get(i);
}
entity.setJoinTotalUpRate(this.calculateGrowthRateNumber(lastJoinEntity.getJoinTotal(), list.get(j).getJoinTotal()));
entity.setJoinTotalUpFlag(this.calculateGrowthRateFlag(lastJoinEntity.getJoinTotal(), list.get(j).getJoinTotal()));

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

@ -2,6 +2,7 @@ package com.epmet.service.group;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.group.result.*;
import com.epmet.entity.group.ResiGroupEntity;
import com.epmet.util.DimIdGenerator;
import org.apache.ibatis.annotations.Param;
@ -66,4 +67,9 @@ public interface GroupDataService {
**/
List<FactOriginGroupMainDailyDTO> extractGroupData(Boolean isFirst,String customerId,String dateId);
/**
* @Author sun
* @Description 查询客户下有效群组列表
**/
List<ResiGroupEntity> getGroupListByCustomerId(String customerId);
}

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

@ -10,6 +10,7 @@ import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO;
import com.epmet.dto.group.form.GridGroupTotalFormDTO;
import com.epmet.dto.group.form.GroupIncrFormDTO;
import com.epmet.dto.group.result.*;
import com.epmet.entity.group.ResiGroupEntity;
import com.epmet.entity.stats.DimGridEntity;
import com.epmet.service.group.GroupDataService;
import com.epmet.util.DimIdGenerator;
@ -211,4 +212,14 @@ public class GroupDataServiceImpl implements GroupDataService {
}
/**
* @Author sun
* @Description 查询客户下有效群组列表
**/
@Override
public List<ResiGroupEntity> getGroupListByCustomerId(String customerId) {
return groupDataDao.selectCustomerGroupList(customerId);
}
}

250
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java

@ -6,9 +6,14 @@ import com.epmet.constant.GroupConstant;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.group.form.AgencyMonthlyFormDTO;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.group.result.*;
import com.epmet.dto.stats.DimAgencyDTO;
import com.epmet.entity.group.ResiGroupEntity;
import com.epmet.entity.stats.DimAgencyEntity;
import com.epmet.entity.stats.DimGridEntity;
import com.epmet.entity.stats.FactGroupTotalAgencyDailyEntity;
import com.epmet.entity.stats.FactGroupTotalGridDailyEntity;
import com.epmet.service.StatsGroupService;
import com.epmet.service.group.GroupDataService;
import com.epmet.service.org.CustomerGridService;
@ -20,11 +25,13 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@ -50,6 +57,12 @@ public class StatsGroupServiceImpl implements StatsGroupService {
private DimCustomerService dimCustomerService;
@Autowired
private CustomerGridService customerGridService;
@Autowired
private DimGridService dimGridService;
@Autowired
private FactGroupTotalGridDailyService factGroupTotalGridDailyService;
@Autowired
private FactGroupTotalAgencyDailyService factGroupTotalAgencyDailyService;
/**
* @param
@ -333,4 +346,241 @@ public class StatsGroupServiceImpl implements StatsGroupService {
return DimIdGenerator.getDimIdBean(result);
}
/**
* @Author sun
* @Description 小组总数-网格日统计
**/
@Override
public void gridGroupTotal(GroupTotalFormDTO formDTO) {
Date date = DateUtils.yesterDay();
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (null != formDTO && StringUtils.isNotBlank(formDTO.getDate())) {
date = DateUtils.parse(formDTO.getDate(), DateUtils.DATE_PATTERN);
}
//入参有客户Id的则按客户Id执行,没有的则全部客户都执行
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
log.info("单独统计客户网格-小组总数日统计数据,当前统计的客户Id:" + formDTO.getCustomerId());
gridGroupStats(formDTO.getCustomerId(), date);
} else {
int pageNo = 1;
int pageSize = 100;
List<String> customerIdList = null;
do {
//获取有效客户列表
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
if (!CollectionUtils.isEmpty(customerIdList)) {
for (String customerId : customerIdList) {
try {
log.info("for循环统计网格-小组总数日统计数据,当前统计的客户Id:" + customerId);
//遍历统计每一个客户数据
gridGroupStats(customerId, date);
} catch (Exception e) {
log.error("小组总数-网格日统计-程序错误,对应客户Id:" + customerId, e);
log.error("Error creating model JSON", e);
}
}
}
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize);
}
}
/**
* @Author sun
* @Description 小组总数-网格日统计数据
**/
private void gridGroupStats(String customerId, Date date) {
//1:查询各维度表Id,方便使用
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
//2:根据客户Id查询网格维度表数据
log.info("StatsGroupServiceImpl.customerGridStats-根据客户Id查询网格维度数据,对应客户Id:" + customerId);
List<DimGridEntity> dimGridList = dimGridService.getGridListByCustomerId(customerId);
//3.根据客户Id查询客户下有效的群组列表数据
log.info("StatsGroupServiceImpl.customerGridStats-根据客户Id查询客户下有效的群组列表数据,对应客户Id:" + customerId);
List<ResiGroupEntity> groupList = groupDataService.getGroupListByCustomerId(customerId);
//4.分别计算每个网格下审核通过的小组数据
List<FactGroupTotalGridDailyEntity> list = new ArrayList<>();
dimGridList.forEach(grid -> {
FactGroupTotalGridDailyEntity entity = new FactGroupTotalGridDailyEntity();
AtomicInteger total = new AtomicInteger(0);
AtomicInteger ordinary = new AtomicInteger(0);
AtomicInteger branch = new AtomicInteger(0);
groupList.forEach(group -> {
if (grid.getId().equals(group.getGridId()) && "approved".equals(group.getState())) {
total.addAndGet(1);
if ("ordinary".equals(group.getGroupType())) {
ordinary.addAndGet(1);
}
if ("branch".equals(group.getGroupType())) {
branch.addAndGet(1);
}
}
});
//封装数据
entity.setCustomerId(grid.getCustomerId());
entity.setAgencyId(grid.getAgencyId());
entity.setGridId(grid.getId());
entity.setDateId(dimId.getDateId());
entity.setWeekId(dimId.getWeekId());
entity.setMonthId(dimId.getMonthId());
entity.setQuarterId(dimId.getQuarterId());
entity.setYearId(dimId.getYearId());
entity.setGroupTotal(total.get());
entity.setOrdinaryTotal(ordinary.get());
entity.setBranchTotal(branch.get());
list.add(entity);
});
//5.批量插入数据库,先删后增的逻辑
if (!CollectionUtils.isEmpty(list)) {
//5.1:根据客户Id、日维度Id批量物理删除一下可能存在的历史数据
FactGroupTotalGridDailyEntity delEntity = new FactGroupTotalGridDailyEntity();
delEntity.setCustomerId(customerId);
delEntity.setDateId(dimId.getDateId());
log.info("StatsGroupServiceImpl.customerGridStats-根据客户Id、日维度Id批量删除小组总数网格日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId());
factGroupTotalGridDailyService.delDateGroupTotal(delEntity);
//5.2:批量保存网格日统计数据
log.info("StatsGroupServiceImpl.customerGridStats-批量新增小组总数网格日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId());
factGroupTotalGridDailyService.insertBatch(list);
}
}
/**
* @Author sun
* @Description 小组总数-机关日统计
**/
@Override
public void agencyGroupTotal(GroupTotalFormDTO formDTO) {
Date date = DateUtils.yesterDay();
//入参有时间的则按具体时间执行,没有的则按当前时间前一天执行
if (null != formDTO && StringUtils.isNotBlank(formDTO.getDate())) {
date = DateUtils.parse(formDTO.getDate(), DateUtils.DATE_PATTERN);
}
//入参有客户Id的则按客户Id执行,没有的则全部客户都执行
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
log.info("单独统计客户组织下-小组总数日统计数据,当前统计的客户Id:" + formDTO.getCustomerId());
agencyGroupStats(formDTO.getCustomerId(), date);
} else {
int pageNo = 1;
int pageSize = 100;
List<String> customerIdList = null;
do {
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
if (!CollectionUtils.isEmpty(customerIdList)) {
for (String customerId : customerIdList) {
try {
log.info("for循环统计机关-小组总数日统计数据,当前统计的客户Id:" + customerId);
//遍历统计每一个客户数据
agencyGroupStats(customerId, date);
} catch (Exception e) {
log.error("小组总数-机关日统计程序错误,对应客户Id:" + customerId, e);
log.error("Error creating model JSON", e);
}
}
}
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize);
}
}
/**
* @Author sun
* @Description 小组总数-机关日统计数据
**/
private void agencyGroupStats(String customerId, Date date) {
//1:查询各维度表Id,方便使用
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
//2:根据客户Id查询机关维度表数据
log.info("StatsGroupServiceImpl.agencyGroupStats-根据客户Id查询机关维度数据,对应客户Id:" + customerId);
DimAgencyDTO dimAgencyDTO = new DimAgencyDTO();
dimAgencyDTO.setCustomerId(customerId);
List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO);
//3.根据客户Id查询网格维度表数据
List<DimGridEntity> gridList = dimGridService.getGridListByCustomerId(customerId);
//4.根据客户Id查询客户下有效的群组列表数据
log.info("StatsGroupServiceImpl.agencyGroupStats-根据客户Id查询客户下有效的群组列表数据,对应客户Id:" + customerId);
List<ResiGroupEntity> groupList = groupDataService.getGroupListByCustomerId(customerId);
List<FactGroupTotalAgencyDailyEntity> list = new ArrayList<>();
//5.遍历组织维度数据分别计算每个组织下群组数据
agencyList.forEach(agency->{
FactGroupTotalAgencyDailyEntity entity = new FactGroupTotalAgencyDailyEntity();
//5-1.汇总组织及所有下级组织列表
Map<String, String> map = new HashMap<>();
map.put(agency.getId(), agency.getId());
String subPids = ((null == agency.getPids() || "".equals(agency.getPids())) ? agency.getId() : agency.getPids() + ":" + agency.getId());
agencyList.forEach(sub -> {
if (sub.getPids().contains(subPids)) {
map.put(sub.getId(), sub.getId());
}
});
//5-2.汇总组织及下级所有的网格列表
List<String> agencyGridList = new ArrayList<>();
gridList.forEach(grid->{
if (map.containsKey(grid.getAgencyId())) {
agencyGridList.add(grid.getId());
}
});
AtomicInteger total = new AtomicInteger(0);
AtomicInteger ordinary = new AtomicInteger(0);
AtomicInteger branch = new AtomicInteger(0);
//5-3.根据汇总的网格列表统计对应的群组数据
agencyGridList.forEach(gridId -> {
groupList.forEach(group -> {
if (gridId.equals(group.getGridId()) && "approved".equals(group.getState())) {
total.addAndGet(1);
if ("ordinary".equals(group.getGroupType())) {
ordinary.addAndGet(1);
}
if ("branch".equals(group.getGroupType())) {
branch.addAndGet(1);
}
}
});
});
//封装数据
entity.setCustomerId(agency.getCustomerId());
entity.setAgencyId(agency.getId());
entity.setPid(agency.getPid());
entity.setDateId(dimId.getDateId());
entity.setWeekId(dimId.getWeekId());
entity.setMonthId(dimId.getMonthId());
entity.setQuarterId(dimId.getQuarterId());
entity.setYearId(dimId.getYearId());
entity.setGroupTotal(total.get());
entity.setOrdinaryTotal(ordinary.get());
entity.setBranchTotal(branch.get());
list.add(entity);
});
//6.批量插入数据库,先删后增的逻辑
if (!CollectionUtils.isEmpty(list)) {
//5.1:根据客户Id、日维度Id批量物理删除一下可能存在的历史数据
FactGroupTotalAgencyDailyEntity delEntity = new FactGroupTotalAgencyDailyEntity();
delEntity.setCustomerId(customerId);
delEntity.setDateId(dimId.getDateId());
log.info("StatsGroupServiceImpl.agencyGroupStats-根据客户Id、日维度Id批量删除小组总数网格日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId());
factGroupTotalAgencyDailyService.delDateGroupTotal(delEntity);
//5.2:批量保存网格日统计数据
log.info("StatsGroupServiceImpl.agencyGroupStats-批量新增小组总数网格日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId());
factGroupTotalAgencyDailyService.insertBatch(list);
}
}
}

101
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupTotalAgencyDailyService.java

@ -0,0 +1,101 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.FactGroupTotalAgencyDailyDTO;
import com.epmet.entity.stats.FactGroupTotalAgencyDailyEntity;
import java.util.List;
import java.util.Map;
/**
* 小组总数-机关日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-10
*/
public interface FactGroupTotalAgencyDailyService extends BaseService<FactGroupTotalAgencyDailyEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<FactGroupTotalAgencyDailyDTO>
* @author generator
* @date 2021-05-10
*/
PageData<FactGroupTotalAgencyDailyDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<FactGroupTotalAgencyDailyDTO>
* @author generator
* @date 2021-05-10
*/
List<FactGroupTotalAgencyDailyDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return FactGroupTotalAgencyDailyDTO
* @author generator
* @date 2021-05-10
*/
FactGroupTotalAgencyDailyDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-05-10
*/
void save(FactGroupTotalAgencyDailyDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-05-10
*/
void update(FactGroupTotalAgencyDailyDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-05-10
*/
void delete(String[] ids);
/**
* @Author sun
* @Description 根据客户Id日维度Id批量物理删除一下可能存在的历史数据
**/
void delDateGroupTotal(FactGroupTotalAgencyDailyEntity delEntity);
}

101
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupTotalGridDailyService.java

@ -0,0 +1,101 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.FactGroupTotalGridDailyDTO;
import com.epmet.entity.stats.FactGroupTotalGridDailyEntity;
import java.util.List;
import java.util.Map;
/**
* 小组总数-网格日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-10
*/
public interface FactGroupTotalGridDailyService extends BaseService<FactGroupTotalGridDailyEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<FactGroupTotalGridDailyDTO>
* @author generator
* @date 2021-05-10
*/
PageData<FactGroupTotalGridDailyDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<FactGroupTotalGridDailyDTO>
* @author generator
* @date 2021-05-10
*/
List<FactGroupTotalGridDailyDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return FactGroupTotalGridDailyDTO
* @author generator
* @date 2021-05-10
*/
FactGroupTotalGridDailyDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-05-10
*/
void save(FactGroupTotalGridDailyDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-05-10
*/
void update(FactGroupTotalGridDailyDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-05-10
*/
void delete(String[] ids);
/**
* @Author sun
* @Description 根据客户Id日维度Id批量物理删除一下可能存在的历史数据
**/
void delDateGroupTotal(FactGroupTotalGridDailyEntity delEntity);
}

108
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupTotalAgencyDailyServiceImpl.java

@ -0,0 +1,108 @@
/**
* 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.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.stats.FactGroupTotalAgencyDailyDao;
import com.epmet.dto.FactGroupTotalAgencyDailyDTO;
import com.epmet.entity.stats.FactGroupTotalAgencyDailyEntity;
import com.epmet.service.stats.FactGroupTotalAgencyDailyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 小组总数-机关日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-10
*/
@Service
public class FactGroupTotalAgencyDailyServiceImpl extends BaseServiceImpl<FactGroupTotalAgencyDailyDao, FactGroupTotalAgencyDailyEntity> implements FactGroupTotalAgencyDailyService {
@Override
public PageData<FactGroupTotalAgencyDailyDTO> page(Map<String, Object> params) {
IPage<FactGroupTotalAgencyDailyEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, FactGroupTotalAgencyDailyDTO.class);
}
@Override
public List<FactGroupTotalAgencyDailyDTO> list(Map<String, Object> params) {
List<FactGroupTotalAgencyDailyEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, FactGroupTotalAgencyDailyDTO.class);
}
private QueryWrapper<FactGroupTotalAgencyDailyEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<FactGroupTotalAgencyDailyEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public FactGroupTotalAgencyDailyDTO get(String id) {
FactGroupTotalAgencyDailyEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, FactGroupTotalAgencyDailyDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(FactGroupTotalAgencyDailyDTO dto) {
FactGroupTotalAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupTotalAgencyDailyEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(FactGroupTotalAgencyDailyDTO dto) {
FactGroupTotalAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupTotalAgencyDailyEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Author sun
* @Description 根据客户Id日维度Id批量物理删除一下可能存在的历史数据
**/
@Override
public void delDateGroupTotal(FactGroupTotalAgencyDailyEntity delEntity) {
baseDao.delDateGroupTotal(delEntity);
}
}

108
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupTotalGridDailyServiceImpl.java

@ -0,0 +1,108 @@
/**
* 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.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.stats.FactGroupTotalGridDailyDao;
import com.epmet.dto.FactGroupTotalGridDailyDTO;
import com.epmet.entity.stats.FactGroupTotalGridDailyEntity;
import com.epmet.service.stats.FactGroupTotalGridDailyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 小组总数-网格日统计表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-10
*/
@Service
public class FactGroupTotalGridDailyServiceImpl extends BaseServiceImpl<FactGroupTotalGridDailyDao, FactGroupTotalGridDailyEntity> implements FactGroupTotalGridDailyService {
@Override
public PageData<FactGroupTotalGridDailyDTO> page(Map<String, Object> params) {
IPage<FactGroupTotalGridDailyEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, FactGroupTotalGridDailyDTO.class);
}
@Override
public List<FactGroupTotalGridDailyDTO> list(Map<String, Object> params) {
List<FactGroupTotalGridDailyEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, FactGroupTotalGridDailyDTO.class);
}
private QueryWrapper<FactGroupTotalGridDailyEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<FactGroupTotalGridDailyEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public FactGroupTotalGridDailyDTO get(String id) {
FactGroupTotalGridDailyEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, FactGroupTotalGridDailyDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(FactGroupTotalGridDailyDTO dto) {
FactGroupTotalGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupTotalGridDailyEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(FactGroupTotalGridDailyDTO dto) {
FactGroupTotalGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGroupTotalGridDailyEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Author sun
* @Description 根据客户Id日维度Id批量物理删除一下可能存在的历史数据
**/
@Override
public void delDateGroupTotal(FactGroupTotalGridDailyEntity delEntity) {
baseDao.delDateGroupTotal(delEntity);
}
}

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.12__alter_fact_origin_group_main_daily.sql

@ -0,0 +1,3 @@
ALTER TABLE `fact_origin_group_main_daily`
ADD COLUMN `GROUP_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '小组类型(ordinary:楼院小组 branch:支部小组)' AFTER `GROUP_STATE`;

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml

@ -139,6 +139,7 @@
id,
customer_id,
group_state,
group_type,
grid_id,
agency_id,
parent_id,
@ -165,6 +166,7 @@
#{item.id},
#{item.customerId},
#{item.groupState},
#{item.groupType},
#{item.gridId},
#{item.agencyId},
#{item.parentId},

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

@ -186,7 +186,8 @@
oper.UPDATED_TIME AS joinDate,
IF(groupp.CREATED_BY = oper.CUSTOMER_USER_ID,'leader','member') AS leaderFlag,
groupp.CREATED_BY AS groupOwnerId,
IF(groupp.CREATED_BY = oper.CUSTOMER_USER_ID,'join','create') AS actionCode
IF(groupp.CREATED_BY = oper.CUSTOMER_USER_ID,'join','create') AS actionCode,
groupp.group_type AS groupType
FROM
RESI_GROUP groupp
@ -226,4 +227,14 @@
</select>
<select id="selectCustomerGroupList" resultType="com.epmet.entity.group.ResiGroupEntity">
SELECT
*
FROM
resi_group
WHERE
del_flag = '0'
AND customer_id = #{customerId}
</select>
</mapper>

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupTotalAgencyDailyDao.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.stats.FactGroupTotalAgencyDailyDao">
<delete id="delDateGroupTotal">
DELETE
FROM
fact_group_total_agency_daily
WHERE
customer_id = #{customerId}
AND date_id = #{dateId}
</delete>
</mapper>

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupTotalGridDailyDao.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.stats.FactGroupTotalGridDailyDao">
<delete id="delDateGroupTotal">
DELETE
FROM
fact_group_total_grid_daily
WHERE
customer_id = #{customerId}
AND date_id = #{dateId}
</delete>
</mapper>

3
epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.11__groupAchievementRule.sql

@ -1 +1,2 @@
INSERT INTO `epmet_point`.`point_rule_default`(`ID`, `RULE_NAME`, `RULE_DESC`, `EVENT_CODE`, `FUNCTION_ID`, `OPERATE_TYPE`, `UP_LIMIT`, `UP_LIMIT_DESC`, `UP_LIMIT_PREFIX`, `RULE_PERIOD`, `POINT`, `POINT_UNIT`, `ENABLED_FLAG`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('10', '组长解决话题', '组长解决组内话题', 'leader_resolve_topic', '1', 'plus', 0, '无上限', NULL, 'day', 2, 'time', '0', '0', 0, 'APP_USER', '2021-04-19 15:55:18', 'APP_USER', '2021-04-19 15:55:18');
#INSERT INTO `epmet_point`.`point_rule_default`(`ID`, `RULE_NAME`, `RULE_DESC`, `EVENT_CODE`, `FUNCTION_ID`, `OPERATE_TYPE`, `UP_LIMIT`, `UP_LIMIT_DESC`, `UP_LIMIT_PREFIX`, `RULE_PERIOD`, `POINT`, `POINT_UNIT`, `ENABLED_FLAG`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('10', '组长解决话题', '组长解决组内话题', 'leader_resolve_topic', '1', 'plus', 0, '无上限', NULL, 'day', 2, 'time', '0', '0', 0, 'APP_USER', '2021-04-19 15:55:18', 'APP_USER', '2021-04-19 15:55:18');
select 1;

Loading…
Cancel
Save