增加多数据源,增加4、5级网格员日通功能

This commit is contained in:
TS-QD1 2023-03-23 17:57:02 +08:00
parent 3d22945204
commit 8f786ad420
37 changed files with 2102 additions and 17 deletions

View File

@ -94,6 +94,12 @@
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

View File

@ -15,7 +15,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@SpringBootApplication
@ComponentScan("com.cm")
@MapperScan({"com.cm.**.dao"})
//@MapperScan({"com.cm.**.dao"})
@EnableScheduling
public class BigdataApplication {

View File

@ -0,0 +1,87 @@
package com.cm.bigdata.config.db;
import com.alibaba.druid.pool.DruidDataSource;
import com.cm.bigdata.config.properties.db.Db1Properties;
import com.cm.bigdata.config.properties.db.DbCommonProperties;
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.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
import java.sql.SQLException;
@Configuration
@MapperScan(basePackages = {"com.cm.**.dao"}, sqlSessionFactoryRef = "db1SqlSessionFactory")
public class Db1Config {
@Autowired
private DbCommonProperties dbCommonProperties;
@Autowired
private Db1Properties db1Properties;
@Bean(name = "db1DataSource")
public DataSource db1DataSource() throws SQLException {
DruidDataSource druid = new DruidDataSource();
// 监控统计拦截的filters
druid.setFilters(dbCommonProperties.getFilters());
// 配置基本属性
druid.setDriverClassName(db1Properties.getDriverClassName());
druid.setUsername(db1Properties.getUsername());
druid.setPassword(db1Properties.getPassword());
druid.setUrl(db1Properties.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 = "db1TransactionManager")
@Primary
public DataSourceTransactionManager db1TransactionManager() throws SQLException {
return new DataSourceTransactionManager(db1DataSource());
}
@Bean(name = "db1SqlSessionFactory")
public SqlSessionFactory db1SqlSessionFactory(@Qualifier("db1DataSource") DataSource dataSource) throws Exception {
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource); // 设置数据源bean
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(db1Properties.getMapperLocations())); // 设置mapper文件路径
return sessionFactory.getObject();
}
@Bean("db1SqlSessionTemplate")
public SqlSessionTemplate db1SqlSessionTemplate(@Qualifier("db1SqlSessionFactory") SqlSessionFactory sqlSessionFactory){
return new SqlSessionTemplate(sqlSessionFactory);
}
}

View File

@ -0,0 +1,87 @@
package com.cm.bigdata.config.db;
import com.alibaba.druid.pool.DruidDataSource;
import com.cm.bigdata.config.properties.db.Db2Properties;
import com.cm.bigdata.config.properties.db.DbCommonProperties;
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.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
import java.sql.SQLException;
@Configuration
@MapperScan(basePackages = {"com.cm.**.dao2"}, sqlSessionFactoryRef = "db2SqlSessionFactory")
public class Db2Config {
@Autowired
private DbCommonProperties dbCommonProperties;
@Autowired
private Db2Properties db2Properties;
@Bean(name = "db2DataSource")
public DataSource db2DataSource() throws SQLException {
DruidDataSource druid = new DruidDataSource();
// 监控统计拦截的filters
druid.setFilters(dbCommonProperties.getFilters());
// 配置基本属性
druid.setDriverClassName(db2Properties.getDriverClassName());
druid.setUsername(db2Properties.getUsername());
druid.setPassword(db2Properties.getPassword());
druid.setUrl(db2Properties.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 = "db2TransactionManager")
public DataSourceTransactionManager db2TransactionManager() throws SQLException {
return new DataSourceTransactionManager(db2DataSource());
}
@Bean(name = "db2SqlSessionFactory")
public SqlSessionFactory db2SqlSessionFactory(@Qualifier("db2DataSource") DataSource dataSource) throws Exception {
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource); // 设置数据源bean
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(db2Properties.getMapperLocations())); // 设置mapper文件路径
return sessionFactory.getObject();
}
@Bean("db2SqlSessionTemplate")
public SqlSessionTemplate db2SqlSessionTemplate(@Qualifier("db2SqlSessionFactory") 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.db1")
public class Db1Properties {
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,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.db2")
public class Db2Properties {
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,127 @@
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")
public class DbCommonProperties {
private String filters;
private int initialSize;
private int minIdle;
private int maxActive;
private long maxWait;
private long timeBetweenEvictionRunsMillis;
private long minEvictableIdleTimeMillis;
private String validationQuery;
private boolean testWhileIdle;
private boolean testOnBorrow;
private boolean testOnReturn;
private boolean poolPreparedStatements;
private int maxPoolPreparedStatementPerConnectionSize;
public String getFilters() {
return filters;
}
public void setFilters(String filters) {
this.filters = filters;
}
public int getInitialSize() {
return initialSize;
}
public void setInitialSize(int initialSize) {
this.initialSize = initialSize;
}
public int getMinIdle() {
return minIdle;
}
public void setMinIdle(int minIdle) {
this.minIdle = minIdle;
}
public int getMaxActive() {
return maxActive;
}
public void setMaxActive(int maxActive) {
this.maxActive = maxActive;
}
public long getMaxWait() {
return maxWait;
}
public void setMaxWait(long maxWait) {
this.maxWait = maxWait;
}
public long getTimeBetweenEvictionRunsMillis() {
return timeBetweenEvictionRunsMillis;
}
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
}
public long getMinEvictableIdleTimeMillis() {
return minEvictableIdleTimeMillis;
}
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) {
this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
}
public String getValidationQuery() {
return validationQuery;
}
public void setValidationQuery(String validationQuery) {
this.validationQuery = validationQuery;
}
public boolean isTestWhileIdle() {
return testWhileIdle;
}
public void setTestWhileIdle(boolean testWhileIdle) {
this.testWhileIdle = testWhileIdle;
}
public boolean isTestOnBorrow() {
return testOnBorrow;
}
public void setTestOnBorrow(boolean testOnBorrow) {
this.testOnBorrow = testOnBorrow;
}
public boolean isTestOnReturn() {
return testOnReturn;
}
public void setTestOnReturn(boolean testOnReturn) {
this.testOnReturn = testOnReturn;
}
public boolean isPoolPreparedStatements() {
return poolPreparedStatements;
}
public void setPoolPreparedStatements(boolean poolPreparedStatements) {
this.poolPreparedStatements = poolPreparedStatements;
}
public int getMaxPoolPreparedStatementPerConnectionSize() {
return maxPoolPreparedStatementPerConnectionSize;
}
public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) {
this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize;
}
}

View File

@ -0,0 +1,28 @@
package com.cm.bigdata.controller.apis.kpi;
import com.cm.bigdata.service.kpi.IKpiService;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.result.SuccessResultData;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "KPI接口")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/kpi")
public class KpiController extends AbstractController {
@Autowired
private IKpiService kpiService;
@GetMapping("update-community-boss-day-count/{level}")
public SuccessResultData<String> updateCommunityBossDayCount(@PathVariable("level") Integer level,
@RequestParam("dayDate") String dayDate) {
long startTime = System.currentTimeMillis();
kpiService.updateCommunityBossDayCount(dayDate, level);
long endTime = System.currentTimeMillis();
return new SuccessResultData<>("used " + (endTime - startTime) + " ms");
}
}

View File

@ -0,0 +1,19 @@
package com.cm.bigdata.dao.kpi;
import com.cm.bigdata.pojo.pos.kpi.CommunityBossDayCountPO;
import org.springframework.stereotype.Repository;
import java.util.Map;
@Repository
public interface IKpiDao {
void saveCommunityBossDayCount(Map<String, Object> params);
void deleteCommunityBossDayCount(Map<String, Object> params);
void updateCommunityBossDayCount(Map<String, Object> params);
CommunityBossDayCountPO getCommunityBossDayCountPO(Map<String, Object> params);
}

View File

@ -0,0 +1,16 @@
package com.cm.bigdata.dao2.kpi;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public interface IBasePopulationInfoDao {
List<BasePopulationInfoCountPO> listPopulationSaveCount(Map<String, Object> params);
List<BasePopulationInfoCountPO> listPopulationUpdateCount(Map<String, Object> params);
}

View File

@ -0,0 +1,14 @@
package com.cm.bigdata.dao2.kpi;
import com.cm.bigdata.pojo.pos.kpi.CommunityBossPO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public interface ICommunityBossDao {
List<CommunityBossPO> listPO(Map<String, Object> params);
}

View File

@ -0,0 +1,13 @@
package com.cm.bigdata.dao2.kpi;
import com.cm.bigdata.pojo.pos.kpi.UserLocationPO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public interface IUserLocationDao {
List<UserLocationPO> listPO(Map<String, Object> params);
}

View File

@ -0,0 +1,17 @@
package com.cm.bigdata.dao2.kpi;
import com.cm.bigdata.pojo.pos.kpi.UserSigninPO;
import com.cm.bigdata.pojo.pos.kpi.UserSignoutPO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public interface IUserSignDao {
List<UserSigninPO> listInPO(Map<String, Object> params);
List<UserSignoutPO> listOutPO(Map<String, Object> params);
}

View File

@ -0,0 +1,23 @@
package com.cm.bigdata.pojo.pos.kpi;
public class BasePopulationInfoCountPO {
private String userId;
private Integer total;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Integer getTotal() {
return total == null ? 0 : total;
}
public void setTotal(Integer total) {
this.total = total;
}
}

View File

@ -0,0 +1,275 @@
package com.cm.bigdata.pojo.pos.kpi;
public class BasePopulationInfoPO {
private Long id;
private String basePopulationInfoId;
private String idCardNumber;
private String fullName;
private String nameUsedBefore;
private String gender;
private String birthDate;
private String telephone;
private String nation;
private String religion;
private String education;
private String politicalStatus;
private String maritalStatus;
private String occupationCategory;
private String occupation;
private String nativePlace;
private String nativePlaceAddr;
private String serviceSpace;
private String registeredResidence;
private String registeredResidenceAddr;
private String currentResidence;
private String currentResidenceAddr;
private String creator;
private String gmtCreate;
private String modifier;
private String gmtModified;
private String areaId;
private String areaCode;
private String areaNames;
private String otherPeopleType;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getBasePopulationInfoId() {
return basePopulationInfoId;
}
public void setBasePopulationInfoId(String basePopulationInfoId) {
this.basePopulationInfoId = basePopulationInfoId;
}
public String getIdCardNumber() {
return idCardNumber;
}
public void setIdCardNumber(String idCardNumber) {
this.idCardNumber = idCardNumber;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getNameUsedBefore() {
return nameUsedBefore;
}
public void setNameUsedBefore(String nameUsedBefore) {
this.nameUsedBefore = nameUsedBefore;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getBirthDate() {
return birthDate;
}
public void setBirthDate(String birthDate) {
this.birthDate = birthDate;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getNation() {
return nation;
}
public void setNation(String nation) {
this.nation = nation;
}
public String getReligion() {
return religion;
}
public void setReligion(String religion) {
this.religion = religion;
}
public String getEducation() {
return education;
}
public void setEducation(String education) {
this.education = education;
}
public String getPoliticalStatus() {
return politicalStatus;
}
public void setPoliticalStatus(String politicalStatus) {
this.politicalStatus = politicalStatus;
}
public String getMaritalStatus() {
return maritalStatus;
}
public void setMaritalStatus(String maritalStatus) {
this.maritalStatus = maritalStatus;
}
public String getOccupationCategory() {
return occupationCategory;
}
public void setOccupationCategory(String occupationCategory) {
this.occupationCategory = occupationCategory;
}
public String getOccupation() {
return occupation;
}
public void setOccupation(String occupation) {
this.occupation = occupation;
}
public String getNativePlace() {
return nativePlace;
}
public void setNativePlace(String nativePlace) {
this.nativePlace = nativePlace;
}
public String getNativePlaceAddr() {
return nativePlaceAddr;
}
public void setNativePlaceAddr(String nativePlaceAddr) {
this.nativePlaceAddr = nativePlaceAddr;
}
public String getServiceSpace() {
return serviceSpace;
}
public void setServiceSpace(String serviceSpace) {
this.serviceSpace = serviceSpace;
}
public String getRegisteredResidence() {
return registeredResidence;
}
public void setRegisteredResidence(String registeredResidence) {
this.registeredResidence = registeredResidence;
}
public String getRegisteredResidenceAddr() {
return registeredResidenceAddr;
}
public void setRegisteredResidenceAddr(String registeredResidenceAddr) {
this.registeredResidenceAddr = registeredResidenceAddr;
}
public String getCurrentResidence() {
return currentResidence;
}
public void setCurrentResidence(String currentResidence) {
this.currentResidence = currentResidence;
}
public String getCurrentResidenceAddr() {
return currentResidenceAddr;
}
public void setCurrentResidenceAddr(String currentResidenceAddr) {
this.currentResidenceAddr = currentResidenceAddr;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getModifier() {
return modifier;
}
public void setModifier(String modifier) {
this.modifier = modifier;
}
public String getGmtModified() {
return gmtModified;
}
public void setGmtModified(String gmtModified) {
this.gmtModified = gmtModified;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getAreaNames() {
return areaNames;
}
public void setAreaNames(String areaNames) {
this.areaNames = areaNames;
}
public String getOtherPeopleType() {
return otherPeopleType;
}
public void setOtherPeopleType(String otherPeopleType) {
this.otherPeopleType = otherPeopleType;
}
}

View File

@ -0,0 +1,98 @@
package com.cm.bigdata.pojo.pos.kpi;
import lombok.Data;
import lombok.ToString;
public class CommunityBossDayCountPO {
private Long id;
private String userId;
private String dayDate;
private Integer isSignin;
private Integer isSigninLate;
private Integer isSignout;
private Integer isSignoutEarly;
private Double workDistance;
private Integer savePopulationCount;
private Integer updatePopulationCount;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getDayDate() {
return dayDate;
}
public void setDayDate(String dayDate) {
this.dayDate = dayDate;
}
public Integer getIsSignin() {
return isSignin;
}
public void setIsSignin(Integer isSignin) {
this.isSignin = isSignin;
}
public Integer getIsSigninLate() {
return isSigninLate;
}
public void setIsSigninLate(Integer isSigninLate) {
this.isSigninLate = isSigninLate;
}
public Integer getIsSignout() {
return isSignout;
}
public void setIsSignout(Integer isSignout) {
this.isSignout = isSignout;
}
public Integer getIsSignoutEarly() {
return isSignoutEarly;
}
public void setIsSignoutEarly(Integer isSignoutEarly) {
this.isSignoutEarly = isSignoutEarly;
}
public Double getWorkDistance() {
return workDistance;
}
public void setWorkDistance(Double workDistance) {
this.workDistance = workDistance;
}
public Integer getSavePopulationCount() {
return savePopulationCount;
}
public void setSavePopulationCount(Integer savePopulationCount) {
this.savePopulationCount = savePopulationCount;
}
public Integer getUpdatePopulationCount() {
return updatePopulationCount;
}
public void setUpdatePopulationCount(Integer updatePopulationCount) {
this.updatePopulationCount = updatePopulationCount;
}
}

View File

@ -0,0 +1,107 @@
package com.cm.bigdata.pojo.pos.kpi;
import lombok.Data;
import lombok.ToString;
public class CommunityBossPO {
private Long id;
private String communityBossId;
private String communityBossUserId;
private String communityBossParentId;
private String communityBossParentUserId;
private Integer communityBossLevel;
private String areaId;
private String areaName;
private String gridSummary;
private String creator;
private String gmtCreate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCommunityBossId() {
return communityBossId;
}
public void setCommunityBossId(String communityBossId) {
this.communityBossId = communityBossId;
}
public String getCommunityBossUserId() {
return communityBossUserId;
}
public void setCommunityBossUserId(String communityBossUserId) {
this.communityBossUserId = communityBossUserId;
}
public String getCommunityBossParentId() {
return communityBossParentId;
}
public void setCommunityBossParentId(String communityBossParentId) {
this.communityBossParentId = communityBossParentId;
}
public String getCommunityBossParentUserId() {
return communityBossParentUserId;
}
public void setCommunityBossParentUserId(String communityBossParentUserId) {
this.communityBossParentUserId = communityBossParentUserId;
}
public Integer getCommunityBossLevel() {
return communityBossLevel;
}
public void setCommunityBossLevel(Integer communityBossLevel) {
this.communityBossLevel = communityBossLevel;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getGridSummary() {
return gridSummary;
}
public void setGridSummary(String gridSummary) {
this.gridSummary = gridSummary;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
}

View File

@ -0,0 +1,89 @@
package com.cm.bigdata.pojo.pos.kpi;
import lombok.Data;
import lombok.ToString;
public class UserLocationPO {
private Long id;
private String userLocationId;
private String userLongitude;
private String userLatitude;
private String userLocation;
private Integer isOverstep;
private String userName;
private String creator;
private String gmtCreate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserLocationId() {
return userLocationId;
}
public void setUserLocationId(String userLocationId) {
this.userLocationId = userLocationId;
}
public String getUserLongitude() {
return userLongitude;
}
public void setUserLongitude(String userLongitude) {
this.userLongitude = userLongitude;
}
public String getUserLatitude() {
return userLatitude;
}
public void setUserLatitude(String userLatitude) {
this.userLatitude = userLatitude;
}
public String getUserLocation() {
return userLocation;
}
public void setUserLocation(String userLocation) {
this.userLocation = userLocation;
}
public Integer getIsOverstep() {
return isOverstep;
}
public void setIsOverstep(Integer isOverstep) {
this.isOverstep = isOverstep;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
}

View File

@ -0,0 +1,95 @@
package com.cm.bigdata.pojo.pos.kpi;
public class UserSigninPO {
private Long id;
private String userSigninId;
private String userName;
private String signinLongitude;
private String signinLatitude;
private Integer isLate;
private Integer isOutside;
private String amPm;
private String creator;
private String gmtCreate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserSigninId() {
return userSigninId;
}
public void setUserSigninId(String userSigninId) {
this.userSigninId = userSigninId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getSigninLongitude() {
return signinLongitude;
}
public void setSigninLongitude(String signinLongitude) {
this.signinLongitude = signinLongitude;
}
public String getSigninLatitude() {
return signinLatitude;
}
public void setSigninLatitude(String signinLatitude) {
this.signinLatitude = signinLatitude;
}
public Integer getIsLate() {
return isLate;
}
public void setIsLate(Integer isLate) {
this.isLate = isLate;
}
public Integer getIsOutside() {
return isOutside;
}
public void setIsOutside(Integer isOutside) {
this.isOutside = isOutside;
}
public String getAmPm() {
return amPm;
}
public void setAmPm(String amPm) {
this.amPm = amPm;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
}

View File

@ -0,0 +1,98 @@
package com.cm.bigdata.pojo.pos.kpi;
import lombok.Data;
import lombok.ToString;
public class UserSignoutPO {
private Long id;
private String userSignoutId;
private String userName;
private String signoutLongitude;
private String signoutLatitude;
private Integer isEarly;
private Integer isOutside;
private String amPm;
private String creator;
private String gmtCreate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserSignoutId() {
return userSignoutId;
}
public void setUserSignoutId(String userSignoutId) {
this.userSignoutId = userSignoutId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getSignoutLongitude() {
return signoutLongitude;
}
public void setSignoutLongitude(String signoutLongitude) {
this.signoutLongitude = signoutLongitude;
}
public String getSignoutLatitude() {
return signoutLatitude;
}
public void setSignoutLatitude(String signoutLatitude) {
this.signoutLatitude = signoutLatitude;
}
public Integer getIsEarly() {
return isEarly;
}
public void setIsEarly(Integer isEarly) {
this.isEarly = isEarly;
}
public Integer getIsOutside() {
return isOutside;
}
public void setIsOutside(Integer isOutside) {
this.isOutside = isOutside;
}
public String getAmPm() {
return amPm;
}
public void setAmPm(String amPm) {
this.amPm = amPm;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
}

View File

@ -0,0 +1,16 @@
package com.cm.bigdata.service.kpi;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO;
import java.util.List;
import java.util.Map;
public interface IBasePopulationInfoService {
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIds(List<String> userIds);
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdsAndDay(List<String> userIds, String date);
List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdsAndDay(List<String> userIds, String date);
}

View File

@ -0,0 +1,11 @@
package com.cm.bigdata.service.kpi;
import com.cm.bigdata.pojo.pos.kpi.CommunityBossPO;
import java.util.List;
public interface ICommunityBossService {
List<CommunityBossPO> listPOByLevel(int communityBossLevel);
}

View File

@ -0,0 +1,15 @@
package com.cm.bigdata.service.kpi;
/**
* 绩效考核
*/
public interface IKpiService {
/**
* 更新45级网格员日统计
* @param date
*/
void updateCommunityBossDayCount(String date, int level);
}

View File

@ -0,0 +1,9 @@
package com.cm.bigdata.service.kpi;
import com.cm.bigdata.pojo.pos.kpi.UserLocationPO;
import java.util.List;
public interface IUserLocationService {
List<UserLocationPO> listPOByUserIdAndDate(String userId, String day);
}

View File

@ -0,0 +1,12 @@
package com.cm.bigdata.service.kpi;
import com.cm.bigdata.pojo.pos.kpi.UserSigninPO;
import com.cm.bigdata.pojo.pos.kpi.UserSignoutPO;
import java.util.List;
public interface IUserSignService {
List<UserSigninPO> listInPOByUserIdsAndDay(List<String> userIds, String day);
List<UserSignoutPO> listOutPOByUserIdsAndDay(List<String> userIds, String day);
}

View File

@ -0,0 +1,42 @@
package com.cm.bigdata.service.kpi.impl;
import com.cm.bigdata.dao2.kpi.IBasePopulationInfoDao;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoPO;
import com.cm.bigdata.service.kpi.IBasePopulationInfoService;
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 BasePopulationInfoServiceImpl implements IBasePopulationInfoService {
@Autowired
private IBasePopulationInfoDao basePopulationInfoDao;
@Override
public List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIds(List<String> userIds) {
Map<String, Object> params = new HashMap<>();
params.put("userIds", userIds);
return basePopulationInfoDao.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 basePopulationInfoDao.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 basePopulationInfoDao.listPopulationUpdateCount(params);
}
}

View File

@ -0,0 +1,25 @@
package com.cm.bigdata.service.kpi.impl;
import com.cm.bigdata.dao2.kpi.ICommunityBossDao;
import com.cm.bigdata.pojo.pos.kpi.CommunityBossPO;
import com.cm.bigdata.service.kpi.ICommunityBossService;
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 CommunityBossServiceImpl implements ICommunityBossService {
@Autowired
private ICommunityBossDao communityBossDao;
@Override
public List<CommunityBossPO> listPOByLevel(int communityBossLevel) {
Map<String, Object> params = new HashMap<>();
params.put("communityBossLevel", communityBossLevel);
return communityBossDao.listPO(params);
}
}

View File

@ -0,0 +1,79 @@
package com.cm.bigdata.service.kpi.impl;
import com.cm.bigdata.dao.kpi.IKpiDao;
import com.cm.bigdata.pojo.pos.kpi.*;
import com.cm.bigdata.service.kpi.*;
import com.cm.bigdata.utils.KpiUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class KpiServiceImpl implements IKpiService {
@Autowired
private IKpiDao kpiDao;
@Autowired
private ICommunityBossService communityBossService;
@Autowired
private IUserSignService userSignService;
@Autowired
private IUserLocationService userLocationService;
@Autowired
private IBasePopulationInfoService basePopulationInfoService;
@Override
public void updateCommunityBossDayCount(String date, int level) {
// communityBoss表中的level位1-4对应的是2-5级网格员
final int communityBossLevel = level - 1;
List<CommunityBossPO> communityBoss4DTOList = communityBossService.listPOByLevel(communityBossLevel);
List<String> userIds = communityBoss4DTOList.stream().map(CommunityBossPO::getCommunityBossUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
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);
// 删除当日数据
deleteCommunityBossDayCount(date, communityBossLevel);
communityBoss4DTOList.forEach(communityBossDTO -> {
String userId = communityBossDTO.getCommunityBossUserId();
List<UserSigninPO> userSigninPO = userSigninMap.get(userId);
int isSignin = userSigninPO == null || userSigninPO.size() == 0 ? 0 : 1;
int isSigninLate = userSigninPO == null || userSigninPO.size() == 0 ? 0 : userSigninPO.get(0).getIsLate();
List<UserSignoutPO> userSignoutPOS = userSignoutMap.get(userId);
int isSignout = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : 1;
int isSignoutEarly = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : userSignoutPOS.get(0).getIsEarly();
double workDistance = KpiUtil.calculateWorkDistance(userLocationService, userId, date);
int populationCount = populationCountMap.get(userId) == null ? 0 : populationCountMap.get(userId);
int savePopulationCount = populationSaveCountMap.get(userId) == null ? 0 : populationSaveCountMap.get(userId);
int updatePopulationCount = populationUpdateCountMap.get(userId) == null ? 0 : populationUpdateCountMap.get(userId);
// 新增
Map<String, Object> params = new HashMap<>();
params.put("userId", userId);
params.put("dayDate", date);
params.put("isSignin", isSignin);
params.put("isSigninLate", isSigninLate);
params.put("isSignout", isSignout);
params.put("isSignoutEarly", isSignoutEarly);
params.put("workDistance", workDistance);
params.put("populationCount", populationCount);
params.put("savePopulationCount", savePopulationCount);
params.put("updatePopulationCount", updatePopulationCount);
params.put("level", communityBossLevel);
kpiDao.saveCommunityBossDayCount(params);
});
}
private void deleteCommunityBossDayCount(String date, int level) {
Map<String, Object> params = new HashMap<>(4);
params.put("dayDate", date);
params.put("level", level);
kpiDao.deleteCommunityBossDayCount(params);
}
}

View File

@ -0,0 +1,33 @@
package com.cm.bigdata.service.kpi.impl;
import com.cm.bigdata.dao2.kpi.IUserLocationDao;
import com.cm.bigdata.pojo.pos.kpi.UserLocationPO;
import com.cm.bigdata.service.kpi.IUserLocationService;
import com.cm.common.constants.ISystemConstant;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.LocalDateTime;
import org.joda.time.format.DateTimeFormat;
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 UserLocationServiceImpl implements IUserLocationService {
@Autowired
private IUserLocationDao userLocationDao;
@Override
public List<UserLocationPO> listPOByUserIdAndDate(String userId, String day) {
String currentDay = LocalDateTime.now().toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
Map<String, Object> params = new HashMap<>();
params.put("creator", userId);
params.put("day", day);
params.put("tableSuffix", StringUtils.equals(currentDay, day) ? "" : "_history");
return userLocationDao.listPO(params);
}
}

View File

@ -0,0 +1,35 @@
package com.cm.bigdata.service.kpi.impl;
import com.cm.bigdata.dao2.kpi.IUserSignDao;
import com.cm.bigdata.pojo.pos.kpi.UserSigninPO;
import com.cm.bigdata.pojo.pos.kpi.UserSignoutPO;
import com.cm.bigdata.service.kpi.IUserSignService;
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 UserSignService implements IUserSignService {
@Autowired
private IUserSignDao userSignDao;
@Override
public List<UserSigninPO> listInPOByUserIdsAndDay(List<String> userIds, String day) {
Map<String, Object> params = new HashMap<>();
params.put("creators", userIds);
params.put("day", day);
return userSignDao.listInPO(params);
}
@Override
public List<UserSignoutPO> listOutPOByUserIdsAndDay(List<String> userIds, String day) {
Map<String, Object> params = new HashMap<>();
params.put("creators", userIds);
params.put("day", day);
return userSignDao.listOutPO(params);
}
}

View File

@ -0,0 +1,118 @@
package com.cm.bigdata.utils;
import com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO;
import com.cm.bigdata.pojo.pos.kpi.UserLocationPO;
import com.cm.bigdata.pojo.pos.kpi.UserSigninPO;
import com.cm.bigdata.pojo.pos.kpi.UserSignoutPO;
import com.cm.bigdata.service.kpi.IBasePopulationInfoService;
import com.cm.bigdata.service.kpi.IUserLocationService;
import com.cm.bigdata.service.kpi.IUserSignService;
import com.cm.common.utils.point.Point;
import com.cm.common.utils.point.PointUtil;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class KpiUtil {
/**
* 签到map
*
* @param userSigninService
* @param userIds
* @return
*/
public static Map<String, List<UserSigninPO>> mapSignin(IUserSignService userSignService, List<String> userIds, String day) {
List<UserSigninPO> userSigninDTOS = userSignService.listInPOByUserIdsAndDay(userIds, day);
Map<String, List<UserSigninPO>> userSigninMap = new HashMap<>();
userSigninDTOS.forEach(userSigninPO -> {
List<UserSigninPO> userSigninDTOList = userSigninMap.get(userSigninPO.getCreator());
if (userSigninDTOList == null) {
userSigninDTOList = new ArrayList<>();
}
userSigninDTOList.add(userSigninPO);
userSigninMap.put(userSigninPO.getCreator(), userSigninDTOList);
});
return userSigninMap;
}
/**
* 签退map
*
* @param userSignoutService
* @param userIds
* @return
*/
public static Map<String, List<UserSignoutPO>> mapSignout(IUserSignService userSignService, List<String> userIds, String day) {
List<UserSignoutPO> userSignoutDTOS = userSignService.listOutPOByUserIdsAndDay(userIds, day);
Map<String, List<UserSignoutPO>> userSigninMap = new HashMap<>();
userSignoutDTOS.forEach(userSignoutPO -> {
List<UserSignoutPO> userSignoutDTOList = userSigninMap.get(userSignoutPO.getCreator());
if (userSignoutDTOList == null) {
userSignoutDTOList = new ArrayList<>();
}
userSignoutDTOList.add(userSignoutPO);
userSigninMap.put(userSignoutPO.getCreator(), userSignoutDTOList);
});
return userSigninMap;
}
/**
* 计算工作距离
*
* @param userLocationService
* @param userId
* @param day af535c78-f0ba-4ccf-891b-cf7c6e42e9e8
* @return
*/
public static Double calculateWorkDistance(IUserLocationService userLocationService, String userId, String day) {
double workDistance = 0D;
if (!StringUtils.equals(userId, "af535c78-f0ba-4ccf-891b-cf7c6e42e9e8")) {
return workDistance;
}
List<UserLocationPO> userLocationPOS = userLocationService.listPOByUserIdAndDate(userId, day);
Point tempPoint = null;
for (UserLocationPO userLocationPO : userLocationPOS) {
Point point = new Point(Double.parseDouble(userLocationPO.getUserLatitude()), Double.parseDouble(userLocationPO.getUserLongitude()));
if (tempPoint == null) {
tempPoint = point;
continue;
}
workDistance += PointUtil.getDistance(tempPoint, point);
tempPoint = point;
}
return workDistance;
}
public static Map<String, Integer> mapPopulationCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserIds(userIds);
Map<String, Integer> map = new HashMap<>();
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
});
return map;
}
public static Map<String, Integer> mapPopulationSaveCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserIdsAndDay(userIds, date);
Map<String, Integer> map = new HashMap<>();
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
});
return map;
}
public static Map<String, Integer> mapPopulationUpdateCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationUpdateCountByUserIdsAndDay(userIds, date);
Map<String, Integer> map = new HashMap<>();
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
});
return map;
}
}

View File

@ -1,6 +1,6 @@
server:
port: 8087
url: http://192.168.0.111:8087/bigdata
url: http://192.168.0.15:8087/bigdata
title: bigdata
servlet:
context-path: /bigdata
@ -20,11 +20,20 @@ spring:
max-request-size: 1GB
datasource:
druid:
url: jdbc:mysql://127.0.0.1:3306/db_bigdata?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: 123456
db1:
url: jdbc:mysql://192.168.0.151:3306/db_btgxq_bigdata?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/mapper/**/*.xml
db2:
url: jdbc:mysql://192.168.0.151:3306/db_btgxq_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/db2-mapper/**/*.xml
initial-size: 2
min-idle: 2
max-active: 5
@ -61,7 +70,7 @@ swagger:
# 文件
file:
uploadPath: /Users/wenc/Desktop/filetest
uploadPath: C:\Users\TS-QD1\Desktop\UploadFiles\
imageTypes: png,jpg,jpeg,gif,blob
videoTypes: mp4
audioTypes: mp3,wav,amr
@ -71,14 +80,11 @@ file:
# 安全
security:
oauth2:
# oauth-server: http://192.168.0.103:7001/usercenter
oauth-server: http://49.233.36.36:8868/usercenter
oauth-server: http://192.168.0.15:7021/usercenter
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
client:
client-id: 23ee73bf31b54084b2eb977d58435be0
client-secret: dnljSTJGLzdWSjBudTNyV2MxUXNudStsbndpMFpwbHRKRnlzRkFjNTgrVW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
# client-id: 26c7aaa37d0f4137a0b4d3bd696d2afd
# client-secret: QWZXc0kvVzd2eXlaMXRYdUFlUVFUb2x4K1Y3Um1jNnFQSklZSkNFZ3lXQW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
client-id: cc7dbe7d6d034b0e93a41f9256723ce3
client-secret: eWJDNTUxN3Q0QU0wVHhmbGROM1hmZzFwdFlyQUxPa1E4bWtkL01PVGVuc21ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
user-authorization-uri: ${security.oauth2.oauth-server}/oauth_client/authorize
access-token-uri: ${security.oauth2.oauth-server}/oauth_client/token
grant-type: authorization_code
@ -96,7 +102,8 @@ api-path:
# 访问控制
access-control:
pass-paths:
- /index.html
- /old.html
- /old.html
- /logout.html
- /default.html
- /assets/**
@ -121,6 +128,7 @@ access-control:
logging:
level:
root: error
org.mybatis: debug
com.cm: debug
# 访问其他项目
@ -131,8 +139,8 @@ server-other:
# servicecity-url: http://192.168.0.111:8084/servicecity
# party-url: http://192.168.0.111:8085/partybuilding
# servicecity-url: http://192.168.0.109:8083/servicecity
servicecity-url: http://219.147.99.164:8082/servicecity
deptassesst-Url: http://219.147.99.164:8082/servicecity
servicecity-url: http://192.168.0.15:7022/servicecity
deptassesst-Url: http://192.168.0.15:7022/servicecity
party-url: http://219.147.99.164:8082/partybuilding
logo-url: http://219.147.99.164:8082/partybuilding
population-url: http://219.147.99.164:8082/population

View File

@ -0,0 +1,90 @@
<?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.dao2.kpi.IBasePopulationInfoDao">
<resultMap id="basePopulationInfo" type="com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoPO">
<id column="id" property="id"/>
<result column="base_population_info_id" property="basePopulationInfoId"/>
<result column="id_card_number" property="idCardNumber"/>
<result column="full_name" property="fullName"/>
<result column="name_used_before" property="nameUsedBefore"/>
<result column="gender" property="gender"/>
<result column="birth_date" property="birthDate"/>
<result column="telephone" property="telephone"/>
<result column="nation" property="nation"/>
<result column="religion" property="religion"/>
<result column="education" property="education"/>
<result column="political_status" property="politicalStatus"/>
<result column="marital_status" property="maritalStatus"/>
<result column="occupation_category" property="occupationCategory"/>
<result column="occupation" property="occupation"/>
<result column="native_place" property="nativePlace"/>
<result column="native_place_addr" property="nativePlaceAddr"/>
<result column="service_space" property="serviceSpace"/>
<result column="registered_residence" property="registeredResidence"/>
<result column="registered_residence_addr" property="registeredResidenceAddr"/>
<result column="current_residence" property="currentResidence"/>
<result column="current_residence_addr" property="currentResidenceAddr"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="area_id" property="areaId"/>
<result column="area_code" property="areaCode"/>
<result column="area_names" property="areaNames"/>
<result column="other_people_type" property="otherPeopleType"/>
</resultMap>
<resultMap id="basePopulationInfoCountPO" type="com.cm.bigdata.pojo.pos.kpi.BasePopulationInfoCountPO">
<result column="user_id" property="userId"/>
<result column="total" property="total"/>
</resultMap>
<select id="listPopulationSaveCount" parameterType="map" resultMap="basePopulationInfoCountPO">
SELECT
creator user_id,
COUNT(creator) total
FROM
gen_base_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
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
gen_base_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>
</mapper>

View File

@ -0,0 +1,42 @@
<?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.dao2.kpi.ICommunityBossDao">
<resultMap id="communityBossPO" type="com.cm.bigdata.pojo.pos.kpi.CommunityBossPO">
<id column="id" property="id"/>
<result column="community_boss_id" property="communityBossId"/>
<result column="community_boss_user_id" property="communityBossUserId"/>
<result column="community_boss_parent_id" property="communityBossParentId"/>
<result column="community_boss_parent_user_id" property="communityBossParentUserId"/>
<result column="community_boss_level" property="communityBossLevel"/>
<result column="area_id" property="areaId"/>
<result column="area_name" property="areaName"/>
<result column="grid_summary" property="gridSummary"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
</resultMap>
<select id="listPO" parameterType="map" resultMap="communityBossPO">
SELECT
id,
community_boss_id,
community_boss_user_id,
community_boss_parent_id,
community_boss_parent_user_id,
community_boss_level,
area_id,
area_name,
grid_summary,
creator,
gmt_create
FROM
city_community_boss
WHERE
is_delete = 0
<if test="communityBossLevel != null and communityBossLevel != ''">
AND
community_boss_level = #{communityBossLevel}
</if>
</select>
</mapper>

View File

@ -0,0 +1,42 @@
<?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.dao2.kpi.IUserLocationDao">
<resultMap id="userLocationPO" type="com.cm.bigdata.pojo.pos.kpi.UserLocationPO">
<id column="id" property="id"/>
<result column="user_location_id" property="userLocationId"/>
<result column="user_longitude" property="userLongitude"/>
<result column="user_latitude" property="userLatitude"/>
<result column="user_location" property="userLocation"/>
<result column="is_overstep" property="isOverstep"/>
<result column="user_name" property="userName"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
</resultMap>
<select id="listPO" parameterType="map" resultMap="userLocationPO">
SELECT
id,
user_location_id,
user_longitude,
user_latitude,
user_location,
is_overstep,
user_name,
creator,
gmt_create
FROM
city_user_location${tableSuffix}
WHERE
is_delete
<if test="creator != null and creator != ''">
AND
creator = #{creator}
</if>
<if test="day != null and day != ''">
AND
LEFT(gmt_create, 10) = #{day}
</if>
</select>
</mapper>

View File

@ -0,0 +1,89 @@
<?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.dao2.kpi.IUserSignDao">
<resultMap id="userSigninPO" type="com.cm.bigdata.pojo.pos.kpi.UserSigninPO">
<id column="id" property="id"/>
<result column="user_signin_id" property="userSigninId"/>
<result column="user_name" property="userName"/>
<result column="signin_longitude" property="signinLongitude"/>
<result column="signin_latitude" property="signinLatitude"/>
<result column="is_late" property="isLate"/>
<result column="is_outside" property="isOutside"/>
<result column="am_pm" property="amPm"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
</resultMap>
<resultMap id="userSignoutPO" type="com.cm.bigdata.pojo.pos.kpi.UserSignoutPO">
<id column="id" property="id"/>
<result column="user_signout_id" property="userSignoutId"/>
<result column="user_name" property="userName"/>
<result column="signout_longitude" property="signoutLongitude"/>
<result column="signout_latitude" property="signoutLatitude"/>
<result column="is_early" property="isEarly"/>
<result column="is_outside" property="isOutside"/>
<result column="am_pm" property="amPm"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
</resultMap>
<select id="listInPO" parameterType="map" resultMap="userSigninPO">
SELECT
id,
user_signin_id,
user_name,
signin_longitude,
signin_latitude,
is_late,
is_outside,
am_pm,
creator,
gmt_create
FROM
city_user_signin
WHERE
is_delete = 0
<if test="day != null and day != ''">
AND
LEFT(gmt_create, 10) = #{day}
</if>
<if test="creators != null and creators.size > 0">
AND
creator IN
<foreach collection="creators" item="item" index="index" open="(" separator="," close=")">
#{creators[${index}]}
</foreach>
</if>
</select>
<select id="listOutPO" parameterType="map" resultMap="userSignoutPO">
SELECT
id,
user_signout_id,
user_name,
signout_longitude,
signout_latitude,
is_early,
is_outside,
am_pm,
creator,
gmt_create
FROM
city_user_signout
WHERE
is_delete = 0
<if test="day != null and day != ''">
AND
LEFT(gmt_create, 10) = #{day}
</if>
<if test="creators != null and creators.size > 0">
AND
creator IN
<foreach collection="creators" item="item" index="index" open="(" separator="," close=")">
#{creators[${index}]}
</foreach>
</if>
</select>
</mapper>

View File

@ -0,0 +1,92 @@
<?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.dao.kpi.IKpiDao">
<resultMap id="communityBossDayCountPO" type="com.cm.bigdata.pojo.pos.kpi.CommunityBossDayCountPO">
<id column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="day_date" property="dayDate"/>
<result column="is_signin" property="isSignin"/>
<result column="is_signin_late" property="isSigninLate"/>
<result column="is_signout" property="isSignout"/>
<result column="is_signout_early" property="isSignoutEarly"/>
<result column="work_distance" property="workDistance"/>
<result column="save_population_count" property="savePopulationCount"/>
<result column="update_population_count" property="updatePopulationCount"/>
</resultMap>
<!-- 保存网格员日统计 -->
<insert id="saveCommunityBossDayCount" parameterType="map">
INSERT INTO kpi_community_boss_${level}_day_count(
user_id,
day_date,
is_signin,
is_signin_late,
is_signout,
is_signout_early,
work_distance,
population_count,
save_population_count,
update_population_count
) VALUES (
#{userId},
#{dayDate},
#{isSignin},
#{isSigninLate},
#{isSignout},
#{isSignoutEarly},
#{workDistance},
#{populationCount},
#{savePopulationCount},
#{updatePopulationCount}
)
</insert>
<!-- 删除网格员日统计 -->
<delete id="deleteCommunityBossDayCount" parameterType="map">
DELETE FROM
kpi_community_boss_${level}_day_count
WHERE
day_date = #{dayDate}
</delete>
<!-- 修改网格员日统计 -->
<update id="updateCommunityBossDayCount" parameterType="map">
UPDATE
kpi_community_boss_${level}_day_count
SET
is_signin = #{isSignin},
is_signin_late = #{isSigninLate},
is_signout = #{isSignout},
is_signout_early = #{isSignoutEarly},
work_distance = #{workDistance},
save_population_count = #{savePopulationCount},
update_population_count = #{updatePopulationCount}
WHERE
user_id = #{userId}
AND
day_date = #{dayDate}
</update>
<!-- 详情 -->
<select id="getCommunityBossDayCountPO" parameterType="map" resultMap="communityBossDayCountPO">
SELECT
id,
user_id,
day_date,
is_signin,
is_signin_late,
is_signout,
is_signout_early,
work_distance,
save_population_count,
update_population_count
FROM
kpi_community_boss_${level}_day_count
WHERE
user_id = #{userId}
AND
day_date = #{dayDate}
</select>
</mapper>