fix: 智聪记账管理,新增睡眠账户统计功能,优化展示余额。
This commit is contained in:
@@ -2,8 +2,11 @@ package com.intc.invest.controller;
|
||||
|
||||
import com.intc.common.core.web.controller.BaseController;
|
||||
import com.intc.common.core.web.domain.AjaxResult;
|
||||
import com.intc.common.core.web.page.TableDataInfo;
|
||||
import com.intc.invest.domain.dto.AccountsDto;
|
||||
import com.intc.invest.domain.dto.AnalysisDto;
|
||||
import com.intc.invest.domain.vo.AccountCalendarVo;
|
||||
import com.intc.invest.domain.vo.AccountsVo;
|
||||
import com.intc.invest.service.IStatisticAnalysisService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -170,6 +173,17 @@ public class StatisticAnalysisController extends BaseController {
|
||||
return AjaxResult.success(resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询睡眠账户统计列表
|
||||
*/
|
||||
@ApiOperation(value="查询睡眠账户统计列表",response = AccountsVo.class)
|
||||
@GetMapping("/sleepAccountsList")
|
||||
public TableDataInfo sleepAccountsList(AccountsDto accountsDto)
|
||||
{
|
||||
startPage();
|
||||
List<AccountsVo> list = iStatisticAnalysisService.selectAccountsList(accountsDto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.intc.invest.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.intc.invest.domain.Accounts;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 记账账户Vo对象 accounts
|
||||
*
|
||||
@@ -46,4 +50,12 @@ public class AccountsVo extends Accounts
|
||||
private String advicePosNames;
|
||||
|
||||
|
||||
/** 最新交易时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date recentDealTime;
|
||||
|
||||
@ApiModelProperty(value="距上次交易时间间隔")
|
||||
private String duration;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -95,4 +95,14 @@ public interface StatisticAnalysisMapper {
|
||||
@DataScope(businessAlias = "t")
|
||||
public List<AccountsDebitPosVo> selectPosStaticList(AccountsDto accountsDto);
|
||||
|
||||
/**
|
||||
* 查询记账账户列表
|
||||
*
|
||||
* @param accountsDto 记账账户
|
||||
* @return 记账账户集合
|
||||
*/
|
||||
@DataScope(businessAlias = "a")
|
||||
public List<AccountsVo> selectAccountsList(AccountsDto accountsDto);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.intc.invest.service;
|
||||
|
||||
import com.intc.invest.domain.dto.AccountsDto;
|
||||
import com.intc.invest.domain.dto.AnalysisDto;
|
||||
import com.intc.invest.domain.vo.AccountCalendarVo;
|
||||
import com.intc.invest.domain.vo.AccountsVo;
|
||||
import com.intc.invest.domain.vo.CreditReportAnalysisVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -53,4 +55,13 @@ public interface IStatisticAnalysisService {
|
||||
|
||||
public Map<String, Object> getPosStatics(AnalysisDto analysisDto);
|
||||
|
||||
/**
|
||||
* 查询睡眠账户列表
|
||||
*
|
||||
* @param accountsDto 记账账户
|
||||
* @return 记账账户集合
|
||||
*/
|
||||
public List<AccountsVo> selectAccountsList(AccountsDto accountsDto);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.intc.invest.service.IAccountsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -90,6 +91,11 @@ public class AccountsServiceImpl implements IAccountsService
|
||||
if(!"null".equals(String.valueOf(accounts.getPayDate()))) {
|
||||
accounts.setPayDateName(accounts.getPayDate()+"号");
|
||||
}
|
||||
String daysBetween="无交易记录";
|
||||
if(accounts.getRecentDealTime()!=null){
|
||||
daysBetween = DateUtils.timeDistance(new Date(),accounts.getRecentDealTime());
|
||||
}
|
||||
accounts.setDuration(daysBetween);
|
||||
}
|
||||
return accountsList;
|
||||
}
|
||||
|
||||
@@ -3230,4 +3230,58 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询记账账户列表
|
||||
*
|
||||
* @param accountsDto 记账账户
|
||||
* @return 记账账户
|
||||
*/
|
||||
@Override
|
||||
public List<AccountsVo> selectAccountsList(AccountsDto accountsDto)
|
||||
{
|
||||
List<AccountsVo> accountsList=statisticAnalysisMapper.selectAccountsList(accountsDto);
|
||||
//修改名称加卡号
|
||||
for (AccountsVo accounts : accountsList) {
|
||||
String typeName="";
|
||||
switch (accounts.getType()){
|
||||
case "1" :
|
||||
typeName="储蓄账户-";
|
||||
break;
|
||||
case "2" :
|
||||
typeName="信用卡账户-";
|
||||
break;
|
||||
case "3" :
|
||||
typeName="借贷账户-";
|
||||
break;
|
||||
case "5" :
|
||||
typeName="投资账户-";
|
||||
break;
|
||||
case "6" :
|
||||
typeName="POS机账户-";
|
||||
break;
|
||||
}
|
||||
if(accounts.getCode()!=null){
|
||||
accounts.setNameCodeAvailableLimit(accounts.getName()+"("+ StringUtils.getLastNumberChars(4,accounts.getCode()+")")+"-可用额度("+accounts.getAvailableLimit()+")");
|
||||
accounts.setTypeNameCodeAvailableLimit(typeName+accounts.getName()+"("+ StringUtils.getLastNumberChars(4,accounts.getCode()+")")+"-可用额度("+accounts.getAvailableLimit()+")");
|
||||
accounts.setNameCode(accounts.getName()+"("+ StringUtils.getLastNumberChars(4,accounts.getCode()+")"));
|
||||
}else {
|
||||
accounts.setNameCodeAvailableLimit(accounts.getName());
|
||||
accounts.setTypeNameCodeAvailableLimit(typeName+accounts.getName());
|
||||
accounts.setNameCode(accounts.getName());
|
||||
}
|
||||
if(!"null".equals(String.valueOf(accounts.getBillDate()))) {
|
||||
accounts.setBillDateName(accounts.getBillDate()+"号");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(accounts.getPayDate()))) {
|
||||
accounts.setPayDateName(accounts.getPayDate()+"号");
|
||||
}
|
||||
String daysBetween="无交易记录";
|
||||
if(accounts.getRecentDealTime()!=null){
|
||||
daysBetween = DateUtils.timeDistance(new Date(),accounts.getRecentDealTime());
|
||||
}
|
||||
accounts.setDuration(daysBetween);
|
||||
}
|
||||
return accountsList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="debitType" column="debit_type" />
|
||||
<result property="lendType" column="lend_type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="recentDealTime" column="recent_deal_time" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAccountsVo">
|
||||
@@ -50,7 +52,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
bcl.pay_date ,
|
||||
bcl.credit_limit ,
|
||||
bcl.debit_type,
|
||||
bcl.lend_type
|
||||
bcl.lend_type,
|
||||
(select create_time from accounts_deal_record adr where adr.account_id=a.account_id
|
||||
order by adr.create_time desc
|
||||
limit 1
|
||||
) as recent_deal_time
|
||||
from
|
||||
accounts a
|
||||
left join bank_card_lend bcl on
|
||||
@@ -68,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="state != null and state != ''"> and a.state = #{state}</if>
|
||||
<if test="status != null and status != ''"> and a.status = #{status}</if>
|
||||
<if test="accountId != null and accountId != ''"> and a.account_id = #{accountId}</if>
|
||||
<if test="repayFlag != null and repayFlag != ''"> and bcl.debit_type in('1','2')</if>
|
||||
<if test="repayFlag != null and repayFlag != ''"> and bcl.debit_type in('1','2') </if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
|
||||
@@ -798,5 +798,101 @@
|
||||
t.oneMonthCount desc
|
||||
|
||||
</select>
|
||||
<resultMap type="AccountsVo" id="AccountsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="type" column="type" />
|
||||
<result property="code" column="code" />
|
||||
<result property="balance" column="balance" />
|
||||
<result property="creditLimit" column="credit_limit" />
|
||||
<result property="availableLimit" column="available_limit" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="accountId" column="account_id" />
|
||||
<result property="state" column="state" />
|
||||
<result property="billDate" column="bill_date" />
|
||||
<result property="payDate" column="pay_date" />
|
||||
<result property="creditLimit" column="credit_limit" />
|
||||
<result property="debitType" column="debit_type" />
|
||||
<result property="lendType" column="lend_type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="recentDealTime" column="recent_deal_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAccountsList" parameterType="AccountsDto" resultMap="AccountsResult">
|
||||
select
|
||||
t.*
|
||||
from
|
||||
(
|
||||
select
|
||||
a.id,
|
||||
a.name,
|
||||
a.type,
|
||||
a.code,
|
||||
a.balance,
|
||||
a.credit_limit,
|
||||
a.available_limit,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.remark,
|
||||
a.account_id,
|
||||
a.state,
|
||||
a.status,
|
||||
bcl.bill_date ,
|
||||
bcl.pay_date ,
|
||||
bcl.credit_limit ,
|
||||
bcl.debit_type,
|
||||
bcl.lend_type,
|
||||
case
|
||||
when (
|
||||
select
|
||||
create_time
|
||||
from
|
||||
accounts_deal_record adr
|
||||
where
|
||||
adr.account_id = a.account_id
|
||||
order by
|
||||
adr.create_time desc
|
||||
limit 1
|
||||
) is null then a.create_time
|
||||
else
|
||||
(
|
||||
select
|
||||
create_time
|
||||
from
|
||||
accounts_deal_record adr
|
||||
where
|
||||
adr.account_id = a.account_id
|
||||
order by
|
||||
adr.create_time desc
|
||||
limit 1
|
||||
)
|
||||
end
|
||||
as recent_deal_time
|
||||
from
|
||||
accounts a
|
||||
left join bank_card_lend bcl on
|
||||
bcl.id = a.id
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
and ( a.type ='1')
|
||||
and( a.status != '2' and a.status != '0')
|
||||
<if test="name != null and name != ''">and a.name like '%'|| #{name}||'%'</if>
|
||||
<if test="accountId != null and accountId != ''"> and a.account_id = #{accountId}</if>
|
||||
<if test="repayFlag != null and repayFlag != ''"> and bcl.debit_type in('1','2') </if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
) t
|
||||
order by t.recent_deal_time asc
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user