Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
Overview
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
platform
hg-smart
Commits
51f1893d
Commit
51f1893d
authored
Oct 31, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化销售开票选择任务添加金额校验
parent
a003b6f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
35 deletions
+81
-35
ServiceHGCW010.java
.../java/com/baosight/hggp/hg/cw/service/ServiceHGCW010.java
+16
-21
ServiceHGCW010D.java
...java/com/baosight/hggp/hg/cw/service/ServiceHGCW010D.java
+3
-3
ServiceHGCW011.java
.../java/com/baosight/hggp/hg/cw/service/ServiceHGCW011.java
+62
-11
No files found.
src/main/java/com/baosight/hggp/hg/cw/service/ServiceHGCW010.java
View file @
51f1893d
...
...
@@ -131,19 +131,12 @@ public class ServiceHGCW010 extends ServiceBase {
AssertUtils
.
isNull
(
HGSC001
,
"项目编码["
+
hgcw010
.
getProjCode
()
+
"]不存在"
);
hgcw010
.
setProjName
(
HGSC001
.
getProjName
());
}
hgcw010
.
setBillState
(
HGConstant
.
BillStatus
.
S1
);
if
(
StringUtils
.
isNotBlank
(
hgcw010
.
getBillNumber
())){
hgcw010
.
setBillState
(
HGConstant
.
BillStatus
.
S2
);
}
hgcw010
.
setSigningDate
(
DateUtils
.
formatShort
(
hgcw010
.
getSigningDate
()));
if
(
hgcw010
.
getId
()
==
null
||
hgcw010
.
getId
()
==
0
)
{
hgcw010
.
setBillState
(
HGConstant
.
BillStatus
.
S1
);
hgcw010
.
setReviewStatus
(
ReviewStatusEnum
.
UNREVIEWED
.
getCode
());
this
.
add
(
hgcw010
);
}
else
{
List
<
HGCW011
>
hgcw011List
=
HGCWTools
.
HgCw011
.
getMainId
(
hgcw010
.
getId
());
if
(
hgcw011List
.
size
()
>
0
&&
StringUtils
.
isNotEmpty
(
hgcw010
.
getBillNumber
())){
hgcw010
.
setBillState
(
HGConstant
.
BillStatus
.
S2
);
}
this
.
modify
(
hgcw010
);
}
}
...
...
@@ -189,9 +182,9 @@ public class ServiceHGCW010 extends ServiceBase {
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HGCW010
HGCW
010
=
new
HGCW010
();
HGCW
010
.
fromMap
(
resultRows
.
get
(
i
));
List
<
HGCW011
>
hgcw011List
=
HGCWTools
.
HgCw011
.
getMainId
(
HGCW
010
.
getId
());
HGCW010
hgcw
010
=
new
HGCW010
();
hgcw
010
.
fromMap
(
resultRows
.
get
(
i
));
List
<
HGCW011
>
hgcw011List
=
HGCWTools
.
HgCw011
.
getMainId
(
hgcw
010
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
hgcw011List
))
{
for
(
HGCW011
hgcw011
:
hgcw011List
)
{
HGCW002
hgcw002
=
HGCWTools
.
HgCw002
.
getContractNumber
(
hgcw011
.
getSettlementNumber
());
...
...
@@ -206,10 +199,10 @@ public class ServiceHGCW010 extends ServiceBase {
HGCWTools
.
HgCw008
.
deductionAmount
(
hgcw011
.
getSettlementNumber
(),
hgcw011
.
getTotalContractPriceIncluding
().
multiply
(
new
BigDecimal
(-
1
)));
}
DaoUtils
.
update
(
"HGCW011.delete"
,
hgcw011
);
DaoUtils
.
update
(
HGCW011
.
DELETE
,
hgcw011
);
}
}
DaoUtils
.
update
(
"HGCW010.delete"
,
HGCW
010
);
DaoUtils
.
update
(
HGCW010
.
DELETE
,
hgcw
010
);
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
...
...
@@ -322,9 +315,9 @@ public class ServiceHGCW010 extends ServiceBase {
return
inInfo
;
}
public
void
addHGCW011
(
HGCW011
HGCW
011
)
{
HGCW
011
.
setId
(
null
);
DaoUtils
.
insert
(
"HGCW011.insert"
,
HGCW
011
);
public
void
addHGCW011
(
HGCW011
hgcw
011
)
{
hgcw
011
.
setId
(
null
);
DaoUtils
.
insert
(
HGCW011
.
INSERT
,
hgcw
011
);
}
...
...
@@ -339,7 +332,7 @@ public class ServiceHGCW010 extends ServiceBase {
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HGCW010
HGCW010
=
new
HGCW010
();
HGCW010
.
fromMap
(
resultRows
.
get
(
i
));
HGCW010
.
setReviewStatus
(
1
);
HGCW010
.
setReviewStatus
(
ReviewStatusEnum
.
REVIEWED
.
getCode
()
);
DaoUtils
.
update
(
"HGCW010.submit"
,
HGCW010
);
}
inInfo
=
this
.
query
(
inInfo
);
...
...
@@ -351,14 +344,16 @@ public class ServiceHGCW010 extends ServiceBase {
return
inInfo
;
}
@OperationLogAnnotation
(
operModul
=
"销售开票"
,
operType
=
"开票"
,
operDesc
=
"开票保存"
)
public
EiInfo
billing
(
EiInfo
inInfo
){
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HGCW010
HGCW010
=
new
HGCW010
();
HGCW010
.
fromMap
(
resultRows
.
get
(
i
));
HGCW010
.
setBillState
(
2
);
DaoUtils
.
update
(
"HGCW010.billing"
,
HGCW010
);
HGCW010
hgcw010
=
new
HGCW010
();
hgcw010
.
fromMap
(
resultRows
.
get
(
i
));
hgcw010
.
setBillState
(
HGConstant
.
BillStatus
.
S2
);
this
.
modify
(
hgcw010
);
//DaoUtils.update("HGCW010.billing", hgcw010);
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
...
...
src/main/java/com/baosight/hggp/hg/cw/service/ServiceHGCW010D.java
View file @
51f1893d
...
...
@@ -207,16 +207,16 @@ public class ServiceHGCW010D extends ServiceEPBase {
public
void
add
(
HGCW010
hgcw010
)
{
hgcw010
.
setInvoiceCode
(
SequenceGenerator
.
getNextSequence
(
HGConstant
.
SequenceId
.
HGCW10_INVOICE_CODE
));
DaoUtils
.
insert
(
"HGCW010.insert"
,
hgcw010
);
DaoUtils
.
insert
(
HGCW010
.
INSERT
,
hgcw010
);
}
public
void
modify
(
HGCW010
hgcw010
)
{
DaoUtils
.
update
(
"HGCW010.update"
,
hgcw010
);
DaoUtils
.
update
(
HGCW010
.
UPDATE
,
hgcw010
);
}
public
void
addHGCW011
(
HGCW011
hgcw011
)
{
hgcw011
.
setId
(
null
);
DaoUtils
.
insert
(
"HGCW011.insert"
,
hgcw011
);
DaoUtils
.
insert
(
HGCW011
.
INSERT
,
hgcw011
);
}
public
List
<
HGCW011
>
mapToList
(
List
<
Map
>
rows
,
Long
mainId
)
{
...
...
src/main/java/com/baosight/hggp/hg/cw/service/ServiceHGCW011.java
View file @
51f1893d
package
com
.
baosight
.
hggp
.
hg
.
cw
.
service
;
import
com.baosight.eplat.utils.StringUtils
;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.hg.cw.domain.HGCW002
;
import
com.baosight.hggp.hg.cw.domain.HGCW006
;
import
com.baosight.hggp.hg.cw.domain.HGCW010
;
import
com.baosight.hggp.hg.cw.domain.HGCW011
;
import
com.baosight.hggp.hg.cw.tools.HGCWTools
;
import
com.baosight.hggp.hg.cw.vo.UserVO
;
import
com.baosight.hggp.util.CommonMethod
;
import
com.baosight.hggp.util.LogUtils
;
import
com.baosight.hggp.util.MapUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -30,7 +37,7 @@ public class ServiceHGCW011 extends ServiceBase {
* @return
*/
@OperationLogAnnotation
(
operModul
=
"
账期维护
"
,
operType
=
"查询"
,
operDesc
=
"初始化"
)
@OperationLogAnnotation
(
operModul
=
"
销售开票
"
,
operType
=
"查询"
,
operDesc
=
"初始化"
)
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
try
{
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
FACTORY_RECORD_BLOCK_ID
,
...
...
@@ -48,7 +55,7 @@ public class ServiceHGCW011 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"
账期维护
"
,
operType
=
"查询"
,
operDesc
=
"查询"
)
@OperationLogAnnotation
(
operModul
=
"
销售开票
"
,
operType
=
"查询"
,
operDesc
=
"查询"
)
@Override
public
EiInfo
query
(
EiInfo
inInfo
)
{
try
{
...
...
@@ -59,13 +66,56 @@ public class ServiceHGCW011 extends ServiceBase {
return
inInfo
;
}
@Override
public
EiInfo
update
(
EiInfo
inInfo
)
{
try
{
List
<
HGCW011
>
hgcw011s
=
MapUtils
.
toDaoEPBases
(
inInfo
,
HGCW011
.
class
);
Long
mainId
=
hgcw011s
.
stream
().
map
(
HGCW011:
:
getMainId
).
distinct
().
findAny
().
orElseThrow
(()
->
new
PlatException
(
"请选择主表数据"
));
HGCW010
hgcw010
=
HGCWTools
.
HgCw010
.
getId
(
String
.
valueOf
(
mainId
));
List
<
HGCW011
>
hgcw011List
=
HGCWTools
.
HgCw011
.
getMainId
(
mainId
);
for
(
HGCW011
hgcw011:
hgcw011s
)
{
HGCW002
hgcw002
=
HGCWTools
.
HgCw002
.
getContractNumber
(
hgcw011
.
getSettlementNumber
());
HGCW006
hgcw006
=
HGCWTools
.
HgCw006
.
getContractNumber
(
hgcw011
.
getSettlementNumber
());
HGCW011
cw011
=
hgcw011List
.
stream
().
filter
(
hgcw0111
->
hgcw0111
.
getId
().
equals
(
hgcw011
.
getId
())).
findFirst
().
get
();
BigDecimal
acount
=
hgcw011
.
getTotalContractPriceIncluding
();
if
(
acount
.
compareTo
(
cw011
.
getTotalContractPriceIncluding
())
>
0
){
acount
=
acount
.
subtract
(
cw011
.
getTotalContractPriceIncluding
());
}
else
if
(
acount
.
compareTo
(
cw011
.
getTotalContractPriceIncluding
())
<
0
){
acount
=
cw011
.
getTotalContractPriceIncluding
().
subtract
(
acount
).
multiply
(
new
BigDecimal
(-
1
));
}
if
(
StringUtils
.
isNotNull
(
hgcw002
)){
HGCWTools
.
HgCw008
.
remainingAmount
(
hgcw011
.
getSettlementNumber
(),
acount
);
}
else
if
(
StringUtils
.
isNotNull
(
hgcw006
)){
HGCWTools
.
HgCw006
.
deductionAmount
(
hgcw011
.
getSettlementNumber
(),
acount
);
}
else
{
HGCWTools
.
HgCw008
.
deductionAmount
(
hgcw011
.
getSettlementNumber
(),
acount
);
}
this
.
modify
(
hgcw011
);
}
List
<
HGCW011
>
hgcw011List1
=
HGCWTools
.
HgCw011
.
getMainId
(
mainId
);
BigDecimal
totalContractPriceIncluding
=
hgcw011List1
.
stream
().
map
(
HGCW011:
:
getTotalContractPriceIncluding
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
taxPoints
=
new
BigDecimal
(
hgcw010
.
getTaxPoints
());
// 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal
taxRateAsDecimal
=
taxPoints
.
divide
(
new
BigDecimal
(
"100"
)).
add
(
new
BigDecimal
(
"1"
));
// 将税率转换为小数形式
BigDecimal
thisSettlementAmount
=
totalContractPriceIncluding
.
divide
(
taxRateAsDecimal
,
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
thisSettlementTax
=
totalContractPriceIncluding
.
subtract
(
thisSettlementAmount
);
// 计算税额
hgcw010
.
setThisSettlementTax
(
thisSettlementTax
.
toString
());
hgcw010
.
setThisSettlementAmount
(
thisSettlementAmount
.
toString
());
DaoUtils
.
update
(
HGCW010
.
UPDATE
,
hgcw010
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
hgcw011s
.
size
()
+
"]条数据保存成功!"
);
}
catch
(
PlatException
e
){
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"修改失败"
);
}
return
inInfo
;
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"
账期维护
"
,
operType
=
"保存"
,
operDesc
=
"保存"
)
@OperationLogAnnotation
(
operModul
=
"
销售开票
"
,
operType
=
"保存"
,
operDesc
=
"保存"
)
public
EiInfo
save
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
...
...
@@ -96,21 +146,21 @@ public class ServiceHGCW011 extends ServiceBase {
/**
* 新增操作
*
* @param
HGCW
011
* @param
hgcw
011
* @return
*/
public
void
add
(
HGCW011
HGCW
011
)
{
DaoUtils
.
insert
(
"HGCW011.insert"
,
HGCW
011
);
public
void
add
(
HGCW011
hgcw
011
)
{
DaoUtils
.
insert
(
HGCW011
.
INSERT
,
hgcw
011
);
}
/**
* 修改操作
*
* @param
HGCW
011
* @param
hgcw
011
* @return
*/
public
void
modify
(
HGCW011
HGCW
011
)
{
DaoUtils
.
update
(
"HGCW011.update"
,
HGCW
011
);
public
void
modify
(
HGCW011
hgcw
011
)
{
DaoUtils
.
update
(
HGCW011
.
UPDATE
,
hgcw
011
);
}
/**
...
...
@@ -119,12 +169,13 @@ public class ServiceHGCW011 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"账期维护"
,
operType
=
"删除"
,
operDesc
=
"删除"
)
@OperationLogAnnotation
(
operModul
=
"销售开票"
,
operType
=
"删除"
,
operDesc
=
"删除"
)
@Override
public
EiInfo
delete
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
DaoUtils
.
update
(
"HGCW011.delete"
,
resultRows
.
get
(
i
));
DaoUtils
.
update
(
HGCW011
.
DELETE
,
resultRows
.
get
(
i
));
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
...
...
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