|
@@ -1,20 +1,15 @@
|
|
|
package shop.alien.store.controller;
|
|
package shop.alien.store.controller;
|
|
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import shop.alien.entity.store.LifeCoupon;
|
|
import shop.alien.entity.store.LifeCoupon;
|
|
|
-import shop.alien.entity.store.vo.StoreInfoVo;
|
|
|
|
|
import shop.alien.mapper.LifeCouponMapper;
|
|
import shop.alien.mapper.LifeCouponMapper;
|
|
|
import shop.alien.mapper.StoreInfoMapper;
|
|
import shop.alien.mapper.StoreInfoMapper;
|
|
|
|
|
|
|
|
-import java.util.*;
|
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 套餐
|
|
* 套餐
|
|
@@ -31,72 +26,6 @@ public class PingtaiTaocanController {
|
|
|
|
|
|
|
|
private final StoreInfoMapper storeInfoMapper;
|
|
private final StoreInfoMapper storeInfoMapper;
|
|
|
|
|
|
|
|
- @GetMapping("getTaocanList")
|
|
|
|
|
- private Map<String, Object> getTaocanList(@RequestParam(value = "page", defaultValue = "1") int page,
|
|
|
|
|
- @RequestParam(value = "size", defaultValue = "10") int size,
|
|
|
|
|
- @RequestParam("storeName") String storeName,
|
|
|
|
|
- @RequestParam("status") String status) {
|
|
|
|
|
- log.info("LifeCouponController.getTaocanList?page={},size={},storeName={},status={}", page, size, storeName, status);
|
|
|
|
|
- Map<String, Object> returnMap = new HashMap<>();
|
|
|
|
|
- IPage<LifeCoupon> quanPage = new Page<>(page, size);
|
|
|
|
|
- LambdaUpdateWrapper<LifeCoupon> wrapper = new LambdaUpdateWrapper<>();
|
|
|
|
|
- if (storeName != null && !storeName.isEmpty()) {
|
|
|
|
|
- QueryWrapper<StoreInfoVo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
- queryWrapper.eq("a.store_name", storeName).eq("a.delete_flag", 0);
|
|
|
|
|
- List<StoreInfoVo> storeInfoVoList = storeInfoMapper.getStoreInfoVoList(queryWrapper);
|
|
|
|
|
- if (storeInfoVoList.isEmpty()) {
|
|
|
|
|
- return returnMap;
|
|
|
|
|
- }
|
|
|
|
|
- List<Integer> storeIds = storeInfoVoList.stream().map(StoreInfoVo::getId).collect(Collectors.toList());
|
|
|
|
|
- wrapper.in(LifeCoupon::getStoreId, storeIds);
|
|
|
|
|
- }
|
|
|
|
|
- if (status != null && !status.isEmpty()) {
|
|
|
|
|
- if (status.equals("0")) {
|
|
|
|
|
- List<Integer> statuss = new ArrayList<>();
|
|
|
|
|
- statuss.add(0);
|
|
|
|
|
- statuss.add(1);
|
|
|
|
|
- statuss.add(2);
|
|
|
|
|
- statuss.add(3);
|
|
|
|
|
- wrapper.in(LifeCoupon::getStatus, statuss);
|
|
|
|
|
- } else {
|
|
|
|
|
- wrapper.eq(LifeCoupon::getStatus, Integer.valueOf(status));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- wrapper.eq(LifeCoupon::getType, 2);
|
|
|
|
|
- wrapper.orderByDesc(LifeCoupon::getUpdatedTime);
|
|
|
|
|
- IPage<LifeCoupon> lifeyouhuiquans = lifeCouponMapper.selectPage(quanPage, wrapper);
|
|
|
|
|
- int totalCnt = lifeCouponMapper.selectCount(wrapper);
|
|
|
|
|
- if (lifeyouhuiquans.getRecords().isEmpty()) {
|
|
|
|
|
- return returnMap;
|
|
|
|
|
- }
|
|
|
|
|
- List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
|
|
- for (LifeCoupon taocan : lifeyouhuiquans.getRecords()) {
|
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
|
- QueryWrapper<StoreInfoVo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
- queryWrapper.eq("a.id", taocan.getStoreId()).eq("a.delete_flag", 0);
|
|
|
|
|
- StoreInfoVo storeInfoVoOne = storeInfoMapper.getStoreInfoVoOne(queryWrapper);
|
|
|
|
|
- map.put("id", taocan.getId());
|
|
|
|
|
- map.put("storeName", storeInfoVoOne.getStoreName());
|
|
|
|
|
- map.put("phoneNum", storeInfoVoOne.getStorePhone());
|
|
|
|
|
- map.put("tijiaoTime", taocan.getCreatedTime());
|
|
|
|
|
- String statusStr;
|
|
|
|
|
- if (taocan.getStatus() == -1) {
|
|
|
|
|
- statusStr = "待审核";
|
|
|
|
|
- } else if (taocan.getStatus() == -2) {
|
|
|
|
|
- statusStr = "已驳回";
|
|
|
|
|
- } else {
|
|
|
|
|
- statusStr = "已通过";
|
|
|
|
|
- }
|
|
|
|
|
- map.put("status", statusStr);
|
|
|
|
|
- map.put("taocanName", taocan.getName());
|
|
|
|
|
- mapList.add(map);
|
|
|
|
|
- }
|
|
|
|
|
- returnMap.put("data", mapList);
|
|
|
|
|
- returnMap.put("total", totalCnt);
|
|
|
|
|
- returnMap.put("current", quanPage.getCurrent());
|
|
|
|
|
- returnMap.put("size", quanPage.getSize());
|
|
|
|
|
- return returnMap;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
@GetMapping("getTaocanDetial")
|
|
@GetMapping("getTaocanDetial")
|
|
|
private LifeCoupon getTaocanList(@RequestParam("id") String id) {
|
|
private LifeCoupon getTaocanList(@RequestParam("id") String id) {
|