Commit ad8f586d by weijiguang

push

parent 49f1e40e
......@@ -8,6 +8,8 @@ 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.mapper.ShopGoodsSkuMapper;
import com.soss.system.push.impl.PushServiceImpl;
import com.soss.system.service.ICustomerService;
import com.soss.system.service.impl.MachineServiceImpl;
......@@ -19,8 +21,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
......@@ -41,6 +45,8 @@ public class ApplicationController {
OrderServiceImpl orderService;
@Autowired
private ICustomerService customerService;
@Autowired
private ShopGoodsSkuMapper shopGoodsSkuMapper;
@PostMapping("/saveData")
public AjaxResult saveApplicationData(@RequestBody String body) {
......@@ -83,9 +89,27 @@ public class ApplicationController {
} catch (Exception e) {
shop.setDistance("-1");
}
JSONArray goods = redisJson.getJSONArray("goods");
log.info("redisJson:{}", redisJson.toJSONString());
log.info("goods:{}", goods.toJSONString());
JSONArray goodsList = redisJson.getJSONArray("goods");
log.info("redisJson1:{}", redisJson.toJSONString());
log.info("goods1:{}", goodsList.toJSONString());
if (!CollectionUtils.isEmpty(goodsList)) {
goodsList.forEach(x -> {
JSONObject goods = JSON.parseObject(x.toString());
JSONObject sku = goods.getJSONObject("sku");
List<SkuVo> skuList = shopGoodsSkuMapper.selectSkuByGoodAndShop(shop.getId(), goods.getString("goodsId"));
if (CollectionUtils.isEmpty(skuList)) {
return;
}
skuList.forEach(skuVo -> {
if (skuVo.getSkuId().toString().equals(sku.getString("skuId"))) {
sku.put("origDiscount", skuVo.getOrigDiscount());
}
});
});
}
log.info("redisJson2:{}", redisJson.toJSONString());
log.info("goods2:{}", goodsList.toJSONString());
redisJson.put("shop", shop);
//推送数据给安卓
......
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