Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
config-server-api
Project
Overview
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
何熠
config-server-api
Commits
2a6af525
Commit
2a6af525
authored
Dec 15, 2021
by
zhaoxiaolei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
H3C 约束完结
parent
91156b43
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
2 deletions
+68
-2
CharacteristicMapper.java
...com/uitech/authorization/mapper/CharacteristicMapper.java
+4
-0
IntegrateServiceImpl.java
...tech/authorization/service/impl/IntegrateServiceImpl.java
+56
-2
CharacteristicMapper.xml
src/main/resources/mapper/CharacteristicMapper.xml
+8
-0
No files found.
src/main/java/cn/com/uitech/authorization/mapper/CharacteristicMapper.java
View file @
2a6af525
...
...
@@ -89,4 +89,8 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser
void
updateSuperBomSku
(
SuperBomSkuInfo
superBomSkuInfo
);
Integer
updateCharacteristicIsH3C
(
CharacteristicRequestParamDto
dto
);
List
<
Characteristic
>
getCharacteristicH3CList
(
String
superBomCode
);
Integer
getCharacteristicInfo
(
String
characteristicCode
,
String
superBomCode
);
}
src/main/java/cn/com/uitech/authorization/service/impl/IntegrateServiceImpl.java
View file @
2a6af525
...
...
@@ -39,6 +39,7 @@ import org.springframework.web.client.RestTemplate;
import
javax.annotation.Resource
;
import
java.sql.Timestamp
;
import
java.util.*
;
import
java.util.stream.Stream
;
@Service
...
...
@@ -793,6 +794,12 @@ public class IntegrateServiceImpl implements IntegrateService {
if
(!
ObjectUtils
.
isEmpty
(
configurableBom
))
{
//有configid
if
(!
StringUtils
.
isEmpty
(
configurableBom
.
getConfigId
()))
{
//查询出superBom下所有isH3C的数据
List
<
Characteristic
>
characteristicH3CList
=
characteristicMapper
.
getCharacteristicH3CList
(
configurableBom
.
getSuperBomCode
());
List
<
String
>
h3cCodeList
=
new
ArrayList
<>();
for
(
Characteristic
characteristic
:
characteristicH3CList
)
{
h3cCodeList
.
add
(
characteristic
.
getCharacteristicCode
());
}
for
(
GetSKUByH3CConfigInfo
.
KeyValues
keyValues
:
selectedCharacteristicList
)
{
CharacteristicValue
characteristicValue
=
characteristicValueMapper
.
getCharacteristicValueInfoByCode
(
keyValues
.
getH3cVCode
(),
configurableBom
.
getSuperBomCode
());
//验证H3CVCODE 是否存在
...
...
@@ -802,19 +809,42 @@ public class IntegrateServiceImpl implements IntegrateService {
flag
=
false
;
break
;
}
else
{
//验证特征的是否存在
//characteristicValue.get
// 查询出superBom下所有isH3C的数据 characteristicH3CList 比较 是否都有传
boolean
contains
=
h3cCodeList
.
contains
(
characteristicValue
.
getCharacteristicCode
());
if
(!
contains
){
Integer
isH3C
=
characteristicMapper
.
getCharacteristicInfo
(
characteristicValue
.
getCharacteristicCode
(),
configurableBom
.
getSuperBomCode
());
if
(
isH3C
.
equals
(
1
)){
//不存在数据库isH3C的数据返回报错
cpnList
.
setMsg
(
"CPQ数据验证失败,失败原因:"
+
characteristicValue
.
getCharacteristicCode
()
+
"特征不能为空!"
);
cpnList
.
setCode
(
ApiResult
.
INTERNAL_SERVER_ERROR
.
getCode
());
flag
=
false
;
break
;
}
else
{
//验证H3CVCODE是否下架
if
(
characteristicValue
.
getIsState
()
==
0
)
{
cpnList
.
setMsg
(
"CPQ数据验证失败,失败原因:"
+
characteristicValue
.
getCharacteristicValueCode
()
+
"已下架!"
);
cpnList
.
setCode
(
ApiResult
.
INTERNAL_SERVER_ERROR
.
getCode
());
flag
=
false
;
break
;
}
else
{
//有superbom 有configid h3cvcode存在 没有下架 设置true进行撞配
flag
=
true
;
}
}
}
else
{
//验证H3CVCODE是否下架
if
(
characteristicValue
.
getIsState
()
==
0
)
{
cpnList
.
setMsg
(
"CPQ数据验证失败,失败原因:"
+
characteristicValue
.
getCharacteristicValueCode
()
+
"已下架!"
);
cpnList
.
setCode
(
ApiResult
.
INTERNAL_SERVER_ERROR
.
getCode
());
flag
=
false
;
break
;
}
else
{
//有superbom 有configid h3cvcode存在 没有下架 设置true进行撞配
flag
=
true
;
}
}
}
}
}
else
{
//没有configid
...
...
@@ -915,6 +945,26 @@ public class IntegrateServiceImpl implements IntegrateService {
Map
<
String
,
Object
>
buildConfigurationMap
=
(
Map
<
String
,
Object
>)
JSONObject
.
toJSON
(
buildConfiguration
);
String
configId
=
(
String
)
buildConfigurationMap
.
get
(
"configId"
);
superBomSkuInfo
.
setConfigId
(
configId
);
//撞配之前调用前置验证
//构建前置验证数据结构
PostVerifyInputDTO
postVerifyInputDTO
=
new
PostVerifyInputDTO
();
postVerifyInputDTO
.
setProductClassCode
(((
SuperBomSkuInfo
)
superBomInfo
).
getProductClassCode
());
postVerifyInputDTO
.
setSuperBomCode
(((
SuperBomSkuInfo
)
superBomInfo
).
getSuperBomCode
());
postVerifyInputDTO
.
setOperator
(
"system"
);
postVerifyInputDTO
.
setSessionId
(
sessionId
);
List
<
PostVerifyInputDTO
.
SelectedCharacteristicListBean
>
selectedCharacteristicLists
=
new
ArrayList
<>();
superBomSkuInfo
.
getCharacteristicList
().
forEach
(
selectedCharacteristic
->{
PostVerifyInputDTO
.
SelectedCharacteristicListBean
selectedCharacteristicListBean
=
new
PostVerifyInputDTO
.
SelectedCharacteristicListBean
();
//根据 list里面的vcode 查询v信息和c信息 赋值到 生成配置的对象里
selectedCharacteristicListBean
.
setCharacteristicName
(
selectedCharacteristic
.
getCharacteristicName
());
selectedCharacteristicListBean
.
setCharacteristicValueName
(
selectedCharacteristic
.
getCharacteristicValueName
());
selectedCharacteristicListBean
.
setQuantity
(
1
);
selectedCharacteristicLists
.
add
(
selectedCharacteristicListBean
);
});
postVerifyInputDTO
.
setSelectedCharacteristicList
(
selectedCharacteristicLists
);
Object
preVerify
=
integrateController
.
preVerify
(
postVerifyInputDTO
,
null
);
Map
<
String
,
Object
>
preVerifyMap
=
(
Map
<
String
,
Object
>)
JSONObject
.
toJSON
(
preVerify
);
if
(
preVerifyMap
.
get
(
"result"
).
equals
(
true
)){
//撞配 找PLM申请SKU
Object
ob
=
GetSKUByConfigInfo
(
superBomSkuInfo
);
boolean
flag1
=
ob
instanceof
GetProductOutDto
;
...
...
@@ -939,6 +989,10 @@ public class IntegrateServiceImpl implements IntegrateService {
}
}
}
}
else
{
cpnList
.
setCode
(
500
);
cpnList
.
setMsg
(
"配置结果违反约束冲突"
+(
String
)
preVerifyMap
.
get
(
"message"
));
}
}
}
}
...
...
src/main/resources/mapper/CharacteristicMapper.xml
View file @
2a6af525
...
...
@@ -208,4 +208,12 @@
</if>
</where>
</update>
<select
id=
"getCharacteristicH3CList"
resultType=
"cn.com.uitech.authorization.pojo.entity.Characteristic"
>
select * from super_characteristic_info where is_h3c = 1 and super_bom_code = #{superBomCode}
</select>
<select
id=
"getCharacteristicInfo"
resultType=
"java.lang.Integer"
>
select is_h3c isH3C from super_characteristic_info where characteristic_Code = #{characteristicCode} and super_bom_code = #{superBomCode}
</select>
</mapper>
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