Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dcs-plan
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
INET-TWO
server
dcs-plan
Commits
59480e71
Commit
59480e71
authored
Sep 23, 2024
by
wangqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采购计划自动化任务功能
parent
ff8c0826
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
2 deletions
+50
-2
ExtPuchasePlanAttributeService.java
...dcs/plan/core/service/ExtPuchasePlanAttributeService.java
+2
-0
ExtPuchasePlanAttributeServiceImpl.java
...core/service/impl/ExtPuchasePlanAttributeServiceImpl.java
+42
-1
pom.xml
dcs-plan-feign/pom.xml
+1
-1
ExtPuchasePlanAttributeServiceFeign.java
...e/dcs/plan/feign/ExtPuchasePlanAttributeServiceFeign.java
+5
-0
No files found.
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/ExtPuchasePlanAttributeService.java
View file @
59480e71
...
@@ -22,4 +22,6 @@ public interface ExtPuchasePlanAttributeService<V extends ExtPuchasePlanAttribut
...
@@ -22,4 +22,6 @@ public interface ExtPuchasePlanAttributeService<V extends ExtPuchasePlanAttribut
public
String
importPurchasePlan
(
InputStream
inputStream
,
String
projectId
);
public
String
importPurchasePlan
(
InputStream
inputStream
,
String
projectId
);
public
String
exportPurchasePlanFile
(
HttpServletResponse
response
,
List
<
String
>
ids
)
throws
IOException
;
public
String
exportPurchasePlanFile
(
HttpServletResponse
response
,
List
<
String
>
ids
)
throws
IOException
;
public
String
autoImportPurchasePlan
(
long
id
);
}
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtPuchasePlanAttributeServiceImpl.java
View file @
59480e71
...
@@ -3,6 +3,10 @@ package com.yonde.dcs.plan.core.service.impl;
...
@@ -3,6 +3,10 @@ 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.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.document.feign.DocCenterFeignService
;
import
com.yonde.dcs.document.feign.shadow.DxDocumentFeignShadow
;
import
com.yonde.dcs.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.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
;
...
@@ -31,6 +35,7 @@ import com.yonde.dcs.plan.common.vo.ExtPuchasePlanAttributeVO;
...
@@ -31,6 +35,7 @@ import com.yonde.dcs.plan.common.vo.ExtPuchasePlanAttributeVO;
import
org.springframework.beans.factory.annotation.Qualifier
;
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
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
com.yonde.dcs.plan.core.service.ExtPuchasePlanAttributeService
;
import
com.yonde.dcs.plan.core.service.ExtPuchasePlanAttributeService
;
import
com.yonde.dcs.plan.core.repository.ExtPuchasePlanAttributeRepository
;
import
com.yonde.dcs.plan.core.repository.ExtPuchasePlanAttributeRepository
;
...
@@ -60,7 +65,9 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
...
@@ -60,7 +65,9 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
private
FileManagerFeignService
fileManagerFeignService
;
private
FileManagerFeignService
fileManagerFeignService
;
@Autowired
@Autowired
private
SystemFileFeignService
systemFileFeignService
;
private
SystemFileFeignService
systemFileFeignService
;
@Qualifier
(
"com.yonde.dcs.feign.expand.ExtDxDocumentServiceFeign"
)
@Autowired
private
ExtDxDocumentServiceFeign
docCenterFeignService
;
@Override
@Override
public
String
importPurchasePlan
(
InputStream
inputStream
,
String
projectId
)
{
public
String
importPurchasePlan
(
InputStream
inputStream
,
String
projectId
)
{
...
@@ -122,6 +129,40 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
...
@@ -122,6 +129,40 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
return
ApiResult
.
SUCCESS
;
return
ApiResult
.
SUCCESS
;
}
}
/**
* 计划文件签审通过之后,调用该方法,自动导入计划
* @param id 文档id
* @return
*/
@Override
public
String
autoImportPurchasePlan
(
long
id
)
{
InputStream
inputStream
=
null
;
CustomMultipartFile
multipartFile
=
null
;
Long
fileId
=
null
;
DxDocumentVO
dxDocumentVO
=
docCenterFeignService
.
getDocumentWithFiles
(
id
);
if
(!
ObjectUtils
.
isEmpty
(
dxDocumentVO
)){
try
{
fileId
=
dxDocumentVO
.
getObjFileLinks
().
get
(
0
).
getTarget
().
getId
();
multipartFile
=
fileManagerFeignService
.
feignDownloadIO
(
fileId
);
}
catch
(
IOException
e
)
{
log
.
info
(
"[自动导入采购计划] >>> 文件服务下载文档附件:{}--失败!"
,
fileId
);
throw
new
DxBusinessException
(
"500"
,
"文件服务文档附件失败:"
+
fileId
);
}
try
{
inputStream
=
new
ByteArrayInputStream
(
multipartFile
.
getBytes
());
importPurchasePlan
(
inputStream
,
dxDocumentVO
.
getDxContextId
().
toString
());
}
catch
(
IOException
e
)
{
log
.
info
(
"[自动导入采购计划] >>> 文件服务下载的文件:{}--转换为输入流失败!"
,
fileId
);
throw
new
DxBusinessException
(
"500"
,
"文件服务下载的文件转换为输入流失败:"
+
fileId
);
}
}
else
{
log
.
info
(
"根据计划文档id:"
+
id
+
"未查到相关数据"
);
}
return
ApiResult
.
SUCCESS
;
}
/**
/**
* 数据转换,将PO转换成EXCEL-VO;
* 数据转换,将PO转换成EXCEL-VO;
* @param content
* @param content
...
...
dcs-plan-feign/pom.xml
View file @
59480e71
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.yonde.dcs
</groupId>
<groupId>
com.yonde.dcs
</groupId>
<artifactId>
dcs-doc-feign
</artifactId>
<artifactId>
dcs-doc-
expand-
feign
</artifactId>
<version>
4.1-20240919-RELEASE
</version>
<version>
4.1-20240919-RELEASE
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
dcs-plan-feign/src/main/java/com/yonde/dcs/plan/feign/ExtPuchasePlanAttributeServiceFeign.java
View file @
59480e71
...
@@ -2,6 +2,7 @@ package com.yonde.dcs.plan.feign;
...
@@ -2,6 +2,7 @@ package com.yonde.dcs.plan.feign;
import
com.yonde.dcs.plan.common.vo.ExtPuchasePlanAttributeVO
;
import
com.yonde.dcs.plan.common.vo.ExtPuchasePlanAttributeVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
com.yonde.dcs.plan.feign.shadow.ExtPuchasePlanAttributeServiceFeignShadow
;
import
com.yonde.dcs.plan.feign.shadow.ExtPuchasePlanAttributeServiceFeignShadow
;
...
@@ -16,4 +17,8 @@ import com.yonde.dcs.plan.feign.shadow.ExtPuchasePlanAttributeServiceFeignShadow
...
@@ -16,4 +17,8 @@ import com.yonde.dcs.plan.feign.shadow.ExtPuchasePlanAttributeServiceFeignShadow
@FeignClient
(
value
=
"${dcs.feign.INET-PLAN}"
,
path
=
"/ExtPuchasePlanAttribute"
)
@FeignClient
(
value
=
"${dcs.feign.INET-PLAN}"
,
path
=
"/ExtPuchasePlanAttribute"
)
public
interface
ExtPuchasePlanAttributeServiceFeign
<
V
extends
ExtPuchasePlanAttributeVO
>
extends
ExtPuchasePlanAttributeServiceFeignShadow
<
V
>
{
public
interface
ExtPuchasePlanAttributeServiceFeign
<
V
extends
ExtPuchasePlanAttributeVO
>
extends
ExtPuchasePlanAttributeServiceFeignShadow
<
V
>
{
@ApiOperation
(
"采购计划自动导入"
)
@GetMapping
(
value
=
"/autoImportPurchasePlan"
)
public
String
autoImportPurchasePlan
(
@RequestParam
(
"id"
)
long
id
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment