Procházet zdrojové kódy

modify:

1. 系统停用备案;
tags/24090101
WendyYang před 2 měsíci
rodič
revize
8d5ea8728d
11 změnil soubory, kde provedl 119 přidání a 20 odebrání
  1. +13
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/external/todo/MHTodoClient.java
  2. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java
  3. +10
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhSystemReplaceController.java
  4. +8
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/QxProjectController.java
  5. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/entity/MhSystemReplaceInfo.java
  6. +58
    -9
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhSystemReplaceManage.java
  7. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java
  8. +14
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/QxProjectManage.java
  9. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/GovSystemReplaceInfoDTO.java
  10. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/MhSystemReplaceInfoVO.java
  11. +1
    -1
      hz-pm-gen/src/main/java/com/hz/pm/gen/config/CodeGen.java

+ 13
- 1
hz-pm-api/src/main/java/com/hz/pm/api/external/todo/MHTodoClient.java Zobrazit soubor

@@ -10,6 +10,7 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.util.EnvironmentUtil;
import com.hz.pm.api.external.todo.dto.MhTodoRequestDTO;
import com.hz.pm.api.external.todo.dto.MhTodoRetDTO;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
@@ -42,6 +43,7 @@ public class MHTodoClient {
*/
private static final String TODO_ADD = "/single_wk_handle/addWkhandle";


/**
* 完成待办接口地址
*/
@@ -55,6 +57,7 @@ public class MHTodoClient {
//==================================================================================================================

private final IMhTodoRecordService todoRecordService;
private final EnvironmentUtil environmentUtil;


/**
@@ -65,6 +68,9 @@ public class MHTodoClient {

@Transactional(rollbackFor = Exception.class)
public void addTodo(Object paramObj, UserFullInfoDTO receiver, MHTodoTypeEnum type, String bizId, String content) {
if (environmentUtil.isDevEnv()) {
return;
}
String url = mhApiHost + TODO_ADD;
String paramObjs = JSON.toJSONString(paramObj);
MhTodoRequestDTO todoReq = MhTodoRequestDTO.builder()
@@ -97,7 +103,10 @@ public class MHTodoClient {
*
* @param wkhandleId 待办ID
*/
public void complete(String wkhandleId) {
private void complete(String wkhandleId) {
if (environmentUtil.isDevEnv()) {
return;
}
String url = mhApiHost + TODO_COMPLETE;
// 发送PUT请求
HttpRequest request = HttpUtil.createRequest(Method.PUT, url)
@@ -114,6 +123,9 @@ public class MHTodoClient {


public void completeTodo(MHTodoTypeEnum todoType, Collection<String> bizIds) {
if (environmentUtil.isDevEnv()) {
return;
}
LambdaQueryWrapper<MhTodoRecord> query = Wrappers.lambdaQuery(MhTodoRecord.class)
.eq(MhTodoRecord::getType, todoType.name())
.in(MhTodoRecord::getBizId, bizIds)


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java Zobrazit soubor

@@ -27,7 +27,7 @@ import javax.validation.Valid;
@RestController
@RequestMapping("/api/v1/fiscal-code")
@RequiredArgsConstructor
@Api(tags = "印章配置-财政编码配置")
@Api(tags = "印章配置-财政编码配置", hidden = true)
public class CompanyFiscalCodeController {

private final CompanyFiscalCodeManage companyFiscalCodeManage;


+ 10
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhSystemReplaceController.java Zobrazit soubor

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

import com.hz.pm.api.projectlib.manage.MhSystemReplaceManage;
import com.hz.pm.api.projectlib.model.dto.MhSystemReplaceInfoVO;
import com.hz.pm.api.projectlib.model.dto.MhSystemStoppedRecordDTO;
import com.hz.pm.api.projectlib.model.req.MhSystemReplaceReq;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
@@ -9,10 +10,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
@@ -51,4 +51,11 @@ public class MhSystemReplaceController {
mhSystemReplaceManage.syncMhSystemReplaceInfo();
}

@PostMapping("/submitStoppedRecord")
@ApiOperation("提交停用备案")
@WebLog("提交停用备案")
public void submitStoppedRecord(@RequestBody @Valid MhSystemStoppedRecordDTO req) {
mhSystemReplaceManage.submitStoppedRecord(req);
}

}

+ 8
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/QxProjectController.java Zobrazit soubor

@@ -1,6 +1,7 @@
package com.hz.pm.api.projectlib.controller;

import com.hz.pm.api.projectlib.manage.QxProjectManage;
import com.hz.pm.api.projectlib.model.dto.MhSystemReplaceInfoVO;
import com.hz.pm.api.projectlib.model.req.*;
import com.hz.pm.api.projectlib.model.vo.QxProjectDetailVO;
import com.hz.pm.api.projectlib.model.vo.QxProjectVO;
@@ -12,6 +13,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* <p>
@@ -69,4 +71,10 @@ public class QxProjectController {
return qxProjectManage.page(req);
}

@GetMapping("/systemReplaceInfos/{projectId}")
@ApiOperation("项目替换系统列表")
public List<MhSystemReplaceInfoVO> listSystemReplaceInfos(@PathVariable Long projectId) {
return qxProjectManage.listReplaceInfo(projectId);
}

}

+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/entity/MhSystemReplaceInfo.java Zobrazit soubor

@@ -71,4 +71,7 @@ public class MhSystemReplaceInfo implements Serializable {
@ApiModelProperty("开始时间")
private LocalDateTime createOn;

@ApiModelProperty("是否停用")
private Boolean stopped;

}

+ 58
- 9
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhSystemReplaceManage.java Zobrazit soubor

@@ -2,20 +2,24 @@ package com.hz.pm.api.projectlib.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.model.constant.MhUnitConst;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.external.MhApiClient;
import com.hz.pm.api.projectlib.entity.*;
import com.hz.pm.api.projectlib.model.dto.MhSystemReplaceInfoDTO;
import com.hz.pm.api.projectlib.model.dto.MhSystemReplaceInfoVO;
import com.hz.pm.api.projectlib.model.dto.MhSystemStoppedRecordDTO;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.MhSystemReplaceType;
import com.hz.pm.api.projectlib.model.req.MhSystemReplaceReq;
import com.hz.pm.api.projectlib.service.*;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.helper.MhUnitQueryHelper;
import com.hz.pm.api.user.helper.MhUnitQueryHelper.UnitQueryState;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import lombok.RequiredArgsConstructor;
@@ -23,6 +27,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -41,13 +46,13 @@ import java.util.stream.Collectors;
public class MhSystemReplaceManage {

private final IMhSystemReplaceInfoService mhSystemReplaceInfoService;
private final MhUnitCache mhUnitCache;
private final MhApiClient mhApiClient;
private final IQxProjectService qxProjectService;
private final IProjectGovSystemReplaceInfosService projectGovSystemReplaceInfosService;
private final IQxProjectSystemReplaceInfosService qxProjectSystemReplaceInfosService;
private final IProjectService projectService;
private final IQxProjectSystemReplaceInfosRelationService qxProjectSystemReplaceInfosRelationService;
private final MhUnitQueryHelper mhUnitQueryHelper;
private final IMhSystemReplaceInfoStoppedRecordService mhSystemReplaceInfoStoppedRecordService;

@Transactional(rollbackFor = Exception.class)
public synchronized void syncMhSystemReplaceInfo() {
@@ -56,6 +61,12 @@ public class MhSystemReplaceManage {
if (CollUtil.isEmpty(systemReplaceInfos)) {
return;
}
List<String> ids = CollUtils.fieldList(systemReplaceInfos, MhSystemReplaceInfoDTO::getId);
for (List<String> strings : ListUtil.partition(ids, 1000)) {
Wrapper<MhSystemReplaceInfo> removeWrapper = Wrappers.lambdaQuery(MhSystemReplaceInfo.class)
.notIn(MhSystemReplaceInfo::getId, strings);
mhSystemReplaceInfoService.remove(removeWrapper);
}
LocalDateTime now = LocalDateTime.now();
List<MhSystemReplaceInfo> newData = systemReplaceInfos.stream().map(w -> {
MhSystemReplaceInfo replaceInfo = new MhSystemReplaceInfo();
@@ -76,23 +87,43 @@ public class MhSystemReplaceManage {
replaceInfo.setTargetName(w.getAlternativeName());
return replaceInfo;
}).collect(Collectors.toList());
mhSystemReplaceInfoService.saveBatch(newData);
mhSystemReplaceInfoService.saveOrUpdateBatch(newData);
}

public PageVo<MhSystemReplaceInfoVO> page(MhSystemReplaceReq req) {
LambdaQueryWrapper<MhSystemReplaceInfo> query = buildMhSystemReplaceInfoQuery(req);
if (req.getBuildOrgCode() != null && req.getBuildOrgCode() != MhUnitConst.ROOT_UNIT_ID) {
query.in(MhSystemReplaceInfo::getBuildOrgCode, mhUnitCache.getViewChildIdsRecursion(req.getBuildOrgCode()));
UnitQueryState state = mhUnitQueryHelper.listCanViewUnitIds(req.getBuildOrgCode());
if (!state.isState()) {
return PageVo.empty();
}
BizUtils.notEmpty(state.getUnitIds(), w -> query.in(MhSystemReplaceInfo::getBuildOrgCode, w));
Page<MhSystemReplaceInfo> page = mhSystemReplaceInfoService.page(req.page(), query);
if (page.getTotal() == 0) {
return PageVo.empty();
}
List<MhSystemReplaceInfoVO> data = BeanUtil.copyToList(page.getRecords(), MhSystemReplaceInfoVO.class);
List<String> stoppedIds = data.stream()
.filter(w -> Boolean.TRUE.equals(w.getStopped()))
.map(MhSystemReplaceInfoVO::getId)
.collect(Collectors.toList());
Map<String, MhSystemStoppedRecordDTO> stoppedRecordMap;
if (stoppedIds.isEmpty()) {
stoppedRecordMap = Collections.emptyMap();
} else {
Wrapper<MhSystemReplaceInfoStoppedRecord> stoppedQuery = Wrappers.lambdaQuery(MhSystemReplaceInfoStoppedRecord.class)
.in(MhSystemReplaceInfoStoppedRecord::getSystemReplaceInfosId, stoppedIds);
List<MhSystemReplaceInfoStoppedRecord> stoppedRecords = mhSystemReplaceInfoStoppedRecordService.list(stoppedQuery);
stoppedRecordMap = CollUtils.listToMap(stoppedRecords,
MhSystemReplaceInfoStoppedRecord::getSystemReplaceInfosId,
w -> BeanUtil.copyProperties(w, MhSystemStoppedRecordDTO.class));
}
List<String> sourceSystemIds = CollUtils.fieldList(data, MhSystemReplaceInfoVO::getId);
Map<String, Project> projectMap = listProjectMapBySourceSystemIds(sourceSystemIds);
Map<String, QxProject> qxProjectMap = listQxProjectBySourceSystemIds(sourceSystemIds);
for (MhSystemReplaceInfoVO datum : data) {
if (Boolean.TRUE.equals(datum.getStopped())) {
datum.setStoppedRecord(stoppedRecordMap.get(datum.getId()));
}
String sourceSystemId = datum.getId();
Project project = projectMap.get(sourceSystemId);
if (project != null) {
@@ -137,9 +168,15 @@ public class MhSystemReplaceManage {

public List<MhSystemReplaceInfoVO> option(MhSystemReplaceReq req) {
LambdaQueryWrapper<MhSystemReplaceInfo> query = buildMhSystemReplaceInfoQuery(req);
if (req.getBuildOrgCode() != null && req.getBuildOrgCode() != MhUnitConst.ROOT_UNIT_ID) {
query.in(MhSystemReplaceInfo::getBuildOrgCode, mhUnitCache.getViewChildIdsRecursion(req.getBuildOrgCode()));
query.eq(MhSystemReplaceInfo::getStopped, Boolean.FALSE);
if (StrUtil.isBlank(req.getReplaceType())) {
query.in(MhSystemReplaceInfo::getReplaceType, Arrays.asList(MhSystemReplaceType.IM, MhSystemReplaceType.IT));
}
UnitQueryState state = mhUnitQueryHelper.listCanViewUnitIds(req.getBuildOrgCode());
if (!state.isState()) {
return Collections.emptyList();
}
BizUtils.notEmpty(state.getUnitIds(), w -> query.in(MhSystemReplaceInfo::getBuildOrgCode, w));
query.notExists("select 1 from qx_project_system_replace_infos_relation qpr " +
"where qpr.source_system_id = mh_system_replace_info.id");
query.notExists("select 1 from nd_project_gov_system_replace_infos npr " +
@@ -191,5 +228,17 @@ public class MhSystemReplaceManage {
return CollUtils.listToMap(relationMap.entrySet(), Map.Entry::getKey, w -> qxProjectMap.get(w.getValue()));
}

@Transactional(rollbackFor = Exception.class)
public synchronized void submitStoppedRecord(MhSystemStoppedRecordDTO req) {
MhSystemReplaceInfo replaceInfo = mhSystemReplaceInfoService.getById(req.getSystemReplaceInfosId());
if (replaceInfo == null || Boolean.TRUE.equals(replaceInfo.getStopped())) {
return;
}
MhSystemReplaceInfoStoppedRecord stoppedRecord = new MhSystemReplaceInfoStoppedRecord();
BeanUtil.copyProperties(replaceInfo, stoppedRecord);
mhSystemReplaceInfoStoppedRecordService.save(stoppedRecord);
replaceInfo.setStopped(Boolean.TRUE);
mhSystemReplaceInfoService.updateById(replaceInfo);
}

}

+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java Zobrazit soubor

@@ -954,15 +954,15 @@ public class ProjectLibManage {
List<ProjectGovSystemReplaceInfos> replaceInfos = new ArrayList<>();
for (int i = 0; i < systemReplaceInfos.size(); i++) {
GovSystemReplaceInfoDTO curr = systemReplaceInfos.get(i);
for (String systemName : curr.getSourceSystemNames()) {
for (int i1 = 0; i1 < curr.getSourceSystemNames().size(); i1++) {
ProjectGovSystemReplaceInfos replaceInfo = new ProjectGovSystemReplaceInfos();
replaceInfo.setProjectId(projectId);
replaceInfo.setProjectCode(projectCode);
replaceInfo.setReplaceType(curr.getReplaceType());
replaceInfo.setSourceSystem(systemName);
replaceInfo.setSourceSystem(curr.getSourceSystemNames().get(i1));
replaceInfo.setTargetSystem(curr.getTargetSystemName());
replaceInfo.setBatchNo(i + 1);
replaceInfo.setSourceSystemId(curr.getSourceSystemId());
replaceInfo.setSourceSystemId(curr.getSourceSystemIds().get(i1));
replaceInfos.add(replaceInfo);
}
}


+ 14
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/QxProjectManage.java Zobrazit soubor

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.projectlib.entity.*;
import com.hz.pm.api.projectlib.model.dto.MhSystemReplaceInfoVO;
import com.hz.pm.api.projectlib.model.dto.QxProjectSystemReplaceInfosDTO;
import com.hz.pm.api.projectlib.model.enumeration.MhSystemReplaceType;
import com.hz.pm.api.projectlib.model.enumeration.QxProjectStatus;
@@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

@@ -214,4 +216,16 @@ public class QxProjectManage {
return PageVo.of(BeanUtil.copyToList(page.getRecords(), QxProjectVO.class), page.getTotal());
}

public List<MhSystemReplaceInfoVO> listReplaceInfo(Long projectId) {
Wrapper<QxProjectSystemReplaceInfosRelation> query = Wrappers.lambdaQuery(QxProjectSystemReplaceInfosRelation.class)
.eq(QxProjectSystemReplaceInfosRelation::getProjectId, projectId);
List<QxProjectSystemReplaceInfosRelation> relations = qxProjectSystemReplaceInfosRelationService.list(query);
if (CollUtil.isEmpty(relations)) {
return Collections.emptyList();
}
List<String> systemIds = CollUtils.fieldList(relations, QxProjectSystemReplaceInfosRelation::getSourceSystemId);
List<MhSystemReplaceInfo> replaceInfos = mhSystemReplaceInfoService.listByIds(systemIds);
return BeanUtil.copyToList(replaceInfos, MhSystemReplaceInfoVO.class);
}

}

+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/GovSystemReplaceInfoDTO.java Zobrazit soubor

@@ -37,7 +37,7 @@ public class GovSystemReplaceInfoDTO implements Serializable {
private String replaceType;

@ApiModelProperty("替代前系统id")
private String sourceSystemId;
private List<String> sourceSystemIds;

@Override
public boolean equals(Object o) {
@@ -51,7 +51,7 @@ public class GovSystemReplaceInfoDTO implements Serializable {
return CollUtil.isEqualList(sourceSystemNames, that.sourceSystemNames)
&& Objects.equals(targetSystemName, that.targetSystemName)
&& Objects.equals(replaceType, that.replaceType)
&& Objects.equals(sourceSystemId, that.sourceSystemId);
&& CollUtil.isEqualList(sourceSystemIds, that.sourceSystemIds);
}

@Override


+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/MhSystemReplaceInfoVO.java Zobrazit soubor

@@ -60,4 +60,10 @@ public class MhSystemReplaceInfoVO {
@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("是否停用")
private Boolean stopped;

@ApiModelProperty("停用备案")
private MhSystemStoppedRecordDTO stoppedRecord;

}

+ 1
- 1
hz-pm-gen/src/main/java/com/hz/pm/gen/config/CodeGen.java Zobrazit soubor

@@ -55,7 +55,7 @@ public class CodeGen {
}

public static void main(String[] args) {
generate("WendyYang", "projectlib", PATH_YYD, "QX_PROJECT_SYSTEM_REPLACE_INFOS_RELATION");
generate("WendyYang", "projectlib", PATH_YYD, "MH_SYSTEM_REPLACE_INFO_STOPPED_RECORD");
}

}

Načítá se…
Zrušit
Uložit