给账户流水接口增加筛选条件

This commit is contained in:
jishenghua 2024-05-31 00:46:03 +08:00
parent cfc25b4f5e
commit 85a0b21960
4 changed files with 144 additions and 12 deletions

View File

@ -108,12 +108,17 @@ public class AccountController {
@RequestParam("pageSize") Integer pageSize,
@RequestParam("accountId") Long accountId,
@RequestParam("initialAmount") BigDecimal initialAmount,
@RequestParam(value = "number",required = false) String number,
@RequestParam(value = "beginTime",required = false) String beginTime,
@RequestParam(value = "endTime",required = false) String endTime,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<AccountVo4InOutList> dataList = accountService.findAccountInOutList(accountId, (currentPage-1)*pageSize, pageSize);
int total = accountService.findAccountInOutListCount(accountId);
List<AccountVo4InOutList> dataList = accountService.findAccountInOutList(accountId, StringUtil.toNull(number),
beginTime, endTime, (currentPage-1)*pageSize, pageSize);
int total = accountService.findAccountInOutListCount(accountId, StringUtil.toNull(number),
beginTime, endTime);
map.put("total", total);
//存放数据json数组
JSONArray dataArray = new JSONArray();
@ -122,11 +127,11 @@ public class AccountController {
for (AccountVo4InOutList aEx : dataList) {
String type = aEx.getType().replace("其它", "");
aEx.setType(type);
String endTime = aEx.getOperTime();
BigDecimal balance = accountService.getAccountSum(accountId, null, endTime, forceFlag)
.add(accountService.getAccountSumByHead(accountId, null, endTime, forceFlag))
.add(accountService.getAccountSumByDetail(accountId, null, endTime, forceFlag))
.add(accountService.getManyAccountSum(accountId, null, endTime, forceFlag)).add(initialAmount);
String operTime = aEx.getOperTime();
BigDecimal balance = accountService.getAccountSum(accountId, null, operTime, forceFlag)
.add(accountService.getAccountSumByHead(accountId, null, operTime, forceFlag))
.add(accountService.getAccountSumByDetail(accountId, null, operTime, forceFlag))
.add(accountService.getManyAccountSum(accountId, null, operTime, forceFlag)).add(initialAmount);
aEx.setBalance(balance);
aEx.setAccountId(accountId);
dataArray.add(aEx);

View File

@ -69,11 +69,17 @@ public interface AccountMapperEx {
List<AccountVo4InOutList> findAccountInOutList(
@Param("accountId") Long accountId,
@Param("number") String number,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
int findAccountInOutListCount(
@Param("accountId") Long accountId);
@Param("accountId") Long accountId,
@Param("number") String number,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime);
int batchDeleteAccountByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);

View File

@ -377,20 +377,21 @@ public class AccountService {
return accountSum;
}
public List<AccountVo4InOutList> findAccountInOutList(Long accountId, Integer offset, Integer rows) throws Exception{
public List<AccountVo4InOutList> findAccountInOutList(Long accountId, String number, String beginTime, String endTime,
Integer offset, Integer rows) throws Exception{
List<AccountVo4InOutList> list=null;
try{
list = accountMapperEx.findAccountInOutList(accountId, offset, rows);
list = accountMapperEx.findAccountInOutList(accountId, number, beginTime, endTime, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public int findAccountInOutListCount(Long accountId) throws Exception{
public int findAccountInOutListCount(Long accountId, String number, String beginTime, String endTime) throws Exception{
int result=0;
try{
result = accountMapperEx.findAccountInOutListCount(accountId);
result = accountMapperEx.findAccountInOutListCount(accountId, number, beginTime, endTime);
}catch(Exception e){
JshException.readFail(logger, e);
}

View File

@ -230,6 +230,16 @@
<if test="accountId != null">
and dh.account_id=#{accountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and dh.oper_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and dh.oper_time &lt;= #{endTime}
</if>
and ifnull(dh.change_amount, 0)!=0
and ifnull(dh.delete_flag,'0') !='1'
<!--主表收入和支出涉及的账户 -->
@ -240,6 +250,16 @@
<if test="accountId != null">
and ah.account_id=#{accountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and ah.bill_no like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and ah.bill_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and ah.bill_time &lt;= #{endTime}
</if>
and ifnull(ah.change_amount, 0)!=0
and ifnull(ah.delete_flag,'0') !='1'
<!--明细中涉及的账户(收款,付款,收预付款) -->
@ -251,6 +271,16 @@
<if test="accountId != null">
and ai.account_id=#{accountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and ah.bill_no like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and ah.bill_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and ah.bill_time &lt;= #{endTime}
</if>
and ifnull(ai.each_amount, 0)!=0
and ifnull(ah.delete_flag,'0') !='1'
<!--主表中转出的账户 -->
@ -261,6 +291,16 @@
<if test="accountId != null">
and ah.account_id=#{accountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and ah.bill_no like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and ah.bill_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and ah.bill_time &lt;= #{endTime}
</if>
and ifnull(ah.change_amount, 0)!=0
and ifnull(ah.delete_flag,'0') !='1'
<!--明细中被转入的账户 -->
@ -271,6 +311,16 @@
<if test="accountId != null">
and ai.account_id=#{accountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and ah.bill_no like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and ah.bill_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and ah.bill_time &lt;= #{endTime}
</if>
and ifnull(ai.each_amount, 0)!=0
and ifnull(ah.delete_flag,'0') !='1'
<!--多账户的情况 -->
@ -283,6 +333,16 @@
<bind name="bindAccountId" value="'%'+accountId+'%'"/>
and dh.account_id_list like #{bindAccountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and dh.oper_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and dh.oper_time &lt;= #{endTime}
</if>
and ifnull(dh.change_amount, 0)!=0
and ifnull(dh.delete_flag,'0') !='1'
ORDER BY oTime desc
@ -301,6 +361,16 @@
<if test="accountId != null">
and dh.account_id=#{accountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and dh.oper_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and dh.oper_time &lt;= #{endTime}
</if>
and ifnull(dh.change_amount, 0)!=0
and ifnull(dh.delete_flag,'0') !='1'
<!--主表收入和支出涉及的账户 -->
@ -311,6 +381,16 @@
<if test="accountId != null">
and ah.account_id=#{accountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and ah.bill_no like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and ah.bill_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and ah.bill_time &lt;= #{endTime}
</if>
and ifnull(ah.change_amount, 0)!=0
and ifnull(ah.delete_flag,'0') !='1'
<!--明细中涉及的账户(收款,付款,收预付款) -->
@ -322,6 +402,16 @@
<if test="accountId != null">
and ai.account_id=#{accountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and ah.bill_no like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and ah.bill_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and ah.bill_time &lt;= #{endTime}
</if>
and ifnull(ai.each_amount, 0)!=0
and ifnull(ah.delete_flag,'0') !='1'
<!--主表中转出的账户 -->
@ -332,6 +422,16 @@
<if test="accountId != null">
and ah.account_id=#{accountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and ah.bill_no like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and ah.bill_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and ah.bill_time &lt;= #{endTime}
</if>
and ifnull(ah.change_amount, 0)!=0
and ifnull(ah.delete_flag,'0') !='1'
<!--明细中被转入的账户 -->
@ -342,6 +442,16 @@
<if test="accountId != null">
and ai.account_id=#{accountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and ah.bill_no like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and ah.bill_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and ah.bill_time &lt;= #{endTime}
</if>
and ifnull(ai.each_amount, 0)!=0
and ifnull(ah.delete_flag,'0') !='1'
<!--多账户的情况 -->
@ -353,6 +463,16 @@
<bind name="bindAccountId" value="'%'+accountId+'%'"/>
and dh.account_id_list like #{bindAccountId}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and dh.oper_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and dh.oper_time &lt;= #{endTime}
</if>
and ifnull(dh.change_amount, 0)!=0
and ifnull(dh.delete_flag,'0') !='1'
) cc