Commit b7af211b authored by wangqiang's avatar wangqiang

意见答复启动流程、文档版本升级功能开发

parent df90b791
......@@ -3,11 +3,18 @@ package com.inet.dcs.document.core.controller;
import com.inet.dcs.document.common.vo.ExtFeedbackVO;
import com.inet.dcs.document.core.controller.shadow.ExtFeedbackControllerShadow;
import com.inet.dcs.document.core.service.ExtFeedbackService;
import com.yonde.dex.basedata.entity.api.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* @description: ExtFeedback-Controller
* @author: dexadmin
......@@ -21,6 +28,31 @@ import org.springframework.web.bind.annotation.ResponseBody;
public class ExtFeedbackController<V extends ExtFeedbackVO, S extends ExtFeedbackService<V>> extends ExtFeedbackControllerShadow<V, S> {
@Autowired
private ExtFeedbackService extFeedbackService;
@ApiOperation(value = "意见回复中所属文档进行版本升级")
@PostMapping("/docUpgredeVersion")
public ApiResult docUpgredeVersion(@RequestParam("docId")Long docId) {
return ApiResult.ok(extFeedbackService.docUpgredeVersion(docId),"版本升级成功");
}
/**
* 更新设计审查项的状态
* @param ids 设计审查项id
*/
@ApiOperation(value = "更新设计审查项的状态")
@PostMapping("/refreshDesignReviewItem")
public void refreshDesignReviewItem(@RequestParam("ids")List<Long> ids) {
extFeedbackService.refreshDesignReviewItem(ids);
}
@ApiOperation(value = "启动意见答复工作流")
@PostMapping("/startWorkflowForFeedback")
public ApiResult startWorkflowForFeedback(@RequestParam("id")Long id){
return ApiResult.ok(extFeedbackService.startWorkflowForFeedback(id),"提交成功");
}
}
......@@ -2,6 +2,9 @@ package com.inet.dcs.document.core.service;
import com.inet.dcs.document.common.vo.ExtFeedbackVO;
import com.inet.dcs.document.core.service.shadow.ExtFeedbackServiceShadow;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import java.util.List;
/**
* @description: ExtFeedback-service
......@@ -11,4 +14,17 @@ import com.inet.dcs.document.core.service.shadow.ExtFeedbackServiceShadow;
**/
public interface ExtFeedbackService<V extends ExtFeedbackVO> extends ExtFeedbackServiceShadow<V> {
public String docUpgredeVersion(Long docId);
public void refreshDesignReviewItem(List<Long> ids);
/**
* 启动意见回复工作流
* @param id 意见的id,并不是意见回复的id
* @return
*/
public String startWorkflowForFeedback(Long id);
}
......@@ -42,16 +42,20 @@ public class ExtDesignNoticeMinutesLinkServiceImpl<V extends ExtDesignNoticeMinu
throw new DxBusinessException("500","审计审查项id不能为空");
}
SearchQueryCondition queryCondition= SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("extDesignRelateDocumentLinks").build())
.openProp(SearchQueryCondition.builder().name("extDesignSubmitDocumentLinks").build())
.openProp(SearchQueryCondition.builder().name("extDesignCheckDocumentLinks").build())
.openProp(SearchQueryCondition.builder().name("extDesignAndClosedCycleDocLinks").build())
.openProp(SearchQueryCondition.builder().name("extDesignRelateDocumentLinks")
.openProp(SearchQueryCondition.builder().name("target").build()).build())
.openProp(SearchQueryCondition.builder().name("extDesignSubmitDocumentLinks")
.openProp(SearchQueryCondition.builder().name("target").build()).build())
.openProp(SearchQueryCondition.builder().name("extDesignCheckDocumentLinks")
.openProp(SearchQueryCondition.builder().name("target").build()).build())
.openProp(SearchQueryCondition.builder().name("extDesignAndClosedCycleDocLinks")
.openProp(SearchQueryCondition.builder().name("target").build()).build())
.searchItems(SearchItems.builder()
.item(new SearchItem("id", SearchItem.Operator.EQ, id, null))
.build())
.build();
List<V> content = this.findRecursion(queryCondition).getContent();
if(CollUtil.isNotEmpty(content)){
if(CollUtil.isEmpty(content)){
throw new DxBusinessException("500","根据id:"+id+",未查到对象!");
}
return content.get(0);
......
package com.inet.dcs.document.core.service.impl;
import com.inet.dcs.document.common.vo.ExtFeedbackVO;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.inet.dcs.document.common.vo.*;
import com.inet.dcs.document.core.constants.Constants;
import com.inet.dcs.document.core.repository.ExtFeedbackRepository;
import com.inet.dcs.document.core.service.ExtDesignNoticeMinutesLinkService;
import com.inet.dcs.document.core.service.ExtDesignReviewFeedbackLinkService;
import com.inet.dcs.document.core.service.ExtFeedbackService;
import com.inet.dcs.document.core.service.ExtReviewFeedbackService;
import com.inet.dcs.document.core.util.SearchUtil;
import com.inet.dcs.document.entity.po.ExtFeedback;
import com.inet.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.api.ApiResult;
import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.version.plugin.common.entity.DxIterationVOHolder;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @description: ExtFeedback-ServiceImpl
* @author: dexadmin
* @version: V
* @date: 2024-11-21 15:35:08
**/
* @description: ExtFeedback-ServiceImpl
* @author: dexadmin
* @version: V
* @date: 2024-11-21 15:35:08
**/
@Slf4j
@Service(ExtFeedbackServiceImpl.BEAN_NAME)
public class ExtFeedbackServiceImpl<V extends ExtFeedbackVO> implements ExtFeedbackService<V>{
public class ExtFeedbackServiceImpl<V extends ExtFeedbackVO> implements ExtFeedbackService<V> {
public static final String BEAN_NAME = "extFeedbackServiceImpl";
@Autowired
ExtFeedbackRepository<ExtFeedback> extFeedbackRepository;
@Autowired
private ExtDxDocumentServiceFeign extDxDocumentServiceFeign;
@Autowired
private ExtDesignReviewFeedbackLinkService extDesignReviewFeedbackLinkService;
@Autowired
private ExtDesignNoticeMinutesLinkService extDesignNoticeMinutesLinkService;
@Autowired
private ExtReviewFeedbackService extReviewFeedbackService;
@Autowired
private WfcProcessFeign wfcProcessFeign;
/**
* 意见回复所属文档进行版本升级(在意见回复流程走完调用该方法)
*
* @param docId
* @return
*/
@Override
public String docUpgredeVersion(Long docId) {
DxDocumentVO documentVO = (DxDocumentVO) extDxDocumentServiceFeign.get(docId);
if (!ObjectUtil.isEmpty(documentVO)) {
DxIterationVOHolder dxIterationVOHolder = extDxDocumentServiceFeign.newVersion(documentVO);
log.info("升级后的原始id是:" + dxIterationVOHolder.getOriginId());
}
return ApiResult.SUCCESS;
}
/**
* 每次页面刷新时,调用该方法
* (该方法作用是查看设计评审项下所有的意见回复的所属文档是否是全部发布,
* ,如果是全发布,则将设计评审项的状态置为“已完成”)
*
* @param ids
*/
@Override
public void refreshDesignReviewItem(List<Long> ids) {
Boolean allDocIsRelease = false;
if(CollUtil.isNotEmpty(ids)) {
for(Long designItemId:ids){
//查询设计审查项的意见的意见回复所关联的文档
SearchQueryCondition query = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("target")
.openProp(SearchQueryCondition.builder().name("extFeedbacks")
.openProp(SearchQueryCondition.builder().name("extReviewFeedDocumentLinks")
.openProp(SearchQueryCondition.builder().name("target").build()).build()).build()).build())
.searchItems(SearchItems.builder()
.item(new SearchItem("sourceId", SearchItem.Operator.EQ, designItemId, null))
.build()).build();
//
List content = extDesignNoticeMinutesLinkService.findRecursion(query).getContent();
if(CollUtil.isNotEmpty(content)){
//获取审查项
ExtDesignNoticeMinutesLinkVO extDesignNoticeMinutesLinkVO =(ExtDesignNoticeMinutesLinkVO)content.get(0);
if(!ObjectUtil.isEmpty(extDesignNoticeMinutesLinkVO)){
//所有审查项所有意见
// for(ExtFeedbackVO extFeedbackVO : extFeedbacks){
// //意见回复下所有的文档
// ExtReviewFeedDocumentLinkVO extReviewFeedDocumentLinkVO = extFeedbackVO.getExtReviewFeedDocumentLinks().get(0);
// DxDocumentVO documentVO = extReviewFeedDocumentLinkVO.getTarget();
// if(!documentVO.getState().equals(Constants.DOC_RELEASE)){
// allDocIsRelease = false;
// break;
// }
// allDocIsRelease = true;
// }
}
}
//如果文档全不是已发布的状态,就将设计审查项的状态置为"已完成"
if(allDocIsRelease){
SearchQueryCondition searchQueryCondition = SearchUtil.buildQuery("id", SearchItem.Operator.EQ, designItemId);
ExtDesignNoticeMinutesLinkVO extDesignNoticeMinutesLinkVO = (ExtDesignNoticeMinutesLinkVO)extDesignNoticeMinutesLinkService.findRecursion(searchQueryCondition).getContent().get(0);
extDesignNoticeMinutesLinkVO.setOperator(OperatorType.MODIFY);
extDesignNoticeMinutesLinkVO.setState(Constants.COMPLETED);
extDesignNoticeMinutesLinkService.saveRecursion(extDesignNoticeMinutesLinkVO);
}
}
}
}
@Override
public String startWorkflowForFeedback(Long id) {
if(ObjectUtil.isEmpty(id)){
throw new DxBusinessException("500","id不能为空");
}
SearchQueryCondition queryDesignItem = SearchUtil.buildQueryWithOpenAttr("id", SearchItem.Operator.EQ, id, "source");
ExtDesignReviewFeedbackLinkVO extDesignReviewFeedbackLinkVO = (ExtDesignReviewFeedbackLinkVO) extDesignReviewFeedbackLinkService.findRecursion(queryDesignItem).getContent().get(0);
//获取设计审查项
ExtDesignNoticeMinutesLinkVO extDesignNoticeMinutesLinkVO = extDesignReviewFeedbackLinkVO.getSource();
//设计审查项的状态:ReviewPreparation(评审准备中)、ViewImplement(意见落实中)、Complete(已完成)
//如果是ViewImplement(意见落实中),说明评审项下意见回复流程已经启动,就不能再次启动流程
if(extDesignNoticeMinutesLinkVO.getState().equals("ViewImplement")){
throw new DxBusinessException("500","评审项的状态是意见落实中,不能再次提交");
}
SearchQueryCondition searchQueryCondition = SearchUtil.buildQueryWithOpenAttr("id", SearchItem.Operator.EQ, id,"extFeedbacks");
List extReviewFeedbacks = extReviewFeedbackService.findRecursion(searchQueryCondition).getContent();
if(CollUtil.isEmpty(extReviewFeedbacks)){
throw new DxBusinessException("500","根据意见id:"+id+"为查看对象");
}
ExtReviewFeedbackVO extReviewFeedbackVO = (ExtReviewFeedbackVO) extReviewFeedbacks.get(0);
//获取所有意见答复
List<ExtFeedbackVO> extFeedbacks = extReviewFeedbackVO.getExtFeedbacks();
if(CollUtil.isEmpty(extFeedbacks)){
throw new DxBusinessException("500","根据意见对象未创建意见答复,提交失败");
}
for(ExtFeedbackVO extFeedbackVO:extFeedbacks){
wfcProcessFeign.startProcessByKey("ExtFeedbackWF", extFeedbackVO);
}
//修改设计审查项的状态为"意见落实中"
extDesignNoticeMinutesLinkVO.setState("ViewImplement");
extDesignNoticeMinutesLinkVO.setOperator(OperatorType.MODIFY);
extDesignNoticeMinutesLinkService.saveRecursion(extDesignNoticeMinutesLinkVO);
return ApiResult.SUCCESS;
}
}
......
......@@ -2,8 +2,12 @@ package com.inet.dcs.document.feign;
import com.inet.dcs.document.common.vo.ExtFeedbackVO;
import com.inet.dcs.document.feign.shadow.ExtFeedbackServiceFeignShadow;
import com.yonde.dex.basedata.entity.api.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @description: ExtFeedback-Feign
......@@ -15,4 +19,8 @@ import org.springframework.cloud.openfeign.FeignClient;
@FeignClient(value = "${dcs.feign.DCS-DOC}", path = "/ExtFeedback")
public interface ExtFeedbackServiceFeign<V extends ExtFeedbackVO> extends ExtFeedbackServiceFeignShadow<V> {
@ApiOperation(value = "意见回复中所属文档进行版本升级")
@PostMapping("/docUpgredeVersion")
public String docUpgredeVersion(Long docId);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment