Compare commits
3 Commits
1dbfb4f59b
...
fdfdddc3b6
Author | SHA1 | Date | |
---|---|---|---|
fdfdddc3b6 | |||
f24fd9a789 | |||
e5c2b1a3cd |
|
@ -100,6 +100,23 @@ public class IndexController extends BaseController
|
|||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营收统计(按月份)
|
||||
*/
|
||||
@GetMapping(value = "/getIncomeList")
|
||||
public AjaxResult getIncomeList(Long deptId,String date)// 2024-11
|
||||
{
|
||||
logger.info("【获取营收统计(按月份)】请求参数: deptId={}", deptId);
|
||||
if(deptId == null){
|
||||
throw new ServiceException("运营商id不能为空:deptId");
|
||||
}
|
||||
if(date == null){
|
||||
throw new ServiceException("时间参数不能为空:date");
|
||||
}
|
||||
List<IndexVo.IncomeVo> incomeList = etOrderService.getIncomeList(deptId, date);
|
||||
return success(incomeList);
|
||||
}
|
||||
|
||||
private static void assign(IndexVo result, IndexVo areaIndexVo) {
|
||||
result.setBalance(result.getBalance().add(areaIndexVo.getBalance()));
|
||||
result.setWithdraw(result.getWithdraw().add(areaIndexVo.getWithdraw()));
|
||||
|
|
|
@ -1030,10 +1030,10 @@ public class AppVerifyController extends BaseController
|
|||
BigDecimal todayOrderAmount = BigDecimal.ZERO;
|
||||
List<Long> longs = etOperatingAreaMapper.selectAreaListByDeptId(sysDept.getDeptId());
|
||||
for (Long id:longs) {
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, id), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, id), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, id,null);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,id,null);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, id,null), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, id,null), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, id,null,null);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,id,null,null);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal areaOrderAmount = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费
|
||||
if (areaOrderAmount != null) {
|
||||
todayOrderAmount = todayOrderAmount.add(areaOrderAmount);
|
||||
|
@ -1058,8 +1058,8 @@ public class AppVerifyController extends BaseController
|
|||
// 统计et_capital_flow中 合伙人
|
||||
BigDecimal payFee = defaultIfNull(etCapitalFlowMapper.getTotalAmountByUserId(startDateStr, endDateStr,userId), BigDecimal.ZERO);
|
||||
BigDecimal refundFee = defaultIfNull(etCapitalFlowMapper.getPartnerRefundFee(startDateStr, endDateStr, userId), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, null, userId);//手续费,扣除掉退款部分的 0.01
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,null,userId);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, null, null,userId);//手续费,扣除掉退款部分的 0.01
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,null,null,userId);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal areaOrderAmount = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费
|
||||
if (areaOrderAmount != null) {
|
||||
todayOrderAmount = todayOrderAmount.add(areaOrderAmount);
|
||||
|
|
|
@ -134,10 +134,10 @@ public class SysDeptController extends BaseController
|
|||
BigDecimal todayOrderAmount = BigDecimal.ZERO;
|
||||
List<Long> longs = etOperatingAreaMapper.selectAreaListByDeptId(deptId);
|
||||
for (Long areaId:longs) {
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId,null);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId,null);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId,null), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId,null), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId,null,null);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId,null,null);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal areaOrderAmount = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费
|
||||
if (areaOrderAmount != null) {
|
||||
todayOrderAmount = todayOrderAmount.add(areaOrderAmount);
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.ruoyi.common.annotation.Excel;
|
|||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单对象 et_order
|
||||
*
|
||||
|
@ -43,4 +45,8 @@ public class EtOrderQuery extends BaseEntity
|
|||
@Excel(name = "退款类型")
|
||||
private String refundType;
|
||||
|
||||
/** 是否退款 */
|
||||
@Excel(name = "是否退款")
|
||||
private List<String> isRefund;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
|
||||
import com.ruoyi.system.domain.AsDevice;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备数量视图对象
|
||||
*
|
||||
|
@ -27,6 +30,9 @@ public class DeviceNumVo {
|
|||
/** 已离线 */
|
||||
private Integer offlineNum;
|
||||
|
||||
/** 全部离线设备 */
|
||||
private Integer allOfflineNum;
|
||||
|
||||
/** 正常待租 */
|
||||
private Integer normalNum;
|
||||
|
||||
|
@ -42,4 +48,7 @@ public class DeviceNumVo {
|
|||
/** 运营中 */
|
||||
private Integer inOperation;
|
||||
|
||||
/** 已离线设备 */
|
||||
private List<AsDevice> offlineDevices;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import com.ruoyi.system.domain.AsDevice;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -115,6 +116,9 @@ public class IndexVo {
|
|||
|
||||
/** 运营中 */
|
||||
private Integer inOperation;
|
||||
|
||||
/** 已离线设备 */
|
||||
private List<AsDevice> offlineDevices;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -79,7 +79,7 @@ public interface EtCapitalFlowMapper
|
|||
* @param areaId 运营区id
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getHandlingFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId, @Param("ownerId") Long ownerId);
|
||||
BigDecimal getHandlingFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId, @Param("areaIds") List<Long> areaIds, @Param("ownerId") Long ownerId);
|
||||
|
||||
/**
|
||||
* 手续费
|
||||
|
@ -95,7 +95,7 @@ public interface EtCapitalFlowMapper
|
|||
* @param areaId 运营区id
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getServiceFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId, @Param("ownerId") Long ownerId);
|
||||
BigDecimal getServiceFee(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("sn") String sn, @Param("areaId") Long areaId, @Param("areaIds") List<Long> areaIds, @Param("ownerId") Long ownerId);
|
||||
/**
|
||||
* 平台服务费
|
||||
*
|
||||
|
|
|
@ -230,7 +230,7 @@ public interface EtOrderMapper
|
|||
/**
|
||||
* 获取订单数
|
||||
*/
|
||||
int getOrderNum(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") Long areaId);
|
||||
int getOrderNum(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") Long areaId, @Param("areaIds") List<Long> areaIds);
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
|
@ -245,12 +245,12 @@ public interface EtOrderMapper
|
|||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
BigDecimal getPayFee(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("sn") String sn, @Param("areaId") Long areaId);
|
||||
BigDecimal getPayFee(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("sn") String sn, @Param("areaId") Long areaId, @Param("areaIds") List<Long> areaIds);
|
||||
|
||||
/**
|
||||
* 已退款
|
||||
*/
|
||||
BigDecimal getRefundFee(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("sn") String sn, @Param("areaId") Long areaId);
|
||||
BigDecimal getRefundFee(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr, @Param("sn") String sn, @Param("areaId") Long areaId, @Param("areaIds") List<Long> areaIds);
|
||||
|
||||
/**
|
||||
* 已退款
|
||||
|
|
|
@ -279,4 +279,9 @@ public interface IEtOrderService
|
|||
* 使用优惠券
|
||||
*/
|
||||
int useCoupon(String orderNo, Long logId);
|
||||
|
||||
/**
|
||||
* 获取营收统计(按月份)
|
||||
*/
|
||||
List<IndexVo.IncomeVo> getIncomeList(Long deptId, String date);
|
||||
}
|
||||
|
|
|
@ -803,16 +803,23 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
|
||||
QueryWrapper<AsDevice> wrapperForOffline = new QueryWrapper<>();
|
||||
wrapperForOffline.eq("online_status","0");//在线状态:0-不在线;1-在线
|
||||
wrapperForOffline.ne("status","0");//
|
||||
if(StrUtil.isNotBlank(powerStart) && StrUtil.isNotBlank(powerEnd)){
|
||||
wrapperForOffline.between("remaining_power",Integer.parseInt(powerStart),Integer.parseInt(powerEnd));
|
||||
}
|
||||
if(StrUtil.isNotBlank(areaId)){
|
||||
wrapperForOffline.eq("area_id",areaId);
|
||||
}
|
||||
Integer allOfflineNum = asDeviceMapper.selectCount(wrapperForOffline);
|
||||
deviceNumVo.setOfflineNum(allOfflineNum);//全部离线数
|
||||
|
||||
wrapperForOffline.ne("status","0");
|
||||
|
||||
Integer offlineNum = asDeviceMapper.selectCount(wrapperForOffline);
|
||||
deviceNumVo.setOfflineNum(offlineNum);//已离线
|
||||
|
||||
List<AsDevice> devices = asDeviceMapper.selectList(wrapperForOffline);
|
||||
deviceNumVo.setOfflineDevices(devices);
|
||||
|
||||
Integer inAppointmentNum = setNum(powerStart, powerEnd, ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT,areaId);
|
||||
deviceNumVo.setInAppointmentNum(inAppointmentNum);//预约中
|
||||
|
||||
|
|
|
@ -43,14 +43,13 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.ruoyi.common.constant.CacheConstants.INDEX_DATA;
|
||||
|
||||
/**
|
||||
* 订单Service业务层处理
|
||||
*
|
||||
|
@ -417,6 +416,22 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
rechargeVoList.add(rechargeVo);
|
||||
});
|
||||
}
|
||||
//补充代码 根据isRefund判断,如果isRefund只存在"0",则只查询未退款(rechargeVo.isRefunded字段,布尔类型的)的记录,如果isRefund存在"1",则查询已退款的记录,如果isRefund为空或两个都有,则查询全部
|
||||
List<String> isRefund = etOrder.getIsRefund();
|
||||
if (isRefund != null && isRefund.size() > 0) {
|
||||
// 如果只包含 "0",则过滤未退款记录
|
||||
if (isRefund.contains("0") && !isRefund.contains("1")) {
|
||||
rechargeVoList.removeIf(rechargeVo -> {
|
||||
Boolean isRefunded = rechargeVo.getIsRefunded();
|
||||
return isRefunded == null || Boolean.TRUE.equals(isRefunded);
|
||||
});
|
||||
}
|
||||
// 如果只包含 "1",则过滤已退款记录
|
||||
if (isRefund.contains("1") && !isRefund.contains("0")) {
|
||||
rechargeVoList.removeIf(rechargeVo -> Boolean.FALSE.equals(rechargeVo.getIsRefunded()));
|
||||
}
|
||||
}
|
||||
|
||||
//将rechargeVoList根据payTime倒序
|
||||
rechargeVoList.sort(Comparator.comparing(RechargeVo::getPayTime).reversed());
|
||||
return rechargeVoList;
|
||||
|
@ -853,7 +868,6 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
SysDept sysDept = wxPayService.getDeptObjByAreaId(areaId);
|
||||
IndexVo indexVo = createIndexVo(areaId,sysDept);
|
||||
|
||||
int defualtDays;
|
||||
/** 营收统计*/
|
||||
if(type.equals("1")){
|
||||
/** 运维统计*/
|
||||
|
@ -869,30 +883,27 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
operationVo.setCompletedRepairCount(etAdminOrderMapper.getOrderCount(ServiceConstants.ADMIN_ORDER_TYPE_REPAIR,ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_COMPLETED,areaId));
|
||||
indexVo.setOperationVo(operationVo);
|
||||
|
||||
defualtDays = 13;
|
||||
}else{
|
||||
defualtDays = 29;
|
||||
}
|
||||
ArrayList<IndexVo.IncomeVo> incomeVos = new ArrayList<>();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(DateUtils.getNowDate());
|
||||
ArrayList<IndexVo.IncomeVo> incomeVos = new ArrayList<>();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(DateUtils.getNowDate());
|
||||
|
||||
for (int i = 0; i < defualtDays; i++) {
|
||||
String formattedDate = dateFormat.format(calendar.getTime());
|
||||
String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
|
||||
String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
|
||||
IndexVo.OrderFeeStatisticsVo todayOrderInfo = getOrderFeeStatistics(startDateStr, endDateStr, areaId);
|
||||
log.info("【首页统计】营收统计----------todayOrderInfo: {}" , JSON.toJSON(todayOrderInfo));
|
||||
IndexVo.IncomeVo incomeVo = new IndexVo.IncomeVo();
|
||||
incomeVo.setDay(formattedDate);
|
||||
incomeVo.setOrderNum(todayOrderInfo.getOrderCount());
|
||||
incomeVo.setIncome(todayOrderInfo.getIncomeFee());
|
||||
incomeVos.add(incomeVo);
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
}
|
||||
for (int i = 0; i < 13; i++) {
|
||||
String formattedDate = dateFormat.format(calendar.getTime());
|
||||
String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
|
||||
String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
|
||||
IndexVo.OrderFeeStatisticsVo todayOrderInfo = getOrderFeeStatistics(startDateStr, endDateStr, areaId);
|
||||
log.info("【首页统计】营收统计----------todayOrderInfo: {}" , JSON.toJSON(todayOrderInfo));
|
||||
IndexVo.IncomeVo incomeVo = new IndexVo.IncomeVo();
|
||||
incomeVo.setDay(formattedDate);
|
||||
incomeVo.setOrderNum(todayOrderInfo.getOrderCount());
|
||||
incomeVo.setIncome(todayOrderInfo.getIncomeFee());
|
||||
incomeVos.add(incomeVo);
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
}
|
||||
|
||||
indexVo.setIncomeVoList(incomeVos);
|
||||
indexVo.setIncomeVoList(incomeVos);
|
||||
}
|
||||
|
||||
/** 车辆统计*/
|
||||
IndexVo.VehicleVo vehicleVo = new IndexVo.VehicleVo();
|
||||
|
@ -943,12 +954,38 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
*/
|
||||
private IndexVo.OrderFeeStatisticsVo getOrderFeeStatistics(String startDateStr, String endDateStr, Long areaId) {
|
||||
IndexVo.OrderFeeStatisticsVo feeStatisticsVo = new IndexVo.OrderFeeStatisticsVo();
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId,null);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId,null);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId,null), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId,null), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId,null,null);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId,null,null);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal incomeFee = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费
|
||||
int orderCount = etOrderMapper.getOrderNum(startDateStr, endDateStr, areaId);
|
||||
int orderCount = etOrderMapper.getOrderNum(startDateStr, endDateStr, areaId,null);
|
||||
feeStatisticsVo.setOrderFee(payFee);
|
||||
feeStatisticsVo.setIncomeFee(incomeFee);
|
||||
feeStatisticsVo.setOrderCount(orderCount);
|
||||
return feeStatisticsVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单信息统计
|
||||
*/
|
||||
private IndexVo.OrderFeeStatisticsVo getOrderFeeStatisticsByDeptId(String startDateStr, String endDateStr, List<Long> areaIds) {
|
||||
IndexVo.OrderFeeStatisticsVo feeStatisticsVo = new IndexVo.OrderFeeStatisticsVo();
|
||||
|
||||
// 查询整个日期范围内的各项费用
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null,null, areaIds), BigDecimal.ZERO); // 新增支付金额
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, null, areaIds), BigDecimal.ZERO); // 退款金额
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, null, areaIds, null); // 手续费,扣除退款
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null, null, areaIds, null); // 平台服务费,扣除退款
|
||||
|
||||
|
||||
// 计算营收 = 新增支付 - 手续费 - 退款 - 平台服务费
|
||||
BigDecimal incomeFee = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);
|
||||
|
||||
// 获取订单数量
|
||||
int orderCount = etOrderMapper.getOrderNum(startDateStr, endDateStr, null, areaIds);
|
||||
|
||||
// 设置统计数据
|
||||
feeStatisticsVo.setOrderFee(payFee);
|
||||
feeStatisticsVo.setIncomeFee(incomeFee);
|
||||
feeStatisticsVo.setOrderCount(orderCount);
|
||||
|
@ -982,7 +1019,7 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
String formattedDate = dateFormat.format(calendar.getTime());
|
||||
String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
|
||||
String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
|
||||
int orderCount = etOrderMapper.getOrderNum(startDateStr, endDateStr, null);
|
||||
int orderCount = etOrderMapper.getOrderNum(startDateStr, endDateStr, null,null);
|
||||
IndexAdminVo.IncomeVo incomeVo = new IndexAdminVo.IncomeVo();
|
||||
incomeVo.setDay(formattedDate);
|
||||
incomeVo.setOrderNum(orderCount);
|
||||
|
@ -1045,9 +1082,9 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
for (EtOperatingArea area : etOperatingAreas) {
|
||||
Long areaId = area.getAreaId();
|
||||
LeaderboardVo leaderboardVo = new LeaderboardVo();
|
||||
leaderboardVo.setOrderCount(etOrderMapper.getOrderNum(startDateStr, endDateStr, areaId));//订单数
|
||||
BigDecimal payFee = etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId);
|
||||
BigDecimal refundFee = etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId);
|
||||
leaderboardVo.setOrderCount(etOrderMapper.getOrderNum(startDateStr, endDateStr, areaId,null));//订单数
|
||||
BigDecimal payFee = etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId,null);
|
||||
BigDecimal refundFee = etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId,null);
|
||||
leaderboardVo.setOrderFee(payFee.subtract(refundFee));//订单金额
|
||||
String inOrderCount = etOrderMapper.getRidingOrder(startDateStr, endDateStr,areaId+"");
|
||||
leaderboardVo.setInProgressOrderCount(Integer.parseInt(inOrderCount));
|
||||
|
@ -1109,11 +1146,11 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
indexAdminVo.setUserCount(asUserMapper.selectAllCount(null,null));//用户总数
|
||||
indexAdminVo.setTodayUserCount(asUserMapper.selectAllCount(startDateStr,endDateStr));//今日新增
|
||||
|
||||
indexAdminVo.setTodayOrderCount(etOrderMapper.getOrderNum(startDateStr, endDateStr, null));//今日订单数
|
||||
indexAdminVo.setTodayOrderFee(etOrderMapper.getPayFee(startDateStr, endDateStr, null, null));//今日订单金额
|
||||
indexAdminVo.setTodayOrderCount(etOrderMapper.getOrderNum(startDateStr, endDateStr, null,null));//今日订单数
|
||||
indexAdminVo.setTodayOrderFee(etOrderMapper.getPayFee(startDateStr, endDateStr, null, null,null));//今日订单金额
|
||||
|
||||
indexAdminVo.setTotalOrderCount(etOrderMapper.getOrderNum(null, null, null));//总订单数
|
||||
indexAdminVo.setTotalOrderFee(etOrderMapper.getPayFee(null, null, null, null));//总订单金额
|
||||
indexAdminVo.setTotalOrderCount(etOrderMapper.getOrderNum(null, null, null,null));//总订单数
|
||||
indexAdminVo.setTotalOrderFee(etOrderMapper.getPayFee(null, null, null, null,null));//总订单金额
|
||||
|
||||
indexAdminVo.setTodayRefundFee(new BigDecimal(etOrderMapper.getTotalRefund(startDateStr,endDateStr,null)));// 今日退款金额
|
||||
indexAdminVo.setTotalRefundFee(new BigDecimal(etOrderMapper.getTotalRefund(null,null,null)));// 总退款金额
|
||||
|
@ -1124,11 +1161,11 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
indexAdminVo.setReturnOrderCount(etOrderMapper.getAuditOrderNum(null,null,null));//还车待审核订单
|
||||
indexAdminVo.setReturnOrderDeductFee(etOrderMapper.getReturnOrderDeductFee(null,null,null));// 待审核还车押金扣款
|
||||
|
||||
indexAdminVo.setTodayHandlingFee(etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null,null,null));// 今日支付手续费
|
||||
indexAdminVo.setTotalHandlingFee(etCapitalFlowMapper.getHandlingFee(null, null, null,null,null));// 总手续费
|
||||
indexAdminVo.setTodayHandlingFee(etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null,null,null,null));// 今日支付手续费
|
||||
indexAdminVo.setTotalHandlingFee(etCapitalFlowMapper.getHandlingFee(null, null, null,null,null,null));// 总手续费
|
||||
|
||||
indexAdminVo.setTodayServiceFee(etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,null,null));//今日服务费
|
||||
indexAdminVo.setTotalServiceFee(etCapitalFlowMapper.getServiceFee(null, null, null,null,null));// 总服务费
|
||||
indexAdminVo.setTodayServiceFee(etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,null,null,null));//今日服务费
|
||||
indexAdminVo.setTotalServiceFee(etCapitalFlowMapper.getServiceFee(null, null, null,null,null,null));// 总服务费
|
||||
|
||||
return indexAdminVo;
|
||||
}
|
||||
|
@ -1393,8 +1430,8 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
String totalRefund = etOrderMapper.getTotalRefund(timeStart, timeEnd, areaId);//已退款
|
||||
income.setTotalPaid(totalPaid);//已支付
|
||||
//handlingFee 手续费 = 0.0054 * 已支付金额
|
||||
BigDecimal handlingFee = etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, null, Long.parseLong(areaId),null);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, null,Long.parseLong(areaId),null);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal handlingFee = etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, null, Long.parseLong(areaId),null,null);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, null,Long.parseLong(areaId),null,null);//平台服务费 ,扣除掉退款部分的
|
||||
income.setHandlingFee(handlingFee.add(platformServiceFee).toString());
|
||||
|
||||
// 总营收 = 已支付 - 已退款 - 手续费
|
||||
|
@ -1465,10 +1502,10 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
income.setDepositPaid(depositAmount);
|
||||
|
||||
/** 总支出*/
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(timeStart, timeEnd, null, aLong), BigDecimal.ZERO);//订单退款
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(timeStart, timeEnd, null, aLong,null), BigDecimal.ZERO);//订单退款
|
||||
BigDecimal depositRefundFee = defaultIfNull(etOrderMapper.getDepositRefundFee(timeStart, timeEnd, null, aLong,null), BigDecimal.ZERO);//押金退款 24795
|
||||
BigDecimal serviceFee = defaultIfNull(etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, null, aLong,null),BigDecimal.ZERO);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = defaultIfNull(etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, null,aLong,null),BigDecimal.ZERO);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal serviceFee = defaultIfNull(etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, null, aLong,null,null),BigDecimal.ZERO);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = defaultIfNull(etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, null,aLong,null,null),BigDecimal.ZERO);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal totalExpenditure = defaultIfNull(refundFee.add(depositRefundFee).add(serviceFee).add(platformServiceFee), BigDecimal.ZERO);
|
||||
|
||||
income.setOrderRefund(refundFee);
|
||||
|
@ -1765,10 +1802,10 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
SysDept deptObjByAreaId = wxPayService.getDeptObjByAreaId(areaId);
|
||||
reconciliation.setDeptName(deptObjByAreaId.getDeptName());
|
||||
reconciliation.setDay(formattedDate);
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId,null);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId,null);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId,null), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId,null), BigDecimal.ZERO);//退款
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(startDateStr, endDateStr, null, areaId,null,null);//手续费,扣除掉退款部分的
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(startDateStr, endDateStr, null,areaId,null,null);//平台服务费 ,扣除掉退款部分的
|
||||
BigDecimal incomeFee = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee).subtract(platformServiceFee), BigDecimal.ZERO);//营收 = 新增 - 手续费 - 退款 - 平台服务费
|
||||
|
||||
reconciliation.setPayFee(payFee);
|
||||
|
@ -1798,12 +1835,12 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
private ReconciliationVo.Reconciliation createReconciliationByVehicle(String timeStart, String timeEnd, String sn,Long areaId) {
|
||||
ReconciliationVo.Reconciliation reconciliation = new ReconciliationVo.Reconciliation();
|
||||
reconciliation.setSn(sn);
|
||||
BigDecimal payFee = etOrderMapper.getPayFee(timeStart, timeEnd, sn, null);
|
||||
BigDecimal payFee = etOrderMapper.getPayFee(timeStart, timeEnd, sn, null,null);
|
||||
reconciliation.setPayFee(payFee);
|
||||
BigDecimal refundFee = etOrderMapper.getRefundFee(timeStart, timeEnd, sn, null);
|
||||
BigDecimal refundFee = etOrderMapper.getRefundFee(timeStart, timeEnd, sn, null,null);
|
||||
reconciliation.setRefundFee(refundFee);
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, sn, areaId,null);//手续费
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, sn, areaId,null);//平台服务费
|
||||
BigDecimal serviceFee = etCapitalFlowMapper.getHandlingFee(timeStart, timeEnd, sn, areaId,null,null);//手续费
|
||||
BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee(timeStart, timeEnd, sn, areaId,null,null);//平台服务费
|
||||
reconciliation.setIncome(payFee.subtract(refundFee).subtract(serviceFee).subtract(platformServiceFee));
|
||||
reconciliation.setServiceFee(serviceFee);
|
||||
reconciliation.setPlatformServiceFee(platformServiceFee);
|
||||
|
@ -2221,6 +2258,68 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
return updateEtOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营收统计(按月份)
|
||||
*/
|
||||
@Override
|
||||
public List<IndexVo.IncomeVo> getIncomeList(Long deptId, String date) {
|
||||
// 定义缓存的键
|
||||
String cacheKey = "income:deptId_" + deptId + ":date_" + date;
|
||||
|
||||
// 尝试从缓存中获取数据
|
||||
List<IndexVo.IncomeVo> cachedIncomeVos = redisCache.getCacheObject(cacheKey);
|
||||
if (cachedIncomeVos != null) {
|
||||
log.info("【营收统计】从缓存中获取数据:" + cacheKey);
|
||||
return cachedIncomeVos; // 如果缓存中有数据,直接返回
|
||||
}
|
||||
|
||||
ArrayList<IndexVo.IncomeVo> incomeVos = new ArrayList<>();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
|
||||
SimpleDateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(DateUtils.getNowDate());
|
||||
List<Long> areaIds = etOperatingAreaService.selectAreaListByDeptId(deptId);
|
||||
|
||||
try {
|
||||
// 将传入的 date 字符串解析为日期
|
||||
Date parsedDate = dateFormat.parse(date);
|
||||
calendar.setTime(parsedDate);
|
||||
} catch (ParseException e) {
|
||||
log.error("日期解析失败, 请检查日期格式,错误信息: {}", e.getMessage());
|
||||
return incomeVos;
|
||||
}
|
||||
|
||||
// 获取当前月的最后一天
|
||||
int lastDayOfMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
|
||||
for (int day = 1; day <= lastDayOfMonth; day ++) {
|
||||
// 设置当前日期为每一天
|
||||
calendar.set(Calendar.DAY_OF_MONTH, day);
|
||||
String formattedDate = dayFormat.format(calendar.getTime());
|
||||
|
||||
// 拼接查询的开始和结束时间
|
||||
String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND;
|
||||
String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND;
|
||||
|
||||
// 获取当天的订单统计信息
|
||||
IndexVo.OrderFeeStatisticsVo todayOrderInfo = getOrderFeeStatisticsByDeptId(startDateStr, endDateStr, areaIds);
|
||||
log.info("【获取营收统计】营收统计----------todayOrderInfo: {}" , JSON.toJSON(todayOrderInfo));
|
||||
|
||||
// 构建收入统计对象
|
||||
IndexVo.IncomeVo incomeVo = new IndexVo.IncomeVo();
|
||||
incomeVo.setDay(formattedDate);
|
||||
incomeVo.setOrderNum(todayOrderInfo.getOrderCount());
|
||||
incomeVo.setIncome(todayOrderInfo.getIncomeFee());
|
||||
|
||||
// 添加到结果列表中
|
||||
incomeVos.add(incomeVo);
|
||||
}
|
||||
|
||||
// 将计算得到的数据存入缓存,缓存有效期为30分钟
|
||||
redisCache.setCacheObject(cacheKey, incomeVos, 30, TimeUnit.MINUTES);
|
||||
return incomeVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用优惠券后的价格
|
||||
* 1. 先判断是否过期?并且是否是未使用的状态
|
||||
|
|
|
@ -70,9 +70,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectAsDeviceListWithIsolate" parameterType="AsDevice" resultMap="AsDeviceResult">
|
||||
select de.device_id, de.picture, de.device_name, de.mac, de.sn, de.model_id, de.hardware_version_id, de.vehicle_num, de.area_id,
|
||||
de.activation_time, de.online_status, de.create_by, de.create_time, de.update_by,
|
||||
de.activation_time, de.online_status, de.create_by, de.create_time, de.update_by,d.dept_id,
|
||||
de.update_time, de.last_time, de.last_location_time, de.gps, de.remark, de.status, de.lock_status, de.location,
|
||||
de.remaining_power, de.voltage, de.version, de.qrcode, de.longitude, de.latitude, de.is_area_out_outage, de.is_admin_unlocking, de.signal_strength, de.satellites, de.quality,de.appid, de.app_name from et_device de
|
||||
de.remaining_power, de.voltage, de.version, de.qrcode, de.longitude, de.latitude, de.is_area_out_outage, de.is_admin_unlocking, de.signal_strength,
|
||||
de.satellites, de.quality,de.appid, de.app_name from et_device de
|
||||
left join et_area_dept ad on ad.area_id = de.area_id
|
||||
left join sys_dept d on d.dept_id = ad.dept_id
|
||||
left join et_hardware_version hv on hv.id = de.hardware_version_id
|
||||
|
|
|
@ -275,7 +275,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
et_capital_flow f
|
||||
where
|
||||
f.bus_type = 4 and f.type = 2 and owner_type = 2
|
||||
<if test="owner_id != null and ownerId != 0"> and f.owner_id = #{ownerId}</if>
|
||||
<if test="ownerId != null and ownerId != 0"> and f.owner_id = #{ownerId}</if>
|
||||
<if test="timeStart != null and timeStart != ''">
|
||||
AND DATE(f.create_time) >= #{timeStart}
|
||||
</if>
|
||||
|
|
|
@ -679,6 +679,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<where>
|
||||
<if test="sn != null and sn != ''"> and sn = #{sn}</if>
|
||||
<if test="areaId != null"> and area_id = #{areaId}</if>
|
||||
<if test="areaIds != null and areaIds.size() > 0">
|
||||
and area_id IN
|
||||
<foreach item="item" index="index" collection="areaIds" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
and DATE(pay_time) >= #{startDateStr}
|
||||
</if>
|
||||
|
|
|
@ -60,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where 1 = 1
|
||||
<if test="refundResult != null "> and r.refund_result = #{refundResult}</if>
|
||||
<if test="refundType != null "> and r.type = #{refundType}</if>
|
||||
<if test="deptId != null and deptId != ''"> and d.dept_id = #{deptId}</if>
|
||||
<if test="userName != null and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
|
|
Loading…
Reference in New Issue
Block a user