home
This commit is contained in:
parent
2fa8673bb7
commit
a7951c1c0d
@ -57,7 +57,16 @@ public class HomeController extends BaseController {
|
||||
public R<ReturnAmountVo> returnMoney(@RequestParam() Integer type) {
|
||||
return R.ok(homeService.returnMoney(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页大盘数据:各渠道成交
|
||||
* @param type 1本月 2上月 3本季度 4本年 5所有
|
||||
* @return
|
||||
*/
|
||||
@SaCheckPermission("business:salary:list")
|
||||
@GetMapping("/byChannel")
|
||||
public R<ReturnAmountVo> byChannel(@RequestParam() Integer type) {
|
||||
return R.ok(homeService.byChannel(type));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class ChannelAmountVo {
|
||||
|
||||
/**
|
||||
* 当前时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date currentDate = new Date();
|
||||
/**
|
||||
* 统计范围
|
||||
*/
|
||||
private String dateStr;
|
||||
/**
|
||||
* 成交总金额
|
||||
*/
|
||||
private BigDecimal all;
|
||||
|
||||
/**
|
||||
* 各渠道成交金额
|
||||
*/
|
||||
private Map<String,DataAmountVo> one;
|
||||
|
||||
|
||||
public void cellPer(){
|
||||
//计算总金额
|
||||
this.all = this.all == null? BigDecimal.ZERO: this.all;
|
||||
for (String str : one.keySet()){
|
||||
all = all.add(one.get(str).getMoney());
|
||||
}
|
||||
//计算占比
|
||||
if(0 == this.all.compareTo(BigDecimal.ZERO)) {
|
||||
one.forEach((k,v)->{v.setPer("0%");});
|
||||
}else {
|
||||
one.forEach((k,v)->{v.setPer(v.getMoney().multiply(new BigDecimal("100.0")).divide(this.all,2, RoundingMode.HALF_UP).toPlainString()+"%");});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class DataAmountVo {
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private String per;
|
||||
/**
|
||||
* 合同数量
|
||||
*/
|
||||
private String num;
|
||||
/**
|
||||
* 合同金额
|
||||
*/
|
||||
private BigDecimal money;
|
||||
/**
|
||||
* 已回款金额
|
||||
*/
|
||||
private BigDecimal payMoney;
|
||||
/**
|
||||
* 未回款金额
|
||||
*/
|
||||
private BigDecimal unPayMoney;
|
||||
}
|
@ -26,11 +26,11 @@ public class MakeAmountVo {
|
||||
/**
|
||||
* 新签合同信息
|
||||
*/
|
||||
private TypeAmountVo newInfo = new TypeAmountVo();
|
||||
private DataAmountVo newInfo = new DataAmountVo();
|
||||
/**
|
||||
* 续签合同信息
|
||||
*/
|
||||
private TypeAmountVo renewInfo = new TypeAmountVo();
|
||||
private DataAmountVo renewInfo = new DataAmountVo();
|
||||
|
||||
public void cellPer(){
|
||||
if(0 == this.all.compareTo(BigDecimal.ZERO)) {
|
||||
@ -41,28 +41,5 @@ public class MakeAmountVo {
|
||||
this.renewInfo.setPer(this.renewInfo.getMoney().multiply(new BigDecimal("100.0")).divide(this.all,2, RoundingMode.HALF_UP).toPlainString()+"%");
|
||||
}
|
||||
}
|
||||
@Data
|
||||
public static class TypeAmountVo{
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private String per;
|
||||
/**
|
||||
* 合同数量
|
||||
*/
|
||||
private String num;
|
||||
/**
|
||||
* 合同金额
|
||||
*/
|
||||
private BigDecimal money;
|
||||
/**
|
||||
* 已回款金额
|
||||
*/
|
||||
private BigDecimal payMoney;
|
||||
/**
|
||||
* 未回款金额
|
||||
*/
|
||||
private BigDecimal unPayMoney;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,4 +11,11 @@ public interface HomeService {
|
||||
MakeAmountVo selectMakeAmount(Integer type);
|
||||
|
||||
ReturnAmountVo returnMoney(Integer type);
|
||||
|
||||
/**
|
||||
* 首页大盘数据:各渠道成交
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
ReturnAmountVo byChannel(Integer type);
|
||||
}
|
||||
|
@ -6,7 +6,9 @@ import com.pusong.business.domain.PsContractInfo;
|
||||
import com.pusong.business.domain.PsContractPay;
|
||||
import com.pusong.business.domain.vo.home.MakeAmountVo;
|
||||
import com.pusong.business.domain.vo.home.ReturnAmountVo;
|
||||
import com.pusong.business.domain.vo.home.DataAmountVo;
|
||||
import com.pusong.business.enums.CommonStatusEnum;
|
||||
import com.pusong.business.enums.ContractStatusEnum;
|
||||
import com.pusong.business.enums.PayStatusEnum;
|
||||
import com.pusong.business.mapper.PsContractInfoMapper;
|
||||
import com.pusong.business.mapper.PsContractPayMapper;
|
||||
@ -19,7 +21,6 @@ import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@ -50,6 +51,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
List<PsContractInfo> list = psContractInfoMapper.selectList(Wrappers.<PsContractInfo>lambdaQuery()
|
||||
.select(PsContractInfo::getContractCode, PsContractInfo::getIsDue, PsContractInfo::getContractAmount)
|
||||
.ne(PsContractInfo::getIsCancel, CommonStatusEnum.SUCCESS.getCode())
|
||||
.ne(PsContractInfo::getContractStatus, ContractStatusEnum.INIT.getCode())
|
||||
.ge(startDate != null,PsContractInfo::getApplyDate,startDate)
|
||||
.le(endDate != null,PsContractInfo::getApplyDate,endDate));
|
||||
|
||||
@ -77,7 +79,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
return makeAmountVo;
|
||||
}
|
||||
|
||||
private void fillPay(List<PsContractInfo> list, MakeAmountVo.TypeAmountVo typeAmountVo){
|
||||
private void fillPay(List<PsContractInfo> list, DataAmountVo typeAmountVo){
|
||||
//续费/新签的合同编码集合
|
||||
List<String> renewCodes = list.stream().map(PsContractInfo::getContractCode).toList();
|
||||
//续费/新签的合同已付金额
|
||||
@ -149,4 +151,30 @@ public class HomeServiceImpl implements HomeService {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 首页大盘数据:各渠道成交
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public ReturnAmountVo byChannel(Integer type){
|
||||
Map<String, Object> mapParam = this.getDate(type);
|
||||
LocalDate startDate = (LocalDate)mapParam.get("startDate");
|
||||
LocalDate endDate = (LocalDate)mapParam.get("endDate");
|
||||
String date = (String)mapParam.get("date");
|
||||
|
||||
log.info("查询日期:{}到{}",startDate,endDate);
|
||||
List<PsContractInfo> list = psContractInfoMapper.selectList(Wrappers.query());
|
||||
// .select(PsContractInfo::getContractCode, PsContractInfo::getIsDue, PsContractInfo::getContractAmount)
|
||||
// .ne(PsContractInfo::getIsCancel, CommonStatusEnum.SUCCESS.getCode())
|
||||
// .ne(PsContractInfo::getContractStatus, ContractStatusEnum.INIT.getCode())
|
||||
// .ge(startDate != null,PsContractInfo::getApplyDate,startDate)
|
||||
// .le(endDate != null,PsContractInfo::getApplyDate,endDate));
|
||||
list.stream().collect(Collectors.groupingBy(PsContractInfo::getContractCode)).entrySet().stream().forEach(entry -> {});
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user