Browse Source

社区相关

dev_shibei_match
zxc 5 years ago
parent
commit
10fa49c2b2
  1. 14
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java
  2. 109
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityGovrnFiveScoreDTO.java
  3. 110
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityPartyFiveScoreDTO.java
  4. 55
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java
  5. 107
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityServiceFiveScoreDTO.java
  6. 59
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityActivityCountResultDTO.java
  7. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityPublishArticleCountResultDTO.java
  8. 21
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/MaxAndMinBigDecimalResultDTO.java
  9. 46
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/SubGridGovernAvgResultDTO.java
  10. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/SubGridPartyAvgResultDTO.java
  11. 51
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/SubGridServiceAvgResultDTO.java
  12. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  13. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java
  14. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java
  15. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityGovrnFiveScoreDao.java
  16. 45
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityPartyFiveScoreDao.java
  17. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityScoreDao.java
  18. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityServiceFiveScoreDao.java
  19. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexGridScoreDao.java
  20. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityFiveScoreEntity.java
  21. 77
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityGovrnFiveScoreEntity.java
  22. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityScoreEntity.java
  23. 77
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityServiceFiveScoreEntity.java
  24. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateCommunityService.java
  25. 373
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateCommunityServiceImpl.java
  26. 24
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml
  27. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml
  28. 19
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml
  29. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityGovrnFiveScoreDao.xml
  30. 27
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityPartyFiveScoreDao.xml
  31. 56
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityScoreDao.xml
  32. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityServiceFiveScoreDao.xml
  33. 44
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexGridScoreDao.xml

14
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java

@ -20,4 +20,18 @@ public interface IndexCalConstant {
String USER_ID="USER_ID";
String YEAR_ID = "YEAR_ID";
String COMMUNITY_GOVERN = "zhilinengli";
String COMMUNITY_PARTY = "dangjiannengli";
String COMMUNITY_SERVICE = "fuwunengli";
String COMMUNITY_SERVICE_AVG = "shequxiajisywgfwnldfpjz";
String COMMUNITY_GOVERN_AVG = "shequxiashusywgzlnlhzpyz";
String COMMUNITY_PARTY_AVG = "xiazhusuoyouwgddjnlpjz";
String COMMUNITY_RELATE = "shequxiangguan";
}

109
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityGovrnFiveScoreDTO.java

@ -1,109 +0,0 @@
/**
* 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.screen;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
/**
* 社区相关-治理能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
public class FactIndexCommunityGovrnFiveScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String id;
/**
* 机关iD
*/
private String agencyId;
/**
* 月份ID
*/
private String monthId;
/**
* 指标ID
*/
private String indexId;
/**
* 总指数分值
*/
private BigDecimal totalScore;
/**
* 党建能力分值
*/
private BigDecimal partyAbilityScore;
/**
* 治理能力分值
*/
private BigDecimal govrnAbilityScore;
/**
* 服务能力分值
*/
private BigDecimal serviceAbilityScore;
/**
* 删除状态0正常1删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 更新人
*/
private String updatedBy ;
public FactIndexCommunityGovrnFiveScoreDTO() {
this.agencyId = "";
this.monthId = "";
this.indexId = "";
this.totalScore = new BigDecimal(0);
this.partyAbilityScore = new BigDecimal(0);
this.govrnAbilityScore = new BigDecimal(0);
this.serviceAbilityScore = new BigDecimal(0);
this.delFlag = 0;
this.revision = 0;
this.createdBy = "APP_USER";
this.updatedBy = "APP_USER";
}
}

110
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityPartyFiveScoreDTO.java

@ -1,110 +0,0 @@
/**
* 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.screen;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
/**
* 社区相关-党建能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
public class FactIndexCommunityPartyFiveScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 机关ID
*/
private String agencyId;
/**
* 月度ID
*/
private String monthId;
/**
* 指标ID
*/
private String indexId;
/**
* 总指数分值
*/
private BigDecimal totalScore;
/**
* 党建能力分值
*/
private BigDecimal partyAbilityScore;
/**
* 治理能力分值
*/
private BigDecimal govrnAbilityScore;
/**
* 服务能力分值
*/
private BigDecimal serviceAbilityScore;
/**
* 删除状态0正常1删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 更新人
*/
private String updatedBy;
public FactIndexCommunityPartyFiveScoreDTO() {
this.agencyId = "";
this.monthId = "";
this.indexId = "";
this.totalScore = new BigDecimal(0);
this.partyAbilityScore = new BigDecimal(0);
this.govrnAbilityScore = new BigDecimal(0);
this.serviceAbilityScore = new BigDecimal(0);
this.delFlag = 0;
this.revision = 0;
this.createdBy = "APP_USER";
this.updatedBy = "APP_USER";
}
}

55
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java

@ -27,7 +27,7 @@ import java.math.BigDecimal;
* 社区相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
* @since v1.0.0 2020-08-31
*/
@Data
public class FactIndexCommunityScoreDTO implements Serializable {
@ -35,49 +35,59 @@ public class FactIndexCommunityScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
* ID 主键
*/
private String id;
/**
* 机关ID
* 客户Id
*/
private String customerId;
/**
* 组织id
*/
private String agencyId;
/**
* 月份ID
* 社区上一级组织id
*/
private String monthId;
private String parentAgencyId;
/**
* 年度ID: yyyy
*/
private String yearId;
/**
* 季度ID
* 季度id: yyyyQ1yyyyQ2yyyyQ3yyyyQ4
*/
private String quarterId;
/**
* 年度ID
* 月维度Id: yyyyMM
*/
private String yearId;
private String monthId;
/**
* 指标ID
* 1总分0不是默认0
*/
private String indexId;
private String isTotal;
/**
*
*
*/
private BigDecimal score;
/**
* 党建能力party治理能力govrn服务能力service
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli社区相关shequxiangguan
*/
private String type;
private String indexCode;
/**
* 删除状态0正常1删除
* 删除状态
*/
private Integer delFlag;
private Integer delFlag;
/**
* 乐观锁
@ -104,4 +114,19 @@ public class FactIndexCommunityScoreDTO implements Serializable {
*/
private Date updatedTime;
public FactIndexCommunityScoreDTO() {
this.customerId = "";
this.agencyId = "";
this.parentAgencyId = "";
this.yearId = "";
this.quarterId = "";
this.monthId = "";
this.isTotal = "0";
this.score = new BigDecimal(0);
this.indexCode = "";
this.delFlag = 0;
this.revision = 0;
this.createdBy = "APP_USER";
this.updatedBy = "APP_USER";
}
}

107
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityServiceFiveScoreDTO.java

@ -1,107 +0,0 @@
/**
* 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.screen;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 社区相关-服务能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
public class FactIndexCommunityServiceFiveScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String id;
/**
* 机关ID
*/
private String agencyId;
/**
* 月度ID
*/
private String monthId;
/**
* 指标ID
*/
private String indexId;
/**
* 总指数分值
*/
private BigDecimal totalScore;
/**
* 党建能力分值
*/
private BigDecimal partyAbilityScore;
/**
* 治理能力分值
*/
private BigDecimal govrnAbilityScore;
/**
* 服务能力分值
*/
private BigDecimal serviceAbilityScore;
/**
* 删除状态0正常1删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

59
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityActivityCountResultDTO.java

@ -0,0 +1,59 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/31 2:12 下午
*/
@Data
public class CommunityActivityCountResultDTO implements Serializable {
private static final long serialVersionUID = -6623426101220283941L;
/**
* 客户ID
*/
private String customerId;
/**
* 机关ID
*/
private String agencyId;
/**
* 上级组织ID
*/
private String parentId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 发文数
*/
public Integer activityCount;
public CommunityActivityCountResultDTO() {
this.agencyId = "";
this.parentId = "";
this.monthId = "";
this.quarterId = "";
this.yearId = "";
this.activityCount = 0;
}
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityPublishArticleCountResultDTO.java

@ -13,6 +13,11 @@ public class CommunityPublishArticleCountResultDTO implements Serializable {
private static final long serialVersionUID = -8260746179353253237L;
/**
* 客户ID
*/
private String customerId;
/**
* 机关ID
*/

21
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/MaxAndMinBigDecimalResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author zxc
* @DateTime 2020/8/30 8:11 下午
*/
@Data
public class MaxAndMinBigDecimalResultDTO implements Serializable {
private static final long serialVersionUID = 76227645470470839L;
private BigDecimal min;
private BigDecimal max;
}

46
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/SubGridGovernAvgResultDTO.java

@ -0,0 +1,46 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author zxc
* @DateTime 2020/8/31 9:11 上午
*/
@Data
public class SubGridGovernAvgResultDTO implements Serializable {
private static final long serialVersionUID = -1354963771895272899L;
/**
* 机关ID
*/
private String agencyId;
/**
* 上级组织ID
*/
private String parentId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 分数
*/
private BigDecimal score;
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/SubGridPartyAvgResultDTO.java

@ -19,6 +19,11 @@ public class SubGridPartyAvgResultDTO implements Serializable {
*/
private String agencyId;
/**
* 客户ID
*/
private String customerId;
/**
* 上级组织ID
*/

51
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/SubGridServiceAvgResultDTO.java

@ -0,0 +1,51 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author zxc
* @DateTime 2020/8/31 1:53 下午
*/
@Data
public class SubGridServiceAvgResultDTO implements Serializable {
private static final long serialVersionUID = -405197363477213644L;
/**
*
*/
private String customerId;
/**
* 机关ID
*/
private String agencyId;
/**
* 上级组织ID
*/
private String parentId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 分数
*/
private BigDecimal score;
}

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

@ -120,7 +120,25 @@ public class DemoController {
@PostMapping("zxc")
public Result getZxc(){
// indexCalculateCommunityService.communityPublishArticleCountCalculate("b09527201c4409e19d1dbc5e3c3429a1","202008");
indexCalculateCommunityService.communityPublishArticleCountCalculate("","202008");
indexCalculateCommunityService.communityGovernAbilityCalculate("b09527201c4409e19d1dbc5e3c3429a1","202008");
return new Result();
}
@PostMapping("zxc1")
public Result getZxc1(){
indexCalculateCommunityService.communityPartyCalculate("b09527201c4409e19d1dbc5e3c3429a1","202008");
return new Result();
}
@PostMapping("zxc2")
public Result getZxc2(){
indexCalculateCommunityService.communityServiceAbilityCalculate("b09527201c4409e19d1dbc5e3c3429a1","202008");
return new Result();
}
@PostMapping("zxcAll")
public Result getZxcAll(){
indexCalculateCommunityService.communityRelate("b09527201c4409e19d1dbc5e3c3429a1","202008");
return new Result();
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java

@ -25,6 +25,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 治理能力-街道及社区相关数据
@ -70,5 +71,5 @@ public interface FactIndexGovrnAblityOrgMonthlyDao extends BaseDao<FactIndexGovr
* @author zxc
* @date 2020/8/26 1:40 下午
*/
List<CommunityGovernAbilityResultDTO> selectCommunityGovernAbility(@Param("customerId")String customerId, @Param("monthId")String monthId);
List<Map<String,Object>> selectCommunityGovernAbility(@Param("customerId")String customerId, @Param("monthId")String monthId);
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java

@ -19,6 +19,8 @@ package com.epmet.dao.indexcoll;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcollect.form.OrgServiceAbilityFormDTO;
import com.epmet.dto.screen.result.CommunityActivityCountResultDTO;
import com.epmet.dto.screen.result.CommunityPublishArticleCountResultDTO;
import com.epmet.entity.indexcoll.FactIndexServiceAblityOrgMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -62,4 +64,13 @@ public interface FactIndexServiceAblityOrgMonthlyDao extends BaseDao<FactIndexSe
* @Date 10:52 2020-08-20
**/
void batchInsertFactIndexServiceAblityOrgMonthly(@Param("list") List<OrgServiceAbilityFormDTO> list, @Param("customerId")String customerId);
/**
* @Description 社区活动组织次数
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/31 2:15 下午
*/
List<CommunityActivityCountResultDTO> selectActivityCount(@Param("customerId")String customerId, @Param("monthId")String monthId);
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityGovrnFiveScoreDao.java

@ -1,33 +0,0 @@
/**
* 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.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.FactIndexCommunityGovrnFiveScoreEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 社区相关-治理能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Mapper
public interface FactIndexCommunityGovrnFiveScoreDao extends BaseDao<FactIndexCommunityGovrnFiveScoreEntity> {
}

45
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityPartyFiveScoreDao.java

@ -1,45 +0,0 @@
/**
* 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.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.FactIndexCommunityPartyFiveScoreDTO;
import com.epmet.entity.screen.FactIndexCommunityPartyFiveScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 社区相关-党建能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Mapper
public interface FactIndexCommunityPartyFiveScoreDao extends BaseDao<FactIndexCommunityPartyFiveScoreEntity> {
/**
* @Description 党建能力社区中间表插入
* @param lists
* @author zxc
* @date 2020/8/27 5:05 下午
*/
void insertCommunityPartyRecord(@Param("lists")List<FactIndexCommunityPartyFiveScoreDTO> lists);
}

35
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityScoreDao.java

@ -18,16 +18,47 @@
package com.epmet.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.FactIndexCommunityScoreDTO;
import com.epmet.entity.screen.FactIndexCommunityScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 社区相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
* @since v1.0.0 2020-08-31
*/
@Mapper
public interface FactIndexCommunityScoreDao extends BaseDao<FactIndexCommunityScoreEntity> {
/**
* @Description 党建能力社区中间表插入
* @param lists
* @author zxc
* @date 2020/8/27 5:05 下午
*/
void insertCommunityPartyRecord(@Param("lists") List<FactIndexCommunityScoreDTO> lists);
/**
* @Description 删除旧记录
* @param customerId
* @param monthId
* @param indexCode
* @author zxc
* @date 2020/9/1 9:03 上午
*/
void deleteOldRecord(@Param("customerId") String customerId,@Param("monthId")String monthId,@Param("indexCode")String indexCode);
/**
* @Description 查询社区相关信息
* @param customerId
* @param monthId
* @author zxc
* @date 2020/9/1 9:41 上午
*/
List<FactIndexCommunityScoreDTO> selectCommunityInfo(@Param("customerId") String customerId,@Param("monthId")String monthId);
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityServiceFiveScoreDao.java

@ -1,33 +0,0 @@
/**
* 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.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.FactIndexCommunityServiceFiveScoreEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 社区相关-服务能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Mapper
public interface FactIndexCommunityServiceFiveScoreDao extends BaseDao<FactIndexCommunityServiceFiveScoreEntity> {
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexGridScoreDao.java

@ -18,7 +18,9 @@
package com.epmet.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.result.SubGridGovernAvgResultDTO;
import com.epmet.dto.screen.result.SubGridPartyAvgResultDTO;
import com.epmet.dto.screen.result.SubGridServiceAvgResultDTO;
import com.epmet.entity.screen.FactIndexGridScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -43,4 +45,22 @@ public interface FactIndexGridScoreDao extends BaseDao<FactIndexGridScoreEntity>
*/
List<SubGridPartyAvgResultDTO> selectSubGridPartyAvgScore(@Param("customerId")String customerId,@Param("monthId")String monthId);
/**
* @Description 社区下属所有网格治理能力汇总平均值
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/31 9:19 上午
*/
List<SubGridGovernAvgResultDTO> selectSubGridGovernAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* @Description 社区下级所有网格服务能力得分平均值
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/31 1:51 下午
*/
List<SubGridServiceAvgResultDTO> selectSubGridServiceAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityPartyFiveScoreEntity.java → epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityFiveScoreEntity.java

@ -34,8 +34,8 @@ import java.util.Date;
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_community_party_five_score")
public class FactIndexCommunityPartyFiveScoreEntity extends BaseEpmetEntity {
@TableName("fact_index_community_five_score")
public class FactIndexCommunityFiveScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;

77
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityGovrnFiveScoreEntity.java

@ -1,77 +0,0 @@
/**
* 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.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 社区相关-治理能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_community_govrn_five_score")
public class FactIndexCommunityGovrnFiveScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 机关iD
*/
private String agencyId;
/**
* 月份ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 指标ID
*/
private String indexId;
/**
* 分数
*/
private BigDecimal score;
/**
* 社区被吹哨次数transfered社区办结项目数closed_project社区项目响应度resp_project_ratio社区超期项目率overdue_project_ratio社区办结项目率closed_project_ratio社区办结项目满意度satisfaction_ratio
*/
private String type;
}

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityScoreEntity.java

@ -30,7 +30,7 @@ import java.util.Date;
* 社区相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
* @since v1.0.0 2020-08-31
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -40,38 +40,48 @@ public class FactIndexCommunityScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 机关ID
* 客户Id
*/
private String customerId;
/**
* 组织id
*/
private String agencyId;
/**
* 月份ID
* 社区上一级组织id
*/
private String monthId;
private String parentAgencyId;
/**
* 年度ID: yyyy
*/
private String yearId;
/**
* 季度ID
* 季度id: yyyyQ1yyyyQ2yyyyQ3yyyyQ4
*/
private String quarterId;
/**
* 年度ID
* 月维度Id: yyyyMM
*/
private String yearId;
private String monthId;
/**
* 指标ID
* 1总分0不是默认0
*/
private String indexId;
private String isTotal;
/**
*
*
*/
private BigDecimal score;
/**
* 党建能力party治理能力govrn服务能力service
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli社区相关shequxiangguan
*/
private String type;
private String indexCode;
}

77
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityServiceFiveScoreEntity.java

@ -1,77 +0,0 @@
/**
* 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.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 社区相关-服务能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_community_service_five_score")
public class FactIndexCommunityServiceFiveScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 机关ID
*/
private String agencyId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 指标ID
*/
private String indexId;
/**
* 分数
*/
private BigDecimal score;
/**
* 社区活动组织次数activity
*/
private String type;
}

23
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateCommunityService.java

@ -12,13 +12,13 @@ import java.util.List;
public interface IndexCalculateCommunityService {
/**
* @Description 社区名义发文数量计算
* @Description 社区党建能力
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/26 10:46 上午
*/
void communityPublishArticleCountCalculate(String customerId, String monthId);
void communityPartyCalculate(String customerId, String monthId);
/**
* @Description 社区治理能力
@ -27,6 +27,23 @@ public interface IndexCalculateCommunityService {
* @author zxc
* @date 2020/8/26 1:40 下午
*/
void CommunityGovernAbilityCalculate(String customerId, String monthId);
void communityGovernAbilityCalculate(String customerId, String monthId);
/**
* @Description 社区服务能力
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/31 1:38 下午
*/
void communityServiceAbilityCalculate(String customerId, String monthId);
/**
* @Description 社区相关计算
* @param customerId
* @param monthId
* @author zxc
* @date 2020/9/1 9:21 上午
*/
void communityRelate(String customerId, String monthId);
}

373
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateCommunityServiceImpl.java

@ -1,30 +1,25 @@
package com.epmet.service.screen.impl;
import com.alibaba.druid.util.StringUtils;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.indexcoll.FactIndexGovrnAblityOrgMonthlyDao;
import com.epmet.dao.indexcoll.FactIndexPartyAblityCpcMonthlyDao;
import com.epmet.dao.indexcoll.FactIndexPartyAblityOrgMonthlyDao;
import com.epmet.dao.indexcoll.FactIndexServiceAblityOrgMonthlyDao;
import com.epmet.dao.screen.*;
import com.epmet.dto.indexcal.ExtremeValueCommonDTO;
import com.epmet.dto.screen.FactIndexCommunityPartyFiveScoreDTO;
import com.epmet.dto.screen.FactIndexCommunityScoreDTO;
import com.epmet.dto.screen.result.*;
import com.epmet.entity.screen.IndexGroupDetailEntity;
import com.epmet.eum.IndexCodeEnum;
import com.epmet.service.indexcal.IndexCodeFieldReService;
import com.epmet.service.screen.IndexCalculateCommunityService;
import com.epmet.service.screen.IndexGroupDetailService;
import com.epmet.support.normalizing.Correlation;
import com.epmet.support.normalizing.IntegerScoreCalculator;
import com.epmet.support.normalizing.ScoreCalculator;
import com.epmet.support.normalizing.ScoreConstants;
import com.epmet.support.normalizing.*;
import com.epmet.support.normalizing.batch.BatchScoreCalculator;
import com.epmet.support.normalizing.batch.IndexInputVO;
import com.epmet.support.normalizing.batch.IndexOutputVO;
import com.epmet.support.normalizing.batch.SampleValue;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -48,19 +43,15 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
@Autowired
private FactIndexGovrnAblityOrgMonthlyDao factIndexGovrnAblityOrgMonthlyDao;
@Autowired
private FactIndexServiceAblityOrgMonthlyDao factIndexServiceAblityOrgMonthlyDao;
@Autowired
private IndexGroupDetailService indexGroupDetailService;
@Autowired
private IndexCodeFieldReService indexCodeFieldReService;
@Autowired
private FactIndexCommunityPartyFiveScoreDao factIndexCommunityPartyFiveScoreDao;
private FactIndexCommunityScoreDao factIndexCommunityScoreDao;
@Autowired
private FactIndexGridScoreDao factIndexGridScoreDao;
@Autowired
private FactIndexCommunityServiceFiveScoreDao factIndexCommunityServiceFiveScoreDao;
@Autowired
private FactIndexCommunityGovrnFiveScoreDao factIndexCommunityGovrnFiveScoreDao;
@Autowired
private FactIndexCommunityScoreDao factIndexCommunityScoreDao;
/**
* @Description 社区名义发文数量计算党建能力
@ -70,32 +61,48 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void communityPublishArticleCountCalculate(String customerId, String monthId) {
public void communityPartyCalculate(String customerId, String monthId) {
customerId = "b09527201c4409e19d1dbc5e3c3429a1";
// 党建能力
// 根据all_parent_index_code 获取指标明细
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(),IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
List<FactIndexCommunityPartyFiveScoreDTO> subAllGridList = new ArrayList<>();
List<FactIndexCommunityPartyFiveScoreDTO> communityPublishArticle = new ArrayList<>();
List<FactIndexCommunityScoreDTO> subAllGridList = new ArrayList<>();
List<FactIndexCommunityScoreDTO> communityPublishArticle = new ArrayList<>();
//下属所有网格的党建能力平均值
String finalCustomerId = customerId;
detailListByParentCode.forEach(indexGroup -> {
if (indexGroup.getIndexCode().equals("xiazhusuoyouwgddjnlpjz")){
if (indexGroup.getIndexCode().equals(IndexCalConstant.COMMUNITY_PARTY_AVG)){
List<SubGridPartyAvgResultDTO> subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridPartyAvgScore(finalCustomerId, monthId);
if (subGridPartyAvgScore.size() != NumConstant.ZERO){
subGridPartyAvgScore.forEach(subGridParty -> {
BigDecimal multiply = subGridParty.getScore().multiply(indexGroup.getWeight());
subGridParty.setScore(multiply);
FactIndexCommunityPartyFiveScoreDTO dto = new FactIndexCommunityPartyFiveScoreDTO();
BeanUtils.copyProperties(subGridParty,dto);
dto.setIndexId(indexGroup.getIndexId());
dto.setTotalScore(dto.getPartyAbilityScore());
subAllGridList.add(dto);
});
factIndexCommunityPartyFiveScoreDao.insertCommunityPartyRecord(subAllGridList);
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList()));
Integer indexStart = NumConstant.ZERO;
Integer indexEnd = NumConstant.TEN;
List<SubGridPartyAvgResultDTO> collect;
do {
collect = subGridPartyAvgScore.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList());
BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
List<SampleValue> index1SampleValues = new ArrayList<>();
collect.forEach(c -> {
SampleValue s = new SampleValue(c.getAgencyId(), c.getScore());
index1SampleValues.add(s);
FactIndexCommunityScoreDTO dto = new FactIndexCommunityScoreDTO();
BeanUtils.copyProperties(c,dto);
subAllGridList.add(dto);
});
IndexInputVO index1VO = new IndexInputVO(indexGroup.getIndexId(), index1SampleValues,indexGroup.getThreshold(), indexGroup.getWeight(), sc1);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS);
result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> {
subAllGridList.forEach(grid -> {
if (grid.getAgencyId().equals(agency.getSampleId())){
grid.setScore(agency.getSampleScore());
}
});
});
indexStart++;
}while (collect.size() == NumConstant.TEN);
}
}
});
@ -105,13 +112,13 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
if (indexGroup.getIndexCode().equals("shequmingyifwsl")) {
if (publishArticleCounts.size() == NumConstant.ONE) {
//TODO 计算之后的分数
FactIndexCommunityPartyFiveScoreDTO dto = new FactIndexCommunityPartyFiveScoreDTO();
FactIndexCommunityScoreDTO dto = new FactIndexCommunityScoreDTO();
BeanUtils.copyProperties(detailListByParentCode.get(NumConstant.ZERO), dto);
dto.setPartyAbilityScore(BigDecimal.valueOf(50.00));
dto.setIndexId(detailListByParentCode.get(NumConstant.ZERO).getIndexId());
dto.setScore(BigDecimal.valueOf(50.00));
dto.setIndexCode(detailListByParentCode.get(NumConstant.ZERO).getIndexCode());
communityPublishArticle.add(dto);
factIndexCommunityPartyFiveScoreDao.insertCommunityPartyRecord(communityPublishArticle);
} else if (publishArticleCounts.size() != NumConstant.ZERO) {
factIndexCommunityScoreDao.insertCommunityPartyRecord(communityPublishArticle);
} else if (publishArticleCounts.size() > NumConstant.ONE) {
Integer indexStart = NumConstant.ZERO;
Integer indexEnd = NumConstant.TEN;
List<CommunityPublishArticleCountResultDTO> collect;
@ -123,32 +130,37 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
collect.forEach(c -> {
SampleValue s = new SampleValue(c.getAgencyId(), c.getPublishArticleCount());
ll.add(s);
FactIndexCommunityPartyFiveScoreDTO publishArticle = new FactIndexCommunityPartyFiveScoreDTO();
FactIndexCommunityScoreDTO publishArticle = new FactIndexCommunityScoreDTO();
BeanUtils.copyProperties(c,publishArticle);
communityPublishArticle.add(publishArticle);
});
IndexInputVO<Integer> index1VO = new IndexInputVO<>(indexGroup.getIndexId(), ll, indexGroup.getWeight(), sc1);
IndexInputVO<Integer> index1VO = new IndexInputVO<>(indexGroup.getIndexId(), ll,indexGroup.getThreshold(), indexGroup.getWeight(), sc1);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS);
result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> {
communityPublishArticle.forEach(publish -> {
if (publish.getAgencyId().equals(agency.getSampleId())){
publish.setIndexId(indexGroup.getIndexId());
publish.setPartyAbilityScore(agency.getSampleScore());
publish.setTotalScore(agency.getSampleScore());
publish.setIndexCode(indexGroup.getIndexCode());
publish.setScore(agency.getSampleScore());
}
});
});
indexStart++;
} while (collect.size() == 10);
factIndexCommunityPartyFiveScoreDao.insertCommunityPartyRecord(communityPublishArticle);
} while (collect.size() == NumConstant.TEN);
}
}
});
subAllGridList.forEach(grid -> {
communityPublishArticle.forEach(publish -> {
if (grid.getAgencyId().equals(publish.getAgencyId())){
grid.setScore(grid.getScore().add(publish.getScore()));
grid.setIndexCode(IndexCalConstant.COMMUNITY_PARTY);
}
});
});
factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.COMMUNITY_PARTY);
factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList);
}
/**
@ -160,21 +172,260 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void CommunityGovernAbilityCalculate(String customerId, String monthId) {
List<CommunityGovernAbilityResultDTO> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId);
public void communityGovernAbilityCalculate(String customerId, String monthId) {
customerId = "b09527201c4409e19d1dbc5e3c3429a1";
List<FactIndexCommunityScoreDTO> subAllGridList = new ArrayList<>();
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
String finalCustomerId = customerId;
detailListByParentCode.forEach(detail -> {
if (detail.getIndexCode().equals(IndexCalConstant.COMMUNITY_GOVERN_AVG)){
List<SubGridGovernAvgResultDTO> subGridGovernAvg = factIndexGridScoreDao.selectSubGridGovernAvgScore(finalCustomerId, monthId);
if (subGridGovernAvg.size() == NumConstant.ONE){
// TODO
}else if (subGridGovernAvg.size() > NumConstant.ONE){
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList()));
Integer indexStart = NumConstant.ZERO;
Integer indexEnd = NumConstant.TEN;
List<SubGridGovernAvgResultDTO> collect;
do {
collect = subGridGovernAvg.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList());
BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
List<SampleValue> index1SampleValues = new ArrayList<>();
collect.forEach(c -> {
SampleValue s = new SampleValue(c.getAgencyId(), c.getScore());
index1SampleValues.add(s);
FactIndexCommunityScoreDTO dto = new FactIndexCommunityScoreDTO();
BeanUtils.copyProperties(c,dto);
subAllGridList.add(dto);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold() ,detail.getWeight(), sc1);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
scoreCountOfSampleId.forEach((key,value) -> {
subAllGridList.forEach(grid -> {
if (grid.getAgencyId().equals(key)){
grid.setScore(value);
}
});
});
indexStart++;
}while (collect.size() == NumConstant.TEN);
}
}
else {
}
});
List<Map<String,Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(finalCustomerId, monthId);
if (communityGovernAbility.size() == NumConstant.ONE){
List<CommunityGovernAbilityCalculateResultDTO> result = new ArrayList<>();
CommunityGovernAbilityCalculateResultDTO governAbility = new CommunityGovernAbilityCalculateResultDTO();
BeanUtils.copyProperties(communityGovernAbility.get(NumConstant.ZERO),governAbility);
// TODO 计算之后的分数
// TODO
result.add(governAbility);
}else if (communityGovernAbility.size() > NumConstant.ONE){
List<IndexInputVO> indexInputVOS = new ArrayList<>();
detailListByParentCode.forEach(detail -> {
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (!StringUtils.isEmpty(fieldNameByIndexCode)){
if (communityGovernAbility.get(NumConstant.ZERO).containsKey(fieldNameByIndexCode)) {
List<BigDecimal> decimalList = communityGovernAbility.stream().map(m -> new BigDecimal(m.get(fieldNameByIndexCode).toString())).collect(Collectors.toList());
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList);
Integer indexStart = NumConstant.ZERO;
Integer indexEnd = NumConstant.TEN;
List<Map<String, Object>> collect;
do {
collect = communityGovernAbility.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList());
ScoreCalculator<Integer> sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
List<SampleValue> index1SampleValues = new ArrayList<>();
collect.forEach(c -> {
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode))));
index1SampleValues.add(s);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1);
indexInputVOS.add(index1VO);
} while (collect.size() == NumConstant.TEN);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
scoreCountOfSampleId.forEach((key,value) -> {
subAllGridList.forEach(grid -> {
if (key.equals(grid.getAgencyId())) {
grid.setCustomerId(finalCustomerId);
grid.setIndexCode(IndexCalConstant.COMMUNITY_GOVERN);
grid.setScore(grid.getScore().add(value));
}
});
});
}
}
});
}
factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.COMMUNITY_GOVERN);
factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList);
}
/**
* @Description 社区服务能力
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/31 1:38 下午
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void communityServiceAbilityCalculate(String customerId, String monthId) {
List<FactIndexCommunityScoreDTO> subAllGridList = new ArrayList<>();
List<FactIndexCommunityScoreDTO> communityPublishArticle = new ArrayList<>();
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), IndexCodeEnum.FU_WU_NENG_LI.getCode());
detailListByParentCode.forEach(detail -> {
switch (detail.getIndexCode()){
case IndexCalConstant.COMMUNITY_SERVICE_AVG:
List<SubGridServiceAvgResultDTO> subGridServiceAvg = factIndexGridScoreDao.selectSubGridServiceAvgScore(customerId, monthId);
if (subGridServiceAvg.size() == NumConstant.ONE){
// TODO 只有一条记录时
}else if (subGridServiceAvg.size() > NumConstant.ONE ){
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList()));
Integer indexStart = NumConstant.ZERO;
Integer indexEnd = NumConstant.TEN;
List<SubGridServiceAvgResultDTO> collect;
do {
collect = subGridServiceAvg.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList());
BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
List<SampleValue> index1SampleValues = new ArrayList<>();
collect.forEach(c -> {
SampleValue s = new SampleValue(c.getAgencyId(), c.getScore());
index1SampleValues.add(s);
FactIndexCommunityScoreDTO dto = new FactIndexCommunityScoreDTO();
BeanUtils.copyProperties(c,dto);
subAllGridList.add(dto);
});
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues,detail.getThreshold(), detail.getWeight(), sc1);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS);
result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> {
subAllGridList.forEach(grid -> {
if (grid.getAgencyId().equals(agency.getSampleId())){
grid.setScore(agency.getSampleScore());
}
});
});
indexStart++;
}while (collect.size() == NumConstant.TEN);
}
break;
case "shequhuodongzzcs":
List<CommunityActivityCountResultDTO> communityActivityCount = factIndexServiceAblityOrgMonthlyDao.selectActivityCount(customerId, monthId);
if (communityActivityCount.size() == NumConstant.ONE){
// TODO
}else if (communityActivityCount.size() > NumConstant.ONE){
Integer indexStart = NumConstant.ZERO;
Integer indexEnd = NumConstant.TEN;
List<CommunityActivityCountResultDTO> collect;
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(communityActivityCount.stream().map(o -> new BigDecimal(o.getActivityCount())).collect(Collectors.toList()));
do {
collect = communityActivityCount.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList());
ScoreCalculator<Integer> sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
List<SampleValue<Integer>> ll = new ArrayList<>();
collect.forEach(c -> {
SampleValue s = new SampleValue(c.getAgencyId(), c.getActivityCount());
ll.add(s);
FactIndexCommunityScoreDTO publishArticle = new FactIndexCommunityScoreDTO();
BeanUtils.copyProperties(c,publishArticle);
communityPublishArticle.add(publishArticle);
});
IndexInputVO<Integer> index1VO = new IndexInputVO<>(detail.getIndexId(), ll, detail.getThreshold(),detail.getWeight(), sc1);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS);
result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> {
communityPublishArticle.forEach(publish -> {
if (publish.getAgencyId().equals(agency.getSampleId())){
publish.setScore(agency.getSampleScore());
}
});
});
indexStart++;
} while (collect.size() == NumConstant.TEN);
}
break;
default:
}
});
subAllGridList.forEach(grid -> {
grid.setIndexCode(IndexCalConstant.COMMUNITY_SERVICE);
communityPublishArticle.forEach(publish -> {
if (grid.getAgencyId().equals(publish.getAgencyId())){
grid.setScore(grid.getScore().add(publish.getScore()));
grid.setCustomerId(customerId);
}
});
});
factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.COMMUNITY_SERVICE);
factIndexCommunityScoreDao.insertCommunityPartyRecord(subAllGridList);
}
/**
* @Description 社区相关计算
* @param customerId
* @param monthId
* @author zxc
* @date 2020/9/1 9:21 上午
*/
@Override
public void communityRelate(String customerId, String monthId) {
this.communityPartyCalculate(customerId, monthId); //党建能力
this.communityGovernAbilityCalculate(customerId, monthId); // 治理能力
this.communityServiceAbilityCalculate(customerId, monthId); // 服务能力
List<FactIndexCommunityScoreDTO> communityPublishArticle = new ArrayList<>();
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode());
List<FactIndexCommunityScoreDTO> factIndexCommunityScoreEntities = factIndexCommunityScoreDao.selectCommunityInfo(customerId, monthId);
detailListByParentCode.forEach(detail -> {
factIndexCommunityScoreEntities.forEach(community -> {
if (detail.getIndexCode().equals(community.getIndexCode())){
community.setScore(community.getScore().multiply(detail.getWeight()));
}
});
});
Map<String, List<FactIndexCommunityScoreDTO>> collect = factIndexCommunityScoreEntities.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId));
List<FactIndexCommunityScoreDTO> result = new ArrayList<>();
collect.forEach((key,value) -> {
FactIndexCommunityScoreDTO score = new FactIndexCommunityScoreDTO();
score.setIsTotal(NumConstant.ONE_STR);
score.setCustomerId(customerId);
score.setAgencyId(key);
score.setMonthId(monthId);
score.setYearId(DateUtils.getYearId(monthId));
score.setQuarterId(DateUtils.getQuarterId(monthId));
factIndexCommunityScoreEntities.forEach(community -> {
score.setScore(score.getScore().add(community.getScore()));
});
result.add(score);
});
factIndexCommunityScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.COMMUNITY_RELATE);
factIndexCommunityScoreDao.insertCommunityPartyRecord(result);
}
/**
* @Description Integer类型获取最大数和最小数
* @param list
@ -190,6 +441,16 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
return result;
}
public MaxAndMinBigDecimalResultDTO getMaxAndMinBigDecimal(List<BigDecimal> list){
BigDecimal max = Collections.max(list);
BigDecimal min = Collections.min(list);
MaxAndMinBigDecimalResultDTO result = new MaxAndMinBigDecimalResultDTO();
result.setMax(max);
result.setMin(min);
return result;
}
/**
* @Description Double类型获取最大数和最小数
* @param list

24
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml

@ -87,19 +87,19 @@
</insert>
<!-- 社区治理能力各个参数查询 -->
<select id="selectCommunityGovernAbility" resultType="com.epmet.dto.screen.result.CommunityGovernAbilityResultDTO">
<select id="selectCommunityGovernAbility" resultType="java.util.Map">
SELECT
agency_id AS agencyId,
parent_id AS parentId,
month_id AS monthId,
quarter_id AS quarterId,
year_id AS yearId,
transfered_count AS transferedCount,
closed_project_count AS closedProjectCount,
resp_project_ratio AS respProjectRatio,
overdue_project_ratio AS overDueProjectRatio,
closed_project_ratio AS closedProjectRatio,
satisfaction_ratio AS satisfactionRatio
AGENCY_ID,
PARENT_ID,
MONTH_ID,
QUARTER_ID,
YEAR_ID,
TRANSFERED_COUNT,
CLOSED_PROJECT_COUNT,
RESP_PROJECT_RATIO,
OVERDUE_PROJECT_RATIO,
CLOSED_PROJECT_RATIO,
SATISFACTION_RATIO
FROM
fact_index_govrn_ablity_org_monthly
WHERE

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml

@ -79,7 +79,8 @@
month_id,
quarter_id,
year_id,
publish_article_count
publish_article_count,
customer_id
FROM
fact_index_party_ablity_org_monthly
WHERE

19
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml

@ -70,4 +70,23 @@
)
</foreach>
</insert>
<!-- 社区活动组织次数 -->
<select id="selectActivityCount" resultType="com.epmet.dto.screen.result.CommunityActivityCountResultDTO">
SELECT
agency_id,
parent_id,
month_id,
quarter_id,
year_id,
activity_count,
customer_id
FROM
fact_index_service_ablity_org_monthly
WHERE
del_flag = '0'
AND data_type = 'community'
AND customer_id = #{customerId}
AND month_id = #{monthId}
</select>
</mapper>

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityGovrnFiveScoreDao.xml

@ -1,6 +0,0 @@
<?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.screen.FactIndexCommunityGovrnFiveScoreDao">
</mapper>

27
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityPartyFiveScoreDao.xml

@ -1,27 +0,0 @@
<?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.screen.FactIndexCommunityPartyFiveScoreDao">
<!-- 党建能力【社区】中间表插入 -->
<insert id="insertCommunityPartyRecord">
INSERT INTO fact_index_community_party_five_score ( ID, AGENCY_ID, MONTH_ID, INDEX_ID, TOTAL_SCORE, PARTY_ABILITY_SCORE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
<foreach collection="lists" item="item" separator=",">
(
REPLACE ( UUID(), '-', '' ),
#{item.agencyId},
#{item.monthId},
#{item.indexId},
#{item.totalScore},
#{item.partyAbilityScore},
#{item.delFlag},
#{item.revision},
#{item.createdBy},
NOW(),
#{item.updatedBy},
NOW()
)
</foreach>
</insert>
</mapper>

56
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityScoreDao.xml

@ -3,4 +3,60 @@
<mapper namespace="com.epmet.dao.screen.FactIndexCommunityScoreDao">
<!-- 党建能力【社区】中间表插入 -->
<insert id="insertCommunityPartyRecord">
INSERT INTO fact_index_community_score ( ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, IS_TOTAL, SCORE, INDEX_CODE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
<foreach collection="lists" item="item" separator=",">
(
REPLACE(UUID(),'-',''),
#{item.customerId},
#{item.agencyId},
#{item.parentAgencyId},
#{item.yearId},
#{item.quarterId},
#{item.monthId},
#{item.isTotal},
#{item.score},
#{item.indexCode},
#{item.delFlag},
#{item.revision},
#{item.createdBy},
NOW(),
#{item.updatedBy},
NOW()
)
</foreach>
</insert>
<!-- 删除旧记录 -->
<delete id="deleteOldRecord">
DELETE
FROM
fact_index_community_score
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND month_id = #{monthId}
AND index_code = #{indexCode}
</delete>
<!-- 查询社区相关信息 -->
<select id="selectCommunityInfo" resultType="com.epmet.dto.screen.FactIndexCommunityScoreDTO">
SELECT
CUSTOMER_ID,
AGENCY_ID,
MONTH_ID,
QUARTER_ID,
YEAR_ID,
SCORE,
INDEX_CODE
FROM
fact_index_community_score
WHERE
del_flag = 0
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
</select>
</mapper>

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityServiceFiveScoreDao.xml

@ -1,6 +0,0 @@
<?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.screen.FactIndexCommunityServiceFiveScoreDao">
</mapper>

44
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexGridScoreDao.xml

@ -8,13 +8,55 @@
SELECT
agency_id,
month_id,
AVG( party_ablity_score ) AS score
quarter_id,
year_id,
AVG( score ) AS score,
customer_id
FROM
fact_index_grid_score
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND month_id = #{monthId}
AND index_code = 'dangjiannengli'
GROUP BY agency_id
</select>
<!-- 社区下属所有网格治理能力汇总平均值 -->
<select id="selectSubGridGovernAvgScore" resultType="com.epmet.dto.screen.result.SubGridGovernAvgResultDTO">
SELECT
agency_id,
month_id,
quarter_id,
year_id,
AVG( score ) AS score,
customer_id
FROM
fact_index_grid_score
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND month_id = #{monthId}
AND index_code = 'zhilinengli'
GROUP BY agency_id
</select>
<!-- 社区下级所有网格服务能力得分平均值 -->
<select id="selectSubGridServiceAvgScore" resultType="com.epmet.dto.screen.result.SubGridServiceAvgResultDTO">
SELECT
agency_id,
month_id,
quarter_id,
year_id,
AVG( score ) AS score,
customer_id
FROM
fact_index_grid_score
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND month_id = #{monthId}
AND index_code = 'fuwunengli'
GROUP BY agency_id
</select>
</mapper>
Loading…
Cancel
Save