Commit a064a2b5 authored by wangqiang's avatar wangqiang

标准版本升级功能开发

parent e8e684f8
......@@ -162,6 +162,11 @@ public class Constants {
* 已过时
*/
public static final String OBSOLETE = "obsolete";
/**
* 已过时 --4.0
*/
public static final String OUTMODED = "Outmoded";
/**
* 打开
*/
......
package com.yonde.dcs.plan.core.controller;
import com.yonde.dcs.plan.entity.po.ExtStandard;
import org.springframework.stereotype.Controller;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import java.io.IOException;
import java.util.List;
import com.yonde.dcs.plan.common.vo.ExtStandardVO;
import org.springframework.beans.factory.annotation.Qualifier;
......@@ -28,6 +31,21 @@ import org.springframework.stereotype.Controller;
public class ExtStandardController<V extends ExtStandardVO, S extends ExtStandardService<V>> extends ExtStandardControllerShadow<V, S> {
@Autowired
private ExtStandardService extStandardService;
@ApiOperation("标准版本升级")
@PostMapping(value = "/upgradeVersion")
public ApiResult standardUpgradeVersion(@RequestBody ExtStandardVO extStandardVO) throws IOException {
return ApiResult.ok(extStandardService.upgradeVersion(extStandardVO),"版本升级成功");
}
@ApiOperation(value = "标准作废",notes = "标准升级完成后,将上一个版本置为已过时")
@PostMapping(value = "/setPreviousVersionOutmoded")
public ApiResult setPreviousVersionOutmoded(@RequestParam(required = false,value = "id") Long id){
return ApiResult.ok(extStandardService.setPreviousVersionOutmoded(id),"标准作废成功");
}
}
......@@ -2,6 +2,8 @@ package com.yonde.dcs.plan.core.service;
import com.yonde.dcs.plan.common.vo.ExtStandardVO;
import com.yonde.dcs.plan.core.service.shadow.ExtStandardServiceShadow;
import com.yonde.dex.basedata.entity.api.ApiResult;
/**
* @description: ExtStandard-service
* @author: dexadmin
......@@ -10,4 +12,11 @@ import com.yonde.dcs.plan.core.service.shadow.ExtStandardServiceShadow;
**/
public interface ExtStandardService<V extends ExtStandardVO> extends ExtStandardServiceShadow<V> {
public String upgradeVersion(ExtStandardVO extStandardVO);
public String setPreviousVersionOutmoded(Long id);
}
package com.yonde.dcs.plan.core.service.impl;
import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dex.basedata.entity.api.ApiResult;
import com.yonde.dex.basedata.exception.DxBusinessException;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation;
import java.util.List;
......@@ -7,6 +10,8 @@ import com.yonde.dcs.plan.common.vo.ExtStandardVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.core.service.ExtStandardService;
import com.yonde.dcs.plan.core.repository.ExtStandardRepository;
......@@ -29,6 +34,39 @@ public class ExtStandardServiceImpl<V extends ExtStandardVO> implements ExtStand
@Autowired
ExtStandardRepository<ExtStandard> extStandardRepository;
/**
* 版本升级,升大版本,并将上一个版本的最新小版置为“已作废”
* @param extStandardVO
* @return
*/
@Override
public String upgradeVersion(ExtStandardVO extStandardVO) {
if(!ObjectUtils.isEmpty(extStandardVO.getId())){
//更新,大版本升级
this.newVersion((V) extStandardVO);
}else {
throw new DxBusinessException("-1","id不能为空");
}
return ApiResult.SUCCESS;
}
/**
* 自动化任务:工作流结束之后,将上一个版本置为已过时;
* @param id 在数据库中的字段为:PREDECESSOR_ID
* @return
*/
@Override
public String setPreviousVersionOutmoded(Long id) {
if(!ObjectUtils.isEmpty(id)){
//将旧版本设置为作废
this.changeStatus(id, Constants.OUTMODED,true);
}else {
//如果是空无需作废;因为是空的话,说明没有升级,所以不用做任何处理
}
return ApiResult.SUCCESS;
}
}
package com.yonde.dcs.plan.feign;
import com.yonde.dcs.plan.common.vo.ExtStandardVO;
import com.yonde.dex.basedata.entity.api.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.feign.shadow.ExtStandardServiceFeignShadow;
......@@ -16,4 +18,8 @@ import com.yonde.dcs.plan.feign.shadow.ExtStandardServiceFeignShadow;
@FeignClient(value = "${dcs.feign.INET-PLAN}", path = "/ExtStandard")
public interface ExtStandardServiceFeign<V extends ExtStandardVO> extends ExtStandardServiceFeignShadow<V> {
@ApiOperation(value = "标准作废",notes = "标准升级完成后,将上一个版本置为已过时")
@PostMapping(value = "/setPreviousVersionOutmoded")
public String setPreviousVersionOutmoded(@RequestParam(required = false,value = "id") Long id);
}
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