Commit 1b1b6d84 by sdif

添加统计数据

parent c78b8d8a
package com.pz.web.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;
import com.pz.common.core.controller.BaseController;
import com.pz.common.core.domain.PageQuery;
import com.pz.common.core.domain.R;
......@@ -9,6 +11,16 @@ import com.pz.system.domain.bo.DbghOrderBo;
import com.pz.system.domain.vo.DbghOrderVo;
import com.pz.system.domain.vo.OrderColumnarVo;
import com.pz.system.mapper.TotalOrderMapper;
import com.pz.common.core.domain.R;
import com.pz.merchant.service.ICompanyService;
import com.pz.merchant.service.IEmployeesService;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.DataOrderVo;
import com.pz.system.domain.vo.DataViewVo;
import com.pz.system.domain.vo.DbghOrderVo;
import com.pz.system.service.IStoreApplyService;
import com.pz.system.service.ISysUserService;
import com.pz.system.service.ITotalOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -16,6 +28,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotEmpty;
import java.util.List;
......@@ -30,6 +44,83 @@ import java.util.List;
@RestController
@RequestMapping("/system/data")
public class DataViewController extends BaseController {
private final ISysUserService iSysUserService;
private final IEmployeesService iEmployeesService;
private final ICompanyService iCompanyService;
private final IStoreApplyService iStoreApplyService;
private final ITotalOrderService iTotalOrderService;
/**
* 新增用户统计
*/
@SaIgnore
@GetMapping("/dataUser")
public R<DataViewVo> dataUser(DataViewBo dataViewBo) {
return R.ok(iSysUserService.dataUser(dataViewBo));
}
/**
* 新增陪诊员统计
*/
@SaIgnore
@GetMapping("/dataEmployees")
public R<DataViewVo> dataEmployees(DataViewBo dataViewBo) {
return R.ok(iEmployeesService.dataEmployees(dataViewBo));
}
/**
* 新增机构统计
*/
@SaIgnore
@GetMapping("/dataCompany")
public R<DataViewVo> dataCompany(DataViewBo dataViewBo) {
return R.ok(iCompanyService.dataCompany(dataViewBo));
}
/**
* 新增商城商户统计
*/
@SaIgnore
@GetMapping("/dataStoreApply")
public R<DataViewVo> dataStoreApply(DataViewBo dataViewBo) {
return R.ok(iStoreApplyService.dataStoreApply(dataViewBo));
}
/**
* 订单销售额
*/
@SaIgnore
@GetMapping("/saleroom")
public R<DataOrderVo> saleroom(DataViewBo dataViewBo) {
return R.ok(iTotalOrderService.saleroom(dataViewBo));
}
/**
* 平台收益
*/
@SaIgnore
@GetMapping("/platformRevenue")
public R<DataOrderVo> platformRevenue(DataViewBo dataViewBo) {
return R.ok(iTotalOrderService.platformRevenue(dataViewBo));
}
/**
* 订单量
*/
@SaIgnore
@GetMapping("/orderQuantity")
public R<DataViewVo> orderQuantity(DataViewBo dataViewBo) {
DataOrderVo dataOrderVo = iTotalOrderService.orderQuantity(dataViewBo);
DataViewVo dataViewVo = new DataViewVo();
dataViewVo.setDataSum((int) dataOrderVo.getDataSum());
return R.ok(dataViewVo);
}
private final TotalOrderMapper totalOrderMapper;
/**
......
......@@ -9,6 +9,8 @@ import com.pz.merchant.domain.Company;
import com.pz.merchant.domain.vo.CompanyAppVo;
import com.pz.merchant.domain.vo.CompanyVo;
import com.pz.merchant.domain.vo.FinanceOrderInfoVo;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.DataViewVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -45,4 +47,6 @@ public interface CompanyMapper extends BaseMapperPlus<CompanyMapper, Company, Co
*/
IPage<FinanceOrderInfoVo> selectAllOrder(IPage<FinanceOrderInfoVo> page, @Param(Constants.WRAPPER) Wrapper<Company> queryWrapper);
DataViewVo selectDataView(@Param("dataViewBo") DataViewBo dataViewBo);
}
......@@ -14,6 +14,8 @@ import com.pz.common.core.mapper.BaseMapperPlus;
import com.pz.merchant.domain.vo.OrderInfoVO;
import com.pz.merchant.domain.vo.TodayOrderListVo;
import com.pz.system.domain.DbmyOrder;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.DataViewVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -52,4 +54,6 @@ public interface EmployeesMapper extends BaseMapperPlus<EmployeesMapper, Employe
Page<EmployeesVo> selectEmployees(@Param("bo") EmployeesBo bo, IPage<EmployeesVo> iPage);
EmployeesVo selectEmployeesById(Integer id);
DataViewVo selectDataView(@Param("dataViewBo") DataViewBo dataViewBo);
}
......@@ -10,7 +10,9 @@ import com.pz.merchant.domain.vo.CompanyAppVo;
import com.pz.merchant.domain.vo.CompanyBalanceVo;
import com.pz.merchant.domain.vo.CompanyVo;
import com.pz.merchant.domain.vo.FinanceStatisticVo;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.bo.WithdrawDepositBo;
import com.pz.system.domain.vo.DataViewVo;
import java.util.Collection;
import java.util.List;
......@@ -94,4 +96,9 @@ public interface ICompanyService {
* @return 操作结果
*/
boolean withdrawDeposit(WithdrawDepositBo bo);
/**
* 新增机构统计
*/
DataViewVo dataCompany(DataViewBo dataViewBo);
}
......@@ -11,8 +11,10 @@ import com.pz.common.core.page.TableDataInfo;
import com.pz.common.core.domain.PageQuery;
import com.pz.merchant.domain.vo.OrderInfoVO;
import com.pz.merchant.domain.vo.TodayOrderListVo;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.bo.EmployeesCompanyBo;
import com.pz.system.domain.bo.WithdrawDepositBo;
import com.pz.system.domain.vo.DataViewVo;
import java.util.Collection;
import java.util.List;
......@@ -141,4 +143,9 @@ public interface IEmployeesService {
*/
boolean withdrawDeposit(WithdrawDepositBo bo);
/**
* 新增陪诊员统计
*/
DataViewVo dataEmployees(DataViewBo dataViewBo);
}
......@@ -22,7 +22,9 @@ import com.pz.merchant.mapper.CompanyMapper;
import com.pz.merchant.service.ICompanyService;
import com.pz.merchant.service.ISonOrderService;
import com.pz.system.domain.Income;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.bo.WithdrawDepositBo;
import com.pz.system.domain.vo.DataViewVo;
import com.pz.system.mapper.CityMapper;
import com.pz.system.mapper.IncomeMapper;
import com.pz.system.mapper.SysUserMapper;
......@@ -269,4 +271,9 @@ public class CompanyServiceImpl implements ICompanyService {
throw new UnsupportedOperationException("资质不足,无法提现");
// return baseMapper.update(null, wrapper) > 0;
}
@Override
public DataViewVo dataCompany(DataViewBo dataViewBo) {
return baseMapper.selectDataView(dataViewBo);
}
}
......@@ -24,9 +24,11 @@ import com.pz.merchant.mapper.CompanyMapper;
import com.pz.merchant.service.ISonOrderService;
import com.pz.system.domain.Business;
import com.pz.system.domain.TotalOrder;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.bo.EmployeesCompanyBo;
import com.pz.system.domain.bo.WithdrawDepositBo;
import com.pz.system.domain.vo.BusinessVo;
import com.pz.system.domain.vo.DataViewVo;
import com.pz.system.domain.vo.TotalOrderVo;
import com.pz.system.mapper.BusinessMapper;
import com.pz.system.mapper.CityMapper;
......@@ -440,5 +442,8 @@ public class EmployeesServiceImpl implements IEmployeesService {
return TableDataInfo.build(page);
}
@Override
public DataViewVo dataEmployees(DataViewBo dataViewBo) {
return baseMapper.selectDataView(dataViewBo);
}
}
......@@ -6,6 +6,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jetbrains.annotations.NotNull;
import java.util.Date;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
......@@ -86,6 +87,10 @@ public class TotalOrder extends BaseEntity{
*/
private Double refundAmount;
/**
* 订单完成时间
*/
private Date finishTime;
/**
* 删除标志(0代表存在 2代表删除)
*/
@TableLogic
......
package com.pz.system.domain.bo;
import com.pz.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class DataViewBo extends BaseEntity {
/**
* 最近7天 1
* 最近30天 2
* 最近1年 3
*/
private Integer condition;
}
package com.pz.system.domain.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class DataOrderVo implements Serializable {
/**
* 总数量
*/
private double dataSum;
}
package com.pz.system.domain.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class DataViewVo implements Serializable {
/**
* 总数量
*/
private Integer dataSum;
}
package com.pz.system.mapper;
import com.pz.system.domain.StoreApply;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.DataViewVo;
import com.pz.system.domain.vo.StoreApplyVo;
import com.pz.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
/**
* 商城商户申请Mapper接口
......@@ -11,5 +14,5 @@ import com.pz.common.core.mapper.BaseMapperPlus;
* @date 2023-09-10
*/
public interface StoreApplyMapper extends BaseMapperPlus<StoreApplyMapper, StoreApply, StoreApplyVo> {
DataViewVo selectDataView(@Param("dataViewBo") DataViewBo dataViewBo);
}
......@@ -7,6 +7,8 @@ import com.pz.common.annotation.DataColumn;
import com.pz.common.annotation.DataPermission;
import com.pz.common.core.domain.entity.SysUser;
import com.pz.common.core.mapper.BaseMapperPlus;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.DataViewVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -93,4 +95,6 @@ public interface SysUserMapper extends BaseMapperPlus<SysUserMapper, SysUser, Sy
*/
SysUser selectUserById(Long userId);
DataViewVo selectDataView(@Param("dataViewBo") DataViewBo dataViewBo);
}
......@@ -7,10 +7,8 @@ import com.pz.merchant.domain.Company;
import com.pz.merchant.domain.vo.FinanceOrderInfoVo;
import com.pz.system.domain.OrderMessage;
import com.pz.system.domain.TotalOrder;
import com.pz.system.domain.vo.AccompanyDemandVo;
import com.pz.system.domain.vo.AppOrderVo;
import com.pz.system.domain.vo.OrderColumnarVo;
import com.pz.system.domain.vo.TotalOrderVo;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.*;
import com.pz.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -62,6 +60,12 @@ public interface TotalOrderMapper extends BaseMapperPlus<TotalOrderMapper, Total
*/
OrderMessage selectDataToMessageById(Long id);
DataOrderVo selectSaleroom(@Param("dataViewBo") DataViewBo dataViewBo);
DataOrderVo selectPlatformRevenue(@Param("dataViewBo") DataViewBo dataViewBo);
DataOrderVo selectOrderQuantity(@Param("dataViewBo") DataViewBo dataViewBo);
/**
* 数据总览
* @param type
......
package com.pz.system.service;
import com.pz.system.domain.StoreApply;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.DataViewVo;
import com.pz.system.domain.vo.StoreApplyVo;
import com.pz.system.domain.bo.StoreApplyBo;
import com.pz.common.core.page.TableDataInfo;
......@@ -52,4 +54,9 @@ public interface IStoreApplyService {
* 校验并批量删除商城商户申请信息
*/
Boolean deleteWithValidByIds(Collection<Integer> ids, Boolean isValid);
/**
* 新增商城商户统计
*/
DataViewVo dataStoreApply(DataViewBo dataViewBo);
}
......@@ -3,6 +3,8 @@ package com.pz.system.service;
import com.pz.common.core.domain.PageQuery;
import com.pz.common.core.domain.entity.SysUser;
import com.pz.common.core.page.TableDataInfo;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.DataViewVo;
import com.pz.system.domain.vo.UserIdentityVo;
import java.util.List;
......@@ -220,4 +222,9 @@ public interface ISysUserService {
UserIdentityVo checkUserIdentity(Long userId);
/**
* 新增用户统计
*/
DataViewVo dataUser(DataViewBo dataViewBo);
}
......@@ -2,9 +2,13 @@ package com.pz.system.service;
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
import com.pz.common.core.domain.R;
import com.pz.system.domain.TotalOrder;
import com.pz.system.domain.bo.CreateOrderBo;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.AccompanyDemandVo;
import com.pz.system.domain.vo.DataOrderVo;
import com.pz.system.domain.vo.DataViewVo;
import com.pz.system.domain.vo.TotalOrderVo;
import com.pz.system.domain.bo.TotalOrderBo;
import com.pz.common.core.page.TableDataInfo;
......@@ -146,4 +150,19 @@ public interface ITotalOrderService {
* @return
*/
Object selectLogisticsStatus(TotalOrderBo totalOrderBo);
/**
* 订单销售额
*/
DataOrderVo saleroom(DataViewBo dataViewBo);
/**
* 平台收益
*/
DataOrderVo platformRevenue(DataViewBo dataViewBo);
/**
* 订单量
*/
DataOrderVo orderQuantity(DataViewBo dataViewBo);
}
......@@ -316,7 +316,7 @@ public class DbghOrderServiceImpl implements IDbghOrderService, ISonOrderService
long expirationTime = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(24);
TotalOrderDelayOperator task = new TotalOrderDelayOperator(totalOrder.getId(), expirationTime, id -> {
totalOrderMapper.update(null,
Wrappers.<TotalOrder>lambdaUpdate().set(TotalOrder::getStatus, 2).eq(TotalOrder::getId, id));
Wrappers.<TotalOrder>lambdaUpdate().set(TotalOrder::getStatus, 2).set(TotalOrder::getFinishTime,new Date()).eq(TotalOrder::getId, id));
});
delayQueue.addOrder(task);
return true;
......
......@@ -295,7 +295,7 @@ public class DbmyOrderServiceImpl implements IDbmyOrderService, ISonOrderService
long expirationTime = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(24);
TotalOrderDelayOperator task = new TotalOrderDelayOperator(totalOrder.getId(), expirationTime, id -> {
totalOrderMapper.update(null,
Wrappers.<TotalOrder>lambdaUpdate().set(TotalOrder::getStatus, 2).eq(TotalOrder::getId, id));
Wrappers.<TotalOrder>lambdaUpdate().set(TotalOrder::getStatus, 2).set(TotalOrder::getFinishTime,new Date()).eq(TotalOrder::getId, id));
});
delayQueue.addOrder(task);
return true;
......
......@@ -316,7 +316,7 @@ public class DbwzOrderServiceImpl implements IDbwzOrderService, ISonOrderService
long expirationTime = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(24);
TotalOrderDelayOperator task = new TotalOrderDelayOperator(totalOrder.getId(), expirationTime, id -> {
totalOrderMapper.update(null,
Wrappers.<TotalOrder>lambdaUpdate().set(TotalOrder::getStatus, 2).eq(TotalOrder::getId, id));
Wrappers.<TotalOrder>lambdaUpdate().set(TotalOrder::getStatus, 2).set(TotalOrder::getFinishTime,new Date()).eq(TotalOrder::getId, id));
});
delayQueue.addOrder(task);
return true;
......
......@@ -15,6 +15,8 @@ import com.pz.common.exception.ServiceException;
import com.pz.common.helper.LoginHelper;
import com.pz.system.domain.StoreInfo;
import com.pz.system.domain.SysUserRole;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.DataViewVo;
import com.pz.system.mapper.StoreInfoMapper;
import com.pz.system.mapper.SysUserMapper;
import com.pz.system.mapper.SysUserRoleMapper;
......@@ -178,4 +180,9 @@ public class StoreApplyServiceImpl implements IStoreApplyService {
}
return baseMapper.deleteBatchIds(ids) > 0;
}
@Override
public DataViewVo dataStoreApply(DataViewBo dataViewBo) {
return baseMapper.selectDataView(dataViewBo);
}
}
......@@ -33,6 +33,8 @@ import com.pz.merchant.mapper.EmployeesMapper;
import com.pz.system.domain.SysPost;
import com.pz.system.domain.SysUserPost;
import com.pz.system.domain.SysUserRole;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.vo.DataViewVo;
import com.pz.system.domain.vo.UserIdentityVo;
import com.pz.system.mapper.*;
import com.pz.system.service.ISysUserService;
......@@ -537,4 +539,8 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
return ObjectUtil.isNull(sysUser) ? null : sysUser.getUserName();
}
@Override
public DataViewVo dataUser(DataViewBo dataViewBo) {
return baseMapper.selectDataView(dataViewBo);
}
}
......@@ -38,11 +38,9 @@ import com.pz.system.datastructure.OrderDelayQueue;
import com.pz.system.datastructure.TotalOrderDelayOperator;
import com.pz.system.domain.*;
import com.pz.system.domain.bo.CreateOrderBo;
import com.pz.system.domain.bo.DataViewBo;
import com.pz.system.domain.bo.TotalOrderBo;
import com.pz.system.domain.vo.AccompanyDemandVo;
import com.pz.system.domain.vo.StoreGoodsVo;
import com.pz.system.domain.vo.TotalOrderVo;
import com.pz.system.domain.vo.UserAddressVo;
import com.pz.system.domain.vo.*;
import com.pz.system.mapper.*;
import com.pz.system.service.IOrderMessageService;
import com.pz.system.service.IPayService;
......@@ -734,6 +732,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
orderService.switchSonOrderStatus(totalOrder1.getId(), CommonOrderStatus.DONE.getCode());
}
totalOrder.setFinishTime(new Date());
return baseMapper.updateById(totalOrder) > 0;
}
......@@ -1367,4 +1366,20 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
}
return IsRefund;
}
@Override
public DataOrderVo saleroom(DataViewBo dataViewBo) {
return baseMapper.selectSaleroom(dataViewBo);
}
@Override
public DataOrderVo platformRevenue(DataViewBo dataViewBo) {
return baseMapper.selectPlatformRevenue(dataViewBo);
}
@Override
public DataOrderVo orderQuantity(DataViewBo dataViewBo) {
return baseMapper.selectOrderQuantity(dataViewBo);
}
}
......@@ -317,7 +317,7 @@ public class YypzOrderServiceImpl implements IYypzOrderService, ISonOrderService
long expirationTime = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(24);
TotalOrderDelayOperator task = new TotalOrderDelayOperator(totalOrder.getId(), expirationTime, id -> {
totalOrderMapper.update(null,
Wrappers.<TotalOrder>lambdaUpdate().set(TotalOrder::getStatus, 2).eq(TotalOrder::getId, id));
Wrappers.<TotalOrder>lambdaUpdate().set(TotalOrder::getStatus, 2).set(TotalOrder::getFinishTime,new Date()).eq(TotalOrder::getId, id));
});
delayQueue.addOrder(task);
return true;
......
......@@ -328,7 +328,7 @@ public class ZyphOrderServiceImpl implements IZyphOrderService, ISonOrderService
long expirationTime = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(24);
TotalOrderDelayOperator task = new TotalOrderDelayOperator(totalOrder.getId(), expirationTime, id -> {
totalOrderMapper.update(null,
Wrappers.<TotalOrder>lambdaUpdate().set(TotalOrder::getStatus, 2).eq(TotalOrder::getId, id));
Wrappers.<TotalOrder>lambdaUpdate().set(TotalOrder::getStatus, 2).set(TotalOrder::getFinishTime,new Date()).eq(TotalOrder::getId, id));
});
delayQueue.addOrder(task);
return true;
......
......@@ -65,6 +65,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</where>
</select>
<select id="selectDataView" resultType="com.pz.system.domain.vo.DataViewVo">
SELECT count(id) as dataSum
FROM company
WHERE `status` = 1
<if test="dataViewBo.condition == 2">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if>
<if test="dataViewBo.condition == 3">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
</if>
<if test="dataViewBo.condition == 1">
and DATE(create_time) = CURDATE()
</if>
</select>
</mapper>
......@@ -142,6 +142,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</where>
</select>
<select id="selectDataView" resultType="com.pz.system.domain.vo.DataViewVo">
SELECT count(id) as dataSum
FROM employees
WHERE `status` = 1
<if test="dataViewBo.condition == 2">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if>
<if test="dataViewBo.condition == 3">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
</if>
<if test="dataViewBo.condition == 1">
and DATE(create_time) = CURDATE()
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pz.system.mapper.StoreApplyMapper">
<select id="selectDataView" resultType="com.pz.system.domain.vo.DataViewVo">
SELECT count(id) as dataSum
FROM store_apply
WHERE `status` = 1
<if test="dataViewBo.condition == 2">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if>
<if test="dataViewBo.condition == 3">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
</if>
<if test="dataViewBo.condition == 1">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) -- 近1年
</if>
</select>
</mapper>
......@@ -178,5 +178,21 @@
where u.del_flag = '0' and u.user_id = #{userId}
</select>
<select id="selectDataView" resultType="com.pz.system.domain.vo.DataViewVo">
SELECT count(user_id) as dataSum
FROM sys_user
WHERE user_type = 'xcx_user'
<if test="dataViewBo.condition == 2">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if>
<if test="dataViewBo.condition == 3">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
</if>
<if test="dataViewBo.condition == 1">
and DATE(create_time) = CURDATE()
</if>
</select>
</mapper>
......@@ -70,6 +70,43 @@
left join employees e on e.id = t.em_id
where t.id = #{id}
</select>
<select id="selectSaleroom" resultType="com.pz.system.domain.vo.DataOrderVo">
SELECT IFNULL(ROUND(SUM(pay_money), 2),0) as dataSum FROM total_order WHERE `status` = 1 and refund_amount = 0
<if test="dataViewBo.condition == 2">
and finish_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if>
<if test="dataViewBo.condition == 3">
and finish_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
</if>
<if test="dataViewBo.condition == 1">
and DATE(finish_time) = CURDATE()
</if>
</select>
<select id="selectPlatformRevenue" resultType="com.pz.system.domain.vo.DataOrderVo">
SELECT IFNULL(ROUND(SUM(employees_divide.order_price - employees_divide.divide_price), 2),0) as dataSum FROM employees_divide
left join total_order on total_order.order_sn = employees_divide.order_id WHERE total_order.`status` = 2 and refund_amount = 0
<if test="dataViewBo.condition == 2">
and employees_divide.create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if>
<if test="dataViewBo.condition == 3">
and employees_divide.create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
</if>
<if test="dataViewBo.condition == 1">
and DATE(employees_divide.create_time) = CURDATE()
</if>
</select>
<select id="selectOrderQuantity" resultType="com.pz.system.domain.vo.DataOrderVo">
SELECT count(*) as dataSum FROM total_order WHERE `status` != 0 and refund_amount = 0
<if test="dataViewBo.condition == 2">
and finish_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if>
<if test="dataViewBo.condition == 3">
and finish_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
</if>
<if test="dataViewBo.condition == 1">
and DATE(finish_time) = CURDATE()
</if>
</select>
<select id="selectDataToMessageById" resultType="com.pz.system.domain.OrderMessage">
select total_order.id as totalOrderId,
......@@ -89,13 +126,13 @@
LEFT JOIN total_order t ON t.business_id = b.id
AND t.`status` = 2
<if test="type == 1">
AND DATE(t.create_time) = CURDATE()
AND DATE(t.finish_time) = CURDATE()
</if>
<if test="type == 2">
AND DATE(t.create_time) BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 DAY) AND CURDATE()
AND DATE(t.finish_time) BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 DAY) AND CURDATE()
</if>
<if test="type == 3">
AND DATE(t.create_time) BETWEEN DATE_SUB(CURDATE(), INTERVAL 29 DAY) AND CURDATE()
AND DATE(t.finish_time) BETWEEN DATE_SUB(CURDATE(), INTERVAL 29 DAY) AND CURDATE()
</if>
GROUP BY b.id;
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment