Commit 9534e123 authored by wangqiang's avatar wangqiang

ICM计划绑定技术联系单功能开发

parent c14b7cd3
......@@ -3,6 +3,8 @@ package com.yonde.dcs.plan.core.controller;
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.ExtICMPlanDocLinkVO;
import org.springframework.beans.factory.annotation.Qualifier;
......@@ -13,6 +15,8 @@ import com.yonde.dcs.plan.core.service.ExtICMPlanDocLinkService;
import com.yonde.dex.basedata.entity.api.ApiResult;
import com.yonde.dcs.plan.core.controller.shadow.ExtICMPlanDocLinkControllerShadow;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
/**
......@@ -28,6 +32,20 @@ import org.springframework.stereotype.Controller;
public class ExtICMPlanDocLinkController<V extends ExtICMPlanDocLinkVO, S extends ExtICMPlanDocLinkService<V>> extends ExtICMPlanDocLinkControllerShadow<V, S> {
@Autowired
private ExtICMPlanDocLinkService extICMPlanDocLinkService;
/**
* 导出计划
* @param sourceId 计划id
* @param targetId 技术联系单id
* @throws IOException
*/
@ApiOperation(value = "绑定计划与技术联系单的关系", notes = "绑定计划与技术联系单的关系", httpMethod = "GET")
@PostMapping(value = "/bindPlanAndDoc")
public ApiResult bindPlanAndDoc(@RequestParam("sourceId") Long sourceId, @RequestParam("targetId")Long targetId) throws IOException {
return ApiResult.ok(extICMPlanDocLinkService.bindPlanAndDoc(sourceId, targetId),"绑定成功");
}
}
......@@ -16,4 +16,6 @@ import java.util.List;
**/
public interface ExtICMPlanDocLinkService<V extends ExtICMPlanDocLinkVO> extends ExtICMPlanDocLinkServiceShadow<V> {
public String bindPlanAndDoc(Long sourceId,Long targetId);
}
package com.yonde.dcs.plan.core.service.impl;
import com.alibaba.excel.EasyExcel;
import com.yonde.dcs.plan.common.vo.ExtICMPlanExcelVO;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO;
import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.utils.SearchUtil;
import com.yonde.dcs.plan.common.vo.*;
import com.yonde.dcs.plan.core.listener.ICMPlanExcelListenner;
import com.yonde.dcs.plan.core.listener.IEDPlanExcelListenner;
import com.yonde.dcs.plan.core.service.ExtICMExternalInterfacePlanService;
import com.yonde.dcs.plan.core.service.ExtIEDPlanService;
import com.yonde.dex.basedata.data.search.SearchItem;
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 org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.List;
import com.yonde.dcs.plan.common.vo.ExtICMPlanDocLinkVO;
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.web.bind.annotation.*;
import com.yonde.dcs.plan.core.service.ExtICMPlanDocLinkService;
import com.yonde.dcs.plan.core.repository.ExtICMPlanDocLinkRepository;
......@@ -38,7 +46,33 @@ public class ExtICMPlanDocLinkServiceImpl<V extends ExtICMPlanDocLinkVO> impleme
@Autowired
ExtICMPlanDocLinkRepository<ExtICMPlanDocLink> extICMPlanDocLinkRepository;
@Autowired
private ExtICMExternalInterfacePlanService<ExtICMExternalInterfacePlanVO> extICMExternalInterfacePlanService;
/**
* 绑定计划与技术联系单的关系,并且修改计划的状态为已打开
* @param sourceId 计划id
* @param targetId 文档id
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public String bindPlanAndDoc(Long sourceId, Long targetId) {
ExtICMPlanDocLinkVO extICMPlanDocLinkVO = new ExtICMPlanDocLinkVO();
extICMPlanDocLinkVO.setSourceId(sourceId);
extICMPlanDocLinkVO.setTargetId(targetId);
extICMPlanDocLinkVO.setOperator(OperatorType.ADD);
this.saveRecursion((V) extICMPlanDocLinkVO);
//更改计划状态未已打开
SearchQueryCondition queryIEDPlanCondition = SearchUtil.buildQuery("id", SearchItem.Operator.EQ, sourceId);
ExtICMExternalInterfacePlanVO extICMPlanForDB = extICMExternalInterfacePlanService.findRecursion(queryIEDPlanCondition).getContent().get(0);
extICMPlanForDB.setOperator(OperatorType.MODIFY);
extICMPlanForDB.setState(Constants.OPENED);
extICMPlanForDB.setPlanOpenDate(LocalDateTime.now());
extICMExternalInterfacePlanService.saveRecursion(extICMPlanForDB);
return ApiResult.SUCCESS;
}
}
......
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