Browse Source

标段部分操作增加锁

tags/24080901
WendyYang 8 months ago
parent
commit
00ad6d070c
14 changed files with 73 additions and 54 deletions
  1. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/ProcDefController.java
  2. +4
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/FinalAcceptanceController.java
  3. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java
  4. +2
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java
  5. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java
  6. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java
  7. +3
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java
  8. +4
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectCodeGenUtil.java
  9. +18
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java
  10. +27
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java
  11. +0
    -25
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectStatusChangeServiceImpl.java
  12. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/controller/TodoCenterController.java
  13. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java
  14. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhUnitService.java

+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/organization/controller/ProcDefController.java View File

@@ -52,7 +52,7 @@ public class ProcDefController {
@ApiOperation(value = "单位流程配置保存", notes = "单位流程配置保存")
@PostMapping("/save")
@WebLog("单位流程配置保存")
public String save(@Validated @RequestBody WflowOrgProcdefDto req) {
public synchronized String save(@Validated @RequestBody WflowOrgProcdefDto req) {
if (StrUtils.isBlank(req.getOrgCode())) {
req.setOrgCode(LoginUserUtil.loginUserDetail().getMhUnitIdStr());
}
@@ -78,7 +78,7 @@ public class ProcDefController {
@ApiOperation(value = "单位流程配置部署", notes = "单位流程配置部署")
@PostMapping("/deploy/{processDefId}")
@WebLog("单位流程配置部署")
public String deploy(@Validated @PathVariable String processDefId) {
public synchronized String deploy(@Validated @PathVariable String processDefId) {
return orgProcessModelService.deployProcessLs(processDefId, null);
}



+ 4
- 5
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/FinalAcceptanceController.java View File

@@ -1,15 +1,13 @@
package com.hz.pm.api.projectdeclared.controller;

import com.hz.pm.api.projectdeclared.model.req.SubmitConstructionReq;
import com.hz.pm.api.projectdeclared.model.req.SubmitFinallyInspectedReq;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.projectdeclared.manage.FinalAcceptanceManage;
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.hz.pm.api.projectdeclared.model.req.SubmitFinallyInspectedReq;
import com.hz.pm.api.projectdeclared.model.vo.FinalAcceptanceVO;
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;
@@ -33,6 +31,7 @@ import javax.servlet.http.HttpServletResponse;
@Api(value = "FinalAcceptanceController", tags = "申报管理-终验")
@RequiredArgsConstructor
public class FinalAcceptanceController {

private final FinalAcceptanceManage finalAcceptanceManage;

@ApiOperation(value = "待终验申报的项目列表", notes = "待终验申报的项目列表")


+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java View File

@@ -287,7 +287,7 @@ public class ConstructionManage {
}

@Transactional(rollbackFor = Exception.class)
public String submitPurchaseContract(SubmitConstructionReq req) {
public synchronized String submitPurchaseContract(SubmitConstructionReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
Long projectId = req.getProjectId();
Project project = projectService.getNewProject(req.getProjectId());
@@ -595,7 +595,7 @@ public class ConstructionManage {
}

@Transactional(rollbackFor = Exception.class)
public void submitFirstInspectedFiles(PreInsSaveDTO req) {
public synchronized void submitFirstInspectedFiles(PreInsSaveDTO req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
Purchase purchase = purchaseService.getById(req.getBidId());
if (!TenderStatusEnum.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.eq(purchase.getStatus())) {
@@ -640,7 +640,7 @@ public class ConstructionManage {
}

@Transactional(rollbackFor = Exception.class)
public void submitXcfhxApply(XcfhxApplyReq req) {
public synchronized void submitXcfhxApply(XcfhxApplyReq req) {
Purchase purchase = purchaseService.getById(req.getBidId());
if (!TenderStatusEnum.TO_BE_SUBMIT_XCFHX_APPLY.eq(purchase.getStatus())
&& !TenderStatusEnum.XCFHX_APPLY_FAILED.eq(purchase.getStatus())) {


+ 2
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -119,7 +119,7 @@ public class DeclaredProjectManage {
* @return
*/
@Transactional(rollbackFor = Exception.class)
public String startTheProcess(DefaultDeclaredDTO dto) {
public synchronized String startTheProcess(DefaultDeclaredDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
ProjectDTO projectInfo = dto.getProjectInfo();

@@ -197,7 +197,7 @@ public class DeclaredProjectManage {
* @return
*/
@Transactional(rollbackFor = Exception.class)
public String reStartTheProcess(DefaultDeclaredDTO dto) {
public synchronized String reStartTheProcess(DefaultDeclaredDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
ProjectDTO projectDto = dto.getProjectInfo();
projectDto.setBuildOrgCode(user.getMhUnitIdStr());


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java View File

@@ -245,7 +245,7 @@ public class FinalAcceptanceManage {
* @return \
*/
@Transactional(rollbackFor = Exception.class)
public String startProcess(SubmitFinallyInspectedReq req) {
public synchronized String startProcess(SubmitFinallyInspectedReq req) {
Integer instTypeCode = ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode();
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, instTypeCode)


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java View File

@@ -63,7 +63,7 @@ public class OperationManage {
}

@Transactional(rollbackFor = Exception.class)
public String pushOperation(OperationReq req) {
public synchronized String pushOperation(OperationReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
List<Purchase> purchases = purchaseService.listByProjectId(req.getProjectId());
Map<Long, Purchase> purchaseMap = CollUtils.listToMap(purchases, Purchase::getId);


+ 3
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java View File

@@ -246,7 +246,7 @@ public class PurchaseManage {
}

@Transactional(rollbackFor = Exception.class)
public void submitPurchaseNotice(SubmitPurchaseNoticeReq req) {
public synchronized void submitPurchaseNotice(SubmitPurchaseNoticeReq req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
Long projectId = req.getProjectId();
Project project = projectService.getNewProject(projectId);
@@ -278,7 +278,8 @@ public class PurchaseManage {
projectService.updateById(project);
}

public void submitPurchaseRecord(SubmitPurchaseRecordReq req) {
@Transactional(rollbackFor = Exception.class)
public synchronized void submitPurchaseRecord(SubmitPurchaseRecordReq req) {
Purchase purchase = purchaseService.getById(req.getBidId());
if (!TenderStatusEnum.TO_BE_SUBMIT_PURCHASE_INFO.eq(purchase.getStatus())) {
throw BizException.wrap("该标段无法进行采购信息备案");


+ 4
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectCodeGenUtil.java View File

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

import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.RegionConst;
@@ -109,14 +110,14 @@ public class ProjectCodeGenUtil {
.orderByDesc(GovBizProjectBaseinfo::getBaseProjId)
.last(BizConst.LIMIT_1));
if (Objects.nonNull(baseMax) && StringUtils.isNotBlank(baseMax.getBaseProjId())) {
max = Long.parseLong(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5));
max = Long.parseLong(StrUtil.removePrefix(baseMax.getBaseProjId(), currentCode));
}
GovOperationProjectBaseinfo operationBaseMax = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class)
.like(GovOperationProjectBaseinfo::getBaseProjId, currentCode)
.orderByDesc(GovOperationProjectBaseinfo::getBaseProjId)
.last(BizConst.LIMIT_1));
if (Objects.nonNull(operationBaseMax) && StringUtils.isNotBlank(operationBaseMax.getBaseProjId())) {
long operationMax = Long.parseLong(operationBaseMax.getBaseProjId().substring(operationBaseMax.getBaseProjId().length() - 5));
long operationMax = Long.parseLong(StrUtil.removePrefix(operationBaseMax.getBaseProjId(), currentCode));
max = Math.max(max, operationMax);
}
Project projectMax = projectService.getOne(Wrappers.lambdaQuery(Project.class)
@@ -124,7 +125,7 @@ public class ProjectCodeGenUtil {
.orderByDesc(Project::getProjectCode)
.last(BizConst.LIMIT_1));
if (Objects.nonNull(projectMax) && StringUtils.isNotBlank(projectMax.getProjectCode())) {
long projectMaxCode = Long.parseLong(projectMax.getProjectCode().substring(projectMax.getProjectCode().length() - 5));
long projectMaxCode = Long.parseLong(StrUtil.removePrefix(projectMax.getProjectCode(), currentCode));
max = Math.max(max, projectMaxCode);
}
max = max + 1;


+ 18
- 4
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java View File

@@ -352,7 +352,7 @@ public class DeclaredRecordManage {
@Transactional(rollbackFor = Exception.class)
public synchronized void initMhProjectToProject() {
Wrapper<MhProject> query = Wrappers.lambdaQuery(MhProject.class)
.isNotNull(MhProject::getProjectCode);
.isNull(MhProject::getProjectCode);
List<MhProject> mhProjects = mhProjectService.list(query);
if (mhProjects.isEmpty()) {
return;
@@ -405,14 +405,22 @@ public class DeclaredRecordManage {
});
List<Project> projects = new ArrayList<>();
for (ImportProjectFinanceInfosDTO importData : importDataList) {
Project project = projectService.getByProjectName(importData.getProjectName());
Assert.notNull(project, "项目不存在:%s", importData.getProjectName());
String projectName = importData.getProjectName();
Project project = projectService.getByProjectName(projectName);
if (project == null) {
log.warn("项目不存在:{}", projectName);
continue;
}
log.info("项目存在:{}", projectName);
project.setDeclareAmount(importData.getDeclareAmount());
project.setDeclareGovOwnFinanceAmount(importData.getDeclareGovOwnFinanceAmount());
project.setDeclareGovSuperiorFinanceAmount(importData.getDeclareGovSuperiorFinanceAmount());
project.setDeclareHaveAmount(importData.getDeclareHaveAmount());
projects.add(project);
}
if (projects.isEmpty()) {
return;
}
projectService.updateBatchById(projects);
} catch (Exception e) {
log.info("读取数据失败:", e);
@@ -452,7 +460,10 @@ public class DeclaredRecordManage {
List<ProjectGovSystemReplaceInfos> replaceInfos = new ArrayList<>();
for (Map.Entry<String, List<ImportReplaceSystemInfosDTO>> entry : groupByProject.entrySet()) {
Project project = projectService.getByProjectName(entry.getKey());
Assert.notNull(project, "项目不存在:%s", entry.getKey());
if (project == null) {
log.warn("项目不存在:{}", entry.getKey());
continue;
}
projectIds.add(project.getId());
Map<String, Integer> batchNoMap = new HashMap<>();
AtomicInteger integer = new AtomicInteger(1);
@@ -469,6 +480,9 @@ public class DeclaredRecordManage {
replaceInfos.add(replaceInfo);
}
}
if (replaceInfos.isEmpty()) {
return;
}
systemReplaceInfosService.removeByProjectIds(projectIds);
systemReplaceInfosService.saveBatch(replaceInfos);
} catch (Exception e) {


+ 27
- 4
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectStatusChangeService.java View File

@@ -1,17 +1,18 @@
package com.hz.pm.api.projectlib.service;

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.service.IService;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.Collection;

/**
* <p>
* 服务类
* 项目状态变更 - 服务类
* </p>
*
* @author CMM
@@ -19,9 +20,23 @@ import java.util.Collection;
*/
public interface IProjectStatusChangeService extends IService<ProjectStatusChange> {

ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId);
default ProjectStatusChange getLastOne(ProjectStatusChangeEvent event, Long projectId) {
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class)
.eq(ProjectStatusChange::getEvent, event)
.eq(ProjectStatusChange::getProjectId, projectId)
.orderByDesc(ProjectStatusChange::getCreateOn)
.last(BizConst.LIMIT_1);
return getOne(query);
}

ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Collection<Long> projectIds);
default ProjectStatusChange getLastOne(ProjectStatusChangeEvent event, Collection<Long> projectIds) {
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectId, projectIds)
.eq(ProjectStatusChange::getEvent, event)
.orderByDesc(ProjectStatusChange::getCreateOn)
.last(BizConst.LIMIT_1);
return getOne(query);
}

default ProjectStatusChange getLastOne(Collection<Long> projectIds, Collection<ProjectStatusChangeEvent> events) {
LambdaQueryWrapper<ProjectStatusChange> pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class)
@@ -32,5 +47,13 @@ public interface IProjectStatusChangeService extends IService<ProjectStatusChang
return getOne(pscQuery);
}

default ProjectStatusChange getLastOne(String projectCode, Collection<ProjectStatusChangeEvent> events) {
LambdaQueryWrapper<ProjectStatusChange> pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class)
.eq(ProjectStatusChange::getProjectCode, projectCode)
.in(ProjectStatusChange::getEvent, events)
.orderByDesc(ProjectStatusChange::getCreateOn)
.last(BizConst.LIMIT_1);
return getOne(pscQuery);
}

}

+ 0
- 25
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectStatusChangeServiceImpl.java View File

@@ -1,17 +1,11 @@
package com.hz.pm.api.projectlib.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.projectlib.mapper.ProjectStatusChangeMapper;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
import org.springframework.stereotype.Service;

import java.util.Collection;

/**
* <p>
* 服务实现类
@@ -23,23 +17,4 @@ import java.util.Collection;
@Service
public class ProjectStatusChangeServiceImpl extends ServiceImpl<ProjectStatusChangeMapper, ProjectStatusChange> implements IProjectStatusChangeService {

@Override
public ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId) {
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class)
.eq(ProjectStatusChange::getEvent, event)
.eq(ProjectStatusChange::getProjectId, projectId)
.orderByDesc(ProjectStatusChange::getCreateOn)
.last(BizConst.LIMIT_1);
return getOne(query);
}

@Override
public ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Collection<Long> projectIds) {
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectId, projectIds)
.eq(ProjectStatusChange::getEvent, event)
.orderByDesc(ProjectStatusChange::getCreateOn)
.last(BizConst.LIMIT_1);
return getOne(query);
}
}

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/controller/TodoCenterController.java View File

@@ -178,7 +178,7 @@ public class TodoCenterController {
@ApiOperation(value = "被退回项目内容调整并通过", notes = "被退回项目内容调整并通过")
@PostMapping("/adjustAndHandle")
@WebLog("被退回项目内容调整并通过")
public String startTheProcess(@Validated @RequestBody AdjustHandleDTO dto) {
public synchronized String startTheProcess(@Validated @RequestBody AdjustHandleDTO dto) {
String instanceId = todoCenterManage.adjustmentAndHandle(dto);
return "退回项目内容调整并且重新通过 【" + instanceId + "】 成功";
}


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java View File

@@ -335,7 +335,7 @@ public class TodoCenterManage {
* @since 2023/02/01
*/
@Transactional(rollbackFor = Exception.class)
public String handler(ReqProcessHandlerDTO param) {
public synchronized String handler(ReqProcessHandlerDTO param) {
// 获取登录用户ID
UserInfoDetails user = LoginUserUtil.loginUserDetail();
// 获取登录用户浙政钉code


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

@@ -26,4 +26,10 @@ public interface IMhUnitService extends IService<MhUnit> {
return CollUtils.fieldList(list(query), MhUnit::getId);
}

default List<MhUnit> listByName(String unitName) {
LambdaQueryWrapper<MhUnit> query = Wrappers.lambdaQuery(MhUnit.class)
.eq(MhUnit::getName, unitName);
return list(query);
}

}

Loading…
Cancel
Save