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
6ba46bd0
Commit
6ba46bd0
authored
Sep 25, 2024
by
wangqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ICM计划自动导入;修改IED计划状态
parent
a4270d0d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
104 additions
and
7 deletions
+104
-7
ExtICMExternalInterfacePlanController.java
...ore/controller/ExtICMExternalInterfacePlanController.java
+12
-1
ExtIEDPlanController.java
.../yonde/dcs/plan/core/controller/ExtIEDPlanController.java
+7
-1
ExtICMExternalInterfacePlanService.java
...plan/core/service/ExtICMExternalInterfacePlanService.java
+2
-0
ExtICMExternalInterfacePlanServiceImpl.java
.../service/impl/ExtICMExternalInterfacePlanServiceImpl.java
+37
-0
ExtIEDPlanServiceImpl.java
...nde/dcs/plan/core/service/impl/ExtIEDPlanServiceImpl.java
+34
-4
ExtICMExternalInterfacePlanServiceFeign.java
...s/plan/feign/ExtICMExternalInterfacePlanServiceFeign.java
+11
-0
ExtIEDPlanServiceFeign.java
...java/com/yonde/dcs/plan/feign/ExtIEDPlanServiceFeign.java
+1
-1
No files found.
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/controller/ExtICMExternalInterfacePlanController.java
View file @
6ba46bd0
...
...
@@ -57,7 +57,18 @@ public class ExtICMExternalInterfacePlanController<V extends ExtICMExternalInter
@ApiOperation
(
value
=
"导出ICM计划"
,
notes
=
"导出ICM计划"
,
httpMethod
=
"GET"
)
@GetMapping
(
value
=
"/exportICMPlan"
)
public
ApiResult
exportPlan
(
HttpServletResponse
response
,
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
throws
IOException
{
return
ApiResult
.
ok
(
extICMExternalInterfacePlanService
.
exportICMPlan
(
response
,
ids
),
"IED计划导出成功"
);
return
ApiResult
.
ok
(
extICMExternalInterfacePlanService
.
exportICMPlan
(
response
,
ids
),
"ICM计划导出成功"
);
}
/**
*
* @param id PBO Document文档对象的id
* @return
*/
@ApiOperation
(
"ICM计划自动导入"
)
@GetMapping
(
value
=
"/autoImportICMPlan"
)
public
ApiResult
autoImportICMPlan
(
@RequestParam
(
"id"
)
long
id
){
return
ApiResult
.
ok
(
extICMExternalInterfacePlanService
.
autoImportICMPlan
(
id
),
"ICM计划自动导入成功"
);
}
}
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/controller/ExtIEDPlanController.java
View file @
6ba46bd0
...
...
@@ -67,10 +67,16 @@ public class ExtIEDPlanController<V extends ExtIEDPlanVO, S extends ExtIEDPlanSe
return
ApiResult
.
ok
(
extIEDPlanService
.
createIEDPlanTask
(
extIEDPlanVO
),
"成功创建IED计划任务"
);
}
/**
*
* @param id document文档id
* @param planState IED计划状态
* @return
*/
@ApiOperation
(
value
=
"修改IED计划状态"
,
notes
=
"修改IED计划状态"
)
@GetMapping
(
value
=
"/updatePlanState"
)
public
ApiResult
updatePlanState
(
@RequestParam
(
"id"
)
Long
id
,
@RequestParam
(
"planState"
)
String
planState
){
return
ApiResult
.
ok
(
extIEDPlanService
.
updatePlanState
(
id
,
planState
),
"更新状态成功"
);
return
ApiResult
.
ok
(
extIEDPlanService
.
updatePlanState
(
id
,
planState
),
"更新
计划
状态成功"
);
}
}
...
...
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/ExtICMExternalInterfacePlanService.java
View file @
6ba46bd0
...
...
@@ -20,4 +20,6 @@ public interface ExtICMExternalInterfacePlanService<V extends ExtICMExternalInte
String
importICMPlan
(
InputStream
inputStream
,
String
projectId
);
String
exportICMPlan
(
HttpServletResponse
response
,
List
<
String
>
ids
)
throws
IOException
;
String
autoImportICMPlan
(
long
id
);
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtICMExternalInterfacePlanServiceImpl.java
View file @
6ba46bd0
...
...
@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import
cn.hutool.core.io.FileUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.feign.expand.ExtDxDocumentServiceFeign
;
import
com.yonde.dcs.plan.common.constants.Constants
;
import
com.yonde.dcs.plan.common.vo.ExtICMPlanExcelVO
;
import
com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO
;
...
...
@@ -35,6 +37,7 @@ 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.web.bind.annotation.*
;
import
com.yonde.dcs.plan.core.service.ExtICMExternalInterfacePlanService
;
import
com.yonde.dcs.plan.core.repository.ExtICMExternalInterfacePlanRepository
;
...
...
@@ -60,6 +63,9 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
@Autowired
private
FileManagerFeignService
fileManagerFeignService
;
@Autowired
private
ExtDxDocumentServiceFeign
docCenterFeignService
;
@Autowired
ExtICMExternalInterfacePlanRepository
<
ExtICMExternalInterfacePlan
>
extICMExternalInterfacePlanRepository
;
...
...
@@ -123,6 +129,8 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
return
ApiResult
.
SUCCESS
;
}
private
List
<
ExtICMPlanExcelVO
>
transformationObject
(
List
<
V
>
extICMPlanList
)
{
List
<
ExtICMPlanExcelVO
>
extICMPlanExcelVOList
=
new
ArrayList
<>();
for
(
ExtICMExternalInterfacePlanVO
extICMPlanVO
:
extICMPlanList
)
{
...
...
@@ -132,6 +140,35 @@ public class ExtICMExternalInterfacePlanServiceImpl<V extends ExtICMExternalInte
}
return
extICMPlanExcelVOList
;
}
@Override
public
String
autoImportICMPlan
(
long
id
)
{
InputStream
inputStream
=
null
;
CustomMultipartFile
multipartFile
=
null
;
Long
fileId
=
null
;
DxDocumentVO
dxDocumentVO
=
docCenterFeignService
.
getDocumentWithFiles
(
id
);
if
(!
ObjectUtils
.
isEmpty
(
dxDocumentVO
)){
try
{
//todo 取固定类型附件
fileId
=
dxDocumentVO
.
getObjFileLinks
().
get
(
0
).
getTarget
().
getId
();
multipartFile
=
fileManagerFeignService
.
feignDownloadIO
(
fileId
);
}
catch
(
IOException
e
)
{
log
.
info
(
"[自动导入ICM计划] >>> 文件服务下载文档附件:{}--失败!"
,
fileId
);
throw
new
DxBusinessException
(
"500"
,
"文件服务文档附件失败:"
+
fileId
);
}
try
{
inputStream
=
new
ByteArrayInputStream
(
multipartFile
.
getBytes
());
importICMPlan
(
inputStream
,
dxDocumentVO
.
getDxContextId
().
toString
());
}
catch
(
IOException
e
)
{
log
.
info
(
"[自动导入ICM计划] >>> 文件服务下载的文件:{}--转换为输入流失败!"
,
fileId
);
throw
new
DxBusinessException
(
"500"
,
"文件服务下载的文件转换为输入流失败:"
+
fileId
);
}
}
else
{
log
.
info
(
"根据计划文档id:"
+
id
+
"未查到相关数据"
);
}
return
ApiResult
.
SUCCESS
;
}
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtIEDPlanServiceImpl.java
View file @
6ba46bd0
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
;
...
...
@@ -23,10 +24,12 @@ import com.yonde.dcs.plan.core.service.ExtIEDPlanService;
import
com.yonde.dcs.plan.core.util.CommonUtils
;
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
;
...
...
@@ -52,6 +55,7 @@ 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
;
...
...
@@ -175,13 +179,23 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
createIEDPlanTask
(
ExtIEDPlanVO
extIEDPlanVO
)
{
System
.
out
.
println
(
JSONUtil
.
toJsonStr
(
extIEDPlanVO
));
DxDocumentVO
dxDocumentVO
=
new
DxDocumentVO
();
DxDocumentVOExpand
dxDocumentExpand
=
new
DxDocumentVOExpand
();
//文件类型 --文件、图册
//文件分类--需要取英文
dxDocumentVO
.
setSubTypeName
(
extIEDPlanVO
.
getFileClassify
());
//todo 需要取英文动态类型
if
(!
StringUtils
.
isEmpty
(
extIEDPlanVO
.
getFileClassify
())){
if
(
extIEDPlanVO
.
getFileClassify
().
contains
(
"技术文件"
)){
dxDocumentVO
.
setSubTypeName
(
"TechnicalFile"
);
}
else
{
//todo wq暂时先不设置其它动态类型
log
.
info
(
"IED计划除技术文件类型的文件还未设置其它类型"
);
}
}
//文件编号
dxDocumentVO
.
setNumber
(
extIEDPlanVO
.
getFileNumber
());
...
...
@@ -206,7 +220,6 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
ExtIEDPlanDocLinkVO
extIEDPlanDocLinkVO
=
new
ExtIEDPlanDocLinkVO
();
extIEDPlanDocLinkVO
.
setTargetId
(
dxDocumentVOForDB
.
getId
());
extIEDPlanDocLinkVO
.
setSourceId
(
extIEDPlanVO
.
getId
());
extIEDPlanDocLinkVO
.
setCreateTime
(
LocalDateTime
.
now
());
extIEDPlanDocLinkVO
.
setOperator
(
OperatorType
.
ADD
);
extIEDPlanDocLinkService
.
saveRecursion
(
extIEDPlanDocLinkVO
);
...
...
@@ -221,14 +234,31 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
* @return
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
updatePlanState
(
Long
id
,
String
planState
)
{
if
(!
StringUtils
.
isEmpty
(
planState
)){
this
.
changeStatus
(
id
,
planState
,
true
);
SearchQueryCondition
queryCondition
=
SearchUtil
.
buildQuery
(
"targetId"
,
SearchItem
.
Operator
.
EQ
,
id
);
// SearchQueryCondition condition = SearchQueryCondition.builder()
// .searchItems(SearchItems.builder()
// .item(new SearchItem("targetId", SearchItem.Operator.EQ, id, null))
// .build())
// .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
+
",未查到相关计划"
);
}
}
else
{
throw
new
DxBusinessException
(
"500"
,
"参数不能为空"
);
}
return
ApiResult
.
SUCCESS
;
}
}
dcs-plan-feign/src/main/java/com/yonde/dcs/plan/feign/ExtICMExternalInterfacePlanServiceFeign.java
View file @
6ba46bd0
package
com
.
yonde
.
dcs
.
plan
.
feign
;
import
com.yonde.dcs.plan.common.vo.ExtICMExternalInterfacePlanVO
;
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.ExtICMExternalInterfacePlanServiceFeignShadow
;
...
...
@@ -16,4 +18,13 @@ import com.yonde.dcs.plan.feign.shadow.ExtICMExternalInterfacePlanServiceFeignSh
@FeignClient
(
value
=
"${dcs.feign.INET-PLAN}"
,
path
=
"/ExtICMExternalInterfacePlan"
)
public
interface
ExtICMExternalInterfacePlanServiceFeign
<
V
extends
ExtICMExternalInterfacePlanVO
>
extends
ExtICMExternalInterfacePlanServiceFeignShadow
<
V
>
{
/**
*
* @param id PBO Document文档对象的id
* @return
*/
@ApiOperation
(
"ICM计划自动导入"
)
@GetMapping
(
value
=
"/autoImportICMPlan"
)
public
String
autoImportICMPlan
(
@RequestParam
(
"id"
)
long
id
);
}
dcs-plan-feign/src/main/java/com/yonde/dcs/plan/feign/ExtIEDPlanServiceFeign.java
View file @
6ba46bd0
...
...
@@ -24,6 +24,6 @@ public interface ExtIEDPlanServiceFeign<V extends ExtIEDPlanVO> extends ExtIEDPl
@ApiOperation
(
value
=
"修改IED计划状态"
,
notes
=
"修改IED计划状态"
)
@GetMapping
(
value
=
"/updatePlanState"
)
public
String
updatePlanState
(
@RequestParam
(
name
=
"IED计划id"
,
value
=
"id"
)
Long
id
,
@RequestParam
(
value
=
"planState"
)
String
planState
);
public
String
updatePlanState
(
@RequestParam
(
"id"
)
Long
id
,
@RequestParam
(
value
=
"planState"
)
String
planState
);
}
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