From 74b76f67a57625186cae33a8e313439cdd55a4db Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Fri, 21 Aug 2020 18:23:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=95=B0=E6=8D=AE=E9=87=87?= =?UTF-8?q?=E9=9B=86api=20=20=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/constant/CompareConstant.java | 26 ++++ .../screencoll/form/CpcBaseDataFormDTO.java | 5 + .../form/CustomerAgencyFormDTO.java | 5 + .../screencoll/form/CustomerDeptFormDTO.java | 5 + .../screencoll/form/CustomerGridFormDTO.java | 5 + .../form/DifficultyDataFormDTO.java | 11 ++ .../dto/screencoll/form/EventDataFormDTO.java | 5 + .../form/IndexDataMonthlyFormDTO.java | 9 +- .../form/IndexDataYearlyFormDTO.java | 9 +- .../form/PartyLinkMassesDataFormDTO.java | 6 + .../form/PartyUserRankDataFormDTO.java | 38 +++--- .../screencoll/form/PioneerDataFormDTO.java | 5 + .../dto/screencoll/form/UserJoinFormDTO.java | 20 ++-- .../screencoll/form/UserTotalDataFormDTO.java | 15 +++ .../screen/ScreenPartyUserRankDataDao.java | 13 +- .../epmet/dao/screen/ScreenUserJoinDao.java | 19 ++- .../entity/screen/ScreenUserJoinEntity.java | 2 +- .../service/screen/ScreenCollService.java | 2 +- .../screen/impl/ScreenCollServiceImpl.java | 113 ++++++++++++++++-- .../V0.0.3__update_col_data_type.sql | 3 - .../mapper/screen/ScreenCpcBaseDataDao.xml | 2 + .../mapper/screen/ScreenCustomerAgencyDao.xml | 6 +- .../mapper/screen/ScreenCustomerDeptDao.xml | 6 +- .../mapper/screen/ScreenCustomerGridDao.xml | 6 +- .../mapper/screen/ScreenDifficultyDataDao.xml | 8 +- .../mapper/screen/ScreenEventDataDao.xml | 6 +- .../screen/ScreenPartyLinkMassesDataDao.xml | 6 +- .../screen/ScreenPartyUserRankDataDao.xml | 32 +++-- .../mapper/screen/ScreenPioneerDataDao.xml | 10 +- .../mapper/screen/ScreenUserJoinDao.xml | 48 ++++++-- .../mapper/screen/ScreenUserTotalDataDao.xml | 6 + 31 files changed, 358 insertions(+), 94 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CompareConstant.java delete mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__update_col_data_type.sql diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CompareConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CompareConstant.java new file mode 100644 index 0000000000..119cd1ca31 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/CompareConstant.java @@ -0,0 +1,26 @@ +package com.epmet.constant; + +/** + * 比较结果常量 + * + * @author yujintao + * @email yujintao@elink-cn.com + * @date 2019/8/19 10:28 + */ +public interface CompareConstant { + + /** + * 增加 + */ + String INCR_STR = "incr"; + + /** + * 下降 + */ + String DECR_STR = "decr"; + + /** + * 相等 + */ + String EQ_STR = "eq"; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CpcBaseDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CpcBaseDataFormDTO.java index 3ff8c4446a..ee1674ce96 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CpcBaseDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CpcBaseDataFormDTO.java @@ -78,4 +78,9 @@ public class CpcBaseDataFormDTO implements Serializable { * 60+岁 */ private Integer ageLevel6; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerAgencyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerAgencyFormDTO.java index de5dc8abdd..cebf258d31 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerAgencyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerAgencyFormDTO.java @@ -63,4 +63,9 @@ public class CustomerAgencyFormDTO implements Serializable { * 行政地区编码 */ private String areaCode; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerDeptFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerDeptFormDTO.java index 19f5f3fecd..a99713701a 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerDeptFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerDeptFormDTO.java @@ -43,4 +43,9 @@ public class CustomerDeptFormDTO implements Serializable { * 部门所在位置 */ private String deptMark; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerGridFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerGridFormDTO.java index 8935eaa156..38094a105a 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerGridFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/CustomerGridFormDTO.java @@ -43,4 +43,9 @@ public class CustomerGridFormDTO implements Serializable { * 党支部的位置!!! */ private String partyMark; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataFormDTO.java index 14ef258fb8..7d136c4b27 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataFormDTO.java @@ -88,4 +88,15 @@ public class DifficultyDataFormDTO implements Serializable { * 最近一次操作说明 eg: 转项目,结案,流转 */ private String latestOperateDesc; + + /** + * 事件被处理次数(08-21新增) + */ + private Integer eventHandledCount; + + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/EventDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/EventDataFormDTO.java index 5be17787cf..21e8ee718e 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/EventDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/EventDataFormDTO.java @@ -116,4 +116,9 @@ public class EventDataFormDTO implements Serializable { * 最近一次操作说明 eg: 转项目,结案,流转 */ private String latestOperateDesc; + + /** + * 数据更新至: yyyy|yyyMM|yyyyMMdd 8.21增加字段 + */ + private String dataEndTime; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java index 9c9ca798a5..c27f75db87 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.screencoll.form; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** * 1、指数_按月统计 入参 @@ -47,20 +48,20 @@ public class IndexDataMonthlyFormDTO implements Serializable { /** * 总指数 */ - private Integer indexTotal; + private BigDecimal indexTotal; /** * 党建能力指数 */ - private Integer partyDevAblity; + private BigDecimal partyDevAblity; /** * 服务能力指数 */ - private Integer serviceAblity; + private BigDecimal serviceAblity; /** * 治理能力指数 */ - private Integer governAblity; + private BigDecimal governAblity; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataYearlyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataYearlyFormDTO.java index bd360a63fa..4eafd27be7 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataYearlyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataYearlyFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.screencoll.form; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** * 17、指数_按年统计 入参 @@ -42,20 +43,20 @@ public class IndexDataYearlyFormDTO implements Serializable { /** * 总指数 */ - private Integer indexTotal; + private BigDecimal indexTotal; /** * 党建能力指数 */ - private Integer partyDevAblity; + private BigDecimal partyDevAblity; /** * 服务能力指数 */ - private Integer serviceAblity; + private BigDecimal serviceAblity; /** * 治理能力指数 */ - private Integer governAblity; + private BigDecimal governAblity; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PartyLinkMassesDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PartyLinkMassesDataFormDTO.java index 8d1ae654a9..c57728d3fc 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PartyLinkMassesDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PartyLinkMassesDataFormDTO.java @@ -43,4 +43,10 @@ public class PartyLinkMassesDataFormDTO implements Serializable { * 群成员总数 */ private Integer groupUserTotal; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PartyUserRankDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PartyUserRankDataFormDTO.java index b4e3884dae..29b35aa147 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PartyUserRankDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PartyUserRankDataFormDTO.java @@ -7,7 +7,7 @@ import java.io.Serializable; /** * 9、党建引领|基层治理-居民(党员)积分排行榜 入参 * @Auther: zhangyong - * @Date: 2020-08-18 09:59 + * @Date: 2020-08-21 09:59 */ @Data public class PartyUserRankDataFormDTO implements Serializable { @@ -15,39 +15,39 @@ public class PartyUserRankDataFormDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 年Id :yyyy + * 数据更新至: yyyy|yyyyMM|yyyyMMdd */ - private String yearId; + private String dataEndTime; /** - * 月份Id :yyyyMM + * 组织类别 agency:组织;部门:department;网格:grid */ - private String monthId; + private String orgType; /** - * 组织类别 agency:组织;部门:department;网格:grid + * 用户所属网格id */ - private String orgType; + private String gridId; /** - * 组织Id 可以为网格,机关id + * 用户所属网格名称 */ - private String orgId; + private String gridName; /** - * 上级组织Id + * 网格所属的组织id */ - private String parentId; + private String orgId; /** - * 组织名称 + * 网格所属的组织名称 */ private String orgName; /** - * 用户身份 party:党员;resi:居民 + * 是否是党员标志:1是。0不是党员 */ - private String userType; + private String partyFlag; /** * 用户Id @@ -63,4 +63,14 @@ public class PartyUserRankDataFormDTO implements Serializable { * 用户积分 */ private Integer pointTotal; + + /** + * 姓 + */ + private String surname; + + /** + * 名 + */ + private String name; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java index 0efe2ff448..7e79fce0b8 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java @@ -85,4 +85,9 @@ public class PioneerDataFormDTO implements Serializable { * 党员发布议题占比 */ private BigDecimal publishIssueRatio; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java index 48802ff6d1..9abd6012d6 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java @@ -35,27 +35,27 @@ public class UserJoinFormDTO implements Serializable { private String orgName; /** - * 组织次数 + * 年Id :yyyy */ - private Integer organizeTotal; + private String yearId; /** - * 参与次数 + * 月份Id :yyyyMM */ - private Integer joinTotal; + private String monthId; /** - * 平均参与人数 + * 人均议题 */ - private Integer avgJoinUser; + private Integer avgIssue; /** - * 年Id :yyyy + * 总的参与次数 */ - private String yearId; + private Integer joinTotal; /** - * 月份Id :yyyyMM + * 平均参与度 */ - private String monthId; + private Integer avgJoin; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserTotalDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserTotalDataFormDTO.java index 42722f7111..14f4df673d 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserTotalDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserTotalDataFormDTO.java @@ -63,4 +63,19 @@ public class UserTotalDataFormDTO implements Serializable { * 项目总数 */ private Integer projectTotal; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + + /** + * 注册人数(08-21新增) + */ + private Integer regUserTotal; + + /** + * 参与人数(08-21新增) + */ + private Integer joinUserTotal; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenPartyUserRankDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenPartyUserRankDataDao.java index de25a82b88..9e43669618 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenPartyUserRankDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenPartyUserRankDataDao.java @@ -36,25 +36,24 @@ public interface ScreenPartyUserRankDataDao extends BaseDao { + /** + * 11、基层治理-公众参与 + * 0) 查询上月的基础数据,可用来计算本月的增长率 + * @param customerId + * @param yearId + * @param monthId + * @param orgIds 组织Id集合 + * @return java.util.List + * @Author zhangyong + * @Date 14:46 2020-08-21 + **/ + List selectLastMonthScreenUserJoinList(@Param("customerId") String customerId, + @Param("yearId") String yearId, + @Param("monthId") String monthId, + @Param("orgIds") String[] orgIds); + /** * 11、基层治理-公众参与 * 1) 根据CUSTOMER_ID、YEAR_ID、MONTH_ID、ORG_ID进行查询,如果有数据,则先进行物理删除 @@ -59,5 +74,5 @@ public interface ScreenUserJoinDao extends BaseDao { * @Author zhangyong * @Date 10:52 2020-08-18 **/ - void batchInsertUserJoin(@Param("list") List list, @Param("customerId")String customerId); + void batchInsertUserJoin(@Param("list") List list, @Param("customerId")String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserJoinEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserJoinEntity.java index d67593a2f4..8a2009d9ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserJoinEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserJoinEntity.java @@ -77,7 +77,7 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { /** * 总的参与次数 */ - private String joinTotal; + private Integer joinTotal; /** * 总的参与次数较上月增长率(采集的时候后台自己计算) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/ScreenCollService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/ScreenCollService.java index 8ee702178d..6ce2d9c3c8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/ScreenCollService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/ScreenCollService.java @@ -14,7 +14,7 @@ public interface ScreenCollService { /** * 9、党建引领|基层治理-居民(党员)积分排行榜 - * 1) 根据CUSTOMER_ID、YEAR_ID、MONTH_ID、ORG_ID进行查询,如果有数据,则先进行物理删除 + * 1) 根据CUSTOMER_ID、GRID_ID、USER_ID进行查询,如果有数据,则先进行物理删除 * 2) 在新增 * * @param formDTO diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/ScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/ScreenCollServiceImpl.java index 899ebac605..bd277c3823 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/ScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/ScreenCollServiceImpl.java @@ -18,15 +18,21 @@ package com.epmet.service.screen.impl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CompareConstant; import com.epmet.dao.screen.*; import com.epmet.dto.screencoll.form.*; import com.epmet.entity.screen.ScreenEventImgDataEntity; +import com.epmet.entity.screen.ScreenUserJoinEntity; import com.epmet.service.screen.ScreenCollService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** @@ -76,14 +82,11 @@ public class ScreenCollServiceImpl implements ScreenCollService { @Transactional(rollbackFor = Exception.class) public void insertPartyUserRankData(List formDTO,String customerId) { if (null != formDTO && formDTO.size() > NumConstant.ZERO){ - String[] orgIds = new String[formDTO.size()]; for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ - orgIds[i] = formDTO.get(i).getOrgId(); + screenPartyUserRankDataDao.deletePartyUserRankData(customerId, + formDTO.get(NumConstant.ZERO).getGridId(), + formDTO.get(NumConstant.ZERO).getUserId()); } - screenPartyUserRankDataDao.deletePartyUserRankData(customerId, - formDTO.get(NumConstant.ZERO).getYearId(), - formDTO.get(NumConstant.ZERO).getMonthId(), - orgIds); screenPartyUserRankDataDao.batchInsertPartyUserRankData(formDTO,customerId); } @@ -309,7 +312,103 @@ public class ScreenCollServiceImpl implements ScreenCollService { formDTO.get(NumConstant.ZERO).getMonthId(), orgIds); - screenUserJoinDao.batchInsertUserJoin(formDTO, customerId); + String[] lastMonth = this.lastMonthDate(); + // 获取上个月的基本数据 + List lastMonthJoinList = screenUserJoinDao.selectLastMonthScreenUserJoinList(customerId, + lastMonth[NumConstant.ZERO], + lastMonth[NumConstant.ONE], + orgIds); + + // 定义本月待添加数据的集合 + List curMonthJoinEntityList = new ArrayList<>(); + // 增加率计算 + if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO){ + // 存在上个月的数据 (本月-上月)/上月 *100 + for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ + for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++){ + if (formDTO.get(i).getOrgId().equals(lastMonthJoinList.get(j).getOrgId())){ + ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(formDTO.get(i), ScreenUserJoinEntity.class); + entity.setJoinTotalUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getJoinTotal(), formDTO.get(j).getJoinTotal())); + entity.setJoinTotalUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getJoinTotal(), formDTO.get(j).getJoinTotal())); + entity.setAvgIssueUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getAvgIssue(), formDTO.get(j).getAvgIssue())); + entity.setAvgIssueUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getAvgIssue(), formDTO.get(j).getAvgIssue())); + entity.setAgvgJoinUpRate(this.calculateGrowthRateNumber(lastMonthJoinList.get(i).getAvgJoin(), formDTO.get(j).getAvgJoin())); + entity.setAgvgJoinUpFlag(this.calculateGrowthRateFlag(lastMonthJoinList.get(i).getAvgJoin(), formDTO.get(j).getAvgJoin())); + curMonthJoinEntityList.add(entity); + } + } + } + } else { + // 计算增长率后的 待新增数据 + BigDecimal zero = new BigDecimal(NumConstant.ZERO); + // 不存在上个月的数据 + for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ + ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(formDTO.get(i), ScreenUserJoinEntity.class); + entity.setJoinTotalUpRate(zero); + entity.setJoinTotalUpFlag(""); + entity.setAvgIssueUpRate(zero); + entity.setAvgIssueUpFlag(""); + entity.setAgvgJoinUpRate(zero); + entity.setAgvgJoinUpFlag(""); + curMonthJoinEntityList.add(entity); + } + } + screenUserJoinDao.batchInsertUserJoin(curMonthJoinEntityList, customerId); + } + } + + /** + * 获取当前日期的前一个月的日期 + * @param + * @return java.lang.String[] + * @Author zhangyong + * @Date 15:33 2020-08-21 + **/ + private String[] lastMonthDate(){ + String[] date = new String[NumConstant.TWO]; + //Java获取当前日期的前一个月的日期 + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.MONTH, NumConstant.ONE_NEG); + int year = calendar.get(Calendar.YEAR); + int month = calendar.get(Calendar.MONTH) + NumConstant.ONE; + date[NumConstant.ZERO] = String.valueOf(year); + date[NumConstant.ONE] = String.valueOf(month);; + if (NumConstant.TEN >= month){ + date[NumConstant.ONE] = NumConstant.ZERO_STR + month; + } + return date; + } + + /** + * 计算 本月数值 相较于 上月数值,的增长率 + * + * @param old 上月数值 + * @param now 本月数值 + * @return java.math.BigDecimal + * @Author zhangyong + * @Date 15:38 2020-08-21 + **/ + private BigDecimal calculateGrowthRateNumber(Integer old, Integer now){ + int number = (now - old) / old * NumConstant.ONE_HUNDRED; + return new BigDecimal(number); + } + + /** + * 计算 本月数值 相较于 上月数值,的增长率, 得出标识 + * + * @param old 上月数值 + * @param now 本月数值 + * @return java.util.String + * @Author zhangyong + * @Date 15:38 2020-08-21 + **/ + private String calculateGrowthRateFlag(Integer old, Integer now){ + if (old > now){ + return CompareConstant.DECR_STR; + } else if (old < now){ + return CompareConstant.INCR_STR; + } else { + return CompareConstant.EQ_STR; } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__update_col_data_type.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__update_col_data_type.sql deleted file mode 100644 index 05b34b4833..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__update_col_data_type.sql +++ /dev/null @@ -1,3 +0,0 @@ -alter table fact_index_party_ablity_org_monthly MODIFY column DATA_TYPE VARCHAR(100) DEFAULT '' COMMENT '数据类型 allRegion:全区;community:社区;street:街道'; -alter table fact_index_service_ablity_org_monthly MODIFY column DATA_TYPE VARCHAR(100) DEFAULT '' COMMENT '数据类型 allRegion:全区;community:社区;street:街道'; -alter table fact_index_govrn_ablity_org_monthly MODIFY column DATA_TYPE VARCHAR(100) DEFAULT '' COMMENT '数据类型 allRegion:全区;community:社区;street:街道'; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml index a0adcc3b70..7f8ddaf4f0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml @@ -21,6 +21,7 @@ ORG_ID, PARENT_ID, ORG_NAME, + DATA_END_TIME, REGISTER_USER_COUNT, RESI_TOTAL, PARTY_MEMBER_COUNT, @@ -45,6 +46,7 @@ #{item.orgId}, #{item.parentId}, #{item.orgName}, + #{item.dataEndTime}, #{item.registerUserCount}, #{item.resiTotal}, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 923a8410f0..a9c6911a70 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -32,7 +32,8 @@ CREATED_BY, CREATED_TIME, UPDATED_BY, - UPDATED_TIME + UPDATED_TIME, + DATA_END_TIME ) values ( @@ -53,7 +54,8 @@ 'APP_USER', now(), 'APP_USER', - now() + now(), + #{item.dataEndTime} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerDeptDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerDeptDao.xml index 627b3b39c1..a3fedbf4d5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerDeptDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerDeptDao.xml @@ -28,7 +28,8 @@ CREATED_BY, CREATED_TIME, UPDATED_BY, - UPDATED_TIME + UPDATED_TIME, + DATA_END_TIME ) values ( @@ -45,7 +46,8 @@ 'APP_USER', now(), 'APP_USER', - now() + now(), + #{item.dataEndTime} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml index 7a36507ce7..5381e9ddd2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml @@ -28,7 +28,8 @@ CREATED_BY, CREATED_TIME, UPDATED_BY, - UPDATED_TIME + UPDATED_TIME, + DATA_END_TIME ) values ( @@ -45,7 +46,8 @@ 'APP_USER', now(), 'APP_USER', - now() + now(), + #{item.dataEndTime} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml index 11451dc3ae..e26c43115c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml @@ -23,6 +23,7 @@ EVENT_CONTENT, EVENT_COST_TIME, EVENT_RE_ORG, + EVENT_HANDLED_COUNT, EVENT_CATEGORY_CODE, EVENT_CATEGORY_NAME, EVENT_STATUS_CODE, @@ -33,7 +34,8 @@ CREATED_TIME, UPDATED_BY, UPDATED_TIME, - LATEST_OPERATE_DESC + LATEST_OPERATE_DESC, + DATA_END_TIME ) values ( @@ -49,6 +51,7 @@ #{item.eventContent}, #{item.eventCostTime}, #{item.eventReOrg}, + #{item.eventHandledCount}, #{item.eventCategoryCode}, #{item.eventCategoryName}, #{item.eventStatusCode}, @@ -59,7 +62,8 @@ now(), 'APP_USER', now(), - #{item.latestOperateDesc} + #{item.latestOperateDesc}, + #{item.dataEndTime} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenEventDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenEventDataDao.xml index 1df8e0a068..be95b118df 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenEventDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenEventDataDao.xml @@ -37,7 +37,8 @@ UPDATED_TIME, EVENT_STATUS_CODE, EVENT_STATUS_DESC, - LATEST_OPERATE_DESC + LATEST_OPERATE_DESC, + DATA_END_TIME ) values ( @@ -67,7 +68,8 @@ now(), #{item.eventStatusCode}, #{item.eventStatusDesc}, - #{item.latestOperateDesc} + #{item.latestOperateDesc}, + #{item.dataEndTime} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml index 01a63f3a53..d317d97ee9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml @@ -28,7 +28,8 @@ CREATED_BY, CREATED_TIME, UPDATED_BY, - UPDATED_TIME + UPDATED_TIME, + DATA_END_TIME ) values ( @@ -45,7 +46,8 @@ 'APP_USER', now(), 'APP_USER', - now() + now(), + #{item.dataEndTime} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml index 1de992bd4d..070e952878 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml @@ -5,11 +5,7 @@ delete from screen_party_user_rank_data - where CUSTOMER_ID = #{customerId} AND YEAR_ID = #{yearId} AND MONTH_ID = #{monthId} - AND ORG_ID IN - - #{item} - + where CUSTOMER_ID = #{customerId} AND GRID_ID = #{gridId} AND USER_ID = #{userId} @@ -17,14 +13,14 @@ ( ID, CUSTOMER_ID, - YEAR_ID, - MONTH_ID, - ORG_TYPE, + GRID_ID, + GRID_NAME, ORG_ID, - PARENT_ID, ORG_NAME, - USER_TYPE, + PARTY_FLAG, USER_ID, + SURNAME, + `NAME`, USER_NAME, POINT_TOTAL, DEL_FLAG, @@ -32,20 +28,21 @@ CREATED_BY, CREATED_TIME, UPDATED_BY, - UPDATED_TIME + UPDATED_TIME, + DATA_END_TIME ) values ( (SELECT REPLACE(UUID(), '-', '') AS id), #{customerId}, - #{item.yearId}, - #{item.monthId}, - #{item.orgType}, + #{item.gridId}, + #{item.gridName}, #{item.orgId}, - #{item.parentId}, #{item.orgName}, - #{item.userType}, + #{item.partyFlag}, #{item.userId}, + #{item.surname}, + #{item.name}, #{item.userName}, #{item.pointTotal}, 0, @@ -53,7 +50,8 @@ 'APP_USER', now(), 'APP_USER', - now() + now(), + #{item.dataEndTime} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml index c140b7d3f3..8142176bee 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml @@ -30,13 +30,14 @@ ISSUE_RATIO, TOPIC_RATIO, SHIFT_PROJECT_RATIO, - RESOLVED_PROJECT_TOTAL_RATIO, + RESOLVED_PROJECT_RATIO, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, - UPDATED_TIME + UPDATED_TIME, + DATA_END_TIME ) values ( @@ -52,17 +53,18 @@ #{item.shiftProjectTotal}, #{item.resolvedProjectTotal}, + #{item.publishIssueRatio}, #{item.issueRatio}, #{item.topicRatio}, #{item.shiftProjectRatio}, #{item.resolvedProjectRatio}, - #{item.publishIssueRatio}, 0, 0, 'APP_USER', now(), 'APP_USER', - now() + now(), + #{item.dataEndTime} ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml index db7b626e27..9751293f5f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml @@ -3,6 +3,23 @@ + + delete from screen_user_join where CUSTOMER_ID = #{customerId} AND YEAR_ID = #{yearId} AND MONTH_ID = #{monthId} @@ -17,15 +34,21 @@ ( ID, CUSTOMER_ID, - YEAR_ID, - MONTH_ID, ORG_TYPE, ORG_ID, PARENT_ID, ORG_NAME, - ORGANIZE_TOTAL, + YEAR_ID, + MONTH_ID, JOIN_TOTAL, - AVG_JOIN_USER, + JOIN_TOTAL_UP_RATE, + JOIN_TOTAL_UP_FLAG, + AVG_ISSUE, + AVG_ISSUE_UP_RATE, + AVG_ISSUE_UP_FLAG, + AVG_JOIN, + AGVG_JOIN_UP_RATE, + AGVG_JOIN_UP_FLAG, DEL_FLAG, REVISION, CREATED_BY, @@ -37,15 +60,24 @@ ( (SELECT REPLACE(UUID(), '-', '') AS id), #{customerId}, - #{item.yearId}, - #{item.monthId}, #{item.orgType}, #{item.orgId}, #{item.parentId}, #{item.orgName}, - #{item.organizeTotal}, + #{item.yearId}, + #{item.monthId}, + #{item.joinTotal}, - #{item.avgJoinUser}, + #{item.joinTotalUpRate}, + #{item.joinTotalUpFlag}, + + #{item.avgIssue}, + #{item.avgIssueUpRate}, + #{item.avgIssueUpFlag}, + + #{item.avgJoin}, + #{item.agvgJoinUpRate}, + #{item.agvgJoinUpFlag}, 0, 0, 'APP_USER', diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml index a582bedbb7..a3f29dd5a6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenUserTotalDataDao.xml @@ -21,12 +21,15 @@ ORG_ID, PARENT_ID, ORG_NAME, + DATA_END_TIME, USER_TOTAL, PARTY_TOTAL, GROUP_TOTAL, TOPIC_TOTAL, ISSUE_TOTAL, PROJECT_TOTAL, + REG_USER_TOTAL, + JOIN_USER_TOTAL, DEL_FLAG, REVISION, CREATED_BY, @@ -42,12 +45,15 @@ #{item.orgId}, #{item.parentId}, #{item.orgName}, + #{item.dataEndTime}, #{item.userTotal}, #{item.partyTotal}, #{item.groupTotal}, #{item.topicTotal}, #{item.issueTotal}, #{item.projectTotal}, + #{item.regUserTotal}, + #{item.joinUserTotal}, 0, 0, 'APP_USER',