1.使用hutool进行Object to Int格式转换
2.添加部分resultCode
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package cn.lili.event.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.lili.common.cache.Cache;
|
||||
import cn.lili.event.OrderStatusChangeEvent;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||
@@ -188,7 +189,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
|
||||
List skuStocks = cache.multiGet(skuKeys);
|
||||
//循环写入商品库存
|
||||
for (int i = 0; i < skuStocks.size(); i++) {
|
||||
goodsSkus.get(i).setQuantity(Integer.parseInt(skuStocks.get(i).toString()));
|
||||
goodsSkus.get(i).setQuantity(Convert.toInt(skuStocks.get(i).toString()));
|
||||
}
|
||||
//批量修改商品库存
|
||||
goodsSkuService.updateBatchById(goodsSkus);
|
||||
@@ -197,7 +198,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
|
||||
if (!promotionKey.isEmpty()) {
|
||||
List promotionStocks = cache.multiGet(promotionKey);
|
||||
for (int i = 0; i < promotionKey.size(); i++) {
|
||||
promotionGoods.get(i).setQuantity(Integer.parseInt(promotionStocks.get(i).toString()));
|
||||
promotionGoods.get(i).setQuantity(Convert.toInt(promotionStocks.get(i).toString()));
|
||||
Integer num = promotionGoods.get(i).getNum();
|
||||
promotionGoods.get(i).setNum((num != null ? num : 0) + order.getOrder().getGoodsNum());
|
||||
}
|
||||
@@ -232,7 +233,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
|
||||
List skuStocks = cache.multiGet(skuKeys);
|
||||
//循环写入商品SKU库存
|
||||
for (int i = 0; i < skuStocks.size(); i++) {
|
||||
goodsSkus.get(i).setQuantity(Integer.parseInt(skuStocks.get(i).toString()));
|
||||
goodsSkus.get(i).setQuantity(Convert.toInt(skuStocks.get(i).toString()));
|
||||
}
|
||||
log.info("订单取消,库存还原:{}", goodsSkus);
|
||||
//批量修改商品库存
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.lili.timetask.handler.impl.goods;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.lili.modules.goods.mapper.GoodsMapper;
|
||||
@@ -40,7 +41,7 @@ public class GoodsExecute implements EveryDayExecute {
|
||||
.between("create_time", DateUtil.yesterday(), new DateTime()));
|
||||
|
||||
for (Map<String, Object> map : list) {
|
||||
goodsMapper.addGoodsCommentNum(Integer.parseInt(map.get("num").toString()), map.get("goods_id").toString());
|
||||
goodsMapper.addGoodsCommentNum(Convert.toInt(map.get("num").toString()), map.get("goods_id").toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.lili.timetask.handler.impl.view;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.lili.common.cache.Cache;
|
||||
import cn.lili.common.cache.CachePrefix;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
@@ -167,15 +168,15 @@ class PageViewStatistics {
|
||||
//将字符串解析成需要的对象
|
||||
str = str.substring(str.indexOf("}") + 2);
|
||||
String[] dateStr = str.split("-");
|
||||
Integer year = Integer.parseInt(dateStr[0]);
|
||||
Integer month = Integer.parseInt(dateStr[1]);
|
||||
Integer year = Convert.toInt(dateStr[0]);
|
||||
Integer month = Convert.toInt(dateStr[1]);
|
||||
Integer day;
|
||||
//是否有店铺id
|
||||
if (dateStr.length > 3) {
|
||||
day = Integer.parseInt(dateStr[2]);
|
||||
day = Convert.toInt(dateStr[2]);
|
||||
this.storeId = dateStr[3];
|
||||
} else {
|
||||
day = Integer.parseInt(dateStr[2]);
|
||||
day = Convert.toInt(dateStr[2]);
|
||||
}
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.YEAR, year);
|
||||
|
||||
Reference in New Issue
Block a user