Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
20a43543
Commit
20a43543
authored
Jan 19, 2025
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(wealth): 优化
parent
6960a4e8
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
253 additions
and
119 deletions
+253
-119
20250106.sql
sql/v2.2财务/20250106.sql
+3
-0
BankApiImpl.java
.../cn/iocoder/yudao/module/ecw/service/api/BankApiImpl.java
+18
-8
OrderQueryServiceImpl.java
...odule/order/service/order/impl/OrderQueryServiceImpl.java
+3
-1
BankReceiptDetailsMapper.java
...ealth/dal/mysql/receiptItem/BankReceiptDetailsMapper.java
+1
-1
ReceivableMapper.java
.../module/wealth/dal/mysql/receivable/ReceivableMapper.java
+2
-0
BoxReportConstant.java
.../iocoder/yudao/module/wealth/enums/BoxReportConstant.java
+0
-4
FinanceReceiptApproveService.java
...o/module/wealth/service/FinanceReceiptApproveService.java
+13
-2
ReceiptServiceImpl.java
...dao/module/wealth/service/receipt/ReceiptServiceImpl.java
+1
-3
BankReceiptDetailsImpl.java
...le/wealth/service/receiptItem/BankReceiptDetailsImpl.java
+1
-1
ReceiptItemService.java
...module/wealth/service/receiptItem/ReceiptItemService.java
+1
-1
ReceiptItemServiceImpl.java
...le/wealth/service/receiptItem/ReceiptItemServiceImpl.java
+14
-15
ReceivableServiceImpl.java
...dule/wealth/service/receivable/ReceivableServiceImpl.java
+102
-55
BankIncomeItemResp.java
...udao/module/wealth/vo/receiptItem/BankIncomeItemResp.java
+3
-0
ReceivableBoxReportQueryVO.java
...dule/wealth/vo/receivable/ReceivableBoxReportQueryVO.java
+3
-1
ReceivableCurrencyAmount.java
...module/wealth/vo/receivable/ReceivableCurrencyAmount.java
+7
-2
ReceivableIncomeBelong.java
...o/module/wealth/vo/receivable/ReceivableIncomeBelong.java
+1
-0
BoxReportCacheRefreshJob.java
...wealth/controller/admin/job/BoxReportCacheRefreshJob.java
+31
-0
BoxReportCacheRefreshRunner.java
...lth/controller/admin/job/BoxReportCacheRefreshRunner.java
+2
-1
ReceiptItemController.java
...h/controller/admin/receiptItem/ReceiptItemController.java
+3
-2
BankReceiptDetailsMapper.xml
...resources/mapper/ReceiptItem/BankReceiptDetailsMapper.xml
+5
-6
ReceiptItemMapper.xml
...c/main/resources/mapper/ReceiptItem/ReceiptItemMapper.xml
+2
-1
ReceiptMapper.xml
...-rest/src/main/resources/mapper/receipt/ReceiptMapper.xml
+5
-2
ReceivableMapper.xml
...src/main/resources/mapper/receivable/ReceivableMapper.xml
+32
-13
No files found.
sql/v2.2财务/20250106.sql
View file @
20a43543
...
...
@@ -48,6 +48,9 @@ CREATE TABLE `ecw_receipt_bank_writeoff_range` (
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
CHARACTER
SET
=
utf8mb4
COLLATE
=
utf8mb4_general_ci
COMMENT
=
'银行收款明细自动核销比例设置表'
ROW_FORMAT
=
DYNAMIC
;
INSERT
INTO
`ecw_receipt_bank_writeoff_range`
(
`id`
,
`write_off_down`
,
`write_off_up`
,
`create_time`
,
`update_time`
,
`creator`
,
`updater`
,
`deleted`
)
VALUES
(
1
,
9999
,
10000
,
'2025-01-20 13:39:44'
,
'2025-01-20 13:39:44'
,
'1'
,
'1'
,
0
);
CREATE
TABLE
`ecw_receipt_invoice`
(
`id`
bigint
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键'
,
`invoice_no`
varchar
(
255
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
NOT
NULL
COMMENT
'开票编号'
,
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/service/api/BankApiImpl.java
View file @
20a43543
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
service
.
api
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.iocoder.yudao.module.ecw.api.bank.BankApi
;
import
cn.iocoder.yudao.module.ecw.api.bank.dto.BankAccountDTO
;
import
cn.iocoder.yudao.module.ecw.convert.bankAccount.BankAccountConvert
;
...
...
@@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.List
;
@Service
...
...
@@ -33,16 +35,24 @@ public class BankApiImpl implements BankApi {
@Override
public
void
updateBankAccountBalance
(
BankAccountDTO
bankAccountDTO
,
boolean
isAdd
)
{
List
<
BankAccountDO
>
bankAccountDOS
=
bankAccountMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
BankAccountDO
.
class
)
.
eq
(
BankAccountDO:
:
getBaAccountName
,
bankAccountDTO
.
getBaAccountName
())
.
eq
(
BankAccountDO:
:
getBaAccountNum
,
bankAccountDTO
.
getBaAccountNum
())
.
eq
(
BankAccountDO:
:
getBaBankName
,
bankAccountDTO
.
getBaBankName
()));
if
(
bankAccountDOS
!=
null
&&
!
bankAccountDOS
.
isEmpty
())
{
BankAccountDO
bankAccountDO
=
bankAccountDOS
.
get
(
0
);
BankAccountDO
bankAccountDO
=
null
;
if
(
bankAccountDTO
.
getId
()
!=
null
)
{
bankAccountDO
=
bankAccountMapper
.
selectById
(
bankAccountDTO
.
getId
());
}
else
{
List
<
BankAccountDO
>
bankAccountDOS
=
bankAccountMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
BankAccountDO
.
class
)
.
eq
(
BankAccountDO:
:
getBaAccountName
,
bankAccountDTO
.
getBaAccountName
())
.
eq
(
BankAccountDO:
:
getBaAccountNum
,
bankAccountDTO
.
getBaAccountNum
())
.
eq
(
BankAccountDO:
:
getBaBankName
,
bankAccountDTO
.
getBaBankName
()));
if
(
CollectionUtil
.
isNotEmpty
(
bankAccountDOS
))
{
bankAccountDO
=
bankAccountDOS
.
get
(
0
);
}
}
if
(
bankAccountDO
!=
null
)
{
BigDecimal
baBalance
=
bankAccountDO
.
getBaBalance
()
==
null
?
BigDecimal
.
ZERO
:
bankAccountDO
.
getBaBalance
();
if
(
isAdd
)
{
bankAccountDO
.
setBaBalance
(
ba
nkAccountDO
.
getBaBalance
()
.
add
(
bankAccountDTO
.
getBaBalance
()));
bankAccountDO
.
setBaBalance
(
ba
Balance
.
add
(
bankAccountDTO
.
getBaBalance
()));
}
else
{
bankAccountDO
.
setBaBalance
(
ba
nkAccountDO
.
getBaBalance
()
.
subtract
(
bankAccountDTO
.
getBaBalance
()));
bankAccountDO
.
setBaBalance
(
ba
Balance
.
subtract
(
bankAccountDTO
.
getBaBalance
()));
}
bankAccountMapper
.
updateById
(
bankAccountDO
);
}
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/order/impl/OrderQueryServiceImpl.java
View file @
20a43543
...
...
@@ -3849,7 +3849,9 @@ public class OrderQueryServiceImpl implements OrderQueryService {
orderCostSummaryDto
.
setIsCargoControl
(
back
.
getIsCargoControl
()
?
1
:
0
);
return
orderCostSummaryDto
;
}).
collect
(
Collectors
.
toList
());
List
<
OrderCostSummaryDto
>
resultList
=
totalList
.
subList
(
page
.
getPage
()
-
1
,
Math
.
min
(
page
.
getPage
()
*
page
.
getRows
(),
records
.
size
()));
int
startIndex
=
Math
.
max
(
0
,
(
page
.
getPage
()
-
1
)
*
page
.
getRows
());
int
endIndex
=
Math
.
min
(
startIndex
+
page
.
getRows
(),
records
.
size
());
List
<
OrderCostSummaryDto
>
resultList
=
totalList
.
subList
(
startIndex
,
endIndex
);
ContainerReportOrderPageResult
<
OrderCostSummaryDto
>
pageResult
=
new
ContainerReportOrderPageResult
(
resultList
,
records
.
size
(),
page
.
getRows
(),
(
long
)
page
.
getPage
(),
records
.
size
()
/
page
.
getRows
()
+
1
);
// 汇总全部
totalList
.
stream
().
forEach
(
orderCostSummaryDto
->
{
...
...
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/dal/mysql/receiptItem/BankReceiptDetailsMapper.java
View file @
20a43543
...
...
@@ -15,7 +15,7 @@ public interface BankReceiptDetailsMapper {
IPage
<
BankIncomeItemResp
>
getBankIncomeItemPage
(
IPage
<
BankIncomeItemResp
>
page
,
@Param
(
"req"
)
BankIncomeItemReq
req
);
List
<
CurrencyAmount
>
calculateAccountBalance
(
String
accountNo
);
List
<
CurrencyAmount
>
calculateAccountBalance
(
Long
accountId
);
List
<
CurrencyAmount
>
calculateCurrentAmount
(
@Param
(
"req"
)
BankIncomeItemReq
req
);
...
...
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/dal/mysql/receivable/ReceivableMapper.java
View file @
20a43543
...
...
@@ -437,4 +437,6 @@ public interface ReceivableMapper extends AbstractMapper<ReceivableDO> {
List
<
ReceivableDO
>
selectBoxReceivablesByOrderIds
(
@Param
(
"orderIds"
)
Set
<
Long
>
orderIds
);
List
<
Long
>
getAllBoxId
();
List
<
Long
>
getDestWarehouseIdListByDestCity
(
@Param
(
"destCity"
)
List
<
Long
>
destCity
);
}
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/enums/BoxReportConstant.java
View file @
20a43543
...
...
@@ -13,8 +13,4 @@ public interface BoxReportConstant {
* 报表查询条件缓存key
*/
String
BOX_REPORT_QUERY_CONDITION_CACHE
=
"wealth:report:condition"
;
/**
* 本年度报表缓存
*/
String
BOX_REPORT_CURRENT_YEAR_CACHE
=
"wealth:report:currentYear"
;
}
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/service/FinanceReceiptApproveService.java
View file @
20a43543
...
...
@@ -5,6 +5,8 @@ import cn.iocoder.yudao.module.bpm.api.BpmCreateServiceFactory;
import
cn.iocoder.yudao.module.bpm.enums.BpmProcessInstanceResultEnum
;
import
cn.iocoder.yudao.module.bpm.enums.WorkFlowEmus
;
import
cn.iocoder.yudao.module.bpm.resp.TaskResp
;
import
cn.iocoder.yudao.module.ecw.api.bank.BankApi
;
import
cn.iocoder.yudao.module.ecw.api.bank.dto.BankAccountDTO
;
import
cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO
;
import
cn.iocoder.yudao.module.wealth.dal.dataobject.receiptApproval.ReceiptApprovalDO
;
import
cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO
;
...
...
@@ -57,6 +59,8 @@ public class FinanceReceiptApproveService {
private
ReceivableService
receivableService
;
@Resource
private
ApplicationContext
applicationContext
;
@Resource
private
BankApi
bankApi
;
@Transactional
public
void
financeApproveCallBack
(
String
bmpKey
,
String
businessKey
,
Integer
result
)
{
...
...
@@ -158,6 +162,7 @@ public class FinanceReceiptApproveService {
List
orderIds
=
orderList
.
stream
().
map
(
ReceivableDO:
:
getOrderId
).
distinct
().
collect
(
Collectors
.
toList
());
receivableService
.
orderReceivableWriteOffLogAdd
(
orderIds
,
receiptDO
.
getReceiptNo
());
// TODO 更新核销误差兑额外费用主币种金额
}
else
if
(
result
==
BpmProcessInstanceResultEnum
.
REJECT
.
getResult
())
{
updateReceipt
.
setState
(
ReceiptStatusEnum
.
WRITE_OFF_PART_ING
.
getValue
());
...
...
@@ -230,7 +235,7 @@ public class FinanceReceiptApproveService {
updateWrapper
.
eq
(
ReceiptItemDO:
:
getId
,
receiptItemDO
.
getId
());
updateWrapper
.
set
(
ReceiptItemDO:
:
getBmpStatus
,
result
);
if
(
result
==
BpmProcessInstanceResultEnum
.
APPROVE
.
getResult
())
{
updateWrapper
.
set
(
ReceiptItemDO:
:
getStatus
,
ReceiptItemStatusEnum
.
WRITE_OFF
.
getValue
());
updateWrapper
.
set
(
ReceiptItemDO:
:
getStatus
,
ReceiptItemStatusEnum
.
DRAFT
.
getValue
());
updateWrapper
.
set
(
ReceiptItemDO:
:
getApprovalTime
,
null
);
receiptItemMapper
.
update
(
null
,
updateWrapper
);
//需要根据应收明细核销状态 变更成部分核销或者待核销
...
...
@@ -259,6 +264,13 @@ public class FinanceReceiptApproveService {
}
receivableService
.
updateBatchById
(
receivableDOS
);
receiptService
.
updateReceiptItemStatus
(
receiptItemDO
.
getReceiptId
());
// 更新银行账户余额
bankApi
.
updateBankAccountBalance
(
BankAccountDTO
.
builder
()
.
id
(
receiptItemDO
.
getAccountId
())
.
baAccountName
(
receiptItemDO
.
getAccountName
())
.
baAccountNum
(
receiptItemDO
.
getAccountNo
())
.
baBankName
(
receiptItemDO
.
getAccountBankName
())
.
baBalance
(
receiptItemDO
.
getAmount
()).
build
(),
true
);
}
else
if
(
result
==
BpmProcessInstanceResultEnum
.
REJECT
.
getResult
())
{
updateWrapper
.
set
(
ReceiptItemDO:
:
getStatus
,
ReceiptItemStatusEnum
.
WRITE_OFF
.
getValue
());
receiptItemMapper
.
update
(
null
,
updateWrapper
);
...
...
@@ -267,7 +279,6 @@ public class FinanceReceiptApproveService {
receiptItemMapper
.
update
(
null
,
updateWrapper
);
}
receiptService
.
recordLog
(
receiptItemDO
.
getReceiptId
(),
ReceiptLinkEnum
.
REJECT_BANK_RECEIPT
,
comment
,
WorkFlowEmus
.
FINANCE_RECEIPT_ITEM_WRITE_OFF_NO
.
getValue
());
// TODO 更新银行账号余额
}
ReceiptApprovalDO
updateReceiptApproval
=
new
ReceiptApprovalDO
();
updateReceiptApproval
.
setId
(
receiptApprovalDO
.
getId
());
...
...
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/service/receipt/ReceiptServiceImpl.java
View file @
20a43543
...
...
@@ -844,7 +844,6 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
update
.
setState
(
ReceiptStatusEnum
.
APPROVE_NEGATION
.
getValue
());
update
.
setBmpId
(
bpmId
);
receiptMapper
.
updateById
(
update
);
//recordLog(update.getId(), ReceiptLinkEnum.REJECT_RECEIPT, financeReceiptVo.getRemark(), WorkFlowEmus.FINANCE_RECEIPT_APPROVE_NO.getValue());
}
@Override
...
...
@@ -876,7 +875,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
if
(
null
==
currencyId
)
{
throw
exception
(
RECEIPT_CURRENCY_NOT_EXISTS
);
}
if
(
totalAmount
.
compareTo
(
receiptDO
.
getReceivableTotalAmount
())
==
-
1
)
{
if
(
totalAmount
.
compareTo
(
receiptDO
.
getReceivableTotalAmount
())
<
0
)
{
DictDataRespDTO
dictDataRespDTO
=
dictDataApi
.
parseDictDataFromCache
(
"write_off_diff"
,
String
.
valueOf
(
currencyId
));
if
(
null
==
dictDataRespDTO
)
{
throw
exception
(
RECEIPT_CURRENCY_DIFF_NOT_EXISTS
);
...
...
@@ -940,7 +939,6 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
update
.
setState
(
ReceiptStatusEnum
.
WRITE_OFF_ALL_NEGATION
.
getValue
());
update
.
setBmpId
(
bpmId
);
receiptMapper
.
updateById
(
update
);
recordLog
(
update
.
getId
(),
ReceiptLinkEnum
.
REJECT_WRITE_OFF_RECEIPT
,
financeReceiptVo
.
getRemark
(),
update
.
getBmpId
());
}
@Override
...
...
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/service/receiptItem/BankReceiptDetailsImpl.java
View file @
20a43543
...
...
@@ -87,7 +87,7 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService {
if
(
accountBalanceMap
.
containsKey
(
record
.
getAccountNo
()))
{
record
.
setAccountBalance
(
accountBalanceMap
.
get
(
record
.
getAccountNo
()));
}
else
{
record
.
setAccountBalance
(
bankReceiptDetailsMapper
.
calculateAccountBalance
(
record
.
getAccount
No
()));
record
.
setAccountBalance
(
bankReceiptDetailsMapper
.
calculateAccountBalance
(
record
.
getAccount
Id
()));
accountBalanceMap
.
put
(
record
.
getAccountNo
(),
record
.
getAccountBalance
());
}
List
<
ReceiptRelationOrderInfoVO
>
orderInfoByReceiptId
=
receiptMapper
.
getOrderInfoByReceiptId
(
Long
.
parseLong
(
record
.
getReceiptId
()));
...
...
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/service/receiptItem/ReceiptItemService.java
View file @
20a43543
...
...
@@ -28,7 +28,7 @@ public interface ReceiptItemService extends IService<ReceiptItemDO> {
* @param createReqVO 创建信息
* @return 编号
*/
Long
createReceiptItem
(
@Valid
ReceiptItemCreateReqVO
createReqVO
);
Long
createReceiptItem
(
@Valid
ReceiptItemCreateReqVO
createReqVO
,
boolean
isBatch
);
/**
* 更新收款单明细
...
...
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/service/receiptItem/ReceiptItemServiceImpl.java
View file @
20a43543
...
...
@@ -116,7 +116,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Long
createReceiptItem
(
ReceiptItemCreateReqVO
createReqVO
)
{
public
Long
createReceiptItem
(
ReceiptItemCreateReqVO
createReqVO
,
boolean
isBatch
)
{
ReceiptDO
receiptDO
=
validateCreateVO
(
createReqVO
);
// 插入收款明细
ReceiptItemDO
receiptItem
=
ReceiptItemConvert
.
INSTANCE
.
convert
(
createReqVO
);
...
...
@@ -141,7 +141,9 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
receiptService
.
updateById
(
update
);
}
receiptService
.
updateReceiptItemStatus
(
receiptItem
.
getReceiptId
());
receiptItemAutoApprove
(
receiptItem
,
receiptDO
.
getReceiptNo
());
if
(
isBatch
)
{
receiptItemAutoApprove
(
receiptItem
,
receiptDO
.
getReceiptNo
());
}
// 返回
return
receiptItem
.
getId
();
}
...
...
@@ -247,13 +249,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
verification
(
Long
id
,
Integer
bpmResult
,
String
comment
)
{
//收款单明细核销审核
if
(
null
==
id
)
{
throw
exception
(
RECEIPT_ITEM_NOT_FOUND
);
}
ReceiptItemDO
receiptItemDO
=
receiptItemMapper
.
selectById
(
id
);
if
(
null
==
receiptItemDO
)
{
throw
exception
(
RECEIPT_ITEM_NOT_FOUND
);
}
receiptItemDO
.
setBmpStatus
(
bpmResult
);
// 核销通过
if
(
Objects
.
equals
(
bpmResult
,
BpmProcessInstanceResultEnum
.
APPROVE
.
getResult
()))
{
...
...
@@ -262,10 +258,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
// 更新收款单
ReceiptDO
receiptDO
=
receiptMapper
.
selectById
(
receiptItemDO
.
getReceiptId
());
if
(
null
==
receiptDO
)
{
throw
exception
(
RECEIPT_NOT_EXISTS
);
}
//判断收款单状态如果是待核销状态-变成部分核销状态,其它 状态不变
//判断收款单状态如果是待提交状态-变成部分核销状态,其它 状态不变
if
(
receiptDO
.
getState
().
equals
(
ReceiptStatusEnum
.
WRITE_OFF_WAITING
.
getValue
()))
{
receiptDO
.
setState
(
ReceiptStatusEnum
.
WRITE_OFF_PART_ING
.
getValue
());
}
...
...
@@ -274,7 +267,11 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
if
(
null
!=
receiptDO
.
getReceivableTotalAmount
()
&&
receiptDO
.
getReceivableTotalAmount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
receiptDO
.
setWriteOffProportion
(
writeOffAmount
.
divide
(
receiptDO
.
getReceivableTotalAmount
(),
8
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
"100"
)).
setScale
(
6
,
BigDecimal
.
ROUND_HALF_UP
));
}
receiptService
.
updateById
(
receiptDO
);
try
{
receiptService
.
updateById
(
receiptDO
);
}
catch
(
Exception
e
)
{
log
.
error
(
"更新收款单状态失败"
,
e
);
}
//更新应收明细
List
<
ReceivableDO
>
receivableDOS
=
receivableService
.
selectList
(
"receipt_id"
,
receiptItemDO
.
getReceiptId
());
for
(
ReceivableDO
receivableDO
:
receivableDOS
)
{
...
...
@@ -282,13 +279,15 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
ReceivableWriteOffRecordDO
receivableWriteOffRecordDO
=
receivableService
.
getReceivableWriteOffRecord
(
receivableDO
.
getId
(),
receiptItemDO
.
getId
());
if
(
null
!=
receivableWriteOffRecordDO
)
{
BigDecimal
writeOffCurrent
=
receivableWriteOffRecordDO
.
getWriteOffAmount
().
divide
(
receivableDO
.
getExchangeRate
(),
4
,
RoundingMode
.
HALF_UP
);
receivableDO
.
setWriteOffAmount
(
receivableDO
.
getWriteOffAmount
().
add
(
writeOffCurrent
));
BigDecimal
oldWriteOffAmount
=
receivableDO
.
getWriteOffAmount
()
==
null
?
BigDecimal
.
ZERO
:
receivableDO
.
getWriteOffAmount
();
receivableDO
.
setWriteOffAmount
(
oldWriteOffAmount
.
add
(
writeOffCurrent
));
}
}
receivableService
.
updateBatchById
(
receivableDOS
);
receiptService
.
updateReceiptItemStatus
(
receiptItemDO
.
getReceiptId
());
// 更新银行账户余额
bankApi
.
updateBankAccountBalance
(
BankAccountDTO
.
builder
()
.
id
(
receiptItemDO
.
getAccountId
())
.
baAccountName
(
receiptItemDO
.
getAccountName
())
.
baAccountNum
(
receiptItemDO
.
getAccountNo
())
.
baBankName
(
receiptItemDO
.
getAccountBankName
())
...
...
@@ -692,7 +691,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
List
<
ReceivableWriteOffReqVO
>
receivableWriteOffList
=
getReceiptItemDetail
(
listForCreateReceiptItem
,
receiptItemCreateReqVO
);
receiptItemCreateReqVO
.
setReceivableWriteOffList
(
receivableWriteOffList
);
// 插入数据
Long
receiptItemId
=
proxy
.
createReceiptItem
(
receiptItemCreateReqVO
);
Long
receiptItemId
=
proxy
.
createReceiptItem
(
receiptItemCreateReqVO
,
true
);
ReceiptItemDO
receiptItemDO
=
receiptItemMapper
.
selectById
(
receiptItemId
);
if
(
receiptItemDO
.
getBmpId
()
==
null
)
{
this
.
createFinanceReceiptItemWriteOff
(
FinanceReceiptItemVo
.
builder
()
...
...
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/service/receivable/ReceivableServiceImpl.java
View file @
20a43543
This diff is collapsed.
Click to expand it.
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/vo/receiptItem/BankIncomeItemResp.java
View file @
20a43543
...
...
@@ -24,6 +24,9 @@ public class BankIncomeItemResp {
@ApiModelProperty
(
value
=
"0收/1支,暂时没支"
)
private
Integer
isIncome
;
@ApiModelProperty
(
value
=
"收款账号id"
)
private
Long
accountId
;
@ApiModelProperty
(
value
=
"收款账号"
)
private
String
accountNo
;
...
...
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/vo/receivable/ReceivableBoxReportQueryVO.java
View file @
20a43543
...
...
@@ -42,7 +42,7 @@ public class ReceivableBoxReportQueryVO {
private
Integer
slStatus
;
@ApiModelProperty
(
value
=
"出货状态"
)
private
Integer
boxStatus
;
private
List
<
Integer
>
boxStatus
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"开始到港时间"
)
...
...
@@ -83,6 +83,8 @@ public class ReceivableBoxReportQueryVO {
private
Boolean
forceUpdateCache
=
false
;
private
List
<
String
>
selfNoList
;
public
Boolean
isEmpty
()
{
return
StringUtils
.
isBlank
(
selfNo
)
&&
(
CollectionUtil
.
isEmpty
(
startWarehouseIdList
))
...
...
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/vo/receivable/ReceivableCurrencyAmount.java
View file @
20a43543
...
...
@@ -15,7 +15,7 @@ public class ReceivableCurrencyAmount {
public
ReceivableCurrencyAmount
(
Long
currencyId
,
BigDecimal
amount
)
{
this
.
currencyId
=
currencyId
;
this
.
amount
=
amount
;
this
.
amount
=
amount
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
)
;
}
@Override
...
...
@@ -32,6 +32,11 @@ public class ReceivableCurrencyAmount {
}
public
void
addAmount
(
BigDecimal
amount
)
{
this
.
amount
=
this
.
amount
.
add
(
amount
);
this
.
amount
=
this
.
amount
.
add
(
amount
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
@Override
public
ReceivableCurrencyAmount
clone
()
{
return
new
ReceivableCurrencyAmount
(
this
.
currencyId
,
this
.
amount
);
}
}
\ No newline at end of file
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/vo/receivable/ReceivableIncomeBelong.java
View file @
20a43543
...
...
@@ -12,4 +12,5 @@ public class ReceivableIncomeBelong {
*/
private
Integer
incomeBelong
;
private
BigDecimal
writeOffAmount
;
private
BigDecimal
writeOffBaseAmount
;
}
yudao-module-wealth/yudao-module-wealth-rest/src/main/java/cn/iocoder/yudao/module/wealth/controller/admin/job/BoxReportCacheRefreshJob.java
0 → 100644
View file @
20a43543
package
cn
.
iocoder
.
yudao
.
module
.
wealth
.
controller
.
admin
.
job
;
import
cn.iocoder.yudao.framework.quartz.core.handler.JobHandler
;
import
cn.iocoder.yudao.module.wealth.dal.mysql.receivable.ReceivableMapper
;
import
cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
@Slf4j
@AllArgsConstructor
public
class
BoxReportCacheRefreshJob
implements
JobHandler
{
private
final
ReceivableService
receivableService
;
private
final
ReceivableMapper
receivableMapper
;
@Override
public
String
execute
(
String
param
)
{
log
.
info
(
"初始化应收报表缓存"
);
try
{
List
<
Long
>
boxIds
=
receivableMapper
.
getAllBoxId
();
receivableService
.
updateBoxAmountCache
(
boxIds
,
true
);
}
catch
(
Exception
e
)
{
log
.
error
(
"初始化应收报表缓存失败"
,
e
);
}
log
.
info
(
"初始化应收报表缓存完成"
);
return
""
;
}
}
yudao-module-wealth/yudao-module-wealth-rest/src/main/java/cn/iocoder/yudao/module/wealth/controller/admin/job/BoxReportCache
Load
er.java
→
yudao-module-wealth/yudao-module-wealth-rest/src/main/java/cn/iocoder/yudao/module/wealth/controller/admin/job/BoxReportCache
RefreshRunn
er.java
View file @
20a43543
...
...
@@ -19,10 +19,11 @@ import static cn.iocoder.yudao.module.wealth.enums.BoxReportConstant.BOX_AMOUNT_
@Component
@Slf4j
@AllArgsConstructor
public
class
BoxReportCache
Load
er
implements
ApplicationRunner
{
public
class
BoxReportCache
RefreshRunn
er
implements
ApplicationRunner
{
private
final
ReceivableService
receivableService
;
private
final
ReceivableMapper
receivableMapper
;
private
final
RedisHelper
redisHelper
;
@Override
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
log
.
info
(
"初始化应收报表缓存"
);
...
...
yudao-module-wealth/yudao-module-wealth-rest/src/main/java/cn/iocoder/yudao/module/wealth/controller/admin/receiptItem/ReceiptItemController.java
View file @
20a43543
...
...
@@ -74,7 +74,7 @@ public class ReceiptItemController {
@ApiOperation
(
"创建收款明细"
)
//@PreAuthorize("@ss.hasPermission('ecw:receipt-item:create')")
public
CommonResult
<
Long
>
createReceiptItem
(
@Valid
@RequestBody
ReceiptItemCreateReqVO
createReqVO
)
{
return
success
(
receiptItemService
.
createReceiptItem
(
createReqVO
));
return
success
(
receiptItemService
.
createReceiptItem
(
createReqVO
,
false
));
}
@PutMapping
(
"/update"
)
...
...
@@ -178,7 +178,8 @@ public class ReceiptItemController {
LambdaQueryWrapper
<
ReceiptItemDO
>
lambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
lambdaQueryWrapper
.
eq
(
ReceiptItemDO:
:
getReceiptId
,
id
);
lambdaQueryWrapper
.
eq
(
ReceiptItemDO:
:
getReceiptId
,
id
)
.
in
(
ReceiptItemDO:
:
getStatus
,
Arrays
.
asList
(
1
,
2
,
3
));
List
<
ReceiptItemDO
>
listItem
=
receiptItemMapper
.
selectList
(
lambdaQueryWrapper
);
...
...
yudao-module-wealth/yudao-module-wealth-rest/src/main/resources/mapper/ReceiptItem/BankReceiptDetailsMapper.xml
View file @
20a43543
...
...
@@ -89,6 +89,7 @@
SELECT
eri.id,
eri.receipt_id,
eri.account_id,
eri.account_no,
eri.account_name,
eri.account_bank_name,
...
...
@@ -102,8 +103,7 @@
INNER JOIN (SELECT receipt_id, order_id FROM ecw_receivable GROUP BY receipt_id, order_id) rb
ON rb.receipt_id = er.id
LEFT JOIN ecw_order eo ON eo.order_id = rb.order_id
LEFT JOIN ecw_bank_account eba ON eba.ba_account_num = eri.account_no
WHERE eri.status = 1
WHERE eri.status = 1 AND eri.account_id IS NOT NULL
<include
refid=
"incomePageCondition"
/>
GROUP BY eri.id
<!-- <if test="req.isAsc != null">-->
...
...
@@ -121,7 +121,7 @@
concat('%',#{req.relationNo},'%') OR eo.tidan_no = #{req.relationNo})
</if>
<if
test=
"req.platformAccountIds != null and req.platformAccountIds.size > 0"
>
AND er
a.platform_
account_id IN
AND er
i.
account_id IN
<foreach
collection=
"req.platformAccountIds"
item=
"platformAccountId"
open=
"("
separator=
","
close=
")"
>
#{platformAccountId}
</foreach>
...
...
@@ -148,7 +148,7 @@
SUM(amount) AS amount
FROM ecw_receipt_item
WHERE
account_
no = #{accountNo
} AND status = 1
account_
id = #{accountId
} AND status = 1
GROUP BY currency_id
</select>
<select
id=
"calculateCurrentAmount"
...
...
@@ -164,8 +164,7 @@
INNER JOIN (SELECT receipt_id, order_id FROM ecw_receivable GROUP BY receipt_id, order_id) rb
ON rb.receipt_id = er.id
LEFT JOIN ecw_order eo ON eo.order_id = rb.order_id
LEFT JOIN ecw_receipt_account era ON era.receipt_id = eri.receipt_id
WHERE eri.status = 1
WHERE eri.status = 1 AND eri.account_id IS NOT NULL
<include
refid=
"incomePageCondition"
/>
GROUP BY eri.id) AS t
GROUP BY t.currency_id
...
...
yudao-module-wealth/yudao-module-wealth-rest/src/main/resources/mapper/ReceiptItem/ReceiptItemMapper.xml
View file @
20a43543
...
...
@@ -108,7 +108,8 @@
SELECT
erwor.receivable_id,
erwor.income_belong,
SUM(erwor.receivable_write_off_amount) AS write_off_amount
IFNULL(SUM(erwor.receivable_write_off_amount), 0) AS write_off_amount,
IFNULL(SUM(erwor.write_off_amount), 0) AS write_off_base_amount
FROM ecw_receivable_write_off_record erwor
LEFT JOIN ecw_receipt_item eri ON erwor.receipt_item_id = eri.id
WHERE
...
...
yudao-module-wealth/yudao-module-wealth-rest/src/main/resources/mapper/receipt/ReceiptMapper.xml
View file @
20a43543
...
...
@@ -55,16 +55,19 @@
</select>
<select
id=
"countReceiptBackPage"
resultType=
"java.lang.Integer"
>
SELECT count(1)
FROM (
SELECT er.id
FROM ecw_receipt er
<if
test=
"query.numberNo != null and query.numberNo != ''"
>
INNER JOIN (SELECT receipt_id,order_id FROM ecw_receivable GROUP BY receipt_id, order_id ) AS rb ON rb.receipt_id = er.id
INNER JOIN (SELECT receipt_id,order_id FROM ecw_receivable GROUP BY receipt_id, order_id ) AS rb ON
rb.receipt_id = er.id
LEFT JOIN ecw_order o ON o.order_id=rb.order_id AND o.deleted=0
</if>
WHERE er.deleted = 0
<include
refid=
"pageCondition"
/>
<if
test=
"query.numberNo != null and query.numberNo != ''"
>
GROUP BY er.receipt_no
</if>
</if>
) AS t
</select>
<select
id=
"getReceiptItemPayat"
resultType=
"java.util.Date"
>
SELECT eri.amount_date
...
...
yudao-module-wealth/yudao-module-wealth-rest/src/main/resources/mapper/receivable/ReceivableMapper.xml
View file @
20a43543
...
...
@@ -453,18 +453,17 @@
eb.id,
eb.self_no,
eb.dg_date,
eb.qg_date,
eb.orderCount,
eb.ladingCount,
eb.dest_country_id,
ebs.sl_settled_time,
ebcn.ul_warehouse_time
ebc.cl_clear_time qg_date,
ebcu.ul_warehouse_time
FROM (
SELECT
box.id id,
box.self_no self_no,
box.dg_date dg_date,
box.qg_date qg_date,
box.dest_country_id dest_country_id,
box.start_warehouse_id start_warehouse_id,
box.dest_warehouse_id dest_warehouse_id,
...
...
@@ -481,42 +480,55 @@
<if
test=
"query.beginDaogangTime != null and query.endDaogangTime != null"
>
AND box.dg_date BETWEEN #{query.beginDaogangTime} AND #{query.endDaogangTime}
</if>
<if
test=
"query.beginQingguanTime != null and query.endQingguanTime != null"
>
AND box.qg_date BETWEEN #{query.beginQingguanTime} AND #{query.endQingguanTime}
</if>
<if
test=
"query.selfNo != null and query.selfNo != '' "
>
AND box.self_no LIKE concat('%',#{query.selfNo},'%')
</if>
<if
test=
"query.selfNoList != null and query.selfNoList.size() > 0"
>
AND box.self_no IN
<foreach
collection=
"query.selfNoList"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"query.startWarehouseIdList != null and query.startWarehouseIdList.size() > 0"
>
AND box.start_warehouse_id IN
<foreach
collection=
"query.startWarehouseIdList"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"query.destCountryId != null and query.destCountryId.size() > 0"
>
AND box.dest_country_id IN
<foreach
collection=
"query.destCountryId"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"query.destWarehouseIdList != null and query.destWarehouseIdList.size() > 0"
>
AND box.dest_warehouse_id IN
<foreach
collection=
"query.destWarehouseIdList"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"query.boxStatus != null"
>
AND box.shipment_status = #{query.boxStatus}
<if
test=
"query.boxStatus != null and query.boxStatus.size() > 0"
>
AND box.shipment_status IN
<foreach
collection=
"query.boxStatus"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"query.slStatus != null"
>
AND box.sl_status = #{query.slStatus}
</if>
) eb
LEFT JOIN ecw_box_cabinet_unload ebc
n ON eb.id = ebcn
.shipment_id
LEFT JOIN ecw_box_cabinet_unload ebc
u ON eb.id = ebcu
.shipment_id
LEFT JOIN ecw_box_settlement ebs ON eb.id = ebs.shipment_id
<if
test=
"query.beginUlWarehouseTime != null and query.endUlWarehouseTime != null"
>
LEFT JOIN ecw_box_clearance ebc ON eb.id = ebc.shipment_id
</if>
LEFT JOIN ecw_box_clearance ebc ON eb.id = ebc.shipment_id
WHERE 1 = 1
<if
test=
"query.beginJsDate != null and query.endJsDate != null"
>
AND ebs.sl_settled_time BETWEEN #{query.beginJsDate} AND #{query.endJsDate}
</if>
<if
test=
"query.beginQingguanTime != null and query.endQingguanTime != null"
>
AND ebc.cl_clear_time BETWEEN #{query.beginQingguanTime} AND #{query.endQingguanTime}
</if>
<if
test=
"query.beginUlWarehouseTime != null and query.endUlWarehouseTime != null"
>
AND ebc
.cl_clear
_time BETWEEN #{query.beginUlWarehouseTime} AND #{query.endUlWarehouseTime}
AND ebc
u.ul_warehouse
_time BETWEEN #{query.beginUlWarehouseTime} AND #{query.endUlWarehouseTime}
</if>
<if
test=
"query.ladingBillStatus != null"
>
<if
test=
"query.ladingBillStatus == 0"
>
...
...
@@ -570,4 +582,11 @@
<select
id=
"getAllBoxId"
resultType=
"java.lang.Long"
>
SELECT id FROM ecw_box WHERE deleted = 0 AND pr_status
>
21 AND dest_country_id > 0
</select>
<select
id=
"getDestWarehouseIdListByDestCity"
resultType=
"java.lang.Long"
>
SELECT id FROM ecw_warehouse WHERE deleted = 0
AND shi IN
<foreach
collection=
"destCity"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</select>
</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