Browse Source

modify:

1. 标项绑定底账、解绑接口;
tags/24111101^0
WendyYang 3 weeks ago
parent
commit
a3656da728
4 changed files with 39 additions and 30 deletions
  1. +0
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectLibController.java
  2. +33
    -22
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java
  3. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/BindSystemToBidReq.java
  4. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectGovSystemReplaceInfosService.java

+ 0
- 7
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectLibController.java View File

@@ -110,13 +110,6 @@ public class ProjectLibController {
projectLibManage.bindSystemToBid(req);
}

@PostMapping("/cancelSystemFromBid")
@WebLog("从标项解绑系统")
@ApiOperation("从标项解绑系统")
public void cancelSystemFromBid(@RequestBody @Valid BindSystemToBidReq req) {
projectLibManage.cancelSystemFromBid(req);
}

@GetMapping("/processSchedule/{projectId}")
@ApiOperation("项目库申报项目当前进度详情")
public List<ProcessDetailVO> processScheduleDetail(@PathVariable("projectId") Long projectId) {


+ 33
- 22
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java View File

@@ -1495,32 +1495,43 @@ public class ProjectLibManage {
return res;
}

@Transactional(rollbackFor = Exception.class)
public synchronized void bindSystemToBid(BindSystemToBidReq req) {
List<ProjectGovSystemReplaceInfos> replaceInfos = systemReplaceInfosService.listByIds(req.getSystemReplaceInfoIds());
if (replaceInfos.isEmpty()) {
throw ReturnException.wrap("系统替换信息不存在");
Wrapper<ProjectGovSystemReplaceInfos> query = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class)
.in(CollUtil.isNotEmpty(req.getSystemReplaceInfoIds()),
ProjectGovSystemReplaceInfos::getId, req.getSystemReplaceInfoIds())
.or(q -> q.eq(ProjectGovSystemReplaceInfos::getBidId, req.getBidId()));
List<ProjectGovSystemReplaceInfos> replaceInfos = systemReplaceInfosService.list(query);
if (CollUtil.isNotEmpty(req.getSystemReplaceInfoIds()) && CollUtil.isEmpty(replaceInfos)) {
throw ReturnException.wrap("未找到相关数据");
}
replaceInfos.removeIf(w -> req.getBidId().equals(w.getBidId()));
if (!replaceInfos.isEmpty()) {
replaceInfos.forEach(w -> {
if (w.getBidId() != null) {
throw ReturnException.wrap("已关联其他标项");
}
w.setBidId(req.getBidId());
});
systemReplaceInfosService.updateBatchById(replaceInfos);
if (CollUtil.contains(replaceInfos, w -> w.getBidId() != null && !w.getBidId().equals(req.getBidId()))) {
throw ReturnException.wrap("存在已关联其他标项的系统");
}
}

public void cancelSystemFromBid(BindSystemToBidReq req) {
List<ProjectGovSystemReplaceInfos> replaceInfos = systemReplaceInfosService.listByIds(req.getSystemReplaceInfoIds());
if (replaceInfos.isEmpty()) {
throw ReturnException.wrap("系统替换信息不存在");
replaceInfos.removeIf(w -> req.getBidId().equals(w.getBidId())
&& CollUtil.contains(req.getSystemReplaceInfoIds(), w.getId()));
if (CollUtil.isEmpty(replaceInfos)) {
return;
}
// 解绑的系统
Map<Boolean, List<Long>> relationMap = replaceInfos.stream()
.collect(Collectors.groupingBy(w -> CollUtil.contains(req.getSystemReplaceInfoIds(), w.getId()),
Collectors.mapping(ProjectGovSystemReplaceInfos::getId, Collectors.toList())));
List<Long> canceledIds = relationMap.get(Boolean.FALSE);
if (CollUtil.isNotEmpty(canceledIds)) {
Wrapper<ProjectGovSystemReplaceInfos> update = Wrappers.lambdaUpdate(ProjectGovSystemReplaceInfos.class)
.set(ProjectGovSystemReplaceInfos::getBidId, null)
.in(ProjectGovSystemReplaceInfos::getId, canceledIds);
systemReplaceInfosService.update(update);
}
// 关联系统
List<Long> bindIds = relationMap.get(Boolean.TRUE);
if (CollUtil.isNotEmpty(bindIds)) {
Wrapper<ProjectGovSystemReplaceInfos> update = Wrappers.lambdaUpdate(ProjectGovSystemReplaceInfos.class)
.set(ProjectGovSystemReplaceInfos::getBidId, req.getBidId())
.in(ProjectGovSystemReplaceInfos::getId, bindIds);
systemReplaceInfosService.update(update);
}
Wrapper<ProjectGovSystemReplaceInfos> wrapper = Wrappers.lambdaUpdate(ProjectGovSystemReplaceInfos.class)
.set(ProjectGovSystemReplaceInfos::getBidId, null)
.in(ProjectGovSystemReplaceInfos::getId, req.getSystemReplaceInfoIds());
systemReplaceInfosService.update(wrapper);
}

}

+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/BindSystemToBidReq.java View File

@@ -23,7 +23,6 @@ public class BindSystemToBidReq {
private Long bidId;

@ApiModelProperty("系统替换信息ID")
@NotEmpty(message = "系统替换信息ID不能为空")
private List<Long> systemReplaceInfoIds;

}

+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectGovSystemReplaceInfosService.java View File

@@ -38,6 +38,12 @@ public interface IProjectGovSystemReplaceInfosService extends IService<ProjectGo
return list(wrapper);
}

default List<ProjectGovSystemReplaceInfos> listByBidId(Long bidId) {
Wrapper<ProjectGovSystemReplaceInfos> wrapper = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class)
.eq(ProjectGovSystemReplaceInfos::getBidId, bidId);
return list(wrapper);
}

default void removeByProjectIds(Collection<Long> projectIds) {
LambdaQueryWrapper<ProjectGovSystemReplaceInfos> query = Wrappers
.lambdaQuery(ProjectGovSystemReplaceInfos.class)


Loading…
Cancel
Save