Skip to content

12.910i上架后端测试

一、后端逻辑

###1.生成订单

public enum Series {
    _6R("6R", "6.0"),
    _7C("7C", "7.0"),
    _8C("8C", "8.0"),
    _9D("9D", "9.0");
    
    
   新增_10i("10i","10.0")
   
   OMMetaFactoryLocator metaFactoryLocator 为null

###2.显示订单

1.	http://127.0.0.1:8030/api/web/mycontent/cloud/orders/02-2019120911395739570000.json

2.接口
@GET
    @Path("/{id}")
    @Produces({"text/html", "application/json"})
    public OrderInfo<?> getOrder(@Component OrderComponent orderComponent, @PathParam("id") String id) {
        OrderInfo<?> orderInfo = orderComponent.getOrderInfo(id);
        HttpExceptions.notFoundIfNull(orderInfo, "Does not exist");
        return orderInfo;
    }
 OrderInfo:
 orderCommonInfo   订单组成表
 online_timelicenseorder  订单表 关联查询
 paymentDetails 支付详情表 ()

###3.合同

orderCommonInfo 表 的 serial
合同序列:c82845c7-83c5-40af-95a1-f72e7ea15f8c

OrderCommonInfo 订单表
/**
* 合同序列号
*/
public String serial;


/**
 *
 * <p>
 * 申请合同命令
 * </p>
 * @author ${Author}
 * @version ${Version}
 * @since 9.0.0
 *
 */
public interface ApplyContractCommand {
    /**
     *
     * <p>
     *  执行
     * </p>
     * @param orderId 订单Id
     * @param callback 支付回调
     * @since 9.0.0
     */
    void execute(String orderId, OrderPaidCallback callback);
}

###4.online管理

http://127.0.0.1:8099/manager/cloud/orders
管理员账号:supermapoltest@163.com
密码:ispeco

##二、测试

1.支付

测试 SuperMap iServer 10i 标准版 支付
1年价格改为0.01  modulesId = 31179

亮点:

1.enum做循环

java
是我就 String s = {"00-","01-","02-","03-"};
!StringUtils.startsWith("02-2019120910585358530000", type.typePrefix)
循环 String数组判断
but
public enum OrderType {
    HOSTED_DATA(HostedDataOrderDetail.class, "00"),
    NEW_IESRVER(GISServerOrderDetail.class, "01"),
    TIME_LICENSE(TimeLicenseOrder.class, "02"),
    PREPAID_CARD(PrepaidCardOrderDetail.class, "03");

    public final Class<?> detailType;
    public final String typePrefix;

    private OrderType(Class<?> paramDetailType, String paramTypePrefix) {
        this.detailType = paramDetailType;
        this.typePrefix = paramTypePrefix + '-';
    }
}

private List<OrderType> types = EnumUtils.getEnumList(OrderType.class);

for (OrderType type : types) {
            if (StringUtils.startsWith(id, type.typePrefix)) {
                return type;
            }
}
定义枚举而不是数组,
枚举转List,再循环判断

2.enum来做不同的dao

Object orderDetail = this.orderDetailDaoSelector.selectByType(type).query(orderId);

public OrderDetailDao<?> selectByType(OrderType key) {
        return (OrderDetailDao)this.daoMap.get(key.detailType);
    }
   
 private Map<Class<?>, OrderDetailDao<?>> daoMap;