lisy
2023-08-08 a93d4f40f35ad4464ec1d5602262a1d8d8407ece
cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -11,6 +11,7 @@
import com.dsh.activity.feignclient.model.*;
import com.dsh.activity.feignclient.other.StoreClient;
import com.dsh.activity.feignclient.other.model.StoreDetailOfCourse;
import com.dsh.activity.model.PointMerchandiseVo;
import com.dsh.activity.model.request.CommodityRequest;
import com.dsh.activity.service.*;
import com.dsh.activity.util.GDMapGeocodingUtil;
@@ -90,13 +91,15 @@
    }
    @ResponseBody
    @PostMapping("/base/pointMerchars/getCommoditys")
    public List<PointsMerchandise> getVicinityGoods(@RequestBody CommodityRequest request){
    public PointMerchandiseVo getVicinityGoods(@RequestBody CommodityRequest request){
        PointMerchandiseVo pointMerchandiseVo = new PointMerchandiseVo();
        List<PointsMerchandise> list =  new ArrayList<>();
        String provinceCode = "";
        String cityCode = "";
        if (ToolUtil.isEmpty(request.getLon()) && ToolUtil.isEmpty(request.getLat())){
            return list;
            return pointMerchandiseVo;
        }
        try {
            Map<String, String> geocode = gdMapGeocodingUtil.geocode(request.getLon(), request.getLat());
@@ -116,8 +119,9 @@
                    iterator.remove(); // 移除符合条件的商品
                }
            }
            pointMerchandiseVo.setMerchandises(list);
        }
        return list;
        return pointMerchandiseVo;
    }
    @PostMapping("/base/pointMerchars/getRedeemedNums")
@@ -222,6 +226,7 @@
                detailsVo.setRedeemedNum(count);
                detailsVo.setResidueNum(merchandise.getQuantityIssued()-count);
                detailsVo.setPerLimit(merchandise.getPickUpQuantity());
                detailsVo.setExchangeType(merchandise.getRedemptionMethod());
                if (merchandise.getRedemptionMethod() == 1){
                    detailsVo.setIntegral(merchandise.getIntegral());
                }else {
@@ -252,8 +257,10 @@
                Coupon coupon = iCouponService.getById(detailRequest.getGoodId());
                detailsVo.setGoodId(coupon.getId());
                List<String> list3 = new ArrayList<>();
                list3.add(coupon.getCover());
                list3.addAll(Arrays.asList(StrUtils.splitStr2StrArr(coupon.getProductImages(), ",")));
                list3.add(ToolUtil.isEmpty(coupon.getCover()) ? "" : coupon.getCover());
                if (ToolUtil.isNotEmpty(coupon.getProductImages())){
                    list3.addAll(Arrays.asList(StrUtils.splitStr2StrArr(coupon.getProductImages(), ",")));
                }
                detailsVo.setPics(list3);
                Collections.sort(detailsVo.getPics(), (s1, s2) -> {
                    if (s1.equals(coupon.getCover())) {
@@ -271,11 +278,12 @@
                detailsVo.setRedeemedNum(couponNums);
                detailsVo.setResidueNum(coupon.getQuantityIssued()-couponNums);
                detailsVo.setPerLimit(coupon.getPickUpQuantity());
                if (merchandise.getRedemptionMethod() == 1){
                    detailsVo.setIntegral(merchandise.getIntegral());
                detailsVo.setExchangeType(coupon.getRedemptionMethod());
                if (coupon.getRedemptionMethod() == 1){
                    detailsVo.setIntegral(coupon.getIntegral().intValue());
                }else {
                    detailsVo.setIntegral(merchandise.getIntegral());
                    detailsVo.setCash(merchandise.getCash());
                    detailsVo.setIntegral(coupon.getIntegral().intValue());
                    detailsVo.setCash(coupon.getCash());
                }
                if (coupon.getUseScope() == 1){
                    detailsVo.setBelongs("全国通用");
@@ -291,8 +299,8 @@
                    StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(list.get(0).getStoreId());
                    detailsVo.setBelongs(courseOfStore.getStoreName()+"可用");
                }
                detailsVo.setStartTime(format.format(merchandise.getStartTime()));
                detailsVo.setEndTime(format.format(merchandise.getEndTime()));
                detailsVo.setStartTime(format.format(coupon.getStartTime()));
                detailsVo.setEndTime(format.format(coupon.getEndTime()));
                detailsVo.setContents(coupon.getIllustrate());
                detailsVo.setGoodType(4);
@@ -304,9 +312,10 @@
    }
    @ResponseBody
    @PostMapping("/base/pointMerchars/getDetailsOfExchange")
    public List<ExchangeDetailsResponse> getIntegralExchangeDetails(@RequestBody Integer appUserId){
    public ExchangeDetailsVo getIntegralExchangeDetails(@RequestBody Integer appUserId){
        ExchangeDetailsVo detailsVo = new ExchangeDetailsVo();
        List<ExchangeDetailsResponse> responses = new ArrayList<>();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        List<UserPointsMerchandise> pointsMerchandises = upmseService.list(new QueryWrapper<UserPointsMerchandise>()
@@ -327,16 +336,17 @@
                }
                detailsResponse.setStartTime(simpleDateFormat.format(merchandise.getStartTime()));
                detailsResponse.setEndTime(simpleDateFormat.format(merchandise.getEndTime()));
                detailsResponse.setUseStatus(pointsMerchandise.getStatus());
                detailsResponse.setUseStatus(pointsMerchandise.getStatus() == 1 ? 2 : 1);
                detailsResponse.setGoodType(merchandise.getType());
                responses.add(detailsResponse);
            }
            detailsVo.setDetailsResponses(responses);
        }
        return responses;
        return detailsVo;
    }
    @ResponseBody
    @PostMapping("/base/pointMerchars/getSpecificsOfGoods")
    public PointDetailsVo getSpecificsOfGoods(@RequestBody Integer speMercharsId){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
@@ -425,9 +435,7 @@
                    detailsVo.setBelongs(pmdsServiceById.getProvince()+pmdsServiceById.getCity());
                    break;
                case 3:
                    PointsMerchandiseStore one = pmdstoService.getOne(new QueryWrapper<PointsMerchandiseStore>()
                            .eq("pointsMerchandiseId",pmdsServiceById.getId() ));
                    StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(one.getStoreId());
                    StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(byId.getStoreId());
                    detailsVo.setBelongs(courseOfStore.getStoreName()+" "+courseOfStore.getStoreAddr());
                    break;
                default:
@@ -447,6 +455,7 @@
    @PostMapping("/base/pointMerchars/saveDetailsUserPointMercase")
    public void saveDetailsUserPointMercase(@RequestBody UserPointsMerchandise merchandise){
        merchandise.setInsertTime(new Date());
        upmseService.save(merchandise);
    }