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
44801616
Commit
44801616
authored
Dec 17, 2021
by
zhaoxiaolei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调用PLM更改h3c 修改基准配置
parent
ca37543b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
109 additions
and
25 deletions
+109
-25
CharacteristicValueMapper.java
...itech/authorization/mapper/CharacteristicValueMapper.java
+2
-0
SendDataToPlm.java
...a/cn/com/uitech/authorization/pojo/dto/SendDataToPlm.java
+10
-4
SendDataToPlmLog.java
...n/com/uitech/authorization/pojo/dto/SendDataToPlmLog.java
+25
-0
StandardModelManageCodeDto.java
...ch/authorization/pojo/dto/StandardModelManageCodeDto.java
+0
-5
CharacteristicValueServiceImpl.java
...rization/service/impl/CharacteristicValueServiceImpl.java
+65
-14
StandardModelManageServiceImpl.java
...rization/service/impl/StandardModelManageServiceImpl.java
+2
-2
application-lcrx.yml
src/main/resources/application-lcrx.yml
+1
-0
CharacteristicValueMapper.xml
src/main/resources/mapper/CharacteristicValueMapper.xml
+4
-0
No files found.
src/main/java/cn/com/uitech/authorization/mapper/CharacteristicValueMapper.java
View file @
44801616
...
...
@@ -103,4 +103,6 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal
CharacteristicValue
getCharacteristicValueInfoByName
(
String
characteristicValueName
,
String
superBomCode
,
String
characteristicName
);
CharacteristicValue
getCharacteristicValueInfoByCode
(
String
h3cVCode
,
String
h3cPn
);
void
saveDeployPlm
(
SendDataToPlmLog
log
);
}
src/main/java/cn/com/uitech/authorization/pojo/dto/SendDataToPlm.java
View file @
44801616
...
...
@@ -16,14 +16,20 @@ import lombok.experimental.Accessors;
public
class
SendDataToPlm
{
@ApiModelProperty
(
name
=
"superBomCode"
,
value
=
"cto编号"
,
dataType
=
"String"
)
private
String
super
BomCode
;
private
String
super
Number
;
@ApiModelProperty
(
name
=
"unisSalesVName"
,
value
=
"销售特征值名称"
,
dataType
=
"String"
)
private
String
unisSalesV
Name
;
private
String
salesVisible
Name
;
@ApiModelProperty
(
name
=
"h3cCValue"
,
value
=
"H3C对照关系"
,
dataType
=
"String"
)
private
String
h3c
CValue
;
private
String
h3c
PN
;
@ApiModelProperty
(
name
=
"h3cDeliverCode"
,
value
=
"H3C交付代码"
,
dataType
=
"String"
)
private
String
h3cDeliverCode
;
private
String
h3cDeliveryCode
;
@ApiModelProperty
(
name
=
"特征值code"
,
value
=
"H3C交付代码"
,
dataType
=
"String"
)
private
String
choiceNumber
;
@ApiModelProperty
(
name
=
"zphNumber"
,
value
=
"zphNumber"
,
dataType
=
"String"
)
private
String
zphNumber
;
}
src/main/java/cn/com/uitech/authorization/pojo/dto/SendDataToPlmLog.java
0 → 100644
View file @
44801616
package
cn
.
com
.
uitech
.
authorization
.
pojo
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
@Accessors
(
chain
=
true
)
@NoArgsConstructor
@Getter
@Setter
@ToString
public
class
SendDataToPlmLog
{
private
String
param
;
private
String
result
;
private
String
url
;
private
Date
updateTime
;
}
src/main/java/cn/com/uitech/authorization/pojo/dto/StandardModelManageCodeDto.java
View file @
44801616
...
...
@@ -38,11 +38,6 @@ public class StandardModelManageCodeDto implements Serializable{
@ApiModelProperty
(
name
=
"characteristicValueCode"
,
value
=
"选配器返回的特征值编码"
,
dataType
=
"String"
,
required
=
false
)
private
String
characteristicValueCode
;
/**
* 选配器返回的特征编码
*/
@ApiModelProperty
(
name
=
"lmsCharacteristicCode"
,
value
=
"选配器返回的特征编码"
,
dataType
=
"String"
,
required
=
false
)
private
String
lmsCharacteristicCode
;
/**
* 选配器返回的特征值编码
...
...
src/main/java/cn/com/uitech/authorization/service/impl/CharacteristicValueServiceImpl.java
View file @
44801616
...
...
@@ -35,6 +35,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
...
...
@@ -69,6 +70,15 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
@Autowired
private
OdRelationMapper
odRelationMapper
;
@Value
(
"${plm.header_Authorization}"
)
private
String
headerAuthorization
;
@Value
(
"${plm.token-url}"
)
private
String
plmUrlToken
;
@Value
(
"${plm.urlH}"
)
private
String
plmUrlH
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CharacteristicValueServiceImpl
.
class
);
/**
...
...
@@ -119,24 +129,65 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
*/
@Override
public
Integer
editCharacteristicValue
(
CharacteristicValue
dto
)
{
SendDataToPlmLog
log
=
new
SendDataToPlmLog
();
try
{
if
(!
StringUtils
.
isEmpty
(
dto
.
getZphCode
()))
{
//当CPQ系统中维护 H3C_PN、H3C_交付代码、特征值-销售可见名称 这些字段的任意一个时,出发调用这个接口 调用PLM
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getH3cDeliverCode
())
||
!
ObjectUtils
.
isEmpty
(
dto
.
getH3cCValue
())
||
!
ObjectUtils
.
isEmpty
(
dto
.
getUnisSalesVName
()))
{
List
<
SendDataToPlm
>
sendDataToPlms
=
new
ArrayList
<>();
SendDataToPlm
sendDataToPlm
=
new
SendDataToPlm
();
sendDataToPlm
.
setSuperNumber
(
dto
.
getSuperBomCode
());
sendDataToPlm
.
setH3cPN
(
dto
.
getH3cCValue
());
sendDataToPlm
.
setH3cDeliveryCode
(
dto
.
getH3cDeliverCode
());
sendDataToPlm
.
setSalesVisibleName
(
dto
.
getUnisSalesVName
());
sendDataToPlm
.
setChoiceNumber
(
dto
.
getCharacteristicValueCode
());
sendDataToPlm
.
setZphNumber
(
dto
.
getZphCode
());
sendDataToPlms
.
add
(
sendDataToPlm
);
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
tokenHeader
=
getHttpHeaderPlmToken
();
HttpEntity
<
String
>
tokenRequestEntity
=
new
HttpEntity
<>(
null
,
tokenHeader
);
ResponseEntity
<
String
>
getToken
=
restTemplate
.
exchange
(
plmUrlToken
,
HttpMethod
.
GET
,
tokenRequestEntity
,
String
.
class
);
String
body
=
getToken
.
getBody
();
Map
<
String
,
Object
>
o
=
(
Map
<
String
,
Object
>)
JSONObject
.
parse
(
body
);
List
item
=
(
List
)
o
.
get
(
"items"
);
Map
<
String
,
Object
>
o1
=
(
Map
<
String
,
Object
>)
item
.
get
(
0
);
Map
<
String
,
Object
>
attributes
=
(
Map
<
String
,
Object
>)
o1
.
get
(
"attributes"
);
String
nonce
=
(
String
)
attributes
.
get
(
"nonce"
);
RestTemplate
restTemplateH
=
new
RestTemplate
();
HttpHeaders
headers
=
getHttpHeaderPlm
(
nonce
);
log
=
new
SendDataToPlmLog
();
log
.
setParam
(
sendDataToPlms
.
toString
());
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
JSON
.
toJSONString
(
sendDataToPlms
),
headers
);
ResponseEntity
<
String
>
exchange
=
restTemplateH
.
exchange
(
plmUrlH
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
log
.
setResult
(
exchange
.
getBody
());
log
.
setUrl
(
plmUrlH
);
characteristicValueMapper
.
saveDeployPlm
(
log
);
}
}
}
catch
(
Throwable
e
)
{
log
.
setParam
(
dto
.
toString
());
log
.
setResult
(
e
.
toString
());
log
.
setUrl
(
plmUrlH
);
characteristicValueMapper
.
saveDeployPlm
(
log
);
}
finally
{
return
characteristicValueMapper
.
editCharacteristicValue
(
dto
);
}
}
//当CPQ系统中维护 H3C_PN、H3C_交付代码、特征值-销售可见名称 这些字段的任意一个时,出发调用这个接口 调用PLM
/*if(!ObjectUtils.isEmpty(dto.getH3cDeliverCode()) || !ObjectUtils.isEmpty(dto.getH3cCValue()) || !ObjectUtils.isEmpty(dto.getUnisSalesVName())){
SendDataToPlm sendDataToPlm = new SendDataToPlm();
sendDataToPlm.setSuperBomCode(dto.getSuperBomCode());
sendDataToPlm.setH3cCValue(dto.getH3cCValue());
sendDataToPlm.setH3cDeliverCode(dto.getH3cDeliverCode());
sendDataToPlm.setUnisSalesVName(dto.getUnisSalesVName());
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = getHttpHeader();
HttpEntity<String> requestEntity = new HttpEntity<String>(JSON.toJSONString(sendDataToPlm), headers);
ResponseEntity<String> responseEntity = restTemplate.exchange("", HttpMethod.POST, requestEntity, String.class);
}*/
return
characteristicValueMapper
.
editCharacteristicValue
(
dto
);
private
HttpHeaders
getHttpHeaderPlm
(
String
headerTokenMsg
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"Content-Type"
,
"application/json"
);
headers
.
add
(
"Authorization"
,
headerAuthorization
);
headers
.
add
(
"CSRF_NONCE"
,
headerTokenMsg
);
//headers.add("Expect", "100-continue");
return
headers
;
}
private
HttpHeaders
getHttpHeader
()
{
private
HttpHeaders
getHttpHeaderPlmToken
()
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"Content-Type"
,
"application/json"
);
headers
.
add
(
"Authorization"
,
headerAuthorization
);
return
headers
;
}
...
...
src/main/java/cn/com/uitech/authorization/service/impl/StandardModelManageServiceImpl.java
View file @
44801616
...
...
@@ -79,8 +79,8 @@ public class StandardModelManageServiceImpl implements StandardModelManageServic
ArrayList
<
StandardModelManageCodeDto
>
list
=
dto
.
getCharacteristicValueList
();
if
(
null
!=
list
&&
list
.
size
()>
0
){
list
.
stream
().
forEach
((
item
)->{
characteristi
.
add
(
item
.
get
Lms
CharacteristicCode
());
characteristiValue
.
add
(
item
.
get
Lms
CharacteristicValueCode
());
characteristi
.
add
(
item
.
getCharacteristicCode
());
characteristiValue
.
add
(
item
.
getCharacteristicValueCode
());
//0715 增加数量级cv更新
if
(!
CollectionUtils
.
isEmpty
(
item
.
getPairCharacteristicValue
())){
item
.
getPairCharacteristicValue
().
stream
().
forEach
(
itemChildren
->{
...
...
src/main/resources/application-lcrx.yml
View file @
44801616
...
...
@@ -47,6 +47,7 @@ management:
enabled
:
false
plm
:
url
:
https://api-test.unispc.com/restcloud/Windchill/servlet/rest/cpq/v1/selectionConfiguration
urlH
:
https://api-test.unispc.com/restcloud/Windchill/servlet/rest/cpq/v1/h3cMapping
token-url
:
https://api-test.unispc.com/restcloud/Windchill/servlet/rest/security/csrf
header_content_type_msg
:
application/json
header_Authorization
:
Basic d2NhZG1pbjp3Y2FkbWlu
...
...
src/main/resources/mapper/CharacteristicValueMapper.xml
View file @
44801616
...
...
@@ -328,4 +328,8 @@
where h3c_c_value = #{h3cVCode}
and super_bom_code = #{h3cPn}
</select>
<insert
id=
"saveDeployPlm"
>
insert into deploy_plm_log (param,result,update_time) values (#{param},#{result},now())
</insert>
</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