feat: 智聪记账管理,新增储蓄卡开卡统计功能代码提交。

This commit is contained in:
tianyongbao
2025-03-05 09:36:28 +08:00
parent 475a29743c
commit 233d2b283f
8 changed files with 315 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ 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.OpenCardVo;
import com.intc.invest.service.IStatisticAnalysisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -185,7 +186,15 @@ public class StatisticAnalysisController extends BaseController {
return getDataTable(list);
}
/**
* 查询储蓄卡开卡统计数据
*/
@ApiOperation(value="查询储蓄卡开卡统计数据",response = OpenCardVo.class)
@GetMapping("/openCardList")
public Map<String,Object> selectOpenCardList(AnalysisDto analysisDto)
{
Map<String, Object> resultMap = iStatisticAnalysisService.selectOpenCardList(analysisDto);
return AjaxResult.success(resultMap);
}
}

View File

@@ -50,4 +50,15 @@ public class BankCardLendDto extends BaseEntity implements Serializable
@ApiModelProperty(value="还款账户flag")
private String repayFlag;
private String staticFlag;
/** 结束月份 */
@ApiModelProperty(value="结束月份")
private String endMonth;
/** 开始月份 */
@ApiModelProperty(value="开始月份")
private String startMonth;
}

View File

@@ -0,0 +1,22 @@
package com.intc.invest.domain.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
*
* @author tianyongbao
* @date 2025-03-04
*/
@ApiModel("开卡数据Vo对象")
@Data
public class OpenCardVo
{
private String type;
private String name;
private Integer count;
}

View File

@@ -105,4 +105,12 @@ public interface StatisticAnalysisMapper {
public List<AccountsVo> selectAccountsList(AccountsDto accountsDto);
/**
* 查询储蓄卡开卡统计数据
*
* @return 储蓄卡信息集合
*/
@DataScope(businessAlias = "t")
public List<OpenCardVo> selectOpenCardList(AccountsDto accountsDto);
}

View File

@@ -63,5 +63,12 @@ public interface IStatisticAnalysisService {
*/
public List<AccountsVo> selectAccountsList(AccountsDto accountsDto);
/**
* 查询储蓄卡开卡统计数据
*
* @return 记账账户集合
*/
public Map<String, Object> selectOpenCardList(AnalysisDto analysisDto);
}

View File

@@ -3284,4 +3284,150 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
}
return accountsList;
}
@Override
public Map<String, Object> selectOpenCardList(AnalysisDto analysisDto) {
//返回数据
HashMap<String, Object> map = new HashMap<>();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//月查询
if(analysisDto.getType().equals("2")){
if(StringUtils.isEmpty(analysisDto.getStartTime())&&StringUtils.isEmpty(analysisDto.getEndTime())){
String endTime=dateFormat.format(DateUtils.addMonths(DateUtils.getNowDate(),-1));
String startTime=dateFormat.format(DateUtils.addMonths(DateUtils.getNowDate(),-2400));
analysisDto.setStartTime(startTime);
analysisDto.setEndTime(endTime);
}else {
analysisDto.setStartTime(analysisDto.getStartTime()+"-01");
analysisDto.setEndTime(analysisDto.getEndTime()+"-31");
}
//年查询
}else if(analysisDto.getType().equals("3")){
if(StringUtils.isEmpty(analysisDto.getStartTime())&&StringUtils.isEmpty(analysisDto.getEndTime())){
String endTime=dateFormat.format(DateUtils.getNowDate());
String startTime=dateFormat.format(DateUtils.addYears(DateUtils.getNowDate(),-500));
analysisDto.setStartTime(startTime);
analysisDto.setEndTime(endTime);
}else {
analysisDto.setStartTime(analysisDto.getStartTime()+"-01-01");
analysisDto.setEndTime(analysisDto.getEndTime()+"-12-31");
}
}
DecimalFormat decimalFormat = new DecimalFormat("#.##");
//获取数据
List<BankCardLendVo> bankCardLendVoList=new ArrayList<>();
BankCardLendDto bankCardLendDto=new BankCardLendDto();
bankCardLendDto.setStartMonth(analysisDto.getStartTime().substring(0,7));
bankCardLendDto.setEndMonth(analysisDto.getEndTime().substring(0,7));
//只统计一类卡和二类卡
bankCardLendDto.setStaticFlag("1");
bankCardLendVoList=bankCardLendMapper.selectBankCardLendList(bankCardLendDto);
//修改名称加卡号
for (BankCardLendVo vo : bankCardLendVoList) {
if(vo.getCode()!=null){
vo.setNameCode(vo.getName()+""+ vo.getCode()+"");
}else {
vo.setNameCode(vo.getName());
}
}
List<BankCardLendVo> debietList=new ArrayList<>();
if("2".equals(analysisDto.getType())){
//月列表
List <String> staticsTimeList=new ArrayList<>();
for (BankCardLendVo vo:bankCardLendVoList
) {
String monthString=dateFormat.format(vo.getActivationDate()).substring(0,7);
if(!staticsTimeList.contains(monthString)){
staticsTimeList.add(monthString);
}
}
for (String staticsTime :staticsTimeList
) {
String details="";
int actualCreditBillMonth=0;
for (BankCardLendVo vo:bankCardLendVoList
) {
String monthString=dateFormat.format(vo.getActivationDate()).substring(0,7);
if(staticsTime.equals(monthString)){
actualCreditBillMonth++;
details+=vo.getNameCode()+""+dateFormat.format(vo.getActivationDate())+""+vo.getOpeningBank()+" 开户;<br/>";
}
}
BankCardLendVo analysisVo=new BankCardLendVo();
analysisVo.setName(actualCreditBillMonth+"");
analysisVo.setCode(staticsTime);
analysisVo.setRemark(details);
debietList.add(analysisVo);
}
//年查询
}else if("3".equals(analysisDto.getType())){
//月列表
List <String> staticsTimeList=new ArrayList<>();
for (BankCardLendVo vo:bankCardLendVoList
) {
String monthString=dateFormat.format(vo.getActivationDate()).substring(0,4);
if(!staticsTimeList.contains(monthString)){
staticsTimeList.add(monthString);
}
}
for (String staticsTime :staticsTimeList
) {
String details="";
int actualCreditBillMonth=0;
for (BankCardLendVo vo:bankCardLendVoList
) {
String monthString=dateFormat.format(vo.getActivationDate()).substring(0,4);
if(staticsTime.equals(monthString)){
actualCreditBillMonth++;
details+=vo.getNameCode()+""+dateFormat.format(vo.getActivationDate())+""+vo.getOpeningBank()+" 开户;<br/>";
}
}
BankCardLendVo analysisVo=new BankCardLendVo();
analysisVo.setName(actualCreditBillMonth+"");
analysisVo.setCode(staticsTime);
analysisVo.setRemark(details);
debietList.add(analysisVo);
}
}
ArrayList<Map<String, Object>> debitList = new ArrayList<>();
ArrayList<Map<String, Object>> tableDebitList = new ArrayList<>();
for (BankCardLendVo bankCardLendVo:debietList
) {
Map<String, Object> datamap = new HashMap<>();
datamap.put("time", bankCardLendVo.getCode());
datamap.put("detail", bankCardLendVo.getRemark());
datamap.put("value", bankCardLendVo.getName());
tableDebitList.add(datamap);
}
Collections.reverse(debietList);
for (BankCardLendVo bankCardLendVo:debietList
) {
Map<String, Object> datamap = new HashMap<>();
datamap.put("time", bankCardLendVo.getCode());
datamap.put("value", bankCardLendVo.getName());
debitList.add(datamap);
}
List<OpenCardVo> accountsList=statisticAnalysisMapper.selectOpenCardList(new AccountsDto());
//列表
map.put("accountsList",accountsList);
map.put("debitList",debitList);
map.put("tableDebitList",tableDebitList);
return map;
}
}

View File

@@ -77,10 +77,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="lendType != null and lendType != ''"> and a.lend_type = #{lendType}</if>
<if test="status != null and status != ''"> and a.status = #{status}</if>
<if test="repayFlag != null and repayFlag != ''"> and a.debit_type in('1','2','3')</if>
<if test="staticFlag != null and staticFlag != ''"> and ( a.debit_type in('1','2') and a.status!='2') </if>
<if test="startMonth!=null and startMonth !=''">
and to_char(a.activation_date, 'yyyy-MM')>=#{startMonth}
</if>
<if test="endMonth!=null and endMonth !=''">
and #{endMonth}>=to_char(a.activation_date, 'yyyy-MM')
</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
order by a.type asc, a.bill_date asc,a.debit_type asc,a.update_time desc
<if test="staticFlag != null and staticFlag != ''">
order by a.activation_date desc
</if>
<if test="staticFlag == null or staticFlag == ''">
order by a.type asc, a.bill_date asc,a.debit_type asc,a.update_time desc
</if>
</select>
<select id="selectBankCardLendById" parameterType="Long" resultMap="BankCardLendResult">

View File

@@ -894,5 +894,101 @@
order by t.recent_deal_time asc
</select>
<select id="selectOpenCardList" resultType="com.intc.invest.domain.vo.OpenCardVo">
select
t.count,
t.name,
t.type,
t.create_by as createBy
from
(
select
count(*) as count,
bcl.create_by,
'近一月开卡' as name ,
'0' as type
from
bank_card_lend bcl
where
bcl."type" = '1'
and (bcl.debit_type = '1'
or bcl.debit_type = '2')
and bcl.del_flag = '0'
and bcl.status!='2'
and bcl.activation_date >= CURRENT_DATE - interval '1 months'
group by
bcl.create_by
union
select
count(*) as count,
bcl.create_by,
'近三月开卡' as name ,
'1' as type
from
bank_card_lend bcl
where
bcl."type" = '1'
and (bcl.debit_type = '1'
or bcl.debit_type = '2')
and bcl.del_flag = '0'
and bcl.status!='2'
and bcl.activation_date >= CURRENT_DATE - interval '3 months'
group by
bcl.create_by
union
select
count(*) as count,
bcl.create_by,
'近半年开卡' as name ,
'2' as type
from
bank_card_lend bcl
where
bcl."type" = '1'
and (bcl.debit_type = '1'
or bcl.debit_type = '2')
and bcl.del_flag = '0'
and bcl.status!='2'
and bcl.activation_date >= CURRENT_DATE - interval '6 months'
group by
bcl.create_by
union
select
count(*) as count,
bcl.create_by,
'近一年开卡' as name ,
'3' as type
from
bank_card_lend bcl
where
bcl."type" = '1'
and (bcl.debit_type = '1'
or bcl.debit_type = '2')
and bcl.del_flag = '0'
and bcl.status!='2'
and bcl.activation_date >= CURRENT_DATE - interval '1 years'
group by
bcl.create_by
union
select
count(*) as count,
bcl.create_by,
'总开卡' as name ,
'5' as type
from
bank_card_lend bcl
where
bcl."type" = '1'
and (bcl.debit_type = '1'
or bcl.debit_type = '2')
and bcl.del_flag = '0'
and bcl.status!='2'
group by
bcl.create_by) t
order by
t.type
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
</mapper>