|
|
@@ -1,10 +1,13 @@
|
|
|
package org.springblade.gateway.shop_gateway.controller;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.SneakyThrows;
|
|
|
+import org.springblade.common.enums.AppConstant;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
@@ -19,6 +22,8 @@ import org.springblade.ldt.bills.entity.Bills;
|
|
|
import org.springblade.ldt.bills.service.IBillsService;
|
|
|
import org.springblade.ldt.shop.entity.Shop;
|
|
|
import org.springblade.ldt.shop.service.IShopService;
|
|
|
+import org.springblade.ldt.shop.vo.ShopVO;
|
|
|
+import org.springblade.ldt.shop.wrapper.ShopWrapper;
|
|
|
import org.springblade.ldt.user.entity.Member;
|
|
|
import org.springblade.ldt.user.service.IMemberService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -43,6 +48,17 @@ public class AppShopController {
|
|
|
private IBillsService billsService;
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 分页
|
|
|
+ */
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入shop")
|
|
|
+ public R<IPage<ShopVO>> list(@RequestParam Map<String,Object> shop, Query query) {
|
|
|
+ IPage<Shop> pages = shopService.page(Condition.getPage(query), Condition.getQueryWrapper(shop,Shop.class).lambda());
|
|
|
+ return R.data(ShopWrapper.build().pageVO(pages));
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("submitAudit")
|
|
|
@ApiOperation(value = "商户提交审核")
|
|
|
public R submitAudit(@RequestBody ShopAuditDto shopAuditDto) {
|
|
|
@@ -58,7 +74,8 @@ public class AppShopController {
|
|
|
int newMembers = memberService.getBaseMapper().selectCount(new QueryWrapper<Member>()
|
|
|
.lambda()
|
|
|
.eq(Member::getShopId,shopId)
|
|
|
- .lt(Member::getCreateTime, DateUtil.beginOfDay(new Date()))
|
|
|
+ .ge(Member::getCreateTime, DateUtil.beginOfDay(new Date()))
|
|
|
+ .le(Member::getCreateTime, DateUtil.beginOfDay(new Date()))
|
|
|
);
|
|
|
//店铺会员总数
|
|
|
int allMembers = getTotalMembers(shopId);
|
|
|
@@ -67,22 +84,36 @@ public class AppShopController {
|
|
|
Shop shop = shopService.getById(shopId);
|
|
|
BigDecimal totalValue = shop.getBalance().add(shop.getCharge());
|
|
|
|
|
|
+ //积分总价值
|
|
|
+ BigDecimal pointsTotalValue = shop.getTotalValue();
|
|
|
+
|
|
|
+
|
|
|
+ //交易笔数
|
|
|
+ int transactionNum = billsService.count(Condition.getQueryWrapper(new Bills()).lambda()
|
|
|
+ .eq(Bills::getReceiveId, shopId)
|
|
|
+ .eq(Bills::getPaystatus, AppConstant.BillPayStatus.付款成功.name()));
|
|
|
+
|
|
|
//今日营收
|
|
|
QueryWrapper<Bills> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.select("IFNULL(sum(price),0) as todayCharge")
|
|
|
.lambda()
|
|
|
.eq(Bills::getReceiveId, shopId)
|
|
|
- .lt(Bills::getCreateTime, DateUtil.beginOfDay(new Date()));
|
|
|
+ .eq(Bills::getPaystatus, AppConstant.BillPayStatus.付款成功.name())
|
|
|
+ .ge(Bills::getCreateTime, DateUtil.beginOfDay(new Date()))
|
|
|
+ .le(Bills::getCreateTime, DateUtil.beginOfDay(new Date()));
|
|
|
+
|
|
|
Map<String, Object> map = billsService.getMap(queryWrapper);
|
|
|
BigDecimal todayCharge = (BigDecimal) map.get("todayCharge");
|
|
|
|
|
|
return R.data(
|
|
|
IndexVO.builder()
|
|
|
- .totalValue(totalValue)
|
|
|
- .todayCharge(todayCharge)
|
|
|
- .allMembers(allMembers)
|
|
|
- .newMember(newMembers)
|
|
|
- .build()
|
|
|
+ .totalValue(totalValue)
|
|
|
+ .todayCharge(todayCharge)
|
|
|
+ .allMembers(allMembers)
|
|
|
+ .pointsTotalValue(pointsTotalValue)
|
|
|
+ .transactionNum(transactionNum)
|
|
|
+ .newMember(newMembers)
|
|
|
+ .build()
|
|
|
);
|
|
|
}
|
|
|
|