Commit 505a08da authored by 侯彦文's avatar 侯彦文

修改文档依赖

parent ea954424
...@@ -2,7 +2,6 @@ package com.yonde.dcs.plan.core.service; ...@@ -2,7 +2,6 @@ package com.yonde.dcs.plan.core.service;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
public interface DxMessageService { public interface DxMessageService {
DxDocumentVO designDocumentsMessage(); DxDocumentVO designDocumentsMessage();
......
...@@ -4,16 +4,17 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,16 +4,17 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.inet.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.plan.common.constants.Constants; import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.vo.ExtICMExternalInterfacePlanVO;
import com.yonde.dcs.plan.common.vo.ExtICMPlanExcelVO; import com.yonde.dcs.plan.common.vo.ExtICMPlanExcelVO;
import com.yonde.dcs.plan.core.listener.ICMPlanExcelListenner; import com.yonde.dcs.plan.core.listener.ICMPlanExcelListenner;
import com.yonde.dcs.plan.core.repository.ExtICMExternalInterfacePlanRepository;
import com.yonde.dcs.plan.core.service.ExtICMExternalInterfacePlanService;
import com.yonde.dcs.plan.core.util.FileUtils; import com.yonde.dcs.plan.core.util.FileUtils;
import com.yonde.dcs.plan.core.util.ResourceHelper; import com.yonde.dcs.plan.core.util.ResourceHelper;
import com.yonde.dcs.plan.entity.po.ExtICMExternalInterfacePlan;
import com.yonde.dex.basedata.data.search.SearchItem; import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems; import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryCondition; import com.yonde.dex.basedata.data.search.SearchQueryCondition;
...@@ -21,38 +22,28 @@ import com.yonde.dex.basedata.entity.api.ApiResult; ...@@ -21,38 +22,28 @@ import com.yonde.dex.basedata.entity.api.ApiResult;
import com.yonde.dex.basedata.entity.api.CustomMultipartFile; import com.yonde.dex.basedata.entity.api.CustomMultipartFile;
import com.yonde.dex.basedata.entity.data.DxPageImpl; import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.exception.DxBusinessException; import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.dao.business.events.DaoPluginBusinessEvent;
import com.yonde.dex.dfs.feign.FileManagerFeignService; import com.yonde.dex.dfs.feign.FileManagerFeignService;
import com.yonde.dex.systemfile.feign.SystemFileFeignService; import com.yonde.dex.systemfile.feign.SystemFileFeignService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation; import org.springframework.util.ObjectUtils;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.yonde.dcs.plan.common.vo.ExtICMExternalInterfacePlanVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.core.service.ExtICMExternalInterfacePlanService;
import com.yonde.dcs.plan.core.repository.ExtICMExternalInterfacePlanRepository;
import com.yonde.dcs.plan.entity.po.ExtICMExternalInterfacePlan;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
/** /**
* @description: ExtICMExternalInterfacePlan-ServiceImpl * @description: ExtICMExternalInterfacePlan-ServiceImpl
* @author: dexadmin * @author: dexadmin
* @version: V * @version: V
* @date: 2024-9-14 10:04:10 * @date: 2024-9-14 10:04:10
**/ **/
@Slf4j @Slf4j
@Service(ExtICMExternalInterfacePlanServiceImpl.BEAN_NAME) @Service(ExtICMExternalInterfacePlanServiceImpl.BEAN_NAME)
public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInterfacePlanVO> implements ExtICMExternalInterfacePlanService<V> { public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInterfacePlanVO> implements ExtICMExternalInterfacePlanService<V> {
...@@ -132,12 +123,11 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte ...@@ -132,12 +123,11 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
} }
private List<ExtICMPlanExcelVO> transformationObject(List<V> extICMPlanList) { private List<ExtICMPlanExcelVO> transformationObject(List<V> extICMPlanList) {
List<ExtICMPlanExcelVO> extICMPlanExcelVOList = new ArrayList<>(); List<ExtICMPlanExcelVO> extICMPlanExcelVOList = new ArrayList<>();
for (ExtICMExternalInterfacePlanVO extICMPlanVO : extICMPlanList) { for (ExtICMExternalInterfacePlanVO extICMPlanVO : extICMPlanList) {
ExtICMPlanExcelVO extICMPlanExcelVO = new ExtICMPlanExcelVO(); ExtICMPlanExcelVO extICMPlanExcelVO = new ExtICMPlanExcelVO();
BeanUtil.copyProperties(extICMPlanVO,extICMPlanExcelVO); BeanUtil.copyProperties(extICMPlanVO, extICMPlanExcelVO);
extICMPlanExcelVOList.add(extICMPlanExcelVO); extICMPlanExcelVOList.add(extICMPlanExcelVO);
} }
return extICMPlanExcelVOList; return extICMPlanExcelVOList;
...@@ -149,7 +139,7 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte ...@@ -149,7 +139,7 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
CustomMultipartFile multipartFile = null; CustomMultipartFile multipartFile = null;
Long fileId = null; Long fileId = null;
DxDocumentVO dxDocumentVO = docCenterFeignService.getDocumentWithFiles(id); DxDocumentVO dxDocumentVO = docCenterFeignService.getDocumentWithFiles(id);
if(!ObjectUtils.isEmpty(dxDocumentVO)){ if (!ObjectUtils.isEmpty(dxDocumentVO)) {
try { try {
//todo 取固定类型附件 //todo 取固定类型附件
fileId = dxDocumentVO.getObjFileLinks().get(0).getTarget().getId(); fileId = dxDocumentVO.getObjFileLinks().get(0).getTarget().getId();
...@@ -160,12 +150,12 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte ...@@ -160,12 +150,12 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
} }
try { try {
inputStream = new ByteArrayInputStream(multipartFile.getBytes()); inputStream = new ByteArrayInputStream(multipartFile.getBytes());
importICMPlan(inputStream,dxDocumentVO.getDxContextId().toString()); importICMPlan(inputStream, dxDocumentVO.getDxContextId().toString());
} catch (IOException e) { } catch (IOException e) {
log.info("[自动导入ICM计划] >>> 文件服务下载的文件:{}--转换为输入流失败!", fileId); log.info("[自动导入ICM计划] >>> 文件服务下载的文件:{}--转换为输入流失败!", fileId);
throw new DxBusinessException("500", "文件服务下载的文件转换为输入流失败:" + fileId); throw new DxBusinessException("500", "文件服务下载的文件转换为输入流失败:" + fileId);
} }
}else { } else {
log.info("根据计划文档id:" + id + "未查到相关数据"); log.info("根据计划文档id:" + id + "未查到相关数据");
} }
......
...@@ -5,9 +5,9 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -5,9 +5,9 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.util.StringUtils; import com.alibaba.excel.util.StringUtils;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.inet.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.expand.entity.DxDocumentVOExpand; import com.yonde.dcs.document.expand.entity.DxDocumentVOExpand;
import com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.plan.common.constants.Constants; import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO; import com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO; import com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO;
...@@ -146,10 +146,10 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan ...@@ -146,10 +146,10 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
extIEDPlanExcelVO.setSystemNumber(extIEDPlanVO.getSystemNumber()); extIEDPlanExcelVO.setSystemNumber(extIEDPlanVO.getSystemNumber());
extIEDPlanExcelVO.setDeviceNumber(extIEDPlanVO.getDeviceNumber()); extIEDPlanExcelVO.setDeviceNumber(extIEDPlanVO.getDeviceNumber());
extIEDPlanExcelVO.setPhase(extIEDPlanVO.getPhase()); extIEDPlanExcelVO.setPhase(extIEDPlanVO.getPhase());
if(!ObjectUtil.isEmpty(extIEDPlanVO.getAuditTime())){ if (!ObjectUtil.isEmpty(extIEDPlanVO.getAuditTime())) {
extIEDPlanExcelVO.setAuditTime(extIEDPlanVO.getAuditTime().format(DateTimeFormatter.ISO_DATE)); extIEDPlanExcelVO.setAuditTime(extIEDPlanVO.getAuditTime().format(DateTimeFormatter.ISO_DATE));
} }
if(!ObjectUtil.isEmpty(extIEDPlanVO.getFileSubmitTime())){ if (!ObjectUtil.isEmpty(extIEDPlanVO.getFileSubmitTime())) {
extIEDPlanExcelVO.setFileSubmitTime(extIEDPlanVO.getFileSubmitTime().format(DateTimeFormatter.ISO_DATE)); extIEDPlanExcelVO.setFileSubmitTime(extIEDPlanVO.getFileSubmitTime().format(DateTimeFormatter.ISO_DATE));
} }
extIEDPlanExcelVO.setEditor(extIEDPlanVO.getEditor()); extIEDPlanExcelVO.setEditor(extIEDPlanVO.getEditor());
......
...@@ -4,9 +4,9 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,9 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.poi.excel.ExcelReader; import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.ExcelWriter;
import com.inet.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.expand.entity.DxDocumentVOExpand; import com.yonde.dcs.document.expand.entity.DxDocumentVOExpand;
import com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.plan.common.constants.Constants; import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.utils.ExcelUtils; import com.yonde.dcs.plan.common.utils.ExcelUtils;
import com.yonde.dcs.plan.common.utils.FileUtils; import com.yonde.dcs.plan.common.utils.FileUtils;
......
...@@ -3,14 +3,18 @@ package com.yonde.dcs.plan.core.service.impl; ...@@ -3,14 +3,18 @@ package com.yonde.dcs.plan.core.service.impl;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.inet.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.plan.common.constants.Constants; import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.vo.ExtPuchasePlanAttributeVO;
import com.yonde.dcs.plan.common.vo.ExtPuchasePlanExcelVO; import com.yonde.dcs.plan.common.vo.ExtPuchasePlanExcelVO;
import com.yonde.dcs.plan.core.listener.PurchasePlanExcelReadListenner; import com.yonde.dcs.plan.core.listener.PurchasePlanExcelReadListenner;
import com.yonde.dcs.plan.core.repository.ExtPuchasePlanAttributeRepository;
import com.yonde.dcs.plan.core.service.ExtPuchasePlanAttributeService;
import com.yonde.dcs.plan.core.util.CommonUtils; import com.yonde.dcs.plan.core.util.CommonUtils;
import com.yonde.dcs.plan.core.util.FileUtils; import com.yonde.dcs.plan.core.util.FileUtils;
import com.yonde.dcs.plan.core.util.ResourceHelper; import com.yonde.dcs.plan.core.util.ResourceHelper;
import com.yonde.dcs.plan.entity.po.ExtPuchasePlanAttribute;
import com.yonde.dex.basedata.data.search.SearchItem; import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems; import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryCondition; import com.yonde.dex.basedata.data.search.SearchQueryCondition;
...@@ -21,26 +25,19 @@ import com.yonde.dex.basedata.exception.DxBusinessException; ...@@ -21,26 +25,19 @@ import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.dfs.feign.FileManagerFeignService; import com.yonde.dex.dfs.feign.FileManagerFeignService;
import com.yonde.dex.dfs.feign.RepoFileFeignService; import com.yonde.dex.dfs.feign.RepoFileFeignService;
import com.yonde.dex.systemfile.feign.SystemFileFeignService; import com.yonde.dex.systemfile.feign.SystemFileFeignService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import com.yonde.dcs.plan.common.vo.ExtPuchasePlanAttributeVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.core.service.ExtPuchasePlanAttributeService;
import com.yonde.dcs.plan.core.repository.ExtPuchasePlanAttributeRepository;
import com.yonde.dcs.plan.entity.po.ExtPuchasePlanAttribute;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/** /**
* @description: ExtPuchasePlanAttribute-ServiceImpl * @description: ExtPuchasePlanAttribute-ServiceImpl
...@@ -68,7 +65,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut ...@@ -68,7 +65,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
@Override @Override
public String importPurchasePlan(InputStream inputStream,String projectId) { public String importPurchasePlan(InputStream inputStream, String projectId) {
EasyExcel.read(inputStream, ExtPuchasePlanExcelVO.class, EasyExcel.read(inputStream, ExtPuchasePlanExcelVO.class,
new PurchasePlanExcelReadListenner(projectId)) new PurchasePlanExcelReadListenner(projectId))
.sheet() .sheet()
...@@ -108,7 +105,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut ...@@ -108,7 +105,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
throw new DxBusinessException("500", "文件服务下载的文件转换为输入流失败:" + fileId); throw new DxBusinessException("500", "文件服务下载的文件转换为输入流失败:" + fileId);
} }
String dir = ResourceHelper.CreateTemDir().getPath(); String dir = ResourceHelper.CreateTemDir().getPath();
String filePath = dir+ Constants.PURCHASE_PLAN_EXCEL_NAME; String filePath = dir + Constants.PURCHASE_PLAN_EXCEL_NAME;
//创建采购计划列表.xlsx 文件 //创建采购计划列表.xlsx 文件
FileUtils.inputToFile(inputStream, filePath); FileUtils.inputToFile(inputStream, filePath);
//向表格中写入数据 //向表格中写入数据
...@@ -129,7 +126,8 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut ...@@ -129,7 +126,8 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
/** /**
* 计划文件签审通过之后,调用该方法,自动导入计划 * 计划文件签审通过之后,调用该方法,自动导入计划
* @param id 文档id *
* @param id 文档id
* @return * @return
*/ */
@Override @Override
...@@ -139,7 +137,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut ...@@ -139,7 +137,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
CustomMultipartFile multipartFile = null; CustomMultipartFile multipartFile = null;
Long fileId = null; Long fileId = null;
DxDocumentVO dxDocumentVO = docCenterFeignService.getDocumentWithFiles(id); DxDocumentVO dxDocumentVO = docCenterFeignService.getDocumentWithFiles(id);
if(!ObjectUtils.isEmpty(dxDocumentVO)){ if (!ObjectUtils.isEmpty(dxDocumentVO)) {
try { try {
//todo 取固定类型附件 //todo 取固定类型附件
fileId = dxDocumentVO.getObjFileLinks().get(0).getTarget().getId(); fileId = dxDocumentVO.getObjFileLinks().get(0).getTarget().getId();
...@@ -150,12 +148,12 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut ...@@ -150,12 +148,12 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
} }
try { try {
inputStream = new ByteArrayInputStream(multipartFile.getBytes()); inputStream = new ByteArrayInputStream(multipartFile.getBytes());
importPurchasePlan(inputStream,dxDocumentVO.getDxContextId().toString()); importPurchasePlan(inputStream, dxDocumentVO.getDxContextId().toString());
} catch (IOException e) { } catch (IOException e) {
log.info("[自动导入采购计划] >>> 文件服务下载的文件:{}--转换为输入流失败!", fileId); log.info("[自动导入采购计划] >>> 文件服务下载的文件:{}--转换为输入流失败!", fileId);
throw new DxBusinessException("500", "文件服务下载的文件转换为输入流失败:" + fileId); throw new DxBusinessException("500", "文件服务下载的文件转换为输入流失败:" + fileId);
} }
}else { } else {
log.info("根据计划文档id:" + id + "未查到相关数据"); log.info("根据计划文档id:" + id + "未查到相关数据");
} }
...@@ -164,6 +162,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut ...@@ -164,6 +162,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
/** /**
* 数据转换,将PO转换成EXCEL-VO; * 数据转换,将PO转换成EXCEL-VO;
*
* @param content * @param content
* @return * @return
*/ */
......
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