vip、天医币、实物订单报表

This commit is contained in:
wuchunlei
2025-09-19 16:48:52 +08:00
parent fc15ffa30d
commit 2135bcb9fc
14 changed files with 398 additions and 99 deletions

View File

@@ -5,8 +5,10 @@ import com.peanut.modules.common.entity.BuyOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.peanut.modules.book.vo.request.BuyOrderListRequestVo; import com.peanut.modules.book.vo.request.BuyOrderListRequestVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 订单表 * 订单表
@@ -17,6 +19,11 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface BuyOrderDao extends MPJBaseMapper<BuyOrder> { public interface BuyOrderDao extends MPJBaseMapper<BuyOrder> {
List<Map<String,Object>> getPhysicalBuyOrderTotal(@Param("date") String date);
List<Map<String,Object>> exportPhysicalBuyOrderInfo(@Param("date") String date);
List<BuyOrder> orderList(BuyOrderListRequestVo requestVo); List<BuyOrder> orderList(BuyOrderListRequestVo requestVo);
int orderListCount(BuyOrderListRequestVo requestVo); int orderListCount(BuyOrderListRequestVo requestVo);

View File

@@ -3,6 +3,10 @@ package com.peanut.modules.common.dao;
import com.peanut.modules.common.entity.TransactionDetailsEntity; import com.peanut.modules.common.entity.TransactionDetailsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/** /**
* 交易明细 * 交易明细
@@ -14,4 +18,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface TransactionDetailsDao extends BaseMapper<TransactionDetailsEntity> { public interface TransactionDetailsDao extends BaseMapper<TransactionDetailsEntity> {
List<Map<String,Object>> getTransactionDetailsTotal(@Param("date") String date);
List<Map<String,Object>> getTransactionDetailsInfo(@Param("date") String date);
} }

View File

@@ -11,7 +11,7 @@ import java.util.Map;
@Mapper @Mapper
public interface UserVipLogDao extends BaseMapper<UserVipLog> { public interface UserVipLogDao extends BaseMapper<UserVipLog> {
List<Map<String,Object>> getUserVipLogInfoList(@Param("date") String date); List<Map<String,Object>> getUserVipLogInfo(@Param("date") String date);
Map<String,Object> getUserVipLogInfoTotal(@Param("date") String date); Map<String,Object> getUserVipLogInfoTotal(@Param("date") String date);
} }

View File

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.BuyOrder; import com.peanut.modules.common.entity.BuyOrder;
import com.peanut.modules.common.entity.ExpressQueryResponse; import com.peanut.modules.common.entity.ExpressQueryResponse;
import com.peanut.modules.common.to.PrepareOrderDto; import com.peanut.modules.common.to.PrepareOrderDto;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -21,4 +23,8 @@ public interface BuyOrderService extends IService<BuyOrder> {
ExpressQueryResponse commonExpressDetail(Map params); ExpressQueryResponse commonExpressDetail(Map params);
void updateOrderStatus(Integer userId, String orderSn, String type); void updateOrderStatus(Integer userId, String orderSn, String type);
List<Map<String,Object>> getPhysicalBuyOrderTotal(String date);
List<Map<String,Object>> exportPhysicalBuyOrderInfo(String date);
} }

View File

@@ -3,5 +3,12 @@ package com.peanut.modules.common.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.TransactionDetailsEntity; import com.peanut.modules.common.entity.TransactionDetailsEntity;
import java.util.List;
import java.util.Map;
public interface TransactionDetailsService extends IService<TransactionDetailsEntity> { public interface TransactionDetailsService extends IService<TransactionDetailsEntity> {
List<Map<String,Object>> getTransactionDetailsTotal(String date);
List<Map<String,Object>> getTransactionDetailsInfo(String date);
} }

View File

@@ -16,7 +16,7 @@ public interface UserVipLogService extends IService<UserVipLog> {
BigDecimal countDayAmount(UserVipLog userVipLog); BigDecimal countDayAmount(UserVipLog userVipLog);
List<Map<String,Object>> getUserVipLogInfoList(String date); List<Map<String,Object>> getUserVipLogInfo(String date);
Map<String, Object> getUserVipLogInfoTotal(String date); Map<String, Object> getUserVipLogInfoTotal(String date);

View File

@@ -220,6 +220,16 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
updateById(orderEntity); updateById(orderEntity);
} }
@Override
public List<Map<String, Object>> getPhysicalBuyOrderTotal(String date) {
return this.baseMapper.getPhysicalBuyOrderTotal(date);
}
@Override
public List<Map<String, Object>> exportPhysicalBuyOrderInfo(String date) {
return this.baseMapper.exportPhysicalBuyOrderInfo(date);
}
@Override @Override
public ExpressQueryResponse commonExpressDetail(Map params) { public ExpressQueryResponse commonExpressDetail(Map params) {
LambdaQueryWrapper<ExpressOrder> expressOrderWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ExpressOrder> expressOrderWrapper = new LambdaQueryWrapper<>();

View File

@@ -7,7 +7,19 @@ import com.peanut.modules.common.service.TransactionDetailsService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Slf4j @Slf4j
@Service("commonTransactionDetailsService") @Service("commonTransactionDetailsService")
public class TransactionDetailsServiceImpl extends ServiceImpl<TransactionDetailsDao, TransactionDetailsEntity> implements TransactionDetailsService { public class TransactionDetailsServiceImpl extends ServiceImpl<TransactionDetailsDao, TransactionDetailsEntity> implements TransactionDetailsService {
@Override
public List<Map<String, Object>> getTransactionDetailsTotal(String date) {
return this.baseMapper.getTransactionDetailsTotal(date);
}
@Override
public List<Map<String, Object>> getTransactionDetailsInfo(String date) {
return this.baseMapper.getTransactionDetailsInfo(date);
}
} }

View File

@@ -51,8 +51,8 @@ public class UserVipLogServiceImpl extends ServiceImpl<UserVipLogDao, UserVipLog
} }
@Override @Override
public List<Map<String, Object>> getUserVipLogInfoList(String date) { public List<Map<String, Object>> getUserVipLogInfo(String date) {
return this.baseMapper.getUserVipLogInfoList(date); return this.baseMapper.getUserVipLogInfo(date);
} }
@Override @Override

View File

@@ -0,0 +1,250 @@
package com.peanut.modules.master.controller;
import com.peanut.common.utils.R;
import com.peanut.modules.common.service.BuyOrderService;
import com.peanut.modules.common.service.TransactionDetailsService;
import com.peanut.modules.common.service.UserVipLogService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
/**
* 报表管理
*/
@Slf4j
@RestController("masterStatistics")
@RequestMapping("master/statistics")
public class StatisticsController {
@Autowired
private UserVipLogService userVipLogService;
@Autowired
private BuyOrderService buyOrderService;
@Autowired
private TransactionDetailsService transactionDetailsService;
@RequestMapping("/getTransactionDetailsTotal")
public R getTransactionDetailsTotal(@RequestBody Map<String, Object> params) {
List<Map<String,Object>> list = transactionDetailsService.getTransactionDetailsTotal(params.get("date").toString());
return R.ok().put("total", list);
}
//导出实物订单明细
@RequestMapping("/getTransactionDetailsInfo")
public void getTransactionDetailsInfo(HttpServletResponse response, @RequestBody Map<String,Object> params){
List<Map<String,Object>> maps = transactionDetailsService.getTransactionDetailsInfo(params.get("date").toString());
XSSFWorkbook wb = new XSSFWorkbook();
//创建一张表
Sheet sheet = wb.createSheet("天医币明细");
//创建第一行起始为0
Row titleRow = sheet.createRow(0);
titleRow.createCell(0).setCellValue("时间");
titleRow.createCell(1).setCellValue("姓名");
titleRow.createCell(2).setCellValue("电话");
titleRow.createCell(3).setCellValue("类型");
titleRow.createCell(4).setCellValue("支付方式");
titleRow.createCell(5).setCellValue("订单编号");
titleRow.createCell(6).setCellValue("变动金额");
titleRow.createCell(7).setCellValue("备注");
titleRow.createCell(8).setCellValue("商品类型");
titleRow.createCell(9).setCellValue("商品名称");
//序号默认为1
int cell = 1;
//遍历
for (Map<String,Object> map : maps) {
Row row = sheet.createRow(cell);
row.createCell(0).setCellValue(map.get("createTime").toString());
row.createCell(1).setCellValue(map.get("name").toString());
row.createCell(2).setCellValue(map.get("tel").toString());
row.createCell(3).setCellValue(map.get("type").toString());
row.createCell(4).setCellValue(map.get("payType").toString());
row.createCell(5).setCellValue(map.get("orderSn").toString());
row.createCell(6).setCellValue(map.get("changeAmount").toString());
row.createCell(7).setCellValue(map.get("note").toString());
row.createCell(8).setCellValue(map.get("goodsType").toString());
row.createCell(9).setCellValue(map.get("productName").toString());
//序号自增
cell++;
}
String fileName = "天医币明细.xlsx";
OutputStream outputStream =null;
try {
//文件名编码格式
fileName = URLEncoder.encode(fileName,"UTF-8");
//设置ContentType请求信息格式
response.setContentType("application/vnd.ms-excel");
//设置标头
response.setHeader("Content-disposition", "attachment;filename=" + fileName);
outputStream = response.getOutputStream();
wb.write(outputStream);
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@RequestMapping("/getPhysicalBuyOrderInfoTotal")
public R getPhysicalBuyOrderInfoTotal(@RequestBody Map<String, Object> params) {
List<Map<String,Object>> list = buyOrderService.getPhysicalBuyOrderTotal(params.get("date").toString());
return R.ok().put("total", list);
}
//导出实物订单明细
@RequestMapping("/exportPhysicalBuyOrderInfo")
public void exportPhysicalBuyOrderInfo(HttpServletResponse response, @RequestBody Map<String,Object> params){
List<Map<String,Object>> maps = buyOrderService.exportPhysicalBuyOrderInfo(params.get("date").toString());
XSSFWorkbook wb = new XSSFWorkbook();
//创建一张表
Sheet sheet = wb.createSheet("实物订单明细");
//创建第一行起始为0
Row titleRow = sheet.createRow(0);
titleRow.createCell(0).setCellValue("时间");
titleRow.createCell(1).setCellValue("姓名");
titleRow.createCell(2).setCellValue("电话");
titleRow.createCell(3).setCellValue("订单号");
titleRow.createCell(4).setCellValue("订单状态");
titleRow.createCell(5).setCellValue("支付方式");
titleRow.createCell(6).setCellValue("订单金额");
titleRow.createCell(7).setCellValue("实物金额");
titleRow.createCell(8).setCellValue("商品名称");
//序号默认为1
int cell = 1;
//遍历
for (Map<String,Object> map : maps) {
Row row = sheet.createRow(cell);
row.createCell(0).setCellValue(map.get("createTime").toString());
row.createCell(1).setCellValue(map.get("name").toString());
row.createCell(2).setCellValue(map.get("tel").toString());
row.createCell(3).setCellValue(map.get("orderSn").toString());
row.createCell(4).setCellValue(map.get("orderStatus").toString());
row.createCell(5).setCellValue(map.get("payType").toString());
row.createCell(6).setCellValue(map.get("orderPrice").toString());
row.createCell(7).setCellValue(map.get("price").toString());
row.createCell(8).setCellValue(map.get("productName").toString());
//序号自增
cell++;
}
String fileName = "实物订单明细.xlsx";
OutputStream outputStream =null;
try {
//文件名编码格式
fileName = URLEncoder.encode(fileName,"UTF-8");
//设置ContentType请求信息格式
response.setContentType("application/vnd.ms-excel");
//设置标头
response.setHeader("Content-disposition", "attachment;filename=" + fileName);
outputStream = response.getOutputStream();
wb.write(outputStream);
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@RequestMapping("/getUserVipLogInfoTotal")
public R getUserVipLogInfoTotal(@RequestBody Map<String, Object> params) {
Map<String,Object> map = userVipLogService.getUserVipLogInfoTotal(params.get("date").toString());
return R.ok().put("total", map);
}
//导出vip记录明细
@RequestMapping("/exportUserVipLogInfo")
public void exportUserVipLogInfo(HttpServletResponse response, @RequestBody Map<String,Object> params){
List<Map<String,Object>> maps = userVipLogService.getUserVipLogInfo(params.get("date").toString());
XSSFWorkbook wb = new XSSFWorkbook();
//创建一张表
Sheet sheet = wb.createSheet("vip记录明细");
//创建第一行起始为0
Row titleRow = sheet.createRow(0);
titleRow.createCell(0).setCellValue("姓名");
titleRow.createCell(1).setCellValue("电话");
titleRow.createCell(2).setCellValue("VIP类型");
titleRow.createCell(3).setCellValue("开始时间");
titleRow.createCell(4).setCellValue("结束时间");
titleRow.createCell(5).setCellValue("订单号");
titleRow.createCell(6).setCellValue("支付方式");
titleRow.createCell(7).setCellValue("备注");
titleRow.createCell(8).setCellValue("金额");
titleRow.createCell(9).setCellValue("总天数");
titleRow.createCell(10).setCellValue("每日摊销");
titleRow.createCell(11).setCellValue("已摊销天数");
titleRow.createCell(12).setCellValue("当月摊销天数");
titleRow.createCell(13).setCellValue("未摊销天数");
titleRow.createCell(14).setCellValue("已摊销金额");
titleRow.createCell(15).setCellValue("当月摊销金额");
titleRow.createCell(16).setCellValue("剩余摊销金额");
//序号默认为1
int cell = 1;
//遍历
for (Map<String,Object> map : maps) {
Row row = sheet.createRow(cell);
row.createCell(0).setCellValue(map.get("name").toString());
row.createCell(1).setCellValue(map.get("tel").toString());
row.createCell(2).setCellValue(map.get("type").toString());
row.createCell(3).setCellValue(map.get("startTime").toString());
row.createCell(4).setCellValue(map.get("endTime").toString());
row.createCell(5).setCellValue(map.get("orderSn").toString());
row.createCell(6).setCellValue(map.get("payType").toString());
row.createCell(7).setCellValue(map.get("remark").toString());
row.createCell(8).setCellValue(map.get("fee").toString());
row.createCell(9).setCellValue(map.get("totalDays").toString());
row.createCell(10).setCellValue(map.get("dayAmount").toString());
row.createCell(11).setCellValue(map.get("alreadyDays").toString());
row.createCell(12).setCellValue(map.get("currentDays").toString());
row.createCell(13).setCellValue(map.get("notyetDays").toString());
row.createCell(14).setCellValue(map.get("alreadyTanxiao").toString());
row.createCell(15).setCellValue(map.get("currentTanxiao").toString());
row.createCell(16).setCellValue(map.get("notyetTanxiao").toString());
//序号自增
cell++;
}
String fileName = "vip记录明细.xlsx";
OutputStream outputStream =null;
try {
//文件名编码格式
fileName = URLEncoder.encode(fileName,"UTF-8");
//设置ContentType请求信息格式
response.setContentType("application/vnd.ms-excel");
//设置标头
response.setHeader("Content-disposition", "attachment;filename=" + fileName);
outputStream = response.getOutputStream();
wb.write(outputStream);
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -11,21 +11,14 @@ import com.peanut.modules.common.service.JfTransactionDetailsService;
import com.peanut.modules.common.service.UserVipLogService; import com.peanut.modules.common.service.UserVipLogService;
import com.peanut.modules.master.service.MyUserService; import com.peanut.modules.master.service.MyUserService;
import com.peanut.modules.master.service.UserVipService; import com.peanut.modules.master.service.UserVipService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
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 jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
/** /**
@@ -47,92 +40,6 @@ public class UserVipController {
@Autowired @Autowired
private JfTransactionDetailsService jfTransactionDetailsService; private JfTransactionDetailsService jfTransactionDetailsService;
@RequestMapping("/getUserVipLogInfoTotal")
public R getUserVipLogInfoTotal(@RequestBody Map<String, Object> params) {
Map<String,Object> map = userVipLogService.getUserVipLogInfoTotal(params.get("date").toString());
return R.ok().put("total", map);
}
@RequestMapping("/getUserVipLogInfoList")
public R getUserVipLogInfoList(@RequestBody Map<String, Object> params) {
List<Map<String,Object>> maps = userVipLogService.getUserVipLogInfoList(params.get("date").toString());
return R.ok().put("list", maps);
}
//导出vip记录明细
@RequestMapping("/exportUserVipLogInfo")
public void exportUserVipLogInfo(HttpServletResponse response, @RequestBody Map<String,Object> params){
List<Map<String,Object>> maps = userVipLogService.getUserVipLogInfoList(params.get("date").toString());
XSSFWorkbook wb = new XSSFWorkbook();
//创建一张表
Sheet sheet = wb.createSheet("vip记录明细");
//创建第一行起始为0
Row titleRow = sheet.createRow(0);
titleRow.createCell(0).setCellValue("姓名");
titleRow.createCell(1).setCellValue("电话");
titleRow.createCell(2).setCellValue("VIP类型");
titleRow.createCell(3).setCellValue("开始时间");
titleRow.createCell(4).setCellValue("结束时间");
titleRow.createCell(5).setCellValue("订单号");
titleRow.createCell(6).setCellValue("支付方式");
titleRow.createCell(7).setCellValue("备注");
titleRow.createCell(8).setCellValue("金额");
titleRow.createCell(9).setCellValue("总天数");
titleRow.createCell(10).setCellValue("每日摊销");
titleRow.createCell(11).setCellValue("已摊销天数");
titleRow.createCell(12).setCellValue("当月摊销天数");
titleRow.createCell(13).setCellValue("未摊销天数");
titleRow.createCell(14).setCellValue("已摊销金额");
titleRow.createCell(15).setCellValue("当月摊销金额");
titleRow.createCell(16).setCellValue("剩余摊销金额");
//序号默认为1
int cell = 1;
//遍历
for (Map<String,Object> map : maps) {
Row row = sheet.createRow(cell);
row.createCell(0).setCellValue(map.get("name").toString());
row.createCell(1).setCellValue(map.get("tel").toString());
row.createCell(2).setCellValue(map.get("type").toString());
row.createCell(3).setCellValue(map.get("startTime").toString());
row.createCell(4).setCellValue(map.get("endTime").toString());
row.createCell(5).setCellValue(map.get("orderSn").toString());
row.createCell(6).setCellValue(map.get("payType").toString());
row.createCell(7).setCellValue(map.get("remark").toString());
row.createCell(8).setCellValue(map.get("fee").toString());
row.createCell(9).setCellValue(map.get("totalDays").toString());
row.createCell(10).setCellValue(map.get("dayAmount").toString());
row.createCell(11).setCellValue(map.get("alreadyDays").toString());
row.createCell(12).setCellValue(map.get("currentDays").toString());
row.createCell(13).setCellValue(map.get("notyetDays").toString());
row.createCell(14).setCellValue(map.get("alreadyTanxiao").toString());
row.createCell(15).setCellValue(map.get("currentTanxiao").toString());
row.createCell(16).setCellValue(map.get("notyetTanxiao").toString());
//序号自增
cell++;
}
String fileName = "vip记录明细.xlsx";
OutputStream outputStream =null;
try {
//文件名编码格式
fileName = URLEncoder.encode(fileName,"UTF-8");
//设置ContentType请求信息格式
response.setContentType("application/vnd.ms-excel");
//设置标头
response.setHeader("Content-disposition", "attachment;filename=" + fileName);
outputStream = response.getOutputStream();
wb.write(outputStream);
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@RequestMapping("/getUserVipList") @RequestMapping("/getUserVipList")
public R getUserVipList(@RequestBody Map<String, Object> params) { public R getUserVipList(@RequestBody Map<String, Object> params) {
MPJLambdaWrapper<MyUserEntity> wrapper = new MPJLambdaWrapper(); MPJLambdaWrapper<MyUserEntity> wrapper = new MPJLambdaWrapper();
@@ -153,6 +60,9 @@ public class UserVipController {
if (params.containsKey("state")&& StringUtils.isNotEmpty(params.get("state").toString())) { if (params.containsKey("state")&& StringUtils.isNotEmpty(params.get("state").toString())) {
wrapper.eq(UserVip::getState,params.get("state")); wrapper.eq(UserVip::getState,params.get("state"));
} }
if (params.containsKey("isLog")&& StringUtils.isNotEmpty(params.get("isLog").toString())) {
wrapper.inSql(UserVip::getUserId,"select user_id from (select uv.*,uvl.id uvlid from user_vip uv left join user_vip_log uvl on uvl.user_vip_id = uv.id where uv.del_flag = 0 ) t where t.uvlid is null group by user_id");
}
wrapper.groupBy(UserVip::getUserId); wrapper.groupBy(UserVip::getUserId);
Page<MyUserEntity> page = userService.page(new Page<>( Page<MyUserEntity> page = userService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper); Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);

View File

@@ -50,6 +50,53 @@
<!-- <resultMap id="OrderDetailResult" type="com.peanut.modules.book.entity.BuyOrderDetail">--> <!-- <resultMap id="OrderDetailResult" type="com.peanut.modules.book.entity.BuyOrderDetail">-->
<!-- </resultMap>--> <!-- </resultMap>-->
<select id="getPhysicalBuyOrderTotal" resultType="map">
select payType,count(1) count,SUM(price) totalPrice from (
select t.createTime,t.name,t.tel,t.orderSn,t.orderStatus,t.payType,t.orderPrice,
t.orderPrice-(select IF(SUM(sp2.price) is NULL,0,SUM(sp2.price)) from shop_product sp2 where sp2.goods_type = '05' and sp2.product_id in (GROUP_CONCAT(sp.product_id SEPARATOR ','))) price,
GROUP_CONCAT(sp.product_name SEPARATOR ', ') productName
from (
select bo.order_id,DATE_FORMAT(bo.create_time,'%Y-%m-%d %H:%i:%s') createTime,u.name,if(u.tel is null,if(u.email is null,'',u.email),u.tel) tel,bo.order_sn orderSn,
IF(bo.payment_method=1,'微信',IF(bo.payment_method=2,'支付宝',IF(bo.payment_method=4,'天医币','0'))) payType,
IF(bo.order_status = 4,'已删除',IF(bo.order_status = 3,'已完成',IF(bo.order_status = 2,'已发货','已付款'))) orderStatus,bo.real_money orderPrice
from buy_order bo
left join user u on u.id = bo.user_id
left join buy_order_product bop on bop.order_id = bo.order_id
left join shop_product sp on sp.product_id = bop.product_id
where u.id not in (select id from user where tel in ('18812616272','13110039505','18526084267','12222222222','13333333333','14444444444','15555555555','16666666666','17777777777','18888888888','1774455','15533','165965','164964','54321','111','13662001490','15505153873','18834844847','17602219785','19999999999','12299','166933','16855','17602634511','16161616161','17171717171','112112112','21212121211','222222','666666','123123','789789','96','25252525','3434343434','123789','124789','789789','163963','5656','19966','1664455','15151515151','256366','986986','18834844846','18834844849','15611027864','18047689535','18834844848','456456456'))
and bo.order_status in (1,2,3,4) and sp.goods_type != '05'
and DATE_FORMAT(bo.create_time,'%Y-%m') = #{date}
group by bo.order_sn
) t
left join buy_order_product bop on bop.order_id = t.order_id
left join shop_product sp on sp.product_id = bop.product_id
group by t.orderSn
) s
group by payType
</select>
<select id="exportPhysicalBuyOrderInfo" resultType="map">
select t.createTime,t.name,t.tel,t.orderSn,t.orderStatus,t.payType,t.orderPrice,
t.orderPrice-(select IF(SUM(sp2.price) is NULL,0,SUM(sp2.price)) from shop_product sp2 where sp2.goods_type = '05' and sp2.product_id in (GROUP_CONCAT(sp.product_id SEPARATOR ','))) price,
GROUP_CONCAT(sp.product_name SEPARATOR ', ') productName
from (
select bo.order_id,DATE_FORMAT(bo.create_time,'%Y-%m-%d %H:%i:%s') createTime,u.name,if(u.tel is null,if(u.email is null,'',u.email),u.tel) tel,bo.order_sn orderSn,
IF(bo.payment_method=1,'微信',IF(bo.payment_method=2,'支付宝',IF(bo.payment_method=4,'天医币','0'))) payType,
IF(bo.order_status = 4,'已删除',IF(bo.order_status = 3,'已完成',IF(bo.order_status = 2,'已发货','已付款'))) orderStatus,bo.real_money orderPrice
from buy_order bo
left join user u on u.id = bo.user_id
left join buy_order_product bop on bop.order_id = bo.order_id
left join shop_product sp on sp.product_id = bop.product_id
where u.id not in (select id from user where tel in ('18812616272','13110039505','18526084267','12222222222','13333333333','14444444444','15555555555','16666666666','17777777777','18888888888','1774455','15533','165965','164964','54321','111','13662001490','15505153873','18834844847','17602219785','19999999999','12299','166933','16855','17602634511','16161616161','17171717171','112112112','21212121211','222222','666666','123123','789789','96','25252525','3434343434','123789','124789','789789','163963','5656','19966','1664455','15151515151','256366','986986','18834844846','18834844849','15611027864','18047689535','18834844848','456456456'))
and bo.order_status in (1,2,3,4) and sp.goods_type != '05'
and DATE_FORMAT(bo.create_time,'%Y-%m') = #{date}
group by bo.order_sn
) t
left join buy_order_product bop on bop.order_id = t.order_id
left join shop_product sp on sp.product_id = bop.product_id
group by t.orderSn
</select>
<select id="queryListByOrderIds" resultType="com.peanut.modules.common.entity.BuyOrder"> <select id="queryListByOrderIds" resultType="com.peanut.modules.common.entity.BuyOrder">
select select

View File

@@ -18,5 +18,48 @@
<result property="note" column="note"/> <result property="note" column="note"/>
</resultMap> </resultMap>
<select id="getTransactionDetailsTotal" resultType="map">
select type,payType,SUM(changeAmount) amount
from (
select t.*,
IF(IF(GROUP_CONCAT(sp.product_name SEPARATOR ',') is NULL,bo.remark,GROUP_CONCAT(sp.product_name SEPARATOR ',')) is NULL,'',IF((GROUP_CONCAT(sp.goods_type SEPARATOR ',') like '%,05%') or (GROUP_CONCAT(sp.goods_type SEPARATOR ',') like '05,'),'实物、课程',IF(GROUP_CONCAT(sp.goods_type SEPARATOR ',')='05','课程',IF(bo.order_type='relearn','课程',IF(bo.order_type='trainingClass','培训班','实物'))))) goodsType,
IF(IF(GROUP_CONCAT(sp.product_name SEPARATOR ',') is NULL,bo.remark,GROUP_CONCAT(sp.product_name SEPARATOR ',')) is NULL,'',IF(GROUP_CONCAT(sp.product_name SEPARATOR ',') is NULL,bo.remark,GROUP_CONCAT(sp.product_name SEPARATOR ','))) productName
from (
select td.transaction_id id,DATE_FORMAT(td.create_time,'%Y-%m-%d %H:%i:%s') createTime,u.name,if(u.tel is null,if(u.email is null,'',u.email),u.tel) tel,IF(td.order_type='后台充扣操作',IF(td.remark='充值','后台充值','后台扣费'),td.order_type) type
,IF(td.remark like '%微信%','微信',IF(td.remark like '%苹果%','苹果',IF(td.remark like '%支付宝%','支付宝',IF(td.order_type = '后台充扣操作' and td.remark = '充值' and note = '二维码','后台微信','')))) payType
,IF(REGEXP_SUBSTR(td.remark, '[0-9]{32}$') is NULL,'',REGEXP_SUBSTR(td.remark, '[0-9]{32}$')) orderSn
,td.change_amount changeAmount,IF(td.note is NULL,'',td.note) note
from transaction_details td
left join user u on u.id = td.user_id
where DATE_FORMAT(td.create_time,'%Y-%m') = #{date} and td.user_id not in (select id from user where tel in ('18812616272','13110039505','18526084267','12222222222','13333333333','14444444444','15555555555','16666666666','17777777777','18888888888','1774455','15533','165965','164964','54321','111','13662001490','15505153873','18834844847','17602219785','19999999999','12299','166933','16855','17602634511','16161616161','17171717171','112112112','21212121211','222222','666666','123123','789789','96','25252525','3434343434','123789','124789','789789','163963','5656','19966','1664455','15151515151','256366','986986','18834844846','18834844849','15611027864','18047689535','18834844848','456456456'))
) t
left join buy_order bo on bo.order_sn = t.orderSn
left join buy_order_product bop on bop.order_id = bo.order_id
left join shop_product sp on sp.product_id = bop.product_id
group by t.id
order by t.createTime
) s
group by type,payType
</select>
<select id="getTransactionDetailsInfo" resultType="map">
select t.*,
IF(IF(GROUP_CONCAT(sp.product_name SEPARATOR ',') is NULL,bo.remark,GROUP_CONCAT(sp.product_name SEPARATOR ',')) is NULL,'',IF((GROUP_CONCAT(sp.goods_type SEPARATOR ',') like '%,05%') or (GROUP_CONCAT(sp.goods_type SEPARATOR ',') like '05,'),'实物、课程',IF(GROUP_CONCAT(sp.goods_type SEPARATOR ',')='05','课程',IF(bo.order_type='relearn','课程',IF(bo.order_type='trainingClass','培训班','实物'))))) goodsType,
IF(IF(GROUP_CONCAT(sp.product_name SEPARATOR ',') is NULL,bo.remark,GROUP_CONCAT(sp.product_name SEPARATOR ',')) is NULL,'',IF(GROUP_CONCAT(sp.product_name SEPARATOR ',') is NULL,bo.remark,GROUP_CONCAT(sp.product_name SEPARATOR ','))) productName
from (
select td.transaction_id id,DATE_FORMAT(td.create_time,'%Y-%m-%d %H:%i:%s') createTime,u.name,if(u.tel is null,if(u.email is null,'',u.email),u.tel) tel,IF(td.order_type='后台充扣操作',IF(td.remark='充值','后台充值','后台扣费'),td.order_type) type
,IF(td.remark like '%微信%','微信',IF(td.remark like '%苹果%','苹果',IF(td.remark like '%支付宝%','支付宝',IF(td.order_type = '后台充扣操作' and td.remark = '充值' and note = '二维码','后台微信','')))) payType
,IF(REGEXP_SUBSTR(td.remark, '[0-9]{32}$') is NULL,'',REGEXP_SUBSTR(td.remark, '[0-9]{32}$')) orderSn
,td.change_amount changeAmount,IF(td.note is NULL,'',td.note) note
from transaction_details td
left join user u on u.id = td.user_id
where DATE_FORMAT(td.create_time,'%Y-%m') = #{date} and td.user_id not in (select id from user where tel in ('18812616272','13110039505','18526084267','12222222222','13333333333','14444444444','15555555555','16666666666','17777777777','18888888888','1774455','15533','165965','164964','54321','111','13662001490','15505153873','18834844847','17602219785','19999999999','12299','166933','16855','17602634511','16161616161','17171717171','112112112','21212121211','222222','666666','123123','789789','96','25252525','3434343434','123789','124789','789789','163963','5656','19966','1664455','15151515151','256366','986986','18834844846','18834844849','15611027864','18047689535','18834844848','456456456'))
) t
left join buy_order bo on bo.order_sn = t.orderSn
left join buy_order_product bop on bop.order_id = bo.order_id
left join shop_product sp on sp.product_id = bop.product_id
group by t.id
order by t.createTime
</select>
</mapper> </mapper>

View File

@@ -3,7 +3,7 @@
<mapper namespace="com.peanut.modules.common.dao.UserVipLogDao"> <mapper namespace="com.peanut.modules.common.dao.UserVipLogDao">
<select id="getUserVipLogInfoList" resultType="map"> <select id="getUserVipLogInfo" resultType="map">
select t.*,dayAmount*alreadyDays alreadyTanxiao, dayAmount*currentDays currentTanxiao, fee-(dayAmount*alreadyDays)-(dayAmount*currentDays) notyetTanxiao select t.*,dayAmount*alreadyDays alreadyTanxiao, dayAmount*currentDays currentTanxiao, fee-(dayAmount*alreadyDays)-(dayAmount*currentDays) notyetTanxiao
from ( from (
select u.name,if(u.tel is null,if(u.email is null,'',u.email),u.tel) tel,IF(uv.type=4,'中医学',IF(uv.type=5,'针灸学',IF(uv.type=6,'肿瘤学',IF(uv.type=7,'国学',IF(uv.type=8,'心理学','中西汇通学'))))) type, select u.name,if(u.tel is null,if(u.email is null,'',u.email),u.tel) tel,IF(uv.type=4,'中医学',IF(uv.type=5,'针灸学',IF(uv.type=6,'肿瘤学',IF(uv.type=7,'国学',IF(uv.type=8,'心理学','中西汇通学'))))) type,