Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-bpm
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
鲁鑫
topsun-bpm
Commits
6531b6c8
Commit
6531b6c8
authored
Jan 11, 2024
by
赵汉亭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
成本中心新增、冻结SAP接口对接,及接口返回数据重封装
parent
b11825c4
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
117 additions
and
180 deletions
+117
-180
ProofingMakeApplicationImpl.java
...roofing/application/impl/ProofingMakeApplicationImpl.java
+25
-27
ProofingMakeReturn.java
...roofing/domain/proofingMake/model/ProofingMakeReturn.java
+3
-61
CostCenterApplicationImpl.java
...ostCenter/application/impl/CostCenterApplicationImpl.java
+70
-40
CostCenterMessageVo.java
.../topsun/sap/costCenter/domain/vo/CostCenterMessageVo.java
+5
-0
CostCenterReturnVo.java
...u/topsun/sap/costCenter/domain/vo/CostCenterReturnVo.java
+1
-14
SapFixedAssetsApplicationImpl.java
...ssets/application/impl/SapFixedAssetsApplicationImpl.java
+8
-12
SapPriceMasterDataApplicationImpl.java
...a/application/impl/SapPriceMasterDataApplicationImpl.java
+5
-24
SapPurchaseApprovalApplicationImpl.java
.../application/impl/SapPurchaseApprovalApplicationImpl.java
+0
-2
No files found.
topsun/src/main/java/com/huigou/topsun/proofing/application/impl/ProofingMakeApplicationImpl.java
View file @
6531b6c8
...
@@ -20,7 +20,6 @@ import com.huigou.topsun.util.MyBaseUtil;
...
@@ -20,7 +20,6 @@ import com.huigou.topsun.util.MyBaseUtil;
import
com.huigou.uasp.bmp.common.application.BaseApplication
;
import
com.huigou.uasp.bmp.common.application.BaseApplication
;
import
com.huigou.util.SDO
;
import
com.huigou.util.SDO
;
import
lombok.SneakyThrows
;
import
lombok.SneakyThrows
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Example
;
import
org.springframework.data.domain.Example
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -29,10 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -29,10 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
/**
/**
* @author 16508
* @author 16508
...
@@ -187,16 +183,16 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
...
@@ -187,16 +183,16 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
});
});
// 给SAP返回BOM-JSON数据
// 给SAP返回BOM-JSON数据
ProofingMakeBom
[]
boms
=
getReturnBOMJson
(
proofingMakeBomList
);
List
<
Map
<
String
,
Object
>>
boms
=
getReturnBOM
(
proofingMakeBomList
);
String
returnJson
=
saveToProduct
(
productId
,
sdo
,
boms
,
status
);
List
<
ProofingMakeReturn
>
param
=
saveToProduct
(
productId
,
sdo
,
boms
,
status
);
// 发送
// 发送
// TODO 接口地址未定
// TODO 接口地址未定
String
url
=
SystemCache
.
getParameter
(
"sap.service.null.url"
,
String
.
class
);
String
url
=
SystemCache
.
getParameter
(
"sap.service.null.url"
,
String
.
class
);
try
{
try
{
// TODO 返回数据未封装
// TODO 返回数据未封装
String
execute
=
httpClient
.
execute
(
returnJson
,
url
);
String
execute
=
httpClient
.
execute
(
param
,
url
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
@@ -258,18 +254,23 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
...
@@ -258,18 +254,23 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
*
*
* @return
* @return
*/
*/
public
ProofingMakeBom
[]
getReturnBOMJson
(
List
<
ProofingMakeBom
>
bomJson
)
throws
JsonProcessingException
{
public
List
<
Map
<
String
,
Object
>>
getReturnBOM
(
List
<
ProofingMakeBom
>
bomJson
)
throws
JsonProcessingException
{
List
<
Map
<
String
,
Object
>>
returnBOMList
=
new
ArrayList
<>();
ProofingMakeBom
[]
proofingMakeBoms
=
new
ProofingMakeBom
[
bomJson
.
size
()];
int
flog
=
0
;
for
(
ProofingMakeBom
proofingMakeBom
:
bomJson
)
{
for
(
ProofingMakeBom
proofingMakeBom
:
bomJson
)
{
ProofingMakeBom
bom
=
new
ProofingMakeBom
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
BeanUtils
.
copyProperties
(
proofingMakeBom
,
bom
);
map
.
put
(
"IDNRK"
,
proofingMakeBom
.
getProductMaterialId
());
bom
.
setProductMaterialName
(
null
);
map
.
put
(
"MENGE"
,
proofingMakeBom
.
getProofingMakeBomNum
());
proofingMakeBoms
[
flog
]
=
bom
;
map
.
put
(
"MEINS"
,
proofingMakeBom
.
getProofingMakeBomMeins
());
flog
++;
map
.
put
(
"AUSCH"
,
proofingMakeBom
.
getProofingMakeBomAusch
());
map
.
put
(
"POTX1"
,
proofingMakeBom
.
getProofingMakeBomText
());
map
.
put
(
"POTX2"
,
proofingMakeBom
.
getProofingMakeBomMaterialText
());
map
.
put
(
"ALPGR"
,
proofingMakeBom
.
getProofingMakeBomAlpgr
());
map
.
put
(
"ALPRF"
,
proofingMakeBom
.
getProofingMakeBomAlprf
());
map
.
put
(
"ALPST"
,
proofingMakeBom
.
getProofingMakeBomAlpst
());
map
.
put
(
"EWAHR"
,
proofingMakeBom
.
getProofingMakeBomEwahr
());
returnBOMList
.
add
(
map
);
}
}
return
proofingMakeBoms
;
return
returnBOMList
;
}
}
@Override
@Override
...
@@ -283,7 +284,7 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
...
@@ -283,7 +284,7 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
*
*
* @return
* @return
*/
*/
public
String
saveToProduct
(
String
productId
,
SDO
sdo
,
ProofingMakeBom
[]
returnJson
,
String
status
)
throws
JsonProcessingException
{
public
List
<
ProofingMakeReturn
>
saveToProduct
(
String
productId
,
SDO
sdo
,
List
<
Map
<
String
,
Object
>>
returnJson
,
String
status
)
throws
JsonProcessingException
{
String
bomJson
=
sdo
.
getString
(
"bom"
);
String
bomJson
=
sdo
.
getString
(
"bom"
);
ObjectMapper
objectMapper
=
new
ObjectMapper
();
ObjectMapper
objectMapper
=
new
ObjectMapper
();
//编辑产品信息
//编辑产品信息
...
@@ -362,14 +363,11 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
...
@@ -362,14 +363,11 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
proofingMakeReturn
.
setBOMItems
(
returnJson
);
proofingMakeReturn
.
setBOMItems
(
returnJson
);
proofingMakeReturn
.
setUPDKZ
(
status
);
proofingMakeReturn
.
setUPDKZ
(
status
);
String
returnBomJson
=
new
ObjectMapper
().
writeValueAsString
(
proofingMakeReturn
);
returnBomJson
=
returnBomJson
.
replaceAll
(
"materialId"
,
"IDNRK"
)
List
<
ProofingMakeReturn
>
proofingMakeReturns
=
new
ArrayList
<>();
.
replaceAll
(
"materialNumber"
,
"MENGE"
)
proofingMakeReturns
.
add
(
proofingMakeReturn
);
.
replaceAll
(
"materialUnit"
,
"MEINS"
)
.
replaceAll
(
"materialJson"
,
"POTX2"
)
return
proofingMakeReturns
;
.
replaceAll
(
"\"materialName\":null,"
,
""
);
// returnJson = "[" + returnJson + "]";
return
returnBomJson
;
}
}
private
ProductDetail
ToProductDetail
(
ProofingMakeBaseInfo
proofingMakeBaseInfo
,
String
productId
)
{
private
ProductDetail
ToProductDetail
(
ProofingMakeBaseInfo
proofingMakeBaseInfo
,
String
productId
)
{
...
...
topsun/src/main/java/com/huigou/topsun/proofing/domain/proofingMake/model/ProofingMakeReturn.java
View file @
6531b6c8
...
@@ -5,6 +5,8 @@ import lombok.Data;
...
@@ -5,6 +5,8 @@ import lombok.Data;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* title: 样品制作单数据传SAP接口
* title: 样品制作单数据传SAP接口
...
@@ -73,66 +75,6 @@ public class ProofingMakeReturn implements Serializable {
...
@@ -73,66 +75,6 @@ public class ProofingMakeReturn implements Serializable {
*/
*/
@JsonProperty
(
value
=
"ZPGBS"
,
required
=
true
)
@JsonProperty
(
value
=
"ZPGBS"
,
required
=
true
)
private
Integer
dispatchMultiple
;
private
Integer
dispatchMultiple
;
//
// /**
// * 物料ID
// */
// @JsonProperty(value = "IDNRK",required = true)
// private String materialId;
//
// /**
// * 物料数量
// */
// @JsonProperty(value = "MENGE",required = true)
// private Integer materialNumber;
//
// /**
// * 组件计量单位
// */
// @JsonProperty(value = "MEINS",required = true)
// private String proofingMakeBomMeins;
//
// /**
// * 组件报废百分比
// */
// @JsonProperty(value = "AUSCH",required = true)
// private Double proofingMakeBomAusch;
//
// /**
// * BOM项目文本(行1)
// */
// @JsonProperty(value = "POTX1",required = true)
// private String proofingMakeBomText;
//
// /**
// * 物料清单项目文本(行2)
// */
// @JsonProperty(value = "POTX2",required = true)
// private String proofingMakeBomMaterialText;
//
// /**
// * 替代组
// */
// @JsonProperty(value = "ALPGR",required = true)
// private String proofingMakeBomAlpgr;
//
// /**
// * 替代优先级
// */
// @JsonProperty(value = "ALPRF",required = true)
// private Integer proofingMakeBomAlprf;
//
// /**
// * 策略
// */
// @JsonProperty(value = "ALPST",required = true)
// private String proofingMakeBomAlpst;
//
// /**
// * 使用概率
// */
// @JsonProperty(value = "EWAHR",required = true)
// private Long proofingMakeBomEwahr;
/**
/**
* 更新标识
* 更新标识
...
@@ -143,6 +85,6 @@ public class ProofingMakeReturn implements Serializable {
...
@@ -143,6 +85,6 @@ public class ProofingMakeReturn implements Serializable {
/**
/**
* bom结点
* bom结点
*/
*/
private
ProofingMakeBom
[]
BOMItems
;
private
List
<
Map
<
String
,
Object
>>
BOMItems
;
}
}
topsun/src/main/java/com/huigou/topsun/sap/costCenter/application/impl/CostCenterApplicationImpl.java
View file @
6531b6c8
...
@@ -2,6 +2,7 @@ package com.huigou.topsun.sap.costCenter.application.impl;
...
@@ -2,6 +2,7 @@ package com.huigou.topsun.sap.costCenter.application.impl;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.cache.DictUtil
;
import
com.huigou.cache.DictUtil
;
import
com.huigou.cache.SystemCache
;
import
com.huigou.cache.SystemCache
;
...
@@ -26,9 +27,10 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -26,9 +27,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
/**
* @Auther: xin.lu
* @Auther: xin.lu
...
@@ -93,26 +95,45 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA
...
@@ -93,26 +95,45 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA
@Override
@Override
public
int
updateCostCenterStatus
(
List
<
String
>
ids
)
{
public
int
updateCostCenterStatus
(
List
<
String
>
ids
)
{
AtomicInteger
flog
=
new
AtomicInteger
();
HashMap
<
String
,
Object
>
FREEZEReturnMap
=
new
HashMap
<>();
ids
.
forEach
(
id
->
{
FREEZEReturnMap
.
put
(
"MODE"
,
"FREEZE"
);
ArrayList
<
HashMap
<
String
,
String
>>
FREEZEList
=
new
ArrayList
<>();
int
flog
=
0
;
for
(
String
id
:
ids
)
{
CostCenter
costCenter
=
costCenterRepository
.
findOne
(
id
);
CostCenter
costCenter
=
costCenterRepository
.
findOne
(
id
);
String
returnJSON
=
new
StringBuilder
().
append
(
"["
)
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
.
append
(
"{"
)
map
.
put
(
"KOSTL"
,
costCenter
.
getKostl
());
.
append
(
"'ZYWLX':'F',"
)
map
.
put
(
"KOKRS"
,
"BSNG"
);
.
append
(
"'KOSTL':'"
).
append
(
costCenter
.
getKostl
()).
append
(
"'"
)
map
.
put
(
"BKZKP"
,
"X"
);
.
append
(
"}"
)
map
.
put
(
"PKZKP"
,
"X"
);
.
append
(
"]"
)
map
.
put
(
"BKZKS"
,
"X"
);
.
toString
().
replaceAll
(
"'"
,
"\""
);
map
.
put
(
"PKZKS"
,
"X"
);
CostCenterMessageVo
costCenterMessageVo
=
send
(
returnJSON
);
FREEZEList
.
add
(
map
);
}
FREEZEReturnMap
.
put
(
"FREEZE"
,
FREEZEList
);
// TODO 列表发送,SAP返回消息怎么匹配
String
execute
=
send
(
FREEZEReturnMap
);
List
<
CostCenterMessageVo
>
costCenterMessageVos
;
try
{
costCenterMessageVos
=
new
ObjectMapper
().
readValue
(
execute
,
new
TypeReference
<
List
<
CostCenterMessageVo
>>()
{
});
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
}
String
[]
id
=
(
String
[])
ids
.
toArray
();
for
(
CostCenterMessageVo
costCenterMessageVo
:
costCenterMessageVos
)
{
int
row
=
Integer
.
parseInt
(
costCenterMessageVo
.
getROW
());
CostCenter
costCenter
=
costCenterRepository
.
findOne
(
id
[
row
]);
if
(!
ObjectUtil
.
isEmpty
(
costCenterMessageVo
)
||
costCenterMessageVo
.
getTYPE
()
==
"S"
)
{
if
(!
ObjectUtil
.
isEmpty
(
costCenterMessageVo
)
||
costCenterMessageVo
.
getTYPE
()
==
"S"
)
{
// 冻结成功,修改状态
// 冻结成功,修改状态
costCenter
.
setIsDelete
(
0
);
costCenter
.
setIsDelete
(
0
);
flog
.
getAndIncrement
()
;
flog
++
;
}
}
BeanUtils
.
copyProperties
(
costCenterMessageVo
,
costCenter
);
BeanUtils
.
copyProperties
(
costCenterMessageVo
,
costCenter
);
costCenterRepository
.
save
(
costCenter
);
costCenterRepository
.
save
(
costCenter
);
}
);
}
if
(
ids
.
size
()
==
flog
.
intValue
()
)
if
(
ids
.
size
()
==
flog
)
return
1
;
return
1
;
return
0
;
return
0
;
}
}
...
@@ -124,30 +145,54 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA
...
@@ -124,30 +145,54 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA
BizBillStatus
status
=
approvePassed
()
?
BizBillStatus
.
COMPLETED
:
BizBillStatus
.
ABORTED
;
BizBillStatus
status
=
approvePassed
()
?
BizBillStatus
.
COMPLETED
:
BizBillStatus
.
ABORTED
;
CostCenter
costCenter
=
costCenterRepository
.
findOne
(
bizId
);
CostCenter
costCenter
=
costCenterRepository
.
findOne
(
bizId
);
costCenter
.
setStatusId
(
status
.
getId
());
costCenter
.
setStatusId
(
status
.
getId
());
costCenterRepository
.
save
(
costCenter
);
// 封装JSON数据
// 向SAP发送新增数据
String
returnJSON
=
getReturnVo
(
costCenter
);
CostCenterReturnVo
costCenterReturnVo
=
new
CostCenterReturnVo
();
// 向SAP发送数据
BeanUtils
.
copyProperties
(
costCenter
,
costCenterReturnVo
);
CostCenterMessageVo
send
=
send
(
returnJSON
);
// 封装新增返回数据
Map
<
String
,
Object
>
CREATEReturnMap
=
new
HashMap
<>();
CREATEReturnMap
.
put
(
"MODE"
,
"CREATE"
);
ObjectMapper
objectMapper
=
new
ObjectMapper
();
HashMap
data
=
objectMapper
.
convertValue
(
costCenterReturnVo
,
HashMap
.
class
);
data
.
put
(
"KOKRS"
,
"BSNG"
);
data
.
put
(
"KHINR"
,
"BSNG"
);
if
(
costCenterReturnVo
.
getKosar
()
==
"F"
)
data
.
put
(
"MGEFL"
,
"X"
);
data
.
put
(
"BKZER"
,
"X"
);
data
.
put
(
"PKZER"
,
"X"
);
data
.
put
(
"BKZOB"
,
"X"
);
CREATEReturnMap
.
put
(
"DATA"
,
data
);
String
execute
=
send
(
CREATEReturnMap
);
CostCenterMessageVo
costCenterMessageVo
=
null
;
try
{
costCenterMessageVo
=
new
ObjectMapper
().
readValue
(
execute
,
CostCenterMessageVo
.
class
);
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
}
BeanUtils
.
copyProperties
(
costCenterMessageVo
,
costCenter
);
costCenterRepository
.
save
(
costCenter
);
}
}
/**
/**
* 向SAP发送数据
* 向SAP发送数据
*
*
* @param
returnJSON
* @param
o
* @return 返回的消息
* @return 返回的消息
*/
*/
private
CostCenterMessageVo
send
(
String
returnJSON
)
{
private
String
send
(
Object
o
)
{
String
url
=
SystemCache
.
getParameter
(
"sap.service.costCent.url"
,
String
.
class
);
String
url
=
SystemCache
.
getParameter
(
"sap.service.costCent.url"
,
String
.
class
);
CostCenterMessageVo
costCenterMessageVo
;
String
execute
;
try
{
try
{
String
execute
=
httpClient
.
execute
(
returnJSON
,
url
);
execute
=
httpClient
.
execute
(
o
,
url
);
costCenterMessageVo
=
new
ObjectMapper
().
readValue
(
execute
,
CostCenterMessageVo
.
class
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
return
costCenterMessageVo
;
return
execute
;
}
}
/**
/**
...
@@ -183,21 +228,6 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA
...
@@ -183,21 +228,6 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA
String
bizId
=
delegateTask
.
getExecution
().
getProcessBusinessKey
();
String
bizId
=
delegateTask
.
getExecution
().
getProcessBusinessKey
();
CostCenter
costCenter
=
costCenterRepository
.
findOne
(
bizId
);
CostCenter
costCenter
=
costCenterRepository
.
findOne
(
bizId
);
costCenter
.
setStatusId
(
BizBillStatus
.
APPLYING
.
getId
());
costCenter
.
setStatusId
(
BizBillStatus
.
APPLYING
.
getId
());
// 向SAP发送新增数据
CostCenterReturnVo
costCenterReturnVo
=
new
CostCenterReturnVo
();
BeanUtils
.
copyProperties
(
costCenter
,
costCenterReturnVo
);
costCenterReturnVo
.
setZYWLX
(
"A"
);
String
returnJson
=
null
;
try
{
returnJson
=
new
ObjectMapper
().
writeValueAsString
(
costCenterReturnVo
);
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
}
// 发送
CostCenterMessageVo
costCenterMessageVo
=
send
(
returnJson
);
BeanUtils
.
copyProperties
(
costCenterMessageVo
,
costCenter
);
costCenterRepository
.
save
(
costCenter
);
costCenterRepository
.
save
(
costCenter
);
}
}
}
}
...
...
topsun/src/main/java/com/huigou/topsun/sap/costCenter/domain/vo/CostCenterMessageVo.java
View file @
6531b6c8
...
@@ -45,4 +45,9 @@ public class CostCenterMessageVo {
...
@@ -45,4 +45,9 @@ public class CostCenterMessageVo {
@Column
(
name
=
"LOG_NO"
)
@Column
(
name
=
"LOG_NO"
)
@JsonProperty
(
"LOG_NO"
)
@JsonProperty
(
"LOG_NO"
)
private
String
LOG_NO
;
private
String
LOG_NO
;
/**
* 行
*/
private
String
ROW
;
}
}
topsun/src/main/java/com/huigou/topsun/sap/costCenter/domain/vo/CostCenterReturnVo.java
View file @
6531b6c8
...
@@ -16,10 +16,6 @@ import java.util.Date;
...
@@ -16,10 +16,6 @@ import java.util.Date;
*/
*/
@JsonIgnoreProperties
@JsonIgnoreProperties
public
class
CostCenterReturnVo
implements
Serializable
{
public
class
CostCenterReturnVo
implements
Serializable
{
/**
* 业务类型
*/
private
String
ZYWLX
;
/**
/**
* 成本中心编码
* 成本中心编码
...
@@ -78,14 +74,6 @@ public class CostCenterReturnVo implements Serializable {
...
@@ -78,14 +74,6 @@ public class CostCenterReturnVo implements Serializable {
@JsonProperty
(
"PRCTR"
)
@JsonProperty
(
"PRCTR"
)
private
String
prctr
;
private
String
prctr
;
public
String
getZYWLX
()
{
return
ZYWLX
;
}
public
void
setZYWLX
(
String
ZYWLX
)
{
this
.
ZYWLX
=
ZYWLX
;
}
public
String
getKostl
()
{
public
String
getKostl
()
{
return
kostl
;
return
kostl
;
}
}
...
@@ -150,9 +138,8 @@ public class CostCenterReturnVo implements Serializable {
...
@@ -150,9 +138,8 @@ public class CostCenterReturnVo implements Serializable {
this
.
prctr
=
prctr
;
this
.
prctr
=
prctr
;
}
}
public
CostCenterReturnVo
(
String
ZYWLX
,
String
kostl
,
Date
datab
,
Date
datbi
,
String
ktext
,
String
ltext
,
String
verak
,
String
kosar
,
String
prctr
)
{
public
CostCenterReturnVo
(
String
kostl
,
Date
datab
,
Date
datbi
,
String
ktext
,
String
ltext
,
String
verak
,
String
kosar
,
String
prctr
)
{
this
.
ZYWLX
=
ZYWLX
;
this
.
kostl
=
kostl
;
this
.
kostl
=
kostl
;
this
.
datab
=
datab
;
this
.
datab
=
datab
;
this
.
datbi
=
datbi
;
this
.
datbi
=
datbi
;
...
...
topsun/src/main/java/com/huigou/topsun/sap/fixedAssets/application/impl/SapFixedAssetsApplicationImpl.java
View file @
6531b6c8
...
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -88,11 +89,11 @@ public class SapFixedAssetsApplicationImpl extends FlowBroker implements SapFixe
...
@@ -88,11 +89,11 @@ public class SapFixedAssetsApplicationImpl extends FlowBroker implements SapFixe
fixedAssets
.
setStatusId
(
status
.
getId
());
fixedAssets
.
setStatusId
(
status
.
getId
());
// 封装返回数据
// 封装返回数据
String
returnJSON
=
getReturnVo
(
fixedAssets
);
List
<
SapFixedAssetsReturnVo
>
sapFixedAssetsReturnVoList
=
getReturnVo
(
fixedAssets
);
String
url
=
SystemCache
.
getParameter
(
"sap.service.fixedAssets.url"
,
String
.
class
);
String
url
=
SystemCache
.
getParameter
(
"sap.service.fixedAssets.url"
,
String
.
class
);
SapFixedAssets
message
;
SapFixedAssets
message
;
try
{
try
{
String
execute
=
httpClient
.
execute
(
returnJSON
,
url
);
String
execute
=
httpClient
.
execute
(
sapFixedAssetsReturnVoList
,
url
);
message
=
new
ObjectMapper
().
readValue
(
execute
,
SapFixedAssets
.
class
);
message
=
new
ObjectMapper
().
readValue
(
execute
,
SapFixedAssets
.
class
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
...
@@ -104,18 +105,13 @@ public class SapFixedAssetsApplicationImpl extends FlowBroker implements SapFixe
...
@@ -104,18 +105,13 @@ public class SapFixedAssetsApplicationImpl extends FlowBroker implements SapFixe
/**
/**
* 封装返回JSON
* 封装返回JSON
*/
*/
private
String
getReturnVo
(
SapFixedAssets
fixedAssets
)
{
private
List
<
SapFixedAssetsReturnVo
>
getReturnVo
(
SapFixedAssets
fixedAssets
)
{
SapFixedAssetsReturnVo
sapFixedAssetsReturnVo
=
new
SapFixedAssetsReturnVo
();
SapFixedAssetsReturnVo
sapFixedAssetsReturnVo
=
new
SapFixedAssetsReturnVo
();
BeanUtils
.
copyProperties
(
fixedAssets
,
sapFixedAssetsReturnVo
);
BeanUtils
.
copyProperties
(
fixedAssets
,
sapFixedAssetsReturnVo
);
// 转JSON
ObjectMapper
objectMapper
=
new
ObjectMapper
();
List
<
SapFixedAssetsReturnVo
>
sapFixedAssetsReturnVos
=
new
ArrayList
<>();
String
returnJson
=
null
;
sapFixedAssetsReturnVos
.
add
(
sapFixedAssetsReturnVo
);
try
{
return
sapFixedAssetsReturnVos
;
returnJson
=
objectMapper
.
writeValueAsString
(
sapFixedAssetsReturnVo
);
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
returnJson
;
}
}
@Override
@Override
...
...
topsun/src/main/java/com/huigou/topsun/sap/priceMasterData/application/impl/SapPriceMasterDataApplicationImpl.java
View file @
6531b6c8
...
@@ -153,42 +153,23 @@ public class SapPriceMasterDataApplicationImpl extends FlowBroker implements Sap
...
@@ -153,42 +153,23 @@ public class SapPriceMasterDataApplicationImpl extends FlowBroker implements Sap
param
.
put
(
"VTWEG"
,
queryRequest
.
getVtweg
());
param
.
put
(
"VTWEG"
,
queryRequest
.
getVtweg
());
param
.
put
(
"KUNNR"
,
queryRequest
.
getKunnr
());
param
.
put
(
"KUNNR"
,
queryRequest
.
getKunnr
());
param
.
put
(
"MATNR"
,
queryRequest
.
getMatnr
());
param
.
put
(
"MATNR"
,
queryRequest
.
getMatnr
());
String
[]
strings
=
new
String
[
1
];
try
{
strings
[
0
]
=
new
ObjectMapper
().
writeValueAsString
(
param
);
strings
.
toString
();
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
}
StringBuilder
stringBuilder
=
new
StringBuilder
();
List
<
Object
>
objectArrayList
=
new
ArrayList
<>();
stringBuilder
.
append
(
"["
)
objectArrayList
.
add
(
param
);
.
append
(
"{"
)
.
append
(
"'KSCHL':'"
).
append
(
queryRequest
.
getKschl
()).
append
(
"',"
)
.
append
(
"'VKORG':'"
).
append
(
queryRequest
.
getVkorg
()).
append
(
"',"
)
.
append
(
"'VTWEG':'"
).
append
(
queryRequest
.
getVtweg
()).
append
(
"',"
)
.
append
(
"'KUNNR':'"
).
append
(
queryRequest
.
getKunnr
()).
append
(
"',"
)
.
append
(
"'MATNR':'"
).
append
(
queryRequest
.
getMatnr
())
.
append
(
"'}"
)
.
append
(
"]"
)
.
toString
().
replaceAll
(
"'"
,
"\""
);
List
<
SapPriceMasterDataItem
>
sapPriceMasterDataItemList
=
null
;
List
<
SapPriceMasterDataItem
>
sapPriceMasterDataItemList
=
null
;
try
{
try
{
// 调用接口,获取返回数据
// 调用接口,获取返回数据
// String execute = httpClient.execute(param, url);
String
execute
=
httpClient
.
execute
(
objectArrayList
,
url
);
String
execute1
=
httpClient
.
execute
(
stringBuilder
.
toString
(),
url
);
// 解析返回数据
// 解析返回数据
execute
1
=
execute1
.
replaceAll
(
"MATNR"
,
"matnr"
)
execute
=
execute
.
replaceAll
(
"MATNR"
,
"matnr"
)
.
replaceAll
(
"KBETR"
,
"kbetr"
)
.
replaceAll
(
"KBETR"
,
"kbetr"
)
.
replaceAll
(
"KONWA"
,
"konwa"
)
.
replaceAll
(
"KONWA"
,
"konwa"
)
.
replaceAll
(
"KMEIN"
,
"kmein"
)
.
replaceAll
(
"KMEIN"
,
"kmein"
)
.
replaceAll
(
"DATAB"
,
"datab"
)
.
replaceAll
(
"DATAB"
,
"datab"
)
.
replaceAll
(
"DATBI"
,
"datbi"
);
.
replaceAll
(
"DATBI"
,
"datbi"
);
ObjectMapper
objectMapper
=
new
ObjectMapper
();
ObjectMapper
objectMapper
=
new
ObjectMapper
();
sapPriceMasterDataItemList
=
objectMapper
.
readValue
(
execute
1
,
new
TypeReference
<
List
<
SapPriceMasterDataItem
>>()
{
sapPriceMasterDataItemList
=
objectMapper
.
readValue
(
execute
,
new
TypeReference
<
List
<
SapPriceMasterDataItem
>>()
{
});
});
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
...
topsun/src/main/java/com/huigou/topsun/sap/purchaseApproval/application/impl/SapPurchaseApprovalApplicationImpl.java
View file @
6531b6c8
...
@@ -6,7 +6,6 @@ import com.huigou.context.OrgUnit;
...
@@ -6,7 +6,6 @@ import com.huigou.context.OrgUnit;
import
com.huigou.context.ThreadLocalUtil
;
import
com.huigou.context.ThreadLocalUtil
;
import
com.huigou.data.query.model.QueryDescriptor
;
import
com.huigou.data.query.model.QueryDescriptor
;
import
com.huigou.data.query.model.QueryModel
;
import
com.huigou.data.query.model.QueryModel
;
import
com.huigou.topsun.sap.dictionary.A
;
import
com.huigou.topsun.sap.purchaseApproval.application.SapPurchaseApprovalApplication
;
import
com.huigou.topsun.sap.purchaseApproval.application.SapPurchaseApprovalApplication
;
import
com.huigou.topsun.sap.purchaseApproval.application.SapPurchaseApprovalItemApplication
;
import
com.huigou.topsun.sap.purchaseApproval.application.SapPurchaseApprovalItemApplication
;
import
com.huigou.topsun.sap.purchaseApproval.domain.SapPurchaseApproval
;
import
com.huigou.topsun.sap.purchaseApproval.domain.SapPurchaseApproval
;
...
@@ -89,7 +88,6 @@ public class SapPurchaseApprovalApplicationImpl extends FlowBroker implements Sa
...
@@ -89,7 +88,6 @@ public class SapPurchaseApprovalApplicationImpl extends FlowBroker implements Sa
/**
/**
* 转换成SAP JSON格式数据
* 转换成SAP JSON格式数据
* @param sapPurchase
* @return
* @return
*/
*/
/*public String getSapPurchaseVoJson(SapPurchaseApproval sapPurchase){
/*public String getSapPurchaseVoJson(SapPurchaseApproval sapPurchase){
...
...
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