From b5a8afd5805916b0477c23df3f3962e4e17885f8 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 10 Nov 2021 01:23:43 +0800 Subject: [PATCH 01/39] =?UTF-8?q?=E9=87=8A=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datareport/controller/screen/ScreenProjectController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java index 66d088dd27..e310d262e1 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java @@ -284,6 +284,7 @@ public class ScreenProjectController { } formDTO.setPageNo(formDTO.getPageNo() + 1); excelWriter.fill(data.getList(), writeSheet); + data.getList().clear(); } while (data.getList().size() == formDTO.getPageSize()); // String templatePath = "excel/project_temp.xlsx"; From 8d734841d617e753ed93df4e48009de58b1aa963 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 10 Nov 2021 10:54:28 +0800 Subject: [PATCH 02/39] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=94=B1=20=E5=89=8D=E7=AB=AF=E4=BC=A0?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/project/dto/form/ProjectCategoryFormDTO.java | 6 ++++++ .../controller/screen/ScreenProjectController.java | 8 ++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/ProjectCategoryFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/ProjectCategoryFormDTO.java index 8cd3a4f083..c7a585ec6c 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/ProjectCategoryFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/ProjectCategoryFormDTO.java @@ -35,4 +35,10 @@ public class ProjectCategoryFormDTO implements Serializable { * 开始时间 */ private String startTime; + + /** + * 组织名称 + */ + @NotBlank(message = "组织名称不能为空",groups = CategoryProjectExportForm.class) + private String orgName; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java index e310d262e1..98cda05a2b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java @@ -8,8 +8,6 @@ import com.alibaba.excel.write.metadata.WriteSheet; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; -import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; -import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; @@ -215,10 +213,9 @@ public class ScreenProjectController { e.setIndex(1); resultDTOList.addAll(ConvertUtils.sourceToTarget(e.getChildren(),ProjectCategoryResultDTO.class)); }); - CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); Map mapData = new HashMap<>(); mapData.put("list",resultDTOList); - mapData.put("orgName",staffInfo.getAgencyName()); + mapData.put("orgName", formDTO.getOrgName()); mapData.put("exportDate",getExportDateStr(formDTO.getStartTime(),formDTO.getEndTime())); Workbook workbook = ExcelExportUtil.exportExcel(new TemplateExportParams(templatePath), mapData); response.setHeader("content-Type", "application/vnd.ms-excel"); @@ -257,9 +254,8 @@ public class ScreenProjectController { formDTO.setIsPage(false); ValidatorUtils.validateEntity(formDTO, ProjectCategoryFormDTO.CategoryProjectExportForm.class); - CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); Map mapData = new HashMap<>(); - mapData.put("orgName", staffInfo == null ? StrConstant.EPMETY_STR : staffInfo.getAgencyName()); + mapData.put("orgName", formDTO.getOrgName()); mapData.put("exportDate", getExportDateStr(formDTO.getStartTime(), formDTO.getEndTime())); mapData.put("categoryName", formDTO.getCategoryName()); if (StringUtils.isNotBlank(formDTO.getParentCategoryName())) { From 66cf45470d1da6a22fb44f24eea8017ed296e789 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 10 Nov 2021 13:59:11 +0800 Subject: [PATCH 03/39] =?UTF-8?q?=E6=96=B0=E7=BD=91=E6=A0=BC=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GridAndOrgCategoryCountResultDTO.java | 69 ++++++++++ .../com/epmet/constant/ProjectConstant.java | 3 + .../screen/ScreenProjectDataDao.java | 5 + ...ProjectCategoryGridAndOrgDailyService.java | 34 +++++ ...ectCategoryGridAndOrgDailyServiceImpl.java | 123 ++++++++++++++++++ .../screen/ScreenProjectDataDao.xml | 58 +++++++++ 6 files changed, 292 insertions(+) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridAndOrgDailyService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java new file mode 100644 index 0000000000..de4f1c8a58 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java @@ -0,0 +1,69 @@ +package com.epmet.dto.screen.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/11/10 10:36 上午 + * @DESC + */ +@Data +public class GridAndOrgCategoryCountResultDTO implements Serializable { + + private static final long serialVersionUID = -5167964547464983118L; + + /** + * 组织ID + */ + private String orgId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 上级组织ID + */ + private String pid; + + /** + * 所有上级组织ID + */ + private String pids; + + private String dateId; + + private String customerId; + + /** + * 分类CODE + */ + private String categoryCode; + + /** + * 分类CODE级别 + */ + private Integer level; + + /** + * 项目总数 + */ + private Integer projectTotal; + + /** + * 关闭【结案】项目总数 + */ + private Integer closedProjectTotal; + + public GridAndOrgCategoryCountResultDTO() { + this.orgId = ""; + this.categoryCode = ""; + this.level = NumConstant.ZERO; + this.projectTotal = NumConstant.ZERO; + this.closedProjectTotal = NumConstant.ZERO; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java index 6b9966b154..ec417c1c60 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -90,4 +90,7 @@ public interface ProjectConstant { * 上报 */ String PROJECT_REPORT="02"; + + String PROJECT_STATUS_CLOSED = "closed"; + String PROJECT_STATUS_ALL = "all"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java index 97c85d1bc0..dd77e140c5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -68,4 +69,8 @@ public interface ScreenProjectDataDao extends BaseDao { int updateProjectSatisfactionScore(@Param("projectId")String projectId, @Param("score")BigDecimal score); List selectProjectList(@Param("customerId") String customerId, @Param("projectId") String projectId); + + List selectGridCategoryProjectCount(@Param("customerIds") List customerIds,@Param("dateId") String dateId, + @Param("status")String status,@Param("customerId") String customerId, + @Param("subCount")Integer subCount); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridAndOrgDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridAndOrgDailyService.java new file mode 100644 index 0000000000..67a6077e34 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridAndOrgDailyService.java @@ -0,0 +1,34 @@ +package com.epmet.service.evaluationindex.screen; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.screen.ScreenProjectCategoryOrgDailyDTO; +import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 项目(事件)分类按 组织——组织——按天统计 + */ +public interface ScreenProjectCategoryGridAndOrgDailyService { + + /** + * @Description 分类下的项目数【grid】 + * @param customerId + * @param dateId + * @author zxc + * @date 2021/11/10 10:23 上午 + */ + void extractCategoryProjectGridData(String customerId, String dateId); + + /** + * @Description 分类下的项目数【org】 + * @param customerId + * @param dateId + * @author zxc + * @date 2021/11/10 10:23 上午 + */ + void extractCategoryProjectOrgData(String customerId, String dateId); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java new file mode 100644 index 0000000000..79626972f2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java @@ -0,0 +1,123 @@ +package com.epmet.service.evaluationindex.screen.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.constant.DataSourceConstant; +import com.epmet.constant.ProjectConstant; +import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao; +import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao; +import com.epmet.dao.evaluationindex.screen.ScreenProjectDataDao; +import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO; +import com.epmet.entity.crm.CustomerRelationEntity; +import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryGridDailyEntity; +import com.epmet.service.crm.CustomerRelationService; +import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryGridAndOrgDailyService; +import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryGridDailyService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.ListUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Author zxc + * @DateTime 2021/11/10 10:25 上午 + * @DESC + */ +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +@Slf4j +public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenProjectCategoryGridAndOrgDailyService{ + + @Autowired + private ScreenProjectDataDao screenProjectDataDao; + @Autowired + private CustomerRelationService relationService; + @Autowired + private ScreenProjectCategoryGridDailyDao gridDailyDao; + @Autowired + private ScreenProjectCategoryGridDailyService gridDailyService; + @Autowired + private ScreenProjectCategoryOrgDailyDao orgDailyDao; + + /** + * @Description 分类下的项目数【grid】 + * @param customerId + * @param dateId + * @author zxc + * @date 2021/11/10 10:23 上午 + */ + @Override + public void extractCategoryProjectGridData(String customerId, String dateId) { + List relationInfo = relationService.selectSubCustomer(customerId); + List customerIds = new ArrayList<>(); + customerIds.add(customerId); + List allList = new ArrayList<>(); + List closedList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(relationInfo)){ + // 单客户 + allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.FOUR); + closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.FOUR); + + }else { + // 多客户 + List subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); + customerIds.addAll(subCustomerIds); + allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.TWO); + closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.TWO); + } + List finalClosedList = closedList; + allList.forEach(a -> finalClosedList.stream().filter(c -> c.getOrgId().equals(a.getOrgId()) && c.getCategoryCode().equals(a.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); + gridDel(customerId,dateId); + gridInsert(allList); + } + + /** + * @Description 项目分类网格删除 + * @param customerId + * @param dateId + * @author zxc + * @date 2021/11/10 1:55 下午 + */ + @Transactional(rollbackFor = Exception.class) + public void gridDel(String customerId,String dateId){ + Integer num = NumConstant.ZERO; + do { + num = gridDailyDao.deleteByDateIdAndCustomerId(customerId, dateId); + }while (num > NumConstant.ZERO && num == NumConstant.ONE_THOUSAND); + } + + /** + * @Description 项目分类网格添加 + * @param needInsert + * @author zxc + * @date 2021/11/10 1:55 下午 + */ + @Transactional(rollbackFor = Exception.class) + public void gridInsert(List needInsert){ + List> partition = ListUtils.partition(needInsert, NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + gridDailyService.insertBatch(ConvertUtils.sourceToTarget(p,ScreenProjectCategoryGridDailyEntity.class)); + log.info("插入的网格项目分类为" + JSON.toJSONString(p)); + }); + } + + /** + * @Description 分类下的项目数【org】 + * @param customerId + * @param dateId + * @author zxc + * @date 2021/11/10 10:23 上午 + */ + @Override + public void extractCategoryProjectOrgData(String customerId, String dateId) { + + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index 5930ae87c9..199776d15e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -269,4 +269,62 @@ ORDER BY a.CREATED_TIME ASC + + From dbe7af9e21119dbd463ecf7c986f8041a07f69bf Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 10 Nov 2021 14:36:23 +0800 Subject: [PATCH 04/39] emm --- .../ScreenProjectCategoryGridAndOrgDailyServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java index 79626972f2..9eb635ff4e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java @@ -61,11 +61,10 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr customerIds.add(customerId); List allList = new ArrayList<>(); List closedList = new ArrayList<>(); - if (CollectionUtils.isNotEmpty(relationInfo)){ + if (CollectionUtils.isEmpty(relationInfo)){ // 单客户 allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.FOUR); closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.FOUR); - }else { // 多客户 List subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); @@ -118,6 +117,8 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr */ @Override public void extractCategoryProjectOrgData(String customerId, String dateId) { - + List relationInfo = relationService.selectSubCustomer(customerId); + List customerIds = new ArrayList<>(); + customerIds.add(customerId); } } From 7fd08f5204804191c93100a68750873648896d8f Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 10 Nov 2021 15:38:20 +0800 Subject: [PATCH 05/39] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=85=B3=E8=81=94=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/screen/ScreenProjectCategoryDTO.java | 102 +++++++++++++++ .../data-statistical-server/pom.xml | 6 + .../com/epmet/controller/DemoController.java | 9 +- .../screen/ScreenProjectCategoryDao.java | 36 ++++++ .../screen/ScreenProjectCategoryEntity.java | 68 ++++++++++ .../screen/ScreenProjectCategoryService.java | 105 ++++++++++++++++ .../screen/ScreenProjectDataService.java | 9 ++ .../ScreenProjectCategoryServiceImpl.java | 119 ++++++++++++++++++ .../impl/ScreenProjectDataServiceImpl.java | 83 +++++++++++- .../screen/ScreenProjectCategoryDao.xml | 30 +++++ 10 files changed, 561 insertions(+), 6 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryDao.xml diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryDTO.java new file mode 100644 index 0000000000..f9fedd5560 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryDTO.java @@ -0,0 +1,102 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.screen; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-10 + */ +@Data +public class ScreenProjectCategoryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 项目id + */ + private String projectId; + + /** + * 分类编码 + */ + private String categoryCode; + + /** + * 所属父类分类编码 + */ + private String parentCategoryCode; + + /** + * 原始分类编码 + */ + private String originCategoryCode; + + /** + * 分类等级:1、2....;产品目前只有2级分类 + */ + private Integer level; + + /** + * 删除标识 0未删除;1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index cf2f0f200b..434c57712e 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -128,6 +128,12 @@ 2.0.0 compile + + com.epmet + oper-crm-client + 2.0.0 + compile + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 6fefc845b6..3d6182a217 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -62,7 +62,6 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Date; -import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -136,6 +135,8 @@ public class DemoController { private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService; @Autowired private DimCustomerService dimCustomerService; + @Autowired + private ScreenProjectDataService screenProjectDataService; @GetMapping("testAlarm") public void testAlarm() { @@ -1068,4 +1069,10 @@ public class DemoController { customerAgencyService.sysAgencyInfo(formDTO.getFromCustomerId(), formDTO.getToCustomerId()); return new Result(); } + + @PostMapping("extractCategory") + public Result extractCategory(@RequestBody StatsFormDTO formDTO) { + screenProjectDataService.extractCategory(formDTO.getCustomerId()); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryDao.java new file mode 100644 index 0000000000..08d28b6c86 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryDao.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.evaluationindex.screen; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-10 + */ +@Mapper +public interface ScreenProjectCategoryDao extends BaseDao { + void deleteByProjectIds(@Param("customerId") String customerId, @Param("projectIds") List projectIds); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryEntity.java new file mode 100644 index 0000000000..4e1ea78bfe --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryEntity.java @@ -0,0 +1,68 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.evaluationindex.screen; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-10 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("screen_project_category") +public class ScreenProjectCategoryEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 项目id + */ + private String projectId; + + /** + * 分类编码 + */ + private String categoryCode; + + /** + * 所属父类分类编码 + */ + private String parentCategoryCode; + + /** + * 原始分类编码 + */ + private String originCategoryCode; + + /** + * 分类等级:1、2....;产品目前只有2级分类 + */ + private Integer level; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryService.java new file mode 100644 index 0000000000..7cea3ea62c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryService.java @@ -0,0 +1,105 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.screen; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.screen.ScreenProjectCategoryDTO; +import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryEntity; + +import java.util.List; +import java.util.Map; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-10 + */ +public interface ScreenProjectCategoryService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-11-10 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-11-10 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ScreenProjectCategoryDTO + * @author generator + * @date 2021-11-10 + */ + ScreenProjectCategoryDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-11-10 + */ + void save(ScreenProjectCategoryDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-11-10 + */ + void update(ScreenProjectCategoryDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-11-10 + */ + void delete(String[] ids); + + /** + * 删除项目分类 + * @Param customerId + * @Param projectIds + * @Return + * @Author zhaoqifeng + * @Date 2021/11/10 11:06 + */ + void deleteByProjectId(String customerId, List projectIds); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java index a29640a75b..845a2fc844 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java @@ -148,4 +148,13 @@ public interface ScreenProjectDataService extends BaseService + * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.screen.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.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryDao; +import com.epmet.dto.screen.ScreenProjectCategoryDTO; +import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryEntity; +import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryService; +import org.apache.commons.collections4.CollectionUtils; +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; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-10 + */ +@Service +public class ScreenProjectCategoryServiceImpl extends BaseServiceImpl implements ScreenProjectCategoryService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ScreenProjectCategoryDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ScreenProjectCategoryDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public ScreenProjectCategoryDTO get(String id) { + ScreenProjectCategoryEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ScreenProjectCategoryDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ScreenProjectCategoryDTO dto) { + ScreenProjectCategoryEntity entity = ConvertUtils.sourceToTarget(dto, ScreenProjectCategoryEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ScreenProjectCategoryDTO dto) { + ScreenProjectCategoryEntity entity = ConvertUtils.sourceToTarget(dto, ScreenProjectCategoryEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 删除项目分类 + * + * @param customerId + * @param projectIds + * @Param customerId + * @Param projectIds + * @Return + * @Author zhaoqifeng + * @Date 2021/11/10 11:06 + */ + @Override + public void deleteByProjectId(String customerId, List projectIds) { + if (CollectionUtils.isEmpty(projectIds)) { + return; + } + baseDao.deleteByProjectIds(customerId, projectIds); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java index f04234049e..047602128f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java @@ -17,6 +17,7 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.dynamic.datasource.annotation.DataSource; @@ -24,19 +25,26 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenProjectDataDao; import com.epmet.dao.evaluationindex.screen.ScreenProjectImgDataDao; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryEntity; import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenProjectImgDataEntity; +import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.send.SendMqMsgUtil; +import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryService; import com.epmet.service.evaluationindex.screen.ScreenProjectDataService; +import com.epmet.service.stats.CustomerProjectCategoryDictService; import com.github.pagehelper.PageHelper; import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.ArrayUtils; @@ -48,10 +56,8 @@ import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 中央区-项目数据 @@ -67,6 +73,12 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl page(Map params) { @@ -132,6 +144,7 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl projectList = new ArrayList<>(); param.getDataList().forEach(item -> { String projectStatusCode = item.getProjectStatusCode(); @@ -196,6 +209,7 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl { List list = ConvertUtils.sourceToTarget(part, ScreenProjectDataEntity.class); insertBatch(list); + saveCategory(customerId, list); }); } if(!CollectionUtils.isEmpty(orient)){ List> partition = ListUtils.partition(orient, NumConstant.ONE_HUNDRED); - partition.forEach(part -> baseDao.updateBatch(part,dateId)); + partition.forEach(part -> { + baseDao.updateBatch(part,dateId); + saveCategory(customerId, ConvertUtils.sourceToTarget(part, ScreenProjectDataEntity.class)); + }); } } @@ -306,4 +326,57 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(customerId), ScreenProjectDataEntity::getCustomerId, customerId); + List projectList = baseDao.selectList(wrapper); + saveCategory(customerId, projectList); + } + + private void saveCategory(String customerId, List projectList) { + + Result parentCustomer = operCrmOpenFeignClient.getExternalAndParentCustomerId(customerId); + //删除旧分类 + List projectIds = projectList.stream().map(ScreenProjectDataEntity::getProjectId).collect(Collectors.toList()); + screenProjectCategoryService.deleteByProjectId(customerId, projectIds); + //提取分类信息 + List projectCategoryList = new ArrayList<>(); + projectList.forEach(project -> { + //分类为空不作处理 + if (StringUtils.isNotBlank(project.getCategoryCode())) { + List categoryList = Arrays.asList(project.getCategoryCode().split(StrConstant.COMMA)); + categoryList.forEach(category -> { + ScreenProjectCategoryEntity entity = new ScreenProjectCategoryEntity(); + entity.setCustomerId(customerId); + entity.setProjectId(project.getProjectId()); + entity.setOriginCategoryCode(category); + CustomerProjectCategoryDictEntity categoryEntity = customerProjectCategoryDictService.getByCategoryCode(customerId, category); + if (null != categoryEntity) { + // + if ("external".equals(categoryEntity.getCustomerType())) { + entity.setCategoryCode(categoryEntity.getEpmetCategoryCode()); + CustomerProjectCategoryDictEntity parent = customerProjectCategoryDictService.getByCategoryCode(parentCustomer.getData(), categoryEntity.getEpmetCategoryCode()); + entity.setParentCategoryCode(parent.getParentCategoryCode()); + } else { + entity.setCategoryCode(categoryEntity.getCategoryCode()); + entity.setParentCategoryCode(categoryEntity.getParentCategoryCode()); + } + entity.setLevel(categoryEntity.getLevel()); + } + projectCategoryList.add(entity); + }); + } + }); + screenProjectCategoryService.insertBatch(projectCategoryList); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryDao.xml new file mode 100644 index 0000000000..afe80a6416 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryDao.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + delete from screen_project_category + where CUSTOMER_ID = #{customerId} + + PROJECT_ID = #{projectId} + + + + + \ No newline at end of file From ba9e395d87a691afecf4f2e17224e4033700b784 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 10 Nov 2021 17:05:49 +0800 Subject: [PATCH 06/39] emm,org --- .../GridAndOrgCategoryCountResultDTO.java | 5 ++ .../screen/ScreenCustomerAgencyDao.java | 10 +++ .../screen/ScreenProjectDataDao.java | 23 ++++++ ...ectCategoryGridAndOrgDailyServiceImpl.java | 70 +++++++++++++++++++ .../screen/ScreenCustomerAgencyDao.xml | 25 +++++++ .../screen/ScreenProjectDataDao.xml | 62 +++++++++++++++- 6 files changed, 193 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java index de4f1c8a58..f62e1c3d54 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java @@ -20,6 +20,11 @@ public class GridAndOrgCategoryCountResultDTO implements Serializable { */ private String orgId; + /** + * 组织类型 + */ + private String orgType; + /** * 网格ID */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index e6155e982e..84f989ddf9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -28,6 +28,7 @@ import com.epmet.dto.extract.result.OrgNameResultDTO; import com.epmet.dto.indexcal.AgencyAndParentResultDTO; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; +import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO; import com.epmet.dto.screen.result.TreeResultDTO; import com.epmet.dto.screencoll.form.CustomerAgencyFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; @@ -244,4 +245,13 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectByCustomerId(@Param("customerId") String customerId); + /** + * @Description 查询父子客户的组织【平阴】 + * @param customerIds 平阴,榆山,锦水的客户ID + * @param customerId 孔村的客户ID🤬 + * @author zxc + * @date 2021/11/10 2:52 下午 + */ + List selectParentSonAgency(@Param("customerIds") List customerIds ,@Param("customerId") String customerId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java index dd77e140c5..5a9155f237 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -70,7 +70,30 @@ public interface ScreenProjectDataDao extends BaseDao { List selectProjectList(@Param("customerId") String customerId, @Param("projectId") String projectId); + /** + * @Description 查询网格下的项目分类 + * @param customerIds 父子客户的customerId + * @param dateId 日期ID + * @param status 所有项目:all,已结案项目:closed + * @param customerId 父级客户ID + * @param subCount 分类截取位数 + * @author zxc + * @date 2021/11/10 3:12 下午 + */ List selectGridCategoryProjectCount(@Param("customerIds") List customerIds,@Param("dateId") String dateId, @Param("status")String status,@Param("customerId") String customerId, @Param("subCount")Integer subCount); + + /** + * @Description 查询组织下的项目分类 + * @param dateId 日期ID + * @param status 所有项目:all,已结案项目:closed + * @param customerId 父级客户ID + * @param subCount 分类截取位数 + * @author zxc + * @date 2021/11/10 3:14 下午 + */ + List selectOrgCategoryProjectCount(@Param("dateId") String dateId, @Param("status")String status, + @Param("customerId") String customerId, @Param("subCount")Integer subCount, + @Param("allAgencies") List allAgencies); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java index 9eb635ff4e..05070b22ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java @@ -5,16 +5,21 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.DataSourceConstant; +import com.epmet.constant.PingYinConstant; import com.epmet.constant.ProjectConstant; +import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao; import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao; import com.epmet.dao.evaluationindex.screen.ScreenProjectDataDao; +import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO; import com.epmet.entity.crm.CustomerRelationEntity; import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryGridDailyEntity; +import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity; import com.epmet.service.crm.CustomerRelationService; import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryGridAndOrgDailyService; import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryGridDailyService; +import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryOrgDailyService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; @@ -45,7 +50,11 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr @Autowired private ScreenProjectCategoryGridDailyService gridDailyService; @Autowired + private ScreenProjectCategoryOrgDailyService orgDailyService; + @Autowired private ScreenProjectCategoryOrgDailyDao orgDailyDao; + @Autowired + private ScreenCustomerAgencyDao screenCustomerAgencyDao; /** * @Description 分类下的项目数【grid】 @@ -110,6 +119,8 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr /** * @Description 分类下的项目数【org】 + * 项目分类来源 + * 本级【直接立项】 + 下级 + 直属网格 * @param customerId * @param dateId * @author zxc @@ -120,5 +131,64 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr List relationInfo = relationService.selectSubCustomer(customerId); List customerIds = new ArrayList<>(); customerIds.add(customerId); + List result = new ArrayList<>(); + if (CollectionUtils.isEmpty(relationInfo)){ + // one customer + List agencies = screenCustomerAgencyDao.selectAgencyByCustomer(customerId); + List allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class); + result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); + List closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); + result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal()))); + }else { + // more customers + // 去除孔村的客户ID,孔村镇的单独查😡 + List subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); + for (int i = NumConstant.ZERO; i < subCustomerIds.size(); i++) { + if (subCustomerIds.get(i).equals(PingYinConstant.KONG_CUN_CUSTOMER_ID)){ + customerIds.remove(i); + continue; + } + } + List allAgencies = screenCustomerAgencyDao.selectParentSonAgency(subCustomerIds, PingYinConstant.KONG_CUN_CUSTOMER_ID); + List> partition = ListUtils.partition(allAgencies, NumConstant.FIFTY); + List allOrgCategoryList = result; + partition.forEach(p -> { + List allOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p); + List closedOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p); + allOrgList.forEach(a -> closedOrgList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); + allOrgCategoryList.addAll(allOrgList); + }); + } + orgDel(customerId,dateId); + } + + /** + * @Description 项目分类组织删除 + * @param customerId + * @param dateId + * @author zxc + * @date 2021/11/10 4:58 下午 + */ + @Transactional(rollbackFor = Exception.class) + public void orgDel(String customerId,String dateId){ + Integer num = NumConstant.ZERO; + do { + num = orgDailyDao.deleteByDateIdAndCustomerId(customerId, dateId); + }while (num > NumConstant.ZERO && num == NumConstant.ONE_THOUSAND); + } + + /** + * @Description 项目分类组织插入 + * @param needInsert + * @author zxc + * @date 2021/11/10 5:03 下午 + */ + @Transactional(rollbackFor = Exception.class) + public void orgInsert(List needInsert){ + List> partition = ListUtils.partition(needInsert, NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + orgDailyService.insertBatch(ConvertUtils.sourceToTarget(p, ScreenProjectCategoryOrgDailyEntity.class)); + log.info("插入的组织项目分类为" + JSON.toJSONString(p)); + }); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 12ccf09ab0..df067fcab1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -505,4 +505,29 @@ AND customer_id = #{customerId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index 199776d15e..201ae4fada 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -270,6 +270,7 @@ a.CREATED_TIME ASC + + + + From e831116e39960ad97519ff0bc86cb8400a9f0473 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 10 Nov 2021 17:18:45 +0800 Subject: [PATCH 07/39] emm --- .../com/epmet/controller/DemoController.java | 24 +++++++++++++++++++ ...ProjectCategoryGridAndOrgDailyService.java | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 3d6182a217..98cfbaf838 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -1075,4 +1075,28 @@ public class DemoController { screenProjectDataService.extractCategory(formDTO.getCustomerId()); return new Result(); } + + @Autowired + private ScreenProjectCategoryGridAndOrgDailyService screenProjectCategoryGridAndOrgDailyService; + + @PostMapping("gridandorgdailynew") + public Result gridAndDaily(@RequestParam("customerId")String customerId,@RequestParam("dateId")String dateId, + @RequestParam(name = "startDate",required = false)String startDate, + @RequestParam(name = "endDate",required = false)String endDate + ){ + long start = System.currentTimeMillis(); + if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){ + List daysBetween = DateUtils.getDaysBetween(startDate, endDate); + daysBetween.forEach(d -> { + screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,d); + screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,d); + }); + }else { + screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,dateId); + screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,dateId); + } + long end = System.currentTimeMillis(); + long l = (end - start) / 1000; + return new Result().ok("gridAndOrgDaily耗时" + l+ "s"); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridAndOrgDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridAndOrgDailyService.java index 67a6077e34..9cdc9f3522 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridAndOrgDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridAndOrgDailyService.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; /** - * 项目(事件)分类按 组织——组织——按天统计 + * 项目(事件)分类按 网格——组织——按天统计 */ public interface ScreenProjectCategoryGridAndOrgDailyService { From 8f4a84103e75c8a3a969547671a8eb8c27139390 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 10 Nov 2021 17:23:53 +0800 Subject: [PATCH 08/39] =?UTF-8?q?=E5=B9=B3=E9=98=B4=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=8A=E6=8A=A5=20ALL=5FPARENT=5FIDS?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B9=B3=E9=98=B4=E7=9A=84=E7=BB=84=E7=BB=87?= =?UTF-8?q?ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/ScreenCustomerAgencyDao.java | 2 ++ .../screen/ScreenCustomerAgencyService.java | 9 +++++++++ .../impl/ScreenCustomerAgencyServiceImpl.java | 13 +++++++++++++ .../screen/impl/ScreenProjectDataServiceImpl.java | 7 +++++++ .../screen/ScreenCustomerAgencyDao.xml | 11 +++++++++++ 5 files changed, 42 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 84f989ddf9..619e9f2e67 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -254,4 +254,6 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectParentSonAgency(@Param("customerIds") List customerIds ,@Param("customerId") String customerId); + + String getParentAgencyId(@Param("agencyId") String agencyId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java index fcb81fc243..9a46990c1d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java @@ -155,4 +155,13 @@ public interface ScreenCustomerAgencyService extends BaseService getAgencyList(String customerId); + /** + * @Description 获取父级组织ID(外部客户) + * @Param agencyId + * @Return {@link String} + * @Author zhaoqifeng + * @Date 2021/11/10 17:00 + */ + String getParentAgencyId(String agencyId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java index 7f11df187a..e8f8f9bb39 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java @@ -335,4 +335,17 @@ public class ScreenCustomerAgencyServiceImpl extends BaseServiceImpl page(Map params) { @@ -208,6 +211,10 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl + + + From be8d2736eaf3a507e46565687520ec6fe965c87d Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 11 Nov 2021 13:35:31 +0800 Subject: [PATCH 15/39] emm --- .../mapper/evaluationindex/screen/ScreenProjectDataDao.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index c6a59a972d..a4fe50c84c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -354,7 +354,7 @@ WHERE pd.DEL_FLAG = '0' AND pc.level = 2 AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') #{dateId} - AND ALL_PARENT_IDS LIKE #{a.orgId} + AND ALL_PARENT_IDS LIKE CONCAT('%',#{a.orgId},'%') AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case') @@ -384,7 +384,7 @@ INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') WHERE pd.DEL_FLAG = '0' AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') #{dateId} - AND ALL_PARENT_IDS LIKE #{a.orgId} + AND ALL_PARENT_IDS LIKE CONCAT('%',#{a.orgId},'%') AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case') From 0d91d6b02d108d203f06f07d5a0ea56adb61568b Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 11 Nov 2021 14:25:03 +0800 Subject: [PATCH 16/39] emm --- ...eenProjectCategoryGridAndOrgDailyServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java index 53a3376dd8..352ccc9d76 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java @@ -138,9 +138,9 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr List allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class); result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); List oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); - if (CollectionUtils.isNotEmpty(oneLevelList)){ - result.addAll(oneLevelList); - } + List oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); + oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); + result.addAll(oneLevelList); List closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal()))); }else { @@ -159,9 +159,9 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr partition.forEach(p -> { List allOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p); List oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); - if (CollectionUtils.isNotEmpty(oneLevelList)){ - allOrgList.addAll(oneLevelList); - } + List oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); + oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); + allOrgList.addAll(oneLevelList); List closedOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p); allOrgList.forEach(a -> closedOrgList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); allOrgCategoryList.addAll(allOrgList); From 3abe15bcfe132da9f4cf193909c52dbc7527d3d7 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 11 Nov 2021 14:51:53 +0800 Subject: [PATCH 17/39] emm --- .../screen/impl/ScreenProjectServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index bc23641267..24cab9b221 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java @@ -245,6 +245,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { /** * @Description 【项目分类】查询项目分类 + * 二级分类总数占比改为 二级分类总数/一级分类总数 * @param formDTO * @param tokenDto * @author zxc @@ -325,6 +326,11 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { collect.forEach(c -> { c.setChildren(c.getChildren().stream().sorted(Comparator.comparing(ProjectCategoryResultDTO::getProjectTotal).reversed()).collect(Collectors.toList())); }); + collect.forEach(p -> { + p.getChildren().forEach(c -> { + c.setTotalRatio(ratio(c.getProjectTotal(), p.getProjectTotal())); + }); + }); return collect; } From bb86b7c8250d3c26eafcfcbab2b37837009c1803 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 12 Nov 2021 08:57:48 +0800 Subject: [PATCH 18/39] emm --- .../mapper/evaluationindex/screen/ScreenProjectDataDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index a4fe50c84c..775ee259cb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -373,7 +373,7 @@ #{a.pid} AS pid, #{a.pids} AS pids, #{a.orgType} AS orgType, - pc.`LEVEL`, + 1 AS level, COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal From 0946f63b45896acbb7b94ed70182777ee19b2706 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 12 Nov 2021 09:45:08 +0800 Subject: [PATCH 19/39] =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ectCategoryGridAndOrgDailyServiceImpl.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java index 352ccc9d76..4d531ddc90 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java @@ -65,6 +65,8 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr */ @Override public void extractCategoryProjectGridData(String customerId, String dateId) { + log.info("开始执行网格项目分类统计"); + long start = System.currentTimeMillis(); List relationInfo = relationService.selectSubCustomer(customerId); List customerIds = new ArrayList<>(); customerIds.add(customerId); @@ -81,10 +83,15 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.TWO); closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.TWO); } + log.info("网格-所有项目分类{}",allList); + log.info("网格-所有已关闭项目分类{}",closedList); List finalClosedList = closedList; allList.forEach(a -> finalClosedList.stream().filter(c -> c.getGridId().equals(a.getGridId()) && c.getCategoryCode().equals(a.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); gridDel(customerId,dateId); + log.info("网格-所有项目分类即将插入的集合{}",allList); gridInsert(allList); + long end = System.currentTimeMillis(); + log.info("网格项目分类统计结束,耗时:"+ (end-start/1000) + "s"); } /** @@ -128,6 +135,8 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr */ @Override public void extractCategoryProjectOrgData(String customerId, String dateId) { + log.info("开始执行组织项目分类统计"); + long start = System.currentTimeMillis(); List relationInfo = relationService.selectSubCustomer(customerId); List customerIds = new ArrayList<>(); customerIds.add(customerId); @@ -136,16 +145,22 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr // one customer List agencies = screenCustomerAgencyDao.selectAgencyByCustomer(customerId); List allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class); + log.info("客户下所有组织{}",allAgencies); result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); + log.info("组织2级项目{}",result); List oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); + log.info("1级组织所有项目{}",oneLevelList); List oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); + log.info("组织-1级已结案所有项目{}",oneLevelClosedList); oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); result.addAll(oneLevelList); List closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); + log.info("组织-2级已结案所有项目{}",oneLevelClosedList); result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal()))); }else { // more customers // 去除孔村的客户ID,孔村镇的单独查😡 + log.info("子级客户{}",relationInfo); List subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); for (int i = NumConstant.ZERO; i < subCustomerIds.size(); i++) { if (subCustomerIds.get(i).equals(PingYinConstant.KONG_CUN_CUSTOMER_ID)){ @@ -154,21 +169,30 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr } } List allAgencies = screenCustomerAgencyDao.selectParentSonAgency(subCustomerIds, PingYinConstant.KONG_CUN_CUSTOMER_ID); + log.info("父子关系所有组织{}",allAgencies); List> partition = ListUtils.partition(allAgencies, NumConstant.FIFTY); List allOrgCategoryList = result; + log.info("开始分批查询数据,每次50"); partition.forEach(p -> { List allOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p); + log.info("组织-2级项目分类{}",allOrgList); List oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); + log.info("组织-1级所有项目分类{}",oneLevelList); List oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); + log.info("组织-1级所有已结案项目分类{}",oneLevelClosedList); oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); allOrgList.addAll(oneLevelList); List closedOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p); + log.info("组织-2级已结案项目分类{}",closedOrgList); allOrgList.forEach(a -> closedOrgList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); allOrgCategoryList.addAll(allOrgList); }); } orgDel(customerId,dateId); + log.info("组织-即将插入的项目分类{}",result); orgInsert(result); + long end = System.currentTimeMillis(); + log.info("组织项目分类统计结束,耗时:"+ (end-start/1000) + "s"); } /** From fee2eb17579600a56b3e4c177c60cb1eabf69835 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 12 Nov 2021 10:15:03 +0800 Subject: [PATCH 20/39] emm --- .../screen/ScreenProjectDataDao.java | 2 +- ...jectCategoryGridAndOrgDailyServiceImpl.java | 14 ++++++++++---- .../screen/ScreenProjectDataDao.xml | 18 ++++++------------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java index e402f3268f..26aa8892d9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -80,7 +80,7 @@ public interface ScreenProjectDataDao extends BaseDao { * @author zxc * @date 2021/11/10 3:12 下午 */ - List selectGridCategoryProjectCount(@Param("customerIds") List customerIds,@Param("dateId") String dateId, + List selectGridCategoryProjectCount(@Param("dateId") String dateId,@Param("parentCustomerId") String parentCustomerId, @Param("status")String status,@Param("customerId") String customerId, @Param("subCount")Integer subCount); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java index 4d531ddc90..ebb9099071 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java @@ -74,14 +74,20 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr List closedList = new ArrayList<>(); if (CollectionUtils.isEmpty(relationInfo)){ // 单客户 - allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.FOUR); - closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.FOUR); + allList = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.FOUR); + closedList = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.FOUR); }else { // 多客户 List subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); customerIds.addAll(subCustomerIds); - allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.TWO); - closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.TWO); + List finalAllList = allList; + List finalClosedList1 = closedList; + customerIds.forEach(c -> { + List all = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_ALL, c, NumConstant.TWO); + finalAllList.addAll(all); + List closed = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_CLOSED, c, NumConstant.TWO); + finalClosedList1.addAll(closed); + }); } log.info("网格-所有项目分类{}",allList); log.info("网格-所有已关闭项目分类{}",closedList); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index 775ee259cb..8304142172 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -274,7 +274,7 @@ From 375503b885d2651dcd3df92a0ba22f19ca8b0671 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 12 Nov 2021 15:36:49 +0800 Subject: [PATCH 26/39] not null --- .../evaluationindex/screen/ScreenProjectDataDao.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index 8304142172..a15debd1c6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -287,7 +287,7 @@ COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal FROM screen_project_data pd - inner JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') + inner JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL) WHERE pd.DEL_FLAG = '0' AND pd.CUSTOMER_ID =#{customerId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') #{dateId} @@ -313,7 +313,7 @@ COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal FROM screen_project_data pd - INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') + INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL) WHERE pd.DEL_FLAG = '0' AND pd.CUSTOMER_ID = #{customerId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') #{dateId} @@ -344,7 +344,7 @@ COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal FROM screen_project_data pd - inner JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') + inner JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL) WHERE pd.DEL_FLAG = '0' AND pc.level = 2 AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') #{dateId} @@ -375,7 +375,7 @@ COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal FROM screen_project_data pd - INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0') + INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL) WHERE pd.DEL_FLAG = '0' AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') #{dateId} AND ALL_PARENT_IDS LIKE CONCAT('%',#{a.orgId},'%') From 96c734490c1753000b2106819367f975f96263eb Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 12 Nov 2021 15:43:46 +0800 Subject: [PATCH 27/39] shijian --- .../impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java index 93343327bd..5e82efba75 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java @@ -97,7 +97,7 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr log.info("网格-所有项目分类即将插入的集合{}",allList); gridInsert(allList); long end = System.currentTimeMillis(); - log.info("网格项目分类统计结束,耗时:"+ (end-start/1000) + "s"); + log.info("网格项目分类统计结束,耗时:"+ (end-start)/1000 + "s"); } /** @@ -205,7 +205,7 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr log.info("组织-即将插入的项目分类{}",result); orgInsert(result); long end = System.currentTimeMillis(); - log.info("组织项目分类统计结束,耗时:"+ (end-start/1000) + "s"); + log.info("组织项目分类统计结束,耗时:"+ (end-start)/1000 + "s"); } /** From d8f0da1bc9ce78c1b1066cb924e9ec70d1601c20 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 12 Nov 2021 16:17:11 +0800 Subject: [PATCH 28/39] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/screen/ScreenProjectDataDao.xml | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml index 8ca09bf5cb..370f73fdf8 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml @@ -162,28 +162,29 @@ From 885ec69e204aad2b65ffef82b782ed3cc7d80e16 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 12 Nov 2021 16:32:49 +0800 Subject: [PATCH 29/39] =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=B2=BE=E7=AE=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...jectCategoryGridAndOrgDailyServiceImpl.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java index 5e82efba75..b1eb748aef 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java @@ -89,12 +89,10 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr finalClosedList1.addAll(closed); }); } - log.info("网格-所有项目分类{}",allList); - log.info("网格-所有已关闭项目分类{}",closedList); List finalClosedList = closedList; allList.forEach(a -> finalClosedList.stream().filter(c -> c.getGridId().equals(a.getGridId()) && c.getCategoryCode().equals(a.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); gridDel(customerId,dateId); - log.info("网格-所有项目分类即将插入的集合{}",allList); + log.info("网格-所有项目分类即将插入的集合{}",JSON.toJSONString(allList)); gridInsert(allList); long end = System.currentTimeMillis(); log.info("网格项目分类统计结束,耗时:"+ (end-start)/1000 + "s"); @@ -151,26 +149,20 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr // one customer List agencies = screenCustomerAgencyDao.selectAgencyByCustomer(customerId); List allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class); - log.info("客户下所有组织{}",allAgencies); result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); - log.info("组织2级项目{}",result); List closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); - log.info("组织-2级已结案所有项目{}",closedList); result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal()))); List oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); - log.info("1级组织所有项目{}",oneLevelList); List oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies); - log.info("组织-1级已结案所有项目{}",oneLevelClosedList); oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); result.addAll(oneLevelList); }else { // more customers // 去除孔村的客户ID,孔村镇的单独查😡 - log.info("子级客户{}",relationInfo); List subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList()); for (int i = NumConstant.ZERO; i < subCustomerIds.size(); i++) { if (subCustomerIds.get(i).equals(PingYinConstant.KONG_CUN_CUSTOMER_ID)){ @@ -180,21 +172,15 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr } subCustomerIds.add(customerId); List allAgencies = screenCustomerAgencyDao.selectParentSonAgency(subCustomerIds, PingYinConstant.KONG_CUN_CUSTOMER_ID); - log.info("父子关系所有组织{}",allAgencies); List> partition = ListUtils.partition(allAgencies, NumConstant.FIFTY); List allOrgCategoryList = result; - log.info("开始分批查询数据,每次50"); partition.forEach(p -> { List allOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p); - log.info("组织-2级项目分类{}",allOrgList); List closedOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p); - log.info("组织-2级已结案项目分类{}",closedOrgList); allOrgList.forEach(a -> closedOrgList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); List oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p); - log.info("组织-1级所有项目分类{}",oneLevelList); List oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p); - log.info("组织-1级所有已结案项目分类{}",oneLevelClosedList); oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal()))); allOrgList.addAll(oneLevelList); @@ -202,7 +188,7 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr }); } orgDel(customerId,dateId); - log.info("组织-即将插入的项目分类{}",result); + log.info("组织-即将插入的项目分类{}",JSON.toJSONString(result)); orgInsert(result); long end = System.currentTimeMillis(); log.info("组织项目分类统计结束,耗时:"+ (end-start)/1000 + "s"); From 609055d2e9a01dc58782879e439e25e5cc8f3955 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 12 Nov 2021 16:34:41 +0800 Subject: [PATCH 30/39] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/redis/RedisKeys.java | 10 ++++++++++ .../java/com/epmet/controller/DemoController.java | 14 ++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 388927ce5a..2ac7d19f96 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -12,6 +12,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.utils.DateUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.T; /** * @author Mark sunlightcs@gmail.com @@ -559,4 +560,13 @@ public class RedisKeys { public static String blockedMqMsgKey(String blockedMsgLabel) { return rootPrefix.concat("message:mq:blocked:").concat(blockedMsgLabel); } + + /** + * desc:获取执行完毕的 业务 参数结果key + * @param bizMethod + * @return + */ + public static String getBackDoorbizExcuteResult(String bizMethod) { + return rootPrefix.concat("backdoor:").concat(bizMethod); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 98cfbaf838..e47ce1845e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -60,9 +62,7 @@ import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -73,7 +73,8 @@ import java.util.concurrent.Future; public class DemoController { @Autowired private StatsDemoService demoService; - + @Autowired + private RedisUtils redisUtils; @Autowired private ExecutorService executorService; @@ -1084,16 +1085,21 @@ public class DemoController { @RequestParam(name = "startDate",required = false)String startDate, @RequestParam(name = "endDate",required = false)String endDate ){ + long start = System.currentTimeMillis(); + Set result = new LinkedHashSet<>(); if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){ List daysBetween = DateUtils.getDaysBetween(startDate, endDate); daysBetween.forEach(d -> { screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,d); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,d); + result.add(d); + redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L); }); }else { screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,dateId); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,dateId); + redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L); } long end = System.currentTimeMillis(); long l = (end - start) / 1000; From 748a770d33182c960905ea1a35de61d9599805d6 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 12 Nov 2021 17:04:25 +0800 Subject: [PATCH 31/39] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/evaluationindex/screen/ScreenProjectDataDao.java | 2 +- .../evaluationindex/screen/impl/ScreenProjectServiceImpl.java | 2 +- .../src/main/resources/mapper/screen/ScreenProjectDataDao.xml | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java index 8c7ce5e97d..d20a3f1183 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -54,7 +54,7 @@ public interface ScreenProjectDataDao { * @author zxc * @date 2021/11/5 1:40 下午 */ - List selectCategoryProjectList(@Param("customerId") String customerId,@Param("orgId") String orgId, + List selectCategoryProjectList(@Param("orgId") String orgId, @Param("categoryCode")String categoryCode,@Param("status")String status, @Param("startTime")String startTime,@Param("endTime")String endTime); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index afbd2e9abe..8a149c37c3 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java @@ -382,7 +382,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { PageCategoryProjectListResultDTO result = new PageCategoryProjectListResultDTO(); List list; PageInfo objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) - .doSelectPageInfo(() -> screenProjectDataDao.selectCategoryProjectList(tokenDto.getCustomerId(), formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus(),formDTO.getStartTime(),formDTO.getEndTime())); + .doSelectPageInfo(() -> screenProjectDataDao.selectCategoryProjectList(formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus(),formDTO.getStartTime(),formDTO.getEndTime())); list = objectPageInfo.getList(); result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal()))); diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml index 370f73fdf8..b7f4bc79ca 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml @@ -180,7 +180,6 @@ AND CONCAT(pd.ALL_PARENT_IDS,':',pd.ORG_ID) LIKE CONCAT('%',#{orgId},'%') AND pc.CATEGORY_CODE LIKE CONCAT(#{categoryCode},'%') - AND pd.CUSTOMER_ID = #{customerId} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') #{endTime} AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') >= #{startTime} From 5e9e3e810e1e113a453490118a410074992bda5c Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 12 Nov 2021 17:32:35 +0800 Subject: [PATCH 32/39] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8F=90=E5=89=8D?= =?UTF-8?q?=E4=B8=80=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../evaluationindex/screen/impl/ScreenProjectServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index 8a149c37c3..214059f7d1 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.constant.FactConstant; @@ -253,6 +254,9 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { */ @Override public List selectProjectCategory(ProjectCategoryFormDTO formDTO, TokenDto tokenDto) { + if (StringUtils.isNotBlank(formDTO.getStartTime())){ + formDTO.setStartTime(DateUtils.getBeforeNDay(formDTO.getStartTime(),NumConstant.ONE)); + } if (StringUtils.isBlank(formDTO.getOrgId())){ CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); if (null == staffInfo){ From 2b32df2253a9945ca86950de8c5f234deded3acf Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 16 Nov 2021 16:33:16 +0800 Subject: [PATCH 33/39] =?UTF-8?q?screenDaily=E7=BB=9F=E8=AE=A1=E5=8A=A0?= =?UTF-8?q?=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/NumConstant.java | 2 + .../tools/distributedlock/LockConstants.java | 2 + .../impl/ScreenExtractServiceImpl.java | 269 +++++++++--------- 3 files changed, 145 insertions(+), 128 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 1281b269f4..9ba8e7a96a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -64,6 +64,8 @@ public interface NumConstant { long THREE_L = 3L; long FOUR_L = 4L; long MINUS_ONE_L = -1L; + long TEN_L = 10L; + long SIX_HUNDRED_L = 600L; String ZERO_STR = "0"; String ONE_STR = "1"; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/LockConstants.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/LockConstants.java index 3174a43a8e..a823816952 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/LockConstants.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/LockConstants.java @@ -9,4 +9,6 @@ public interface LockConstants { String TEST_LOCK_NAME = "testLock"; String STATS_LOCK_NAME = "stats"; + + String SCREEN_DAILY = "screenDaily"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index e5a348fbbf..f76adbe421 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -2,6 +2,8 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.distributedlock.LockConstants; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.HttpClientManager; @@ -20,6 +22,7 @@ import com.epmet.service.stats.DimCustomerService; import com.google.common.util.concurrent.ThreadFactoryBuilder; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.redisson.api.RLock; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -86,6 +89,8 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService; @Autowired private ScreenProjectCategoryGridAndOrgDailyService screenProjectCategoryGridAndOrgDailyService; + @Autowired + private DistributedLock distributedLock; /** * @param extractOriginFormDTO @@ -163,155 +168,163 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { * @date 2020/9/24 10:16 上午 */ public void extractDaily(String customerId, String dateId, boolean isLast) { - //等待3个线程执行完毕后再 继续执行下一个客户的 避免死锁 - final CountDownLatch latch = new CountDownLatch(NumConstant.FOUR); - threadPool.submit(() -> { - //党员基本情况screen_cpc_base_data - try { - partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId, dateId); - } catch (Exception e) { - log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - //先锋模范screen_pioneer_data - if (isLast) { + RLock lock = null; + try { + // 锁持有10分钟,等待10s + lock = distributedLock.getLock(LockConstants.SCREEN_DAILY, NumConstant.SIX_HUNDRED_L, NumConstant.TEN_L, TimeUnit.SECONDS); + //等待3个线程执行完毕后再 继续执行下一个客户的 避免死锁 + final CountDownLatch latch = new CountDownLatch(NumConstant.FOUR); + threadPool.submit(() -> { + //党员基本情况screen_cpc_base_data try { - pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId, dateId); } catch (Exception e) { - log.error("先锋模范【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + //先锋模范screen_pioneer_data + if (isLast) { + try { + pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } } + + latch.countDown(); + log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId); + }); + threadPool.submit(() -> { + //公众参与排行(注册人数、参与人数、话题数、议题数、项目数)screen_public_party_total_data try { - pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId, dateId); } catch (Exception e) { - log.error("先锋模范【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + if (isLast) { + //基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data + try { + ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO(); + param2.setCustomerId(customerId); + param2.setDateId(null); + log.info("【难点赌点数据上报开始------】 当前客户Id{}", param2.getCustomerId()); + //screenGrassrootsGovernDataAbsorptionService.difficultyDataHub(param); + + screenGrassrootsGovernDataAbsorptionService.difficultyDataExtract(param2); + log.info("【难点赌点数据上报结束------】 当前客户Id{}", param2.getCustomerId()); + } catch (Exception e) { + log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } } + latch.countDown(); + log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId); + }); + threadPool.submit(() -> { + ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); + param.setCustomerId(customerId); + param.setDateId(dateId); + //中央区 screen_user_total_data try { - pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + screenCentralZoneDataAbsorptionService.centralZoneDataHub(param); } catch (Exception e) { - log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + log.error("中央区抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); } - } - latch.countDown(); - log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId); - }); - threadPool.submit(() -> { - //公众参与排行(注册人数、参与人数、话题数、议题数、项目数)screen_public_party_total_data - try { - publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId, dateId); - } catch (Exception e) { - log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - if (isLast) { - //基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data try { - ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO(); - param2.setCustomerId(customerId); - param2.setDateId(null); - log.info("【难点赌点数据上报开始------】 当前客户Id{}", param2.getCustomerId()); - //screenGrassrootsGovernDataAbsorptionService.difficultyDataHub(param); - - screenGrassrootsGovernDataAbsorptionService.difficultyDataExtract(param2); - log.info("【难点赌点数据上报结束------】 当前客户Id{}", param2.getCustomerId()); + // 项目(事件)分析按网格_按天统计 + screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId); } catch (Exception e) { - log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + log.error("项目(事件)分析按网格_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + // 项目(事件)分析按组织_按天统计 + screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId); + } catch (Exception e) { + log.error("项目(事件)分析按组织_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); } - } - latch.countDown(); - log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId); - }); - threadPool.submit(() -> { - ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); - param.setCustomerId(customerId); - param.setDateId(dateId); - //中央区 screen_user_total_data - try { - screenCentralZoneDataAbsorptionService.centralZoneDataHub(param); - } catch (Exception e) { - log.error("中央区抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - - try { - // 项目(事件)分析按网格_按天统计 - screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId); - } catch (Exception e) { - log.error("项目(事件)分析按网格_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - // 项目(事件)分析按组织_按天统计 - screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId); - } catch (Exception e) { - log.error("项目(事件)分析按组织_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - //按天统计:网格内各个分类下的项目总数 - try { - screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId, dateId); - } catch (Exception e) { - log.error("按天统计:网格内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); - } + //按天统计:网格内各个分类下的项目总数 + try { + screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId, dateId); + } catch (Exception e) { + log.error("按天统计:网格内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); + } - // 按天统计:组织内各个分类下的项目总数 - try { - screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId, dateId); - } catch (Exception e) { - log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); - } - latch.countDown(); - log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}", dateId, customerId); - }); - threadPool.submit(() -> { - //治理能力排行screen_govern_rank_data - try { - governRankDataExtractService.extractGridDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractCommunityDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractStreetDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【街道】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractDistrictDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【全区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + // 按天统计:组织内各个分类下的项目总数 + try { + screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId, dateId); + } catch (Exception e) { + log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); + } + latch.countDown(); + log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}", dateId, customerId); + }); + threadPool.submit(() -> { + //治理能力排行screen_govern_rank_data + try { + governRankDataExtractService.extractGridDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractCommunityDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractStreetDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【街道】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractDistrictDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【全区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - ExtractFactGridGovernDailyFromDTO extractFactGridGovernDailyFromDTO = new ExtractFactGridGovernDailyFromDTO(); - extractFactGridGovernDailyFromDTO.setCustomerId(customerId); - extractFactGridGovernDailyFromDTO.setDateId(dateId); - factGridGovernDailyService.extractFactGridGovernDaily(extractFactGridGovernDailyFromDTO); - } catch (Exception e) { - log.error("治理指数-网格fact_grid_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + ExtractFactGridGovernDailyFromDTO extractFactGridGovernDailyFromDTO = new ExtractFactGridGovernDailyFromDTO(); + extractFactGridGovernDailyFromDTO.setCustomerId(customerId); + extractFactGridGovernDailyFromDTO.setDateId(dateId); + factGridGovernDailyService.extractFactGridGovernDaily(extractFactGridGovernDailyFromDTO); + } catch (Exception e) { + log.error("治理指数-网格fact_grid_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - factAgencyGovernDailyService.extractFactAgencyGovernDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + factAgencyGovernDailyService.extractFactAgencyGovernDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId); + } catch (Exception e) { + log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + extractPartData(customerId, dateId); + latch.countDown(); + log.info("extractDaily 4 thread run end ========= dateId:{},customerId:{}", dateId, customerId); + }); try { - factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId); - } catch (Exception e) { - log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + latch.await(); + } catch (InterruptedException e) { + log.error("extractDaily run exception", e); } - extractPartData(customerId, dateId); - latch.countDown(); - log.info("extractDaily 4 thread run end ========= dateId:{},customerId:{}", dateId, customerId); - }); - try { - latch.await(); - } catch (InterruptedException e) { - log.error("extractDaily run exception", e); + log.info("===== extractDaily method end customerId:{}======",customerId); + }finally { + lock.unlock(); } - log.info("===== extractDaily method end customerId:{}======",customerId); + } @Override From eedbf25a4f533a3f24eea29200dc97dc869c2b90 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 16 Nov 2021 20:49:16 +0800 Subject: [PATCH 34/39] =?UTF-8?q?=E9=87=8A=E6=94=BE=E8=AF=A5=E9=87=8A?= =?UTF-8?q?=E6=94=BE=E7=9A=84=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/toscreen/impl/ScreenExtractServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index f76adbe421..3b03d3768d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -321,8 +321,10 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { log.error("extractDaily run exception", e); } log.info("===== extractDaily method end customerId:{}======",customerId); - }finally { - lock.unlock(); + } catch (Exception e) { + log.error("extractDaily exception msg:{}", e); + } finally { + distributedLock.unLock(lock); } } From ee857c71a97507b0446f2892aaccc2b582f0651c Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 23 Nov 2021 09:32:54 +0800 Subject: [PATCH 35/39] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=8D=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java index b1eb748aef..fc1ed7cb21 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java @@ -148,6 +148,9 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr if (CollectionUtils.isEmpty(relationInfo)){ // one customer List agencies = screenCustomerAgencyDao.selectAgencyByCustomer(customerId); + if (CollectionUtils.isEmpty(agencies)){ + return; + } List allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class); result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies); From 17a41ad6697949098f6772fa4df00616f6b768ca Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Tue, 23 Nov 2021 10:24:54 +0800 Subject: [PATCH 36/39] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E7=9A=84=E6=B2=BB?= =?UTF-8?q?=E7=90=86=E6=8C=87=E6=95=B0=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/org/CustomerGridDao.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index e906015ad2..5b39b9e9a1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -88,6 +88,7 @@ WHERE CG.CUSTOMER_ID =#{customerId} and cg.del_flag='0' + AND cg.SYNC_FLAG = '1'