feat: 首页日历功能新增。
This commit is contained in:
@@ -3,6 +3,7 @@ package com.ruoyi.invest.controller;
|
|||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
import com.ruoyi.invest.domain.dto.AnalysisDto;
|
import com.ruoyi.invest.domain.dto.AnalysisDto;
|
||||||
|
import com.ruoyi.invest.domain.vo.AccountCalendarVo;
|
||||||
import com.ruoyi.invest.service.IStatisticAnalysisService;
|
import com.ruoyi.invest.service.IStatisticAnalysisService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,6 +27,15 @@ public class StatisticAnalysisController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IStatisticAnalysisService iStatisticAnalysisService;
|
private IStatisticAnalysisService iStatisticAnalysisService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("首页-日历数据信息")
|
||||||
|
@GetMapping("/getAccountCalendarInfo")
|
||||||
|
public AjaxResult getAccountCalendarInfo(AnalysisDto analysisDto){
|
||||||
|
List<AccountCalendarVo> list = iStatisticAnalysisService.getAccountCalendarInfo(analysisDto);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("账户总览-POS机信息")
|
@ApiOperation("账户总览-POS机信息")
|
||||||
@GetMapping("/getPosAccountsInfo")
|
@GetMapping("/getPosAccountsInfo")
|
||||||
public Map<String,Object> getPosAccountsInfo(){
|
public Map<String,Object> getPosAccountsInfo(){
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.invest.domain.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记账账户Vo对象 accounts
|
||||||
|
*
|
||||||
|
* @author tianyongbao
|
||||||
|
* @date 2024-08-01
|
||||||
|
*/
|
||||||
|
@ApiModel("首页日历Vo对象")
|
||||||
|
@Data
|
||||||
|
public class AccountCalendarVo
|
||||||
|
{
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
private String start;
|
||||||
|
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.ruoyi.invest.mapper;
|
|||||||
import com.ruoyi.common.datascope.annotation.DataScope;
|
import com.ruoyi.common.datascope.annotation.DataScope;
|
||||||
import com.ruoyi.invest.domain.dto.AccountsDealRecordDto;
|
import com.ruoyi.invest.domain.dto.AccountsDealRecordDto;
|
||||||
import com.ruoyi.invest.domain.dto.BankCardLendDto;
|
import com.ruoyi.invest.domain.dto.BankCardLendDto;
|
||||||
|
import com.ruoyi.invest.domain.vo.AccountCalendarVo;
|
||||||
import com.ruoyi.invest.domain.vo.AccountsDealRecordVo;
|
import com.ruoyi.invest.domain.vo.AccountsDealRecordVo;
|
||||||
import com.ruoyi.invest.domain.vo.BankCardLendVo;
|
import com.ruoyi.invest.domain.vo.BankCardLendVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@@ -38,4 +39,13 @@ public interface StatisticAnalysisMapper {
|
|||||||
*/
|
*/
|
||||||
@DataScope(businessAlias = "a")
|
@DataScope(businessAlias = "a")
|
||||||
public List<AccountsDealRecordVo> selectDailyExpensesList(AccountsDealRecordDto accountsDealRecordDto);
|
public List<AccountsDealRecordVo> selectDailyExpensesList(AccountsDealRecordDto accountsDealRecordDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询日常支出
|
||||||
|
*
|
||||||
|
* @param accountsDealRecordDto
|
||||||
|
* @return 收支集合
|
||||||
|
*/
|
||||||
|
@DataScope(businessAlias = "a")
|
||||||
|
public List<AccountCalendarVo> selectDailyExpensesByDate(AccountsDealRecordDto accountsDealRecordDto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
package com.ruoyi.invest.service;
|
package com.ruoyi.invest.service;
|
||||||
|
|
||||||
import com.ruoyi.invest.domain.dto.AnalysisDto;
|
import com.ruoyi.invest.domain.dto.AnalysisDto;
|
||||||
|
import com.ruoyi.invest.domain.vo.AccountCalendarVo;
|
||||||
import com.ruoyi.invest.domain.vo.CreditReportAnalysisVO;
|
import com.ruoyi.invest.domain.vo.CreditReportAnalysisVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 22077662
|
* @author 22077662
|
||||||
*/
|
*/
|
||||||
public interface IStatisticAnalysisService {
|
public interface IStatisticAnalysisService {
|
||||||
|
public List<AccountCalendarVo> getAccountCalendarInfo(AnalysisDto analysisDto);
|
||||||
|
|
||||||
public Map<String, Object> getPosAccountsInfo();
|
public Map<String, Object> getPosAccountsInfo();
|
||||||
|
|
||||||
public Map<String, Object> getCreditAccountsInfo();
|
public Map<String, Object> getCreditAccountsInfo();
|
||||||
|
|||||||
@@ -2577,4 +2577,137 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
|||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AccountCalendarVo> getAccountCalendarInfo (AnalysisDto analysisDto) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 设置日期格式
|
||||||
|
List<AccountCalendarVo> list =new ArrayList<>();
|
||||||
|
BankCardLendDto bankCardLendDto=new BankCardLendDto();
|
||||||
|
bankCardLendDto.setType("2");
|
||||||
|
bankCardLendDto.setStatus("1");
|
||||||
|
List<BankCardLendVo> bankCardVoList=bankCardLendMapper.selectBankCardLendList(bankCardLendDto);
|
||||||
|
for (BankCardLendVo bankCard : bankCardVoList) {
|
||||||
|
String nameCode=bankCard.getName()+"("+ StringUtils.getLastNumberChars(4,bankCard.getCode()+")");
|
||||||
|
|
||||||
|
String payDateStr = analysisDto.getStartTime().split("-")[0] + "-" +analysisDto.getStartTime().split("-")[1] + "-" + String.format("%02d", bankCard.getPayDate());
|
||||||
|
AccountCalendarVo payDate = new AccountCalendarVo();
|
||||||
|
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")){
|
||||||
|
String nextPayDateStr = analysisDto.getStartTime().split("-")[0] + "-" +analysisDto.getEndTime().split("-")[1] + "-" + String.format("%02d", bankCard.getPayDate());
|
||||||
|
AccountCalendarVo nextPayDate = new AccountCalendarVo();
|
||||||
|
nextPayDate.setStart(nextPayDateStr);
|
||||||
|
nextPayDate.setTitle(nameCode+ "还款日");
|
||||||
|
nextPayDate.setType(2);
|
||||||
|
nextPayDate.setColor("red");
|
||||||
|
list.add(nextPayDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CreditCardBillDto creditCardBillDto =new CreditCardBillDto();
|
||||||
|
creditCardBillDto.setStartMonth(analysisDto.getStartTime().split("-")[0] + "-" + analysisDto.getStartTime().split("-")[1]);
|
||||||
|
creditCardBillDto.setEndMonth(analysisDto.getEndTime().split("-")[0] + "-" + analysisDto.getEndTime().split("-")[1]);
|
||||||
|
List<CreditCardBillVo> creditCardBillList=creditCardBillMapper.selectCreditCardBillList(creditCardBillDto);
|
||||||
|
//修改名称加卡号
|
||||||
|
for (CreditCardBillVo creditCardBill : creditCardBillList) {
|
||||||
|
String nameCode=creditCardBill.getBankName()+"("+ StringUtils.getLastNumberChars(4,creditCardBill.getBankCode()+")");
|
||||||
|
if(creditCardBill.getBankName()!=null){
|
||||||
|
String billDateStr = sdf.format(creditCardBill.getBillDate());
|
||||||
|
AccountCalendarVo billDate = new AccountCalendarVo();
|
||||||
|
billDate.setStart(billDateStr);
|
||||||
|
billDate.setTitle(nameCode+ "账单:"+creditCardBill.getBillAmount());
|
||||||
|
billDate.setType(1);
|
||||||
|
billDate.setColor("green");
|
||||||
|
list.add(billDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InstallmentHistoryDetailDto detailDto=new InstallmentHistoryDetailDto();
|
||||||
|
detailDto.setStartDate(analysisDto.getStartTime());
|
||||||
|
detailDto.setEndDate(analysisDto.getEndTime());
|
||||||
|
detailDto.setType("3");
|
||||||
|
List<InstallmentHistoryDetailVo> detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
|
||||||
|
for (InstallmentHistoryDetailVo detail : detailList) {
|
||||||
|
|
||||||
|
if(detail.getBankCardLendName()!=null){
|
||||||
|
String billDateStr = sdf.format(detail.getRepaymentDate());
|
||||||
|
AccountCalendarVo historyDetail = new AccountCalendarVo();
|
||||||
|
historyDetail.setStart(billDateStr);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//日常支出统计
|
||||||
|
AccountsDealRecordDto dto=new AccountsDealRecordDto();
|
||||||
|
//获取数据
|
||||||
|
dto.setEndTime(analysisDto.getEndTime());
|
||||||
|
dto.setStartTime(analysisDto.getStartTime());
|
||||||
|
List<AccountCalendarVo> dailyExpensesList=statisticAnalysisMapper.selectDailyExpensesByDate(dto);
|
||||||
|
list.addAll(dailyExpensesList);
|
||||||
|
|
||||||
|
AccountsDealRecordDto dealDto=new AccountsDealRecordDto();
|
||||||
|
//获取数据
|
||||||
|
dealDto.setEndTime(analysisDto.getEndTime());
|
||||||
|
dealDto.setStartTime(analysisDto.getStartTime());
|
||||||
|
dealDto.setType("5");
|
||||||
|
dealDto.setDealCategory("2");
|
||||||
|
List<AccountsDealRecordVo> accountsDealRecordVoList=accountsDealRecordMapper.selectAccountsDealRecordList(dealDto);
|
||||||
|
//日列表
|
||||||
|
List <String> staticsTimeList=new ArrayList<>();
|
||||||
|
for (AccountsDealRecordVo vo:accountsDealRecordVoList
|
||||||
|
) {
|
||||||
|
String dayString=sdf.format(vo.getCreateTime());
|
||||||
|
|
||||||
|
if(!staticsTimeList.contains(dayString)){
|
||||||
|
staticsTimeList.add(dayString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String staticsTime :staticsTimeList
|
||||||
|
) {
|
||||||
|
double investAmount=0;
|
||||||
|
for (AccountsDealRecordVo vo:accountsDealRecordVoList
|
||||||
|
) {
|
||||||
|
String dayString=sdf.format(vo.getCreateTime());
|
||||||
|
|
||||||
|
if(staticsTime.equals(dayString)){
|
||||||
|
if(vo.getDealType().equals("1")){
|
||||||
|
if(vo.getDealCategory().equals("2")){
|
||||||
|
investAmount+=vo.getAmount();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(vo.getDealType().equals("2")){
|
||||||
|
if(vo.getDealCategory().equals("2")){
|
||||||
|
investAmount-=vo.getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AccountCalendarVo billDate = new AccountCalendarVo();
|
||||||
|
billDate.setStart(staticsTime);
|
||||||
|
billDate.setTitle("投资收益:"+investAmount);
|
||||||
|
billDate.setType(6);
|
||||||
|
billDate.setColor("purple");
|
||||||
|
list.add(billDate);
|
||||||
|
|
||||||
|
}
|
||||||
|
Collections.sort(list, Comparator.comparing(AccountCalendarVo::getType).reversed());
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,8 @@
|
|||||||
from
|
from
|
||||||
accounts_deal_record a
|
accounts_deal_record a
|
||||||
<where>
|
<where>
|
||||||
a.deal_category = '1'
|
a.del_flag='0'
|
||||||
|
and a.deal_category = '1'
|
||||||
<if test="endTime!=null and endTime !=''">
|
<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>
|
||||||
@@ -175,4 +176,39 @@
|
|||||||
a.child_category
|
a.child_category
|
||||||
order by sum(a.amount) desc
|
order by sum(a.amount) desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<resultMap type="AccountCalendarVo" id="AccountCalendarResult">
|
||||||
|
<result property="title" column="title" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="start" column="start" />
|
||||||
|
<result property="color" column="color" />
|
||||||
|
|
||||||
|
</resultMap>
|
||||||
|
<select id="selectDailyExpensesByDate" parameterType="AccountsDealRecordDto" resultMap="AccountCalendarResult">
|
||||||
|
select
|
||||||
|
to_char(a.create_time,
|
||||||
|
'yyyy-MM-dd') as start,
|
||||||
|
concat('日常支出:',
|
||||||
|
sum(a.amount)) as title,
|
||||||
|
'magenta' as color,
|
||||||
|
5 as type
|
||||||
|
from
|
||||||
|
accounts_deal_record a
|
||||||
|
<where>
|
||||||
|
a.del_flag='0'
|
||||||
|
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')
|
||||||
|
</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>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user