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-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..f62e1c3d54
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java
@@ -0,0 +1,74 @@
+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;
+
+ /**
+ * 组织类型
+ */
+ private String orgType;
+
+ /**
+ * 网格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/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml
index 7a0ae49569..0fc10e94cb 100644
--- a/epmet-module/data-statistical/data-statistical-server/pom.xml
+++ b/epmet-module/data-statistical/data-statistical-server/pom.xml
@@ -142,6 +142,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/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/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
index 6fefc845b6..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
@@ -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,34 @@ 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();
+ }
+
+ @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/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..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
@@ -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,15 @@ 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);
+
+
+ String getParentAgencyId(@Param("agencyId") String agencyId);
}
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/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..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
@@ -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,31 @@ 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);
+
+ /**
+ * @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/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/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 600786782c..e5a348fbbf 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
@@ -84,6 +84,8 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
private FactAgencyGovernDailyService factAgencyGovernDailyService;
@Autowired
private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService;
+ @Autowired
+ private ScreenProjectCategoryGridAndOrgDailyService screenProjectCategoryGridAndOrgDailyService;
/**
* @param extractOriginFormDTO
@@ -243,14 +245,14 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
//按天统计:网格内各个分类下的项目总数
try {
- projectCategoryGridDailyService.extractProjectCategoryData(customerId, dateId);
+ screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId, dateId);
} catch (Exception e) {
log.error("按天统计:网格内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e);
}
// 按天统计:组织内各个分类下的项目总数
try {
- projectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId, dateId);
+ screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId, dateId);
} catch (Exception e) {
log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e);
}
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/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..9cdc9f3522
--- /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/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 relationInfo = relationService.selectSubCustomer(customerId);
+ List customerIds = new ArrayList<>();
+ customerIds.add(customerId);
+ List allList = new ArrayList<>();
+ 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);
+ }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.getGridId().equals(a.getGridId()) && 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) {
+ 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);
+ orgInsert(result);
+ }
+
+ /**
+ * @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/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryServiceImpl.java
new file mode 100644
index 0000000000..b696efeeb3
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryServiceImpl.java
@@ -0,0 +1,119 @@
+/**
+ * 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.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..d5b114852a 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,27 @@ 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.ScreenCustomerAgencyService;
+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 +57,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 +74,14 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl page(Map params) {
@@ -132,6 +147,7 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl projectList = new ArrayList<>();
param.getDataList().forEach(item -> {
String projectStatusCode = item.getProjectStatusCode();
@@ -195,7 +211,12 @@ 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 +333,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/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
index 1772d2a0aa..f97f5b4946 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,5 +505,41 @@
del_flag = 0
AND customer_id = #{customerId}
+
+ SELECT
+ a.AGENCY_ID
+ FROM
+ screen_customer_agency a
+ INNER JOIN screen_customer_agency b ON a.AREA_CODE = b.PARENT_AREA_CODE
+ AND b.DEL_FLAG = '0'
+ AND b.AGENCY_ID = #{agencyId}
+ WHERE
+ a.DEL_FLAG = '0'
+
+
+
+
+ SELECT
+ AGENCY_ID AS orgId,
+ PID,
+ REPLACE(PIDS,',',':') AS pids,
+ `LEVEL` AS orgType
+ FROM screen_customer_agency
+ WHERE DEL_FLAG = '0'
+ AND CUSTOMER_ID IN
+
+ #{c}
+
+ UNION ALL
+ SELECT
+ AGENCY_ID AS orgId,
+ PID,
+ REPLACE(PIDS,',',':') AS pids,
+ CASE WHEN `LEVEL` = 'district' THEN 'street' ELSE `LEVEL` END AS orgType
+ FROM screen_customer_agency
+ WHERE DEL_FLAG = '0'
+ AND CUSTOMER_ID = #{customerId}
+ AND `LEVEL` != 'street'
+
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
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..2988342b64 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,120 @@
ORDER BY
a.CREATED_TIME ASC
+
+
+
+ SELECT
+ #{dateId} AS dateId,
+ #{customerId} AS customerId,
+ pc.CATEGORY_CODE,
+ pd.ORG_ID AS gridId,
+ pd.PARENT_ID AS pid,
+ pd.ALL_PARENT_IDS AS pids,
+ pc.`LEVEL`,
+
+ COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal
+
+
+ COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
+
+ FROM screen_project_data pd
+ LEFT JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0')
+ WHERE pd.DEL_FLAG = '0'
+ AND pd.CUSTOMER_ID IN
+
+ #{c}
+
+ AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') #{dateId}
+ AND pd.ORG_TYPE = 'grid'
+ AND pc.level = 2
+
+ AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
+
+ GROUP BY pd.ORG_ID,pc.CATEGORY_CODE
+ UNION ALL
+ SELECT
+ #{dateId} AS dateId,
+ #{customerId} AS customerId,
+ left(pc.CATEGORY_CODE, #{subCount}) AS categoryCode,
+ pd.ORG_ID AS gridId,
+ pd.PARENT_ID AS pid,
+ pd.ALL_PARENT_IDS AS pids,
+ 1 AS level,
+
+ COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal
+
+
+ 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')
+ WHERE pd.DEL_FLAG = '0'
+ AND pd.CUSTOMER_ID IN
+
+ #{c}
+
+ AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') #{dateId}
+ AND pd.ORG_TYPE = 'grid'
+
+ AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
+
+ GROUP BY pd.ORG_ID,categoryCode
+
+
+
+
+
+ SELECT
+ #{dateId} AS dateId,
+ #{customerId} AS customerId,
+ pc.CATEGORY_CODE,
+ #{a.orgId} AS orgId,
+ #{a.pid} AS pid,
+ #{a.pids} AS pids,
+ #{a.orgType} AS orgType,
+ pc.`LEVEL`,
+
+ COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal
+
+
+ COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
+
+ FROM screen_project_data pd
+ LEFT JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0')
+ 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 pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
+
+ GROUP BY pc.CATEGORY_CODE
+ UNION ALL
+ SELECT
+ #{dateId} AS dateId,
+ #{customerId} AS customerId,
+ left(pc.CATEGORY_CODE, #{subCount}) AS categoryCode,
+ #{a.orgId} AS orgId,
+ #{a.pid} AS pid,
+ #{a.pids} AS pids,
+ #{a.orgType} AS orgType,
+ pc.`LEVEL`,
+
+ COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal
+
+
+ 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')
+ WHERE pd.DEL_FLAG = '0'
+ AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') #{dateId}
+ AND ALL_PARENT_IDS LIKE #{a.orgId}
+
+ AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
+
+ GROUP BY categoryCode
+
+