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
6eb97009
Commit
6eb97009
authored
Aug 01, 2024
by
wangqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加fegin接口
parent
0f2e36d7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
6 deletions
+171
-6
ExtPlanController.java
...com/yonde/dcs/plan/core/controller/ExtPlanController.java
+9
-2
ExtPlanService.java
.../java/com/yonde/dcs/plan/core/service/ExtPlanService.java
+11
-1
ExtPlanServiceImpl.java
.../yonde/dcs/plan/core/service/impl/ExtPlanServiceImpl.java
+92
-2
ExtPlanServiceFeign.java
...in/java/com/yonde/dcs/plan/feign/ExtPlanServiceFeign.java
+59
-1
No files found.
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/controller/ExtPlanController.java
View file @
6eb97009
package
com
.
yonde
.
dcs
.
plan
.
core
.
controller
;
package
com
.
yonde
.
dcs
.
plan
.
core
.
controller
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -66,7 +67,7 @@ public class ExtPlanController<V extends ExtPlanVO, S extends ExtPlanService<V>>
...
@@ -66,7 +67,7 @@ public class ExtPlanController<V extends ExtPlanVO, S extends ExtPlanService<V>>
*/
*/
@ApiOperation
(
"计划驱动编制任务"
)
@ApiOperation
(
"计划驱动编制任务"
)
@GetMapping
(
value
=
"/changeState"
)
@GetMapping
(
value
=
"/changeState"
)
public
ApiResult
c
hangeState
(
@RequestParam
String
state
,
@RequestParam
List
<
Long
>
ids
)
{
public
ApiResult
extC
hangeState
(
@RequestParam
String
state
,
@RequestParam
List
<
Long
>
ids
)
{
extPlanService
.
extChangeState
(
state
,
ids
);
extPlanService
.
extChangeState
(
state
,
ids
);
return
ApiResult
.
ok
(
"启动计划成功"
);
return
ApiResult
.
ok
(
"启动计划成功"
);
}
}
...
@@ -80,7 +81,7 @@ public class ExtPlanController<V extends ExtPlanVO, S extends ExtPlanService<V>>
...
@@ -80,7 +81,7 @@ public class ExtPlanController<V extends ExtPlanVO, S extends ExtPlanService<V>>
@ApiOperation
(
"校验计划答复状态"
)
@ApiOperation
(
"校验计划答复状态"
)
@GetMapping
(
value
=
"/checkReplayState"
)
@GetMapping
(
value
=
"/checkReplayState"
)
public
ApiResult
checkReplayState
(
@RequestParam
Long
id
)
{
public
ApiResult
checkReplayState
(
@RequestParam
Long
id
)
{
return
extPlanService
.
checkReplayState
(
id
);
return
ApiResult
.
ok
(
extPlanService
.
checkReplayState
(
id
)
);
}
}
...
@@ -96,6 +97,12 @@ public class ExtPlanController<V extends ExtPlanVO, S extends ExtPlanService<V>>
...
@@ -96,6 +97,12 @@ public class ExtPlanController<V extends ExtPlanVO, S extends ExtPlanService<V>>
extPlanService
.
exportPlan
(
response
,
ids
);
extPlanService
.
exportPlan
(
response
,
ids
);
}
}
@ApiOperation
(
value
=
"通过文件分类查询"
,
notes
=
"通过文件分类查询"
,
httpMethod
=
"post"
)
@GetMapping
(
value
=
"/searchFileType"
)
public
void
searchFileType
(
@RequestParam
(
"fileType"
)
String
fileType
,
DxDocumentVO
doc
){
extPlanService
.
searchFileType
(
fileType
,
doc
);
}
}
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/ExtPlanService.java
View file @
6eb97009
package
com
.
yonde
.
dcs
.
plan
.
core
.
service
;
package
com
.
yonde
.
dcs
.
plan
.
core
.
service
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.plan.common.vo.ExtPlanVO
;
import
com.yonde.dcs.plan.common.vo.ExtPlanVO
;
import
com.yonde.dcs.plan.core.service.shadow.ExtPlanServiceShadow
;
import
com.yonde.dcs.plan.core.service.shadow.ExtPlanServiceShadow
;
import
com.yonde.dex.basedata.entity.api.ApiResult
;
import
com.yonde.dex.basedata.entity.api.ApiResult
;
...
@@ -57,7 +58,7 @@ public interface ExtPlanService<V extends ExtPlanVO> extends ExtPlanServiceShado
...
@@ -57,7 +58,7 @@ public interface ExtPlanService<V extends ExtPlanVO> extends ExtPlanServiceShado
* @param id
* @param id
* @return
* @return
*/
*/
ApiResult
checkReplayState
(
Long
id
);
String
checkReplayState
(
Long
id
);
/**
/**
* 导出计划
* 导出计划
...
@@ -67,4 +68,13 @@ public interface ExtPlanService<V extends ExtPlanVO> extends ExtPlanServiceShado
...
@@ -67,4 +68,13 @@ public interface ExtPlanService<V extends ExtPlanVO> extends ExtPlanServiceShado
*/
*/
void
exportPlan
(
HttpServletResponse
response
,
List
<
Long
>
ids
);
void
exportPlan
(
HttpServletResponse
response
,
List
<
Long
>
ids
);
/**
* 通过文件分类查询
*
* @param fileType
* @param doc
*/
void
searchFileType
(
String
fileType
,
DxDocumentVO
doc
);
}
}
dcs-plan-core/src/main/java/com/yonde/dcs/plan/core/service/impl/ExtPlanServiceImpl.java
View file @
6eb97009
...
@@ -21,6 +21,8 @@ import com.yonde.dex.basedata.entity.api.ApiResult;
...
@@ -21,6 +21,8 @@ import com.yonde.dex.basedata.entity.api.ApiResult;
import
com.yonde.dex.basedata.entity.data.DxPageImpl
;
import
com.yonde.dex.basedata.entity.data.DxPageImpl
;
import
com.yonde.dex.basedata.entity.data.OperatorType
;
import
com.yonde.dex.basedata.entity.data.OperatorType
;
import
com.yonde.dex.basedata.exception.DxBusinessException
;
import
com.yonde.dex.basedata.exception.DxBusinessException
;
import
com.yonde.dex.bmodel.common.entity.vo.ModelDefinitionVO
;
import
com.yonde.dex.bmodel.feign.api.ModelDefinitionFeignService
;
import
com.yonde.dex.dao.service.util.DxPageUtils
;
import
com.yonde.dex.dao.service.util.DxPageUtils
;
import
com.yonde.dex.dict.feign.DictDataFeignService
;
import
com.yonde.dex.dict.feign.DictDataFeignService
;
import
com.yonde.dex.dict.service.vo.DictDataVO
;
import
com.yonde.dex.dict.service.vo.DictDataVO
;
...
@@ -84,6 +86,9 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
...
@@ -84,6 +86,9 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
@Autowired
@Autowired
private
DxUserInfoFeign
userService
;
private
DxUserInfoFeign
userService
;
@Autowired
private
ModelDefinitionFeignService
modelDefinitionService
;
/**
/**
* 通过userId获取组织名
* 通过userId获取组织名
*
*
...
@@ -651,7 +656,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
...
@@ -651,7 +656,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
* @return
* @return
*/
*/
@Override
@Override
public
ApiResult
checkReplayState
(
Long
id
)
{
public
String
checkReplayState
(
Long
id
)
{
//通过id查询
//通过id查询
ExtDistributeRecordVO
recordVO
=
this
.
recursionDisRecordVO
(
id
);
ExtDistributeRecordVO
recordVO
=
this
.
recursionDisRecordVO
(
id
);
List
<
ExtDisReocredLinkVO
>
sourceDisReocredLink
=
recordVO
.
getExtDisReocredLink
();
List
<
ExtDisReocredLinkVO
>
sourceDisReocredLink
=
recordVO
.
getExtDisReocredLink
();
...
@@ -673,7 +678,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
...
@@ -673,7 +678,7 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
recordVO
.
setOperator
(
OperatorType
.
MODIFY
);
recordVO
.
setOperator
(
OperatorType
.
MODIFY
);
extDistributeRecordService
.
saveRecursion
(
recordVO
);
extDistributeRecordService
.
saveRecursion
(
recordVO
);
}
}
return
ApiResult
.
ok
(
"任务关闭"
)
;
return
"任务关闭"
;
}
}
/**
/**
...
@@ -797,6 +802,91 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
...
@@ -797,6 +802,91 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
writer
.
addHeaderAlias
(
"secretCode"
,
"密级"
);
writer
.
addHeaderAlias
(
"secretCode"
,
"密级"
);
}
}
/**
* 通过文件分类查询
*
* @param fileType
*/
@Override
public
void
searchFileType
(
String
fileType
,
DxDocumentVO
doc
)
{
String
[]
fileTypeSplit
=
fileType
.
split
(
"/"
);
int
length
=
fileTypeSplit
.
length
;
if
(
length
==
1
)
{
throw
new
DxBusinessException
(
"-1"
,
"该计划交付文件分类有误,请检查该条计划文件分类!"
);
}
String
name
=
fileType
.
substring
(
fileType
.
lastIndexOf
(
"/"
)
+
1
);
//获取subTypeName的父级名称
String
nameTamp
=
fileType
.
substring
(
fileType
.
lastIndexOf
(
"/"
,
fileType
.
lastIndexOf
(
"/"
)
-
2
)
+
1
);
String
parentName
=
nameTamp
.
substring
(
0
,
nameTamp
.
lastIndexOf
(
"/"
));
//通过名称查询各级分类
List
<
ModelDefinitionVO
>
modelDefinitionVOS
=
this
.
searchModelByDisplayName
(
name
);
//通过分类判断父级分类
ModelDefinitionVO
modelDefinitionVO
=
this
.
checkParentName
(
modelDefinitionVOS
,
parentName
);
//设置文档的subTypeName
doc
.
setSubTypeName
(
modelDefinitionVO
.
getName
());
//设置文档的各级分类
String
stableId
=
modelDefinitionVO
.
getStableId
();
//读取三级分类 eg:1-14-7-3-1626767724903-1626767984017-1626767984019-1626767984020-1626767984022
// 1-14-7-3-1626767724903-1626767984017-1626767994041-1626767994061
String
stabledIds
=
stableId
.
substring
(
37
);
String
substring
=
stabledIds
.
substring
(
stabledIds
.
lastIndexOf
(
"-"
,
stabledIds
.
lastIndexOf
(
"-"
,
stabledIds
.
lastIndexOf
(
"-"
)
-
1
)
-
1
)
+
1
);
String
[]
split
=
substring
.
split
(
"-"
);
if
(
split
.
length
==
2
)
{
//todo wq:在4.1中DxDocumentVO对象无下面注释属性
// doc.setOneLevCategory(this.searchModelName(split[0]));
// doc.setTwoLevCategory(this.searchModelName(split[1]));
// doc.setThreeLevCategory(null);
}
if
(
split
.
length
==
3
)
{
//todo wq:在4.1中DxDocumentVO对象无下面注释属性
// doc.setOneLevCategory(this.searchModelName(split[0]));
// doc.setTwoLevCategory(this.searchModelName(split[1]));
// doc.setThreeLevCategory(this.searchModelName(split[2]));
}
}
/**
* 通过名称查询各级分类
*
* @param name
* @return
*/
private
List
<
ModelDefinitionVO
>
searchModelByDisplayName
(
String
name
)
{
SearchQueryCondition
query
=
SearchQueryCondition
.
builder
()
.
searchItems
(
SearchItems
.
builder
()
.
item
(
new
SearchItem
(
"displayName"
,
SearchItem
.
Operator
.
EQ
,
name
,
null
))
.
operator
(
SearchItems
.
BooleanOperator
.
AND
).
build
()).
build
();
DxPageImpl
<
ModelDefinitionVO
>
dxPage
=
modelDefinitionService
.
findRecursion
(
query
);
//return DxPageUtils.getFirst(dxPage);
List
<
ModelDefinitionVO
>
content
=
dxPage
.
getContent
();
return
content
;
}
/**
* 校验二级分类名称是否等于通过subTypeName查询的名称
*
* @param modelDefinitionVOS
* @param parentName
* @return
*/
private
ModelDefinitionVO
checkParentName
(
List
<
ModelDefinitionVO
>
modelDefinitionVOS
,
String
parentName
)
{
if
(
modelDefinitionVOS
.
size
()
>=
2
)
{
//不同分类下有同名的subTypeName
ModelDefinitionVO
modelDefinitionVO
=
modelDefinitionVOS
.
stream
().
filter
(
item
->
{
Long
parentId
=
item
.
getParentId
();
//通过parentId获取模型信息
ModelDefinitionVO
definitionVO
=
modelDefinitionService
.
get
(
parentId
);
if
(
parentName
.
equals
(
definitionVO
.
getDisplayName
()))
{
return
true
;
}
return
false
;
}).
findAny
().
orElse
(
null
);
return
modelDefinitionVO
;
}
//没有重名的模型,获取一个
return
modelDefinitionVOS
.
get
(
0
);
}
}
}
dcs-plan-feign/src/main/java/com/yonde/dcs/plan/feign/ExtPlanServiceFeign.java
View file @
6eb97009
package
com
.
yonde
.
dcs
.
plan
.
feign
;
package
com
.
yonde
.
dcs
.
plan
.
feign
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.plan.common.vo.ExtPlanVO
;
import
com.yonde.dcs.plan.common.vo.ExtPlanVO
;
import
com.yonde.dex.basedata.entity.api.ApiResult
;
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.ExtPlanServiceFeignShadow
;
import
com.yonde.dcs.plan.feign.shadow.ExtPlanServiceFeignShadow
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.List
;
/**
/**
* @description: ExtPlan-Feign
* @description: ExtPlan-Feign
String
* @author: dexadmin
* @author: dexadmin
* @version: V
* @version: V
* @date: 2024-7-26 9:34:06
* @date: 2024-7-26 9:34:06
...
@@ -16,4 +24,54 @@ import com.yonde.dcs.plan.feign.shadow.ExtPlanServiceFeignShadow;
...
@@ -16,4 +24,54 @@ import com.yonde.dcs.plan.feign.shadow.ExtPlanServiceFeignShadow;
@FeignClient
(
value
=
"${dcs.feign.INET-PLAN}"
,
path
=
"/ExtPlan"
)
@FeignClient
(
value
=
"${dcs.feign.INET-PLAN}"
,
path
=
"/ExtPlan"
)
public
interface
ExtPlanServiceFeign
<
V
extends
ExtPlanVO
>
extends
ExtPlanServiceFeignShadow
<
V
>
{
public
interface
ExtPlanServiceFeign
<
V
extends
ExtPlanVO
>
extends
ExtPlanServiceFeignShadow
<
V
>
{
@ApiOperation
(
"下载计划模板"
)
@GetMapping
(
value
=
"/downloadTemplate"
)
void
downloadTemplate
(
HttpServletResponse
response
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
)
throws
IOException
;
/**
* 新增计划
*
* @param uploadFile
* @return
* @throws IOException
*/
@ApiOperation
(
"新增计划"
)
@PostMapping
(
value
=
"/insertPlan/{projectId}"
)
ApiResult
insertPlan
(
@RequestParam
(
"file"
)
MultipartFile
uploadFile
,
@PathVariable
(
"projectId"
)
Long
projectId
)
throws
IOException
;
/**
* 修改计划状态
*
* @param state
* @param ids
* @return
*/
@ApiOperation
(
"计划驱动编制任务"
)
@GetMapping
(
value
=
"/changeState"
)
void
extChangeState
(
@RequestParam
String
state
,
@RequestParam
List
<
Long
>
ids
);
/**
* 校验计划答复状态
*
* @param id
* @return
*/
@ApiOperation
(
"校验计划答复状态"
)
@GetMapping
(
value
=
"/checkReplayState"
)
String
checkReplayState
(
@RequestParam
Long
id
)
;
/**
* 导出计划
* @param response
* @param ids
* @throws IOException
*/
@ApiOperation
(
value
=
"导出计划"
,
notes
=
"导出计划"
,
httpMethod
=
"GET"
)
@GetMapping
(
value
=
"/exportPlan"
)
void
exportPlan
(
HttpServletResponse
response
,
@RequestParam
(
"ids"
)
List
<
Long
>
ids
);
@ApiOperation
(
value
=
"通过文件分类查询"
,
notes
=
"通过文件分类查询"
,
httpMethod
=
"post"
)
@GetMapping
(
value
=
"/searchFileType"
)
void
searchFileType
(
@RequestParam
(
"fileType"
)
String
fileType
,
DxDocumentVO
doc
);
}
}
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