Browse Source

Merge remote-tracking branch 'remotes/origin/dev' into dev_staff_info

# Conflicts:
#	epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
#	epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
#	epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
master
jianjun 4 years ago
parent
commit
f4e58c3480
  1. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  2. 45
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/StaffPatrollExcel.java
  3. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/redis/ResiGroupRedis.java
  4. 7
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/CategoryAnalysisResultDTO.java
  5. 7
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryTopAppealResultDTO.java
  6. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java
  7. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  8. 16
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java
  9. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java
  10. 27
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java
  11. 46
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml
  12. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java
  13. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java
  14. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java
  15. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  16. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java
  17. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java
  18. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.24__add_categoryOriginCustomerId.sql
  19. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml
  20. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.xml
  21. 62
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml
  22. 9
      epmet-module/resi-home/resi-home-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java
  23. 2
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberConfirmController.java
  24. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java
  25. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java
  26. 27
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/SelectPatrolCountResultDTO.java
  27. 9
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  28. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  29. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsStaffPatrolRecordDailyController.java
  30. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java
  31. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsStaffPatrolRecordDailyService.java
  32. 36
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java
  33. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml
  34. 12
      epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml

12
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -5,16 +5,19 @@ import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.epmetuser.form.*;
import com.epmet.dataaggre.dto.epmetuser.result.*;
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO;
import com.epmet.dataaggre.excel.StaffPatrollExcel;
import com.epmet.dataaggre.service.datastats.DataStatsService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -253,4 +256,13 @@ public class EpmetUserController {
return new Result<CustomerStaffResultDTO>().ok(epmetUserService.getStaffInfo(staffId));
}
@GetMapping("export/staffpatroll")
public void export(@LoginUser TokenDto tokenDto, @RequestBody StaffListFormDTO formDTO, HttpServletResponse response) throws Exception {
ValidatorUtils.validateEntity(formDTO, StaffListFormDTO.Staff.class);
formDTO.setUserId(tokenDto.getUserId());
//formDTO.setUserId("73ae6280e46a6653a5605d51d5462725");
List<StaffListResultDTO> resultDTOS = epmetUserService.staffPatrolList(formDTO);
ExcelUtils.exportExcelToTarget(response, null, resultDTOS, StaffPatrollExcel.class);
}
}

45
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/StaffPatrollExcel.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.epmet.dataaggre.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
* 客户表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-11
*/
@Data
public class StaffPatrollExcel {
@Excel(name = "组织")
private String gridName = "";
@Excel(name = "姓名")
private String staffName = "";
@Excel(name = "巡查总次数")
private Integer patrolTotal = 0;
@Excel(name = "上报项目数")
private Integer reportProjectCount;
@Excel(name = "巡查总时长")
private String totalTime = "";
}

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/redis/ResiGroupRedis.java

@ -2,6 +2,7 @@ package com.epmet.dataaggre.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.dataaggre.constant.GroupConstant;
import com.epmet.dto.form.UserBadgeUnitFormDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -36,8 +37,8 @@ public class ResiGroupRedis {
if (!CollectionUtils.isEmpty(result)){
List<String> icons = new ArrayList<>();
for (Object o : result) {
Map<String,String> map = (Map<String, String>) o;
icons.add(map.get(GroupConstant.BADGE_ICON));
UserBadgeUnitFormDTO map = (UserBadgeUnitFormDTO) o;
icons.add(map.getBadgeIcon());
}
return icons;
}

7
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/CategoryAnalysisResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.result.screen;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -33,4 +34,10 @@ public class CategoryAnalysisResultDTO implements Serializable {
* 分类编码
*/
private String categoryCode;
/**
* 分类来源客户ID
*/
@JsonIgnore
private String categoryOriginCustomerId;
}

7
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryTopAppealResultDTO.java

@ -1,6 +1,7 @@
package com.epmet.project.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -30,6 +31,12 @@ public class CategoryTopAppealResultDTO implements Serializable {
*/
private Integer categoryCount;
/**
* 分类来源客户ID
*/
@JsonIgnore
private String categoryOriginCustomerId;
public CategoryTopAppealResultDTO() {
this.categoryId = "";
this.categoryName = "";

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/StaffPatrolDetailController.java

@ -6,11 +6,11 @@ import com.epmet.datareport.service.user.StaffPatrolDetailService;
import com.epmet.user.form.GridManagerListFormDTO;
import com.epmet.dto.form.PatrolTrackFormDTO;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.user.form.PatrolCountFormDTO;
import com.epmet.dto.form.PatrolCountFormDTO;
import com.epmet.user.result.GridManagerListResultDTO;
import com.epmet.dto.result.PatrolTrackResultDTO;
import com.epmet.dto.result.RecordListResultDTO;
import com.epmet.user.result.PatrolCountResultDTO;
import com.epmet.dto.result.PatrolCountResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java

@ -42,7 +42,7 @@ public interface ScreenProjectCategoryOrgDailyDao {
*/
List<CategoryAnalysisResultDTO> selectCategoryAnalysis(@Param("agencyId") String agencyId,@Param("customerId")String customerId);
CustomerProjectCategoryDTO selectProjectCategory(@Param("categoryCode")String categoryCode, @Param("customerId")String customerId, @Param("subCustomerIds")List<String> subCustomerIds);
CustomerProjectCategoryDTO selectProjectCategory(@Param("categoryCode")String categoryCode, @Param("customerId")String customerId);
/**
* @Description 查询事件分类

16
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java

@ -154,13 +154,8 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
List<CategoryAnalysisResultDTO> resultDTOList = screenProjectCategoryOrgDailyDao.selectCategoryAnalysis(formDTO.getAgencyId(), customerId);
List<CategoryAnalysisResultDTO> resultList = new ArrayList<>();
if (!CollectionUtils.isEmpty(resultDTOList)) {
Result<List<String>> crmRes = operCrmOpenFeignClient.getAllSubCustomerIds(customerId);
List<String> subCustomerIds = new ArrayList<>();
if (crmRes.success() && !CollectionUtils.isEmpty(crmRes.getData())) {
subCustomerIds = crmRes.getData();
}
for (CategoryAnalysisResultDTO dto : resultDTOList) {
CustomerProjectCategoryDTO projectCategoryDTO = screenProjectCategoryOrgDailyDao.selectProjectCategory(dto.getCategoryCode(), customerId, subCustomerIds);
CustomerProjectCategoryDTO projectCategoryDTO = screenProjectCategoryOrgDailyDao.selectProjectCategory(dto.getCategoryCode(), dto.getCategoryOriginCustomerId());
if (null == projectCategoryDTO || StringUtils.isBlank(projectCategoryDTO.getCategoryName())) {
log.warn(String.format("查询分类名称失败,当前客户:%s, categoryCode:%s", dto.getCategoryCode(), customerId));
continue;
@ -219,15 +214,10 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
if (CollectionUtils.isEmpty(result)){
return new ArrayList<>();
}
Result<List<String>> sonCustomer = operCrmOpenFeignClient.getAllSubCustomerIds(customerId);
List<String> subCustomerIds = new ArrayList<>();
if (sonCustomer.success() && !CollectionUtils.isEmpty(sonCustomer.getData())) {
subCustomerIds = sonCustomer.getData();
}
for (CategoryTopAppealResultDTO r : result) {
CustomerProjectCategoryDTO projectCategoryDTO = screenProjectCategoryOrgDailyDao.selectProjectCategory(r.getCategoryId(), customerId, subCustomerIds);
CustomerProjectCategoryDTO projectCategoryDTO = screenProjectCategoryOrgDailyDao.selectProjectCategory(r.getCategoryId(), r.getCategoryOriginCustomerId());
if (null == projectCategoryDTO || StringUtils.isBlank(projectCategoryDTO.getCategoryName())) {
log.warn(String.format("查询分类名称失败,当前客户:%s, categoryCode:%s", r.getCategoryId(), customerId));
log.warn(String.format("查询分类名称失败,当前客户:%s, categoryCode:%s", r.getCategoryId(), r.getCategoryOriginCustomerId()));
continue;
}
r.setCategoryName(projectCategoryDTO.getCategoryName());

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/StaffPatrolDetailService.java

@ -3,11 +3,11 @@ package com.epmet.datareport.service.user;
import com.epmet.user.form.GridManagerListFormDTO;
import com.epmet.dto.form.PatrolTrackFormDTO;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.user.form.PatrolCountFormDTO;
import com.epmet.dto.form.PatrolCountFormDTO;
import com.epmet.user.result.GridManagerListResultDTO;
import com.epmet.dto.result.PatrolTrackResultDTO;
import com.epmet.dto.result.RecordListResultDTO;
import com.epmet.user.result.PatrolCountResultDTO;
import com.epmet.dto.result.PatrolCountResultDTO;
import java.util.List;

27
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/StaffPatrolDetailServiceImpl.java

@ -3,6 +3,7 @@ package com.epmet.datareport.service.user.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.datareport.constant.PatrolConstant;
import com.epmet.datareport.dao.user.StaffPatrolDetailDao;
@ -15,9 +16,9 @@ import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.user.form.GridManagerListFormDTO;
import com.epmet.dto.form.PatrolTrackFormDTO;
import com.epmet.dto.form.RecordListFormDTO;
import com.epmet.user.form.PatrolCountFormDTO;
import com.epmet.dto.form.PatrolCountFormDTO;
import com.epmet.user.result.GridManagerListResultDTO;
import com.epmet.user.result.PatrolCountResultDTO;
import com.epmet.dto.result.PatrolCountResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -26,7 +27,6 @@ import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -200,24 +200,11 @@ public class StaffPatrolDetailServiceImpl implements StaffPatrolDetailService {
*/
@Override
public PatrolCountResultDTO patrolCount(PatrolCountFormDTO formDTO) {
PatrolCountResultDTO result = new PatrolCountResultDTO();
GridManagerListFormDTO gridManagerListFormDTO = ConvertUtils.sourceToTarget(formDTO, GridManagerListFormDTO.class);
List<GridManagerListResultDTO> resultDTOS = gridManagerList(gridManagerListFormDTO);
// 结果为空就是没网格员
if (CollectionUtils.isEmpty(resultDTOS)){
return result;
}
// 根据状态分组,只取巡查中的网格员;巡查中的为0,剩下的都是未巡查,巡查中不为0,总数 - 巡查中 = 未巡查
Map<String, List<GridManagerListResultDTO>> groupByStatus = resultDTOS.stream().collect(Collectors.groupingBy(GridManagerListResultDTO::getStatus));
List<GridManagerListResultDTO> patrolling = groupByStatus.get(PatrolConstant.PATROLLING);
if (CollectionUtils.isEmpty(patrolling)){
result.setElseCount(resultDTOS.size());
return result;
Result<PatrolCountResultDTO> resultDTOResult = epmetUserOpenFeignClient.patrolCount(formDTO);
if (!resultDTOResult.success()){
throw new RenException("查询巡查人数失败...");
}
result.setPatrollingCount(patrolling.size());
result.setElseCount(resultDTOS.size() - patrolling.size());
return result;
return resultDTOResult.getData();
}
}

46
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -8,7 +8,8 @@
SELECT '' AS categoryName,
M.PROJECT_TOTAL AS projectTotal,
m.DATE_ID as dateId,
m.CATEGORY_CODE as categoryCode
m.CATEGORY_CODE as categoryCode,
m.CATEGORY_ORIGIN_CUSTOMER_ID
FROM screen_project_category_org_daily m
WHERE M.DEL_FLAG = '0'
and m.level='1'
@ -33,46 +34,25 @@
<!-- 平阴的分类编码: 平阴自己的+ 子客户未对照的 -->
<select id="selectProjectCategory" parameterType="map" resultType="com.epmet.project.CustomerProjectCategoryDTO">
SELECT
*
SELECT DISTINCT
m.CATEGORY_CODE,
m.CATEGORY_NAME,
m.`LEVEL`
FROM
(
SELECT DISTINCT
m.CATEGORY_CODE,
m.CATEGORY_NAME,
m.`LEVEL`
FROM
customer_project_category_dict m
WHERE
m.DEL_FLAG = '0'
AND m.customer_id = #{customerId}
<if test="subCustomerIds != null and subCustomerIds.size() > 0">
UNION ALL
SELECT DISTINCT
m.CATEGORY_CODE,
m.CATEGORY_NAME,
m.`LEVEL`
FROM
customer_project_category_dict m
WHERE
m.DEL_FLAG = '0'
AND m.customer_id IN
<foreach item="subCustomerId" collection="subCustomerIds" open="(" separator="," close=")">
#{subCustomerId}
</foreach>
</if>
) temp
customer_project_category_dict m
WHERE
temp.CATEGORY_CODE = #{categoryCode}
ORDER BY temp.`LEVEL` DESC
LIMIT 1
m.DEL_FLAG = '0'
AND m.customer_id = #{customerId}
AND CATEGORY_CODE = #{categoryCode}
LIMIT 1
</select>
<!-- 查询事件分类 -->
<select id="categoryTopAppeal" resultType="com.epmet.project.dto.result.CategoryTopAppealResultDTO">
SELECT
CATEGORY_CODE AS categoryId,
PROJECT_TOTAL AS categoryCount
PROJECT_TOTAL AS categoryCount,
CATEGORY_ORIGIN_CUSTOMER_ID
FROM
screen_project_category_org_daily
WHERE

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

@ -43,6 +43,11 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable {
*/
private String customerId;
/**
* 分类来源客户ID
*/
private String categoryOriginCustomerId;
/**
* 日期yyyyMMdd
*/

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

@ -43,6 +43,11 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable {
*/
private String customerId;
/**
* 分类来源客户ID
*/
private String categoryOriginCustomerId;
/**
* 日期yyyyMMdd
*/

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

@ -27,6 +27,11 @@ public class CategoryProjectResultDTO implements Serializable {
*/
private String customerId;
/**
* 分类来源客户ID
*/
private String categoryOriginCustomerId;
/**
* 分类码
*/

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java

@ -65,7 +65,17 @@ public interface ScreenProjectCategoryOrgDailyDao extends BaseDao<ScreenProjectC
*/
List<CategoryProjectResultDTO> selectOrgCategoryMoreCustomerInfo(@Param("customerIds")List<String> customerIds, @Param("dateId") String dateId,
@Param("level")String level, @Param("customerId")String customerId, @Param("existsStatus")Boolean existsStatus);
/**
* @Description 查询组织分类信息多客户升级版
* @Param customerIds
* @Param dateId
* @Param level
* @Param customerId
* @author zxc
* @date 2021/8/19 10:40 上午
*/
List<CategoryProjectResultDTO> selectOrgCategoryMoreCustomerInfoPlus(@Param("customerIds")List<String> customerIds, @Param("dateId") String dateId,
@Param("level")String level, @Param("customerId")String customerId);
/**
* @Description 根据客户ID天ID组织ID删除旧数据
* @Param customerId

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java

@ -42,6 +42,11 @@ public class ScreenProjectCategoryOrgDailyEntity extends BaseEpmetEntity {
*/
private String customerId;
/**
* 分类来源客户ID
*/
private String categoryOriginCustomerId;
/**
* 日期yyyyMMdd
*/

35
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java

@ -187,6 +187,10 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
* 2.查询子客户的分类标签把子客户分类标签一样的累加
* 3.子客户累加后的跟父客户对比 categoryCode一样累加到父客户不一样直接添加到父客户agencyId一并改为父客户的
* 4.父客户数据处理好在存储一套子客户数据
*
*
* 2021-08-19新注释新修改
* 利用 EPMET_CATEGORY_CODE把外部客户的分类计算到内部客户
*/
disposeMoreCustomer(customerId,dateId,relationInfo);
}
@ -397,19 +401,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
List<String> customerIds = relationInfo.stream().map(m -> m.getCustomerId()).collect(Collectors.toList());
// 父客户存在的分类
List<CategoryProjectResultDTO> categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true);
// 父客户不存在的分类
List<CategoryProjectResultDTO> categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false);
// 子级客户的分类标签数据
List<CategoryProjectResultDTO> sonResult = new ArrayList<>();
if (!CollectionUtils.isEmpty(categoryProjectExists)){
categoryProjectResultDTOS.addAll(categoryProjectExists);
sonResult.addAll(categoryProjectExists);
}
if (!CollectionUtils.isEmpty(categoryProjectNotExists)){
categoryProjectResultDTOS.addAll(categoryProjectNotExists);
sonResult.addAll(categoryProjectNotExists);
}
// 此时的 'categoryProjectResultDTOS' 等于 父子客户所有的分类标签
// 内部客户进行分组
Map<String, List<CategoryProjectResultDTO>> groupByCategoryCode = categoryProjectResultDTOS.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getCategoryCode));
// 这时的result集合要清空,因为被上边使用 【result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class);】
result.clear();
@ -417,6 +409,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
groupByCategoryCode.forEach((code, list) -> {
ScreenProjectCategoryOrgDailyEntity e = new ScreenProjectCategoryOrgDailyEntity();
e.setCustomerId(customerId);
e.setCategoryOriginCustomerId(customerId);
e.setCategoryCode(code);
e.setOrgId(entity.getAgencyId());
e.setProjectTotal(CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.stream().collect(Collectors.summingInt(CategoryProjectResultDTO::getProjectTotal)));
@ -426,8 +419,20 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
e.setLevel(list.get(NumConstant.ZERO).getLevel());
finalResult.add(e);
});
if (!CollectionUtils.isEmpty(sonResult)){
List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(sonResult, ScreenProjectCategoryOrgDailyEntity.class);
// 内部客户与外部客户 相同的分类累加
if (!CollectionUtils.isEmpty(categoryProjectExists)){
finalResult.forEach(f -> {
categoryProjectExists.forEach(c -> {
if (f.getCategoryCode().equals(c.getCategoryCode())){
f.setProjectTotal(f.getProjectTotal() + c.getProjectTotal());
}
});
});
}
// 父客户不存在的分类
List<CategoryProjectResultDTO> categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false);
if (!CollectionUtils.isEmpty(categoryProjectNotExists)){
List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(categoryProjectNotExists, ScreenProjectCategoryOrgDailyEntity.class);
result.addAll(entities);
}
// 添加此 锦水、孔村、榆山 orgId,删除时使用

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.24__add_categoryOriginCustomerId.sql

@ -0,0 +1 @@
alter table `epmet_evaluation_index`.screen_project_category_org_daily add COLUMN `CATEGORY_ORIGIN_CUSTOMER_ID` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '分类来源客户ID' AFTER CUSTOMER_ID;

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml

@ -69,6 +69,7 @@
<select id="selectListProjectCategoryByOrg" resultType="com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO">
SELECT
c.CUSTOMER_ID,
c.CUSTOMER_ID AS categoryOriginCustomerId,
c.CATEGORY_CODE,
c.`LEVEL`,
p.AGENCY_ID AS orgId,

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.xml

@ -17,6 +17,7 @@
sca.PID,
sca.pids,
sg.CUSTOMER_ID,
sg.CUSTOMER_ID AS categoryOriginCustomerId,
sg.CATEGORY_CODE,
SUM(sg.PROJECT_TOTAL) AS projectTotal,
sg.level,

62
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -29,6 +29,7 @@
IFNULL(sca.PID,'0') AS pid,
IFNULL(sca.PIDS,'0') AS pids,
sa.CUSTOMER_ID,
sa.CATEGORY_ORIGIN_CUSTOMER_ID,
sa.CATEGORY_CODE,
SUM(sa.PROJECT_TOTAL) AS projectTotal,
sa.level,
@ -50,8 +51,14 @@
IFNULL(sca.PID,'0') AS pid,
IFNULL(sca.PIDS,'0') AS pids,
#{customerId} as customerId,
od.CUSTOMER_ID AS categoryOriginCustomerId,
od.level,
od.CATEGORY_CODE,
<if test="existsStatus == true">
cd.EPMET_CATEGORY_CODE AS categoryCode,
</if>
<if test="existsStatus == false">
od.CATEGORY_CODE AS categoryCode,
</if>
SUM(od.PROJECT_TOTAL) AS projectTotal,
#{level} as orgType,
od.DATE_ID
@ -101,4 +108,57 @@
GROUP BY od.CATEGORY_CODE
</select>
<!-- 查询组织分类信息【多客户】升级版 -->
<select id="selectOrgCategoryMoreCustomerInfoPlus" resultType="com.epmet.dto.screen.result.CategoryProjectResultDTO">
SELECT
IF(od.pid = '0', od.ORG_ID,od.pid) AS orgId,
IFNULL(sca.PID,'0') AS pid,
IFNULL(sca.PIDS,'0') AS pids,
#{customerId} as customerId,
od.level,
#{level} as orgType,
cd.EPMET_CATEGORY_CODE AS categoryCode,
SUM(od.PROJECT_TOTAL) AS projectTotal,
od.DATE_ID
FROM screen_project_category_org_daily od
LEFT JOIN customer_project_category_dict cd ON (cd.CATEGORY_CODE = od.CATEGORY_CODE AND cd.CUSTOMER_ID = od.CUSTOMER_ID)
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = od.PID
WHERE 1=1
AND od.DEL_FLAG = '0'
AND od.CUSTOMER_ID IN (
<foreach collection="customerIds" item="customer" separator=",">
#{customer}
</foreach>
)
AND cd.EPMET_CATEGORY_CODE IS NOT NULL
AND od.pid = '0'
AND od.date_id = #{dateId}
GROUP BY od.CATEGORY_CODE,od.pid
UNION ALL
SELECT
IF(od.pid = '0', od.ORG_ID,od.pid) AS orgId,
IFNULL(sca.PID,'0') AS pid,
IFNULL(sca.PIDS,'0') AS pids,
#{customerId} as customerId,
od.level,
#{level} as orgType,
od.CATEGORY_CODE AS categoryCode,
SUM(od.PROJECT_TOTAL) AS projectTotal,
od.DATE_ID
FROM screen_project_category_org_daily od
LEFT JOIN customer_project_category_dict cd ON (cd.CATEGORY_CODE = od.CATEGORY_CODE AND cd.CUSTOMER_ID = od.CUSTOMER_ID)
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = od.PID
WHERE 1=1
AND od.DEL_FLAG = '0'
AND od.CUSTOMER_ID IN (
<foreach collection="customerIds" item="customer" separator=",">
#{customer}
</foreach>
)
AND cd.EPMET_CATEGORY_CODE IS NULL
AND od.pid = '0'
AND od.date_id = #{dateId}
GROUP BY od.CATEGORY_CODE,od.pid
</select>
</mapper>

9
epmet-module/resi-home/resi-home-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java

@ -13,6 +13,7 @@ import com.epmet.enums.OrgLevelEnums;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.ResiEventService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -44,11 +45,18 @@ public class ResiEventServiceImpl implements ResiEventService, ResultDataResolve
//String parentAgencyId = gridInfoData.getParentAgencyId();
//String pids = gridInfoData.getPids();
List<ResiEventNpcResultDTO> npcResultList = new ArrayList<>();
//查询人大代表列表
ListUserByBadgeFormDTO npcForm = new ListUserByBadgeFormDTO(customerId, BadgeConstant.BADGE_KEY_NPC);
Result<List<ListUserByBadgeResultDTO>> npcResult = epmetUserOpenFeignClient.listUsersByBadge(npcForm);
List<ListUserByBadgeResultDTO> npcData = getResultDataOrThrowsException(npcResult, ServiceConstant.EPMET_USER_SERVER, null, null);
if(CollectionUtils.isEmpty(npcData)) {
// 没有人大代表,直接返回空列表即可
return npcResultList;
}
//批量查询人大代表所在的网格信息
List<String> npcGridIds = npcData.stream().map(d -> d.getGridId()).collect(Collectors.toList());
OrgInfoFormDTO form = new OrgInfoFormDTO(OrgInfoConstant.GRID, npcGridIds);
@ -57,7 +65,6 @@ public class ResiEventServiceImpl implements ResiEventService, ResultDataResolve
Map<String, OrgInfoResultDTO> npcGridInfoMap = convertNpcGridInfos2Map(npcGridInfos);
List<ResiEventNpcResultDTO> npcResultList = new ArrayList<>();
npcData.stream().forEach(npc -> {
if (StringUtils.isBlank(excludeUserId) || !npc.getUserId().equals(excludeUserId)) {
OrgInfoResultDTO gridInfo = npcGridInfoMap.get(npc.getGridId());

2
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberConfirmController.java

@ -1,5 +1,6 @@
package com.epmet.modules.partymember.controller;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.utils.Result;
import com.epmet.modules.partymember.service.PartyMemberConfirmService;
import com.epmet.resi.mine.dto.from.PartyMemberInitFromDTO;
@ -65,6 +66,7 @@ public class PartyMemberConfirmController {
* @date 2020/3/31 10:50
*/
@PostMapping("submit")
@NoRepeatSubmit
public Result submit(@RequestBody PartymemberInfoDTO partyMemberInfoDTO) {
return partyMemberConfirmService.submit(partyMemberInfoDTO);
}

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/form/PatrolCountFormDTO.java → epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PatrolCountFormDTO.java

@ -1,4 +1,4 @@
package com.epmet.user.form;
package com.epmet.dto.form;
import lombok.Data;

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/user/result/PatrolCountResultDTO.java → epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolCountResultDTO.java

@ -1,4 +1,4 @@
package com.epmet.user.result;
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;

27
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/SelectPatrolCountResultDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/8/20 9:04 上午
* @DESC
*/
@Data
public class SelectPatrolCountResultDTO implements Serializable {
private static final long serialVersionUID = -4944469520967374496L;
/**
* 巡查状态
*/
private String status;
/**
* 人数
*/
private Integer staffCount = NumConstant.ZERO;
}

9
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -617,4 +617,13 @@ public interface EpmetUserOpenFeignClient {
*/
@PostMapping("/epmetuser/staffrole/queryRoleStaffIds")
Result<Set<String>> queryRoleStaffIds(@RequestBody RoleStaffIdFormDTO formDTO);
/**
* @Description 查询巡查人数
* @Param formDTO
* @author zxc
* @date 2021/8/20 10:21 上午
*/
@PostMapping("/epmetuser/statsstaffpatrolrecorddaily/patrolcount")
Result<PatrolCountResultDTO> patrolCount(@RequestBody PatrolCountFormDTO formDTO);
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -440,4 +440,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<Set<String>> queryRoleStaffIds(RoleStaffIdFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "queryRoleStaffIds", formDTO);
}
@Override
public Result<PatrolCountResultDTO> patrolCount(PatrolCountFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "patrolCount", formDTO);
}
}

22
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsStaffPatrolRecordDailyController.java

@ -1,19 +1,13 @@
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.StatsStaffPatrolRecordDailyDTO;
import com.epmet.service.StatsStaffPatrolRecordDailyService;
import com.epmet.dto.form.PatrolCountFormDTO;
import com.epmet.dto.result.PatrolCountResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* []工作人员巡查记录统计
@ -28,5 +22,15 @@ public class StatsStaffPatrolRecordDailyController {
@Autowired
private StatsStaffPatrolRecordDailyService statsStaffPatrolRecordDailyService;
/**
* @Description 查询巡查人数
* @Param formDTO
* @author zxc
* @date 2021/8/20 10:21 上午
*/
@PostMapping("patrolcount")
public Result<PatrolCountResultDTO> patrolCount(@RequestBody PatrolCountFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, PatrolCountFormDTO.PatrolCountForm.class);
return new Result<PatrolCountResultDTO>().ok(statsStaffPatrolRecordDailyService.patrolCount(formDTO));
}
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StatsStaffPatrolRecordDailyDao.java

@ -18,11 +18,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.SelectPatrolCountResultDTO;
import com.epmet.entity.StatsStaffPatrolRecordDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* []工作人员巡查记录统计
@ -61,4 +63,13 @@ public interface StatsStaffPatrolRecordDailyDao extends BaseDao<StatsStaffPatrol
void updateStatsRecordEnd(@Param("userId")String userId,@Param("totalTime") Integer totalTime,
@Param("projectCount")Integer projectCount,@Param("dateId")String dateId,@Param("gridId")String gridId);
/**
* @Description 查询巡查人数
* @Param agencyId
* @Param dateId
* @author zxc
* @date 2021/8/20 9:10 上午
*/
List<SelectPatrolCountResultDTO> selectPatrolCount(@Param("agencyId")String agencyId, @Param("dateId")String dateId);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsStaffPatrolRecordDailyService.java

@ -2,6 +2,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.StatsStaffPatrolRecordDailyEntity;
import com.epmet.dto.form.PatrolCountFormDTO;
import com.epmet.dto.result.PatrolCountResultDTO;
/**
* []工作人员巡查记录统计
@ -11,5 +13,12 @@ import com.epmet.entity.StatsStaffPatrolRecordDailyEntity;
*/
public interface StatsStaffPatrolRecordDailyService extends BaseService<StatsStaffPatrolRecordDailyEntity> {
/**
* @Description 查询巡查人数
* @Param formDTO
* @author zxc
* @date 2021/8/20 10:21 上午
*/
PatrolCountResultDTO patrolCount(PatrolCountFormDTO formDTO);
}

36
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsStaffPatrolRecordDailyServiceImpl.java

@ -1,23 +1,19 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.PatrolConstant;
import com.epmet.dao.StatsStaffPatrolRecordDailyDao;
import com.epmet.dto.StatsStaffPatrolRecordDailyDTO;
import com.epmet.dto.result.SelectPatrolCountResultDTO;
import com.epmet.entity.StatsStaffPatrolRecordDailyEntity;
import com.epmet.service.StatsStaffPatrolRecordDailyService;
import com.epmet.dto.form.PatrolCountFormDTO;
import com.epmet.dto.result.PatrolCountResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* []工作人员巡查记录统计
@ -29,4 +25,24 @@ import java.util.Map;
@Slf4j
public class StatsStaffPatrolRecordDailyServiceImpl extends BaseServiceImpl<StatsStaffPatrolRecordDailyDao, StatsStaffPatrolRecordDailyEntity> implements StatsStaffPatrolRecordDailyService {
/**
* @Description 查询巡查人数
* @Param formDTO
* @author zxc
* @date 2021/8/20 10:21 上午
*/
@Override
public PatrolCountResultDTO patrolCount(PatrolCountFormDTO formDTO) {
PatrolCountResultDTO result = new PatrolCountResultDTO();
List<SelectPatrolCountResultDTO> counts = baseDao.selectPatrolCount(formDTO.getAgencyId(), DateUtils.getBeforeNDay(NumConstant.ZERO));
counts.forEach(c -> {
if (c.getStatus().equals(PatrolConstant.PATROLLING)){
result.setPatrollingCount(c.getStaffCount());
}
if (c.getStatus().equals(PatrolConstant.END)){
result.setElseCount(c.getStaffCount());
}
});
return result;
}
}

2
epmet-user/epmet-user-server/src/main/resources/mapper/StaffPatrolRecordDao.xml

@ -48,7 +48,7 @@
<select id="selectPatrolRecord" resultType="com.epmet.dto.result.GridManagerUserListResultDTO">
SELECT t.* FROM (SELECT
pr.ID AS recordId,
DISTINCT pr.ID AS recordId,
pr.GRID AS gridId,
pr.STAFF_ID,
pr.`STATUS`

12
epmet-user/epmet-user-server/src/main/resources/mapper/StatsStaffPatrolRecordDailyDao.xml

@ -40,4 +40,16 @@
AND GRID_ID = #{gridId}
</select>
<!-- 查询巡查人数 -->
<select id="selectPatrolCount" resultType="com.epmet.dto.result.SelectPatrolCountResultDTO">
SELECT t.STATUS , COUNT(t.STAFF_ID) AS staffCount FROM
(SELECT
STAFF_ID,LATEST_PATROL_STATUS AS STATUS
FROM stats_staff_patrol_record_daily
WHERE DEL_FLAG = 0
AND DATE_ID = #{dateId}
AND GRID_PIDS LIKE CONCAT('%',#{agencyId},'%')
ORDER BY STAFF_ID DESC) t GROUP BY t.STATUS
</select>
</mapper>
Loading…
Cancel
Save