|
@@ -0,0 +1,91 @@
|
|
|
+package com.qs.mp.web.controller.api.admin;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.qs.mp.admin.domain.param.IndexQueryParam;
|
|
|
+import com.qs.mp.admin.domain.vo.IndexVO;
|
|
|
+import com.qs.mp.channel.domain.Channel;
|
|
|
+import com.qs.mp.channel.service.IChannelService;
|
|
|
+import com.qs.mp.common.core.domain.AjaxResult;
|
|
|
+import com.qs.mp.common.utils.DateUtils;
|
|
|
+import com.qs.mp.user.domain.UserDeliverOrder;
|
|
|
+import com.qs.mp.user.service.IUserTicketOrderService;
|
|
|
+import com.qs.mp.utils.SecurityUtils;
|
|
|
+import com.qs.mp.web.controller.common.BaseApiController;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @auther quanshu
|
|
|
+ * @create 2022-03-31 16:17:48
|
|
|
+ * @describe 首页渠道管理前端控制器
|
|
|
+ */
|
|
|
+@Api("首页管理API")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/v1/mp/admin/index/*")
|
|
|
+@Component
|
|
|
+public class IndexMgrController extends BaseApiController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IChannelService channelService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IUserTicketOrderService userTicketOrderService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询统计交易金额
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/pay/amt")
|
|
|
+ // @PreAuthorize("@ss.hasPermi('business:channel:list')")
|
|
|
+ public AjaxResult listChannel(@RequestBody IndexQueryParam indeQueryParam) {
|
|
|
+
|
|
|
+ IndexQueryParam queryParam = getQueryParam(indeQueryParam);
|
|
|
+
|
|
|
+ List<IndexVO> list = new ArrayList<IndexVO>();
|
|
|
+ QueryWrapper<UserDeliverOrder> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.ge(null != queryParam && null != queryParam.getStartTime(), "DATE_FORMAT(t1.created_time, '%Y-%m-%d')", queryParam.getStartTime());
|
|
|
+ queryWrapper.le(null != queryParam && null != queryParam.getEndTime(), "DATE_FORMAT(t1.created_time, '%Y-%m-%d')", queryParam.getEndTime());
|
|
|
+ queryWrapper.gt("t1.`status`", 0);
|
|
|
+ Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
|
+ if(null != channelId && 0 != channelId) {
|
|
|
+ Channel channel = channelService.getById(channelId);
|
|
|
+ if(null!=channel && StringUtils.isNotBlank(channel.getChannelNo())) {
|
|
|
+ queryWrapper.and(wrapper -> wrapper.likeRight("t2.channel_no", channel.getChannelNo())
|
|
|
+ .or().eq("t2.channel_no", channel.getChannelNo()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ list = userTicketOrderService.selectIndexPayAmtList(queryWrapper);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化查询参数
|
|
|
+ * @param indeQueryParam
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private IndexQueryParam getQueryParam(IndexQueryParam indeQueryParam) {
|
|
|
+ IndexQueryParam queryParam = new IndexQueryParam();
|
|
|
+ queryParam.setDays(null != indeQueryParam && null != indeQueryParam.getDays()?indeQueryParam.getDays():7);
|
|
|
+ queryParam.setLevel(null != indeQueryParam && StringUtils.isNotBlank(indeQueryParam.getLevel())?indeQueryParam.getLevel():"day");
|
|
|
+ if(queryParam.getDays() == 0) { // 自定义
|
|
|
+
|
|
|
+ }else {
|
|
|
+ queryParam.setStartTime(new Date());
|
|
|
+ queryParam.setEndTime(DateUtils.getNowDate());
|
|
|
+ }
|
|
|
+ return queryParam;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|