Commit 717e59fb authored by 侯彦文's avatar 侯彦文

doc报错

parent 6ba46bd0
......@@ -2,22 +2,17 @@ package com.yonde.dcs.plan.core.service.impl;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.util.StringUtils;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONPObject;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.expand.entity.DxDocumentVOExpand;
import com.yonde.dcs.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.common.vo.ExtPuchasePlanExcelVO;
import com.yonde.dcs.plan.core.listener.IEDPlanExcelListenner;
import com.yonde.dcs.plan.core.listener.PurchasePlanExcelReadListenner;
import com.yonde.dcs.plan.core.repository.ExtIEDPlanRepository;
import com.yonde.dcs.plan.core.service.ExtIEDPlanDocLinkService;
import com.yonde.dcs.plan.core.service.ExtIEDPlanService;
......@@ -26,10 +21,8 @@ import com.yonde.dcs.plan.core.util.FileUtils;
import com.yonde.dcs.plan.core.util.ResourceHelper;
import com.yonde.dcs.plan.core.util.SearchUtil;
import com.yonde.dcs.plan.entity.po.ExtIEDPlan;
import com.yonde.dcs.plan.entity.po.ExtIEDPlanDocLink;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryBuilder;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.api.ApiResult;
import com.yonde.dex.basedata.entity.api.CustomMultipartFile;
......@@ -38,10 +31,13 @@ import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.dfs.feign.FileManagerFeignService;
import com.yonde.dex.systemfile.feign.SystemFileFeignService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
......@@ -52,13 +48,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
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 javax.servlet.http.HttpServletResponse;
/**
* @description: ExtIEDPlan-ServiceImpl
......@@ -85,7 +74,7 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
private ExtIEDPlanDocLinkService extIEDPlanDocLinkService;
@Override
public String importIEDPlan(InputStream inputStream,String projectId) {
public String importIEDPlan(InputStream inputStream, String projectId) {
EasyExcel.read(inputStream, ExtIEDPlanExcelVO.class,
new IEDPlanExcelListenner(projectId))
.sheet()
......@@ -143,7 +132,6 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
}
private List<ExtIEDPlanExcelVO> transformationObject(List<V> extIEDPlanList) {
List<ExtIEDPlanExcelVO> extIEDPlanExcelVOList = new ArrayList<>();
for (ExtIEDPlanVO extIEDPlanVO : extIEDPlanList) {
......@@ -175,6 +163,7 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
/**
* 创建IED计划任务
*
* @param extIEDPlanVO
* @return
*/
......@@ -187,10 +176,10 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
//文件类型 --文件、图册
//文件分类--需要取英文
//todo 需要取英文动态类型
if(!StringUtils.isEmpty(extIEDPlanVO.getFileClassify())){
if(extIEDPlanVO.getFileClassify().contains("技术文件")){
if (!StringUtils.isEmpty(extIEDPlanVO.getFileClassify())) {
if (extIEDPlanVO.getFileClassify().contains("技术文件")) {
dxDocumentVO.setSubTypeName("TechnicalFile");
}else {
} else {
//todo wq暂时先不设置其它动态类型
log.info("IED计划除技术文件类型的文件还未设置其它类型");
}
......@@ -201,11 +190,11 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
Map<String, Object> dynamicAttrs = new HashMap<>();
//文件代号
dynamicAttrs.put("fileNumber",extIEDPlanVO.getFileCode());
dynamicAttrs.put("fileNumber", extIEDPlanVO.getFileCode());
//管理信息系统编码
dynamicAttrs.put("systemCode",extIEDPlanVO.getSystemNumber());
dynamicAttrs.put("systemCode", extIEDPlanVO.getSystemNumber());
//阶段
dynamicAttrs.put("phase",extIEDPlanVO.getPhase());
dynamicAttrs.put("phase", extIEDPlanVO.getPhase());
//设置动态属性
dxDocumentVO.setDynamicAttrs(dynamicAttrs);
//设备号
......@@ -230,13 +219,14 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
/**
* 更新计划状态
*
* @param planState
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public String updatePlanState(Long id,String planState) {
if(!StringUtils.isEmpty(planState)){
public String updatePlanState(Long id, String planState) {
if (!StringUtils.isEmpty(planState)) {
SearchQueryCondition queryCondition = SearchUtil.buildQuery("targetId", SearchItem.Operator.EQ, id);
// SearchQueryCondition condition = SearchQueryCondition.builder()
// .searchItems(SearchItems.builder()
......@@ -245,20 +235,19 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
// .build();
List<ExtIEDPlanDocLinkVO> content = extIEDPlanDocLinkService.findRecursion(queryCondition).getContent();
Long iedPlanId = content.get(0).getSourceId();
if(!ObjectUtil.isEmpty(iedPlanId)){
this.changeStatus(iedPlanId,planState,true);
}else {
throw new DxBusinessException("500","根据文档id:"+id+",未查到相关计划");
if (!ObjectUtil.isEmpty(iedPlanId)) {
this.changeStatus(iedPlanId, planState, true);
} else {
throw new DxBusinessException("500", "根据文档id:" + id + ",未查到相关计划");
}
}else {
throw new DxBusinessException("500","参数不能为空");
} else {
throw new DxBusinessException("500", "参数不能为空");
}
return ApiResult.SUCCESS;
}
}
......@@ -97,6 +97,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
@Autowired
private ModelDefinitionFeignService modelDefinitionService;
@Qualifier("docCenterFeignService")
@Autowired
private DocCenterFeignService docCenterFeignService;
......@@ -458,7 +459,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
new SearchItem("number", SearchItem.Operator.EQ, number, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
DxPageImpl<DxDocumentVO> recursion = docCenterFeignService.findRecursion(query);
if (org.springframework.util.CollectionUtils.isEmpty(recursion.getContent())) {
if (CollectionUtils.isEmpty(recursion.getContent())) {
return null;
}
return DxPageUtils.getFirst(recursion);
......
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