wuxw7
2017-04-12 e27de138abc4725bea60909fe59f72da754bf669
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.java110.order.smo.impl;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.common.util.ProtocolUtil;
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.entity.order.OrderList;
import com.java110.feign.base.IPrimaryKeyService;
import com.java110.order.smo.IOrderServiceSMO;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
/**
 * 订单服务业务逻辑处理实现类
 * Created by wuxw on 2017/4/11.
 */
@Service("orderServiceSMOImpl")
public class OrderServiceSMOImpl extends BaseServiceSMO implements IOrderServiceSMO {
 
    @Autowired
    IPrimaryKeyService iPrimaryKeyService;
 
    /**
     * 订单调度
     * @param orderInfo 订单信息
     * @return 订单处理接口
     * @throws Exception
     */
    @Override
    public String orderDispatch(JSONObject orderInfo) throws Exception {
 
        //1.0 购物车信息校验处理,走订单受理必须要有购物车信息和订单项信息
        if(!orderInfo.containsKey("orderListInfo") || !orderInfo.containsKey("busiOrder")){
            throw  new IllegalArgumentException("请求报文中没有购物车相关信息[orderListInfo]或订单项相关信息[busiOrder],请检查报文:"+orderInfo);
        }
 
        JSONObject orderListTmp = orderInfo.getJSONObject("orderListInfo");
 
        OrderList orderList = JSONObject.parseObject(orderListTmp.toJSONString(),OrderList.class);
 
        String olId = orderList.getOlId();
        //生成olId
        if(StringUtils.isBlank(olId) || olId.startsWith("-") ){
            olId = this.queryPrimaryKey(iPrimaryKeyService,"OL_ID");
            orderList.setOlId(olId);
        }
 
 
 
 
        return null;
    }
 
    public IPrimaryKeyService getiPrimaryKeyService() {
        return iPrimaryKeyService;
    }
 
    public void setiPrimaryKeyService(IPrimaryKeyService iPrimaryKeyService) {
        this.iPrimaryKeyService = iPrimaryKeyService;
    }
}