diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java index 2bb49d5c25..2f704b6b16 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java @@ -16,10 +16,7 @@ import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; import com.epmet.project.dto.result.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -134,13 +131,13 @@ public class ProjectController { * 002、项目分类字典查询 * 查询当前客户的父客户下,项目分类字典 * - * @param tokenDto + * @param customerId * @return com.epmet.commons.tools.utils.Result> * @Author zhangyong * @Date 10:41 2021-03-22 **/ @PostMapping("categorydict") - public Result> categoryDict(@LoginUser TokenDto tokenDto) { - return new Result>().ok(projectService.getCategoryDict(tokenDto)); + public Result> categoryDict(@RequestHeader("CustomerId") String customerId) { + return new Result>().ok(projectService.getCategoryDict(customerId)); } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java index bb2ffedd9c..917113fe12 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java @@ -74,10 +74,10 @@ public interface ProjectService { /** * 002、项目分类字典查询 * - * @param tokenDto + * @param customerId * @return java.util.List * @Author zhangyong * @Date 14:26 2021-03-22 **/ - List getCategoryDict(TokenDto tokenDto); + List getCategoryDict(String customerId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java index 4da82573c9..4d2df70470 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java @@ -358,12 +358,12 @@ public class ProjectServiceImpl implements ProjectService { } @Override - public List getCategoryDict(TokenDto tokenDto) { + public List getCategoryDict(String customerId) { List result = new ArrayList<>(); - Result parentCustomerId = operCrmOpenFeignClient.getExternalAndParentCustomerId(tokenDto.getCustomerId()); + Result parentCustomerId = operCrmOpenFeignClient.getExternalAndParentCustomerId(customerId); if (!parentCustomerId.success() && null == parentCustomerId.getData()) { logger.warn(String.format("调用%s服务查询外部客户的 父级客户ID 失败,入参%s", ServiceConstant.OPER_CRM_SERVER, - JSON.toJSONString(tokenDto.getCustomerId()))); + JSON.toJSONString(customerId))); return result; } CustomerCategoryDTO argDto = new CustomerCategoryDTO(); @@ -373,7 +373,7 @@ public class ProjectServiceImpl implements ProjectService { Result> parentCategoryDict = govIssueOpenFeignClient.getCustomerCategoryDict(argDto); if (!parentCategoryDict.success()) { logger.warn(String.format("调用%s服务查询当前客户的父客户下,项目分类字典失败,入参%s", ServiceConstant.GOV_ISSUE_SERVER, - JSON.toJSONString(tokenDto.getCustomerId()))); + JSON.toJSONString(customerId))); } else { result = parentCategoryDict.getData(); // 获取客户二级分类 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridDailyServiceImpl.java index 5901e47b35..3a8752e20e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridDailyServiceImpl.java @@ -144,6 +144,9 @@ public class ScreenProjectCategoryGridDailyServiceImpl extends BaseServiceImpl listDTO= factOriginProjectCategoryDailyService.selectListProjectCategoryGridDailyDTO(customerId); + listDTO.forEach(dto->{ + dto.setDateId(dateId); + }); boolean insertRes=insertBatch(ConvertUtils.sourceToTarget(listDTO, ScreenProjectCategoryGridDailyEntity.class)); log.info("insertRes is {}",insertRes); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml index 451acb81d5..7836274c05 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml @@ -43,7 +43,7 @@ SELECT c.CUSTOMER_ID, left(c.CATEGORY_CODE, 4) as CATEGORY_CODE, - c.`LEVEL`, + '1'as `LEVEL`, p.GRID_ID, p.AGENCY_ID AS PID, P.PIDS, diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 673a33aeb9..54a2ff009c 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -102,6 +102,12 @@ 2.0.0 compile + + com.epmet + oper-crm-client + 2.0.0 + compile + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java index 0a9a266b67..c4faa05e5d 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java @@ -30,10 +30,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IssueCategoryDao; import com.epmet.dao.IssueProjectCategoryDictDao; import com.epmet.dao.IssueProjectRelationDao; -import com.epmet.dto.IssueCategoryDTO; -import com.epmet.dto.IssueDTO; -import com.epmet.dto.IssueProjectCategoryDictDTO; -import com.epmet.dto.ProjectCategoryDTO; +import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.CustomerCategoryListResultDTO; import com.epmet.dto.result.ProjectCategoryDTOResultDTO; @@ -42,6 +39,7 @@ import com.epmet.dto.result.ProjectIssueDTOResultDTO; import com.epmet.entity.IssueProjectCategoryDictEntity; import com.epmet.entity.IssueProjectTagDictEntity; import com.epmet.feign.GovProjectOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; import com.epmet.redis.IssueProjectCategoryDictRedis; import com.epmet.service.IssueProjectCategoryDictService; @@ -76,11 +74,12 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl page(Map params) { @@ -199,21 +198,35 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl list = baseDao.selectCategoryListByCustomer(formDTO.getCustomerId()); - if (CollectionUtils.isEmpty(list)) { - //分类初始化 - List categoryList = baseDao.selectCategoryListByCustomer("default"); - categoryList.forEach(item -> { - item.setCustomerId(formDTO.getCustomerId()); - }); - this.insertBatch(categoryList); - //标签初始化 - List tagList = issueProjectTagDictService.getTagListByCustomer("default"); - tagList.forEach(item -> { - item.setCustomerId(formDTO.getCustomerId()); - }); - issueProjectTagDictService.insertBatch(tagList); + //2021.3.23 sun 不传客户Id时默认查询所有有效客户列表 循环添加 + List customerIdList = new ArrayList<>(); + if(StringUtils.isBlank(formDTO.getCustomerId())){ + Result> resultList = operCrmOpenFeignClient.getAllCustomerList(); + if(!resultList.success()){ + throw new RuntimeException("crm库获取有效客户列表失败!"); + } + customerIdList = resultList.getData().stream().map(cu->cu.getId()).collect(Collectors.toList()); + }else { + customerIdList.add(formDTO.getCustomerId()); } + //end sun + customerIdList.forEach(cu->{ + List list = baseDao.selectCategoryListByCustomer(cu); + if (CollectionUtils.isEmpty(list)) { + //分类初始化 + List categoryList = baseDao.selectCategoryListByCustomer("default"); + categoryList.forEach(item -> { + item.setCustomerId(cu); + }); + this.insertBatch(categoryList); + //标签初始化 + List tagList = issueProjectTagDictService.getTagListByCustomer("default"); + tagList.forEach(item -> { + item.setCustomerId(cu); + }); + issueProjectTagDictService.insertBatch(tagList); + } + }); } /** diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml index 7752ab2c35..20f8c5cfdd 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml @@ -46,10 +46,12 @@ ID, PID, PIDS, + PARENT_CATEGORY_CODE, CATEGORY_CODE, CATEGORY_NAME, CATEGORY_TYPE, - SORT + SORT, + IS_DISABLE FROM issue_project_category_dict WHERE diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml index ec80fe2af3..5988ddbbbd 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml @@ -77,7 +77,8 @@ CATEGORY_ID, IS_DEFAULT, ISSUE_USE_COUNT, - PROJECT_USE_COUNT + PROJECT_USE_COUNT, + IS_DISABLE FROM issue_project_tag_dict WHERE diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.8__del_category_tag_field.sql b/epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.9__del_category_tag_field.sql similarity index 100% rename from epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.8__del_category_tag_field.sql rename to epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.9__del_category_tag_field.sql