fix: 首页日历功能完善,bug修复。

This commit is contained in:
tianyongbao
2024-08-02 11:32:10 +08:00
parent 4fe312a482
commit 5814d46a23
4 changed files with 129 additions and 8 deletions

View File

@@ -22,4 +22,6 @@ public class AccountCalendarVo
private String color;
private String textColor;
}

View File

@@ -48,4 +48,13 @@ public interface StatisticAnalysisMapper {
*/
@DataScope(businessAlias = "a")
public List<AccountCalendarVo> selectDailyExpensesByDate(AccountsDealRecordDto accountsDealRecordDto);
/**
* 查询工资收入
*
* @param accountsDealRecordDto
* @return 收支集合
*/
@DataScope(businessAlias = "a")
public List<AccountCalendarVo> selectSalaryByDate(AccountsDealRecordDto accountsDealRecordDto);
}

View File

@@ -2595,7 +2595,6 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
payDate.setStart(payDateStr);
payDate.setTitle(nameCode+ "还款日");
payDate.setType(2);
payDate.setColor("red");
list.add(payDate);
//周视图,月份不相同,下个月的也加入数据
if(!analysisDto.getStartTime().split("-")[1].equals(analysisDto.getEndTime().split("-")[1])&&analysisDto.getType().equals("2")){
@@ -2604,7 +2603,6 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
nextPayDate.setStart(nextPayDateStr);
nextPayDate.setTitle(nameCode+ "还款日");
nextPayDate.setType(2);
nextPayDate.setColor("red");
list.add(nextPayDate);
}
}
@@ -2621,7 +2619,6 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
billDate.setStart(billDateStr);
billDate.setTitle(nameCode+ "账单:"+creditCardBill.getBillAmount());
billDate.setType(1);
billDate.setColor("green");
list.add(billDate);
}
}
@@ -2640,12 +2637,10 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
if(detail.getPostingState().equals("0")){
historyDetail.setTitle(detail.getBankCardLendName()+ "贷款待还:"+detail.getCurrentAmount());
historyDetail.setType(3);
historyDetail.setColor("orange");
}
else {
historyDetail.setTitle(detail.getBankCardLendName()+ "贷款已还:"+detail.getCurrentAmount());
historyDetail.setType(4);
historyDetail.setColor("blue");
}
list.add(historyDetail);
@@ -2659,6 +2654,15 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
List<AccountCalendarVo> dailyExpensesList=statisticAnalysisMapper.selectDailyExpensesByDate(dto);
list.addAll(dailyExpensesList);
//工资收入统计
//获取数据
dto.setEndTime(analysisDto.getEndTime());
dto.setStartTime(analysisDto.getStartTime());
List<AccountCalendarVo> salaryList=statisticAnalysisMapper.selectSalaryByDate(dto);
list.addAll(salaryList);
AccountsDealRecordDto dealDto=new AccountsDealRecordDto();
//获取数据
dealDto.setEndTime(analysisDto.getEndTime());
@@ -2704,10 +2708,89 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
billDate.setType(6);
billDate.setColor("purple");
list.add(billDate);
}
Collections.sort(list, Comparator.comparing(AccountCalendarVo::getType).reversed());
AccountsTransferRecordDto posDto=new AccountsTransferRecordDto();
//获取数据
posDto.setEndTime(analysisDto.getEndTime());
posDto.setStartTime(analysisDto.getStartTime());
posDto.setType("1");
List<AccountsTransferRecordVo> transferList=accountsTransferRecordMapper.selectAccountsTransferRecordList(posDto);
//日列表
List <String> posTimeList=new ArrayList<>();
for (AccountsTransferRecordVo vo:transferList
) {
String dayString=sdf.format(vo.getCreateTime());
if(!posTimeList.contains(dayString)){
posTimeList.add(dayString);
}
}
for (String staticsTime :posTimeList
) {
double posAmount=0;
for (AccountsTransferRecordVo vo:transferList
) {
String dayString=sdf.format(vo.getCreateTime());
if(staticsTime.equals(dayString)){
posAmount+=vo.getAmount();
}
}
AccountCalendarVo billDate = new AccountCalendarVo();
billDate.setStart(staticsTime);
billDate.setTitle("POS机刷卡:"+posAmount);
billDate.setType(7);
list.add(billDate);
}
//统一设置事件背景色和字体颜色
// 1信用卡账单2还款日3贷款待还4贷款已还5日常支出6投资收益7POS机刷卡8工资收入
for (AccountCalendarVo calendar:list
) {
int type=calendar.getType();
switch(type){
case 1:
calendar.setColor("Khaki");
calendar.setTextColor("DeepPink");
break;
case 2:
calendar.setColor("LightCoral");
calendar.setTextColor("SpringGreen");
break;
case 3:
calendar.setColor("LightPink");
calendar.setTextColor("Magenta");
break;
case 4:
calendar.setColor("LightGreen");
calendar.setTextColor("RoyalBlue");
break;
case 5:
calendar.setColor("LemonChiffon");
calendar.setTextColor("MediumBlue");
break;
case 6:
calendar.setColor("LightBlue");
calendar.setTextColor("Crimson");
break;
case 7:
calendar.setColor("LavenderBlush");
calendar.setTextColor("Black");
break;
case 8:
calendar.setColor("Ivory");
calendar.setTextColor("Tomato");
break;
default:
calendar.setColor("White");
calendar.setTextColor("DarkViolet");
break;
}
}
return list;
}
}

View File

@@ -199,7 +199,34 @@
and a.deal_type = '2'
and a.deal_category = '1'
<if test="endTime!=null and endTime !=''">
and #{endTime}>to_char(a.create_time, 'yyyy-MM-dd')
and #{endTime}>=to_char(a.create_time, 'yyyy-MM-dd')
</if>
<if test="startTime!=null and startTime !=''">
and to_char(a.create_time, 'yyyy-MM-dd')>=#{startTime}
</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
group by
to_char(a.create_time,
'yyyy-MM-dd')
</select>
<select id="selectSalaryByDate" parameterType="AccountsDealRecordDto" resultMap="AccountCalendarResult">
select
to_char(a.create_time,
'yyyy-MM-dd') as start,
concat('工资收入:',
sum(a.amount)) as title,
8 as type
from
accounts_deal_record a
<where>
a.del_flag='0'
and a.deal_type = '1'
and a.deal_category = '11'
<if test="endTime!=null and endTime !=''">
and #{endTime}>=to_char(a.create_time, 'yyyy-MM-dd')
</if>
<if test="startTime!=null and startTime !=''">
and to_char(a.create_time, 'yyyy-MM-dd')>=#{startTime}