Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
iClear-api
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Jiaqi.xu
2021-09-18 16:37:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7e2c9fbb928f734a65815e076f37e2f118e69373
7e2c9fbb
1 parent
e9e575da
C类保存到业务表明细数量小数位两位;D类保存到业务表明细数量小数位五位
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
9 deletions
src/main/java/com/erry/iclear/dateInterface/service/ChmConsignmentDetailService.java
src/main/java/com/erry/iclear/dateInterface/service/ChmConsignmentDetailService.java
View file @
7e2c9fb
...
...
@@ -145,7 +145,7 @@ public class ChmConsignmentDetailService {
//商品编号
result
.
setSkuCode
(
mawbDetail
.
getCodeTS
());
//申报总价
result
.
setAmount
(
mawbDetail
.
getDeclTotal
(
));
result
.
setAmount
(
bigDecimalFormat
(
mawbDetail
.
getDeclTotal
()
));
//第一计量单位(法定单位)
DictionaryEntries
firstUnitDictionaryEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
TRANSACTION_UNIT
+
mawbDetail
.
getFirstUnit
());
if
(!
Objects
.
equals
(
firstUnitDictionaryEntries
,
null
)){
...
...
@@ -153,7 +153,7 @@ public class ChmConsignmentDetailService {
result
.
setUnitLegalFirst
(
firstUnitDictionaryEntries
.
getChineseName
());
}
//第一法定数量
result
.
setQtyLegalFirst
(
BigDecimal
.
valueOf
(
mawbDetail
.
getFirstQty
().
doubleValue
(
)));
result
.
setQtyLegalFirst
(
bigDecimalFormat
(
BigDecimal
.
valueOf
(
mawbDetail
.
getFirstQty
().
doubleValue
()
)));
//成交计量单位
//2021年7月8日 成交单位有修改,原取值第一法定计量单位,先取值成交单位。xjq
DictionaryEntries
knockdownUnitEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
TRANSACTION_UNIT
+
mawbDetail
.
getGunit
());
...
...
@@ -166,7 +166,7 @@ public class ChmConsignmentDetailService {
//商品名称
result
.
setSkuName
(
mawbDetail
.
getGname
());
//成交数量
result
.
setKnockdownNumber
(
BigDecimal
.
valueOf
(
mawbDetail
.
getGqty
().
doubleValue
(
)));
result
.
setKnockdownNumber
(
bigDecimalFormat
(
BigDecimal
.
valueOf
(
mawbDetail
.
getGqty
().
doubleValue
()
)));
//第二计量单位
DictionaryEntries
secondUnitDictionaryEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
TRANSACTION_UNIT
+
mawbDetail
.
getSecondUnit
());
if
(!
Objects
.
equals
(
secondUnitDictionaryEntries
,
null
)){
...
...
@@ -174,14 +174,14 @@ public class ChmConsignmentDetailService {
result
.
setUnitLegalSecond
(
secondUnitDictionaryEntries
.
getChineseName
());
}
//第二法定数量
result
.
setQtyLegalSecond
(
BigDecimal
.
valueOf
(
mawbDetail
.
getSecondQty
().
doubleValue
(
)));
result
.
setQtyLegalSecond
(
bigDecimalFormat
(
BigDecimal
.
valueOf
(
mawbDetail
.
getSecondQty
().
doubleValue
()
)));
//成交币制
DictionaryEntries
currencyDictionaryEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
CURRENCY_SYSTEM
+
mawbDetail
.
getTradeCurr
());
if
(!
Objects
.
equals
(
currencyDictionaryEntries
,
null
)){
result
.
setCurrencyDic
(
currencyDictionaryEntries
);
result
.
setCurrency
(
currencyDictionaryEntries
.
getChineseName
());
}
result
.
setDeclaredWeight
(
mawbDetail
.
getDeclaredWeight
(
));
result
.
setDeclaredWeight
(
bigDecimalFormat
(
mawbDetail
.
getDeclaredWeight
()
));
result
.
setDetailId
(
mawbDetail
.
getDetailId
());
}
catch
(
Exception
e
){
log
.
error
(
"convertToChmConsignmentDetailBasf() error:"
+
e
.
getMessage
());
...
...
@@ -207,7 +207,7 @@ public class ChmConsignmentDetailService {
//申报单价 小数点保留4位
result
.
setDeclPrice
(
NumberUtils
.
bigDecimalFormat
(
detail
.
getOriRegion
(),
4
));
//申报总价 小数点保留2位
result
.
setDeclTotal
(
NumberUtils
.
bigDecimalFormat
(
detail
.
getAmount
(),
2
));
result
.
setDeclTotal
(
bigDecimalFormatD
(
NumberUtils
.
bigDecimalFormat
(
detail
.
getAmount
(),
2
)
));
//征免方式 数字一字码,0~9
if
(!
Objects
.
equals
(
detail
.
getLevyTypeDic
(),
null
)){
result
.
setDutyMode
(
detail
.
getLevyTypeDic
().
getExt2
());
...
...
@@ -221,7 +221,7 @@ public class ChmConsignmentDetailService {
result
.
setFirstUnit
(
detail
.
getUnitLegalFirstId
().
getExt2
());
}
//第一法定数量
result
.
setFirstQty
(
NumberUtils
.
bigDecimalToIntger
(
detail
.
getQtyLegalFirst
(
)));
result
.
setFirstQty
(
NumberUtils
.
bigDecimalToIntger
(
bigDecimalFormatD
(
detail
.
getQtyLegalFirst
()
)));
//成交计量单位 数字三字码
if
(!
Objects
.
equals
(
detail
.
getKnockdownUnitDic
(),
null
)){
result
.
setGunit
(
detail
.
getKnockdownUnitDic
().
getExt2
());
...
...
@@ -233,7 +233,7 @@ public class ChmConsignmentDetailService {
//商品序号
result
.
setGno
(
gno
);
//成交数量
result
.
setGqty
(
detail
.
getKnockdownNumber
(
));
result
.
setGqty
(
bigDecimalFormatD
(
detail
.
getKnockdownNumber
()
));
//原产国 英文三字码
if
(!
Objects
.
equals
(
detail
.
getHabitatDic
(),
null
)){
result
.
setOriginCountry
(
detail
.
getHabitatDic
().
getExt3
());
...
...
@@ -243,7 +243,7 @@ public class ChmConsignmentDetailService {
result
.
setSecondUnit
(
detail
.
getUnitLegalSecondId
().
getExt2
());
}
//第二法定数量
result
.
setSecondQty
(
NumberUtils
.
bigDecimalToIntger
(
detail
.
getQtyLegalSecond
(
)));
result
.
setSecondQty
(
NumberUtils
.
bigDecimalToIntger
(
bigDecimalFormatD
(
detail
.
getQtyLegalSecond
()
)));
//成交币制 英文三字码
if
(!
Objects
.
equals
(
detail
.
getCurrencyDic
(),
null
)){
result
.
setTradeCurr
(
detail
.
getCurrencyDic
().
getExt2
());
...
...
@@ -278,6 +278,33 @@ public class ChmConsignmentDetailService {
return
result
;
}
public
BigDecimal
bigDecimalFormat
(
BigDecimal
num
){
BigDecimal
bdForMat
=
null
;
if
(
num
!=
null
){
bdForMat
=
num
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
bdForMat
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
){
bdForMat
=
new
BigDecimal
(
0.01
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
return
bdForMat
;
}
/**
* D类运单小数处理
* @param num
* @return
*/
public
BigDecimal
bigDecimalFormatD
(
BigDecimal
num
){
BigDecimal
bdForMat
=
null
;
if
(
num
!=
null
){
bdForMat
=
num
.
setScale
(
5
,
BigDecimal
.
ROUND_HALF_UP
);
/*if(bdForMat.compareTo(BigDecimal.ZERO) == 0){
bdForMat = new BigDecimal(0.00001).setScale(5,BigDecimal.ROUND_HALF_UP);
}*/
}
return
bdForMat
;
}
public
List
<
ChmConsignmentDetail
>
findChmConsignmentDetailListByConsignmentCode
(
Long
consignmentId
){
List
<
ChmConsignmentDetail
>
result
=
new
ArrayList
<>();
try
{
...
...
Please
register
or
login
to post a comment