Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
ec87cd18
Commit
ec87cd18
authored
Jul 08, 2021
by
季圣华
Browse files
优化收预付款的逻辑
parent
b27ffdf1
Changes
3
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotHeadController.java
View file @
ec87cd18
...
@@ -290,8 +290,7 @@ public class DepotHeadController {
...
@@ -290,8 +290,7 @@ public class DepotHeadController {
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
String
beanJson
=
body
.
getInfo
();
String
beanJson
=
body
.
getInfo
();
String
rows
=
body
.
getRows
();
String
rows
=
body
.
getRows
();
BigDecimal
preTotalPrice
=
body
.
getPreTotalPrice
();
depotHeadService
.
updateDepotHeadAndDetail
(
beanJson
,
rows
,
tenantId
,
request
);
depotHeadService
.
updateDepotHeadAndDetail
(
beanJson
,
rows
,
preTotalPrice
,
tenantId
,
request
);
return
result
;
return
result
;
}
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java
View file @
ec87cd18
...
@@ -13,6 +13,7 @@ import com.jsh.erp.exception.JshException;
...
@@ -13,6 +13,7 @@ import com.jsh.erp.exception.JshException;
import
com.jsh.erp.service.accountItem.AccountItemService
;
import
com.jsh.erp.service.accountItem.AccountItemService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.orgaUserRel.OrgaUserRelService
;
import
com.jsh.erp.service.orgaUserRel.OrgaUserRelService
;
import
com.jsh.erp.service.supplier.SupplierService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.Tools
;
import
com.jsh.erp.utils.Tools
;
...
@@ -46,6 +47,8 @@ public class AccountHeadService {
...
@@ -46,6 +47,8 @@ public class AccountHeadService {
@Resource
@Resource
private
UserService
userService
;
private
UserService
userService
;
@Resource
@Resource
private
SupplierService
supplierService
;
@Resource
private
LogService
logService
;
private
LogService
logService
;
@Resource
@Resource
private
AccountItemMapperEx
accountItemMapperEx
;
private
AccountItemMapperEx
accountItemMapperEx
;
...
@@ -221,6 +224,7 @@ public class AccountHeadService {
...
@@ -221,6 +224,7 @@ public class AccountHeadService {
return
list
==
null
?
0
:
list
.
size
();
return
list
==
null
?
0
:
list
.
size
();
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
addAccountHeadAndDetail
(
String
beanJson
,
String
rows
,
HttpServletRequest
request
)
throws
Exception
{
public
void
addAccountHeadAndDetail
(
String
beanJson
,
String
rows
,
HttpServletRequest
request
)
throws
Exception
{
AccountHead
accountHead
=
JSONObject
.
parseObject
(
beanJson
,
AccountHead
.
class
);
AccountHead
accountHead
=
JSONObject
.
parseObject
(
beanJson
,
AccountHead
.
class
);
User
userInfo
=
userService
.
getCurrentUser
();
User
userInfo
=
userService
.
getCurrentUser
();
...
@@ -236,12 +240,18 @@ public class AccountHeadService {
...
@@ -236,12 +240,18 @@ public class AccountHeadService {
/**处理单据子表信息*/
/**处理单据子表信息*/
accountItemService
.
saveDetials
(
rows
,
headId
,
type
,
request
);
accountItemService
.
saveDetials
(
rows
,
headId
,
type
,
request
);
}
}
if
(
"收预付款"
.
equals
(
accountHead
.
getType
())){
supplierService
.
updateAdvanceIn
(
accountHead
.
getOrganId
(),
accountHead
.
getTotalPrice
());
}
logService
.
insertLog
(
"财务单据"
,
logService
.
insertLog
(
"财务单据"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
).
append
(
accountHead
.
getBillNo
()).
toString
(),
request
);
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
).
append
(
accountHead
.
getBillNo
()).
toString
(),
request
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
updateAccountHeadAndDetail
(
String
beanJson
,
String
rows
,
HttpServletRequest
request
)
throws
Exception
{
public
void
updateAccountHeadAndDetail
(
String
beanJson
,
String
rows
,
HttpServletRequest
request
)
throws
Exception
{
AccountHead
accountHead
=
JSONObject
.
parseObject
(
beanJson
,
AccountHead
.
class
);
AccountHead
accountHead
=
JSONObject
.
parseObject
(
beanJson
,
AccountHead
.
class
);
//获取之前的金额数据
BigDecimal
preTotalPrice
=
getAccountHead
(
accountHead
.
getId
()).
getTotalPrice
().
abs
();
accountHeadMapper
.
updateByPrimaryKeySelective
(
accountHead
);
accountHeadMapper
.
updateByPrimaryKeySelective
(
accountHead
);
//根据单据编号查询单据id
//根据单据编号查询单据id
AccountHeadExample
dhExample
=
new
AccountHeadExample
();
AccountHeadExample
dhExample
=
new
AccountHeadExample
();
...
@@ -253,6 +263,9 @@ public class AccountHeadService {
...
@@ -253,6 +263,9 @@ public class AccountHeadService {
/**处理单据子表信息*/
/**处理单据子表信息*/
accountItemService
.
saveDetials
(
rows
,
headId
,
type
,
request
);
accountItemService
.
saveDetials
(
rows
,
headId
,
type
,
request
);
}
}
if
(
"收预付款"
.
equals
(
accountHead
.
getType
())){
supplierService
.
updateAdvanceIn
(
accountHead
.
getOrganId
(),
accountHead
.
getTotalPrice
().
subtract
(
preTotalPrice
));
}
logService
.
insertLog
(
"财务单据"
,
logService
.
insertLog
(
"财务单据"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
accountHead
.
getBillNo
()).
toString
(),
request
);
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
accountHead
.
getBillNo
()).
toString
(),
request
);
}
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
ec87cd18
...
@@ -267,7 +267,7 @@ public class DepotHeadService {
...
@@ -267,7 +267,7 @@ public class DepotHeadService {
}
}
//对于零售出库单据,更新会员的预收款信息
//对于零售出库单据,更新会员的预收款信息
if
(
BusinessConstants
.
DEPOTHEAD_TYPE_OUT
.
equals
(
depotHead
.
getType
())
if
(
BusinessConstants
.
DEPOTHEAD_TYPE_OUT
.
equals
(
depotHead
.
getType
())
&&
BusinessConstants
.
SUB_TYPE_
TRANSFER
.
equals
(
depotHead
.
getSubType
())){
&&
BusinessConstants
.
SUB_TYPE_
RETAIL
.
equals
(
depotHead
.
getSubType
())){
if
(
BusinessConstants
.
PAY_TYPE_PREPAID
.
equals
(
depotHead
.
getPayType
()))
{
if
(
BusinessConstants
.
PAY_TYPE_PREPAID
.
equals
(
depotHead
.
getPayType
()))
{
if
(
depotHead
.
getOrganId
()
!=
null
)
{
if
(
depotHead
.
getOrganId
()
!=
null
)
{
supplierService
.
updateAdvanceIn
(
depotHead
.
getOrganId
(),
depotHead
.
getTotalPrice
().
abs
());
supplierService
.
updateAdvanceIn
(
depotHead
.
getOrganId
(),
depotHead
.
getTotalPrice
().
abs
());
...
@@ -689,16 +689,16 @@ public class DepotHeadService {
...
@@ -689,16 +689,16 @@ public class DepotHeadService {
* 更新单据主表及单据子表信息
* 更新单据主表及单据子表信息
* @param beanJson
* @param beanJson
* @param rows
* @param rows
* @param preTotalPrice
* @param tenantId
* @param tenantId
* @param request
* @param request
* @throws Exception
* @throws Exception
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
updateDepotHeadAndDetail
(
String
beanJson
,
String
rows
,
public
void
updateDepotHeadAndDetail
(
String
beanJson
,
String
rows
,
Long
tenantId
,
HttpServletRequest
request
)
throws
Exception
{
BigDecimal
preTotalPrice
,
Long
tenantId
,
HttpServletRequest
request
)
throws
Exception
{
/**更新单据主表信息*/
/**更新单据主表信息*/
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
//获取之前的金额数据
BigDecimal
preTotalPrice
=
getDepotHead
(
depotHead
.
getId
()).
getTotalPrice
().
abs
();
String
subType
=
depotHead
.
getSubType
();
String
subType
=
depotHead
.
getSubType
();
if
(
"零售"
.
equals
(
subType
)
||
"零售退货"
.
equals
(
subType
)
if
(
"零售"
.
equals
(
subType
)
||
"零售退货"
.
equals
(
subType
)
||
"采购"
.
equals
(
subType
)
||
"采购退货"
.
equals
(
subType
)
||
"采购"
.
equals
(
subType
)
||
"采购退货"
.
equals
(
subType
)
...
...
Write
Preview
Supports
Markdown
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