记得上下班打卡 | git大法好,push需谨慎

Commit a7ed200f authored by 胡佳晨's avatar 胡佳晨

拆单

parent 52bc19ae
......@@ -51,6 +51,7 @@ public class GoblinRedisConst {
public static final String REDIS_GOBLIN_BUY_COUNT = PREFIX.concat("uid:");//用户sku购买数量 key:uid:skuId:$skuId
public static final String REDIS_GOBLIN_SALE_COUNT = PREFIX.concat("sale:skuId:");//用户sku购买数量 key:sale:skuId:$skuId
public static final String REDIS_GOBLIN_ORDER = PREFIX.concat("order:");//用户sku购买数量 key:$orderId
public static final String REDIS_GOBLIN_ORDER_SKU = PREFIX.concat("orderSku:");//用户sku购买数量 key:$orderSkuId
public static final String REDIS_GOBLIN_ORDER_UN_PAY = PREFIX.concat("order:un:pay:");//未支付订单id列表 key:$randomKey
public static final String REDIS_GOBLIN_ORDER_LIST = PREFIX.concat("order:id:list:");//用户订单id列表 key:$uid
/* ----------------------------------------------------------------- */
......
......@@ -107,8 +107,8 @@ public class GoblinStoreOrderVo implements Serializable, Cloneable {
@ApiModelProperty(value = "orderAttr")
private GoblinOrderAttrVo orderAttrVo;
@ApiModelProperty(value = "orderSku")
private List<GoblinOrderSkuVo> orderSkuVos;
@ApiModelProperty(value = "orderSkuId")
private List<String> orderSkuVoIds;
private static final GoblinStoreOrderVo obj = new GoblinStoreOrderVo();
......
......@@ -354,7 +354,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
payInnerResultVo.setPayType(preParam.getPayType());
}
List<GoblinOrderSkuVo> goblinOrderSkuVoList = ObjectUtil.getGoblinOrderSkuVoArrayList();
List<String> goblinOrderSkuIdList = CollectionUtil.linkedListString();
LinkedList<String> sqls = CollectionUtil.linkedListString();
sqls.add(SqlMapping.get("goblin.order.create.sku_insert"));
sqls.add(SqlMapping.get("goblin.order.create.order_insert"));
......@@ -371,7 +371,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
//订单 orderSku Vo
GoblinOrderSkuVo orderSkuVo = GoblinOrderSkuVo.getNew();
BeanUtils.copyProperties(orderSku, orderSkuVo);
goblinOrderSkuVoList.add(orderSkuVo);
redisUtils.setGoblinOrderSku(orderSkuVo.getOrderSkuId(), orderSkuVo);
mongoUtils.insertGoblinOrderSkuVo(orderSkuVo);
goblinOrderSkuIdList.add(orderSkuVo.getOrderSkuId());
}
GoblinStoreOrder storeOrder = item.getStoreOrder();
sqlDataOrder.add(new Object[]{
......@@ -392,8 +394,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
BeanUtils.copyProperties(orderAttr, orderAttrVo);
//redis 赋值
orderVo.setOrderAttrVo(orderAttrVo);
orderVo.setOrderSkuVos(goblinOrderSkuVoList);
orderVo.setOrderSkuVoIds(goblinOrderSkuIdList);
redisUtils.setGoblinOrder(orderVo.getOrderId(), orderVo);
mongoUtils.insertGoblinStoreOrderVo(orderVo);
//redis 添加未支付列表
redisUtils.addUnPayOrder(orderVo.getOrderId());
//redis 订单列表
......@@ -560,11 +563,16 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
orderId, now, now
});
sqls.add(SqlMapping.get("goblin_order.pay.sku"));
List<GoblinOrderSkuVo> skuList = orderVo.getOrderSkuVos();
for (GoblinOrderSkuVo orderSkuVo : skuList) {
List<String> skuList = orderVo.getOrderSkuVoIds();
for (String orderSkuVoIds : skuList) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuVoIds);
//增加销量
redisUtils.incrSkuSaleCount(orderSkuVo.getSkuId(), orderSkuVo.getNum());
orderSkuVo.setStatus(GoblinStatusConst.OrderStatus.ORDER_STATUS_2.getValue());
//redis
redisUtils.setGoblinOrderSku(orderSkuVo.getOrderSkuId(), orderSkuVo);
//mongo
mongoUtils.updateGoblinOrderSkuVo(orderSkuVo.getOrderSkuId(), orderSkuVo);
sqlDataSku.add(new Object[]{
GoblinStatusConst.OrderStatus.ORDER_STATUS_2.getValue(), now,
orderSkuVo.getOrderSkuId(), now, now
......@@ -575,12 +583,12 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
orderVo.setPayTime(storeOrder.getPayTime());
orderVo.setWriteOffCode(storeOrder.getWriteOffCode());
orderVo.setStatus(storeOrder.getStatus());
orderVo.setOrderSkuVos(skuList);
orderVo.setOrderSkuVoIds(skuList);
redisUtils.setGoblinOrder(orderId, orderVo);
//删除未支付订单
redisUtils.removeGoblinOrder(null, orderId);
//mongo
mongoUtils.insertGoblinStoreOrderVo(orderVo);
//mongo
mongoUtils.updateGoblinStoreOrderVo(orderId, orderVo);
//mysql
queueUtils.sendMsgByRedis(MQConst.KylinQueue.SQL_ORDER_CREATE.getKey(),
SqlMapping.gets(sqls, sqlDataOrder, sqlDataSku));
......
......@@ -59,7 +59,7 @@ public class GoblinMongoUtils {
public List<GoblinServiceSupportVo> getServiceSupportVos(List<String> ssids) {
if (CollectionUtils.isEmpty(ssids)) return ObjectUtil.getGoblinServiceSupportVoArrayList();
return mongoTemplate.find(Query.query(Criteria.where("ssid").in(ssids)),
GoblinServiceSupportVo.class,GoblinServiceSupportVo.class.getSimpleName());
GoblinServiceSupportVo.class, GoblinServiceSupportVo.class.getSimpleName());
}
public List<GoblinServiceSupportVo> getMgtServiceSupportVos() {
......@@ -337,4 +337,23 @@ public class GoblinMongoUtils {
public GoblinStoreOrderVo insertGoblinStoreOrderVo(GoblinStoreOrderVo vo) {
return mongoTemplate.insert(vo, GoblinStoreOrderVo.class.getSimpleName());
}
public UpdateResult updateGoblinStoreOrderVo(String orderId, GoblinStoreOrderVo data) {
BasicDBObject object = ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(data));
return mongoTemplate.getCollection(GoblinStoreMarketVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("orderId").is(orderId)).getQueryObject(),
object);
}
//添加 订单SkuVo全量
public GoblinOrderSkuVo insertGoblinOrderSkuVo(GoblinOrderSkuVo vo) {
return mongoTemplate.insert(vo, GoblinOrderSkuVo.class.getSimpleName());
}
public UpdateResult updateGoblinOrderSkuVo(String orderSkuId, GoblinOrderSkuVo data) {
BasicDBObject object = ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(data));
return mongoTemplate.getCollection(GoblinStoreMarketVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("orderSkuId").is(orderSkuId)).getQueryObject(),
object);
}
}
......@@ -426,7 +426,14 @@ public class GoblinRedisUtils {
redisUtil.set(redisKey, vo);
}
// 赋值 订单相关vo
// 赋值 订单相关Skuvo
public void setGoblinOrderSku(String orderSkuId, GoblinOrderSkuVo vo) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER_SKU.concat(orderSkuId);
redisUtil.set(redisKey, vo);
}
// 获取 订单相关vo
public GoblinStoreOrderVo getGoblinOrder(String orderId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER.concat(orderId);
Object obj = redisUtil.get(redisKey);
......@@ -437,6 +444,17 @@ public class GoblinRedisUtils {
}
}
// 获取 订单相关Skuvo
public GoblinOrderSkuVo getGoblinOrderSkuVo(String orderSkuId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER_SKU.concat(orderSkuId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return null;
} else {
return (GoblinOrderSkuVo) obj;
}
}
// 获取 未支付订单id列表
public List<String> getUnPayOrder() {
int randomKey = RandomUtil.getRandomInt(0, 100);
......
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