Merge remote-tracking branch 'origin/test'
commit
27d4c6b2ee
|
@ -20,10 +20,10 @@ public class PageParam implements Serializable {
|
|||
@Min(value = 1, message = "页码最小值为 1")
|
||||
private Integer pageNo = PAGE_NO;
|
||||
|
||||
@Schema(description = "每页条数,最大值为 100", required = true, example = "10")
|
||||
@Schema(description = "每页条数,最大值为 1000", required = true, example = "10")
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
@Min(value = 1, message = "每页条数最小值为 1")
|
||||
@Max(value = 100, message = "每页条数最大值为 100")
|
||||
@Max(value = 100, message = "每页条数最大值为 1000")
|
||||
private Integer pageSize = PAGE_SIZE;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 充值档位 Excel VO
|
||||
*
|
||||
* @author 创盈云
|
||||
*/
|
||||
@Data
|
||||
public class StatisticsExcelVO {
|
||||
@ExcelProperty("租户id")
|
||||
private Long tenantId;
|
||||
@ExcelProperty("租户名称")
|
||||
private String tenantName;
|
||||
@ExcelProperty("总销售金额")
|
||||
private BigDecimal totalMoney;
|
||||
@ExcelProperty("总订单数量")
|
||||
private Integer totalNum;
|
||||
@ExcelProperty("总退款金额")
|
||||
private BigDecimal totalWithdrawMoney;
|
||||
@ExcelProperty("240档订单数量")
|
||||
private Integer threeTotalNum;
|
||||
@ExcelProperty("400档订单数量")
|
||||
private Integer twoTotalNum;
|
||||
@ExcelProperty("640档订单数量")
|
||||
private Integer oneTotalNum;
|
||||
|
||||
}
|
|
@ -1,27 +1,36 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.statement;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeGearRespVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqVo;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsExcelVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsPageVo;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrderStatus;
|
||||
import cn.iocoder.yudao.module.shop.request.order.StatementAllRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.order.StatementPageRequest;
|
||||
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
/**
|
||||
* @Title:StatementController
|
||||
* @Description: 报表
|
||||
|
@ -54,4 +63,23 @@ public class StatementController {
|
|||
}
|
||||
|
||||
|
||||
@GetMapping("/statement-excel")
|
||||
@Operation(summary = "导出数据统计(根据租户统计) Excel")
|
||||
@OperateLog(type = EXPORT)
|
||||
@TenantIgnore
|
||||
public void exportRechargeGearExcel(@Valid StatementPageRequest request,
|
||||
HttpServletResponse response) throws IOException {
|
||||
PageInfo<StatisticsPageVo> statistics = storeOrderService.statistics(request);
|
||||
List<StatisticsExcelVO> list = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(statistics.getList())) {
|
||||
statistics.getList().forEach(e -> {
|
||||
StatisticsExcelVO vo = new StatisticsExcelVO();
|
||||
BeanUtils.copyProperties(e,vo);
|
||||
list.add(vo);
|
||||
});
|
||||
}
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "导出数据统计(根据租户统计).xls", "数据", StatisticsExcelVO.class, list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1463,11 +1463,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
request.setEndTime(LocalDateTimeUtil.endOfDay(lastDay));
|
||||
}
|
||||
}
|
||||
LocalDateTime todayOfLastWeek = LocalDateTime.now().minusDays(7);
|
||||
LocalDateTime monday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
|
||||
LocalDateTime sunday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
|
||||
request.setStartTime(LocalDateTimeUtil.beginOfDay(monday));
|
||||
request.setEndTime(LocalDateTimeUtil.endOfDay(sunday));
|
||||
List<StatementAllReqDataVo> dataVos = mapper.statisticsAll(request.getStartTime(), request.getEndTime());
|
||||
if (!CollectionUtils.isEmpty(dataVos)) {
|
||||
reqVo.setTotalMoney(BigDecimal.valueOf(dataVos.stream().filter(x -> x.getRefundStatus() != 2).mapToDouble(StatementAllReqDataVo::getPrice).sum()));
|
||||
|
|
|
@ -106,8 +106,8 @@
|
|||
e.name as tenantName,
|
||||
a.out_trade_no,
|
||||
a.pay_time,
|
||||
a.real_name as nickname,
|
||||
a.real_name,
|
||||
b.nickname,
|
||||
b.nickname as realName,
|
||||
a.uid,
|
||||
a.user_phone,
|
||||
a.confirm_phone,
|
||||
|
@ -249,9 +249,9 @@
|
|||
<if test="data.nickname !=null and data.nickname!=''">
|
||||
and b.nickname like CONCAT('%',#{data.nickname},'%')
|
||||
</if>
|
||||
<if test="data.realName !=null and data.realName!=''">
|
||||
<!--<if test="data.realName !=null and data.realName!=''">
|
||||
and a.real_name like CONCAT('%',#{data.realName},'%')
|
||||
</if>
|
||||
</if>-->
|
||||
<if test="data.userPhone !=null and data.userPhone!=''">
|
||||
and a.user_phone like CONCAT('%',#{data.userPhone},'%')
|
||||
</if>
|
||||
|
|
Loading…
Reference in New Issue