Browse Source

合并用户数据分析的改造 到master分支

feature/dangjian
yujintao 6 years ago
parent
commit
8a28131eb6
  1. 26
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/utils/DateUtils.java
  2. 146
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserGridOpiningDTO.java
  3. 127
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserPartyRankDTO.java
  4. 137
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserRegisterRankDTO.java
  5. 1
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/datasources/DataSourceNames.java
  6. 9
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/datasources/DynamicDataSourceConfig.java
  7. 104
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserGridOpiningController.java
  8. 107
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserPartyRankController.java
  9. 104
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserRegisterRankController.java
  10. 2
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/UserAnalysisController.java
  11. 45
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserGridOpiningDao.java
  12. 46
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserPartyRankDao.java
  13. 55
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserRegisterRankDao.java
  14. 116
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserGridOpiningEntity.java
  15. 97
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserPartyRankEntity.java
  16. 107
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserRegisterRankEntity.java
  17. 80
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserGridOpiningExcel.java
  18. 70
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserPartyRankExcel.java
  19. 76
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserRegisterRankExcel.java
  20. 107
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserGridOpiningService.java
  21. 105
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserPartyRankService.java
  22. 105
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserRegisterRankService.java
  23. 29
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/UserAnalysisService.java
  24. 138
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserGridOpiningServiceImpl.java
  25. 140
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserPartyRankServiceImpl.java
  26. 147
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserRegisterRankServiceImpl.java
  27. 42
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/UserAnalysisServiceImpl.java
  28. 4
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/application-dev.yml
  29. 48
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserGridOpiningDao.xml
  30. 48
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserPartyRankDao.xml
  31. 71
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserRegisterRankDao.xml
  32. 1
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/UserAnalysisDao.xml
  33. 41
      esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClint.java
  34. 31
      esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClintFallback.java
  35. 19
      esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/service/ScheduleJobUserService.java
  36. 29
      esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/service/impl/ScheduleJobUserServiceImpl.java
  37. 18
      esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/analysis/UserAnalysisTask.java
  38. 21
      esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/analysis/UserAnalysisTaskImpl.java

26
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/utils/DateUtils.java

@ -14,9 +14,11 @@ import org.joda.time.LocalDate;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/**
* 日期处理工具类
@ -185,4 +187,28 @@ public class DateUtils {
DateTime dateTime = new DateTime(date);
return dateTime.plusYears(years).toDate();
}
/***
* 前端上传信息解析
* @param oldDate
* @return java.lang.String
* @author qushutong
* @date 2020/3/26 10:09
*/
public static String dealDateFormat(String oldDate) {
Date date1 = null;
DateFormat df2 = null;
try {
oldDate= oldDate.replace("Z", " UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
Date date = df.parse(oldDate);
SimpleDateFormat df1 = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
date1 = df1.parse(date.toString());
df2 = new SimpleDateFormat("yyyy-MM-dd");
} catch (ParseException e) {
e.printStackTrace();
}
return df2.format(date1);
}
}

146
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserGridOpiningDTO.java

@ -0,0 +1,146 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto.user;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 网格开通情况
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-25
*/
@Data
public class MetaUserGridOpiningDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 网格id
*/
private String gridId;
/**
* 用户总数
*/
private int registerCount;
/**
* 党员数
*/
private int partyCount;
/**
* 已注册居民
*/
private int residentCount;
/**
* 未注册居民
*/
private int unAuthorizedCount;
/**
* 新闻发布数
*/
private int newsCount;
/**
* 社群数
*/
private int communityCount;
/**
* 群成员数
*/
private int communityMemberCount;
/**
* 群话题数
*/
private int communityTopicCount;
/**
* 议题总数
*/
private int eventCount;
/**
* 项目数
*/
private int itemCount;
/**
* 项目已解决数
*/
private int itemCloseCount;
/**
* 好评数
*/
private int itemPraiseCount;
/**
* 网格名称
*/
private String allDeptName;
/**
* 网格党建指导员姓名
*/
private String gridLeader;
/**
* 删除标记
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 注册时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

127
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserPartyRankDTO.java

@ -0,0 +1,127 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto.user;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Data
public class MetaUserPartyRankDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 街道id
*/
private String streetId;
/**
* 街道名称
*/
private String streetName;
/**
* 已注册党员数量已认证
*/
private Integer partyMemberCount;
/**
* 年龄超过50岁党员数量
*/
private Integer oldCount;
/**
* 老龄化比例
*/
private BigDecimal oldPercent;
/**
* 年龄50岁以下的党员数量
*/
private Integer youngCount;
/**
* 年轻化比例
*/
private BigDecimal youngPercent;
/**
*
*/
private Integer maleCount;
/**
*
*/
private Integer femaleCount;
/**
* 未知性别
*/
private Integer unknownSexCount;
/**
* 党员认证失败数
*/
private Integer partyAuthFailureCount;
/**
* 删除标记
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 注册时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

137
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/user/MetaUserRegisterRankDTO.java

@ -0,0 +1,137 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto.user;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 用户注册排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Data
public class MetaUserRegisterRankDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 街道id
*/
private String streetId;
/**
* 街道名称
*/
private String streetName;
/**
* 用户总数
*/
private Integer userCount;
/**
* 党员数
*/
private Integer partyMemberCount;
/**
* 已注册居民
*/
private Integer residentCount;
/**
* 为注册居民
*/
private Integer unAuthorizedCount;
/**
* 年龄超过50岁
*/
private Integer oldCount;
/**
* 老龄化比例
*/
private BigDecimal oldPercent;
/**
* 50岁以下用户数量
*/
private Integer youngCount;
/**
* 年轻化比例
*/
private BigDecimal youngPercent;
/**
*
*/
private Integer maleCount;
/**
*
*/
private Integer femaleCount;
/**
* 未知性别
*/
private Integer unknownSexCount;
/**
* 删除标记
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 注册时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

1
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/datasources/DataSourceNames.java

@ -19,4 +19,5 @@ public interface DataSourceNames {
String NINTH = "ninth";
String TENTH = "tenth";
String ELEVENTH = "eleventh";
String TWELVE = "twelve";
}

9
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/datasources/DynamicDataSourceConfig.java

@ -86,6 +86,12 @@ public class DynamicDataSourceConfig {
return DruidDataSourceBuilder.create().build();
}
@Bean
@ConfigurationProperties("spring.datasource.druid.twelve")
public DataSource twelvethDataSource() {
return DruidDataSourceBuilder.create().build();
}
@Bean
@Primary
public DynamicDataSource dataSource(DataSource firstDataSource, DataSource secondDataSource,
@ -93,7 +99,7 @@ public class DynamicDataSourceConfig {
DataSource fifthDataSource, DataSource sixthDataSource,
DataSource seventhDataSource, DataSource eighthDataSource,
DataSource ninthDataSource, DataSource tenthDataSource,
DataSource eleventhDataSource) {
DataSource eleventhDataSource,DataSource twelvethDataSource) {
Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceNames.FIRST, firstDataSource);
targetDataSources.put(DataSourceNames.SECOND, secondDataSource);
@ -106,6 +112,7 @@ public class DynamicDataSourceConfig {
targetDataSources.put(DataSourceNames.NINTH, ninthDataSource);
targetDataSources.put(DataSourceNames.TENTH, tenthDataSource);
targetDataSources.put(DataSourceNames.ELEVENTH, eleventhDataSource);
targetDataSources.put(DataSourceNames.TWELVE, twelvethDataSource);
return new DynamicDataSource(firstDataSource, targetDataSources);
}
}

104
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserGridOpiningController.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.user.MetaUserGridOpiningDTO;
import com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO;
import com.elink.esua.epdc.modules.user.excel.MetaUserGridOpiningExcel;
import com.elink.esua.epdc.modules.user.service.MetaUserGridOpiningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 网格开通情况
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-25
*/
@RestController
@RequestMapping("metausergridopining")
public class MetaUserGridOpiningController {
@Autowired
private MetaUserGridOpiningService metaUserGridOpiningService;
@GetMapping("page")
public Result<PageData<MetaUserGridOpiningDTO>> page(@RequestParam Map<String, Object> params){
PageData<MetaUserGridOpiningDTO> page = metaUserGridOpiningService.page(params);
return new Result<PageData<MetaUserGridOpiningDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<MetaUserGridOpiningDTO> get(@PathVariable("id") String id){
MetaUserGridOpiningDTO data = metaUserGridOpiningService.get(id);
return new Result<MetaUserGridOpiningDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody MetaUserGridOpiningDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
metaUserGridOpiningService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody MetaUserGridOpiningDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
metaUserGridOpiningService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
metaUserGridOpiningService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<MetaUserGridOpiningDTO> list = metaUserGridOpiningService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, MetaUserGridOpiningExcel.class);
}
/**
* @author: qushutong
* @Date: 2020/3/25 10:35
* @Description: 临时表导入
*/
@GetMapping("tolead")
public Result<List<GridOpeningResultDTO>> tolead() {
return metaUserGridOpiningService.createUserAnalysisData();
}
}

107
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserPartyRankController.java

@ -0,0 +1,107 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.user.MetaUserPartyRankDTO;
import com.elink.esua.epdc.modules.user.excel.MetaUserPartyRankExcel;
import com.elink.esua.epdc.modules.user.service.MetaUserPartyRankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@RestController
@RequestMapping("metauserpartyrank")
public class MetaUserPartyRankController {
@Autowired
private MetaUserPartyRankService metaUserPartyRankService;
@GetMapping("page")
public Result<PageData<MetaUserPartyRankDTO>> page(@RequestParam Map<String, Object> params){
PageData<MetaUserPartyRankDTO> page = metaUserPartyRankService.page(params);
return new Result<PageData<MetaUserPartyRankDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<MetaUserPartyRankDTO> get(@PathVariable("id") String id){
MetaUserPartyRankDTO data = metaUserPartyRankService.get(id);
return new Result<MetaUserPartyRankDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody MetaUserPartyRankDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
metaUserPartyRankService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody MetaUserPartyRankDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
metaUserPartyRankService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
metaUserPartyRankService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<MetaUserPartyRankDTO> list = metaUserPartyRankService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, MetaUserPartyRankExcel.class);
}
/***
* 定时任务导入
* @param
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/3/26 18:22
*/
@GetMapping("toLeadPartyRankData")
public Result toLeadPartyRankData(){
return metaUserPartyRankService.toLeadPartyRankData();
}
}

104
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/MetaUserRegisterRankController.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.user.MetaUserRegisterRankDTO;
import com.elink.esua.epdc.modules.user.excel.MetaUserRegisterRankExcel;
import com.elink.esua.epdc.modules.user.service.MetaUserRegisterRankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 用户注册排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@RestController
@RequestMapping("metauserregisterrank")
public class MetaUserRegisterRankController {
@Autowired
private MetaUserRegisterRankService metaUserRegisterRankService;
@GetMapping("page")
public Result<PageData<MetaUserRegisterRankDTO>> page(@RequestParam Map<String, Object> params){
PageData<MetaUserRegisterRankDTO> page = metaUserRegisterRankService.page(params);
return new Result<PageData<MetaUserRegisterRankDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<MetaUserRegisterRankDTO> get(@PathVariable("id") String id){
MetaUserRegisterRankDTO data = metaUserRegisterRankService.get(id);
return new Result<MetaUserRegisterRankDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody MetaUserRegisterRankDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
metaUserRegisterRankService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody MetaUserRegisterRankDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
metaUserRegisterRankService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
metaUserRegisterRankService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<MetaUserRegisterRankDTO> list = metaUserRegisterRankService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, MetaUserRegisterRankExcel.class);
}
/***
* 定时任务用户注册排行导入数据
* @param
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/3/26 13:44
*/
@GetMapping("toLeadUserRegisterRandData")
public Result toLeadUserRegisterRandData(){
return metaUserRegisterRankService.toLeadUserRegisterRandData();
}
}

2
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/controller/UserAnalysisController.java

@ -209,7 +209,7 @@ public class UserAnalysisController {
* @date 2020/3/23 16:36
*/
@PostMapping("export/exportOperationData")
public void exportOperationData(@RequestBody ExportOperationFormDTO exportOperationFormDTO, HttpServletResponse response) throws Exception{
public void exportOperationData(@RequestBody ExportOperationFormDTO exportOperationFormDTO, HttpServletResponse response) throws Exception {
List<ExportOperationDataResultDTO> list = userAnalysisService.listExportOperationCount(exportOperationFormDTO);
ExcelUtils.exportExcelToTarget(response, "开通网格情况", list, ExportOperationDataExcel.class);
}

45
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserGridOpiningDao.java

@ -0,0 +1,45 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.modules.user.entity.MetaUserGridOpiningEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 网格开通情况
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-25
*/
@Mapper
public interface MetaUserGridOpiningDao extends BaseDao<MetaUserGridOpiningEntity> {
/***
* 列表
* @param params
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.modules.user.entity.MetaUserGridOpiningEntity>
* @author qushutong
* @date 2020/3/25 17:30
*/
List<MetaUserGridOpiningEntity> pageselectListPage(Map<String,Object> params);
}

46
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserPartyRankDao.java

@ -0,0 +1,46 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.dao;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Mapper
public interface MetaUserPartyRankDao extends BaseDao<MetaUserPartyRankEntity> {
/***
* 分页
* @param params
* @return java.util.List<com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity>
* @author qushutong
* @date 2020/3/26 18:36
*/
List<MetaUserPartyRankEntity> selectPagePartyRank(Map<String,Object> params);
}

55
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/dao/MetaUserRegisterRankDao.java

@ -0,0 +1,55 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.dao;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.user.entity.MetaUserRegisterRankEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 用户注册排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Mapper
public interface MetaUserRegisterRankDao extends BaseDao<MetaUserRegisterRankEntity> {
/***
* 分页
* @param params
* @return java.util.List<com.elink.esua.epdc.modules.user.entity.MetaUserRegisterRankEntity>
* @author qushutong
* @date 2020/3/26 15:41
*/
List<MetaUserRegisterRankEntity> selectPageUserRegisterRank(Map<String,Object> params);
/***
* 获取当前用户拥有权限的街道id
* @param params
* @return java.util.List<java.lang.String>
* @author qushutong
* @date 2020/3/26 16:54
*/
List<String> selectListStreetId(Map<String,Object> params);
}

116
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserGridOpiningEntity.java

@ -0,0 +1,116 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 网格开通情况
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-25
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("meta_epdc_user_grid_opining")
public class MetaUserGridOpiningEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 网格id
*/
private String gridId;
/**
* 用户总数
*/
private int registerCount;
/**
* 党员数
*/
private int partyCount;
/**
* 已注册居民
*/
private int residentCount;
/**
* 未注册居民
*/
private int unAuthorizedCount;
/**
* 新闻发布数
*/
private int newsCount;
/**
* 社群数
*/
private int communityCount;
/**
* 群成员数
*/
private int communityMemberCount;
/**
* 群话题数
*/
private int communityTopicCount;
/**
* 议题总数
*/
private int eventCount;
/**
* 项目数
*/
private int itemCount;
/**
* 项目已解决数
*/
private int itemCloseCount;
/**
* 好评数
*/
private int itemPraiseCount;
/**
* 网格名称
*/
private String allDeptName;
/**
* 网格党建指导员姓名
*/
private String gridLeader;
}

97
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserPartyRankEntity.java

@ -0,0 +1,97 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("meta_epdc_user_party_rank")
public class MetaUserPartyRankEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 街道id
*/
private String streetId;
/**
* 街道名称
*/
private String streetName;
/**
* 已注册党员数量已认证
*/
private Integer partyMemberCount;
/**
* 年龄超过50岁党员数量
*/
private Integer oldCount;
/**
* 老龄化比例
*/
private BigDecimal oldPercent;
/**
* 年龄50岁以下的党员数量
*/
private Integer youngCount;
/**
* 年轻化比例
*/
private BigDecimal youngPercent;
/**
*
*/
private Integer maleCount;
/**
*
*/
private Integer femaleCount;
/**
* 未知性别
*/
private Integer unknownSexCount;
/**
* 党员认证失败数
*/
private Integer partyAuthFailureCount;
}

107
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/entity/MetaUserRegisterRankEntity.java

@ -0,0 +1,107 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户注册排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("meta_epdc_user_register_rank")
public class MetaUserRegisterRankEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 街道id
*/
private String streetId;
/**
* 街道名称
*/
private String streetName;
/**
* 用户总数
*/
private Integer userCount;
/**
* 党员数
*/
private Integer partyMemberCount;
/**
* 已注册居民
*/
private Integer residentCount;
/**
* 为注册居民
*/
private Integer unAuthorizedCount;
/**
* 年龄超过50岁
*/
private Integer oldCount;
/**
* 老龄化比例
*/
private BigDecimal oldPercent;
/**
* 50岁以下用户数量
*/
private Integer youngCount;
/**
* 年轻化比例
*/
private BigDecimal youngPercent;
/**
*
*/
private Integer maleCount;
/**
*
*/
private Integer femaleCount;
/**
* 未知性别
*/
private Integer unknownSexCount;
}

80
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserGridOpiningExcel.java

@ -0,0 +1,80 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 网格开通情况
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-25
*/
@Data
public class MetaUserGridOpiningExcel {
@Excel(name = "网格名称")
private String allDeptNames;
@Excel(name = "网格党建指导员姓名")
private String gridLeader;
@Excel(name = "用户总数")
private int registerCount;
@Excel(name = "党员数")
private int partyCount;
@Excel(name = "已注册居民")
private int residentCount;
@Excel(name = "未注册居民")
private int unAuthorizedCount;
@Excel(name = "新闻发布数")
private String newsCount;
@Excel(name = "社群数")
private int communityCount;
@Excel(name = "群成员数")
private int communityMemberCount;
@Excel(name = "群话题数")
private int communityTopicCount;
@Excel(name = "议题总数")
private int eventCount;
@Excel(name = "项目数")
private int itemCount;
@Excel(name = "项目已解决数")
private int itemCloseCount;
@Excel(name = "好评数")
private int itemPraiseCount;
@Excel(name = "更新时间", format = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
}

70
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserPartyRankExcel.java

@ -0,0 +1,70 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Data
public class MetaUserPartyRankExcel {
@Excel(name = "街道名称")
private String streetName;
@Excel(name = "已注册党员数量(已认证)")
private Integer partyMemberCount;
@Excel(name = "年龄超过50岁党员数量")
private Integer oldCount;
@Excel(name = "老龄化比例")
private BigDecimal oldPercent;
@Excel(name = "年龄50岁以下的党员数量")
private Integer youngCount;
@Excel(name = "年轻化比例")
private BigDecimal youngPercent;
@Excel(name = "男")
private Integer maleCount;
@Excel(name = "女")
private Integer femaleCount;
@Excel(name = "未知性别")
private Integer unknownSexCount;
@Excel(name = "党员认证失败数")
private Integer partyAuthFailureCount;
@Excel(name = "更新时间", format = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
}

76
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/excel/MetaUserRegisterRankExcel.java

@ -0,0 +1,76 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户注册排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Data
public class MetaUserRegisterRankExcel {
@Excel(name = "街道名称")
private String streetName;
@Excel(name = "用户总数")
private Integer userCount;
@Excel(name = "党员数")
private Integer partyMemberCount;
@Excel(name = "已注册居民")
private Integer residentCount;
@Excel(name = "为注册居民")
private Integer unAuthorizedCount;
@Excel(name = "年龄超过50岁")
private Integer oldCount;
@Excel(name = "老龄化比例")
private BigDecimal oldPercent;
@Excel(name = "50岁以下用户数量")
private Integer youngCount;
@Excel(name = "年轻化比例")
private BigDecimal youngPercent;
@Excel(name = "男")
private Integer maleCount;
@Excel(name = "女")
private Integer femaleCount;
@Excel(name = "未知性别")
private Integer unknownSexCount;
@Excel(name = "更新时间", format = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
}

107
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserGridOpiningService.java

@ -0,0 +1,107 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.user.MetaUserGridOpiningDTO;
import com.elink.esua.epdc.modules.user.entity.MetaUserGridOpiningEntity;
import java.util.List;
import java.util.Map;
/**
* 网格开通情况
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-25
*/
public interface MetaUserGridOpiningService extends BaseService<MetaUserGridOpiningEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<MetaUserGridOpiningDTO>
* @author generator
* @date 2020-03-25
*/
PageData<MetaUserGridOpiningDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<MetaUserGridOpiningDTO>
* @author generator
* @date 2020-03-25
*/
List<MetaUserGridOpiningDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return MetaUserGridOpiningDTO
* @author generator
* @date 2020-03-25
*/
MetaUserGridOpiningDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-25
*/
void save(MetaUserGridOpiningDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-25
*/
void update(MetaUserGridOpiningDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-25
*/
void delete(String[] ids);
/***
* 网格开通数据生成临时表导入
* @param
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/3/25 10:42
*/
Result createUserAnalysisData();
}

105
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserPartyRankService.java

@ -0,0 +1,105 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.user.MetaUserPartyRankDTO;
import com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity;
import java.util.List;
import java.util.Map;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
public interface MetaUserPartyRankService extends BaseService<MetaUserPartyRankEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<MetaUserPartyRankDTO>
* @author generator
* @date 2020-03-26
*/
PageData<MetaUserPartyRankDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<MetaUserPartyRankDTO>
* @author generator
* @date 2020-03-26
*/
List<MetaUserPartyRankDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return MetaUserPartyRankDTO
* @author generator
* @date 2020-03-26
*/
MetaUserPartyRankDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-26
*/
void save(MetaUserPartyRankDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-26
*/
void update(MetaUserPartyRankDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-26
*/
void delete(String[] ids);
/***
* 定时任务导入党员排行
* @param
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/3/26 18:23
*/
Result toLeadPartyRankData();
}

105
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/MetaUserRegisterRankService.java

@ -0,0 +1,105 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.user.MetaUserRegisterRankDTO;
import com.elink.esua.epdc.modules.user.entity.MetaUserRegisterRankEntity;
import java.util.List;
import java.util.Map;
/**
* 用户注册排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
public interface MetaUserRegisterRankService extends BaseService<MetaUserRegisterRankEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<MetaUserRegisterRankDTO>
* @author generator
* @date 2020-03-26
*/
PageData<MetaUserRegisterRankDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<MetaUserRegisterRankDTO>
* @author generator
* @date 2020-03-26
*/
List<MetaUserRegisterRankDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return MetaUserRegisterRankDTO
* @author generator
* @date 2020-03-26
*/
MetaUserRegisterRankDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-26
*/
void save(MetaUserRegisterRankDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-26
*/
void update(MetaUserRegisterRankDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-26
*/
void delete(String[] ids);
/***
* 导入用户注册
* @param
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/3/26 13:26
*/
Result toLeadUserRegisterRandData();
}

29
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/UserAnalysisService.java

@ -88,7 +88,6 @@ public interface UserAnalysisService {
GridDataTotalResultDTO selectGridDataTotal(Map<String, Object> params);
/***
* 运营数据导出用户相关
* @param exportOperationFormDTO
@ -97,4 +96,32 @@ public interface UserAnalysisService {
* @date 2020/3/23 15:16
*/
List<ExportOperationDataResultDTO> listExportOperationCount(ExportOperationFormDTO exportOperationFormDTO);
/***
* 获取所有网格
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO>
* @author qushutong
* @date 2020/3/25 17:22
*/
List<GridOpeningResultDTO> selectListGridHasMaCode(Map<String, Object> params);
/***
* 获取导入数据
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO>
* @author qushutong
* @date 2020/3/25 19:13
*/
List<GridOpeningResultDTO> getToLeadGridOpenings(Map<String, Object> params);
/***
* 获取导入用户排行数据
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO>
* @author qushutong
* @date 2020/3/26 13:32
*/
List<UserDataRankResultDTO> getToLeadUserRegisterRandData(Map<String, Object> params);
}

138
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserGridOpiningServiceImpl.java

@ -0,0 +1,138 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.DateUtils;
import com.elink.esua.epdc.commons.tools.utils.LocalDateUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.datasources.DataSourceNames;
import com.elink.esua.epdc.datasources.annotation.DataSource;
import com.elink.esua.epdc.dto.user.MetaUserGridOpiningDTO;
import com.elink.esua.epdc.dto.user.result.GridOpeningResultDTO;
import com.elink.esua.epdc.modules.user.dao.MetaUserGridOpiningDao;
import com.elink.esua.epdc.modules.user.entity.MetaUserGridOpiningEntity;
import com.elink.esua.epdc.modules.user.service.MetaUserGridOpiningService;
import com.elink.esua.epdc.modules.user.service.UserAnalysisService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 网格开通情况
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-25
*/
@Service
public class MetaUserGridOpiningServiceImpl extends BaseServiceImpl<MetaUserGridOpiningDao, MetaUserGridOpiningEntity> implements MetaUserGridOpiningService {
@Autowired
private UserAnalysisService userAnalysisService;
@Override
@DataSource(name = DataSourceNames.TWELVE)
public PageData<MetaUserGridOpiningDTO> page(Map<String, Object> params) {
IPage<MetaUserGridOpiningEntity> page = getPage(params);
List<MetaUserGridOpiningEntity> metaUserGridOpiningEntityList = getMetaUserGridOpiningEntities(params);
return getPageData(metaUserGridOpiningEntityList,page.getTotal(), MetaUserGridOpiningDTO.class);
}
private List<MetaUserGridOpiningEntity> getMetaUserGridOpiningEntities(Map<String, Object> params) {
// 获取所有网格
List<GridOpeningResultDTO> gridOpeningResultDTOS = userAnalysisService.selectListGridHasMaCode(params);
List<String> deptIdList = new ArrayList<>();
for(GridOpeningResultDTO item:gridOpeningResultDTOS){
deptIdList.add(item.getGridId());
}
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
params.put("deptIdList",deptIdList);
String time = (String) params.get("createdTime");
if(StringUtils.isBlank(time)){
String createdTime = format.format(new Date());
params.put("createdTime",createdTime);
}else {
String createdTime = DateUtils.dealDateFormat(time);
params.put("createdTime",createdTime);
}
return baseDao.pageselectListPage(params);
}
@Override
@DataSource(name = DataSourceNames.TWELVE)
public List<MetaUserGridOpiningDTO> list(Map<String, Object> params) {
List<MetaUserGridOpiningEntity> entityList = getMetaUserGridOpiningEntities(params);
return ConvertUtils.sourceToTarget(entityList, MetaUserGridOpiningDTO.class);
}
private QueryWrapper<MetaUserGridOpiningEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<MetaUserGridOpiningEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public MetaUserGridOpiningDTO get(String id) {
MetaUserGridOpiningEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, MetaUserGridOpiningDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(MetaUserGridOpiningDTO dto) {
MetaUserGridOpiningEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserGridOpiningEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(MetaUserGridOpiningDTO dto) {
MetaUserGridOpiningEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserGridOpiningEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@DataSource(name = DataSourceNames.TWELVE)
public Result createUserAnalysisData() {
List<GridOpeningResultDTO> list = userAnalysisService.getToLeadGridOpenings(new HashMap<>());
List<MetaUserGridOpiningEntity> metaUserGridOpiningEntities = ConvertUtils.sourceToTarget(list, MetaUserGridOpiningEntity.class);
boolean b = insertBatch(metaUserGridOpiningEntities);
return b?new Result<>():new Result().error("录入失败");
}
}

140
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserPartyRankServiceImpl.java

@ -0,0 +1,140 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.DateUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.datasources.DataSourceNames;
import com.elink.esua.epdc.datasources.annotation.DataSource;
import com.elink.esua.epdc.dto.user.MetaUserPartyRankDTO;
import com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO;
import com.elink.esua.epdc.modules.user.dao.MetaUserPartyRankDao;
import com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity;
import com.elink.esua.epdc.modules.user.service.MetaUserPartyRankService;
import com.elink.esua.epdc.modules.user.service.MetaUserRegisterRankService;
import com.elink.esua.epdc.modules.user.service.UserAnalysisService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 党员排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Service
public class MetaUserPartyRankServiceImpl extends BaseServiceImpl<MetaUserPartyRankDao, MetaUserPartyRankEntity> implements MetaUserPartyRankService {
@Autowired
private UserAnalysisService userAnalysisService;
@Autowired
private MetaUserRegisterRankServiceImpl metaUserRegisterRankService;
@Override
@DataSource(name = DataSourceNames.TWELVE)
public PageData<MetaUserPartyRankDTO> page(Map<String, Object> params) {
IPage<MetaUserPartyRankEntity> page = getPage(params);
List<MetaUserPartyRankEntity> metaUserRegisterRankEntities = getMetaUserPartyRankEntities(params);
return getPageData(metaUserRegisterRankEntities,page.getTotal(), MetaUserPartyRankDTO.class);
}
private List<MetaUserPartyRankEntity> getMetaUserPartyRankEntities(Map<String, Object> params) {
// 获取权限下的街道id
List<String> streetIdList = metaUserRegisterRankService.getListStreetId();
params.put("streetIdList",streetIdList);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String time = (String) params.get("createdTime");
if(StringUtils.isBlank(time)){
String createdTime = format.format(new Date());
params.put("createdTime",createdTime);
}else {
String createdTime = DateUtils.dealDateFormat(time);
params.put("createdTime",createdTime);
}
return baseDao.selectPagePartyRank(params);
}
@Override
@DataSource(name = DataSourceNames.TWELVE)
public List<MetaUserPartyRankDTO> list(Map<String, Object> params) {
List<MetaUserPartyRankEntity> entityList = getMetaUserPartyRankEntities(params);
return ConvertUtils.sourceToTarget(entityList, MetaUserPartyRankDTO.class);
}
private QueryWrapper<MetaUserPartyRankEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<MetaUserPartyRankEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public MetaUserPartyRankDTO get(String id) {
MetaUserPartyRankEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, MetaUserPartyRankDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(MetaUserPartyRankDTO dto) {
MetaUserPartyRankEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserPartyRankEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(MetaUserPartyRankDTO dto) {
MetaUserPartyRankEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserPartyRankEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@DataSource(name = DataSourceNames.TWELVE)
public Result toLeadPartyRankData() {
// 获取导出数据
Map<String,Object> params = new HashMap<>();
params.put("partyFlag", YesOrNoEnum.YES.value());
List<UserDataRankResultDTO> toLeadUserRegisterRandData = userAnalysisService.getToLeadUserRegisterRandData(params);
List<MetaUserPartyRankEntity> metaUserPartyRankEntities = ConvertUtils.sourceToTarget(toLeadUserRegisterRandData, MetaUserPartyRankEntity.class);
return insertBatch(metaUserPartyRankEntities)? new Result(): new Result().error("导入党员排行失败") ;
}
}

147
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/MetaUserRegisterRankServiceImpl.java

@ -0,0 +1,147 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.user.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.DateUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.datasources.DataSourceNames;
import com.elink.esua.epdc.datasources.annotation.DataSource;
import com.elink.esua.epdc.dto.user.MetaUserRegisterRankDTO;
import com.elink.esua.epdc.dto.user.result.UserDataRankResultDTO;
import com.elink.esua.epdc.modules.user.dao.MetaUserRegisterRankDao;
import com.elink.esua.epdc.modules.user.entity.MetaUserRegisterRankEntity;
import com.elink.esua.epdc.modules.user.service.MetaUserRegisterRankService;
import com.elink.esua.epdc.modules.user.service.UserAnalysisService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 用户注册排行
*
* @author qu elink@elink-cn.com
* @since v1.0.0 2020-03-26
*/
@Service
public class MetaUserRegisterRankServiceImpl extends BaseServiceImpl<MetaUserRegisterRankDao, MetaUserRegisterRankEntity> implements MetaUserRegisterRankService {
@Autowired
private UserAnalysisService userAnalysisService;
@Override
@DataSource(name = DataSourceNames.TWELVE)
public PageData<MetaUserRegisterRankDTO> page(Map<String, Object> params) {
IPage<MetaUserRegisterRankEntity> page = getPage(params);
List<MetaUserRegisterRankEntity> metaUserRegisterRankEntities = getMetaUserRegisterRankEntities(params);
return getPageData(metaUserRegisterRankEntities,page.getTotal(), MetaUserRegisterRankDTO.class);
}
private List<MetaUserRegisterRankEntity> getMetaUserRegisterRankEntities(Map<String, Object> params) {
// 获取权限下的街道id
List<String> streetIdList = getListStreetId();
params.put("streetIdList",streetIdList);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String time = (String) params.get("createdTime");
if(StringUtils.isBlank(time)){
String createdTime = format.format(new Date());
params.put("createdTime",createdTime);
}else {
String createdTime = DateUtils.dealDateFormat(time);
params.put("createdTime",createdTime);
}
return baseDao.selectPageUserRegisterRank(params);
}
@Override
@DataSource(name = DataSourceNames.TWELVE)
public List<MetaUserRegisterRankDTO> list(Map<String, Object> params) {
List<MetaUserRegisterRankEntity> entityList = getMetaUserRegisterRankEntities(params);
return ConvertUtils.sourceToTarget(entityList, MetaUserRegisterRankDTO.class);
}
private QueryWrapper<MetaUserRegisterRankEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<MetaUserRegisterRankEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public MetaUserRegisterRankDTO get(String id) {
MetaUserRegisterRankEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, MetaUserRegisterRankDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(MetaUserRegisterRankDTO dto) {
MetaUserRegisterRankEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserRegisterRankEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(MetaUserRegisterRankDTO dto) {
MetaUserRegisterRankEntity entity = ConvertUtils.sourceToTarget(dto, MetaUserRegisterRankEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@DataSource(name = DataSourceNames.TWELVE)
public Result toLeadUserRegisterRandData() {
// 获取导出数据
List<UserDataRankResultDTO> toLeadUserRegisterRandData = userAnalysisService.getToLeadUserRegisterRandData(new HashMap<>());
// 导入数据
List<MetaUserRegisterRankEntity> metaUserRegisterRankEntities = ConvertUtils.sourceToTarget(toLeadUserRegisterRandData, MetaUserRegisterRankEntity.class);
return insertBatch(metaUserRegisterRankEntities) ? new Result():new Result().error("导入注册用户排行失败");
}
/***
* 获取当前用户拥有权限的街道id
* @param
* @return java.util.List<java.lang.String>
* @author qushutong
* @date 2020/3/26 16:57
*/
public List<String> getListStreetId() {
Map params = new HashMap();
params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
return baseDao.selectListStreetId(params);
}
}

42
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/user/service/impl/UserAnalysisServiceImpl.java

@ -53,7 +53,6 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
@Override
public List<GridOpeningResultDTO> listPageGridOpeningsForExport(Map<String, Object> params) {
params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
List<GridOpeningResultDTO> list = baseDao.selectListGridHasMaCode(params);
list = fillFieldForGridOpening(list, params);
@ -141,6 +140,11 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
UserDetail userDetail = SecurityUser.getUser();
params.put("deptIdList", userDetail.getDeptIdList());
IPage<UserDataRankResultDTO> page = getPage(params);
List<UserDataRankResultDTO> list = getListUserDataRankResultDro(params);
return new PageData<>(list, page.getTotal());
}
private List<UserDataRankResultDTO> getListUserDataRankResultDro(Map<String, Object> params) {
List<UserDataRankResultDTO> list = baseDao.selectListUserDataRank(params);
if (CollUtil.isNotEmpty(list)) {
@ -175,7 +179,7 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
}
}
}
return new PageData<>(list, page.getTotal());
return list;
}
@ -284,7 +288,7 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
@Override
public List<ExportOperationDataResultDTO> listExportOperationCount(ExportOperationFormDTO exportOperationFormDTO) {
List<Long> allStreetIds = new ArrayList<>();
for(Long[] item : exportOperationFormDTO.getAllDeptIdsShow()){
for (Long[] item : exportOperationFormDTO.getAllDeptIdsShow()) {
allStreetIds.add(item[0]);
}
exportOperationFormDTO.setAllStreetIds(allStreetIds);
@ -308,11 +312,11 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
// 企业
List<ExportOperationDataResultDTO> enterpriseDataResultDTOS = baseDao.selectExportEnterpriseCount(exportOperationFormDTO);
//居民数
for(int i= 0;i<exportOperationDataResultDTOS.size();i++){
for(ExportOperationDataResultDTO item:unAuthorizedResultDTOS){
if( exportOperationDataResultDTOS.get(i).getStreetName().equals(item.getStreetName())){
exportOperationDataResultDTOS.get(i).setRegisterCount(exportOperationDataResultDTOS.get(i).getRegisterCount()+item.getUnAuthorizedCount());
}else {
for (int i = 0; i < exportOperationDataResultDTOS.size(); i++) {
for (ExportOperationDataResultDTO item : unAuthorizedResultDTOS) {
if (exportOperationDataResultDTOS.get(i).getStreetName().equals(item.getStreetName())) {
exportOperationDataResultDTOS.get(i).setRegisterCount(exportOperationDataResultDTOS.get(i).getRegisterCount() + item.getUnAuthorizedCount());
} else {
exportOperationDataResultDTOS.get(i).setRegisterCount(exportOperationDataResultDTOS.get(i).getRegisterCount());
}
}
@ -328,4 +332,26 @@ public class UserAnalysisServiceImpl extends BaseServiceImpl<UserAnalysisDao, Us
}
return exportOperationDataResultDTOS;
}
@Override
public List<GridOpeningResultDTO> selectListGridHasMaCode(Map<String, Object> params) {
params.put("deptIdList", SecurityUser.getUser().getDeptIdList());
params.put("category", YesOrNoEnum.YES.value());
return baseDao.selectListGridHasMaCode(params);
}
@Override
public List<GridOpeningResultDTO> getToLeadGridOpenings(Map<String, Object> params) {
params.put("category", YesOrNoEnum.YES.value());
List<GridOpeningResultDTO> list = baseDao.selectListGridHasMaCode(params);
list = fillFieldForGridOpening(list, params);
return list;
}
@Override
public List<UserDataRankResultDTO> getToLeadUserRegisterRandData(Map<String, Object> params) {
return getListUserDataRankResultDro(params);
}
}

4
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/application-dev.yml

@ -47,6 +47,10 @@ spring:
url: jdbc:mysql://47.104.224.45:3308/esua_epdc_user?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: epdc
password: elink833066
twelve: #数据源12
url: jdbc:mysql://47.104.224.45:3308/esua_epdc_analysis?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: epdc
password: elink833066
initial-size: 10
max-active: 100
min-idle: 10

48
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserGridOpiningDao.xml

@ -0,0 +1,48 @@
<?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.elink.esua.epdc.modules.user.dao.MetaUserGridOpiningDao">
<resultMap type="com.elink.esua.epdc.modules.user.entity.MetaUserGridOpiningEntity" id="metaUserGridOpiningMap">
<result property="id" column="ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="registerCount" column="REGISTER_COUNT"/>
<result property="partyCount" column="PARTY_COUNT"/>
<result property="residentCount" column="RESIDENT_COUNT"/>
<result property="unAuthorizedCount" column="UN_AUTHORIZED_COUNT"/>
<result property="newsCount" column="NEWS_COUNT"/>
<result property="communityCount" column="COMMUNITY_COUNT"/>
<result property="communityMemberCount" column="COMMUNITY_MEMBER_COUNT"/>
<result property="communityTopicCount" column="COMMUNITY_TOPIC_COUNT"/>
<result property="eventCount" column="EVENT_COUNT"/>
<result property="itemCount" column="ITEM_COUNT"/>
<result property="itemCloseCount" column="ITEM_CLOSE_COUNT"/>
<result property="itemPraiseCount" column="ITEM_PRAISE_COUNT"/>
<result property="allDeptName" column="ALL_DEPT_NAME"/>
<result property="gridLeader" column="GRID_LEADER"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="pageselectListPage" resultMap="metaUserGridOpiningMap">
SELECT
*
FROM
meta_epdc_user_grid_opining op
WHERE
del_flag = '0'
<if test="deptIdList!=null and deptIdList.size()>0">
and op.GRID_ID in
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
<if test="createdTime!=null and createdTime != ''">
and op.CREATED_TIME like concat('%', #{createdTime}, '%')
</if>
</select>
</mapper>

48
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserPartyRankDao.xml

@ -0,0 +1,48 @@
<?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.elink.esua.epdc.modules.user.dao.MetaUserPartyRankDao">
<resultMap type="com.elink.esua.epdc.modules.user.entity.MetaUserPartyRankEntity" id="metaUserPartyRankMap">
<result property="id" column="ID"/>
<result property="streetId" column="STREET_ID"/>
<result property="streetName" column="STREET_NAME"/>
<result property="partyMemberCount" column="PARTY_MEMBER_COUNT"/>
<result property="oldCount" column="OLD_COUNT"/>
<result property="oldPercent" column="OLD_PERCENT"/>
<result property="youngCount" column="YOUNG_COUNT"/>
<result property="youngPercent" column="YOUNG_PERCENT"/>
<result property="maleCount" column="MALE_COUNT"/>
<result property="femaleCount" column="FEMALE_COUNT"/>
<result property="unknownSexCount" column="UNKNOWN_SEX_COUNT"/>
<result property="partyAuthFailureCount" column="PARTY_AUTH_FAILURE_COUNT"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectPagePartyRank" resultMap="metaUserPartyRankMap">
SELECT
*
FROM
meta_epdc_user_party_rank pr
WHERE
del_flag = '0'
<if test="streetId!=null and streetId != ''">
and pr.STREET_ID = #{streetId}
</if>
<if test="createdTime!=null and createdTime != ''">
and pr.CREATED_TIME like concat('%', #{createdTime}, '%')
</if>
<if test="streetIdList!=null and streetIdList.size()>0">
and pr.STREET_ID in
<foreach collection="streetIdList" index="index" item="streetId" open="(" separator="," close=")">
#{streetId}
</foreach>
</if>
</select>
</mapper>

71
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/MetaUserRegisterRankDao.xml

@ -0,0 +1,71 @@
<?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.elink.esua.epdc.modules.user.dao.MetaUserRegisterRankDao">
<resultMap type="com.elink.esua.epdc.modules.user.entity.MetaUserRegisterRankEntity" id="metaUserRegisterRankMap">
<result property="id" column="ID"/>
<result property="streetId" column="STREET_ID"/>
<result property="streetName" column="STREET_NAME"/>
<result property="userCount" column="USER_COUNT"/>
<result property="partyMemberCount" column="PARTY_MEMBER_COUNT"/>
<result property="residentCount" column="RESIDENT_COUNT"/>
<result property="unAuthorizedCount" column="UN_AUTHORIZED_COUNT"/>
<result property="oldCount" column="OLD_COUNT"/>
<result property="oldPercent" column="OLD_PERCENT"/>
<result property="youngCount" column="YOUNG_COUNT"/>
<result property="youngPercent" column="YOUNG_PERCENT"/>
<result property="maleCount" column="MALE_COUNT"/>
<result property="femaleCount" column="FEMALE_COUNT"/>
<result property="unknownSexCount" column="UNKNOWN_SEX_COUNT"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectPageUserRegisterRank" resultMap="metaUserRegisterRankMap">
SELECT
*
FROM
meta_epdc_user_register_rank rr
WHERE
del_flag = '0'
<if test="streetId!=null and streetId != ''">
and rr.STREET_ID = #{streetId}
</if>
<if test="createdTime!=null and createdTime != ''">
and rr.CREATED_TIME like concat('%', #{createdTime}, '%')
</if>
<if test="streetIdList!=null and streetIdList.size()>0">
and rr.STREET_ID in
<foreach collection="streetIdList" index="index" item="streetId" open="(" separator="," close=")">
#{streetId}
</foreach>
</if>
</select>
<select id="selectListStreetId" resultType="String">
SELECT
ad2.id streetId
FROM
esua_epdc_user.epdc_user uu
LEFT JOIN esua_epdc_admin.sys_dept ad ON uu.DEPT_ID = ad.ID
AND ad.type_key = 'grid_party'
LEFT JOIN esua_epdc_admin.sys_dept ad1 ON ad1.id = ad.pid
LEFT JOIN esua_epdc_admin.sys_dept ad2 ON ad2.id = ad1.pid
WHERE
uu.DEL_FLAG = '0'
<if test="deptIdList!=null and deptIdList.size()>0">
and ad2.ID in
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
AND ad.id IS NOT NULL
AND ad2.id IS NOT NULL
GROUP BY
ad2.id
</select>
</mapper>

1
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/user/UserAnalysisDao.xml

@ -44,6 +44,7 @@
<if test="startTime != null and endTime != null and endTime != ''">
AND uu.CREATED_TIME BETWEEN #{startTime} AND #{endTime}
</if>
AND ad2.id is NOT NULL
AND ad.id IS NOT NULL
) t GROUP BY t.streetId
) t1

41
esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/UserFeignClint.java

@ -0,0 +1,41 @@
package com.elink.esua.epdc.feign;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.feign.fallback.UserFeignClintFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
/**
* @author: qushutong
* @Date: 2020/3/25 10:20
* @Description: 用户数据分析
*/
@FeignClient(name = ServiceConstant.EPDC_ANALYSIS_SERVER, fallback = UserFeignClintFallback.class)
public interface UserFeignClint {
/***
* 生成用户分析数据导入临时表
* @param
* @return void
* @author qushutong
* @date 2020/3/25 10:19
*/
@GetMapping("analysis/metausergridopining/tolead")
Result createUserAnalysisData();
/***
* 用户注册排行导入数据
* @param
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author qushutong
* @date 2020/3/26 17:45
*/
@GetMapping("analysis/metauserregisterrank/toLeadUserRegisterRandData")
Result toLeadUserRegisterRandData();
@GetMapping("analysis/metauserpartyrank/toLeadPartyRankData")
Result toLeadPartyRankData();
}

31
esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClintFallback.java

@ -0,0 +1,31 @@
package com.elink.esua.epdc.feign.fallback;
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.feign.UserFeignClint;
import org.springframework.stereotype.Component;
/**
* @author: qushutong
* @Date: 2020/3/25 10:22
* @Description: 用户数据分析
*/
@Component
public class UserFeignClintFallback implements UserFeignClint {
@Override
public Result createUserAnalysisData() {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "createUserAnalysisData", "");
}
@Override
public Result toLeadUserRegisterRandData() {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "toLeadUserRegisterRandData", "");
}
@Override
public Result toLeadPartyRankData() {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ANALYSIS_SERVER, "toLeadPartyRankData", "");
}
}

19
esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/service/ScheduleJobUserService.java

@ -0,0 +1,19 @@
package com.elink.esua.epdc.service;
/**
* @author: qushutong
* @Date: 2020/3/25 10:18
* @Description: 用户数据分析
*/
public interface ScheduleJobUserService {
/***
* 生成用户分析数据导入临时表
* @param
* @return void
* @author qushutong
* @date 2020/3/25 10:19
*/
void createUserAnalysisData();
}

29
esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/service/impl/ScheduleJobUserServiceImpl.java

@ -0,0 +1,29 @@
package com.elink.esua.epdc.service.impl;
import com.elink.esua.epdc.feign.UserFeignClint;
import com.elink.esua.epdc.service.ScheduleJobUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
/**
* @author: qushutong
* @Date: 2020/3/25 10:15
* @Description: 用户数据数据分析
*/
@Component
public class ScheduleJobUserServiceImpl implements ScheduleJobUserService {
@Autowired
private UserFeignClint userFeignClint;
@Override
public void createUserAnalysisData() {
// 网格开通
userFeignClint.createUserAnalysisData();
// 用户注册
userFeignClint.toLeadUserRegisterRandData();
// 党员排行绑
userFeignClint.toLeadPartyRankData();
}
}

18
esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/analysis/UserAnalysisTask.java

@ -0,0 +1,18 @@
package com.elink.esua.epdc.task.analysis;
/**
* @author: qushutong
* @Date: 2020/3/25 10:04
* @Description: 用户分析
*/
public interface UserAnalysisTask {
/***
* 网格开通情况
* @param
* @return void
* @author qushutong
* @date 2020/3/25 10:11
*/
void run(String params);
}

21
esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/analysis/UserAnalysisTaskImpl.java

@ -0,0 +1,21 @@
package com.elink.esua.epdc.task.analysis;
import com.elink.esua.epdc.service.ScheduleJobUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author: qushutong
* @Date: 2020/3/25 10:12
* @Description:
*/
@Component("UserAnalysisTask")
public class UserAnalysisTaskImpl implements UserAnalysisTask {
@Autowired
private ScheduleJobUserService scheduleJobUserService;
@Override
public void run(String params) {
scheduleJobUserService.createUserAnalysisData();
}
}
Loading…
Cancel
Save