liujie
2023-10-07 44311853fa68f04db11d341bd374a4ac9b5ea567
cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -12,6 +12,8 @@
import com.dsh.activity.feignclient.other.StoreClient;
import com.dsh.activity.feignclient.other.model.Store;
import com.dsh.activity.feignclient.other.model.StoreDetailOfCourse;
import com.dsh.activity.model.CoachChangeStateVO;
import com.dsh.activity.model.PointMerchandiseIncomeVo;
import com.dsh.activity.model.PointMerchandiseVo;
import com.dsh.activity.model.request.*;
import com.dsh.activity.model.response.GoodsInfoOneVo;
@@ -73,7 +75,78 @@
    @Resource
    private CouponCityService ccityService;
    @Autowired
    private UserPointsMerchandiseService userPointsMerchandiseService;
    /**
     * 门票上下架 state=1 上架 state=2 下架
     */
    @RequestMapping("/base/pointMerchars/changeState")
    public Object changeState(@RequestBody CoachChangeStateVO dto){
        return pmdsService.changeState(dto);
    }
    @ResponseBody
    @PostMapping("/base/pointMerchars/ticketList")
    public List<Map<String,Object>> ticketList(@RequestBody IntegralGoodsOfSearch ofSearch){
        List<Map<String, Object>> result = pmdsService.ticketList(ofSearch);
        if (result.size() > 0){
            for (Map<String, Object> stringObjectMap : result) {
                Integer o = (Integer) stringObjectMap.get("id");
                String startTime = (String) stringObjectMap.get("startTime");
                String endTime = (String) stringObjectMap.get("endTime");
                stringObjectMap.put("timeValue",startTime + "至"+endTime);
                int count1 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>()
                        .eq(UserPointsMerchandise::getPointsMerchandiseId, o));
                int count2 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>()
                        .eq(UserPointsMerchandise::getPointsMerchandiseId, o)
                        .eq(UserPointsMerchandise::getStatus,2));
                stringObjectMap.put("hasExchangeQty",count1);
                stringObjectMap.put("hasPickQty",count2);
                stringObjectMap.put("activeStatus",dealTimeStatus(startTime,endTime));
            }
            if (ToolUtil.isNotEmpty(ofSearch.getActiveStatus())){
                result = dealTimeData(result,ofSearch.getActiveStatus());
            }
        }
        return result;
    }
    @ResponseBody
    @PostMapping("/base/pointMerchars/queryGoodsListSearch")
    public List<Map<String,Object>> getIntegralGoodsListOfSearch(@RequestBody IntegralGoodsOfSearch ofSearch){
        System.out.println(ofSearch);
        List<Map<String, Object>> mapList = pmdsService.queryGoodsListOfSearch(ofSearch);
        if (mapList.size() > 0){
            for (Map<String, Object> stringObjectMap : mapList) {
                Integer o = (Integer) stringObjectMap.get("id");
                String startTime = (String) stringObjectMap.get("startTime");
                String endTime = (String) stringObjectMap.get("endTime");
                stringObjectMap.put("timeValue",startTime + "至"+endTime);
                int count1 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>()
                        .eq(UserPointsMerchandise::getPointsMerchandiseId, o));
                int count2 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>()
                        .eq(UserPointsMerchandise::getPointsMerchandiseId, o)
                        .eq(UserPointsMerchandise::getStatus,2));
                stringObjectMap.put("hasExchangeQty",count1);
                stringObjectMap.put("hasPickQty",count2);
                stringObjectMap.put("activeStatus",dealTimeStatus(startTime,endTime));
            }
            if (ToolUtil.isNotEmpty(ofSearch.getActiveStatus())){
                mapList = dealTimeData(mapList,ofSearch.getActiveStatus());
            }
        }
        System.out.println("mapList->"+mapList);
        return mapList;
    }
    /**
     * 获取积分商票消费金额
     */
    @ResponseBody
    @RequestMapping("/base/pointMerchars/getAmount")
    public List<PointMerchandiseIncomeVo> getAmount(){
        return  userPointsMerchandiseService.getAmount();
    }
    @Resource
    private PointsMerchandiseCityService pmdsCityService;
@@ -549,34 +622,7 @@
    }
    @ResponseBody
    @PostMapping("/base/pointMerchars/queryGoodsListSearch")
    public List<Map<String,Object>> getIntegralGoodsListOfSearch(@RequestBody IntegralGoodsOfSearch ofSearch){
        System.out.println(ofSearch);
        List<Map<String, Object>> mapList = pmdsService.queryGoodsListOfSearch(ofSearch);
        if (mapList.size() > 0){
            for (Map<String, Object> stringObjectMap : mapList) {
                Integer o = (Integer) stringObjectMap.get("id");
                String startTime = (String) stringObjectMap.get("startTime");
                String endTime = (String) stringObjectMap.get("endTime");
                stringObjectMap.put("timeValue",startTime + "至"+endTime);
                int count1 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>()
                        .eq(UserPointsMerchandise::getPointsMerchandiseId, o));
                int count2 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>()
                        .eq(UserPointsMerchandise::getPointsMerchandiseId, o)
                        .eq(UserPointsMerchandise::getStatus,2));
                stringObjectMap.put("hasExchangeQty",count1);
                stringObjectMap.put("hasPickQty",count2);
                stringObjectMap.put("activeStatus",dealTimeStatus(startTime,endTime));
            }
            if (ToolUtil.isNotEmpty(ofSearch.getActiveStatus())){
                mapList = dealTimeData(mapList,ofSearch.getActiveStatus());
            }
        }
        System.out.println("mapList->"+mapList);
        return mapList;
    }
    public int dealTimeStatus(String startTime, String endTime){
        LocalDate now = LocalDate.now();