无关风月
2025-11-19 c16becdd1bf5197fbe9dab3a6a8f440f79b938af
cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -398,20 +398,22 @@
    @PostMapping("/base/pointMerchars/getCommoditys")
    public PointMerchandiseVo getVicinityGoods(@RequestBody CommodityRequest request) {
        System.err.println("积分商城请求参数"+request);
        PointMerchandiseVo pointMerchandiseVo = new PointMerchandiseVo();
        List<PointsMerchandise> list = new ArrayList<>();
        String provinceCode = "";
        String cityCode = "";
        if (ToolUtil.isEmpty(request.getLon()) && ToolUtil.isEmpty(request.getLat())) {
            return pointMerchandiseVo;
        }else{
            try {
                Map<String, String> geocode = gdMapGeocodingUtil.geocode(request.getLon(), request.getLat());
                provinceCode = geocode.get("provinceCode");
                cityCode = geocode.get("cityCode");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        try {
            Map<String, String> geocode = gdMapGeocodingUtil.geocode(request.getLon(), request.getLat());
            provinceCode = geocode.get("provinceCode");
            cityCode = geocode.get("cityCode");
        } catch (Exception e) {
            e.printStackTrace();
        }
        list = pmdsService.list(new QueryWrapper<PointsMerchandise>()
                .eq("state", 1)
@@ -420,6 +422,29 @@
                .ge("endTime", new Date())
                .eq("status", 1)
        );
        if (request.getShopId()!=null){
            List<Integer> storeId = new ArrayList<>();
            storeId.add(request.getShopId());
            List<Store> stores = storeClient.queryStoreByIds(storeId);
            Store store = stores.get(0);
            provinceCode = store.getProvinceCode();
            cityCode = store.getCityCode();
            List<Integer> pointsMerchandiseIds = pmdstoService.lambdaQuery().eq(PointsMerchandiseStore::getStoreId, request.getShopId()).list()
                    .stream().map(PointsMerchandiseStore::getPointsMerchandiseId)
                    .collect(Collectors.toList());
            if (pointsMerchandiseIds.isEmpty()){
                pointMerchandiseVo.setMerchandises(list);
                return pointMerchandiseVo;
            }else{
                List<PointsMerchandise> pointsMerchandiseList = pmdsService.lambdaQuery()
                        .eq(PointsMerchandise::getState, 1)
                        .eq(PointsMerchandise::getShelves,1)
                        .in(PointsMerchandise::getId, pointsMerchandiseIds).list();
                list = pointsMerchandiseList;
            }
        }
        list = list.stream().distinct().collect(Collectors.toList());
        if (list.size() > 0) {
            Iterator<PointsMerchandise> iterator = list.iterator();
            while (iterator.hasNext()) {
@@ -887,7 +912,7 @@
                detailsResponse.setGoodType(merchandise.getType());
                if (merchandise.getType() == 3) {
                    detailsResponse.setCodeType(3);
                    detailsResponse.setDataId(pointsMerchandise.getPointsMerchandiseId());
                    detailsResponse.setDataId(pointsMerchandise.getId()+"");
                    detailsResponse.setCardType(merchandise.getCardType());
                    List<Integer> sids = new ArrayList<>();
                    detailsResponse.setUserId(appUserId);
@@ -1008,7 +1033,7 @@
                        String format = simpleDateFormat1.format(pointsMerchandise.getInsertTime());
                        detailsResponse.setStartTime(format + " " + startTime + ":00");
                        detailsResponse.setEndTime(format + " " + endTime + ":00");
                        if (simpleDateFormat.parse(format + " " + endTime + ":00").before(new Date())) {
                        if (simpleDateFormat.parse(format + " " + endTime + ":00").before(new Date()) &&detailsResponse.getUseStatus()==2) {
                            System.err.println("过期了,当前门店中最晚营业时间为" + format + " " + endTime + ":00");
                            detailsResponse.setUseStatus(3);
                        }
@@ -1024,7 +1049,7 @@
                        detailsResponse.setEndTime(endDate);
                        Date now = new Date();
                        if (now.after(end)) {
                        if (now.after(end)&&detailsResponse.getUseStatus()==2) {
                            detailsResponse.setUseStatus(3);
                        }
@@ -1032,7 +1057,7 @@
                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        Calendar calendar = Calendar.getInstance();
                        calendar.setTime(pointsMerchandise.getInsertTime());
                        calendar.add(Calendar.DAY_OF_MONTH, 93);
                        calendar.add(Calendar.DAY_OF_MONTH, 90);
                        Date end = calendar.getTime();
                        String startDate = dateFormat.format(pointsMerchandise.getInsertTime());
                        String endDate = dateFormat.format(end);
@@ -1040,7 +1065,7 @@
                        detailsResponse.setEndTime(endDate);
                        Date now = new Date();
                        if (now.after(end)) {
                        if (now.after(end)&&detailsResponse.getUseStatus()==2) {
                            detailsResponse.setUseStatus(3);
                        }
@@ -1048,7 +1073,7 @@
                        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        Calendar calendar = Calendar.getInstance();
                        calendar.setTime(pointsMerchandise.getInsertTime());
                        calendar.add(Calendar.DAY_OF_MONTH, 372);
                        calendar.add(Calendar.DAY_OF_MONTH, 365);
                        Date end = calendar.getTime();
                        String startDate = dateFormat.format(pointsMerchandise.getInsertTime());
                        String endDate = dateFormat.format(end);
@@ -1056,7 +1081,7 @@
                        detailsResponse.setEndTime(endDate);
                        Date now = new Date();
                        if (now.after(end)) {
                        if (now.after(end)&&detailsResponse.getUseStatus()==2) {
                            detailsResponse.setUseStatus(3);
                        }
@@ -1082,12 +1107,16 @@
            detailsResponse.setUseStatus(vipDetail.getStatus() == 1 ? 2 : 1);
            detailsResponse.setGoodType(3);
            detailsResponse.setCardType(3);
            detailsResponse.setDataId(vipDetail.getId()+"");
            // 表明是会员赠送的门票
            detailsResponse.setExchangeType(4);
            // 全国通用
            detailsResponse.setRid(Collections.singletonList(0));
            detailsResponse.setSid(Collections.singletonList(0));
            Date now = new Date();
            if (now.after(vipDetail.getEndTime())&&detailsResponse.getUseStatus()==2) {
                detailsResponse.setUseStatus(3);
            }
            responses.add(detailsResponse);
        }
        if (userCoupons.size() > 0) {
@@ -1116,6 +1145,10 @@
                detailsResponse.setEndTime(simpleDateFormat.format(c.getEndTime()));
                detailsResponse.setUseStatus(userCoupon.getStatus() == 1 ? 2 : 1);
                detailsResponse.setGoodType(4);
                Date now = new Date();
                if (now.after(c.getEndTime())&&detailsResponse.getUseStatus()==2) {
                    detailsResponse.setUseStatus(3);
                }
                responses.add(detailsResponse);
            }
            Comparator<ExchangeDetailsResponse> comparator = Comparator.comparing(ExchangeDetailsResponse::getStartTime).reversed();