ソースを参照

删除无用代码

tags/24080901
WendyYang 9ヶ月前
コミット
da70d8fa5e
72個のファイルの変更151行の追加4941行の削除
  1. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java
  2. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/TagUtil.java
  3. +0
    -84
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/DashboardController.java
  4. +7
    -39
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/StatisticsController.java
  5. +0
    -122
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java
  6. +0
    -74
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java
  7. +0
    -164
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardExpertManage.java
  8. +0
    -549
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java
  9. +0
    -301
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java
  10. +0
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java
  11. +0
    -195
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java
  12. +0
    -33
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/PerformanceStatisticsManage.java
  13. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ProjectCostStatisticsManage.java
  14. +0
    -19
      hz-pm-api/src/main/java/com/hz/pm/api/datascope/contants/DataScopeColumnConst.java
  15. +0
    -32
      hz-pm-api/src/main/java/com/hz/pm/api/datascope/contants/LambdaDataScopeTypeEnum.java
  16. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeEntity.java
  17. +0
    -14
      hz-pm-api/src/main/java/com/hz/pm/api/ding/constants/DingOrganizationContant.java
  18. +0
    -255
      hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java
  19. +0
    -446
      hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java
  20. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java
  21. +0
    -256
      hz-pm-api/src/main/java/com/hz/pm/api/ding/task/OrganizationBatchGetTask.java
  22. +5
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java
  23. +0
    -55
      hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertUserInfoAssembler.java
  24. +0
    -14
      hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java
  25. +0
    -27
      hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java
  26. +0
    -39
      hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java
  27. +0
    -78
      hz-pm-api/src/main/java/com/hz/pm/api/gov/entity/GovBusinessStrip.java
  28. +3
    -8
      hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java
  29. +5
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/irs/config/IrsSealPlatformProperties.java
  30. +0
    -52
      hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/ApplicationController.java
  31. +0
    -70
      hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java
  32. +0
    -396
      hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java
  33. +0
    -93
      hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/ProjectIrsManage.java
  34. +0
    -50
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProperties.java
  35. +27
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProps.java
  36. +18
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/organization/constant/ProcDefCont.java
  37. +0
    -13
      hz-pm-api/src/main/java/com/hz/pm/api/organization/constants/ProcDefContant.java
  38. +0
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/DingOrganizationController.java
  39. +3
    -10
      hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java
  40. +1
    -48
      hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java
  41. +0
    -47
      hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java
  42. +13
    -29
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java
  43. +29
    -117
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java
  44. +0
    -136
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/IrsManage.java
  45. +4
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseService.java
  46. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java
  47. +6
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java
  48. +0
    -61
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateEmployeeTask.java
  49. +0
    -14
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateOrganizationTask.java
  50. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java
  51. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java
  52. +1
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java
  53. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningProjectTask.java
  54. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java
  55. +0
    -475
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCollectionTask.java
  56. +0
    -250
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCoreBizTask.java
  57. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProvinceOrgTask.java
  58. +11
    -10
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/WorkNoticeFlowTask.java
  59. +0
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowUtil.java
  60. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java
  61. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/sys/convert/RegionConverter.java
  62. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/InitProcessManage.java
  63. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/OrgProcDefManage.java
  64. +1
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java
  65. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java
  66. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java
  67. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java
  68. +0
    -70
      hz-pm-api/src/main/resources/application-dev.yml
  69. +0
    -64
      hz-pm-api/src/main/resources/application-prod.yml
  70. +0
    -1
      hz-pm-api/src/test/java/com/hz/pm/api/irs/IrsTest.java
  71. +0
    -2
      hz-pm-api/src/test/java/com/hz/pm/api/organization/OrganizationTest.java
  72. +0
    -70
      hz-pm-api/src/test/resources/application-dev.yml

+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java ファイルの表示

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.sys.mapper.RoleMapper;
import com.hz.pm.api.sys.model.entity.Role;


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/common/util/TagUtil.java ファイルの表示

@@ -2,7 +2,6 @@ package com.hz.pm.api.common.util;

import cn.hutool.core.collection.CollUtil;
import com.hz.pm.api.expert.model.TagFieldInfo;
import org.apache.commons.collections4.CollectionUtils;

import java.util.Comparator;
import java.util.List;


+ 0
- 84
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/DashboardController.java ファイルの表示

@@ -1,84 +0,0 @@
package com.hz.pm.api.dashboard.controller;

import com.ningdatech.log.annotation.WebLog;
import com.hz.pm.api.dashboard.manage.CockpitStatsManage;
import com.hz.pm.api.dashboard.manage.DashboardProjectManage;
import com.hz.pm.api.dashboard.model.dto.CockpitStatsSaveDTO;
import com.hz.pm.api.dashboard.model.po.QueryYearPO;
import com.hz.pm.api.dashboard.model.vo.*;
import com.hz.pm.api.scheduler.task.CockpitStatsStatisticsTask;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.UnknownHostException;
import java.util.List;

/**
* @author liuxinxin
* @date 2023/8/2 上午10:36
*/

@RestController
@RequestMapping("/api/v1/dashboard")
@Validated
@RequiredArgsConstructor
@Api(value = "DashboardController", tags = "驾驶舱相关接口")
public class DashboardController {

private final DashboardProjectManage dashboardProjectManage;

private final CockpitStatsManage cockpitStatsManage;

private final CockpitStatsStatisticsTask cockpitStatsStatisticsTask;

@PostMapping("project-summary")
@ApiOperation("驾驶舱项目总览")
@WebLog("驾驶舱项目总览")
public DashboardProjectSummaryVO getProjectSummary(@Valid @RequestBody QueryYearPO queryYearPO) {
return dashboardProjectManage.getProjectSummary(queryYearPO);
}

@PostMapping("project-cnt-summary")
@ApiOperation("驾驶舱项目数量")
@WebLog("驾驶舱项目数量")
public DashboardProjectCntSummaryVO getProjectCntSummary(@Valid @RequestBody QueryYearPO queryYearPO) {
return dashboardProjectManage.getProjectCntSummary(queryYearPO);
}

@PostMapping("investment-summary")
@ApiOperation("驾驶舱投资金额")
@WebLog("驾驶舱投资金额")
public DashboardInvestmentSummaryVO getInvestmentSummary(@Valid @RequestBody QueryYearPO queryYearPO) {
return dashboardProjectManage.getInvestmentSummary(queryYearPO);
}

@GetMapping("/project-portrait/{projectCode}")
@ApiOperation("驾驶舱-项目画像接口")
public DashboardProjectProtraitVO getProjectPortrait(@PathVariable String projectCode) {
return dashboardProjectManage.getProjectPortrait(projectCode);
}

@GetMapping("cockpit-stats")
@ApiOperation("驾驶舱-统计数据接口")
public CockpitStatsVO getData(@RequestParam(required = false) String regionCode,
@RequestParam(required = false) Integer year) {
return cockpitStatsManage.getData(regionCode,year);
}

@GetMapping("cockpit-stats-start")
@ApiOperation("驾驶舱-统计数据接口 强制运行任务")
public String statsStart() throws UnknownHostException {
cockpitStatsStatisticsTask.doTask();
return "运行成功";
}

@PostMapping("cockpit-stats-save")
@ApiOperation("驾驶舱-统计数据接口 假数据保存")
public String statsSave(@RequestBody List<CockpitStatsSaveDTO> saves) {
cockpitStatsManage.save(saves);
return "保存成功";
}
}

+ 7
- 39
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/controller/StatisticsController.java ファイルの表示

@@ -1,7 +1,11 @@
package com.hz.pm.api.dashboard.controller;

import com.hz.pm.api.dashboard.manage.*;
import com.hz.pm.api.dashboard.model.vo.*;
import com.hz.pm.api.dashboard.manage.ExpertStatisticsManage;
import com.hz.pm.api.dashboard.manage.FundStatisticsManage;
import com.hz.pm.api.dashboard.manage.ProjectCostStatisticsManage;
import com.hz.pm.api.dashboard.model.vo.CostStatisticsVO;
import com.hz.pm.api.dashboard.model.vo.ExpertStatisticsVO;
import com.hz.pm.api.dashboard.model.vo.FundStatisticsVO;
import com.ningdatech.log.annotation.DataScopeQueryCheck;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -20,23 +24,13 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/api/v1/statistics")
@Validated
@RequiredArgsConstructor
@Api(value = "StatisticsController", tags = "统计")
@Api(tags = "统计")
public class StatisticsController {

private final FundStatisticsManage fundStatisticsManage;

private final ExpertStatisticsManage expertStatisticsManage;

private final MeetingStatisticsManage meetingStatisticsManage;

private final ProjectCostStatisticsManage costStatisticsManage;

private final EarlyWarningStatisticsManage earlyWarningStatisticsManage;

private final PerformanceStatisticsManage performanceStatisticsManage;

private final ProjectStatisticsManage projectStatisticsManage;

@DataScopeQueryCheck
@GetMapping("/fund")
@ApiOperation("项目资金统计")
@@ -52,37 +46,11 @@ public class StatisticsController {
}

@DataScopeQueryCheck
@GetMapping("/meeting")
@ApiOperation("评审会议统计")
public MeetingStatisticsVO meeting(@RequestParam(required = false) Integer year) {
return meetingStatisticsManage.statistics(year);
}

@DataScopeQueryCheck
@GetMapping("/project-cost")
@ApiOperation("项目成本统计")
public CostStatisticsVO projectCost() {
return costStatisticsManage.statistics();
}

@DataScopeQueryCheck
@GetMapping("/early-warning")
@ApiOperation("预警统计")
public EarlyWarningStatisticsVO earlyWarning(@RequestParam(required = false) Integer year) {
return earlyWarningStatisticsManage.statistics(year);
}

@DataScopeQueryCheck
@GetMapping("/performance")
@ApiOperation("绩效统计")
public PerformanceStatisticsVO performance(@RequestParam(required = false) Integer year) {
return performanceStatisticsManage.statistics(year);
}

@DataScopeQueryCheck
@GetMapping("/project")
@ApiOperation("项目统计")
public ProjectStatisticsVO project(@RequestParam(required = false) Integer year) {
return projectStatisticsManage.statistics(year);
}
}

+ 0
- 122
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java ファイルの表示

@@ -1,122 +0,0 @@
package com.hz.pm.api.dashboard.helper;

import cn.hutool.core.collection.CollUtil;
import com.hz.pm.api.dashboard.constant.ChartTypeEnum;
import com.hz.pm.api.dashboard.model.basic.AnalysisChart;
import com.hz.pm.api.dashboard.model.basic.AnalysisData;
import com.hz.pm.api.meta.helper.DictionaryCache;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
* @author liuxinxin
* @date 2023/8/4 下午2:36
*/

@Component
@RequiredArgsConstructor
public class DashboardChartAssembler {

private final DictionaryCache dictionaryCache;


public static AnalysisChart buildProjectStateAnalysisChart(Map<Integer, List<Project>> projectGroupMap, ChartTypeEnum chartTypeEnum) {
AnalysisChart analysisChart = new AnalysisChart();
List<AnalysisData> dataList = new ArrayList<>();
analysisChart.setChartType(chartTypeEnum);
analysisChart.setDataList(dataList);
for (Map.Entry<Integer, List<Project>> entry : projectGroupMap.entrySet()) {
AnalysisData analysisData = new AnalysisData();
String chartKey = ProjectStatusEnum.getDesc(entry.getKey());
analysisData.setKey(chartKey);
analysisData.setValue(CollUtil.size(entry.getValue()));
dataList.add(analysisData);
}
return analysisChart;
}

public static <T> AnalysisChart buildInvestmentAnalysisChart(Map<T, String> keyValueMap
, Map<T, List<Project>> projectGroupMap, ChartTypeEnum chartTypeEnum) {
AnalysisChart analysisChart = new AnalysisChart();
List<AnalysisData> dataList = new ArrayList<>();
analysisChart.setChartType(chartTypeEnum);
analysisChart.setDataList(dataList);
for (T key : keyValueMap.keySet()) {
AnalysisData analysisData = new AnalysisData();
String chartKey = keyValueMap.get(key);
List<Project> projectList = projectGroupMap.get(key);

BigDecimal approvedTotalInvestmentIncreaseSum = new BigDecimal("0");
if (CollUtil.isNotEmpty(projectList)) {
for (Project project : projectList) {
BigDecimal approvedTotalInvestmentIncrease = project.getApprovedTotalInvestmentIncrease();
if (Objects.nonNull(approvedTotalInvestmentIncrease)) {
approvedTotalInvestmentIncreaseSum.add(approvedTotalInvestmentIncrease);
}
}
}
analysisData.setKey(chartKey);
analysisData.setValue(approvedTotalInvestmentIncreaseSum);
dataList.add(analysisData);
}
return analysisChart;
}

public static <T> AnalysisChart buildAnalysisChart(Map<T, String> keyValueMap
, Map<T, List<Project>> projectGroupMap, ChartTypeEnum chartTypeEnum) {
AnalysisChart analysisChart = new AnalysisChart();
List<AnalysisData> dataList = new ArrayList<>();
analysisChart.setChartType(chartTypeEnum);
analysisChart.setDataList(dataList);
for (T key : keyValueMap.keySet()) {
AnalysisData analysisData = new AnalysisData();
String chartKey = keyValueMap.get(key);
List<Project> projectList = projectGroupMap.get(key);
analysisData.setKey(chartKey);
analysisData.setValue(CollUtil.isEmpty(projectList) ? 0 : projectList.size());
dataList.add(analysisData);
}
return analysisChart;
}

public static <T> AnalysisChart buildAnalysisChartString(Map<T, String> keyValueMap
, Map<String, List<Project>> projectGroupMap, ChartTypeEnum chartTypeEnum) {
AnalysisChart analysisChart = new AnalysisChart();
List<AnalysisData> dataList = new ArrayList<>();
analysisChart.setChartType(chartTypeEnum);
analysisChart.setDataList(dataList);
for (T key : keyValueMap.keySet()) {
AnalysisData analysisData = new AnalysisData();
String chartKey = keyValueMap.get(key);
List<Project> projectList = projectGroupMap.get(key);
analysisData.setKey(chartKey);
analysisData.setValue(CollUtil.isEmpty(projectList) ? 0 : projectList.size());
dataList.add(analysisData);
}
return analysisChart;
}

public <T> AnalysisChart assemblerAnalysisChart(Map<String, List<T>> dictionaryCodeIdMap
, ChartTypeEnum chartTypeEnum) {
AnalysisChart analysisChart = new AnalysisChart();
List<AnalysisData> dataList = new ArrayList<>();
analysisChart.setChartType(chartTypeEnum);
analysisChart.setDataList(dataList);

for (String dictionaryCode : dictionaryCodeIdMap.keySet()) {
AnalysisData analysisData = new AnalysisData();
analysisData.setKey(dictionaryCache.getByCode(dictionaryCode).get().getName());
analysisData.setValue(dictionaryCodeIdMap.get(dictionaryCode).size());
dataList.add(analysisData);
}
return analysisChart;
}
}

+ 0
- 74
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java ファイルの表示

@@ -1,74 +0,0 @@
package com.hz.pm.api.dashboard.helper;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.dashboard.constant.AnalysisBasicConstant;
import com.hz.pm.api.sys.model.entity.Region;
import com.hz.pm.api.sys.service.IRegionService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* @author liuxinxin
* @date 2023/8/3 下午3:13
*/

@Component
@RequiredArgsConstructor
public class DashboardHelper {

private final IRegionService iRegionService;

/**
* 获取丽水区域相关信息
*/
public Map<String, String> getLiShuiRegionCodeNameMap() {
List<Region> regionList = iRegionService.list(Wrappers.lambdaQuery(Region.class)
.eq(Region::getParentCode, AnalysisBasicConstant.LS_REGION_CODE));
return regionList.stream().collect(Collectors.toMap(Region::getRegionCode, Region::getRegionName));
}

/**
* 获取增补情况键值表
*/
public Map<Integer, String> getTemporaryAugmentMap() {
// 0:否 1:是
Map<Integer, String> map = new HashMap<>();
map.put(1, "增补项目");
map.put(0, "非增补项目");
return map;
}


/**
* 获取项目类型键值表
*/
public Map<Integer, String> getProjectTypeMap() {
// "项目类型 1:建设 2:运维
Map<Integer, String> map = new HashMap<>();
map.put(1, "建设");
map.put(2, "运维");
return map;
}

/**
* 获取项目类型键值表
*/
public Map<Integer, String> getBizDomainMap() {
// 综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治'
Map<Integer, String> map = new HashMap<>();
map.put(1, "党政机关整体智治");
map.put(2, "数字政府");
map.put(3, "数字经济");
map.put(4, "数字社会");
map.put(5, "数字文化");
map.put(6, "数字法治");
map.put(7, "一体化智能化公共数据平台");
map.put(8, "基层智治");
return map;
}
}

+ 0
- 164
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardExpertManage.java ファイルの表示

@@ -1,164 +0,0 @@
package com.hz.pm.api.dashboard.manage;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.dashboard.constant.ChartTypeEnum;
import com.hz.pm.api.dashboard.helper.DashboardChartAssembler;
import com.hz.pm.api.dashboard.helper.DashboardHelper;
import com.hz.pm.api.dashboard.model.basic.AnalysisChart;
import com.hz.pm.api.dashboard.model.basic.AnalysisData;
import com.hz.pm.api.dashboard.model.basic.StarExpertBO;
import com.hz.pm.api.dashboard.model.po.QueryYearPO;
import com.hz.pm.api.dashboard.model.vo.ExpertDashboardSummaryVO;
import com.hz.pm.api.expert.constant.ExpertUserInfoStepEnum;
import com.hz.pm.api.expert.entity.ExpertUserFullInfo;
import com.hz.pm.api.expert.service.IExpertUserFullInfoService;
import com.hz.pm.api.meeting.entity.domain.Meeting;
import com.hz.pm.api.meeting.entity.domain.MeetingExpertJudge;
import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum;
import com.hz.pm.api.meeting.service.IMeetingExpertJudgeService;
import com.hz.pm.api.meeting.service.IMeetingService;
import com.hz.pm.api.meta.constant.ExpertDictTypeEnum;
import com.hz.pm.api.meta.model.entity.ExpertDictionary;
import com.hz.pm.api.meta.service.IExpertDictionaryService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
* @author liuxinxin
* @date 2023/8/2 上午10:39
*/

@Component
@RequiredArgsConstructor
public class DashboardExpertManage {

private final DashboardHelper dashboardHelper;
private final IExpertUserFullInfoService iExpertUserFullInfoService;
private final IMeetingService iMeetingService;
private final IMeetingExpertJudgeService iMeetingExpertJudgeService;
private final IExpertDictionaryService iExpertDictionaryService;
private final DashboardChartAssembler dashboardChartAssembler;


public ExpertDashboardSummaryVO getExpertDashboardSummary(QueryYearPO queryYearPO) {
String queryRegionCode = queryYearPO.getRegionCode();
List<AnalysisChart> analysisChartList = new ArrayList<>();

// 获取丽水区域 code name Map
Map<String, String> liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap();
// 获取库内所有的专家列表
List<ExpertUserFullInfo> evidenceHasBeenSubmittedExpertInfoList = iExpertUserFullInfoService.list();

// 专家regionCode分组map列表
Map<String, List<ExpertUserFullInfo>> regionCodeExpertMap = Collections.emptyMap();

// 各区域专家数量
AnalysisChart regionExpertNumberChartAnalysisChart = new AnalysisChart();
List<AnalysisData> regionExpertNumberChartDataList = new ArrayList<>();
regionExpertNumberChartAnalysisChart.setChartType(ChartTypeEnum.REGION_EXPERT_NUMBER_CHART);
regionExpertNumberChartAnalysisChart.setDataList(regionExpertNumberChartDataList);
for (String regionCode : liShuiRegionCodeNameMap.keySet()) {
AnalysisData analysisData = new AnalysisData();
String regionName = liShuiRegionCodeNameMap.get(regionCode);
List<ExpertUserFullInfo> expertUserFullInfoList = regionCodeExpertMap.get(regionCode);
int expertCnt = 0;
if (CollectionUtil.isNotEmpty(expertUserFullInfoList)) {
expertCnt = expertUserFullInfoList.size();
}
analysisData.setKey(regionName);
analysisData.setValue(expertCnt);
regionExpertNumberChartDataList.add(analysisData);
}
analysisChartList.add(regionExpertNumberChartAnalysisChart);

// 查询区域的专家id 列表
List<Long> regionDegreeExpertIdList = new ArrayList<>();
if (StringUtils.isNotBlank(queryRegionCode)) {
List<ExpertUserFullInfo> expertUserFullInfoList = regionCodeExpertMap.get(queryRegionCode);
if (CollectionUtil.isNotEmpty(expertUserFullInfoList)) {
regionDegreeExpertIdList = expertUserFullInfoList.stream()
.map(ExpertUserFullInfo::getUserId)
.collect(Collectors.toList());
}
} else {
regionDegreeExpertIdList = evidenceHasBeenSubmittedExpertInfoList.stream()
.map(ExpertUserFullInfo::getUserId)
.collect(Collectors.toList());
}

if (CollectionUtil.isNotEmpty(regionDegreeExpertIdList)) {
// 区域学历分布
List<ExpertDictionary> degreeExpertDictionaryList = iExpertDictionaryService
.listByUserId(regionDegreeExpertIdList, ExpertDictTypeEnum.DEGREE);
Map<String, List<String>> degreeCodeMap = degreeExpertDictionaryList.stream()
.map(ExpertDictionary::getDictionaryCode)
.collect(Collectors.groupingBy(Function.identity()));
AnalysisChart regionExpertEducationChartAnalysisChart =
dashboardChartAssembler.assemblerAnalysisChart(degreeCodeMap, ChartTypeEnum.REGION_EXPERT_EDUCATION_CHART);
analysisChartList.add(regionExpertEducationChartAnalysisChart);

// 区域职称级别分布
List<ExpertDictionary> titleLevelExpertDictionaryList = iExpertDictionaryService
.listByUserId(regionDegreeExpertIdList, ExpertDictTypeEnum.TITLE_LEVEL);
Map<String, List<ExpertDictionary>> titleLevelCodeMap = titleLevelExpertDictionaryList.stream()
.collect(Collectors.groupingBy(ExpertDictionary::getDictionaryCode));
AnalysisChart regionExpertTitleLevelChartAnalysisChart =
dashboardChartAssembler.assemblerAnalysisChart(titleLevelCodeMap, ChartTypeEnum.REGION_EXPERT_TITLE_LEVEL_CHART);
analysisChartList.add(regionExpertTitleLevelChartAnalysisChart);
}

// 评审次数
List<Meeting> normalMeetingList = iMeetingService.list(Wrappers.lambdaQuery(Meeting.class)
.ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()));
Integer meetingCnt = normalMeetingList.size();

// 各类型评审次数
Map<String, List<Meeting>> meetingTypeMap = normalMeetingList.stream().collect(Collectors.groupingBy(Meeting::getType));
AnalysisChart meetingTypeCntChartAnalysisChart =
dashboardChartAssembler.assemblerAnalysisChart(meetingTypeMap, ChartTypeEnum.MEETING_TYPE_CNT_CHART);
analysisChartList.add(meetingTypeCntChartAnalysisChart);

// 明星专家列表
List<StarExpertBO> starExpertList = new ArrayList<>();
List<MeetingExpertJudge> meetingExpertJudgeList = iMeetingExpertJudgeService.list();
Map<Long, List<MeetingExpertJudge>> expertIdMeetingExpertJudgeMap = meetingExpertJudgeList.stream()
.collect(Collectors.groupingBy(MeetingExpertJudge::getExpertId));
Map<Long, String> expertIdExpertNameMap = evidenceHasBeenSubmittedExpertInfoList.stream()
.collect(Collectors.toMap(ExpertUserFullInfo::getUserId, ExpertUserFullInfo::getExpertName));

for (Long expertId : expertIdMeetingExpertJudgeMap.keySet()) {
String expertName = expertIdExpertNameMap.get(expertId);
List<MeetingExpertJudge> expertMeetingExpertJudgeList = expertIdMeetingExpertJudgeMap.get(expertId);
DoubleSummaryStatistics statistics = expertMeetingExpertJudgeList
.stream().filter(r -> Objects.nonNull(r.getScore()))
.map(MeetingExpertJudge::getScore).mapToDouble(Number::doubleValue).summaryStatistics();
double average = statistics.getAverage();
StarExpertBO starExpertBO = new StarExpertBO();
starExpertBO.setAveragePerformanceScore(average);
starExpertBO.setExpertId(expertId);
starExpertBO.setExpertName(expertName);
starExpertList.add(starExpertBO);
}
starExpertList = starExpertList.stream()
.sorted(Comparator.comparing(StarExpertBO::getAveragePerformanceScore)
.reversed()).collect(Collectors.toList());
if (starExpertList.size() > 5) {
starExpertList = starExpertList.subList(0, 5);
}

// 装配返回类
ExpertDashboardSummaryVO expertDashboardSummaryVO = new ExpertDashboardSummaryVO();
expertDashboardSummaryVO.setMeetingCnt(meetingCnt);
expertDashboardSummaryVO.setStarExpertList(starExpertList);
expertDashboardSummaryVO.setAnalysisChartList(analysisChartList);
return expertDashboardSummaryVO;
}

}


+ 0
- 549
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java ファイルの表示

@@ -1,549 +0,0 @@
package com.hz.pm.api.dashboard.manage;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.dashboard.constant.ChartTypeEnum;
import com.hz.pm.api.dashboard.constant.DashboardConstant.Protrait;
import com.hz.pm.api.dashboard.handle.ApplicationHandler;
import com.hz.pm.api.dashboard.handle.ProjectStatusHandler;
import com.hz.pm.api.dashboard.helper.DashboardChartAssembler;
import com.hz.pm.api.dashboard.helper.DashboardHelper;
import com.hz.pm.api.dashboard.model.basic.AnalysisChart;
import com.hz.pm.api.dashboard.model.basic.CompanyProjectCntBO;
import com.hz.pm.api.dashboard.model.basic.ProjectATIISBO;
import com.hz.pm.api.dashboard.model.po.QueryYearPO;
import com.hz.pm.api.dashboard.model.vo.*;
import com.hz.pm.api.gov.model.entity.GovBizProjectApply;
import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo;
import com.hz.pm.api.gov.model.entity.GovOperationProjectBaseinfo;
import com.hz.pm.api.gov.service.IGovBizProjectApplyService;
import com.hz.pm.api.gov.service.IGovBizProjectBaseinfoService;
import com.hz.pm.api.gov.service.IGovOperationProjectBaseinfoService;
import com.hz.pm.api.portrait.service.IProjectTagService;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.service.IPurchaseService;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply;
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.service.INdProjectDelayApplyService;
import com.hz.pm.api.projectlib.service.IProjectService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
import java.util.stream.Collectors;

/**
* @author liuxinxin
* @date 2023/8/2 上午10:39
*/

@Component
@RequiredArgsConstructor
public class DashboardProjectManage {

private final IProjectService iProjectService;

private final IGovBizProjectBaseinfoService baseinfoService;

private final IGovBizProjectApplyService applyService;


private final IGovOperationProjectBaseinfoService operationBaseService;
private final INdProjectDelayApplyService iProjectDelayApplyService;
private final DashboardHelper dashboardHelper;
private final IPurchaseService iPurchaseService;

private final ProjectStatusHandler statusHandler;

private final IProjectTagService projectTagService;

private final ApplicationHandler applicationHandler;

public DashboardProjectSummaryVO getProjectSummary(QueryYearPO queryYearPO) {
// 预算年度
Integer year = queryYearPO.getYear();
String regionCode = queryYearPO.getRegionCode();
List<Project> allProjectWithRepeatList = iProjectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Objects.nonNull(year), Project::getProjectYear, year)
.eq(StringUtils.isNotBlank(regionCode), Project::getAreaCode, regionCode)
);
List<Project> allProjectList = allProjectWithRepeatList.stream()
.filter(r -> r.getNewest()).collect(Collectors.toList());

List<Long> allProjectIdWithRepeatList = allProjectWithRepeatList.stream().map(Project::getId).collect(Collectors.toList());

// 项目总数
Integer projectCnt = allProjectList.size();

// 待立项项目数
List<Project> toBeApprovedProjectList = allProjectList.stream()
.filter(r -> ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(r.getStatus()))
.collect(Collectors.toList());
Integer toBeApprovedProjectCnt = toBeApprovedProjectList.size();

// 已立项项目数
Integer approvedProjectCnt = projectCnt - toBeApprovedProjectCnt;

// 项目立项率
Double projectApprovalRate = BigDecimal.valueOf((float) approvedProjectCnt / projectCnt).setScale(2, RoundingMode.HALF_UP).doubleValue();

// 项目申报总金额
List<BigDecimal> declareAmountList = allProjectList.stream().map(Project::getDeclareAmount)
.filter(Objects::nonNull).
collect(Collectors.toList());
BigDecimal declareAmountSum = new BigDecimal("0");
for (BigDecimal declareAmount : declareAmountList) {
declareAmountSum.add(declareAmount);
}

// 项目批复总金额
List<BigDecimal> approvedTotalInvestmentIncreaseList = allProjectList.stream().map(Project::getApprovedTotalInvestmentIncrease)
.filter(Objects::nonNull)
.collect(Collectors.toList());
BigDecimal approvedTotalInvestmentIncreaseSum = new BigDecimal("0");
for (BigDecimal approvedTotalInvestmentIncrease : approvedTotalInvestmentIncreaseList) {
approvedTotalInvestmentIncreaseSum.add(approvedTotalInvestmentIncrease);
}

// 资金核定率
BigDecimal fundApprovalRate = new BigDecimal("0");
if (new BigDecimal("0").compareTo(approvedTotalInvestmentIncreaseSum) != 0) {
fundApprovalRate = declareAmountSum.divide(approvedTotalInvestmentIncreaseSum, 2, RoundingMode.HALF_UP);
}


// 项目采购总金额
BigDecimal projectProcurementTotalAmount = new BigDecimal("0");
List<Purchase> purchaseList = iPurchaseService.list(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, allProjectIdWithRepeatList));
for (Purchase purchase : purchaseList) {
BigDecimal transactionAmount = purchase.getTransactionAmount();
if (Objects.nonNull(transactionAmount)) {
projectProcurementTotalAmount.add(transactionAmount);
}
}

// 项目画像

// 延期项目数 延期占比
List<ProjectDelayApply> projectDelayApplyList = iProjectDelayApplyService
.list(Wrappers.lambdaQuery(ProjectDelayApply.class)
.in(ProjectDelayApply::getProjectId, allProjectIdWithRepeatList));
Map<Long, List<ProjectDelayApply>> projectDelayApplyListMap = projectDelayApplyList.stream().collect(Collectors.groupingBy(ProjectDelayApply::getProjectId));
Integer delayProjectCnt = projectDelayApplyListMap.keySet().size();
Double delayProportion = BigDecimal.valueOf((float) delayProjectCnt / projectCnt).setScale(2, RoundingMode.HALF_UP).doubleValue();

// 项目变更数量 项目变更金额
List<Project> changedProjectList = new ArrayList<>();
Map<String, List<Project>> allProjectMap = allProjectWithRepeatList.stream().collect(Collectors.groupingBy(Project::getProjectCode));
for (String projectCode : allProjectMap.keySet()) {
List<Project> projectList = allProjectMap.get(projectCode);
Project newestProject = projectList.stream()
.filter(Project::getNewest)
.collect(Collectors.toList()).get(0);
boolean isChanged = false;
for (Project project : projectList) {
Boolean newest = project.getNewest();
boolean isBackReject = project.getIsBackReject();
if (!newest && isBackReject) {
isChanged = true;
break;
}
}
if (isChanged) {
changedProjectList.add(newestProject);
}
}
Integer changedProjectCnt = changedProjectList.size();

// 项目变更金额
BigDecimal changedProjectContractAmountSum = new BigDecimal("0");
for (Project project : changedProjectList) {
BigDecimal contractAmount = project.getContractAmount();
if (Objects.nonNull(contractAmount)) {
changedProjectContractAmountSum.add(contractAmount);
}
}

// 装配返回VO
DashboardProjectSummaryVO dashboardProjectSummaryVO = new DashboardProjectSummaryVO();
dashboardProjectSummaryVO.setProjectCnt(projectCnt);
dashboardProjectSummaryVO.setApprovedProjectCnt(approvedProjectCnt);
dashboardProjectSummaryVO.setToBeApprovedProjectCnt(toBeApprovedProjectCnt);
dashboardProjectSummaryVO.setProjectApprovalRate(projectApprovalRate);
dashboardProjectSummaryVO.setDeclareAmountSum(declareAmountSum);
dashboardProjectSummaryVO.setApprovedTotalInvestmentIncreaseSum(approvedTotalInvestmentIncreaseSum);

dashboardProjectSummaryVO.setDelayProjectCnt(delayProjectCnt);
dashboardProjectSummaryVO.setDelayProportion(delayProportion);
dashboardProjectSummaryVO.setChangedProjectCnt(changedProjectCnt);
dashboardProjectSummaryVO.setChangedProjectContractAmountSum(changedProjectContractAmountSum);
dashboardProjectSummaryVO.setFundApprovalRate(fundApprovalRate);
return dashboardProjectSummaryVO;
}

public DashboardProjectCntSummaryVO getProjectCntSummary(QueryYearPO req) {
// 预算年度
Integer year = req.getYear();
List<Project> allProjectList = iProjectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, true)
.eq(Objects.nonNull(year), Project::getProjectYear, year));

// 单位项目数量TOP5
List<CompanyProjectCntBO> companyProjectCntTop5List = new ArrayList<>();
Map<String, List<Project>> buildOrgNameProjectGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getBuildOrgName));
for (String buildOrgName : buildOrgNameProjectGroupMap.keySet()) {
List<Project> projectList = buildOrgNameProjectGroupMap.get(buildOrgName);
CompanyProjectCntBO companyProjectCntBO = new CompanyProjectCntBO();
companyProjectCntBO.setBuildOrgName(buildOrgName);
companyProjectCntBO.setProjectCnt(projectList.size());
companyProjectCntTop5List.add(companyProjectCntBO);
}
companyProjectCntTop5List.sort(Comparator.comparing(CompanyProjectCntBO::getProjectCnt).reversed());
if (companyProjectCntTop5List.size() > 5) {
companyProjectCntTop5List = companyProjectCntTop5List.subList(0, 5);
}

// 项目增补情况
Map<Integer, List<Project>> isTemporaryAugmentGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getIsTemporaryAugment));
Map<Integer, String> temporaryAugmentMap = dashboardHelper.getTemporaryAugmentMap();
AnalysisChart isTemporaryAugmentAnalysisChart = DashboardChartAssembler.buildAnalysisChart(temporaryAugmentMap, isTemporaryAugmentGroupMap
, ChartTypeEnum.PROJECT_SUPPLEMENTATION_STATUS_CHART);

// 各类型项目数量
Map<String, List<Project>> projectTypeGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getProjectType));
Map<Integer, String> projectTypeMap = dashboardHelper.getTemporaryAugmentMap();
AnalysisChart projectTypeAnalysisChart = DashboardChartAssembler.buildAnalysisChartString(projectTypeMap, projectTypeGroupMap
, ChartTypeEnum.EACH_TYPE_QUANTITY_OF_PROJECT_CHART);

// 各区域项目数量
Map<String, List<Project>> areaCodeGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getAreaCode));
Map<String, String> liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap();
AnalysisChart areaCodeAnalysisChart = DashboardChartAssembler.buildAnalysisChart(liShuiRegionCodeNameMap, areaCodeGroupMap
, ChartTypeEnum.PROJECTS_NUMBER_IN_EACH_REGION_CHART);

// 各领域项目数量
Map<Integer, List<Project>> bizDomainGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getBizDomain));
Map<Integer, String> bizDomainMap = dashboardHelper.getBizDomainMap();
AnalysisChart bizDomainAnalysisChart = DashboardChartAssembler.buildAnalysisChart(bizDomainMap, bizDomainGroupMap
, ChartTypeEnum.PROJECTS_NUMBER_IN_VARIOUS_FIELDS_CHART);

// 各阶段项目数量
Map<Integer, List<Project>> projectStateGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getStage));
AnalysisChart projectStateAnalysisChart = DashboardChartAssembler
.buildProjectStateAnalysisChart(projectStateGroupMap, ChartTypeEnum.PROJECTS_NUMBER_IN_EACH_STAGE_CHART);

DashboardProjectCntSummaryVO dashboardProjectCntSummaryVO = new DashboardProjectCntSummaryVO();
dashboardProjectCntSummaryVO.setCompanyProjectCntTop5List(companyProjectCntTop5List);
List<AnalysisChart> analysisChartList = new ArrayList<>();
dashboardProjectCntSummaryVO.setAnalysisChartList(analysisChartList);
analysisChartList.add(isTemporaryAugmentAnalysisChart);
analysisChartList.add(projectTypeAnalysisChart);
analysisChartList.add(bizDomainAnalysisChart);
analysisChartList.add(areaCodeAnalysisChart);
analysisChartList.add(projectStateAnalysisChart);
return dashboardProjectCntSummaryVO;
}


public DashboardInvestmentSummaryVO getInvestmentSummary(QueryYearPO req) {
// 预算年度
Integer year = req.getYear();
String regionCode = req.getRegionCode();
List<Project> allProjectList = iProjectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, true)
.eq(Objects.nonNull(year), Project::getProjectYear, year)
.eq(StringUtils.isNotBlank(regionCode), Project::getAreaCode, regionCode)
);

// 项目预算TOP5
List<ProjectATIISBO> projectATIISTop5List = allProjectList.stream().filter(r -> Objects.nonNull(r.getApprovedTotalInvestmentIncrease()))
.map(r -> {
ProjectATIISBO projectATIISBO = new ProjectATIISBO();
projectATIISBO.setProjectId(r.getId());
projectATIISBO.setProjectCode(r.getProjectCode());
projectATIISBO.setProjectName(r.getProjectName());
projectATIISBO.setApprovedTotalInvestmentIncrease(r.getApprovedTotalInvestmentIncrease());
return projectATIISBO;
}).collect(Collectors.toList());
projectATIISTop5List.sort(Comparator.comparing(ProjectATIISBO::getApprovedTotalInvestmentIncrease));
if (projectATIISTop5List.size() > 5) {
projectATIISTop5List = projectATIISTop5List.subList(0, 5);
}

// 单位预算TOP5
List<CompanyProjectCntBO> companyProjectATIISTop5List = new ArrayList<>();
Map<String, List<Project>> buildOrgNameProjectGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getBuildOrgName));
for (String buildOrgName : buildOrgNameProjectGroupMap.keySet()) {
List<Project> projectList = buildOrgNameProjectGroupMap.get(buildOrgName);
CompanyProjectCntBO companyProjectCntBO = new CompanyProjectCntBO();
companyProjectCntBO.setBuildOrgName(buildOrgName);
BigDecimal approvedTotalInvestmentIncreaseSum = new BigDecimal("0");
for (Project project : projectList) {
BigDecimal approvedTotalInvestmentIncrease = project.getApprovedTotalInvestmentIncrease();
if (Objects.nonNull(approvedTotalInvestmentIncrease)) {
approvedTotalInvestmentIncreaseSum.add(approvedTotalInvestmentIncrease);
}
}
companyProjectCntBO.setApprovedTotalInvestmentIncreaseSum(approvedTotalInvestmentIncreaseSum);
companyProjectATIISTop5List.add(companyProjectCntBO);
}
companyProjectATIISTop5List.sort(Comparator.comparing(CompanyProjectCntBO::getApprovedTotalInvestmentIncreaseSum).reversed());
if (companyProjectATIISTop5List.size() > 5) {
companyProjectATIISTop5List = companyProjectATIISTop5List.subList(0, 5);
}

// 各领域项目投资情况
Map<Integer, List<Project>> bizDomainGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getBizDomain));
Map<Integer, String> bizDomainMap = dashboardHelper.getBizDomainMap();
AnalysisChart bizDomainInvestmentAnalysisChart = DashboardChartAssembler.buildInvestmentAnalysisChart(bizDomainMap, bizDomainGroupMap
, ChartTypeEnum.PROJECTS_INVESTMENT_AMOUNT_IN_VARIOUS_FIELDS_CHART);

// 各区域项目投资情况
Map<String, List<Project>> areaCodeGroupMap = allProjectList.stream()
.collect(Collectors.groupingBy(Project::getAreaCode));
Map<String, String> liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap();
AnalysisChart areaCodeInvestmentAnalysisChart = DashboardChartAssembler.buildInvestmentAnalysisChart(liShuiRegionCodeNameMap, areaCodeGroupMap
, ChartTypeEnum.PROJECTS_INVESTMENT_SITUATION_IN_VARIOUS_REGIONS);

DashboardInvestmentSummaryVO dashboardInvestmentSummaryVO = new DashboardInvestmentSummaryVO();
dashboardInvestmentSummaryVO.setCompanyProjectATIISTop5List(companyProjectATIISTop5List);
dashboardInvestmentSummaryVO.setProjectATIISTop5List(projectATIISTop5List);
List<AnalysisChart> analysisChartList = new ArrayList<>();
dashboardInvestmentSummaryVO.setAnalysisChartList(analysisChartList);
analysisChartList.add(areaCodeInvestmentAnalysisChart);
analysisChartList.add(bizDomainInvestmentAnalysisChart);
return dashboardInvestmentSummaryVO;
}

/**
* 驾驶舱-项目画像
*
* @param projectCode
* @return
*/
public DashboardProjectProtraitVO getProjectPortrait(String projectCode) {
DashboardProjectProtraitVO res = new DashboardProjectProtraitVO();
//1.先查询项目
Project project = iProjectService.getProjectByCode(projectCode);

GovBizProjectBaseinfo baseInfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjId, projectCode)
.last(BizConst.LIMIT_1));

GovOperationProjectBaseinfo operationBase = operationBaseService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class)
.eq(GovOperationProjectBaseinfo::getBaseProjId, projectCode)
.last(BizConst.LIMIT_1));

GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId, projectCode)
.last(BizConst.LIMIT_1));

if (Objects.isNull(project) && Objects.isNull(baseInfo) && Objects.isNull(operationBase)) {
return res;
}

//2.转换项目信息
if (Objects.nonNull(project)) {
ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project, ProtraitProjectInfoVO.class);
projectInfo.setOverdueSituation("即将超期");
projectInfo.setSafetyInputRate(convertSafetyInputRate(project));
projectInfo.setStatus(Objects.nonNull(project.getStatus()) ? project.getStatus().toString() : null);
//3.项目状态情况
projectInfo.setStatusSituation(genProjectStatus(project));
res.setProjectInfo(projectInfo);
} else if (Objects.nonNull(baseInfo)) {
ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(baseInfo, ProtraitProjectInfoVO.class);
projectInfo.setOverdueSituation("即将超期");
projectInfo.setSafetyInputRate("0");
if (Objects.nonNull(apply)) {
try {
projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear()));
} catch (Exception ignored) {
}
projectInfo.setProjectIntroduction(apply.getBaseProjIntro());
projectInfo.setBuildCycle(apply.getBaseProjDuration());
projectInfo.setApprovalAmount(apply.getBaseProjTotalAmount());
}
projectInfo.setProjectCode(projectCode);
projectInfo.setProjectName(baseInfo.getBaseProjName());
projectInfo.setBuildOrgName(baseInfo.getBaseBuildDeprt());
projectInfo.setBuildOrgCode(baseInfo.getBaseBuildDeprtDing());
//3.项目状态情况
projectInfo.setStatusSituation(genProjectStatus(baseInfo));
projectInfo.setStatus(baseInfo.getBaseProjSetProg());
res.setProjectInfo(projectInfo);
} else if (Objects.nonNull(operationBase)) {
ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(operationBase, ProtraitProjectInfoVO.class);
projectInfo.setOverdueSituation("即将超期");
projectInfo.setSafetyInputRate("0");
if (Objects.nonNull(apply)) {
try {
projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear()));
} catch (Exception ignored) {
}
projectInfo.setProjectIntroduction(apply.getBaseProjIntro());
projectInfo.setBuildCycle(apply.getBaseProjDuration());
projectInfo.setApprovalAmount(apply.getBaseProjTotalAmount());
}
projectInfo.setProjectCode(projectCode);
projectInfo.setProjectName(operationBase.getBaseProjName());
projectInfo.setBuildOrgName(operationBase.getBaseBuildDeprt());
projectInfo.setBuildOrgCode(operationBase.getBaseBuildDeprtDing());
//3.项目状态情况
projectInfo.setStatusSituation(genProjectStatus(operationBase));
projectInfo.setStatus(operationBase.getBaseProjSetProg());
res.setProjectInfo(projectInfo);
}


//4.查询项目特征
res.setProjectFeatures(projectTagService.getProjectTas(projectCode));

//5.查询项目产出
res.setProjectOutput(applicationHandler.generateOutput(projectCode));

return res;
}

/**
* 计算安全投入
*
* @param project
* @return
*/
public static String convertSafetyInputRate(Project project) {
String safetyInputDescribe = project.getSafetyInputDescribe();
if (org.apache.commons.lang3.StringUtils.isNotBlank(safetyInputDescribe)) {
try {
JSONArray array = JSON.parseArray(safetyInputDescribe);
final Double[] total = {0.0};
array.forEach(j -> {
JSONObject json = JSON.parseObject(JSON.toJSONString(j));
Double safetyInputAmount = json.getDouble(Protrait.FEILD_SAFETYMONEY);
if (Objects.nonNull(safetyInputAmount)) {
total[0] += safetyInputAmount;
}
});
Double totalAmount = total[0];
//申报金额
BigDecimal declareAmount = project.getDeclareAmount();
if (Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0) {
return Protrait.ZREO_PERCEN;
}
BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100))
.divide(declareAmount, BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP)
.stripTrailingZeros();
return rate.toPlainString();
} catch (Exception ignored) {
}
}
return Protrait.ZREO_PERCEN;
}

/**
* 生成项目 状态流转信息
*
* @param project
* @return
*/
private List<ProtraitProjectStatusSituationVO> genProjectStatus(Project project) {
final List<ProtraitProjectStatusSituationVO> res = Lists.newArrayList();
//1.计划(单位内部审核)
res.add(new ProtraitProjectStatusSituationVO());
//2.申报(项目预审)
res.add(new ProtraitProjectStatusSituationVO());
//3.审批(建设方案审批)
res.add(new ProtraitProjectStatusSituationVO());
//4.建设(立项后的建设中)
res.add(new ProtraitProjectStatusSituationVO());
//5.验收(终验)
res.add(new ProtraitProjectStatusSituationVO());
//6.运维(todo: 运维时间还没有)
res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.OPERATION).build());
//7.绩效
res.add(new ProtraitProjectStatusSituationVO());
//8.注销(todo: 还没有注销功能)
res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.LOG_OFF).build());

CompletableFuture.allOf(
CompletableFuture.runAsync(() -> res.set(0, statusHandler.genApproveStatus(project, Protrait.PLAN,
InstTypeEnum.UNIT_INNER_AUDIT)), ForkJoinPool.commonPool()),
CompletableFuture.runAsync(() -> res.set(1, statusHandler.genApproveStatus(project, Protrait.DECLARED,
InstTypeEnum.PRELIMINARY_PREVIEW)), ForkJoinPool.commonPool()),
CompletableFuture.runAsync(() -> res.set(2, statusHandler.genApproveStatus(project, Protrait.APPROVE,
InstTypeEnum.CONSTRUCTION_PLAN_REVIEW)), ForkJoinPool.commonPool()),
CompletableFuture.runAsync(() -> res.set(3, statusHandler.genStatus(project, Protrait.CONSTRUCTION,
ProjectStatusEnum.UNDER_CONSTRUCTION, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)), ForkJoinPool.commonPool()),
CompletableFuture.runAsync(() -> res.set(4, statusHandler.genApproveStatus(project, Protrait.ACCEPT,
InstTypeEnum.PROJECT_FINAL_INSPECTION)), ForkJoinPool.commonPool()),
CompletableFuture.runAsync(() -> res.set(6, statusHandler.generatePerformanceStatus(project)),
ForkJoinPool.commonPool())
).join();
return res;
}

private List<ProtraitProjectStatusSituationVO> genProjectStatus(GovBizProjectBaseinfo baseinfo) {
final List<ProtraitProjectStatusSituationVO> res = Lists.newArrayList();
//1.计划(单位内部审核)
res.add(new ProtraitProjectStatusSituationVO(Protrait.PLAN, null));
//2.申报(项目预审)
res.add(new ProtraitProjectStatusSituationVO(Protrait.DECLARED, null));
//3.审批(建设方案审批)
res.add(new ProtraitProjectStatusSituationVO(Protrait.APPROVE, null));
//4.建设(立项后的建设中)
res.add(new ProtraitProjectStatusSituationVO(Protrait.CONSTRUCTION, null));
//5.验收(终验)
res.add(new ProtraitProjectStatusSituationVO(Protrait.ACCEPT,
Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null));
//6.运维(todo: 运维时间还没有)
res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.OPERATION).build());
//7.绩效
res.add(new ProtraitProjectStatusSituationVO(Protrait.ACCEPT, null));
//8.注销(todo: 还没有注销功能)
res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.LOG_OFF).build());
return res;
}

private List<ProtraitProjectStatusSituationVO> genProjectStatus(GovOperationProjectBaseinfo baseinfo) {
final List<ProtraitProjectStatusSituationVO> res = Lists.newArrayList();
//1.计划(单位内部审核)
res.add(new ProtraitProjectStatusSituationVO(Protrait.PLAN, null));
//2.申报(项目预审)
res.add(new ProtraitProjectStatusSituationVO(Protrait.DECLARED, null));
//3.审批(建设方案审批)
res.add(new ProtraitProjectStatusSituationVO(Protrait.APPROVE, null));
//4.建设(立项后的建设中)
res.add(new ProtraitProjectStatusSituationVO(Protrait.CONSTRUCTION, null));
//5.验收(终验)
res.add(new ProtraitProjectStatusSituationVO(Protrait.ACCEPT,
Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null));
//6.运维(todo: 运维时间还没有)
res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.OPERATION).build());
//7.绩效
res.add(new ProtraitProjectStatusSituationVO(Protrait.ACCEPT, null));
//8.注销(todo: 还没有注销功能)
res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.LOG_OFF).build());
return res;
}
}

+ 0
- 301
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java ファイルの表示

@@ -1,301 +0,0 @@
package com.hz.pm.api.dashboard.manage;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.model.entity.DataDTO;
import com.hz.pm.api.dashboard.model.vo.EarlyWarningStatisticsVO;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
import com.hz.pm.api.projectlib.model.enumeration.WarningFlowTypeEnum;
import com.hz.pm.api.projectlib.model.enumeration.WarningOperationTypeEnum;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectInst;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords;
import com.hz.pm.api.sys.service.IEarlyWarningRecordsService;
import com.hz.pm.api.sys.utils.EarlyWarningUtil;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
import com.wflow.enums.WarningNoticeTypeEnum;
import com.wflow.enums.WarningRuleTypeEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.HistoryService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.task.api.Task;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

/**
* @Classname EarlyWarningStatisticsManage
* @Description
* @Date 2023/12/05 17:44
* @Author PoffyZhang
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class EarlyWarningStatisticsManage {

private final IEarlyWarningRecordsService earlyWarningRecordsService;

private final HistoryService historyService;

private final IProjectInstService projectInstService;

private final IProjectService projectService;

private final TaskService taskService;

private static final List<Integer> threeYears = Lists.newArrayList(LocalDateTime.now().getYear() - 2,
LocalDateTime.now().getYear() - 1, LocalDateTime.now().getYear());

public EarlyWarningStatisticsVO statistics(Integer year) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

//项目
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE));

EarlyWarningStatisticsVO res = new EarlyWarningStatisticsVO();
LambdaQueryWrapper<WflowEarlyWarningRecords> wrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class);
EarlyWarningUtil.buildPermissionWrapper(wrapper, user);
List<WflowEarlyWarningRecords> records = earlyWarningRecordsService.list(wrapper);
//累积总告警数
res.setAccumulatedAlarmsTotal(records.size());
res.setAccumulatedAlarmsFlow((int) records.stream().filter(a -> {
if (Objects.nonNull(a.getRuleType()) &&
a.getRuleType().equals(WarningRuleTypeEnum.PROCESS_WARNING.getCode())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).count());
res.setAccumulatedAlarmsFilling((int) records.stream().filter(a -> {
if (Objects.nonNull(a.getRuleType()) &&
a.getRuleType().equals(WarningRuleTypeEnum.DECLARED_WARNING.getCode())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).count());

//近三年
List<DataDTO> threeYearsAlarms = Lists.newArrayList();
for (Integer thisYear : threeYears) {
DataDTO yearData = new DataDTO();
yearData.setName(thisYear.toString());
yearData.setNum((int) records.stream().filter(r -> {
if (Objects.nonNull(r.getWarningTime()) &&
thisYear.equals(r.getWarningTime().getYear())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).count());
threeYearsAlarms.add(yearData);
}
res.setThreeYearsAlarms(threeYearsAlarms);

//当前各流程报警数
List<DataDTO> alarmsFlowsNow = Lists.newArrayList();
for (ProjectProcessStageEnum stageEnum : ProjectProcessStageEnum.values()) {
String processName = stageEnum.getDesc();
Integer processType = stageEnum.getCode();
alarmsFlowsNow.add(DataDTO.of(processName, computeFlowWarningNow(processType, records)));
}
res.setAlarmsFlowsNow(alarmsFlowsNow);

//当前各填报报警数
List<DataDTO> alarmsFillingNow = Lists.newArrayList();
for (WarningFlowTypeEnum fillingEnum : WarningFlowTypeEnum.values()) {
String processName = fillingEnum.getDesc();
Integer projectStatus = fillingEnum.getProjectStutas();
alarmsFillingNow.add(DataDTO.of(processName, computeFillingNow(projectStatus, records, projects)));
}
res.setAlarmsFillingNow(alarmsFillingNow);

//实施预警
List<DataDTO> alarmsConstruction = Lists.newArrayList();
for (WarningNoticeTypeEnum noticeTypeEnum : WarningNoticeTypeEnum.values()) {
String name = noticeTypeEnum.getDesc();
Integer noticeType = noticeTypeEnum.getCode();
alarmsConstruction.add(DataDTO.of(name, computeConstruction(noticeType, records, projects)));
}
res.setConstructionAlarms(alarmsConstruction);

//安全监测
List<DataDTO> safetyMonitoring = Lists.newArrayList();
//--1 安全设计
safetyMonitoring.add(DataDTO.of("安全设计", 0));
//--2 安全投入低于5%
safetyMonitoring.add(DataDTO.of("安全投入低于5%", computeSafeLessFive(projects)));
//--3 非信创
safetyMonitoring.add(DataDTO.of("非信创", computeNotXinChuang(projects)));
//--4 等保未做
safetyMonitoring.add(DataDTO.of("等保未做", 0));
//--5 密评未做
safetyMonitoring.add(DataDTO.of("密评未做", 0));
res.setSafetyMonitoring(safetyMonitoring);
return res;
}

//计算非信创
private Integer computeNotXinChuang(List<Project> projects) {
return (int) projects.stream().filter(p -> StringUtils.isNotBlank(p.getCloudType()) &&
!p.getCloudType().contains("2")).count();
}

//计算安全投入低于5%
private Integer computeSafeLessFive(List<Project> projects) {
return (int) projects.stream().filter(p -> {
//计算出 安全投入
BigDecimal rate = new BigDecimal(DashboardProjectManage.convertSafetyInputRate(p));
if (rate.compareTo(new BigDecimal(5)) < 0) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).count();
}

private Integer computeConstruction(Integer noticeType, List<WflowEarlyWarningRecords> records,
List<Project> projects) {
//终验告警
List<WflowEarlyWarningRecords> constructionRecords = records.stream().filter(r -> {
if (Objects.nonNull(r.getRuleType()) &&
WarningRuleTypeEnum.OPERATION_WARNING.getCode().equals(r.getRuleType())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).filter(r -> Objects.nonNull(r.getNoticeType()) && r.getNoticeType().equals(noticeType) &&
WarningOperationTypeEnum.ZHONGYAN.getCode().equals(r.getBiz()))
.collect(Collectors.toList());
if (CollUtil.isEmpty(constructionRecords)) {
return 0;
}
Map<String, List<WflowEarlyWarningRecords>> recordsMap = constructionRecords.stream().collect(Collectors.groupingBy(
WflowEarlyWarningRecords::getProjectCode));

//待终验的项目
List<Project> tobeFinalProjects = projects.stream().filter(p -> {
if (Objects.nonNull(p.getStatus()) &&
p.getStatus().equals(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).collect(Collectors.toList());

return (int) tobeFinalProjects.stream().filter(p -> {
if (recordsMap.containsKey(p.getProjectCode())) {
List<WflowEarlyWarningRecords> warningRecords = recordsMap.get(p.getProjectCode());
//如果是临期的 不能包含有超期的
if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) {
for (WflowEarlyWarningRecords warningRecord : warningRecords) {
if (Objects.isNull(warningRecord.getNoticeType()) || warningRecord.getNoticeType()
.equals(WarningNoticeTypeEnum.OVER.getCode())) {
return Boolean.FALSE;
}
}
}
//这个状态有告警 并且 这个项目也是这个类型
return Boolean.TRUE;
}
return Boolean.FALSE;
}).count();
}

private Integer computeFillingNow(Integer projectStutas, List<WflowEarlyWarningRecords> records,
List<Project> projects) {
List<WflowEarlyWarningRecords> fillingRecords = records.stream().filter(r -> {
if (Objects.nonNull(r.getRuleType()) &&
WarningRuleTypeEnum.DECLARED_WARNING.getCode().equals(r.getRuleType())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).filter(r -> Objects.nonNull(r.getNodeId())).collect(Collectors.toList());
if (CollUtil.isEmpty(fillingRecords)) {
return 0;
}
Map<String, List<WflowEarlyWarningRecords>> warningMap = fillingRecords.stream()
.collect(Collectors.groupingBy(WflowEarlyWarningRecords::getProjectCode));

List<Project> thisStatusProjects = projects.stream().filter(p -> {
if (Objects.nonNull(p.getStatus()) && p.getStatus().equals(projectStutas)) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).collect(Collectors.toList());

return (int) thisStatusProjects.stream().filter(p -> {
if (warningMap.containsKey(p.getProjectCode())) {
//这个状态有告警 并且 这个项目也是这个类型
return Boolean.TRUE;
}
return Boolean.FALSE;
}).count();
}

//计算某个流程当前正在告警的数量
private Integer computeFlowWarningNow(Integer processType, List<WflowEarlyWarningRecords> records) {
List<WflowEarlyWarningRecords> processRecords = records.stream().filter(r -> {
if (Objects.nonNull(r.getRuleType()) &&
WarningRuleTypeEnum.PROCESS_WARNING.getCode().equals(r.getRuleType())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).filter(r -> Objects.nonNull(r.getNodeId())).collect(Collectors.toList());
if (CollUtil.isEmpty(processRecords)) {
return 0;
}
Map<String, List<WflowEarlyWarningRecords>> warningMap = processRecords.stream()
.collect(Collectors.groupingBy(WflowEarlyWarningRecords::getNodeId));

//1.先查出 所育 这个类型的 流程
List<ProjectInst> proInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getInstType, processType));
if (CollUtil.isEmpty(proInsts)) {
return 0;
}
//2.再筛选一下 选出 正在审核 未完成的
Set<String> instCodes = proInsts.stream().map(ProjectInst::getInstCode)
.collect(Collectors.toSet());
List<HistoricProcessInstance> processes = historyService.createHistoricProcessInstanceQuery()
.processInstanceIds(instCodes)
.unfinished()
.orderByProcessInstanceStartTime()
.asc()
.list();
if (CollUtil.isEmpty(processes)) {
return 0;
}
//查出所有正在执行的工作流任务
List<Task> tasks = taskService.createTaskQuery()
.list();
if (CollUtil.isEmpty(tasks)) {
return 0;
}
Map<String, List<Task>> taskMap = tasks.stream()
.collect(Collectors.groupingBy(Task::getProcessInstanceId));
return (int) processes.stream().filter(p -> {
if (taskMap.containsKey(p.getId())) {
List<Task> tasksThis = taskMap.get(p.getId());
for (Task taskThis : tasksThis) {
//说明 当前有告警
if (warningMap.containsKey(taskThis.getTaskDefinitionKey())) {
return Boolean.TRUE;
}
}
}
return Boolean.FALSE;
}).count();
}
}

+ 0
- 4
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java ファイルの表示

@@ -57,10 +57,6 @@ public class ExpertStatisticsManage {

private final IMetaDictionaryService metaDictionaryService;

private Integer[] years = new Integer[]{LocalDateTime.now().getYear() - 2,
LocalDateTime.now().getYear() - 1, LocalDateTime.now().getYear(),
LocalDateTime.now().getYear() + 1, LocalDateTime.now().getYear() + 2};

private Integer[] threeYears = new Integer[]{LocalDateTime.now().getYear() - 2,
LocalDateTime.now().getYear() - 1, LocalDateTime.now().getYear()};



+ 0
- 195
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java ファイルの表示

@@ -1,195 +0,0 @@
package com.hz.pm.api.dashboard.manage;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hz.pm.api.common.helper.RegionCacheHelper;
import com.hz.pm.api.common.model.constant.RegionConst;
import com.hz.pm.api.common.model.entity.DataDTO;
import com.hz.pm.api.dashboard.model.vo.MeetingStatisticsVO;
import com.hz.pm.api.ding.constants.DingOrganizationContant;
import com.hz.pm.api.expert.constant.ReviewResultEnum;
import com.hz.pm.api.expert.model.entity.ExpertReview;
import com.hz.pm.api.expert.model.enumeration.ReviewTemplateTypeEnum;
import com.hz.pm.api.expert.service.IExpertReviewService;
import com.hz.pm.api.meeting.entity.domain.Meeting;
import com.hz.pm.api.meeting.service.IMeetingService;
import com.hz.pm.api.organization.model.entity.DingOrganization;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.sys.model.dto.RegionDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname MeetingStatisticsManage
* @Description
* @Date 2023/12/05 17:44
* @Author PoffyZhang
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class MeetingStatisticsManage {

private final IMeetingService meetingService;

private final IExpertReviewService expertReviewService;

private final RegionCacheHelper regionCacheHelper;

private final IDingOrganizationService dingOrganizationService;

private final IProjectService projectService;

public MeetingStatisticsVO statistics(Integer year) {
MeetingStatisticsVO res = new MeetingStatisticsVO();
List<Meeting> meetings = meetingService.list(Wrappers.lambdaQuery(Meeting.class));
//查出 年份的 会议数据
meetings = meetings.stream().filter(m -> {
if (Objects.nonNull(m.getStartTime()) &&
(Objects.isNull(year) || year.equals(m.getStartTime().getYear()))) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).collect(Collectors.toList());
List<Long> meetingIds = meetings.stream().map(Meeting::getId)
.collect(Collectors.toList());

//会议总数
res.setMeetingTotal(meetings.size());

//评审数
List<ExpertReview> expertReviews = Lists.newArrayList();
Integer reviewsTotal = 0;
if (CollUtil.isNotEmpty(meetingIds)) {
expertReviews = expertReviewService.list(Wrappers.lambdaQuery(ExpertReview.class)
.eq(ExpertReview::getIsFinal, Boolean.TRUE)
.in(ExpertReview::getMeetingId, meetingIds));
reviewsTotal = expertReviews.size();
}
//通过的评审
List<ExpertReview> passExpertReviews = expertReviews.stream()
.filter(r -> Objects.nonNull(r.getReviewResult()) &&
r.getReviewResult().equals(ReviewResultEnum.PASSED.getCode()))
.collect(Collectors.toList());
//不通过的评审
List<ExpertReview> notpassExpertReviews = expertReviews.stream()
.filter(r -> Objects.nonNull(r.getReviewResult()) &&
r.getReviewResult().equals(ReviewResultEnum.REFUSED.getCode()))
.collect(Collectors.toList());
res.setPassReview(passExpertReviews.size());
res.setNotPassRate(reviewsTotal.compareTo(0) == 0 ? BigDecimal.ZERO :
BigDecimal.valueOf(notpassExpertReviews.size()).multiply(BigDecimal.valueOf(100)
.divide(BigDecimal.valueOf(reviewsTotal), RoundingMode.HALF_UP)));

//各区域
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY)
.stream().filter(r -> r.getRegionLevel().equals(RegionConst.RL_COUNTY))
.sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList());
List<DataDTO> regionMeetngs = Lists.newArrayList();
for (RegionDTO region : regions) {
regionMeetngs.add(DataDTO.of(region.getRegionName(), region.getRegionCode(), meetings.size()));
}
res.setRegionMeetings(regionMeetngs);

//预审 验收 会议
List<DataDTO> meetingTypes = Lists.newArrayList();
meetingTypes.add(DataDTO.of("预审会议", ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode().toString(),
meetings.stream().filter(m -> {
if (StringUtils.isNotBlank(m.getType()) &&
m.getType().equals(ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode()
.toString())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).collect(Collectors.toList()).size()));
long yanshouCount = meetings.stream().filter(m -> {
if (StringUtils.isNotBlank(m.getType()) &&
m.getType().equals(ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode()
.toString())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).count();
meetingTypes.add(DataDTO.of("验收会议", ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode().toString(),
(int) yanshouCount));
res.setMeetingTypes(meetingTypes);

//各区县评审 不通过率
List<DataDTO> regionNotpassReview = Lists.newArrayList();
for (RegionDTO region : regions) {
DataDTO data = new DataDTO();
data.setCode(region.getRegionCode());
data.setName(region.getRegionName());
//先求出 此区域会议
List<Long> regionMeetingIds = meetings.stream().filter(m -> Boolean.FALSE).map(Meeting::getId).collect(Collectors.toList());

List<ExpertReview> regionReviews = expertReviews.stream().filter(r -> {
if (Objects.nonNull(r.getMeetingId()) &&
regionMeetingIds.contains(r.getMeetingId())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}).collect(Collectors.toList());
long regionNotpass = regionReviews.stream().filter(r -> Objects.nonNull(r.getReviewResult()) &&
r.getReviewResult().equals(ReviewResultEnum.REFUSED.getCode()))
.count();

data.setRate(CollUtil.isEmpty(regionReviews) ? BigDecimal.ZERO :
BigDecimal.valueOf(regionNotpass).multiply(BigDecimal.valueOf(100))
.divide(BigDecimal.valueOf(regionReviews.size()), BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP));

regionNotpassReview.add(data);
}
res.setNotPassRegionMeetings(regionNotpassReview);

//各部门 不通过项目TOP10
List<DingOrganization> organizations = dingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE,
DingOrganizationContant.GOV_TEMPORARY)));
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE));

//TOP10
List<ExpertReview> finalExpertReviews = expertReviews;
List<DataDTO> notpassTop10 = organizations.stream()
.map(o -> {
DataDTO data = new DataDTO();
data.setCode(o.getOrganizationCode());
data.setName(o.getOrganizationName());
List<Project> orgProjects = projects.stream().filter(p -> Objects.nonNull(p.getBuildOrgCode()) &&
p.getBuildOrgCode().equals(o.getOrganizationCode()))
.collect(Collectors.toList());
List<String> projectCodes = orgProjects.stream().map(Project::getProjectCode)
.collect(Collectors.toList());
if (CollUtil.isEmpty(projectCodes)) {
return data;
}
List<ExpertReview> reviews = finalExpertReviews.stream().filter(r -> Objects.nonNull(r.getProjectCode()) &&
projectCodes.contains(r.getProjectCode())).collect(Collectors.toList());
long orgNotpass = reviews.stream().filter(r -> Objects.nonNull(r.getReviewResult()) &&
r.getReviewResult().equals(ReviewResultEnum.REFUSED.getCode()))
.count();
data.setRate(CollUtil.isEmpty(reviews) ? BigDecimal.ZERO :
BigDecimal.valueOf(orgNotpass).multiply(BigDecimal.valueOf(100))
.divide(BigDecimal.valueOf(reviews.size()), BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP));
return data;
})
.filter(d -> Objects.nonNull(d.getRate()))
.sorted(Comparator.comparing(DataDTO::getRate).reversed())
.limit(10).collect(Collectors.toList());
res.setNotPassTop10(notpassTop10);
return res;
}
}

+ 0
- 33
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/PerformanceStatisticsManage.java ファイルの表示

@@ -1,33 +0,0 @@
package com.hz.pm.api.dashboard.manage;

import com.google.common.collect.Lists;
import com.hz.pm.api.dashboard.model.vo.PerformanceStatisticsVO;
import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.List;

/**
* @Classname PerformanceStatisticsManage
* @Description
* @Date 2023/12/05 17:44
* @Author PoffyZhang
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class PerformanceStatisticsManage {

private final IPerformanceAppraisalProjectService performanceAppraisalProjectService;

List<Integer> thisTwoYears = Lists.newArrayList(LocalDateTime.now().getYear() - 1
,LocalDateTime.now().getYear());

public PerformanceStatisticsVO statistics(Integer year) {
PerformanceStatisticsVO res = new PerformanceStatisticsVO();

return res;
}
}

+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ProjectCostStatisticsManage.java ファイルの表示

@@ -32,7 +32,6 @@ import java.util.stream.Collectors;
public class ProjectCostStatisticsManage {

private final IMeetingExpertService meetingExpertService;

private final IMeetingService meetingService;

//评审费 每人500 (0.05万)


+ 0
- 19
hz-pm-api/src/main/java/com/hz/pm/api/datascope/contants/DataScopeColumnConst.java ファイルの表示

@@ -1,19 +0,0 @@
package com.hz.pm.api.datascope.contants;

/**
* <p>
* DataScopeColumnConst
* </p>
*
* @author WendyYang
* @since 16:24 2022/11/3
*/
public interface DataScopeColumnConst {

String REGION_ID = "region_id";

String REGION_CODE = "region_code";

String ORG_CODE = "org_code";

}

+ 0
- 32
hz-pm-api/src/main/java/com/hz/pm/api/datascope/contants/LambdaDataScopeTypeEnum.java ファイルの表示

@@ -1,32 +0,0 @@
package com.hz.pm.api.datascope.contants;

import io.swagger.annotations.ApiModel;

/**
* @Classname DataScopeTypeEnum
* @Description
* @Date 2022/11/18 11:15
* @Created by PoffyZhang
*/
@ApiModel(value = "DataScopeTypeEnum", description = "数据范围类型-枚举")
public enum LambdaDataScopeTypeEnum {
/**
* 地区
*/
REGION,

/**
* 公司
*/
ORG,

/**
* 员工
*/
EMPLOYEE,

/**
* 都没有
*/
NONE;
}

+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeEntity.java ファイルの表示

@@ -3,10 +3,10 @@ package com.hz.pm.api.datascope.model;
import lombok.Data;

/**
* @Classname DataScopEntity
* @author PoffyZhang
* @Classname DataScopeEntity
* @Description
* @Date 2022/11/11 16:25
* @Created by PoffyZhang
*/
@Data
public class DataScopeEntity {


+ 0
- 14
hz-pm-api/src/main/java/com/hz/pm/api/ding/constants/DingOrganizationContant.java ファイルの表示

@@ -1,14 +0,0 @@
package com.hz.pm.api.ding.constants;

/**
* @Classname DingOrganizationContant
* @Description
* @Date 2023/7/10 17:58
* @Author PoffyZhang
*/
public interface DingOrganizationContant {

String UNIT_TYPE = "GOV_UNIT";
String GOV_TEMPORARY = "GOV_TEMPORARY";
String HOLLOW = "GOV_HOLLOW_DIVISION_NODE";
}

+ 0
- 255
hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java ファイルの表示

@@ -1,42 +1,13 @@
package com.hz.pm.api.ding.controller;

import com.alibaba.fastjson.JSON;
import com.hz.pm.api.common.util.CryptUtils;
import com.hz.pm.api.ding.task.EmployeeBatchGetTask;
import com.hz.pm.api.ding.task.GovBusinessStripsTask;
import com.hz.pm.api.ding.task.OrganizationBatchGetTask;
import com.hz.pm.api.irs.manage.AppIrsManage;
import com.hz.pm.api.irs.model.dto.ForwardDTO;
import com.hz.pm.api.sys.manage.OrgProcDefManage;
import com.hz.pm.api.projectdeclared.manage.IrsManage;
import com.hz.pm.api.projectlib.model.dto.ProjectDTO;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.ningdatech.irs.service.IRefreshTokenService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.NoSuchAlgorithmException;
import java.util.Objects;

/**
* <p>
@@ -52,237 +23,11 @@ import java.util.Objects;
@Slf4j
public class DingInfoPullController {

private final EmployeeBatchGetTask employeeBatchGetTask;
private final GovBusinessStripsTask businessStripsTask;
private final OrganizationBatchGetTask organizationBatchGetTask;

private final OrgProcDefManage orgProcDefManage;

private final IrsManage irsManage;

@Resource
private IRefreshTokenService refreshTokenService;

@Value("${irs.interface-refresh.request-token-url}")
private String govRequestTokenUrl;
@Value("${irs.interface-refresh.refresh-token-url}")
private String govRefreshTokenUrl;

private final AppIrsManage appIrsManage;

private final IProjectService projectService;

@GetMapping("/employee")
public void employeeBatchGet() {
employeeBatchGetTask.batchGetEmployeeTask();
}

@GetMapping("/businessStrips")
public void businessStripsBatchGet() {
businessStripsTask.batchGetGovBusinessStripsTask();
}

@GetMapping("/organization")
public void organizationBatchGet() {
organizationBatchGetTask.batchGetOrganizationTask();
}

@GetMapping("/organization/{orgCode}")
public void organizationGetSubs(@PathVariable String orgCode) {
organizationBatchGetTask.organizationGetSubs(orgCode);
}

@GetMapping("/organization-sub/{orgCode}")
public void organizationSubGetOrgs(@PathVariable String orgCode) {
organizationBatchGetTask.organizationSubGetOrgs(orgCode);
}

@GetMapping("/employeeByRegionCode/{regionCode}")
public void employeeBatchGetByRegionCode(@PathVariable String regionCode) {
employeeBatchGetTask.batchGetEmployeeTaskByRegionCode(regionCode);
}

@GetMapping("/employeeByOrdCode/{orgCode}")
public void employeeBatchGetByOrdCode(@PathVariable String orgCode) {
employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode);
}

@GetMapping("/getEmployeeByCode/{empCode}")
public void getEmployeeByCode(@PathVariable String empCode) {
employeeBatchGetTask.getEmployeeByCode(empCode);
}

@GetMapping("/getBatchEmployeeByCode/{orgCode}")
public void getBatchEmployeeByCode(@PathVariable String orgCode) {
employeeBatchGetTask.getBatchEmployeeByCode(orgCode);
}

@GetMapping("/getToken")
public String getToken() {
return employeeBatchGetTask.getToken();
}

@GetMapping("/getAuthToken")
public String getAuthToken() {
return employeeBatchGetTask.getAuthToken();
}

@ApiOperation(value = "项目详情推送", notes = "项目详情推送")
@GetMapping("/push-project")
public String pushProject() throws Exception {
File f = new File("/temp/遂昌归集项目信息(需补).xlsx");
// File f = new File("C:\\Users\\PoffyZhang\\Desktop\\遂昌归集项目信息(需补).xlsx");
Workbook wb = readExcel(new FileInputStream(f), f.getName());
Assert.notNull(wb, "文件流为空");
Row row;
Integer sucessNum = 0;
if (wb != null) {
//获取第一个sheet
Sheet sheet = wb.getSheetAt(0);
//获取最大行数
int rownum = sheet.getPhysicalNumberOfRows();
//获取第一行
row = sheet.getRow(0);
//获取最大列数
for (int i = 1; i < rownum; i++) {
row = sheet.getRow(i);
if (Objects.isNull(row) || Objects.isNull(row.getCell(0))) {
//取不到数据了 停止
log.info("数据取完");
break;
}
ProjectDTO projectDto = new ProjectDTO();

projectDto.setProjectCode(row.getCell(0).toString());
projectDto.setProjectName(row.getCell(1).toString());
projectDto.setArea(row.getCell(2).toString());
projectDto.setAreaCode("331123000");
String baseProjType = String.valueOf(row.getCell(4));
if (StringUtils.isNotBlank(baseProjType) && baseProjType.contains(".")) {
baseProjType = baseProjType.substring(0,
baseProjType.indexOf("."));
}
projectDto.setBaseProjType(baseProjType);
projectDto.setBaseConstructionType(String.valueOf(row.getCell(5)));
projectDto.setBaseProjConsClass(String.valueOf(row.getCell(6)));
projectDto.setBaseLowestLevel(String.valueOf(row.getCell(7)));
projectDto.setProjectYear(Integer.valueOf(String.valueOf(row.getCell(8))));
projectDto.setBaseProjBasis(String.valueOf(row.getCell(9)));
projectDto.setBuildBasis(String.valueOf(row.getCell(10)));
String baseProjSerProg = String.valueOf(row.getCell(12));
if (StringUtils.isNotBlank(baseProjSerProg) && baseProjSerProg.contains(".")) {
baseProjSerProg = baseProjSerProg.substring(0,
baseProjSerProg.indexOf("."));
}
projectDto.setBaseProjSetProg(baseProjSerProg);
projectDto.setResponsibleMan(String.valueOf(row.getCell(13)));
projectDto.setResponsibleManMobile(String.valueOf(row.getCell(14)));
projectDto.setContactName(String.valueOf(row.getCell(15)));
projectDto.setContactPhone(String.valueOf(row.getCell(16)));
projectDto.setBuildOrgName(String.valueOf(row.getCell(18)));
projectDto.setBuildOrgCode(String.valueOf(row.getCell(19)));
projectDto.setSuperOrg(String.valueOf(row.getCell(21)));
projectDto.setSuperOrgCode(String.valueOf(row.getCell(22)));
projectDto.setHigherSuperOrg(String.valueOf(row.getCell(24)));
projectDto.setHigherSuperOrgCode(String.valueOf(row.getCell(25)));

log.info("projectDto :{}", JSON.toJSONString(projectDto));

if (StringUtils.isNotBlank(appIrsManage.pushProjectDetail(projectDto))) {
sucessNum++;
}
}
}

return "推送IRS项目详情成功数量:" + sucessNum;
}

@ApiOperation(value = "应用和项目关系推送", notes = "应用和项目关系推送")
@GetMapping("/push-app-project")
public String pushAppProject() throws Exception {
long timestamp = System.currentTimeMillis();
String areaCode = "331123";
String appKey = "A331101453557202109017383";
String appSecret = "496f0f2a19994f76b4fd9dae087366c7";
String baseProjSys = "初次建设的应用21";
String baseProjSysCode = "A331123467587202307014177";
String baseProjName = "遂昌县-nsl-项目测试004";
String baseProjId = "331123230130123412186";
String requestSecret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, HttpMethod.POST.name());
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b");
String capTime = String.valueOf(timestamp);
String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp);
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp +
"&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime +
"&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId +
"&isEffective=1&baseProjSysCode=" + baseProjSysCode;
RestTemplate restTemplate = new RestTemplate();
log.info("url :{}", url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

log.info(JSON.toJSONString(forEntity));

return forEntity.getBody();
}

@ApiOperation(value = "项目详情推送", notes = "项目详情推送")
@GetMapping("/push-project-detail")
public String pushProjectDetail() throws NoSuchAlgorithmException {
Project project = projectService.getById(189L);
ProjectDTO projectDto = new ProjectDTO();

projectDto.setProjectCode(project.getProjectCode());
projectDto.setProjectName(project.getProjectName());
projectDto.setArea(project.getArea());
projectDto.setAreaCode(project.getAreaCode());
projectDto.setBaseProjType("1");
projectDto.setBaseConstructionType("03");
projectDto.setBaseProjConsClass("C");
projectDto.setBaseLowestLevel("C");
projectDto.setProjectYear(project.getProjectYear());
projectDto.setBaseProjBasis("1");
projectDto.setBuildBasis("01");
projectDto.setBaseProjSetProg("05");
projectDto.setResponsibleMan(project.getResponsibleMan());
projectDto.setResponsibleManMobile(project.getResponsibleManMobile());
projectDto.setContactName(project.getContactName());
projectDto.setContactPhone(project.getContactPhone());
projectDto.setBuildOrgName(project.getBuildOrgName());
projectDto.setBuildOrgCode(project.getBuildOrgCode());
projectDto.setSuperOrg(project.getSuperOrg());
projectDto.setSuperOrgCode(project.getSuperOrgCode());
projectDto.setHigherSuperOrg(project.getHigherSuperOrg());
projectDto.setHigherSuperOrgCode(project.getHigherSuperOrgCode());

log.info("projectDto :{}", JSON.toJSONString(projectDto));

if (StringUtils.isNotBlank(appIrsManage.pushProjectDetail(projectDto))) {
return "推送成功";
}
return "推送失败";
}

@ApiOperation(value = "转发IRS请求", notes = "转发IRS请求 用于")
@PostMapping("/forward")
public String forward(@Valid @RequestBody ForwardDTO dto) {
return irsManage.forward(dto);
}

public static Workbook readExcel(InputStream is, String extString) {
Workbook wb = null;

extString = extString.substring(extString.lastIndexOf("."));
try {
if (".xls".equals(extString)) {
return new HSSFWorkbook(is);
} else if (".xlsx".equals(extString)) {
return new XSSFWorkbook(is);
} else {
return null;
}
} catch (IOException e) {
e.printStackTrace();
}
return wb;
}
}

+ 0
- 446
hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java ファイルの表示

@@ -1,446 +0,0 @@
package com.hz.pm.api.ding.task;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.ding.constants.DingOrganizationContant;
import com.hz.pm.api.organization.model.entity.DingEmployeeInfo;
import com.hz.pm.api.organization.model.entity.DingOrganization;
import com.hz.pm.api.organization.service.IDingEmployeeInfoService;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import com.hz.pm.api.user.model.entity.UserInfo;
import com.hz.pm.api.user.service.IUserInfoService;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.GenericResult;
import com.ningdatech.zwdd.ZwddIntegrationProperties;
import com.ningdatech.zwdd.client.ZwddAuthClient;
import com.ningdatech.zwdd.client.ZwddClient;
import com.ningdatech.zwdd.model.Page;
import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO;
import com.ningdatech.zwdd.model.dto.EmployeeInfoDTO;
import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery;
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition;
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

/**
* @author liuxinxin
* @date 2023/2/10 上午9:52
*/

@Slf4j
@Component
@RequiredArgsConstructor
public class EmployeeBatchGetTask {

private static final int PAGE_SIZE = 20;
private static final int GROUP_SIZE = 100;
private static final long MAX_SIZE = 10000;

//==================================================================================================================

private final ZwddClient zwddClient;
private final ZwddAuthClient zwddAuthClient;
private final IDingOrganizationService dingOrganizationService;
private final IDingEmployeeInfoService dingEmployeeInfoService;
private final ZwddIntegrationProperties zwddIntegrationProperties;
private final IUserInfoService userInfoService;

//==================================================================================================================

@Transactional(rollbackFor = Exception.class)
// @Scheduled(cron = "0 0 1 * * ?")
public void batchGetEmployeeTask() {
// 获取所有的组织列表用户获取组织下的 用户信息(暂时只查单位的类型)
List<DingOrganization> dingOrganizationList = dingOrganizationService.list(
Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE));
log.info("所有待更新员工的单位数:{}", dingOrganizationList.size());
if (CollUtil.isNotEmpty(dingOrganizationList)) {
//记录任务 单位数
Integer index = 0;
for (DingOrganization dingOrg : dingOrganizationList) {
log.info("当前单位:{},下标数,{}", dingOrg.getOrganizationName(), index);
index++;
List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>();
String organizationCode = dingOrg.getOrganizationCode();
PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery();
query.setEmployeeStatus("A");
query.setOrganizationCode(organizationCode);
query.setReturnTotalSize(true);
query.setTenantId(zwddIntegrationProperties.getTenantId());
int pageNo = 1;
query.setPageNo(pageNo);
query.setPageSize(PAGE_SIZE);

// 查询组织下 用户信息
GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData();
if (Objects.isNull(data)) {
log.info("响应为空:{}", organizationCode);
continue;
}
if (CollUtil.isNotEmpty(data.getData())) {
allOrganizationEmployeePositionList.addAll(data.getData());
}
Long totalSize = data.getTotalSize();

log.info("dingOrg :{}", JSON.toJSONString(dingOrg));

log.info("totalSize :{},{}", totalSize, dingOrg.getOrganizationName());
if (totalSize > PAGE_SIZE) {
if (totalSize > MAX_SIZE) {
//超过1万 按1万的处理
totalSize = MAX_SIZE;
}

int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0;
int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo;
for (pageNo = 2; pageNo <= maxPageNo; pageNo++) {
query.setPageNo(pageNo);
GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
if (pageGenericResult.isSuccess()) {
allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData());
} else {
log.error(pageGenericResult.getMsg());
}
}
}

// 批量查询 成员的accountId
List<DingEmployeeInfo> dingEmployeeInfoSaveRecordList = new ArrayList<>();
if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) {
log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size());
assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList);
} else {
log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size());
List<List<OrganizationEmployeePosition>> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE);
for (List<OrganizationEmployeePosition> segment : split) {
assemblerAccountId(segment, dingEmployeeInfoSaveRecordList);
}
}
// 批量保存用户信息
saveBatch(dingEmployeeInfoSaveRecordList);
}
}
}


private void assemblerAccountId(List<OrganizationEmployeePosition> segment, List<DingEmployeeInfo> dingEmployeeInfoSaveRecordList) {
List<String> employeeCodes = segment.stream().map(OrganizationEmployeePosition::getEmployeeCode).distinct().collect(Collectors.toList());
GenericResult<List<EmployeeAccountIdDTO>> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes);
List<EmployeeAccountIdDTO> employeeAccountIdDTOList = listGenericResult.getData();
if (CollUtil.isNotEmpty(employeeAccountIdDTOList)) {
Map<String, Long> employeeCodeAccountIdMap = employeeAccountIdDTOList.stream().filter(Objects::nonNull)
.collect(Collectors.toMap(EmployeeAccountIdDTO::getEmployeeCode, EmployeeAccountIdDTO::getAccountId));

List<DingEmployeeInfo> dingEmployeeInfos = buildDingEmployeeInfoRecordList(segment);

dingEmployeeInfos = dingEmployeeInfos.stream().map(r -> {
r.setAccountId(employeeCodeAccountIdMap.get(r.getEmployeeCode()));
return r;
}).collect(Collectors.toList());
dingEmployeeInfoSaveRecordList.addAll(dingEmployeeInfos);
}
}

private List<DingEmployeeInfo> buildDingEmployeeInfoRecordList(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) {
List<DingEmployeeInfo> saveRecordList = new ArrayList<>();
for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) {
List<GovEmployeePosition> govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions();
if (CollUtil.isNotEmpty(govEmployeePositions)) {
List<DingEmployeeInfo> segmentSaveRecordList = new ArrayList<>();
for (GovEmployeePosition govEmployeePosition : govEmployeePositions) {
DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo();
BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo);
dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob());
dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode());
dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode());
dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode());
dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode());
dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode());
dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode());
dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode());
dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus());
dingEmployeeInfo.setCreateOn(LocalDateTime.now());
dingEmployeeInfo.setUpdateOn(LocalDateTime.now());
dingEmployeeInfo.setCreateBy(-1L);
dingEmployeeInfo.setUpdateBy(-1L);
segmentSaveRecordList.add(dingEmployeeInfo);
}
saveRecordList.addAll(segmentSaveRecordList);
} else {
DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo();
BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo);
saveRecordList.add(dingEmployeeInfo);
}
}
return saveRecordList;
}

private void saveBatch(List<DingEmployeeInfo> dingEmployeeInfoSaveRecordList) {
dingEmployeeInfoSaveRecordList = dingEmployeeInfoSaveRecordList.stream()
.filter(r -> "true".equals(r.getMainJob())
&& "A".equals(r.getEmpStatus())
&& StringUtils.isNotBlank(r.getEmpPosUnitCode())
&& StringUtils.isNotBlank(r.getEmployeeCode())
).collect(Collectors.toList());

Set<String> uniqueKeySet = new HashSet<String>();

List<DingEmployeeInfo> saveList = new ArrayList<>();

for (DingEmployeeInfo dingEmployeeInfo : dingEmployeeInfoSaveRecordList) {
if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getEmpPosUnitCode())) {
saveList.add(dingEmployeeInfo);
}
}

List<DingOrganization> organizations = dingOrganizationService.list();
Map<String, DingOrganization> organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o));

for (DingEmployeeInfo dingEmployeeInfo : saveList) {
String employeeCode = dingEmployeeInfo.getEmployeeCode();

DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode)
.last(BizConst.LIMIT_1));
if (Objects.isNull(employeeInfo)) {
dingEmployeeInfoService.save(dingEmployeeInfo);
} else {
dingEmployeeInfo.setId(employeeInfo.getId());
dingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo);
}
}
}

/**
* 按区域 来更新员工
*
* @param regionCode
*/
public void batchGetEmployeeTaskByRegionCode(String regionCode) {
List<DingOrganization> units = dingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)
.eq(DingOrganization::getDivisionCode, regionCode));


log.info("所有地区 {} 待更新员工的单位数:{}", regionCode, units.size());
if (CollUtil.isNotEmpty(units)) {
//记录任务 单位数
Integer index = 0;
for (DingOrganization dingOrganization : units) {
log.info("当前单位:{},下标数,{}", dingOrganization.getOrganizationName(), index);
index++;
List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>();
String organizationCode = dingOrganization.getOrganizationCode();
PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery();
query.setEmployeeStatus("A");
query.setOrganizationCode(organizationCode);
query.setReturnTotalSize(true);
query.setTenantId(zwddIntegrationProperties.getTenantId());
int pageNo = 1;
query.setPageNo(pageNo);
query.setPageSize(PAGE_SIZE);

// 查询组织下 用户信息
GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData();
if (Objects.isNull(data)) {
log.info("响应为空:{}", organizationCode);
continue;
}
if (CollUtil.isNotEmpty(data.getData())) {
allOrganizationEmployeePositionList.addAll(data.getData());
}
Long totalSize = data.getTotalSize();

log.info("dingOrganization :{}", JSON.toJSONString(dingOrganization));

log.info("totalSize :{},{}", totalSize, dingOrganization.getOrganizationName());
if (totalSize > PAGE_SIZE) {
if (totalSize > MAX_SIZE) {
//超过1万 按1万的处理
totalSize = MAX_SIZE;
}

int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0;
int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo;
for (pageNo = 2; pageNo <= maxPageNo; pageNo++) {
query.setPageNo(pageNo);
GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
if (pageGenericResult.isSuccess()) {
allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData());
} else {
log.error(pageGenericResult.getMsg());
}
}
}

// 批量查询 成员的accountId
List<DingEmployeeInfo> dingEmployeeInfoSaveRecordList = new ArrayList<>();
if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) {
log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size());
assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList);
} else {
log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size());
List<List<OrganizationEmployeePosition>> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE);
for (List<OrganizationEmployeePosition> segment : split) {
assemblerAccountId(segment, dingEmployeeInfoSaveRecordList);
}
}
// 批量保存用户信息
saveBatch(dingEmployeeInfoSaveRecordList);
}
log.info("员工同步完成");
}
}

public void batchGetEmployeeTaskByOrdCode(String orgCode) {
DingOrganization org = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, orgCode)
.last(BizConst.LIMIT_1));
VUtils.isTrue(Objects.isNull(org)).throwMessage("单位不存在");
log.info("所属单位 {} 要更新员工信息了", org.getOrganizationName());

List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>();
PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery();
query.setEmployeeStatus("A");
query.setOrganizationCode(orgCode);
query.setReturnTotalSize(true);
query.setTenantId(zwddIntegrationProperties.getTenantId());
int pageNo = 1;
query.setPageNo(pageNo);
query.setPageSize(PAGE_SIZE);

// 查询组织下 用户信息
GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData();
if (Objects.isNull(data)) {
log.info("响应为空:{}", orgCode);
return;
}
if (CollUtil.isNotEmpty(data.getData())) {
allOrganizationEmployeePositionList.addAll(data.getData());
}
Long totalSize = data.getTotalSize();

log.info("dingOrganization :{}", JSON.toJSONString(org));

log.info("totalSize :{},{}", totalSize, org.getOrganizationName());
if (totalSize > PAGE_SIZE) {
if (totalSize > MAX_SIZE) {
//超过1万 按1万的处理
totalSize = MAX_SIZE;
}

int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0;
int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE) + restPageNo;
for (pageNo = 2; pageNo <= maxPageNo; pageNo++) {
query.setPageNo(pageNo);
GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult));
if (pageGenericResult.isSuccess()) {
allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData());
} else {
log.error(pageGenericResult.getMsg());
}
}
}

// 批量查询 成员的accountId
List<DingEmployeeInfo> dingEmployeeInfoSaveRecordList = new ArrayList<>();
if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) {
log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size());
assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList);
} else {
log.info("assemblerAccountId :{}", allOrganizationEmployeePositionList.size());
List<List<OrganizationEmployeePosition>> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE);
for (List<OrganizationEmployeePosition> segment : split) {
assemblerAccountId(segment, dingEmployeeInfoSaveRecordList);
}
}
// 批量保存用户信息
saveBatch(dingEmployeeInfoSaveRecordList);

log.info("员工同步完成");

}

/**
* 更新员工信息 主要是头像
*
* @param empCode
*/
public void getEmployeeByCode(String empCode) {
GenericResult<EmployeeInfoDTO> result = zwddClient.getEmployeeByCode(empCode);
log.error("请求员工信息 result:{}", JSON.toJSONString(result));
if (!result.isSuccess()) {
log.error("请求员工信息失败 :{},mesg:{}", empCode, result.getMsg());
return;
}
EmployeeInfoDTO data = result.getData();

if (Objects.isNull(data)) {
log.error("请求员工信息失败 返回为空");
return;
}

DingEmployeeInfo emp = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getEmployeeCode, empCode)
.last(BizConst.LIMIT_1));

if (Objects.nonNull(emp)) {
emp.setAvatar(data.getGovEmpAvatar());
dingEmployeeInfoService.updateById(emp);
}

UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getEmployeeCode, empCode)
.last(BizConst.LIMIT_1));

if (Objects.nonNull(user)) {
user.setAvatar(data.getGovEmpAvatar());
userInfoService.updateById(user);
}
}

/**
* 更新一整个单位的
*
* @param orgCode
*/
public void getBatchEmployeeByCode(String orgCode) {

List<DingEmployeeInfo> employees = dingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getEmpPosUnitCode, orgCode));

for (DingEmployeeInfo employee : employees) {
getEmployeeByCode(employee.getEmployeeCode());
}
}

/**
* 获取token
*/
public String getToken() {
GenericResult<String> accessToken = zwddClient.getAccessToken();
return accessToken.getData();
}

public String getAuthToken() {
GenericResult<String> accessToken = zwddAuthClient.getAccessToken();
return accessToken.getData();
}
}

+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/ding/task/GovBusinessStripsTask.java ファイルの表示

@@ -35,7 +35,6 @@ public class GovBusinessStripsTask {
private final IGovBusinessStripService iGovBusinessStripService;

@Transactional(rollbackFor = Exception.class)
// @Scheduled(cron = "0 0 1 * * ?")
public void batchGetGovBusinessStripsTask() {
PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery();
pageSubGovBusinessStripsQuery.setPageNo(1);


+ 0
- 256
hz-pm-api/src/main/java/com/hz/pm/api/ding/task/OrganizationBatchGetTask.java ファイルの表示

@@ -1,256 +0,0 @@

package com.hz.pm.api.ding.task;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.ningdatech.basic.model.GenericResult;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.ding.model.DingOrgInfoTreeDTO;
import com.hz.pm.api.organization.model.entity.DingOrganization;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import com.ningdatech.zwdd.client.ZwddClient;
import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO;
import com.ningdatech.zwdd.model.dto.DingScopesV2DTO;
import com.ningdatech.zwdd.model.dto.PageSubOrganizationCodeDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @author liuxinxin
* @date 2023/2/7 上午10:15
*/

@Slf4j
@Component
public class OrganizationBatchGetTask {

@Autowired
private ZwddClient zwddClient;

private static final Integer GROUP_SIZE = 100;

@Autowired
private IDingOrganizationService iDingOrganizationService;

@Autowired
private EmployeeBatchGetTask employeeBatchGetTask;

/**
* 获取浙政钉组织架构
*/
@Transactional(rollbackFor = Exception.class)
// @Scheduled(cron = "0 0 1 * * ?")
public void batchGetOrganizationTask() {
// List<DingOrganization> allList = iDingOrganizationService.list();
// List<String> currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList());
// 全量删除
iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId));
// 获取顶级组织code
GenericResult<DingScopesV2DTO> scopesV2Result = zwddClient.getScopesV2();
DingScopesV2DTO scopesV2 = scopesV2Result.getData();

if (Objects.nonNull(scopesV2)) {
// 顶级组织code
List<String> deptVisibleScopes = scopesV2.getDeptVisibleScopes();
log.info("顶级组织code: size = " + deptVisibleScopes.size() + "列表:" + JSONObject.toJSONString(deptVisibleScopes));
// 获取顶级节点信息
GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient.listOrganizationsByCodes(deptVisibleScopes);
log.info("listGenericResult: {}" + JSON.toJSONString(listGenericResult));
List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData();
for (String orgCode : deptVisibleScopes) {
// if (currentAllOrganizationCodeList.contains(orgCode)) {
// log.info("已存在组织架构---{}", orgCode);
// continue;
// }
List<DingOrgInfoTreeDTO> treeDTOList = new ArrayList<>();

DingOrgInfoTreeDTO childDingOrgInfoTreeDTO = new DingOrgInfoTreeDTO();
//设置节点详情
if (dingOrgInfoDtos != null && !dingOrgInfoDtos.isEmpty()) {
for (DingOrgInfoDTO orgInfo : dingOrgInfoDtos) {
if (orgInfo.getOrganizationCode().equals(orgCode)) {
childDingOrgInfoTreeDTO.setDingOrgInfoDTO(orgInfo);
}
}
}
childDingOrgInfoTreeDTO.setCode(orgCode);
childDingOrgInfoTreeDTO.setChildCodes(new ArrayList<>());
getDingOrgChild(childDingOrgInfoTreeDTO);
treeDTOList.add(childDingOrgInfoTreeDTO);
if (CollectionUtils.isNotEmpty(treeDTOList)) {
List<DingOrganization> saveRecordList = new ArrayList<>();
buildSaveRecordList(treeDTOList, saveRecordList);
// 批量保存
if (saveRecordList.size() <= GROUP_SIZE) {
iDingOrganizationService.saveBatch(saveRecordList);
} else {
List<List<DingOrganization>> split = Lists.partition(saveRecordList, GROUP_SIZE);
for (List<DingOrganization> segment : split) {
iDingOrganizationService.saveBatch(segment);
}
}
}
log.info("----拉取浙政钉组织结构结束---,顶级code:" + orgCode);
}
}
}

/**
* 更新 其 子单位
* @param orgCode
*/
public void organizationGetSubs(String orgCode) {
log.info("----拉取浙政钉组织子单位开始---,顶级code:" + orgCode);
DingOrganization topOrg = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, orgCode)
.last(BizConst.LIMIT_1));
// 顶级组织code
GenericResult<PageSubOrganizationCodeDTO> subOrganizationResult = zwddClient.pageSubOrganizationCodes(1, 100, orgCode);
log.info("subOrganizationResult: {}" + JSON.toJSONString(subOrganizationResult));
PageSubOrganizationCodeDTO data = subOrganizationResult.getData();
List<String> subOrganizationCodeList = data.getSubOrganizationCodeList();

if(Objects.isNull(subOrganizationCodeList)){
log.info("subOrganizationCodeList为null");
return;
}

employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(orgCode);

for(String subOrganizationCode : subOrganizationCodeList){
GenericResult<DingOrgInfoDTO> organizationByCode = zwddClient.getOrganizationByCode(subOrganizationCode);
DingOrgInfoDTO dingOrgInfo = organizationByCode.getData();
DingOrganization old = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, dingOrgInfo.getOrganizationCode())
.last(BizConst.LIMIT_1));
if(Objects.nonNull(old)){
log.info("该单位已经存在 :{}",old.getOrganizationName());
organizationGetSubs(dingOrgInfo.getOrganizationCode());
// employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(dingOrgInfo.getOrganizationCode());
continue;
}

DingOrganization organization = new DingOrganization();
organization.setOrganizationCode(dingOrgInfo.getOrganizationCode());
organization.setOrganizationName(dingOrgInfo.getOrganizationName());
//和顶级单位一个区域
organization.setDivisionCode(topOrg.getDivisionCode());
organization.setParentCode(dingOrgInfo.getParentCode());
organization.setTypeName(dingOrgInfo.getTypeName());
organization.setAddress(dingOrgInfo.getAddress());
organization.setBusinessStripCodes(dingOrgInfo.getBusinessStripCodes());
organization.setDisplayOrder(dingOrgInfo.getDisplayOrder());
organization.setGmtCreate(LocalDateTime.now());
organization.setInstitutionLevelCode(dingOrgInfo.getInstitutionLevelCode());
organization.setParentName(dingOrgInfo.getParentName());
if(iDingOrganizationService.save(organization)){
organizationGetSubs(organization.getOrganizationCode());
// employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(organization.getOrganizationCode());
}
}

log.info("----拉取浙政钉组织子单位结束---,顶级code:" + orgCode);
}

/**
* 查看下 当前的子单位信息
* @param orgCode
*/
public void organizationSubGetOrgs(String orgCode) {
// 顶级组织code
GenericResult<PageSubOrganizationCodeDTO> subOrganizationResult = zwddClient.pageSubOrganizationCodes(1, 100, orgCode);
log.info("subOrganizationResult: {}" + JSON.toJSONString(subOrganizationResult));
PageSubOrganizationCodeDTO data = subOrganizationResult.getData();
List<String> subOrganizationCodeList = data.getSubOrganizationCodeList();

if(Objects.isNull(subOrganizationCodeList)){
log.info("subOrganizationCodeList为null");
return;
}

for(String subOrganizationCode : subOrganizationCodeList){
GenericResult<DingOrgInfoDTO> organizationByCode = zwddClient.getOrganizationByCode(subOrganizationCode);
DingOrgInfoDTO dingOrgInfo = organizationByCode.getData();
log.info("dingOrgInfo :{}",JSON.toJSONString(dingOrgInfo));
}
}

private void buildSaveRecordList(List<DingOrgInfoTreeDTO> treeDTOList, List<DingOrganization> saveRecordList) {
if (CollectionUtils.isEmpty(treeDTOList)) {
return;
}
for (DingOrgInfoTreeDTO dingOrgInfoTreeDTO : treeDTOList) {
DingOrganization saveRecord = new DingOrganization();
DingOrgInfoDTO dingOrgInfoDTO = dingOrgInfoTreeDTO.getDingOrgInfoDTO();
List<DingOrgInfoTreeDTO> childCodes = dingOrgInfoTreeDTO.getChildCodes();
saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder());
// saveRecord.setEnabled("1");
saveRecord.setParentCode(dingOrgInfoDTO.getParentCode());
saveRecord.setTypeCode(dingOrgInfoDTO.getTypeCode());
saveRecord.setTypeName(dingOrgInfoDTO.getTypeName());
saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode());
// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size());
saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName());
saveRecord.setDivisionCode(dingOrgInfoDTO.getDivisionCode());
saveRecordList.add(saveRecord);
if (CollectionUtils.isNotEmpty(childCodes)) {
buildSaveRecordList(childCodes, saveRecordList);
}
}
}

private void getDingOrgChild(DingOrgInfoTreeDTO parentDingOrgInfoTreeDTO) {
String parentOrgCode = parentDingOrgInfoTreeDTO.getCode();
DingOrgInfoDTO orgInfoDTO = parentDingOrgInfoTreeDTO.getDingOrgInfoDTO();
boolean leaf = orgInfoDTO.getLeaf();
if (!leaf) {
int currentPage = 1;
int pageSize = 100;
GenericResult<PageSubOrganizationCodeDTO> pageSubOrganizationCodeDTOGenericResult = zwddClient.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode);
PageSubOrganizationCodeDTO pageSubOrganizationCodeDTO = pageSubOrganizationCodeDTOGenericResult.getData();

if (CollUtil.isNotEmpty(pageSubOrganizationCodeDTO.getSubOrganizationCodeList())) {
List<String> subOrganizationCodeList = new ArrayList<>(pageSubOrganizationCodeDTO.getSubOrganizationCodeList());
Long totalSize = pageSubOrganizationCodeDTO.getTotalSize();

while (totalSize > (long) currentPage * pageSize) {
GenericResult<PageSubOrganizationCodeDTO> subPageSubOrganizationCodeDTOGenericResult = zwddClient
.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode);
PageSubOrganizationCodeDTO subOrganizationCodeDTO = subPageSubOrganizationCodeDTOGenericResult.getData();
if (CollectionUtils.isNotEmpty(subOrganizationCodeDTO.getSubOrganizationCodeList())) {
subOrganizationCodeList.addAll(subOrganizationCodeDTO.getSubOrganizationCodeList());
}
}

if (CollectionUtils.isNotEmpty(subOrganizationCodeList)) {
GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient
.listOrganizationsByCodes(subOrganizationCodeList);
List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData();
List<DingOrgInfoTreeDTO> dingOrgInfoTreeDTOList = dingOrgInfoDtos.stream().map(r -> {
DingOrgInfoTreeDTO dingOrgInfoTreeDTO = new DingOrgInfoTreeDTO();
dingOrgInfoTreeDTO.setCode(r.getOrganizationCode());
dingOrgInfoTreeDTO.setDingOrgInfoDTO(r);
dingOrgInfoTreeDTO.setChildCodes(new ArrayList<>());
getDingOrgChild(dingOrgInfoTreeDTO);
return dingOrgInfoTreeDTO;
}).collect(Collectors.toList());
parentDingOrgInfoTreeDTO.setChildCodes(dingOrgInfoTreeDTOList);
}
}
}
}
}



+ 5
- 5
hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java ファイルの表示

@@ -53,17 +53,17 @@ public class ExpertInfoCmdAssembler {


private static List<ExpertAvoidCompanyDTO> buildExpertAvoidCompanyList(ExpertProfessionalInfo professionalInfo) {
List<ExpertAvoidCompanyDTO> expertAvoidCompanyList = new ArrayList<>();
List<ExpertAvoidCompanyDTO> avoidCompanies = new ArrayList<>();
List<ExpertAvoidCompanyInfo> avoidCompanyList = professionalInfo.getAvoidCompanyList();
if (CollectionUtils.isNotEmpty(avoidCompanyList)) {
expertAvoidCompanyList = avoidCompanyList.stream().map(r -> {
avoidCompanyList.forEach(r -> {
ExpertAvoidCompanyDTO expertAvoidCompanyDTO = new ExpertAvoidCompanyDTO();
expertAvoidCompanyDTO.setCompanyName(r.getCompanyName());
expertAvoidCompanyDTO.setCompanyUniqCode(r.getCompanyUniqCode());
return expertAvoidCompanyDTO;
}).collect(Collectors.toList());
avoidCompanies.add(expertAvoidCompanyDTO);
});
}
return expertAvoidCompanyList;
return avoidCompanies;
}

private static List<ExpertRegionDTO> buildExpertRegionList(ExpertBasicInfo basicInfo) {


+ 0
- 55
hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertUserInfoAssembler.java ファイルの表示

@@ -9,7 +9,6 @@ import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum;
import com.hz.pm.api.expert.entity.*;
import com.hz.pm.api.expert.model.*;
import com.hz.pm.api.expert.model.dto.*;
import com.hz.pm.api.expert.model.vo.ExpertFullInfoVO;
import com.hz.pm.api.gov.model.vo.GovBusinessStripVO;
import com.hz.pm.api.meta.constant.ExpertDictTypeEnum;
import com.hz.pm.api.meta.constant.ExpertTagEnum;
@@ -42,60 +41,6 @@ public class ExpertUserInfoAssembler {
private final DictionaryCache dictionaryCache;
private final RegionCacheHelper regionCacheHelper;

public ExpertFullInfoVO buildExpertDetail(List<AttachFileVo> attachFiles, ExpertFullInfoAllDTO expertFullInfoAll) {
ExpertUserFullInfoDTO expertUserInfo = expertFullInfoAll.getExpertUserInfoDTO();
// 字典字典段map
Map<String, List<DictFieldInfoDTO>> dictMap = buildDictInfoMap(expertFullInfoAll.getExpertDictionaryList());
// 专家文件资料map
Map<Long, FileBasicInfo> fileMap = buildFileBasicInfoMap(attachFiles);
// 专家标签字段map
Map<String, List<TagFieldInfo>> tagMap = buildTagFieldInfoMap(expertFullInfoAll.getExpertTagList());
// 专家履职意向地
List<ExpertRegionDTO> intentionWorkRegions = expertFullInfoAll.getExpertIntentionWorkRegionInfo();
// 专家回避单位列表
List<ExpertAvoidCompanyDTO> avoidCompanies = expertFullInfoAll.getExpertAvoidCompanyList();
// 基本信息
ExpertBasicInfo basicInfo = convert(expertUserInfo, dictMap, tagMap, intentionWorkRegions);
// 学历信息
ExpertEduInfo eduInfo = buildExpertEduInfo(expertUserInfo, dictMap);
// 职业信息
ExpertJobInfo jobInfo = buildExpertJobInfo(expertUserInfo, dictMap);
jobInfo.setBusinessStrips(expertFullInfoAll.getBusinessStrips());
// 专业信息
ExpertProfessionalInfo profession = buildExpertProfessionalInfo(expertUserInfo, dictMap, tagMap, fileMap, avoidCompanies);
// 推荐信息
ExpertRecommendInfo recommendInfo = new ExpertRecommendInfo();
recommendInfo.setRecommendedWay(dictMap.get(ExpertDictTypeEnum.RECOMMENDED_WAY.getKey()));
recommendInfo.setRecommendFile(expertUserInfo.getRecommendFile());
// 其他信息
ExpertOtherInfo otherInfo = new ExpertOtherInfo();
otherInfo.setOther(tagMap.get(ExpertTagEnum.OTHER.getKey()));
otherInfo.setRemark(expertUserInfo.getRemark());

// 专家申请履职意向展示列表
List<ExpertRegionInfo> applyIntentionWorkRegions = expertFullInfoAll.getExpertApplyIntentionWorkRegionInfo().stream().map(r -> {
ExpertRegionInfo intentionWorkRegion = new ExpertRegionInfo();
intentionWorkRegion.setRegionLevel(r.getRegionLevel());
intentionWorkRegion.setRegionCode(r.getRegionCode());
intentionWorkRegion.setRegionName(regionCacheHelper.getUnionPath(r.getRegionCode(), r.getRegionLevel()));
return intentionWorkRegion;
}).collect(Collectors.toList());

if (CollUtil.isEmpty(basicInfo.getExpertIntentionWorkRegions())) {
basicInfo.setExpertIntentionWorkRegions(applyIntentionWorkRegions);
}
ExpertFullInfoVO resExpertFullInfo = new ExpertFullInfoVO();
resExpertFullInfo.setUserId(expertUserInfo.getUserId());
resExpertFullInfo.setBasicInfo(basicInfo);
resExpertFullInfo.setEduInfo(eduInfo);
resExpertFullInfo.setJobInfo(jobInfo);
resExpertFullInfo.setProfessionalInfo(profession);
resExpertFullInfo.setRecommendInfo(recommendInfo);
resExpertFullInfo.setExpertOtherInfo(otherInfo);
resExpertFullInfo.setExpertApplyIntentionWorkRegions(applyIntentionWorkRegions);
return resExpertFullInfo;
}

public static Map<Long, FileBasicInfo> buildFileBasicInfoMap(List<AttachFileVo> attachFiles) {
return attachFiles.stream().map(r -> {
FileBasicInfo fileBasicInfo = new FileBasicInfo();


+ 0
- 14
hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java ファイルの表示

@@ -44,20 +44,6 @@ public class ExpertController {
expertManage.expertRegistration(request);
}

@PostMapping("/basic-info-submit")
@ApiOperation("专家管理员新增专家)")
@WebLog("专家管理员新增专家")
public void expertBasicInfoSubmit(@Valid @RequestBody ExpertUserBasicInfoSubmitRequest request) {
expertManage.expertBasicInfoSubmit(request);
}

@PostMapping("/basic-info-submit-notvalid")
@ApiOperation("专家管理员新增专家 参数不校检")
@WebLog("专家管理员新增专家 参数不校检")
public void expertBasicInfoSubmitNotValid(@RequestBody ExpertUserBasicInfoSubmitRequest request) {
expertManage.expertBasicInfoSubmit(request);
}

@GetMapping("/portrait/{expertId}/{year}")
public ExpertPortraitVO expertPortrait(@PathVariable Long expertId, @PathVariable Integer year) {
return expertManage.expertPortrait(expertId, year);


+ 0
- 27
hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java ファイルの表示

@@ -83,9 +83,6 @@ public class ExpertManage {
private final IExpertUserFullInfoService expertUserFullInfoService;
private final ExpertInfoService expertInfoService;
private final IUserInfoService userInfoService;
private final ExpertMetaApplyManage expertMetaApplyManage;
private final IUserRoleService userRoleService;
private final IRoleService roleService;
private final VerifyCodeCheckHelper verifyCodeCheckHelper;
private final ZwddClient zwddClient;
private final IMeetingExpertService meetingExpertService;
@@ -112,30 +109,6 @@ public class ExpertManage {
}).filter(Objects::nonNull).collect(Collectors.groupingBy(DictionaryVO::getDictionaryType));
}

/**
* 专家管理员新增专家
*
* @param req /
*/
@Transactional(rollbackFor = Exception.class)
public void expertBasicInfoSubmit(ExpertUserBasicInfoSubmitRequest req) {
Long operatorId = LoginUserUtil.getUserId();
// 用户id
Long userId = assemblerAndGenerateExpert(req, operatorId);
// 批量通过专家入库审核/专家履职意向审核
expertMetaApplyManage.autoPassExpertApply(userId);

// 增加用户专家角色
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT.name()));
UserRole expertRole = userRoleService.getOne(userId, role.getId());
if (Objects.isNull(expertRole)) {
expertRole = new UserRole();
expertRole.setUserId(userId);
expertRole.setRoleId(role.getId());
userRoleService.save(expertRole);
}
}

public ExpertDetailVO getExpertDetail(Long userId, boolean getFileDetail) {
ExpertUserFullInfo eui = expertUserFullInfoService.getByUserId(userId);
if (eui == null) {


+ 0
- 39
hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java ファイルの表示

@@ -8,7 +8,6 @@ import com.hz.pm.api.gov.model.vo.GovBizProjectListVO;
import com.hz.pm.api.gov.model.vo.GovOperationProjectDetailVO;
import com.hz.pm.api.gov.model.vo.GovProjectDictionaryVO;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.scheduler.task.SynProjectCollectionTask;
import com.hz.pm.api.scheduler.task.SynProvinceOrgTask;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
@@ -40,9 +39,6 @@ import java.util.List;
public class GovProjectCollectionController {

private final GovProjectCollectionManage collectionManage;

private final SynProjectCollectionTask collectionTask;

private final SynProvinceOrgTask synProvinceOrgTask;

@GetMapping("/dictionary")
@@ -155,41 +151,6 @@ public class GovProjectCollectionController {
return collectionManage.operationDraftRemove(draftId);
}

@PostMapping("/push-task")
@ApiOperation("主动调用定时器方法")
@WebLog("主动调用定时器方法")
public void pushTask() throws UnknownHostException {
collectionTask.doTask();
}

@PostMapping("/push-task-single")
@ApiOperation("主动调用定时器方法")
@WebLog("主动调用定时器方法")
public void pushTaskSingle(@RequestBody List<String> projectCodes) {
collectionTask.doTaskSingle(projectCodes);
}

@PostMapping("/staging-convert-pdf")
@ApiOperation("把库存的项目归集的文件 都转换成PDF文件存入字段")
@WebLog("主动转换库存的文件都为PDF文件")
public void stagingConvertPdf(@RequestParam(required = false) String projId) {
collectionTask.stagingConvertPdf(projId);
}

@PostMapping("/staging-convert-pdf2")
@ApiOperation("把库存的项目归集的文件approval_file重新转换")
@WebLog("把库存的项目归集的文件approval_file重新转换")
public void stagingConvertPdf2(@RequestParam(required = false) String projId) {
collectionTask.stagingConvertPdf2(projId);
}

@PostMapping("/staging-convert-pdf3")
@ApiOperation("把库存的项目归集的文件 都转换成PDF文件存入字段 采购")
@WebLog("主动转换库存的文件都为PDF文件 采购")
public void stagingConvertPdf3(@RequestParam(required = false) String projId) {
collectionTask.stagingConvertPdf3(projId);
}

@PostMapping("/rebuild-project-code")
@ApiOperation("重新生成项目编号")
@WebLog("重新生成项目编号")


+ 0
- 78
hz-pm-api/src/main/java/com/hz/pm/api/gov/entity/GovBusinessStrip.java ファイルの表示

@@ -1,78 +0,0 @@
package com.hz.pm.api.gov.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;

import java.io.Serializable;

/**
* <p>
*
* </p>
*
* @author liuxinxin
* @since 2023-04-13
*/
@TableName("gov_business_strip")
@ApiModel(value = "GovBusinessStrip对象", description = "")
public class GovBusinessStrip implements Serializable {

private static final long serialVersionUID = 1L;

private Long id;

private String businessStripCode;

private String businessStripName;

private String parentCode;

private String parentName;

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}
public String getBusinessStripCode() {
return businessStripCode;
}

public void setBusinessStripCode(String businessStripCode) {
this.businessStripCode = businessStripCode;
}
public String getBusinessStripName() {
return businessStripName;
}

public void setBusinessStripName(String businessStripName) {
this.businessStripName = businessStripName;
}
public String getParentCode() {
return parentCode;
}

public void setParentCode(String parentCode) {
this.parentCode = parentCode;
}
public String getParentName() {
return parentName;
}

public void setParentName(String parentName) {
this.parentName = parentName;
}

@Override
public String toString() {
return "GovBusinessStrip{" +
"id=" + id +
", businessStripCode=" + businessStripCode +
", businessStripName=" + businessStripName +
", parentCode=" + parentCode +
", parentName=" + parentName +
"}";
}
}

+ 3
- 8
hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java ファイルの表示

@@ -115,20 +115,15 @@ public class GovProjectCollectionManage {

private final FileService fileService;

@Value("${project.push-url}")
@Value("${project.push-url:}")
private String pushUrl;

@Value("${project.no-effective-url}")
@Value("${project.no-effective-url:}")
private String noEffectiveUrl;

@Value("${project.delete-all-url}")
@Value("${project.delete-all-url:}")
private String deleteAllUrl;

@Value("${spring.profiles.active}")
private String active;

private final RegionCacheHelper regionCacheHelper;

private final IProjectService projectService;
private final IProjectApplicationService applicationService;



+ 5
- 5
hz-pm-api/src/main/java/com/hz/pm/api/irs/config/IrsSealPlatformProperties.java ファイルの表示

@@ -22,27 +22,27 @@ public class IrsSealPlatformProperties {

public static String apiUrl;

@Value("${irs.seal-platform.project-id}")
@Value("${irs.seal-platform.project-id:}")
public void setProjectId(String projectId) {
IrsSealPlatformProperties.projectId = projectId;
}

@Value("${irs.seal-platform.project-secret}")
@Value("${irs.seal-platform.project-secret:}")
public void setProjectSecret(String projectSecret) {
IrsSealPlatformProperties.projectSecret = projectSecret;
}

@Value("${irs.seal-platform.access-key}")
@Value("${irs.seal-platform.access-key:}")
public void setAccessKey(String accessKey) {
IrsSealPlatformProperties.accessKey = accessKey;
}

@Value("${irs.seal-platform.secret-key}")
@Value("${irs.seal-platform.secret-key:}")
public void setSecretKey(String secretKey) {
IrsSealPlatformProperties.secretKey = secretKey;
}

@Value("${irs.seal-platform.api-url}")
@Value("${irs.seal-platform.api-url:}")
public void setApiUrl(String apiUrl) {
IrsSealPlatformProperties.apiUrl = apiUrl;
}


+ 0
- 52
hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/ApplicationController.java ファイルの表示

@@ -1,52 +0,0 @@
package com.hz.pm.api.irs.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ningdatech.log.annotation.WebLog;
import com.hz.pm.api.irs.manage.AppIrsManage;
import com.hz.pm.api.irs.model.dto.ApiApplyDTO;
import com.hz.pm.api.irs.model.dto.PushProjectAppToIrsDTO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.security.NoSuchAlgorithmException;

/**
* @Classname ApplicationController
* @Description
* @Date 2023/7/12 9:26
* @Author PoffyZhang
*/
@RestController
@RequestMapping("/api/v1/irs/app")
@AllArgsConstructor
@Slf4j
@Valid
public class ApplicationController {

private final AppIrsManage appIrsManage;

@PostMapping("/push-project-app")
@WebLog("推送项目和应用关系")
public Boolean pushProjectApp(@Valid @RequestBody PushProjectAppToIrsDTO dto) throws Exception {
return appIrsManage.pushProjectApp(dto);
}

@GetMapping("/sreach-app")
public JSONObject searchApp(ApiApplyDTO apply) throws NoSuchAlgorithmException {
return appIrsManage.searchApp(apply);
}

@GetMapping("/sreach-apps")
public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException {
return appIrsManage.searchApps(apply);
}

@GetMapping("/digitalResourcesIndicators/{appCode}/{pageSize}")
public JSONObject getDigitalResourcesIndicators(@PathVariable String appCode,@PathVariable Integer pageSize) {
return appIrsManage.getDigitalResourceIndicatorsByAppCode(appCode, pageSize);
}

}

+ 0
- 70
hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java ファイルの表示

@@ -1,70 +0,0 @@
package com.hz.pm.api.irs.controller;

import com.hz.pm.api.projectdeclared.manage.IrsManage;
import com.hz.pm.api.projectdeclared.model.vo.IrsApplicationVO;
import com.hz.pm.api.projectdeclared.model.vo.PiotTasksVO;
import com.hz.pm.api.scheduler.task.SynProjectCoreBizTask;
import com.ningdatech.log.annotation.WebLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.net.UnknownHostException;
import java.security.NoSuchAlgorithmException;
import java.util.List;

/**
* @Classname IrsController
* @Description irs 一些下拉框信息
* @Date 2023/3/13 9:53
* @Author PoffyZhang
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/api/v1/irs")
@Api(value = "irs", tags = "irs-信息查询")
@RequiredArgsConstructor
public class IrsController {

private final IrsManage irsManage;

private final SynProjectCoreBizTask projectCoreBizTask;

@ApiOperation(value = "irs应用列表", notes = "irs应用列表")
@WebLog("irs应用列表")
@GetMapping("/application-list")
public List<IrsApplicationVO> applicationList(@RequestParam(required = false) String areaCode) {
return irsManage.applicationList(areaCode);
}

@ApiOperation(value = "试点任务列表", notes = "试点任务列表")
@WebLog("试点任务列表")
@GetMapping("/piot-tasks")
public List<PiotTasksVO> piotTasks() {
return irsManage.listPiotTasks();
}

@ApiOperation(value = "获取企业社会信用编码", notes = "获取企业社会信用编码")
@GetMapping("/get-credit-code")
public String getCreditCode() throws NoSuchAlgorithmException {
return irsManage.getCreditCode();
}

@ApiOperation(value = "强制刷新核心业务", notes = "强制刷新核心业务")
@GetMapping("/refresh-core-biz")
public void refreshCoreBiz(@RequestParam(required = false) String orgCode) throws UnknownHostException {
if(StringUtils.isNotBlank(orgCode)){
projectCoreBizTask.doTask(orgCode);
}else{
projectCoreBizTask.doTask();
}
}
}

+ 0
- 396
hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java ファイルの表示

@@ -1,396 +0,0 @@
package com.hz.pm.api.irs.manage;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.crypto.digest.MD5;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.RegionConst;
import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.common.statemachine.util.StateMachineUtil;
import com.hz.pm.api.common.util.CryptUtils;
import com.hz.pm.api.common.util.HttpUtil;
import com.hz.pm.api.irs.model.dto.ApiApplyDTO;
import com.hz.pm.api.irs.model.dto.ApiApplySearchResult;
import com.hz.pm.api.irs.model.dto.PushProjectAppToIrsDTO;
import com.hz.pm.api.irs.model.res.ApiResponse;
import com.hz.pm.api.projectlib.model.dto.ProjectDTO;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectApplication;
import com.hz.pm.api.projectlib.service.IProjectApplicationService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.irs.service.IRefreshTokenService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname AppIrsManage
* @Description
* @Date 2023/7/12 11:43
* @Author PoffyZhang
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class AppIrsManage {

private final IProjectService projectService;

private final IProjectApplicationService applicationService;

private final StateMachineUtil stateMachineUtil;

@Value("${irs.push-app.appKey}")
private String pushAppKey;

@Value("${irs.push-app.appScret}")
private String pushAppScret;

@Value("${irs.push-app.url}")
private String pushUrl;

@Value("${irs.search-app.appKey}")
private String searchAppKey;

@Value("${irs.search-app.appScret}")
private String searchAppScret;

@Value("${irs.search-app.url}")
private String searchUrl;
@Resource
private IRefreshTokenService refreshTokenService;

@Value("${irs.interface-refresh.request-token-url}")
private String govRequestTokenUrl;
@Value("${irs.interface-refresh.refresh-token-url}")
private String govRefreshTokenUrl;

@Value("${irs.push-project-detail.url}")
private String pushProjectUrl;

@Value("${irs.push-project-detail.appKey}")
private String pushProjectAppKey;

@Value("${irs.push-project-detail.appSecret}")
private String pushProjectAppSecret;

//=============数字资源指标获取========================================================================================

@Value("${irs.digital-resource-indicators.app-key}")
private String driAppKey;

@Value("${irs.digital-resource-indicators.app-secret}")
private String driAppSecret;

@Value("${irs.digital-resource-indicators.interface-name}")
private String driInterfaceName;

@Value("${irs.digital-resource-indicators.url}")
private String driUrl;

/**
* 推送 项目和应用关系
*
* @param dto
* @return
* @throws NoSuchAlgorithmException
*/
public Boolean pushProjectApp(PushProjectAppToIrsDTO dto) throws Exception {
String appCode = dto.getAppCode();
Long appId = dto.getAppId();
String projectCode = dto.getProjectCode();
ProjectApplication app = applicationService.getById(appId);
VUtils.isTrue(Objects.isNull(app)).throwMessage("应用不存在!");
VUtils.isTrue(CommonEnum.NO.getCode().equals(app.getIsFirst())).throwMessage("应用不是初次新建!");
Project project = projectService.getProjectByCode(projectCode);
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!");

ApiApplyDTO apiApply = new ApiApplyDTO();
apiApply.setAppId(appCode);
JSONObject jsonObject = this.searchApp(apiApply);
ApiApplySearchResult apiApplySearchResult = JSON.parseObject(JSON.toJSONString(jsonObject), ApiApplySearchResult.class);
VUtils.isTrue(Objects.isNull(apiApplySearchResult)).throwMessage("应用在IRS不存在!");

long timestamp = System.currentTimeMillis();
String areaCode = project.getAreaCode();
String projectName = project.getProjectName();
String requestSecret = refreshTokenService.refreshToken(pushAppKey, pushAppScret, govRequestTokenUrl, govRefreshTokenUrl, HttpMethod.POST.name());
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b");
String capTime = String.valueOf(timestamp);
String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp);
String url = pushUrl + "?requestTime=" + timestamp +
"&sign=" + sign + "&appKey=" + pushAppKey + "&capCode=" + capCode + "&capTime=" + capTime +
"&baseProjSys=" + apiApplySearchResult.getName() + "&areaCode=" + areaCode + "&baseProjName=" + projectName +
"&baseProjId=" + project.getProjectCode() +
"&isEffective=1&baseProjSysCode=" + appCode;
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ApiResponse> forEntity = restTemplate.getForEntity(url, ApiResponse.class);

log.info("推送 项目和应用结果 : {}", JSON.toJSONString(forEntity));

ApiResponse body = forEntity.getBody();

if (Objects.isNull(body) || Objects.isNull(body.getCode())
|| 0 != body.getCode()) {
return Boolean.FALSE;
}

//保存关系
app.setAppCode(appCode);
if (applicationService.updateById(app)) {
/**
* 判断下 如果成功的话 那么判断下 这个项目的初次创建的app 是否都已经被注册
* 如果都已经注册 要调用状态机 进入下一个状态
*/
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectId, project.getId()));
//筛选出 初次新建的app 但是没有appCode的
apps = apps.stream().filter(a -> {
if (CommonEnum.YES.getCode().equals(a.getIsFirst()) &&
StringUtils.isBlank(app.getAppCode())) {
return Boolean.TRUE;
}
return Boolean.FALSE;
})
.collect(Collectors.toList());

//如果筛选出来的 为空的话 就调用状态机
if (CollUtil.isEmpty(apps)) {
stateMachineUtil.pass(project);
project.setUpdateOn(LocalDateTime.now());
projectService.updateById(project);
}
}

return body.getSuccess();
}

/**
* 查询app
*
* @param apply
* @return
* @throws NoSuchAlgorithmException
*/
public JSONObject searchApp(ApiApplyDTO apply) throws NoSuchAlgorithmException {
long timestamp = System.currentTimeMillis();
String appCode = apply.getAppId();
String requestSecret = refreshTokenService.refreshToken(searchAppKey, searchAppScret, govRequestTokenUrl, govRefreshTokenUrl, HttpMethod.POST.name());
String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp);
String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + searchAppKey + "&" +
"pageSize=10&pageNum=1&appCode=" + appCode +
"&areaCode=&deptCode=&name=";
log.info("url : {}", url);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

if (Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody())) {
JSONObject body = JSON.parseObject(forEntity.getBody());
if (Objects.isNull(body)) {
return null;
}
JSONObject datas = body.getJSONObject("datas");
if (Objects.isNull(datas)) {
return null;
}
JSONObject data = datas.getJSONObject("data");
if (Objects.isNull(data)) {
return null;
}
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult");
if (CollUtil.isEmpty(apiApplySearchResult)) {
return null;
}
return apiApplySearchResult.getJSONObject(0);
}
return null;
}

public JSONArray searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException {
long timestamp = System.currentTimeMillis();
String areaCode = StringUtils.isNotBlank(apply.getAreaCode()) ?
convertAreaCode(apply.getAreaCode()) : null;
String requestSecret = refreshTokenService.refreshToken(searchAppKey, searchAppScret, govRequestTokenUrl, govRefreshTokenUrl,
HttpMethod.POST.name());
String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp);
String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + searchAppKey + "&pageSize=1000&" +
"pageNum=1&areaCode=" + areaCode +
"&deptCode=&name=";
log.info("查询应用目录:{}", url);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

log.info("查询应用目录 : {}", forEntity.getStatusCode());

if (Objects.nonNull(forEntity.getBody())) {
JSONObject body = JSON.parseObject(forEntity.getBody());
if (Objects.isNull(body)) {
return null;
}
JSONObject datas = body.getJSONObject("datas");
if (Objects.isNull(datas)) {
return null;
}
JSONObject data = datas.getJSONObject("data");
if (Objects.isNull(data)) {
return null;
}
JSONArray apiApplySearchResult = data.getJSONArray("apiApplySearchResult");
return apiApplySearchResult;
}
return null;
}

/**
* 如果是市本级的 结尾改成01 还要转换开发区的code
*
* @param areaCode
* @return
*/
private String convertAreaCode(String areaCode) {
if (RegionConst.RC_HZ.equals(areaCode) || RegionConst.LS_KF.equals(areaCode)) {
return RegionConst.RC_LS_SBJ_IRS;
}
return areaCode;
}

public String testGuibing() throws Exception {
long timestamp = System.currentTimeMillis();
String appSecret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";
String method = "POST";
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method);
log.info("secret :{}", secret);
String sign = MD5.create().digestHex(appKey + secret + timestamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if (Objects.nonNull(factory)) {
restTemplate = new RestTemplate(factory);
} else {
restTemplate = new RestTemplate();
}
String appId = "A330000100000202105005790";
String capCode = CryptUtils.encryptHMAC(timestamp + appId, "bcb4fc0f517fc168ee543fcf4d231f3b");
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" +
"dataSharing/5crv7i4727abLCv0.htm?requestTime=" + timestamp +
"&sign=" + sign + "&appKey=" + appKey +
"&capCode=" + capCode + "&capTime=" + timestamp +
"&appId=" + appId;
log.info("url :{}", url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
return forEntity.getBody();
}

/**
* 推送项目详情
*
* @return
*/
public String pushProjectDetail(ProjectDTO projectDto) {
long timestamp = System.currentTimeMillis();
String appSecret = pushProjectAppSecret;
String appKey = pushProjectAppKey;
String method = HttpMethod.POST.name();
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method);
log.info("secret :{}", secret);
String sign = MD5.create().digestHex(appKey + secret + timestamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if (Objects.nonNull(factory)) {
restTemplate = new RestTemplate(factory);
} else {
restTemplate = new RestTemplate();
}
String baseProjPrincipal = projectDto.getResponsibleMan();//"蒋国海"
String baseProjSetYear = String.valueOf(projectDto.getProjectYear());//"2022"
String baseProjId = projectDto.getProjectCode();//"331123220130969000000"
String baseManDeprt = projectDto.getBuildOrgName();//"遂昌县大数据和金融发展中心"
String baseProjBasis = projectDto.getBaseProjBasis();//"2"
String baseLowestLevel = projectDto.getBaseLowestLevel();//"C"
String ProjPrincipalCall = projectDto.getResponsibleManMobile();//"13884366607"
//内容类别
String baseConstructionType = projectDto.getBaseConstructionType();//"01"
String baseProjType = projectDto.getBaseProjType();//"1"
String baseProjContacts = projectDto.getContactName();//"毛以林"
String isEffective = "02"; // 有效
String baseConsDeprtDing = projectDto.getBuildOrgCode();//"GO_9a7dce7fbaf54787998fa004f1b7c0e1";
String baseProjSetProg = projectDto.getBaseProjSetProg();//"04"
String baseProjContactsCall = projectDto.getContactPhone();//"13857049999"
String baseProjName = projectDto.getProjectName();//"遂昌县大数据和金融发展中心天工系统"
String baseProjConsClass = projectDto.getBaseProjConsClass();//"C"
String areaCode = projectDto.getAreaCode();//"331123000"
String baseAreaName = projectDto.getArea();//"遂昌县";
String baseManDeprtDing = projectDto.getSuperOrgCode();//"GO_9a7dce7fbaf54787998fa004f1b7c0e1";
String baseProvManDeprtDing = projectDto.getHigherSuperOrgCode();//"GO_6c383c049d95461f9a0df780140ceb32";
String baseBasisEstablish = projectDto.getBuildBasis();//"中共遂昌县委办公室关于研究开发“天工”智能化管理平台(三期)的函";
String capCode = null;
try {
capCode = CryptUtils.encryptHMAC(timestamp + areaCode, "bcb4fc0f517fc168ee543fcf4d231f3b");
} catch (Exception e) {
log.error(e.getMessage());
}

String url = pushProjectUrl + "?" +
"requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + appKey + "&baseProjPrincipal=" + baseProjPrincipal + "" +
"&baseProjSetYear=" + baseProjSetYear + "&baseProjId=" + baseProjId +
"&baseManDeprt=" + baseManDeprt + "&baseProjBasis=" + baseProjBasis +
"&baseLowestLevel=" + baseLowestLevel + "&ProjPrincipalCall=" + ProjPrincipalCall +
"&baseConstructionType=" + baseConstructionType + "&baseProjType=" + baseProjType +
"&baseProjContacts=" + baseProjContacts + "&isEffective=" + isEffective +
"&baseConsDeprtDing=" + baseConsDeprtDing + "&baseProjSetProg=" + baseProjSetProg +
"&baseProjContactsCall=" + baseProjContactsCall + "&baseProjName=" + baseProjName +
"&baseProjConsClass=" + baseProjConsClass + "&capCode=" + capCode + "&baseManDeprtDing=" + baseManDeprtDing +
"&baseProvManDeprtDing=" + baseProvManDeprtDing + "&baseBasisEstablish=" + baseBasisEstablish +
"&baseAreaCode=" + areaCode + "&capTime=" + timestamp + "&baseAreaName=" + baseAreaName;
log.info("url :{}", url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
return forEntity.getBody();
}

public JSONObject getDigitalResourceIndicatorsByAppCode(String appCode, Integer pageSize) {
long timestamp = System.currentTimeMillis();
String appSecret = driAppSecret;
String appKey = driAppKey;
String method = HttpMethod.POST.name();
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method);
log.info("secret : {}", secret);
String sign = MD5.create().digestHex(appKey + secret + timestamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if (Objects.nonNull(factory)) {
restTemplate = new RestTemplate(factory);
} else {
restTemplate = new RestTemplate();
}

String url = driUrl + "?" +
"requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + appKey + "&appCode=" + appCode + "&pageIndex=1&pageSize=" + pageSize;
log.info("url :{}", url);
ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class);
log.info(Objects.requireNonNull(forEntity.getBody()).toJSONString());
return forEntity.getBody();
}

}

+ 0
- 93
hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/ProjectIrsManage.java ファイルの表示

@@ -1,93 +0,0 @@
package com.hz.pm.api.irs.manage;

import com.alibaba.fastjson.JSONObject;
import com.ningdatech.irs.service.IRefreshTokenService;
import com.hz.pm.api.common.util.CryptUtils;
import com.hz.pm.api.common.util.HttpUtil;
import com.hz.pm.api.common.util.RefreshKeyUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.security.NoSuchAlgorithmException;
import java.util.Objects;

/**
* @Classname ProjectIrsManage
* @Description
* @Date 2023/8/15 11:43
* @Author PoffyZhang
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class ProjectIrsManage {

@Value("${irs.core-biz.appKey}")
private String appKey;

@Value("${irs.core-biz.appSecret}")
private String appSecret;

@Value("${irs.core-biz.url}")
private String coreBizUrl;

@Value("${irs.core-biz.interfaceName}")
private String interfaceName;
@Resource
private IRefreshTokenService refreshTokenService;

@Value("${irs.interface-refresh.request-token-url}")
private String govRequestTokenUrl;
@Value("${irs.interface-refresh.refresh-token-url}")
private String govRefreshTokenUrl;

/**
* 查询核心业务
*
* @param businessName
* @return
* @throws NoSuchAlgorithmException
*/
public JSONObject searchCoreBiz(String businessName,String orgCode,Integer limit,Integer page) {
long timestamp = System.currentTimeMillis();
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl,
HttpMethod.POST.name());
String sign = null;
try{
sign = CryptUtils.MD5Encode(appKey + secret + timestamp);
}catch (Exception e){
log.error(e.getMessage());
}
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if(Objects.nonNull(factory)){
restTemplate = new RestTemplate(factory);
}else{
restTemplate = new RestTemplate();
}

String url = coreBizUrl + "?" +
"dingCode=" + (StringUtils.isNotBlank(orgCode)?orgCode:StringUtils.EMPTY) +
"&matterName=" + (StringUtils.isNotBlank(businessName)?businessName:StringUtils.EMPTY) +
"&oid=&useState=1&" +
"limit=" + (Objects.isNull(limit) ? "10" : limit) + "&page=" + (Objects.isNull(page) ? "1" : page) +
"&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp;

ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class);
JSONObject body = forEntity.getBody();
log.info("core biz :{}",body);

JSONObject datas = body.getJSONObject("datas");
if(Objects.nonNull(datas)){
return datas;
}
return forEntity.getBody();
}
}

+ 0
- 50
hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProperties.java ファイルの表示

@@ -1,50 +0,0 @@
package com.hz.pm.api.meeting.entity.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
* <p>
* SystemProperties
* </p>
*
* @author WendyYang
* @since 14:39 2022/9/15
*/
@Data
@Component
public class WebProperties {

public static String expertRegistrationUrl;

public static String webUrl;

public static String apiHost;

public static String provincialUrl;

@Value("${api-host:}")
private void setApiHost(String host) {
apiHost = host;
}

@Value("${expert-registration.url:/expertEnroll}")
private void setExpertRegistrationUrl(String url) {
expertRegistrationUrl = url;
}

@Value("${web.url:}")
private void setWebUrl(String url) {
webUrl = url;
}

/**
* 省局项目管理调用跳转地址
*/
@Value("${web.provincial:}")
private void setProvincial(String provincial) {
provincialUrl = provincial;
}

}

+ 27
- 0
hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProps.java ファイルの表示

@@ -0,0 +1,27 @@
package com.hz.pm.api.meeting.entity.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
* <p>
* WebProps
* </p>
*
* @author WendyYang
* @since 14:39 2022/9/15
*/
@Data
@Component
public class WebProps {

public static String apiHost;


@Value("${api-host:}")
private void setApiHost(String host) {
apiHost = host;
}

}

+ 18
- 0
hz-pm-api/src/main/java/com/hz/pm/api/organization/constant/ProcDefCont.java ファイルの表示

@@ -0,0 +1,18 @@
package com.hz.pm.api.organization.constant;

/**
* <p>
* ProcDefCont
* </p>
*
* @author WendyYang
* @since 15:50 2024/3/29
*/
public class ProcDefCont {

private ProcDefCont() {
}

public static final String MODELS_ID_PREFIX = "pd";

}

+ 0
- 13
hz-pm-api/src/main/java/com/hz/pm/api/organization/constants/ProcDefContant.java ファイルの表示

@@ -1,13 +0,0 @@
package com.hz.pm.api.organization.constants;

/**
* @Classname ProcDefContant
* @Description
* @Date 2023/7/11 9:35
* @Author PoffyZhang
*/
public interface ProcDefContant {

public final static String MODELS_ID_PREFIX = "pd";

}

+ 0
- 7
hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/DingOrganizationController.java ファイルの表示

@@ -3,8 +3,6 @@ package com.hz.pm.api.organization.controller;

import com.hz.pm.api.organization.manage.OrganizationManage;
import com.hz.pm.api.organization.model.po.ReqOrganizationListPO;
import com.hz.pm.api.organization.model.po.ReqSynthesizePO;
import com.hz.pm.api.organization.model.vo.KeyTreeVO;
import com.hz.pm.api.organization.model.vo.OrganizationTreeVO;
import com.hz.pm.api.organization.model.vo.ResOrganizationListVO;
import com.ningdatech.basic.model.PageVo;
@@ -49,9 +47,4 @@ public class DingOrganizationController {
return organizationManage.getChildOrganizationList(parentCode, orgName, false);
}

@ApiOperation("组织树状列表筛选(前端定制化接口不可复用)")
@PostMapping("/tree-list")
public List<KeyTreeVO> treeVOList(@Valid @RequestBody ReqSynthesizePO request) {
return organizationManage.treeRubbishVOList(request);
}
}

+ 3
- 10
hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/GovBusinessStripManage.java ファイルの表示

@@ -9,7 +9,6 @@ import com.hz.pm.api.organization.model.vo.GovBusinessStripTreeVO;
import com.hz.pm.api.organization.model.vo.ProvincialGovBusinessStripVO;
import com.hz.pm.api.organization.service.IGovBusinessStripService;
import com.hz.pm.api.organization.service.IProvincialGovBusinessStripService;
import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
@@ -30,14 +29,8 @@ import java.util.stream.Collectors;
public class GovBusinessStripManage {

private final IGovBusinessStripService iGovBusinessStripService;

private final IProvincialGovBusinessStripService provincialGovBusinessStripService;

private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService;

@Value("${irs.province-gov.can-search}")
private Boolean canSearch;

public List<GovBusinessStripTreeVO> getChildOrganizationList(String parentCode) {
if (Objects.isNull(parentCode)) {
parentCode = "-1";
@@ -57,15 +50,15 @@ public class GovBusinessStripManage {

public List<ProvincialGovBusinessStripVO> getProvincialGovBusinessStripList(String businessStripName) {
List<ProvincialGovBusinessStrip> strips = provincialGovBusinessStripService.list(Wrappers.lambdaQuery(ProvincialGovBusinessStrip.class)
.like(StringUtils.isNotBlank(businessStripName),ProvincialGovBusinessStrip::getBusinessStripName,businessStripName)
.like(StringUtils.isNotBlank(businessStripName), ProvincialGovBusinessStrip::getBusinessStripName, businessStripName)
.orderByAsc(ProvincialGovBusinessStrip::getBusinessStripName));

if(CollUtil.isEmpty(strips)){
if (CollUtil.isEmpty(strips)) {
return Collections.emptyList();
}

return strips.stream()
.map(p -> BeanUtil.copyProperties(p,ProvincialGovBusinessStripVO.class))
.map(p -> BeanUtil.copyProperties(p, ProvincialGovBusinessStripVO.class))
.collect(Collectors.toList());
}
}

+ 1
- 48
hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java ファイルの表示

@@ -5,23 +5,20 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.ningdatech.basic.model.PageVo;
import com.hz.pm.api.common.config.DingOrganizationProperties;
import com.hz.pm.api.common.helper.RegionCacheHelper;
import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.ding.constants.DingOrganizationContant;
import com.hz.pm.api.fiscal.service.ICompanyFiscalCodeService;
import com.hz.pm.api.organization.model.entity.DingEmployeeInfo;
import com.hz.pm.api.organization.model.entity.DingOrganization;
import com.hz.pm.api.organization.model.po.ReqOrganizationListPO;
import com.hz.pm.api.organization.model.po.ReqSynthesizePO;
import com.hz.pm.api.organization.model.vo.KeyTreeVO;
import com.hz.pm.api.organization.model.vo.OrganizationTreeVO;
import com.hz.pm.api.organization.model.vo.ResOrganizationListVO;
import com.hz.pm.api.organization.service.IDingEmployeeInfoService;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import com.hz.pm.api.sys.model.dto.RegionDTO;
import com.ningdatech.basic.model.PageVo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
@@ -138,50 +135,6 @@ public class OrganizationManage {
}).collect(Collectors.toList());
}

public List<KeyTreeVO> treeRubbishVOList(ReqSynthesizePO request) {
String organizationCode = request.getOrganizationCode();
String organizationName = request.getOrganizationName();
String employeeName = request.getEmployeeName();
Boolean onlyUnit = request.getOnlyUnit();

// 用户搜索为特殊逻辑
if (StringUtils.isNotBlank(employeeName)) {
return treeEmployeeQuery(employeeName, organizationCode);
}

List<DingOrganization> dingOrganizationList = new ArrayList<>();
List<String> organizationCodeList = new ArrayList<>();
if (StringUtils.isNotBlank(organizationName)) {
dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.like(DingOrganization::getOrganizationName, organizationName)
.in(onlyUnit, DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE,
DingOrganizationContant.HOLLOW)));
if (dingOrganizationList.isEmpty()) {
return new ArrayList<>();
}
} else if (StrUtils.isBlank(organizationCode)) {
organizationCodeList = dingOrganizationProperties.getDeptVisibleScopes();
} else {
organizationCodeList = CollectionUtil.toList(organizationCode);
}

if (CollectionUtil.isEmpty(dingOrganizationList)) {
dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.in(DingOrganization::getOrganizationCode, organizationCodeList)
.notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION"));
}

List<KeyTreeVO> orgKeyTreeVOList = dingOrganizationList.stream().map(r -> {
KeyTreeVO keyTreeVO = new KeyTreeVO();
keyTreeVO.setTitle(r.getOrganizationName());
keyTreeVO.setKey(r.getOrganizationCode());
keyTreeVO.setType("ORGANIZATION");
return keyTreeVO;
}).collect(Collectors.toList());
treeVOList(request.getNeedMember(), orgKeyTreeVOList, onlyUnit);
return orgKeyTreeVOList;
}

public List<KeyTreeVO> treeEmployeeQuery(String employeeName, String organizationCode) {
List<String> parentCodeList = CollUtil.toList(organizationCode).stream()
.filter(StringUtils::isNotBlank)


+ 0
- 47
hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java ファイルの表示

@@ -272,53 +272,6 @@ public class IndicatorConfigManage {
}

/**
* 装配 模板详情
*
* @param templateDetails
* @return
*/
private List<ProjectTemplateDetailVO> buildTemplateDetail(List<PerformanceIndicatorProjectTemplateDetail> templateDetails) {
List<ProjectTemplateDetailVO> res = Lists.newArrayList();
//第一层是 一级的
for (PerformanceIndicatorProjectTemplateDetail templateDetailFirst : templateDetails) {
if (PerformanceTemplateTypeEnum.FIRST_INDEX.getCode().equals(templateDetailFirst.getType())) {
ProjectTemplateDetailVO detailFirstVo = BeanUtil.copyProperties(templateDetailFirst, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> firstList = Lists.newArrayList();
for (PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) {
if (Objects.nonNull(templateDetailSecond.getParentId()) &&
templateDetailSecond.getParentId().equals(templateDetailFirst.getId())) {
ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> secondList = Lists.newArrayList();
for (PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) {
if (Objects.nonNull(templateDetailThird.getParentId()) &&
templateDetailThird.getParentId().equals(templateDetailSecond.getId())) {
ProjectTemplateDetailVO detailThirdVo = BeanUtil.copyProperties(templateDetailThird, ProjectTemplateDetailVO.class);
List<ProjectTemplateDetailVO> thirdList = Lists.newArrayList();
for (PerformanceIndicatorProjectTemplateDetail templateDetailFour : templateDetails) {
if (Objects.nonNull(templateDetailFour.getParentId()) &&
templateDetailFour.getParentId().equals(templateDetailThird.getId())) {
ProjectTemplateDetailVO detailFourVo = BeanUtil.copyProperties(templateDetailFour, ProjectTemplateDetailVO.class);
thirdList.add(detailFourVo);
}
}
detailThirdVo.setChildren(thirdList);
secondList.add(detailThirdVo);
}
}
detailSecondVo.setChildren(secondList);
firstList.add(detailSecondVo);
}
}
detailFirstVo.setChildren(firstList);
res.add(detailFirstVo);

}
}
return res;
}


/**
* 删除项目模板
*
* @param id


+ 13
- 29
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java ファイルの表示

@@ -1,34 +1,33 @@
package com.hz.pm.api.projectdeclared.controller;

import javax.servlet.http.HttpServletResponse;

import com.hz.pm.api.projectdeclared.model.enumerization.ProjectDraftTypeEnum;
import com.ningdatech.log.annotation.WebLog;
import com.hz.pm.api.gov.manage.GovProjectCollectionManage;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSONObject;
import com.ningdatech.basic.model.PageVo;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage;
import com.hz.pm.api.projectdeclared.manage.ProjectAdjustmentManage;
import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectListParamDTO;
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO;
import com.hz.pm.api.projectdeclared.model.enumerization.ProjectDraftTypeEnum;
import com.hz.pm.api.projectdeclared.model.vo.ProjectDraftVO;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
* @Classname DeclaredProjectController
* @Description 申报项目
* @Date 2023/1/31 11:29
* @Author PoffyZhang
* <p>
* DeclaredProjectController
* </p>
*
* @author WendyYang
* @since 16:22 2024/3/29
*/
@Slf4j
@Validated
@@ -47,15 +46,6 @@ public class DeclaredProjectController {
return declaredProjectManage.projectLibList(req);
}

@ApiOperation(value = "核心业务列表", notes = "核心业务列表")
@GetMapping("/core-biz")
public JSONObject bizList(@RequestParam(required = false) String businessName,
@RequestParam(required = false) Integer pageSize,
@RequestParam(required = false) Integer pageNumber,
@RequestParam(required = false) String orgCode) {
return declaredProjectManage.bizList(businessName, pageSize, pageNumber, orgCode);
}

@ApiOperation(value = "申报项目草稿箱列表", notes = "申报项目草稿箱列表")
@GetMapping("/draft")
public PageVo<ProjectDraftVO> draft(@ModelAttribute DeclaredProjectListParamDTO params) {
@@ -110,10 +100,4 @@ public class DeclaredProjectController {
ExcelDownUtil.downXls(response, req, declaredProjectManage::exportList);
}

@PostMapping("/remove/{projectCode}")
@ApiOperation("申报项目删除-预审失败")
@WebLog("申报项目删除-预审失败")
public String remove(@PathVariable String projectCode) {
return declaredProjectManage.removeProject(projectCode);
}
}

+ 29
- 117
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java ファイルの表示

@@ -4,26 +4,19 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.common.util.ExcelExportStyle;
import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum;
import com.hz.pm.api.gov.manage.GovProjectCollectionManage;
import com.hz.pm.api.irs.manage.ProjectIrsManage;
import com.hz.pm.api.projectdeclared.contant.DeclaredProjectConst;
import com.hz.pm.api.projectdeclared.model.dto.*;
import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft;
import com.hz.pm.api.projectdeclared.model.enumerization.ProjectDraftTypeEnum;
@@ -55,7 +48,6 @@ import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.basic.util.StrPool;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
@@ -65,22 +57,26 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

/**
* @Classname DeclaredProjectManage
* @Description
* @Date 2023/2/1 14:48
* @Author PoffyZhang
* <p>
* DeclaredProjectManage
* </p>
*
* @author WendyYang
* @since 16:24 2024/3/29
*/
@Component
@Slf4j
@@ -88,38 +84,23 @@ import java.util.stream.Collectors;
public class DeclaredProjectManage {

private final IProjectService projectService;

private final ProjectLibManage projectLibManage;

private final IProjectDraftService projectDraftService;

private final ProcessInstanceService processService;

private final ProcessModelManage processModelManage;

private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;

private final DefaultDeclaredProjectManage declaredProjectManage;
private final NoticeManage noticeManage;

private final UserInfoHelper userInfoHelper;

private final MhUnitCache mhUnitCache;

private final ProjectIrsManage projectIrsManage;

private final GovProjectCollectionManage collectionManage;

@Value("${spring.profiles.active}")
private String active;

/**
* 新项目 启动实例
*
* @param dto
* @return
* @param req \
* @return \
*/
@Transactional(rollbackFor = Exception.class)
public synchronized String startTheProcess(DefaultDeclaredDTO dto) {
public synchronized String startTheProcess(DefaultDeclaredDTO req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS,
@@ -128,15 +109,15 @@ public class DeclaredProjectManage {
throw BizException.wrap("找不到单位流程配置");
}

ProjectDTO projectInfo = dto.getProjectInfo();
ProjectDTO projectInfo = req.getProjectInfo();

projectInfo.setBuildOrgCode(user.getMhUnitIdStr());
projectInfo.setBuildOrgName(user.getMhUnitName());

//项目名称去重
defaultDeclaredProjectManage.checkDuplication(projectInfo);
declaredProjectManage.checkDuplication(projectInfo);
//判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额
defaultDeclaredProjectManage.checkAmount(projectInfo);
declaredProjectManage.checkAmount(projectInfo);

//写死 是否有主管单位
projectInfo.setIsHigherSuperOrg(CommonEnum.YES.getCode());
@@ -156,21 +137,21 @@ public class DeclaredProjectManage {


ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(user));
params.setUser(declaredProjectManage.buildUser(user));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
BeanUtils.copyProperties(dto.getProjectInfo(), conditionDto);
dto.getFormData().putAll(
BeanUtils.copyProperties(req.getProjectInfo(), conditionDto);
req.getFormData().putAll(
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() {
})
);
params.setFormData(dto.getFormData());
params.setFormData(req.getFormData());
//开始申报
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Project project = new Project();
BeanUtils.copyProperties(projectInfo, project);
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project);
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project);
String instanceId = processService.startProcessLs(model, params, orgModelMap);
log.info("申报项目成功 【{}】", instanceId);

@@ -211,7 +192,7 @@ public class DeclaredProjectManage {
if (StringUtils.isNotBlank(projectDto.getProjectName()) &&
!projectDto.getProjectName().equals(projectInfo.getProjectName())) {
projectDto.setProjectCode(projectInfo.getProjectCode());
defaultDeclaredProjectManage.checkDuplication(projectDto);
declaredProjectManage.checkDuplication(projectDto);
}

//写死 是否有主管单位
@@ -227,7 +208,7 @@ public class DeclaredProjectManage {
}

//判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额
defaultDeclaredProjectManage.checkAmount(projectDto);
declaredProjectManage.checkAmount(projectDto);

WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS,
user.getMhUnitId());
@@ -242,16 +223,16 @@ public class DeclaredProjectManage {
.throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段");

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(user));
params.setUser(declaredProjectManage.buildUser(user));
params.setProcessUsers(Collections.emptyMap());

//把条件值给放入工作流
defaultDeclaredProjectManage.buildCondition(params, dto);
declaredProjectManage.buildCondition(params, dto);

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Project project = new Project();
BeanUtils.copyProperties(projectDto, project);
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project);
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project);
String instanceId = processService.startProcessLs(model, params, orgModelMap);
log.info("重新申报项目成功 【{}】", instanceId);

@@ -421,7 +402,7 @@ public class DeclaredProjectManage {
ExcelDownUtil.setFileName(fileName, response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class)
EasyExcelFactory.write(response.getOutputStream(), DeclaredProjectExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
@@ -431,73 +412,4 @@ public class DeclaredProjectManage {
}
}

/**
* 查询 核心业务
*
* @param businessName \
* @return \
*/
public JSONObject bizList(String businessName, Integer limit, Integer page, String orgCode) {
JSONObject jsonObject = new JSONObject();
UserInfoDetails user = LoginUserUtil.loginUserDetail();
if (BizConst.DEV.equals(active)) {
jsonObject = JSONObject.parseObject(DeclaredProjectConst.Biz.CORE_BIZ);
if (CollUtil.isEmpty(jsonObject)) {
return jsonObject;
}
if (StringUtils.isNotBlank(businessName)) {
JSONArray dataArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA);
if (CollUtil.isEmpty(dataArray)) {
return new JSONObject();
}
Iterator<Object> iter = dataArray.stream().iterator();
JSONArray dataArrayRes = new JSONArray();
while (iter.hasNext()) {
JSONObject value = (JSONObject) iter.next();
String businessValue = value.getString("matterName");
if (StringUtils.isNotBlank(businessValue) && businessValue.contains(businessName)) {
dataArrayRes.add(value);
}
}
jsonObject.put("data", dataArrayRes);
jsonObject.put("total", dataArrayRes.size());
}
} else if (BizConst.PRE.equals(active) ||
BizConst.PROD.equals(active)) {
if (StringUtils.isNotBlank(orgCode)) {
String[] orgCodes = orgCode.split(StrPool.COMMA);
JSONArray finalArray = new JSONArray();
for (String og : orgCodes) {
JSONObject res = projectIrsManage.searchCoreBiz(businessName, og, limit, page);
if (Objects.nonNull(res)) {
JSONArray dataArray = res.getJSONArray(BizConst.RESPONSE_KEY_DATA);
if (CollUtil.isNotEmpty(dataArray)) {
finalArray.addAll(dataArray);
}
}
}
jsonObject.put("data", finalArray);
jsonObject.put("total", finalArray.size());
} else {
jsonObject = projectIrsManage.searchCoreBiz(businessName, user.getMhUnitIdStr(), limit, page);
}
}
return jsonObject;
}

/**
* 预审失败的时候 可以删除项目
*
* @param projectCode \
*/
@Transactional
public String removeProject(String projectCode) {
Project project = projectService.getProjectByCode(projectCode);
Assert.notNull(project, "该项目不存在");
VUtils.isTrue(Objects.isNull(project.getStatus()) ||
!ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode().equals(project.getStatus()))
.throwMessage("不是预审不通过 状态 不能删除!");

return collectionManage.removeProject(Lists.newArrayList(projectCode));
}
}

+ 0
- 136
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/IrsManage.java ファイルの表示

@@ -1,136 +0,0 @@
package com.hz.pm.api.projectdeclared.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
import com.ningdatech.basic.util.CollUtils;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.util.CryptUtils;
import com.hz.pm.api.common.util.HttpUtil;
import com.hz.pm.api.irs.manage.AppIrsManage;
import com.hz.pm.api.irs.model.dto.ApiApplyDTO;
import com.hz.pm.api.irs.model.dto.ForwardDTO;
import com.hz.pm.api.irs.utils.RefreshTokenUtil;
import com.hz.pm.api.projectdeclared.model.entity.IrsApplication;
import com.hz.pm.api.projectdeclared.model.entity.NdPiotTasks;
import com.hz.pm.api.projectdeclared.model.vo.IrsApplicationVO;
import com.hz.pm.api.projectdeclared.model.vo.PiotTasksVO;
import com.hz.pm.api.projectdeclared.service.INdPiotTasksService;
import com.hz.pm.api.projectdeclared.service.IrsApplicationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import java.security.NoSuchAlgorithmException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* @Classname IrsManage
* @Description
* @Date 2023/3/1 14:48
* @Author PoffyZhang
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class IrsManage {

@Value("${irs.is-search-app}")
private Boolean isSearchApp;

private final IrsApplicationService irsApplicationService;

private final INdPiotTasksService piotTasksService;

private final AppIrsManage appIrsManage;


public List<IrsApplicationVO> applicationList(String areaCode) {
//不请求IRS
if(!isSearchApp) {
List<IrsApplication> list = irsApplicationService.list();
if(CollUtil.isEmpty(list)){
return Collections.emptyList();
}
return CollUtils.convert(list,app -> BeanUtil.copyProperties(app,IrsApplicationVO.class));
}

try {
ApiApplyDTO apiApplay = new ApiApplyDTO();
apiApplay.setAreaCode(areaCode);
JSONArray jsonArray = appIrsManage.searchApps(apiApplay);
if(CollUtil.isNotEmpty(jsonArray)){
return jsonArray.stream().map(apply -> {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(apply));
IrsApplicationVO vo = new IrsApplicationVO();
vo.setApplicationCode(jsonObject.getString("appId"));
vo.setApplicationName(jsonObject.getString("name"));
return vo;
}).collect(Collectors.toList());
}
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
return Collections.emptyList();
}

public List<PiotTasksVO> listPiotTasks() {
List<NdPiotTasks> list = piotTasksService.list();
if(CollUtil.isEmpty(list)){
return Collections.emptyList();
}
return CollUtils.convert(list,task -> BeanUtil.copyProperties(task,PiotTasksVO.class));
}

public String getCreditCode() throws NoSuchAlgorithmException {
String appSecret = RefreshTokenUtil.refrshByAppScret();
String appkey = "8fb070a1f1194b2ebffdc6f596bb8a96";
String dataName = "丽水市大数据";
long timestamp = System.currentTimeMillis();
String sign = CryptUtils.MD5Encode(appkey + appSecret + timestamp);
String url = "https://interface.ls.local/a/api/shared/1689239219101?data_name=" + dataName + "&appKey=" + appkey +
"&sign=" + sign + "&requestTime=" + timestamp;
RestTemplate restTemplate = new RestTemplate(HttpUtil.generateHttpRequestFactory());
log.info("url:" + url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
return forEntity.getBody();
}

/**
* 转发IRS请求
* @param dto
* @return
*/
public String forward(ForwardDTO dto) {
try{
String url = dto.getUrl();
url = url + "?" + asUrlParams(dto.getData());
log.info("url :{}",url);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());
return forEntity.getBody();
}catch (Exception e){
log.error("e:" + e);
}
return BizConst.OP_FAIL;
}

public static String asUrlParams(Map<String, Object> source){
return Joiner.on("&")
// 用指定符号代替空值,key 或者value 为null都会被替换
.useForNull("")
.withKeyValueSeparator("=")
.join(source);
}
}

+ 4
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseService.java ファイルの表示

@@ -1,7 +1,6 @@
package com.hz.pm.api.projectdeclared.service;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -9,7 +8,10 @@ import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum;
import com.ningdatech.basic.util.CollUtils;

import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**


+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java ファイルの表示

@@ -53,13 +53,13 @@ import java.util.stream.Collectors;
@Slf4j
public class ApplicationManage {

@Value("${irs.app-report.url}")
@Value("${irs.app-report.url:}")
private String url;

@Value("${irs.app-report.appKey}")
@Value("${irs.app-report.appKey:}")
private String appKey;

@Value("${irs.app-report.appScret}")
@Value("${irs.app-report.appScret:}")
private String appScret;

private final IProjectApplicationService applicationService;


+ 6
- 6
hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java ファイルの表示

@@ -54,21 +54,21 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc
@Resource
private IRefreshTokenService refreshTokenService;

@Value("${irs.interface-refresh.request-token-url}")
@Value("${irs.interface-refresh.request-token-url:}")
private String govRequestTokenUrl;
@Value("${irs.interface-refresh.refresh-token-url}")
@Value("${irs.interface-refresh.refresh-token-url:}")
private String govRefreshTokenUrl;

@Value("${irs.province-gov.url}")
@Value("${irs.province-gov.url:}")
private String govUrl;

@Value("${irs.province-gov.appSecret}")
@Value("${irs.province-gov.appSecret:}")
private String govAppSecret;

@Value("${irs.province-gov.appKey}")
@Value("${irs.province-gov.appKey:}")
private String govAppKey;

@Value("${irs.province-gov.interfaceName}")
@Value("${irs.province-gov.interfaceName:}")
private String interfaceName;

/**


+ 0
- 61
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateEmployeeTask.java ファイルの表示

@@ -1,61 +0,0 @@
package com.hz.pm.api.scheduler.task;

import cn.hutool.core.date.StopWatch;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hz.pm.api.ding.constants.DingOrganizationContant;
import com.hz.pm.api.ding.task.EmployeeBatchGetTask;
import com.hz.pm.api.organization.model.entity.DingOrganization;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;

/**
* @author liuxinxin
* @date 2023/1/12 上午9:53
* 批量获取/更新部门信息任务
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class BatchUpdateEmployeeTask {

@Value("${hostname}")
private String HOST_NAME;

private final EmployeeBatchGetTask employeeBatchGetTask;
private final IDingOrganizationService organizationService;

//@Scheduled(cron = "0 45 1 * * ?")
public void doTask() throws UnknownHostException {
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) {
return;
}

log.info("=========== 每日更新 浙政钉员工信息 (根据现有单位) ======== 任务开始");
StopWatch stopWatch = new StopWatch();
stopWatch.start();
// 1.查出浙政钉 所有单位
List<DingOrganization> units = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.in(DingOrganization::getTypeCode, Lists.newArrayList(
DingOrganizationContant.UNIT_TYPE,DingOrganizationContant.GOV_TEMPORARY
)));

log.info("需要更新的 单位数量为 {}",units.size());

for(DingOrganization organization : units){
log.info("当前单位是 {}",organization.getOrganizationName());
employeeBatchGetTask.batchGetEmployeeTaskByOrdCode(organization.getOrganizationCode());
}

stopWatch.stop();
log.info("=========== 每日更新 浙政钉员工信息 (根据现有单位) ======== 任务结束 {}s", stopWatch.getTotalTimeSeconds());
}

}

+ 0
- 14
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateOrganizationTask.java ファイルの表示

@@ -1,14 +0,0 @@
package com.hz.pm.api.scheduler.task;

import org.springframework.stereotype.Component;

/**
* @author liuxinxin
* @date 2023/1/12 上午9:53
* 批量获取/更新部门信息任务
*/
@Component
public class BatchUpdateOrganizationTask {


}

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java ファイルの表示

@@ -44,7 +44,7 @@ public class CheckProvincialReviewResultTask {
private final IProjectService projectService;
private final StateMachineUtil stateMachineUtil;

@Value("${hostname}")
@Value("${hostname:}")
private String HOST_NAME;

@Value("${spring.profiles.active}")


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java ファイルの表示

@@ -64,7 +64,7 @@ import java.util.stream.Stream;
@RequiredArgsConstructor
public class CockpitStatsStatisticsTask {

@Value("${hostname}")
@Value("${hostname:}")
public String HOST;

@Value("${spring.profiles.active}")


+ 1
- 3
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java ファイルの表示

@@ -56,7 +56,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class EarlyWarningInstanceNotStartTask {

@Value("${hostname}")
@Value("${hostname:}")
private String HOST_NAME;

private final IEarlyWarningService earlyWarningService;
@@ -65,8 +65,6 @@ public class EarlyWarningInstanceNotStartTask {

private final EarlyWarningManage earlyWarningManage;

private final IContractService contractService;

private final IOperationService operationService;

private final IUserInfoService userInfoService;


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningProjectTask.java ファイルの表示

@@ -55,7 +55,7 @@ public class EarlyWarningProjectTask {

private final TaskService taskService;

@Value("${hostname}")
@Value("${hostname:}")
private String HOST_NAME;

@Scheduled(fixedDelay = 6000 * 120)


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java ファイルの表示

@@ -37,7 +37,7 @@ public class ProjectStatusFlowTask {

private final IProjectService projectService;
@Value("${hostname}")
@Value("${hostname:}")
private String HOST_NAME;

@Scheduled(cron = "0 */1 * * * ?")


+ 0
- 475
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCollectionTask.java ファイルの表示

@@ -1,475 +0,0 @@
package com.hz.pm.api.scheduler.task;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.StopWatch;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.file.service.FileService;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.gov.manage.GovProjectCollectionManage;
import com.hz.pm.api.gov.model.entity.*;
import com.hz.pm.api.gov.model.vo.GovBizProjectDetailVO;
import com.hz.pm.api.gov.model.vo.GovBizProjectListVO;
import com.hz.pm.api.gov.model.vo.GovOperationProjectBaseinfoVO;
import com.hz.pm.api.gov.model.vo.GovOperationProjectDetailVO;
import com.hz.pm.api.gov.service.*;
import com.hz.pm.api.gov.utils.ProjectConvertUtil;
import com.hz.pm.api.projectlib.manage.ProjectLibManage;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO;
import com.hz.pm.api.projectlib.service.IProjectService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

/**
* @author ZPF
* @since 2023/08/31 18:16
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class SynProjectCollectionTask {

@Value("${hostname}")
public String HOST;

@Value("${spring.profiles.active}")
public String active;


private final GovProjectCollectionManage collectionManage;
private final IGovBizProjectBaseinfoService baseinfoService;
private final IGovBizProjectApplyService applyService;
private final IGovBizProjectApproveService approveService;
private final IGovBizProjectCimplementService cimplementService;
private final IGovBizProjectMimplementService mimplementService;
private final IGovBizProjectProcureService procureService;
private final IProjectService projectService;
private final ProjectLibManage projectLibManage;
private final FileService fileService;

private static final Integer PAGE_NUMBER = 1;


/**
* 前置机每天晚上10点自动清空,第二天早上6点获取数据
* 定时同步前置机数据 每天1点开始执行一次
*/
@Scheduled(cron = "0 0 1 * * ?")
public void doTask() throws UnknownHostException {
if (!HOST.equals(InetAddress.getLocalHost().getHostName())) {
log.info("定时器没开启或者host不对! {}:{}",
HOST, InetAddress.getLocalHost().getHostName());
return;
}
if (BizConst.PRE.equals(active)) {
log.info("预发环境不用同步!");
return;
}

StopWatch stopWatch = new StopWatch();
stopWatch.start();

log.info("数据同步任务开始之前 先删除前置机上的所有数据");
collectionManage.deleteAll();

//全量项目归集
ProjectListReq req = new ProjectListReq();
Long count = collectionManage.count(req) + collectionManage.operationCount(req);
if (count == 0L) {
log.info("本次同步无数据");
return;
}
req.setPageNumber(PAGE_NUMBER);
req.setPageSize(count.intValue());
PageVo<GovBizProjectListVO> projectCollectionPage = collectionManage.list(req);

log.info("projectCollections size :{}", projectCollectionPage.getTotal());

for (GovBizProjectListVO vo : projectCollectionPage.getRecords()) {
GovBizProjectDetailVO projectDetail = collectionManage.detail(vo.getBaseProjId());
collectionManage.pushProjectVo(projectDetail);
}

//2.运维备案项目
PageVo<GovBizProjectListVO> operationList = collectionManage.operationList(req);
log.info("operation list size :{}", operationList.getTotal());
for (GovBizProjectListVO vo : operationList.getRecords()) {
GovOperationProjectDetailVO operationDetail = collectionManage.operationDetail(vo.getBaseProjId());
GovOperationProjectBaseinfoVO baseinfo = operationDetail.getBaseinfo();
if (Objects.isNull(baseinfo) || Objects.isNull(baseinfo.getPush()) ||
Boolean.FALSE.equals(baseinfo.getPush())) {
log.info("此运维项目不用推送:" + vo.getBaseProjId());
}
collectionManage.pushProjectVo(operationDetail);
}

//3.申报项目 需要推送的项目
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getPush, Boolean.TRUE));
log.info("projects need push size :{}", projects.size());
for (Project project : projects) {
ProjectDetailVO projectDetailVO = projectLibManage.detailProjectCode(project.getProjectCode());
GovBizProjectDetailVO vo = ProjectConvertUtil.declaredToCollection(projectDetailVO, fileService);
if (Objects.nonNull(vo)) {
collectionManage.pushProjectVo(vo);
}
}

stopWatch.stop();
log.info("数据同步任务结束====={}s", stopWatch.getTotalTimeSeconds());
}

/**
* 把库存的项目归集里 没有转换PDF文件的 都转换一遍 存入数据库
*/
public void stagingConvertPdf(String projId) {
log.info("项目归集库存转换PDF任务开始=====");
StopWatch stopWatch = new StopWatch();
stopWatch.start();

GovBizProjectBaseinfo base = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjId, projId));
if (Objects.nonNull(base)) {
//开始转换PDF
convertPdfVo(projId);
}

stopWatch.stop();
log.info("项目归集库存转换PDF任务结束====={}s", stopWatch.getTotalTimeSeconds());
}

public void stagingConvertPdf2(String projId) {
log.info("项目归集库存转换PDF任务2开始=====");
StopWatch stopWatch = new StopWatch();
stopWatch.start();
ProjectListReq req = new ProjectListReq();
req.setPageNumber(1);
req.setPageSize(BizConst.MAX_EXPORT_COUNT);
List<GovBizProjectApprove> projects = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getDeleted, Boolean.FALSE)
.eq(StringUtils.isNotBlank(projId), GovBizProjectApprove::getBaseProjId, projId)
.isNotNull(GovBizProjectApprove::getApprovalFile)
.isNull(GovBizProjectApprove::getApprovalFilePdf));

if (CollUtil.isEmpty(projects)) {
log.info("没有项目归集 任务终止");
return;
}

for (GovBizProjectApprove project : projects) {
String baseProjId = project.getBaseProjId();
//开始转换PDF
GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
if (Objects.isNull(approve)) {
return;
}
if (StringUtils.isBlank(approve.getApprovalFilePdf()) && StringUtils.isNotBlank(approve.getApprovalFile())) {
StringJoiner sj = collectionManage.convertAndUpload(approve.getApprovalFile());
approve.setApprovalFilePdf(sj.toString());
}
}

stopWatch.stop();
log.info("项目归集库存转换PDF任务2结束====={}s", stopWatch.getTotalTimeSeconds());
}

public void stagingConvertPdf3(String projId) {
log.info("项目归集库存转换PDF任务3开始=====");

StopWatch stopWatch = new StopWatch();
stopWatch.start();
ProjectListReq req = new ProjectListReq();
req.setPageNumber(1);
req.setPageSize(BizConst.MAX_EXPORT_COUNT);
List<GovBizProjectApprove> approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getDeleted, Boolean.FALSE)
.eq(StringUtils.isNotBlank(projId), GovBizProjectApprove::getBaseProjId, projId)
.isNotNull(GovBizProjectApprove::getApprovalFile)
.isNull(GovBizProjectApprove::getApprovalFilePdf));

if (CollUtil.isEmpty(approves)) {
log.info("没有项目归集 审批信息 立项文件 任务终止");
return;
}

for (GovBizProjectApprove approve : approves) {
//开始转换PDF
convertPdfVo(approve.getBaseProjId());
}

stopWatch.stop();
log.info("项目归集库存转换PDF任务3结束====={}s", stopWatch.getTotalTimeSeconds());
}

//开始转换PDF
private void convertPdfVo(String baseProjId) {
convertPdfApply(baseProjId);
convertPdfApprove(baseProjId);
convertPdfCimplement(baseProjId);
convertPdfMimplement(baseProjId);
convertPdfAProcure(baseProjId);
}

private void convertPdfApply(String baseProjId) {
GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
if (Objects.isNull(apply)) {
return;
}
if (StringUtils.isBlank(apply.getBaseProjApplyFilePdf()) && StringUtils.isNotBlank(apply.getBaseProjApplyFile())) {
StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseProjApplyFile());
apply.setBaseProjApplyFilePdf(sj.toString());
}
if (StringUtils.isBlank(apply.getBaseProjBasisFilePdf()) && StringUtils.isNotBlank(apply.getBaseProjBasisFile())) {
StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseProjBasisFile());
apply.setBaseProjBasisFilePdf(sj.toString());
}
if (StringUtils.isBlank(apply.getBaseProjOtherFilePdf()) && StringUtils.isNotBlank(apply.getBaseProjOtherFile())) {
StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseProjOtherFile());
apply.setBaseProjOtherFilePdf(sj.toString());
}
if (StringUtils.isBlank(apply.getBaseResearchReportFilePdf()) && StringUtils.isNotBlank(apply.getBaseResearchReportFile())) {
StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseResearchReportFile());
apply.setBaseResearchReportFilePdf(sj.toString());
}
if (StringUtils.isBlank(apply.getBaseOperatMaintenFilePdf()) && StringUtils.isNotBlank(apply.getBaseOperatMaintenFile())) {
StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseOperatMaintenFile());
apply.setBaseOperatMaintenFilePdf(sj.toString());
}
applyService.updateById(apply);
}

private void convertPdfApprove(String baseProjId) {
GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
if (Objects.isNull(approve)) {
return;
}
if (StringUtils.isBlank(approve.getApprovalFilePdf()) && StringUtils.isNotBlank(approve.getApprovalFile())) {
StringJoiner sj = collectionManage.convertAndUpload(approve.getApprovalFile());
approve.setApprovalFilePdf(sj.toString());
}
if (StringUtils.isBlank(approve.getPreliminaryDesignFilePdf()) && StringUtils.isNotBlank(approve.getPreliminaryDesignFile())) {
StringJoiner sj = collectionManage.convertAndUpload(approve.getPreliminaryDesignFile());
approve.setPreliminaryDesignFilePdf(sj.toString());
}
if (StringUtils.isBlank(approve.getBaseReviewCommentsFilePdf()) && StringUtils.isNotBlank(approve.getBaseReviewCommentsFile())) {
StringJoiner sj = collectionManage.convertAndUpload(approve.getBaseReviewCommentsFile());
approve.setBaseReviewCommentsFilePdf(sj.toString());
}
approveService.updateById(approve);
}

private void convertPdfCimplement(String baseProjId) {
GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
if (Objects.isNull(cimplement)) {
return;
}
if (StringUtils.isBlank(cimplement.getBaseCheckFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseCheckFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseCheckFile());
cimplement.setBaseCheckFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseChanFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseChanFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseChanFile());
cimplement.setBaseChanFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseChangeFormFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseChangeFormFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseChangeFormFile());
cimplement.setBaseChangeFormFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseUserConsFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseUserConsFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseUserConsFile());
cimplement.setBaseUserConsFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseEstaSummFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseEstaSummFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseEstaSummFile());
cimplement.setBaseEstaSummFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseEngineerPostpoFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseEngineerPostpoFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseEngineerPostpoFile());
cimplement.setBaseEngineerPostpoFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBasePasswAssessFilePdf()) && StringUtils.isNotBlank(cimplement.getBasePasswAssessFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBasePasswAssessFile());
cimplement.setBasePasswAssessFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseThirdAcceptFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseThirdAcceptFile());
cimplement.setBaseThirdAcceptFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseFinanlAuditFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseFinanlAuditFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseFinanlAuditFile());
cimplement.setBaseFinanlAuditFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseInitialOpinionFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseInitialOpinionFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseInitialOpinionFile());
cimplement.setBaseInitialOpinionFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseThirdAcceptFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseThirdAcceptFile());
cimplement.setBaseThirdAcceptFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseSummReportFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseSummReportFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseSummReportFile());
cimplement.setBaseSummReportFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseFinalExpertOpinionFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseFinalExpertOpinionFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseFinalExpertOpinionFile());
cimplement.setBaseFinalExpertOpinionFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseIrsTestRunFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseIrsTestRunFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseIrsTestRunFile());
cimplement.setBaseIrsTestRunFilePdf(sj.toString());
}
if (StringUtils.isBlank(cimplement.getBaseInforLevelFilePdf()) && StringUtils.isNotBlank(cimplement.getBaseInforLevelFile())) {
StringJoiner sj = collectionManage.convertAndUpload(cimplement.getBaseInforLevelFile());
cimplement.setBaseInforLevelFilePdf(sj.toString());
}
cimplementService.updateById(cimplement);
}

private void convertPdfMimplement(String baseProjId) {
GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId, baseProjId)
.last(BizConst.LIMIT_1));
if (Objects.isNull(mimplement)) {
return;
}
if (StringUtils.isBlank(mimplement.getBaseChanFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseChanFile())) {
StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseChanFile());
mimplement.setBaseChanFilePdf(sj.toString());
}
if (StringUtils.isBlank(mimplement.getBaseUserConsFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseUserConsFile())) {
StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseUserConsFile());
mimplement.setBaseUserConsFilePdf(sj.toString());
}
if (StringUtils.isBlank(mimplement.getBaseEstaSummFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseEstaSummFile())) {
StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseEstaSummFile());
mimplement.setBaseEstaSummFilePdf(sj.toString());
}
if (StringUtils.isBlank(mimplement.getBaseEngineerPostpoFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseEngineerPostpoFile())) {
StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseEngineerPostpoFile());
mimplement.setBaseEngineerPostpoFilePdf(sj.toString());
}
if (StringUtils.isBlank(mimplement.getBasePasswAssessFilePdf()) && StringUtils.isNotBlank(mimplement.getBasePasswAssessFile())) {
StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBasePasswAssessFile());
mimplement.setBasePasswAssessFilePdf(sj.toString());
}
if (StringUtils.isBlank(mimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseThirdAcceptFile())) {
StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseThirdAcceptFile());
mimplement.setBaseThirdAcceptFilePdf(sj.toString());
}
if (StringUtils.isBlank(mimplement.getBaseThirdAcceptFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseThirdAcceptFile())) {
StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseThirdAcceptFile());
mimplement.setBaseThirdAcceptFilePdf(sj.toString());
}
if (StringUtils.isBlank(mimplement.getBaseFinalExpertOpinionFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseFinalExpertOpinionFile())) {
StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseFinalExpertOpinionFile());
mimplement.setBaseFinalExpertOpinionFilePdf(sj.toString());
}
if (StringUtils.isBlank(mimplement.getBaseEngineerAlterFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseEngineerAlterFile())) {
StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseEngineerAlterFile());
mimplement.setBaseEngineerAlterFilePdf(sj.toString());
}
if (StringUtils.isBlank(mimplement.getBaseOperatMaintenSummFilePdf()) && StringUtils.isNotBlank(mimplement.getBaseOperatMaintenSummFile())) {
StringJoiner sj = collectionManage.convertAndUpload(mimplement.getBaseOperatMaintenSummFile());
mimplement.setBaseOperatMaintenSummFilePdf(sj.toString());
}
mimplementService.updateById(mimplement);
}

private void convertPdfAProcure(String baseProjId) {
List<GovBizProjectProcure> procures = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId, baseProjId));
for (GovBizProjectProcure procure : procures) {
if (StringUtils.isBlank(procure.getPurchaseContractPdf()) && StringUtils.isNotBlank(procure.getPurchaseContract())) {
StringJoiner sj = collectionManage.convertAndUpload(procure.getPurchaseContract());
procure.setPurchaseContractPdf(sj.toString());
}
if (StringUtils.isBlank(procure.getPurchaseFilePdf()) && StringUtils.isNotBlank(procure.getPurchaseFile())) {
StringJoiner sj = collectionManage.convertAndUpload(procure.getPurchaseFile());
procure.setPurchaseFilePdf(sj.toString());
}
if (StringUtils.isBlank(procure.getBiddingFilePdf()) && StringUtils.isNotBlank(procure.getBiddingFile())) {
StringJoiner sj = collectionManage.convertAndUpload(procure.getBiddingFile());
procure.setBiddingFilePdf(sj.toString());
}
procureService.updateById(procure);
}
}

public void doTaskSingle(List<String> projectCodes) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();

log.info("数据同步任务 指定项目编号 :{}", projectCodes);

if (CollUtil.isEmpty(projectCodes)) {
throw new BizException("不能为空!");
}

//全量项目归集
ProjectListReq req = new ProjectListReq();
req.setPageNumber(PAGE_NUMBER);
req.setPageSize(1000);
PageVo<GovBizProjectListVO> projectCollectionPage = collectionManage.list(req);

log.info("projectCollections size :{}", projectCollectionPage.getTotal());

for (GovBizProjectListVO vo : projectCollectionPage.getRecords()) {
GovBizProjectDetailVO projectDetail = collectionManage.detail(vo.getBaseProjId());
collectionManage.pushProjectVo(projectDetail);
}

//2.运维备案项目
PageVo<GovBizProjectListVO> operationList = collectionManage.operationList(req);
log.info("operation list size :{}", operationList.getTotal());
for (GovBizProjectListVO vo : operationList.getRecords()) {
GovOperationProjectDetailVO operationDetail = collectionManage.operationDetail(vo.getBaseProjId());
GovOperationProjectBaseinfoVO baseinfo = operationDetail.getBaseinfo();
if (Objects.isNull(baseinfo) || Objects.isNull(baseinfo.getPush()) ||
Boolean.FALSE.equals(baseinfo.getPush())) {
log.info("此运维项目不用推送:" + vo.getBaseProjId());
}
collectionManage.pushProjectVo(operationDetail);
}

//3.申报项目 需要推送的项目
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getPush, Boolean.TRUE)
.in(Project::getProjectCode, projectCodes));
log.info("projects need push size :{}", projects.size());
for (Project project : projects) {
ProjectDetailVO projectDetailVO = projectLibManage.detailProjectCode(project.getProjectCode());
GovBizProjectDetailVO vo = ProjectConvertUtil.declaredToCollection(projectDetailVO, fileService);
if (Objects.nonNull(vo)) {
collectionManage.pushProjectVo(vo);
}
}

stopWatch.stop();
log.info("数据同步任务 指定项目编号 结束====={}s", stopWatch.getTotalTimeSeconds());
}
}

+ 0
- 250
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCoreBizTask.java ファイルの表示

@@ -1,250 +0,0 @@
package com.hz.pm.api.scheduler.task;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.StopWatch;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.ningdatech.basic.model.GenericResult;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.ding.constants.DingOrganizationContant;
import com.hz.pm.api.irs.manage.ProjectIrsManage;
import com.hz.pm.api.irs.model.entity.ProjectCoreBiz;
import com.hz.pm.api.irs.service.IProjectCoreBizService;
import com.hz.pm.api.organization.model.entity.DingOrganization;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import com.hz.pm.api.projectdeclared.contant.ProjectCodeCont;
import com.ningdatech.zwdd.client.ZwddClient;
import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @author ZPF
* @since 2023/09/13 18:16
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class SynProjectCoreBizTask {

@Value("${hostname}")
public String HOST;

@Value("${spring.profiles.active}")
public String active;

@Autowired
private IProjectCoreBizService projectCoreBizService;

@Autowired
private IDingOrganizationService organizationService;

@Autowired
private ZwddClient zwddClient;

@Autowired
private ProjectIrsManage projectIrsManage;

private final Integer MAX_PAGE_SIZE = 1000;

/**
* 前置机每天晚上10点自动清空,第二天早上6点获取数据
* 定时同步前置机数据 每天1点开始执行一次 不按照单位
*
*/
// @Scheduled(cron = "0 0 2 * * ?")
public void doTask() throws UnknownHostException {
if (!HOST.equals(InetAddress.getLocalHost().getHostName())) {
log.info("定时器没开启或者host不对! {}:{}",
HOST,InetAddress.getLocalHost().getHostName());
return;
}

log.info("同步项目核心业务开始=====");
StopWatch stopWatch = new StopWatch();
stopWatch.start();

List<DingOrganization> orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE
, DingOrganizationContant.GOV_TEMPORARY)));

log.info("总共需要同步 orgs size :{}",orgs.size());

syncCoreBiz(orgs);
stopWatch.stop();
log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds());
}

public void doTask(String orgCode) throws UnknownHostException {
log.info("同步项目核心业务开始=====");
StopWatch stopWatch = new StopWatch();
stopWatch.start();

List<DingOrganization> orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class)
.in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE
, DingOrganizationContant.GOV_TEMPORARY))
.eq(StringUtils.isNotBlank(orgCode),DingOrganization::getOrganizationCode,orgCode));

log.info("总共需要同步 orgs size :{}",orgs.size());

syncCoreBiz(orgs);

stopWatch.stop();
log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds());
}

private void syncCoreBiz(List<DingOrganization> orgs) {
for(DingOrganization organization : orgs){
GenericResult<DingOrgInfoDTO> dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode());

log.info("core biz result : {}",JSON.toJSONString(dingResult));

if(dingResult.isSuccess()){
DingOrgInfoDTO data = dingResult.getData();
String unifiedSocialCreditCode = data.getUnifiedSocialCreditCode();
if(StringUtils.isNotBlank(unifiedSocialCreditCode)){
organization.setUnifiedSocialCreditCode(unifiedSocialCreditCode);
organizationService.updateById(organization);
}

//去请求IRS接口
JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, organization.getOrganizationCode(), 1000, 1);

JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA);
if(CollUtil.isNotEmpty(jsonArray)){
jsonArray.forEach(j -> {
JSONObject jsonData = JSON.parseObject(JSON.toJSONString(j));
ProjectCoreBiz coreBiz = new ProjectCoreBiz();
//
Long irsId = jsonData.getLong(BizConst.RESPONSE_KEY_ID);
String dingCode = jsonData.getString(BizConst.RESPONSE_KEY_DING_CODE);
String matterName = jsonData.getString(BizConst.RESPONSE_KEY_MATTER_NAME);
String orgName = jsonData.getString(BizConst.RESPONSE_KEY_ORG_NAME);
String userState = jsonData.getString(BizConst.RESPONSE_KEY_USER_STATE);
String areaName = jsonData.getString(BizConst.RESPONSE_KEY_AREA_NAME);
ProjectCoreBiz old = projectCoreBizService.getOne(Wrappers.lambdaQuery(ProjectCoreBiz.class)
.eq(ProjectCoreBiz::getIrsId, irsId)
.last(BizConst.LIMIT_1));

if(Objects.nonNull(old)){
coreBiz.setId(old.getId());
}else{
coreBiz.setCreateOn(LocalDateTime.now());
}
coreBiz.setUpdateOn(LocalDateTime.now());
coreBiz.setIrsId(irsId);
coreBiz.setMatterName(matterName);
coreBiz.setOrgCode(dingCode);
coreBiz.setOrgName(orgName);
coreBiz.setUserState(userState);
coreBiz.setAreaName(areaName);
coreBiz.setMatterCode(irsId.toString());
projectCoreBizService.saveOrUpdate(coreBiz);
coreBiz.setMatterCode(genirate(unifiedSocialCreditCode,coreBiz.getId()));
projectCoreBizService.updateById(coreBiz);
});
}
}
}
}

private void syncCoreBiz() {
Map<String,DingOrganization> map = organizationService.list().stream().distinct().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o));

Integer currentSize = MAX_PAGE_SIZE;
Integer page = 1;
while (currentSize.equals(MAX_PAGE_SIZE)) {
//去请求IRS接口
JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, null, MAX_PAGE_SIZE, page);

JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA);

if(Objects.isNull(jsonArray)){
return;
}

currentSize = jsonArray.size();
if (CollUtil.isNotEmpty(jsonArray)) {
if (currentSize.equals(MAX_PAGE_SIZE)) {
page++;
}
jsonArray.forEach(j -> {
JSONObject jsonData = JSON.parseObject(JSON.toJSONString(j));
ProjectCoreBiz coreBiz = new ProjectCoreBiz();
//
Long irsId = jsonData.getLong(BizConst.RESPONSE_KEY_ID);
String dingCode = jsonData.getString(BizConst.RESPONSE_KEY_DING_CODE);
String matterName = jsonData.getString(BizConst.RESPONSE_KEY_MATTER_NAME);
String orgName = jsonData.getString(BizConst.RESPONSE_KEY_ORG_NAME);
String userState = jsonData.getString(BizConst.RESPONSE_KEY_USER_STATE);
String areaName = jsonData.getString(BizConst.RESPONSE_KEY_AREA_NAME);
ProjectCoreBiz old = projectCoreBizService.getOne(Wrappers.lambdaQuery(ProjectCoreBiz.class)
.eq(ProjectCoreBiz::getIrsId, irsId)
.last(BizConst.LIMIT_1));

if (Objects.nonNull(old)) {
coreBiz.setId(old.getId());
} else {
coreBiz.setCreateOn(LocalDateTime.now());
}

if(map.containsKey(dingCode)){
DingOrganization organization = map.get(dingCode);

String unifiedSocialCreditCode = organization.getUnifiedSocialCreditCode();
if(StringUtils.isBlank(unifiedSocialCreditCode)){
GenericResult<DingOrgInfoDTO> dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode());

log.info("ding org result : {}",JSON.toJSONString(dingResult));

if(dingResult.isSuccess()){
DingOrgInfoDTO data = dingResult.getData();
unifiedSocialCreditCode = data.getUnifiedSocialCreditCode();
organization.setUnifiedSocialCreditCode(unifiedSocialCreditCode);
organizationService.updateById(organization);
}
}

coreBiz.setUpdateOn(LocalDateTime.now());
coreBiz.setIrsId(irsId);
coreBiz.setMatterName(matterName);
coreBiz.setOrgCode(dingCode);
coreBiz.setOrgName(orgName);
coreBiz.setUserState(userState);
coreBiz.setAreaName(areaName);
coreBiz.setMatterCode(irsId.toString());
projectCoreBizService.saveOrUpdate(coreBiz);
coreBiz.setMatterCode(genirate(unifiedSocialCreditCode, coreBiz.getId()));
projectCoreBizService.updateById(coreBiz);
}
});
}
}
}

/**
* 生成 编号
* @param unifiedSocialCreditCode
* @param id
* @return
*/
private String genirate(String unifiedSocialCreditCode, Long id) {
String formatId = String.format(ProjectCodeCont.SHUZI_4, id);
return unifiedSocialCreditCode + formatId;
}

}

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProvinceOrgTask.java ファイルの表示

@@ -28,7 +28,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class SynProvinceOrgTask {

@Value("${hostname}")
@Value("${hostname:}")
public String HOST;

@Value("${spring.profiles.active}")


+ 11
- 10
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/WorkNoticeFlowTask.java ファイルの表示

@@ -4,6 +4,7 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.LocalDateTime;
import java.util.List;

import com.ningdatech.basic.model.GenericResult;
import com.hz.pm.api.staging.model.entity.WorkNoticeStaging;
import com.hz.pm.api.staging.service.INdWorkNoticeStagingService;
@@ -25,7 +26,7 @@ import lombok.extern.slf4j.Slf4j;

/**
* 发送工作通知定时任务
* @return
*
* @author CMM
* @since 2023/02/28 21:23
*/
@@ -37,7 +38,7 @@ public class WorkNoticeFlowTask {
private final INdWorkNoticeStagingService workNoticeStagingService;
private final ZwddClient zwddClient;

@Value("${hostname}")
@Value("${hostname:}")
private String HOST_NAME;

@Scheduled(cron = "0 */1 * * * ?")
@@ -51,27 +52,27 @@ public class WorkNoticeFlowTask {
.le(WorkNoticeStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES)
.orderByAsc(WorkNoticeStaging::getId));

log.info("需要发送的工作通知 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList));
if(CollUtil.isEmpty(stagingList)){
log.info("需要发送的工作通知 size:{} :{}", stagingList.size(), JSON.toJSONString(stagingList));
if (CollUtil.isEmpty(stagingList)) {
log.info("没有需要发送的工作通知!");
return;
}
//遍历
for(WorkNoticeStaging workNoticeStaging : stagingList){
try{
for (WorkNoticeStaging workNoticeStaging : stagingList) {
try {
WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo();
BeanUtils.copyProperties(workNoticeStaging,workNoticeInfo);
BeanUtils.copyProperties(workNoticeStaging, workNoticeInfo);
String receiverUserId = workNoticeInfo.getReceiverUserId();
String bizMsgId = workNoticeInfo.getBizMsgId();
String msg = workNoticeInfo.getMsg();
GenericResult<Void> result = zwddClient.sendWorkNotice(receiverUserId, bizMsgId, msg);
if (result.isSuccess()){
if (result.isSuccess()) {
//执行成功了 删除暂存的数据
workNoticeStagingService.removeById(workNoticeStaging);
}
}catch (Exception e){
} catch (Exception e) {
log.error("发送工作通知 异常 bizMsgId:【" + workNoticeStaging.getBizMsgId() + "】 异常内容:" + e);
}finally {
} finally {
//增加重试的次数 和下次扫描时间
workNoticeStagingService.addRetryTimes(workNoticeStaging);
}


+ 0
- 2
hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowUtil.java ファイルの表示

@@ -1,7 +1,5 @@
package com.hz.pm.api.staging.utils;

import com.google.common.collect.Maps;

import java.util.HashMap;
import java.util.Map;



+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java ファイルの表示

@@ -14,7 +14,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/sys/convert/RegionConverter.java ファイルの表示

@@ -79,7 +79,7 @@ public class RegionConverter {
List<RegionTreeVO> treeList = new ArrayList<>();
List<RegionDTO> children = regions.getOrDefault(parentId, Collections.emptyList());
for (RegionDTO region : children) {
if (!showDeleted && region.getDeleted()) {
if (!showDeleted && Boolean.TRUE.equals(region.getDeleted())) {
continue;
}
RegionTreeVO node = toRegionTreeVO(region);


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/InitProcessManage.java ファイルの表示

@@ -58,7 +58,7 @@ public class InitProcessManage {
models.setFormName(stage.getDesc());
models.setProcessType(stage.getCode());
models.setRegionCode(unitId);
models.setProcess(new ProcessNode());
models.setProcess(new ProcessNode<>());
models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}");
models.setFormItems("[]");
String formId = processModelService.insertProcess(models);


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/OrgProcDefManage.java ファイルの表示

@@ -4,7 +4,7 @@ import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.organization.constants.ProcDefContant;
import com.hz.pm.api.organization.constant.ProcDefCont;
import com.hz.pm.api.user.model.entity.MhUnit;
import com.hz.pm.api.user.service.IMhUnitService;
import com.ningdatech.basic.util.CollUtils;
@@ -75,7 +75,7 @@ public class OrgProcDefManage {
}

private void saveDef(MhUnit unit, ProcessDefTypeEnum defType) {
String procDefId = ProcDefContant.MODELS_ID_PREFIX + IdUtil.objectId();
String procDefId = ProcDefCont.MODELS_ID_PREFIX + IdUtil.objectId();
WflowOrgModels defaultModel = new WflowOrgModels();
defaultModel.setProcessDefId(procDefId);
defaultModel.setIsStop(Boolean.FALSE);


+ 1
- 2
hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java ファイルの表示

@@ -4,9 +4,8 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hz.pm.api.expert.entity.ExpertUserFullInfo;
import com.ningdatech.basic.function.VUtils;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.expert.entity.ExpertUserFullInfo;
import com.hz.pm.api.expert.service.IExpertUserFullInfoService;
import com.hz.pm.api.signature.entity.CompanySignature;
import com.hz.pm.api.signature.service.ICompanySignatureService;


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java ファイルの表示

@@ -2,7 +2,7 @@ package com.hz.pm.api.user.controller;


import com.fasterxml.jackson.databind.ObjectMapper;
import com.hz.pm.api.meeting.entity.config.WebProperties;
import com.hz.pm.api.meeting.entity.config.WebProps;
import com.hz.pm.api.user.manage.AgentLoginManage;
import com.hz.pm.api.user.manage.AuthCodeLoginManage;
import com.hz.pm.api.user.model.vo.AuthCodeVO;
@@ -109,7 +109,7 @@ public class UserAuthController {
}
String authCode = authCodeLoginManage.generateAuthCode(targetUserId);
String urlParam = "?authCode=" + authCode;
String path = WebProperties.apiHost + request.getContextPath() + AUTH_CODE_LOGIN_PATH;
String path = WebProps.apiHost + request.getContextPath() + AUTH_CODE_LOGIN_PATH;
response.sendRedirect(path + urlParam);
}



+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java ファイルの表示

@@ -72,7 +72,7 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails {
*/
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
if (CollectionUtil.isNotEmpty(this.userRoleList)) {
if (CollUtil.isNotEmpty(this.userRoleList)) {
List<SimpleGrantedAuthority> authorities = new ArrayList<>();
for (Role role : this.userRoleList) {
authorities.add(new SimpleGrantedAuthority(role.getCode()));


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java ファイルの表示

@@ -10,7 +10,6 @@ import com.ningdatech.basic.model.PageVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;


+ 0
- 70
hz-pm-api/src/main/resources/application-dev.yml ファイルの表示

@@ -152,10 +152,6 @@ sa-token:
token-style: uuid
# 是否输出操作日志
is-log: false
#浙政钉公司顶级organizationCode
organization:
dept-visible-scopes:
- GO_ff70e47bae684fdba0d64f4acab85661

yxt:
# wsdl-url: http://115.239.137.23:9501/ws/v1?wsdl
@@ -168,72 +164,6 @@ yxt:
sms-enable: true
tel-enable: true

#省局联审 请求信息
provincial:
# host: http://zj.ningdatech.com/prometheus-zhejiang_foreign
host: http://223.4.72.75/prometheus-zhejiang_foreign
pushUrl: /api/v1/foreign/importantPro
detailUrl: /api/v1/foreign/importantProView
domainUrl: /api/v1/foreign/dominantUnit
key: 7fb48b518c6044a5a44deddd11b445e3
secret: ced8fff70018413c9516c58f95885624


#天印服务器接口信息
irs:
is-search-app: false
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interface-name: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform:
project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a
access-key: 42bcb49bea174986a3bfdfba7d005566
secret-key: bebff29877d4443abd67fc4f8fb335d8
api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf
app-report:
url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl
appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c
appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b
push-app:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm
appScret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
search-app:
url: https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm
appScret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
province-gov:
can-search: false
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm
interfaceName: 62vd5jAdM0b7Gr00
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
push-project-detail:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm
interfaceName: 3XN9R93Pva6db7sf
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
core-biz:
url: https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm
interfaceName: Fc3re2cq7r64Qfa7
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
interface-refresh:
method: POST
request-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm
refresh-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm
interface-local-refresh:
method: GET
request-token-url: https://interface.ls.local/a/api/requestTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign}
refresh-token-url: https://interface.ls.local/a/api/refreshTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign}
hostname: iZbp13nwyvib53j4j1p2xoZ
project:
push-url: http://120.26.44.207:38088/open/api/v1/project-receive/save
no-effective-url: http://120.26.44.207:38088/open/api/v1/project-receive/not-effective
delete-all-url: http://120.26.44.207:38088/open/api/v1/project-receive/delete-all
login:
phone-verify-code:
skip: true


+ 0
- 64
hz-pm-api/src/main/resources/application-prod.yml ファイルの表示

@@ -173,70 +173,6 @@ yxt:
sms-enable: false
tel-enable: false

#省局联审 请求信息
provincial:
host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign
pushUrl: /api/v1/foreign/importantPro
detailUrl: /api/v1/foreign/importantProView
domainUrl: /api/v1/foreign/dominantUnit
key: b5b2096953534a53991be4ea95f8cffa
secret: 1bec9b77134d4962ac466fbe9696b897

#天印服务器接口信息
irs:
is-search-app: true
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interfaceName: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform:
project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a
access-key: 42bcb49bea174986a3bfdfba7d005566
secret-key: bebff29877d4443abd67fc4f8fb335d8
api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf
app-report:
url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl
appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c
appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b
push-app:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm
appScret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
search-app:
url: https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm
appScret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
province-gov:
can-search: true
interfaceName: 62vd5jAdM0b7Gr00
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
push-project-detail:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm
interfaceName: 3XN9R93Pva6db7sf
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
core-biz:
url: https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm
interfaceName: Fc3re2cq7r64Qfa7
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
interface-refresh:
method: POST
request-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm
refresh-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm
interface-local-refresh:
method: GET
request-token-url: https://interface.ls.local/a/api/requestTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign}
refresh-token-url: https://interface.ls.local/a/api/refreshTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign}
hostname: iZ6mx01gyeodd80imxd2gbZ
project:
push-url: http://10.53.168.41:38088/open/api/v1/project-receive/save
no-effective-url: http://10.53.168.41:38088/open/api/v1/project-receive/not-effective
delete-all-url: http://10.53.168.41:38088/open/api/v1/project-receive/delete-all
login:
phone-verify-code:
skip: false


+ 0
- 1
hz-pm-api/src/test/java/com/hz/pm/api/irs/IrsTest.java ファイルの表示

@@ -7,7 +7,6 @@ import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.util.CryptUtils;
import com.hz.pm.api.common.util.HmacAuthUtil;
import com.hz.pm.api.common.util.RefreshKeyUtil;
import com.hz.pm.api.irs.manage.AppIrsManage;
import com.ningdatech.zwdd.ZwddIntegrationProperties;
import com.ningdatech.zwdd.client.ZwddAuthClient;
import com.ningdatech.zwdd.client.ZwddClient;


+ 0
- 2
hz-pm-api/src/test/java/com/hz/pm/api/organization/OrganizationTest.java ファイルの表示

@@ -8,9 +8,7 @@ import com.google.common.collect.Lists;
import com.ningdatech.basic.model.GenericResult;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.ding.model.DingOrgInfoTreeDTO;
import com.hz.pm.api.ding.task.EmployeeBatchGetTask;
import com.hz.pm.api.ding.task.GovBusinessStripsTask;
import com.hz.pm.api.ding.task.OrganizationBatchGetTask;
import com.hz.pm.api.organization.model.entity.DingOrganization;
import com.hz.pm.api.organization.service.IDingOrganizationService;
import com.ningdatech.zwdd.client.ZwddClient;


+ 0
- 70
hz-pm-api/src/test/resources/application-dev.yml ファイルの表示

@@ -152,10 +152,6 @@ sa-token:
token-style: uuid
# 是否输出操作日志
is-log: false
#浙政钉公司顶级organizationCode
organization:
dept-visible-scopes:
- GO_ff70e47bae684fdba0d64f4acab85661

yxt:
# wsdl-url: http://115.239.137.23:9501/ws/v1?wsdl
@@ -168,72 +164,6 @@ yxt:
sms-enable: true
tel-enable: true

#省局联审 请求信息
provincial:
# host: http://zj.ningdatech.com/prometheus-zhejiang_foreign
host: http://223.4.72.75/prometheus-zhejiang_foreign
pushUrl: /api/v1/foreign/importantPro
detailUrl: /api/v1/foreign/importantProView
domainUrl: /api/v1/foreign/dominantUnit
key: 7fb48b518c6044a5a44deddd11b445e3
secret: ced8fff70018413c9516c58f95885624


#天印服务器接口信息
irs:
is-search-app: false
digital-resource-indicators:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm
interface-name: 99E2bic31KdXzaa7
app-key: A331101453557202109017383
app-secret: 496f0f2a19994f76b4fd9dae087366c7
seal-platform:
project-id: 330001110
project-secret: 70e512d40c8f440484db4acab181570a
access-key: 42bcb49bea174986a3bfdfba7d005566
secret-key: bebff29877d4443abd67fc4f8fb335d8
api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf
app-report:
url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl
appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c
appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b
push-app:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm
appScret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
search-app:
url: https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm
appScret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
province-gov:
can-search: false
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm
interfaceName: 62vd5jAdM0b7Gr00
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
push-project-detail:
url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm
interfaceName: 3XN9R93Pva6db7sf
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
core-biz:
url: https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm
interfaceName: Fc3re2cq7r64Qfa7
appSecret: 496f0f2a19994f76b4fd9dae087366c7
appKey: A331101453557202109017383
interface-refresh:
method: POST
request-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm
refresh-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm
interface-local-refresh:
method: GET
request-token-url: https://interface.ls.local/a/api/requestTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign}
refresh-token-url: https://interface.ls.local/a/api/refreshTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign}
hostname: iZbp13nwyvib53j4j1p2xoZ
project:
push-url: http://120.26.44.207:38088/open/api/v1/project-receive/save
no-effective-url: http://120.26.44.207:38088/open/api/v1/project-receive/not-effective
delete-all-url: http://120.26.44.207:38088/open/api/v1/project-receive/delete-all
login:
phone-verify-code:
skip: true


読み込み中…
キャンセル
保存