1、修改询价异常接口
2、增加采购发起异常接口
This commit is contained in:
@ -3,6 +3,7 @@ package com.chinaunicom.mall.ebtp.project.projectexception.controller;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||||
|
import com.chinaunicom.mall.ebtp.project.baseoperlog.aop.OperLog;
|
||||||
import com.chinaunicom.mall.ebtp.project.projectexception.entity.ProjectException;
|
import com.chinaunicom.mall.ebtp.project.projectexception.entity.ProjectException;
|
||||||
import com.chinaunicom.mall.ebtp.project.projectexception.entity.ProjectExceptionVO;
|
import com.chinaunicom.mall.ebtp.project.projectexception.entity.ProjectExceptionVO;
|
||||||
import com.chinaunicom.mall.ebtp.project.projectexception.service.IProjectExceptionService;
|
import com.chinaunicom.mall.ebtp.project.projectexception.service.IProjectExceptionService;
|
||||||
@ -129,5 +130,23 @@ public class ProjectExceptionController{
|
|||||||
return BaseResponse.success(projectExceptionService.getIsAgainPurchase(sectionId));
|
return BaseResponse.success(projectExceptionService.getIsAgainPurchase(sectionId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目中心提供异常调用接口
|
||||||
|
* @param subprojectId 子项目ID
|
||||||
|
* @param projectPlanId 方案ID
|
||||||
|
* @param reason 异常原因
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@OperLog("项目中心提供异常调用接口")
|
||||||
|
@ApiOperation("项目中心提供异常调用接口")
|
||||||
|
@PostMapping("initiateException")
|
||||||
|
public BaseResponse<Boolean> initiateException(
|
||||||
|
@ApiParam(value = "子项目ID", required = true) @RequestParam(name = "subprojectId") String subprojectId,
|
||||||
|
@ApiParam(value = "方案ID", required = true) @RequestParam(name = "projectPlanId") String projectPlanId,
|
||||||
|
@ApiParam(value = "异常原因") @RequestParam(name = "reason",required = false) String reason){
|
||||||
|
|
||||||
|
return BaseResponse.success(projectExceptionService.initiateException(subprojectId,projectPlanId,reason));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,4 +63,13 @@ public interface IProjectExceptionService extends IBaseService<ProjectException>
|
|||||||
* @return 返回结果
|
* @return 返回结果
|
||||||
*/
|
*/
|
||||||
boolean getIsAgainPurchase(String sectionId);
|
boolean getIsAgainPurchase(String sectionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目中心提供异常调用接口
|
||||||
|
* @param subprojectId 子项目ID
|
||||||
|
* @param projectPlanId 方案ID
|
||||||
|
* @param reason 异常原因
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
boolean initiateException(String subprojectId, String projectPlanId, String reason);
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,14 @@ import com.chinaunicom.mall.ebtp.project.sectionsupplier.service.ISectionSupplie
|
|||||||
import io.seata.core.context.RootContext;
|
import io.seata.core.context.RootContext;
|
||||||
import io.seata.spring.annotation.GlobalTransactional;
|
import io.seata.spring.annotation.GlobalTransactional;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -188,6 +190,7 @@ public class ProjectExceptionServiceImpl extends BaseServiceImpl<ProjectExceptio
|
|||||||
/*查询标段信息*/
|
/*查询标段信息*/
|
||||||
ProjectSectionVO projectSectionVO = new ProjectSectionVO();
|
ProjectSectionVO projectSectionVO = new ProjectSectionVO();
|
||||||
projectSectionVO.setProjectId(projectException.getProjectId());
|
projectSectionVO.setProjectId(projectException.getProjectId());
|
||||||
|
projectSectionVO.setNotStatus(ProjectCommonUtil.SECTION_STATUS_9);
|
||||||
List<ProjectSection> sectionList = projectSectionService.getList(projectSectionVO);
|
List<ProjectSection> sectionList = projectSectionService.getList(projectSectionVO);
|
||||||
|
|
||||||
//提取异常标段ID
|
//提取异常标段ID
|
||||||
@ -244,14 +247,25 @@ public class ProjectExceptionServiceImpl extends BaseServiceImpl<ProjectExceptio
|
|||||||
section.setProjectPlanId(inquiryNoticeVO.getInquiryId());
|
section.setProjectPlanId(inquiryNoticeVO.getInquiryId());
|
||||||
QueryWrapper<ProjectSection> sectionQueryWrapper = Wrappers.query(section);
|
QueryWrapper<ProjectSection> sectionQueryWrapper = Wrappers.query(section);
|
||||||
section = projectSectionService.getOne(sectionQueryWrapper);
|
section = projectSectionService.getOne(sectionQueryWrapper);
|
||||||
|
|
||||||
|
return extracted(section,inquiryNoticeVO.getReason());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起异常信息
|
||||||
|
* @param section 标段ID
|
||||||
|
* @param reason 异常原因
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
private boolean extracted(ProjectSection section,String reason) {
|
||||||
|
|
||||||
ProjectExceptionEnum.FRAME_EXCEPTION_PROJECT_SECTION_NOT_FIND.customValid(null == section || StringUtils.isBlank(section.getId()));
|
ProjectExceptionEnum.FRAME_EXCEPTION_PROJECT_SECTION_NOT_FIND.customValid(null == section || StringUtils.isBlank(section.getId()));
|
||||||
//校验标段是否处在归档阶段
|
//校验标段是否处在归档阶段
|
||||||
ProjectExceptionEnum.FRAME_EXCEPTION_PROJECT_EXCEPTION_SECTION_BUSINESS_MODULE_ERROR.customValid(section.getBusinessModule() >= ProjectCommonUtil.BUSINESS_MODULE_12);
|
ProjectExceptionEnum.FRAME_EXCEPTION_PROJECT_EXCEPTION_SECTION_BUSINESS_MODULE_ERROR.customValid(section.getBusinessModule() >= ProjectCommonUtil.BUSINESS_MODULE_12);
|
||||||
if(ProjectCommonUtil.SECTION_STATUS_9 == section.getStatus()){
|
if(ProjectCommonUtil.SECTION_STATUS_9 == section.getStatus()){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//1 插入异常信息和异常标段信息
|
||||||
//2 插入异常信息和异常标段信息
|
|
||||||
ProjectExceptionVO exception = new ProjectExceptionVO();
|
ProjectExceptionVO exception = new ProjectExceptionVO();
|
||||||
exception.setProjectId(section.getProjectId());
|
exception.setProjectId(section.getProjectId());
|
||||||
exception.setId(PropertyUtils.getSnowflakeId());
|
exception.setId(PropertyUtils.getSnowflakeId());
|
||||||
@ -259,7 +273,7 @@ public class ProjectExceptionServiceImpl extends BaseServiceImpl<ProjectExceptio
|
|||||||
exception.setIsSendMessage(ProjectCommonUtil.IS_SEND_MESSAGE_1);
|
exception.setIsSendMessage(ProjectCommonUtil.IS_SEND_MESSAGE_1);
|
||||||
exception.setExceptionDesc(ProjectCommonUtil.EXCEPTION_DESC_4);
|
exception.setExceptionDesc(ProjectCommonUtil.EXCEPTION_DESC_4);
|
||||||
exception.setHandleType(ProjectCommonUtil.SECTION_EXCEPTION_HANDLE_TYPE_1);
|
exception.setHandleType(ProjectCommonUtil.SECTION_EXCEPTION_HANDLE_TYPE_1);
|
||||||
exception.setExceptionComments(inquiryNoticeVO.getReason());
|
exception.setExceptionComments(reason);
|
||||||
|
|
||||||
boolean result = this.save(exception);
|
boolean result = this.save(exception);
|
||||||
ProjectExceptionEnum.FRAME_EXCEPTION_PROJECT_EXCEPTION_SAVE.customValid(!result);
|
ProjectExceptionEnum.FRAME_EXCEPTION_PROJECT_EXCEPTION_SAVE.customValid(!result);
|
||||||
@ -267,12 +281,26 @@ public class ProjectExceptionServiceImpl extends BaseServiceImpl<ProjectExceptio
|
|||||||
exception.setSectionArray(sectionArray);
|
exception.setSectionArray(sectionArray);
|
||||||
result = saveSectionList(exception);
|
result = saveSectionList(exception);
|
||||||
|
|
||||||
//3 修改项目和标段信息
|
//查询标段信息
|
||||||
ProjectRecord projectRecord = new ProjectRecord();
|
ProjectSectionVO projectSectionVO = new ProjectSectionVO();
|
||||||
projectRecord.setStatus(ProjectCommonUtil.PROJECT_STATUS_9);
|
projectSectionVO.setProjectId(section.getProjectId());
|
||||||
projectRecord.setId(exception.getProjectId());
|
projectSectionVO.setNotStatus(ProjectCommonUtil.SECTION_STATUS_9);
|
||||||
projectRecord.setTenderingContent(inquiryNoticeVO.getReason());
|
List<ProjectSection> sectionList = projectSectionService.getList(projectSectionVO);
|
||||||
projectRecordService.updateById(projectRecord);
|
|
||||||
|
//提取异常标段ID
|
||||||
|
List<String> sectionExceptionIds = Arrays.asList(sectionArray);
|
||||||
|
|
||||||
|
/*标段是否全部废止状态*/
|
||||||
|
long isAllAbolish = sectionList.stream().filter(n -> !sectionExceptionIds.contains(n.getId())).count();
|
||||||
|
|
||||||
|
//2 修改项目和标段信息
|
||||||
|
if(isAllAbolish <= 0){
|
||||||
|
ProjectRecord projectRecord = new ProjectRecord();
|
||||||
|
projectRecord.setStatus(ProjectCommonUtil.PROJECT_STATUS_9);
|
||||||
|
projectRecord.setId(exception.getProjectId());
|
||||||
|
projectRecord.setTenderingContent(reason);
|
||||||
|
projectRecordService.updateById(projectRecord);
|
||||||
|
}
|
||||||
|
|
||||||
section.setStatus(ProjectCommonUtil.SECTION_STATUS_9);
|
section.setStatus(ProjectCommonUtil.SECTION_STATUS_9);
|
||||||
projectSectionService.updateById(section);
|
projectSectionService.updateById(section);
|
||||||
@ -297,6 +325,13 @@ public class ProjectExceptionServiceImpl extends BaseServiceImpl<ProjectExceptio
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean initiateException(String subprojectId, String projectPlanId, String reason) {
|
||||||
|
ProjectSection section = projectSectionService.selectByPlanId(projectPlanId);
|
||||||
|
return extracted(section,reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 再次发起项目
|
* 再次发起项目
|
||||||
|
Reference in New Issue
Block a user