Commit 90d99a2b by weijiguang

fix coupon bug

parent c356a5a0
package com.soss.web.controller.coffee;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.soss.common.core.domain.AjaxResult;
import com.soss.common.exception.ServiceException;
import com.soss.common.utils.StringUtils;
import com.soss.system.domain.Machine;
import com.soss.system.domain.Shop;
import com.soss.system.domain.vo.orderTaking.SkuVo;
import com.soss.system.jiguang.impl.JiGuangPushServiceImpl;
import com.soss.system.mapper.ShopGoodsSkuMapper;
import com.soss.system.service.ICustomerService;
import com.soss.system.service.impl.MachineServiceImpl;
import com.soss.system.service.impl.OrderServiceImpl;
......@@ -17,8 +20,10 @@ import io.jsonwebtoken.lang.Assert;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.concurrent.TimeUnit;
@RestController
......@@ -39,6 +44,8 @@ public class ApplicationController {
OrderServiceImpl orderService;
@Autowired
private ICustomerService customerService;
@Autowired
private ShopGoodsSkuMapper shopGoodsSkuMapper;
@PostMapping("/saveData")
public AjaxResult saveApplicationData(@RequestBody String body) {
......@@ -82,6 +89,24 @@ public class ApplicationController {
shop.setDistance("-1");
}
redisJson.put("shop", shop);
JSONArray goodsList = redisJson.getJSONArray("goods");
if (!CollectionUtils.isEmpty(goodsList)) {
for (int i = 0; i < goodsList.size(); i++) {
JSONObject goods = goodsList.getJSONObject(i);
JSONObject sku = goods.getJSONObject("sku");
List<SkuVo> skuList = shopGoodsSkuMapper.selectSkuByGoodAndShop(shop.getId(), goods.getString("goodsId"));
if (CollectionUtils.isEmpty(skuList)) {
continue;
}
skuList.forEach(skuVo -> {
if (skuVo.getSkuId().toString().equals(sku.getString("skuId"))) {
sku.put("origDiscount", skuVo.getOrigDiscount());
}
});
}
}
//推送数据给安卓
JSONObject jgBody = new JSONObject();
jgBody.put("action", "QRCODE_VISITED");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment