修改考核规则

This commit is contained in:
TS-QD1 2023-12-11 09:12:58 +08:00
parent 21dc86f636
commit 82157e032e
24 changed files with 774 additions and 41 deletions

37
readme.md Normal file
View File

@ -0,0 +1,37 @@
# 20231206迭代`未上线`
## 表结构调整
### kpi_khxz_wgy_3
| 字段 | 类型 | 默认值 | 描述 | 操作 |
|---------------------------------|--------------|-----|----------|----|
| community_base_population_count | int(11) | 0 | 社区基础人口数量 | 新增 |
| community_population_count | int(11) | 0 | 社区实际人口数量 | 新增 |
| community_population_rate | double(11,2) | 0 | 社区实际人口比例 | 新增 |
| population_count | int(11) | 0 | 人口数量 | 新增 |
| area_name | varchar(255) | 0 | 街道名称 | 新增 |
| community_name | varchar(255) | 0 | 社区名称 | 新增 |
### kpi_khxz_wgy_4
| 字段 | 类型 | 默认值 | 描述 | 操作 |
|---------------------------------|--------------|-----|----------|----|
| community_base_population_count | int(11) | 0 | 社区基础人口数量 | 新增 |
| community_population_count | int(11) | 0 | 社区实际人口数量 | 新增 |
| community_population_rate | double(11,2) | 0 | 社区实际人口比例 | 新增 |
| population_count | int(11) | 0 | 人口数量 | 新增 |
| area_name | varchar(255) | 0 | 街道名称 | 新增 |
| community_name | varchar(255) | 0 | 社区名称 | 新增 |
### kpi_khxz_zf_ga
| 字段 | 类型 | 默认值 | 描述 | 操作 |
|---------|--------------|-----|------|----|
| reasonF | varchar(255) | | 金额原因 | 新增 |
### kpi_khxz_znbm
| 字段 | 类型 | 默认值 | 描述 | 操作 |
|---------|--------------|-----|------|----|
| reasonF | varchar(255) | | 金额原因 | 新增 |

View File

@ -0,0 +1,99 @@
package com.cm.bigdata.config.db;
import com.alibaba.druid.pool.DruidDataSource;
import com.cm.bigdata.config.properties.db.Db3Properties;
import com.cm.bigdata.config.properties.db.DbCommonProperties;
import com.github.pagehelper.PageInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Properties;
@Configuration
@MapperScan(basePackages = {"com.cm.**.dao3"}, sqlSessionFactoryRef = "db3SqlSessionFactory")
public class Db3Config {
@Autowired
private DbCommonProperties dbCommonProperties;
@Autowired
private Db3Properties db3Properties;
@Bean(name = "db3DataSource")
public DataSource db3DataSource() throws SQLException {
DruidDataSource druid = new DruidDataSource();
// 监控统计拦截的filters
druid.setFilters(dbCommonProperties.getFilters());
// 配置基本属性
druid.setDriverClassName(db3Properties.getDriverClassName());
druid.setUsername(db3Properties.getUsername());
druid.setPassword(db3Properties.getPassword());
druid.setUrl(db3Properties.getUrl());
//初始化时建立物理连接的个数
druid.setInitialSize(dbCommonProperties.getInitialSize());
//最大连接池数量
druid.setMaxActive(dbCommonProperties.getMaxActive());
//最小连接池数量
druid.setMinIdle(dbCommonProperties.getMinIdle());
//获取连接时最大等待时间单位毫秒
druid.setMaxWait(dbCommonProperties.getMaxWait());
//间隔多久进行一次检测检测需要关闭的空闲连接
druid.setTimeBetweenEvictionRunsMillis(dbCommonProperties.getTimeBetweenEvictionRunsMillis());
//一个连接在池中最小生存的时间
druid.setMinEvictableIdleTimeMillis(dbCommonProperties.getMinEvictableIdleTimeMillis());
//用来检测连接是否有效的sql
druid.setValidationQuery(dbCommonProperties.getValidationQuery());
//建议配置为true不影响性能并且保证安全性
druid.setTestWhileIdle(dbCommonProperties.isTestWhileIdle());
//申请连接时执行validationQuery检测连接是否有效
druid.setTestOnBorrow(dbCommonProperties.isTestOnBorrow());
druid.setTestOnReturn(dbCommonProperties.isTestOnReturn());
//是否缓存preparedStatement也就是PSCacheoracle设为truemysql设为false分库分表较多推荐设置为false
druid.setPoolPreparedStatements(dbCommonProperties.isPoolPreparedStatements());
// 打开PSCache时指定每个连接上PSCache的大小
druid.setMaxPoolPreparedStatementPerConnectionSize(dbCommonProperties.getMaxPoolPreparedStatementPerConnectionSize());
return druid;
}
@Bean(name = "db3TransactionManager")
public DataSourceTransactionManager db3TransactionManager() throws SQLException {
return new DataSourceTransactionManager(db3DataSource());
}
public Interceptor pageHelper() {
Interceptor pageHelper = new PageInterceptor();
Properties p = new Properties();
p.setProperty("offsetAsPageNum", "true");
p.setProperty("rowBoundsWithCount", "true");
p.setProperty("reasonable", "true");
pageHelper.setProperties(p);
return pageHelper;
}
@Bean(name = "db3SqlSessionFactory")
public SqlSessionFactory db2SqlSessionFactory(@Qualifier("db3DataSource") DataSource dataSource) throws Exception {
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource); // 设置数据源bean
sessionFactory.setPlugins(new Interceptor[]{pageHelper()});
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(db3Properties.getMapperLocations())); // 设置mapper文件路径
return sessionFactory.getObject();
}
@Bean("db3SqlSessionTemplate")
public SqlSessionTemplate db2SqlSessionTemplate(@Qualifier("db3SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}

View File

@ -0,0 +1,64 @@
package com.cm.bigdata.config.properties.db;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "spring.datasource.druid.db3")
public class Db3Properties {
private String url;
private String dbType;
private String driverClassName;
private String username;
private String password;
private String mapperLocations;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDbType() {
return dbType;
}
public void setDbType(String dbType) {
this.dbType = dbType;
}
public String getDriverClassName() {
return driverClassName;
}
public void setDriverClassName(String driverClassName) {
this.driverClassName = driverClassName;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMapperLocations() {
return mapperLocations;
}
public void setMapperLocations(String mapperLocations) {
this.mapperLocations = mapperLocations;
}
}

View File

@ -0,0 +1,21 @@
package com.cm.bigdata.dao3.kpi;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInAreaCountPO;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInCommunityCountPO;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public interface IPopulationInfoDao {
List<BasePopulationInfoCountPO> listPopulationSaveCount(Map<String, Object> params);
List<BasePopulationInfoCountPO> listPopulationUpdateCount(Map<String, Object> params);
List<BasePopulationInAreaCountPO> listPopulationInAreaCount(Map<String, Object> params);
List<BasePopulationInCommunityCountPO> listPopulationInCommunityCount(Map<String, Object> params);
}

View File

@ -217,10 +217,18 @@ public class KpiKhxzWgyDTO implements Serializable {
*/
@ExcelIgnore
private String reasonV;
@ExcelProperty(value = {"人口信息管理", "社区基数人口数"}, index = 22)
private Integer communityBasePopulationCount;
@ExcelProperty(value = {"人口信息管理", "社区录入人口数"}, index = 23)
private Integer communityPopulationCount;
@ExcelProperty(value = {"人口信息管理", "社区人口录入比例"}, index = 24)
private Double communityPopulationRate;
@ExcelIgnore
private Integer populationCount;
/**
* 人口信息录入
*/
@ExcelProperty(value = {"人口信息管理", "人口信息录入"}, index = 22)
@ExcelProperty(value = {"人口信息管理", "人口信息录入"}, index = 25)
@JsonProperty("W")
private Double w;
/**
@ -231,7 +239,7 @@ public class KpiKhxzWgyDTO implements Serializable {
/**
* 人口信息质量管理
*/
@ExcelProperty(value = {"人口信息管理", "人口信息质量管理"}, index = 23)
@ExcelProperty(value = {"人口信息管理", "人口信息质量管理"}, index = 26)
@JsonProperty("X")
private Double x;
/**
@ -242,7 +250,7 @@ public class KpiKhxzWgyDTO implements Serializable {
/**
* 人口信息维护
*/
@ExcelProperty(value = {"人口信息管理", "人口信息维护"}, index = 24)
@ExcelProperty(value = {"人口信息管理", "人口信息维护"}, index = 27)
@JsonProperty("Y")
private Double y;
/**
@ -253,7 +261,7 @@ public class KpiKhxzWgyDTO implements Serializable {
/**
* 抽查情况
*/
@ExcelProperty(value = {"人口信息管理", "抽查情况"}, index = 25)
@ExcelProperty(value = {"人口信息管理", "抽查情况"}, index = 28)
@JsonProperty("Z")
private Double z;
/**
@ -264,7 +272,7 @@ public class KpiKhxzWgyDTO implements Serializable {
/**
* 党建信息上报
*/
@ExcelProperty(value = {"党组织建设", "党建信息上报"}, index = 26)
@ExcelProperty(value = {"党组织建设", "党建信息上报"}, index = 29)
@JsonProperty("AA")
private Double aA;
/**
@ -275,7 +283,7 @@ public class KpiKhxzWgyDTO implements Serializable {
/**
* 党建信息质量管理
*/
@ExcelProperty(value = {"党组织建设", "党建信息质量管理"}, index = 27)
@ExcelProperty(value = {"党组织建设", "党建信息质量管理"}, index = 30)
@JsonProperty("AB")
private Double aB;
/**
@ -286,7 +294,7 @@ public class KpiKhxzWgyDTO implements Serializable {
/**
* 党建信息维护
*/
@ExcelProperty(value = {"党组织建设", "党建信息维护"}, index = 28)
@ExcelProperty(value = {"党组织建设", "党建信息维护"}, index = 31)
@JsonProperty("AC")
private Double aC;
/**
@ -297,7 +305,7 @@ public class KpiKhxzWgyDTO implements Serializable {
/**
* 抽查情况
*/
@ExcelProperty(value = {"党组织建设", "抽查情况"}, index = 29)
@ExcelProperty(value = {"党组织建设", "抽查情况"}, index = 32)
@JsonProperty("AD")
private Double aD;
/**
@ -308,25 +316,25 @@ public class KpiKhxzWgyDTO implements Serializable {
/**
* 总得分
*/
@ExcelProperty(value = {"总得分"}, index = 30)
@ExcelProperty(value = {"总得分"}, index = 33)
@JsonProperty("AE")
private Double aE;
/**
* 应发绩效工资
*/
@ExcelProperty(value = {"应发(浮动)绩效工资"}, index = 31)
@ExcelProperty(value = {"应发(浮动)绩效工资"}, index = 34)
@JsonProperty("AF")
private String aF;
/**
* 实发绩效工资
*/
@ExcelProperty(value = {"实发绩效工资"}, index = 32)
@ExcelProperty(value = {"实发绩效工资"}, index = 35)
@JsonProperty("AG")
private Double aG;
/**
* 评价
*/
@ExcelProperty(value = {"评价"}, index = 33)
@ExcelProperty(value = {"评价"}, index = 36)
@JsonProperty("AH")
private String aH;
/**
@ -339,6 +347,11 @@ public class KpiKhxzWgyDTO implements Serializable {
*/
@ExcelIgnore
private String modifier;
@ExcelIgnore
private String areaName;
@ExcelIgnore
private String communityName;
public Long getId() {
return id;
@ -803,4 +816,52 @@ public class KpiKhxzWgyDTO implements Serializable {
public void setModifier(String modifier) {
this.modifier = modifier;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getCommunityName() {
return communityName;
}
public void setCommunityName(String communityName) {
this.communityName = communityName;
}
public Integer getCommunityBasePopulationCount() {
return communityBasePopulationCount;
}
public void setCommunityBasePopulationCount(Integer communityBasePopulationCount) {
this.communityBasePopulationCount = communityBasePopulationCount;
}
public Integer getCommunityPopulationCount() {
return communityPopulationCount;
}
public void setCommunityPopulationCount(Integer communityPopulationCount) {
this.communityPopulationCount = communityPopulationCount;
}
public Double getCommunityPopulationRate() {
return communityPopulationRate;
}
public void setCommunityPopulationRate(Double communityPopulationRate) {
this.communityPopulationRate = communityPopulationRate;
}
public Integer getPopulationCount() {
return populationCount;
}
public void setPopulationCount(Integer populationCount) {
this.populationCount = populationCount;
}
}

View File

@ -101,6 +101,11 @@ public class KpiKhxzZfGaDTO implements Serializable {
@ExcelProperty(value = {"案件受理数量", "案件奖励(元)"}, index = 5)
@JsonProperty("F")
private Double f;
@Size(max = 255, message = "编码长度不能超过255")
@ApiModelProperty("案件奖励(元)原因")
@Length(max = 255, message = "编码长度不能超过255")
@ExcelIgnore
private String reasonF;
/**
* 未在规定的时限内退单影响处置时效
*/
@ -321,6 +326,14 @@ public class KpiKhxzZfGaDTO implements Serializable {
this.f = f;
}
public String getReasonF() {
return reasonF;
}
public void setReasonF(String reasonF) {
this.reasonF = reasonF;
}
public Double getG() {
return g;
}

View File

@ -101,6 +101,11 @@ public class KpiKhxzZnbmDTO implements Serializable {
@ExcelProperty(value = {"案件受理数量", "案件办理得分与奖励金额", "案件积分奖励(元)"}, index = 5)
@JsonProperty("F")
private Double f;
@Size(max= 255,message="编码长度不能超过255")
@ApiModelProperty("金额原因")
@Length(max= 255,message="编码长度不能超过255")
@ExcelIgnore
private String reasonF;
/**
* 案件办理得分与奖励金额得分
*/
@ -312,6 +317,14 @@ public class KpiKhxzZnbmDTO implements Serializable {
this.f = f;
}
public String getReasonF() {
return reasonF;
}
public void setReasonF(String reasonF) {
this.reasonF = reasonF;
}
public Double getG() {
return g;
}

View File

@ -0,0 +1,24 @@
package com.cm.bigdata.pojo.pos.kpi;
public class BasePopulationInAreaCountPO {
private String creatorArea1;
private Integer total;
public String getCreatorArea1() {
return creatorArea1;
}
public void setCreatorArea1(String creatorArea1) {
this.creatorArea1 = creatorArea1;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
}

View File

@ -0,0 +1,33 @@
package com.cm.bigdata.pojo.pos.kpi;
public class BasePopulationInCommunityCountPO {
private String creatorArea1;
private String creatorArea2;
private Integer total;
public String getCreatorArea1() {
return creatorArea1;
}
public void setCreatorArea1(String creatorArea1) {
this.creatorArea1 = creatorArea1;
}
public String getCreatorArea2() {
return creatorArea2;
}
public void setCreatorArea2(String creatorArea2) {
this.creatorArea2 = creatorArea2;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
}

View File

@ -6,6 +6,10 @@ public class CommunityPO {
private String communityName;
private String areaId;
private String areaName;
private Integer baseGridCount;
private Integer baseCommunityBossCount;
private Integer baseHouseCount;
private Integer basePopulationCount;
public String getCommunityId() {
return communityId;
@ -38,4 +42,36 @@ public class CommunityPO {
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public Integer getBaseGridCount() {
return baseGridCount;
}
public void setBaseGridCount(Integer baseGridCount) {
this.baseGridCount = baseGridCount;
}
public Integer getBaseCommunityBossCount() {
return baseCommunityBossCount;
}
public void setBaseCommunityBossCount(Integer baseCommunityBossCount) {
this.baseCommunityBossCount = baseCommunityBossCount;
}
public Integer getBaseHouseCount() {
return baseHouseCount;
}
public void setBaseHouseCount(Integer baseHouseCount) {
this.baseHouseCount = baseHouseCount;
}
public Integer getBasePopulationCount() {
return basePopulationCount;
}
public void setBasePopulationCount(Integer basePopulationCount) {
this.basePopulationCount = basePopulationCount;
}
}

View File

@ -0,0 +1,28 @@
package com.cm.bigdata.service.kpi;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInAreaCountPO;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInCommunityCountPO;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO;
import java.util.List;
import java.util.Map;
public interface IPopulationInfoService {
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIds(List<String> userIds);
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserId(String userId);
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdsAndDay(List<String> userIds, String date);
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdAndDay(String userId, String date);
List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdsAndDay(List<String> userIds, String date);
List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdAndDay(String userId, String date);
List<BasePopulationInAreaCountPO> listPopulationInAreaCount();
List<BasePopulationInCommunityCountPO> listPopulationInCommunityCount();
}

View File

@ -39,6 +39,8 @@ public class KpiServiceImpl implements IKpiService {
@Autowired
private IBasePopulationInfoService basePopulationInfoService;
@Autowired
private IPopulationInfoService populationInfoService;
@Autowired
private IReportCaseService reportCaseService;
@Autowired
private IUserService userService;
@ -76,9 +78,9 @@ public class KpiServiceImpl implements IKpiService {
int isHoliday = KpiUtil.hasValueInList(holidays, date) ? 1 : 0;
Map<String, List<UserSigninPO>> userSigninMap = KpiUtil.mapSignin(userSignService, userIds, date);
Map<String, List<UserSignoutPO>> userSignoutMap = KpiUtil.mapSignout(userSignService, userIds, date);
Map<String, Integer> populationCountMap = KpiUtil.mapPopulationCount(basePopulationInfoService, userIds);
Map<String, Integer> populationSaveCountMap = KpiUtil.mapPopulationSaveCount(basePopulationInfoService, userIds, date);
Map<String, Integer> populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(basePopulationInfoService, userIds, date);
Map<String, Integer> populationCountMap = KpiUtil.mapPopulationCount(populationInfoService, userIds);
Map<String, Integer> populationSaveCountMap = KpiUtil.mapPopulationSaveCount(populationInfoService, userIds, date);
Map<String, Integer> populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(populationInfoService, userIds, date);
Map<String, LeavePO> leaveMap = KpiUtil.mapLeave(leaveService, userIds, date);
// 删除当日数据
@ -195,9 +197,9 @@ public class KpiServiceImpl implements IKpiService {
int isHoliday = KpiUtil.hasValueInList(holidays, date) ? 1 : 0;
Map<String, List<UserSigninPO>> userSigninMap = KpiUtil.mapSignin(userSignService, userId, date);
Map<String, List<UserSignoutPO>> userSignoutMap = KpiUtil.mapSignout(userSignService, userId, date);
Map<String, Integer> populationCountMap = KpiUtil.mapPopulationCount(basePopulationInfoService, userId);
Map<String, Integer> populationSaveCountMap = KpiUtil.mapPopulationSaveCount(basePopulationInfoService, userId, date);
Map<String, Integer> populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(basePopulationInfoService, userId, date);
Map<String, Integer> populationCountMap = KpiUtil.mapPopulationCount(populationInfoService, userId);
Map<String, Integer> populationSaveCountMap = KpiUtil.mapPopulationSaveCount(populationInfoService, userId, date);
Map<String, Integer> populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(populationInfoService, userId, date);
Map<String, LeavePO> leaveMap = KpiUtil.mapLeave(leaveService, userId, date);
// 删除当日数据
deleteCommunityBossDayCount(date, communityBossLevel, userId);

View File

@ -0,0 +1,79 @@
package com.cm.bigdata.service.kpi.impl;
import com.cm.bigdata.dao3.kpi.IPopulationInfoDao;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInAreaCountPO;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInCommunityCountPO;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO;
import com.cm.bigdata.service.kpi.IPopulationInfoService;
import com.cm.common.base.AbstractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class PopulationInfoServiceImpl extends AbstractService implements IPopulationInfoService {
@Autowired
private IPopulationInfoDao populationInfoDao;
@Override
public List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIds(List<String> userIds) {
Map<String, Object> params = new HashMap<>();
params.put("userIds", userIds);
return populationInfoDao.listPopulationSaveCount(params);
}
@Override
public List<BasePopulationInfoCountPO> listPopulationSaveCountByUserId(String userId) {
Map<String, Object> params = new HashMap<>();
params.put("userId", userId);
return populationInfoDao.listPopulationSaveCount(params);
}
@Override
public List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdsAndDay(List<String> userIds, String date) {
Map<String, Object> params = new HashMap<>();
params.put("day", date);
params.put("userIds", userIds);
return populationInfoDao.listPopulationSaveCount(params);
}
@Override
public List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdAndDay(String userId, String date) {
Map<String, Object> params = new HashMap<>();
params.put("day", date);
params.put("userId", userId);
return populationInfoDao.listPopulationSaveCount(params);
}
@Override
public List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdsAndDay(List<String> userIds, String date) {
Map<String, Object> params = new HashMap<>();
params.put("day", date);
params.put("userIds", userIds);
return populationInfoDao.listPopulationUpdateCount(params);
}
@Override
public List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdAndDay(String userId, String date) {
Map<String, Object> params = new HashMap<>();
params.put("day", date);
params.put("userId", userId);
return populationInfoDao.listPopulationUpdateCount(params);
}
@Override
public List<BasePopulationInAreaCountPO> listPopulationInAreaCount() {
Map<String, Object> params = new HashMap<>();
return populationInfoDao.listPopulationInAreaCount(params);
}
@Override
public List<BasePopulationInCommunityCountPO> listPopulationInCommunityCount() {
Map<String, Object> params = new HashMap<>();
return populationInfoDao.listPopulationInCommunityCount(params);
}
}

View File

@ -5,11 +5,8 @@ import com.cm.bigdata.dao.kpi.IKpiHolidayDao;
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
import com.cm.bigdata.monitor.KpiUpdateMonitor;
import com.cm.bigdata.pojo.dtos.kpi.CommunityBossDTO;
import com.cm.bigdata.pojo.pos.kpi.UserPO;
import com.cm.bigdata.service.kpi.ICommunityBossService;
import com.cm.bigdata.service.kpi.IKpiService;
import com.cm.bigdata.service.kpi.IUserGridService;
import com.cm.bigdata.service.kpi.IUserService;
import com.cm.bigdata.pojo.pos.kpi.*;
import com.cm.bigdata.service.kpi.*;
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyCRunnable;
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyCUserRunnable;
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyEGIKRTRunnable;
@ -39,6 +36,10 @@ public class KpiKhxzWgyTask {
@Autowired
private ICommunityBossService communityBossService;
@Autowired
private ICommunityService communityService;
@Autowired
private IPopulationInfoService populationInfoService;
@Autowired
private IUserGridService userGridService;
private ExecutorService executorService = Executors.newFixedThreadPool(2);
@ -94,13 +95,20 @@ public class KpiKhxzWgyTask {
}
List<String> userIds = communityBossDTOS.stream().map(CommunityBossDTO::getCommunityBossUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
List<UserPO> userPOS = userService.listPO(userIds);
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = populationInfoService.listPopulationSaveCountByUserIds(userIds);
List<BasePopulationInCommunityCountPO> basePopulationInCommunityCountPOS = populationInfoService.listPopulationInCommunityCount();
List<CommunityPO> communityPOS = communityService.listPO(new HashMap<>());
userPOS.forEach(userPO -> {
String areaId = null;
String areaName = null;
String communityId = null;
String communityName = null;
for (CommunityBossDTO communityBossDTO : communityBossDTOS) {
if (StringUtils.equals(userPO.getUserId(), communityBossDTO.getCommunityBossUserId())) {
areaId = communityBossDTO.getAreaId();
areaName = communityBossDTO.getAreaName();
communityId = communityBossDTO.getCommunityId();
communityName = communityBossDTO.getCommunityName();
break;
}
}
@ -119,6 +127,11 @@ public class KpiKhxzWgyTask {
saveParams.put("khMonth", khMonth);
saveParams.put("wgyLevel", wgyLevel);
saveParams.put("gridCount", gridCount);
saveParams.put("areaName", areaName);
saveParams.put("communityName", communityName);
setPopulationCount(userPO.getUserId(), saveParams, basePopulationInfoCountPOS);
setPopulationInCommunityCount(communityName, saveParams, basePopulationInCommunityCountPOS);
setPopulationRate(communityId, saveParams, communityPOS);
kpiKhxzWgyDao.save(saveParams);
});
KpiUpdateMonitor.getInstance().complete();
@ -138,13 +151,20 @@ public class KpiKhxzWgyTask {
}
List<String> userIds = communityBossDTOS.stream().map(CommunityBossDTO::getCommunityBossUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
List<UserPO> userPOS = userService.listPO(userIds);
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = populationInfoService.listPopulationSaveCountByUserIds(userIds);
List<BasePopulationInCommunityCountPO> basePopulationInCommunityCountPOS = populationInfoService.listPopulationInCommunityCount();
List<CommunityPO> communityPOS = communityService.listPO(new HashMap<>());
userPOS.forEach(userPO -> {
String areaId = null;
String areaName = null;
String communityId = null;
String communityName = null;
for (CommunityBossDTO communityBossDTO : communityBossDTOS) {
if (StringUtils.equals(userPO.getUserId(), communityBossDTO.getCommunityBossUserId())) {
areaId = communityBossDTO.getAreaId();
areaName = communityBossDTO.getAreaName();
communityId = communityBossDTO.getCommunityId();
communityName = communityBossDTO.getCommunityName();
break;
}
}
@ -163,6 +183,11 @@ public class KpiKhxzWgyTask {
saveParams.put("khMonth", khMonth);
saveParams.put("wgyLevel", wgyLevel);
saveParams.put("gridCount", gridCount);
saveParams.put("areaName", areaName);
saveParams.put("communityName", communityName);
setPopulationCount(userPO.getUserId(), saveParams, basePopulationInfoCountPOS);
setPopulationInCommunityCount(communityName, saveParams, basePopulationInCommunityCountPOS);
setPopulationRate(communityId, saveParams, communityPOS);
kpiKhxzWgyDao.save(saveParams);
});
}
@ -175,4 +200,49 @@ public class KpiKhxzWgyTask {
return kpiKhxzWgyDao.listUserId(params);
}
private void setPopulationCount(String userId, Map<String, Object> params, List<BasePopulationInfoCountPO> basePopulationInfoCountPOS) {
boolean isExist = false;
for (BasePopulationInfoCountPO basePopulationInfoCountPO : basePopulationInfoCountPOS) {
if (StringUtils.equals(userId, basePopulationInfoCountPO.getUserId())) {
params.put("populationCount", basePopulationInfoCountPO.getTotal());
isExist = true;
break;
}
}
if (!isExist) {
params.put("populationCount", 0);
}
}
private void setPopulationInCommunityCount(String communityName, Map<String, Object> params, List<BasePopulationInCommunityCountPO> populationInCommunityCountPOS) {
boolean isExist = false;
for (BasePopulationInCommunityCountPO basePopulationInCommunityCountPO : populationInCommunityCountPOS) {
if (StringUtils.equals(communityName, basePopulationInCommunityCountPO.getCreatorArea2())) {
params.put("communityPopulationCount", basePopulationInCommunityCountPO.getTotal());
isExist = true;
break;
}
}
if (!isExist) {
params.put("communityPopulationCount", 0);
}
}
private void setPopulationRate(String communityId, Map<String, Object> params, List<CommunityPO> communityPOS) {
Integer communityPopulationCount = (Integer) params.get("communityPopulationCount");
for (CommunityPO communityPO : communityPOS) {
if (StringUtils.equals(communityId, communityPO.getCommunityId())) {
params.put("communityBasePopulationCount", communityPO.getBasePopulationCount());
if (communityPopulationCount > communityPO.getBasePopulationCount()) {
params.put("communityPopulationRate", 1D);
break;
}
if (communityPO.getBasePopulationCount() == 0) {
params.put("communityPopulationRate", 0D);
break;
}
params.put("communityPopulationRate", Math.round((double) communityPopulationCount / communityPO.getBasePopulationCount() * 100D) * 0.01);
}
}
}
}

View File

@ -19,6 +19,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
@Service
public class KpiKhxzZnbmTask {
@ -42,7 +43,8 @@ public class KpiKhxzZnbmTask {
KpiUpdateMonitor.getInstance().complete();
return;
}
executorService.execute(new KpiKhxzZnbmCDEFGLMRunnable(kpiKhxzZnbmDao, kpiDao, khYear, khMonth, userIds));
List<String> ldjcddUserIds = listLdjcddUserId();
executorService.execute(new KpiKhxzZnbmCDEFGLMRunnable(kpiKhxzZnbmDao, kpiDao, khYear, khMonth, userIds, ldjcddUserIds));
executorService.execute(new KpiKhxzZnbmIJRunnable(kpiKhxzZnbmDao, kpiDao, khYear, khMonth, userIds));
}
@ -84,4 +86,17 @@ public class KpiKhxzZnbmTask {
return kpiKhxzZnbmDao.listUserId(params);
}
/**
* 劳动监察大队的用户ID列表
* departmentId: 920105cd-8596-4d24-96ac-6d984abc915f
*
* @return
*/
private List<String> listLdjcddUserId() {
Map<String, Object> params = new HashMap<>();
// 劳动检查大队
params.put("departmentId", "920105cd-8596-4d24-96ac-6d984abc915f");
return userService.listPO(params).stream().map(UserPO::getUserId).collect(Collectors.toList());
}
}

View File

@ -47,7 +47,7 @@ public class KpiKhxzZfGaDEFRunnable implements Runnable {
updateParams.put("userId", userId);
updateParams.put("D", unInspectCount);
updateParams.put("E", inspectCount);
double F = inspectCount * 200 + unInspectCount * 200 * 0.6;
double F = inspectCount * 50 + unInspectCount * 50 * 0.6;
updateParams.put("F", F);
kpiKhxzZfGaDao.updateDEF(updateParams);
});

View File

@ -4,6 +4,7 @@ import com.cm.bigdata.dao.kpi.IKpiDao;
import com.cm.bigdata.dao.kpi.IKpiKhxzZnbmDao;
import com.cm.bigdata.monitor.KpiUpdateMonitor;
import com.cm.bigdata.pojo.pos.kpi.CasePO;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.List;
@ -16,13 +17,15 @@ public class KpiKhxzZnbmCDEFGLMRunnable implements Runnable {
private int khYear;
private int khMonth;
private List<String> userIds;
private List<String> ldjcddUserIds;
public KpiKhxzZnbmCDEFGLMRunnable(IKpiKhxzZnbmDao kpiKhxzZnbmDao, IKpiDao kpiDao, int khYear, int khMonth, List<String> userIds) {
public KpiKhxzZnbmCDEFGLMRunnable(IKpiKhxzZnbmDao kpiKhxzZnbmDao, IKpiDao kpiDao, int khYear, int khMonth, List<String> userIds, List<String> ldjcddUserIds) {
this.kpiKhxzZnbmDao = kpiKhxzZnbmDao;
this.kpiDao = kpiDao;
this.khYear = khYear;
this.khMonth = khMonth;
this.userIds = userIds;
this.ldjcddUserIds = ldjcddUserIds;
}
@Override
@ -48,7 +51,12 @@ public class KpiKhxzZnbmCDEFGLMRunnable implements Runnable {
updateParams.put("C", handleCount);
updateParams.put("D", inspectCount);
updateParams.put("E", unInspectCount);
updateParams.put("F", inspectCount * 200D);
// 这里劳动监察大队是50其余的部门是200
if (ldjcddUserIds.contains(userId)) {
updateParams.put("F", inspectCount * 50D);
} else {
updateParams.put("F", inspectCount * 200D);
}
double G = handleCount == 0 ? 0 : 60D / handleCount * inspectCount;
updateParams.put("G", G);
updateParams.put("L", G > 0 ? 20 : 0);

View File

@ -232,8 +232,8 @@ public class KpiUtil {
**/
}
public static Map<String, Integer> mapPopulationCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserIds(userIds);
public static Map<String, Integer> mapPopulationCount(IPopulationInfoService populationInfoService, List<String> userIds) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = populationInfoService.listPopulationSaveCountByUserIds(userIds);
Map<String, Integer> map = new HashMap<>();
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
@ -241,8 +241,8 @@ public class KpiUtil {
return map;
}
public static Map<String, Integer> mapPopulationCount(IBasePopulationInfoService basePopulationInfoService, String userId) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserId(userId);
public static Map<String, Integer> mapPopulationCount(IPopulationInfoService populationInfoService, String userId) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = populationInfoService.listPopulationSaveCountByUserId(userId);
Map<String, Integer> map = new HashMap<>();
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
@ -250,8 +250,8 @@ public class KpiUtil {
return map;
}
public static Map<String, Integer> mapPopulationSaveCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserIdsAndDay(userIds, date);
public static Map<String, Integer> mapPopulationSaveCount(IPopulationInfoService populationInfoService, List<String> userIds, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = populationInfoService.listPopulationSaveCountByUserIdsAndDay(userIds, date);
Map<String, Integer> map = new HashMap<>();
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
@ -259,8 +259,8 @@ public class KpiUtil {
return map;
}
public static Map<String, Integer> mapPopulationSaveCount(IBasePopulationInfoService basePopulationInfoService, String userId, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserIdAndDay(userId, date);
public static Map<String, Integer> mapPopulationSaveCount(IPopulationInfoService populationInfoService, String userId, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = populationInfoService.listPopulationSaveCountByUserIdAndDay(userId, date);
Map<String, Integer> map = new HashMap<>();
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
@ -268,8 +268,8 @@ public class KpiUtil {
return map;
}
public static Map<String, Integer> mapPopulationUpdateCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationUpdateCountByUserIdsAndDay(userIds, date);
public static Map<String, Integer> mapPopulationUpdateCount(IPopulationInfoService populationInfoService, List<String> userIds, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = populationInfoService.listPopulationUpdateCountByUserIdsAndDay(userIds, date);
Map<String, Integer> map = new HashMap<>();
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
@ -277,8 +277,8 @@ public class KpiUtil {
return map;
}
public static Map<String, Integer> mapPopulationUpdateCount(IBasePopulationInfoService basePopulationInfoService, String userId, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationUpdateCountByUserIdAndDay(userId, date);
public static Map<String, Integer> mapPopulationUpdateCount(IPopulationInfoService populationInfoService, String userId, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = populationInfoService.listPopulationUpdateCountByUserIdAndDay(userId, date);
Map<String, Integer> map = new HashMap<>();
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());

View File

@ -34,6 +34,13 @@ spring:
username: root
password: root
mapper-locations: classpath*:mybatis/db2-mapper/**/*.xml
db3:
url: jdbc:mysql://192.168.0.151:3306/db_baotou_city?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false
db-type: mysql
driver-class-name: com.mysql.jdbc.Driver
username: root
password: root
mapper-locations: classpath*:mybatis/db3-mapper/**/*.xml
initial-size: 2
min-idle: 2
max-active: 5

View File

@ -7,6 +7,10 @@
<result column="community_name" property="communityName"/>
<result column="area_id" property="areaId"/>
<result column="area_name" property="areaName"/>
<result column="base_grid_count" property="baseGridCount"/>
<result column="base_community_boss_count" property="baseCommunityBossCount"/>
<result column="base_house_count" property="baseHouseCount"/>
<result column="base_population_count" property="basePopulationCount"/>
</resultMap>

View File

@ -0,0 +1,95 @@
<?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.cm.bigdata.dao3.kpi.IPopulationInfoDao">
<resultMap id="basePopulationInfoCountPO" type="com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO">
<result column="user_id" property="userId"/>
<result column="total" property="total"/>
</resultMap>
<resultMap id="basePopulationInAreaCountPO" type="com.cm.bigdata.pojo.pos.kpi.BasePopulationInAreaCountPO">
<result column="creator_area1" property="creatorArea1"/>
<result column="total" property="total"/>
</resultMap>
<resultMap id="basePopulationInCommunityCountPO" type="com.cm.bigdata.pojo.pos.kpi.BasePopulationInCommunityCountPO">
<result column="creator_area1" property="creatorArea1"/>
<result column="creator_area2" property="creatorArea2"/>
<result column="total" property="total"/>
</resultMap>
<select id="listPopulationSaveCount" parameterType="map" resultMap="basePopulationInfoCountPO">
SELECT
creator user_id,
COUNT(creator) total
FROM
population_population_info
WHERE
is_delete = 0
<if test="day != null and day != ''">
AND
LEFT(gmt_create, 10) = #{day}
</if>
<if test="userId != null and userId != ''">
AND
creator = #{userId}
</if>
<if test="userIds != null and userIds.size > 0">
AND
creator IN
<foreach collection="userIds" index="index" open="(" separator="," close=")">
#{userIds[${index}]}
</foreach>
</if>
GROUP BY
creator
</select>
<select id="listPopulationUpdateCount" parameterType="map" resultMap="basePopulationInfoCountPO">
SELECT
modifier user_id,
COUNT(modifier) total
FROM
population_population_info
WHERE
is_delete = 0
<if test="day != null and day != ''">
AND
LEFT(gmt_create, 10) = #{day}
</if>
<if test="userIds != null and userIds.size > 0">
AND
modifier IN
<foreach collection="userIds" index="index" open="(" separator="," close=")">
#{userIds[${index}]}
</foreach>
</if>
GROUP BY
modifier
</select>
<select id="listPopulationInAreaCount" parameterType="map" resultMap="basePopulationInAreaCountPO">
SELECT
creator_area1,
COUNT(creator_area1) total
FROM
population_population_info
WHERE
is_delete = 0
GROUP BY
creator_area1
</select>
<select id="listPopulationInCommunityCount" parameterType="map" resultMap="basePopulationInCommunityCountPO">
SELECT
creator_area2,
COUNT(creator_area2) total
FROM
population_population_info
WHERE
is_delete = 0
GROUP BY
creator_area2
</select>
</mapper>

View File

@ -61,6 +61,12 @@
<result column="AH" property="aH"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="area_name" property="areaName"/>
<result column="community_name" property="communityName"/>
<result column="community_base_population_count" property="communityBasePopulationCount"/>
<result column="community_population_count" property="communityPopulationCount"/>
<result column="community_population_rate" property="communityPopulationRate"/>
<result column="population_count" property="populationCount"/>
</resultMap>
<insert id="save" parameterType="map">
@ -72,7 +78,13 @@
kh_year,
kh_month,
grid_count,
B
B,
area_name,
community_name,
community_base_population_count,
community_population_count,
community_population_rate,
population_count
) VALUES (
#{areaId},
#{communityId},
@ -81,7 +93,13 @@
#{khYear},
#{khMonth},
#{gridCount},
#{B}
#{B},
#{areaName},
#{communityName},
#{communityBasePopulationCount},
#{communityPopulationCount},
#{communityPopulationRate},
#{populationCount}
)
</insert>

View File

@ -15,6 +15,7 @@
<result column="D" property="d"/>
<result column="E" property="e"/>
<result column="F" property="f"/>
<result column="reasonF" property="reasonF"/>
<result column="G" property="g"/>
<result column="reasonG" property="reasonG"/>
<result column="H" property="h"/>
@ -124,6 +125,8 @@
UPDATE
kpi_khxz_zf_ga
SET
F = #{F},
reasonF = #{reasonF},
G = #{G},
reasonG = #{reasonG},
H = #{H},

View File

@ -15,6 +15,7 @@
<result column="D" property="d"/>
<result column="E" property="e"/>
<result column="F" property="f"/>
<result column="reasonF" property="reasonF"/>
<result column="G" property="g"/>
<result column="H" property="h"/>
<result column="reasonH" property="reasonH"/>
@ -128,6 +129,8 @@
UPDATE
kpi_khxz_znbm
SET
F = #{F},
reasonF = #{reasonF},
H = #{H},
reasonH = #{reasonH},
K = #{K},