Commit 99df1c25 authored by machengbo's avatar machengbo

订单详情 和 接口文档

parent e0c98ce6
...@@ -2,18 +2,20 @@ package com.jz.dm.mall.moduls.controller.order; ...@@ -2,18 +2,20 @@ package com.jz.dm.mall.moduls.controller.order;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants; import com.jz.common.constant.Constants;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto; import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest; import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest;
import com.jz.dm.mall.moduls.service.OrderService; import com.jz.dm.mall.moduls.service.OrderService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/** /**
* 订单表(TOrder)表控制层 * 订单表(TOrder)表控制层
...@@ -29,14 +31,19 @@ public class OrderController { ...@@ -29,14 +31,19 @@ public class OrderController {
* 服务对象 * 服务对象
*/ */
@Autowired @Autowired
private OrderService tOrderService; private OrderService orderService;
/**
* 订单管理列表(分页查询)
*
* @author Bellamy
*/
@PostMapping(value = "/list") @PostMapping(value = "/list")
@ApiOperation(value = "订单管理列表(分页查询)", notes = "订单列表(分页查询)") @ApiOperation(value = "订单管理列表(分页查询)", notes = "订单列表(分页查询)")
public PageInfoResponse<OrderDto> queryPageList(@RequestBody OrderRequest orderRequest, HttpServletRequest req) throws Exception { public PageInfoResponse<OrderDto> queryPageList(@RequestBody OrderRequest orderRequest, HttpServletRequest req) throws Exception {
PageInfoResponse<OrderDto> pageInfo = new PageInfoResponse<OrderDto>(); PageInfoResponse<OrderDto> pageInfo = new PageInfoResponse<OrderDto>();
try { try {
pageInfo = tOrderService.findList(orderRequest, req); pageInfo = orderService.findList(orderRequest, req);
} catch (Exception e) { } catch (Exception e) {
pageInfo.setMessage("查询失败"); pageInfo.setMessage("查询失败");
pageInfo.setCode(Constants.FAILURE_CODE); pageInfo.setCode(Constants.FAILURE_CODE);
...@@ -44,4 +51,47 @@ public class OrderController { ...@@ -44,4 +51,47 @@ public class OrderController {
} }
return pageInfo; return pageInfo;
} }
/**
* 根据订单主键查询,订单详情
*
* @param orderId
* @author Bellamy
*/
@GetMapping(value = "/orderDetail")
@ApiOperation(value = "订单详情", notes = "订单详情")
public Result<OrderDto> getOrderDetail(@RequestParam(value = "orderId") String orderId, HttpServletRequest req) throws Exception {
Result<OrderDto> result = new Result<OrderDto>();
if (StringUtils.isNotEmpty(orderId)) {
OrderDto orderDto = orderService.getOrderDetail(orderId);
result.setResult(orderDto);
} else {
result.setMessage("参数为不能为空!");
}
return result;
}
/**
* 根据订单主键查询,订单详情
*
* @param orderId,dataGoodsId
* @author Bellamy
*/
@GetMapping(value = "/apiInterfaceDetail")
@ApiOperation(value = "订单详情---接口文档", notes = "接口文档")
public Result<Map> getApiInterfaceDetail(@RequestParam(value = "orderId") String orderId, @RequestParam(value = "dataGoodsId") String dataGoodsId, HttpServletRequest req) throws Exception {
Result<Map> result = new Result<Map>();
Map params = new HashMap();
if (StringUtils.isNotEmpty(dataGoodsId)) {
params.put("dataGoodsId", dataGoodsId);
}
if (StringUtils.isNotEmpty(orderId)) {
params.put("orderId", orderId);
}
//查询接口文档 和参数信息
Map dataGoodsApi = orderService.getApiInterfaceDetail(params);
result.setResult(dataGoodsApi);
return result;
}
} }
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.order.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* api商品(DataGoodsApiDto)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:31
*/
@ApiModel
public class DataGoodsApiDto implements Serializable {
private static final long serialVersionUID = -14346819849726413L;
/**
* api商品id
*/
@ApiModelProperty(value = "api商品id")
private Long goodsApi;
/**
* 数据id
*/
@ApiModelProperty(value = "数据id")
private Long dataGoodsId;
/**
* api服务名称
*/
@ApiModelProperty(value = "api服务名称")
private String apiName;
/**
* 请求类型(方式)
*/
@ApiModelProperty(value = "请求类型(方式)")
private String requestType;
/**
* api接口地址
*/
@ApiModelProperty(value = "api接口地址")
private String apiUrl;
/**
* api接口方法
*/
@ApiModelProperty(value = "api接口方法")
private String apiMethod;
/**
* api请求协议:http,https
*/
@ApiModelProperty(value = "api请求协议:http,https")
private String apiProtocl;
/**
* api返回数据样例
*/
@ApiModelProperty(value = "api返回数据样例")
private String returnDataExample;
/**
* api请求样例
*/
@ApiModelProperty(value = "api请求样例")
private String requestExample;
/**
* 返回类型
*/
@ApiModelProperty(value = "返回类型")
private String returnType;
/**
* apikey
*/
@ApiModelProperty(value = "apikey")
private String apiKey;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date creTime;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String crePerson;
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
private String uptPerson;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date uptTime;
/**
* 授权码token
*/
@ApiModelProperty(value = "授权码token")
private String requestToken;
/**
* 接口参数信息
*/
@ApiModelProperty(value = "接口参数信息")
private List<DataGoodsApiParamsDto> apiParamsDto;
public Long getGoodsApi() {
return goodsApi;
}
public void setGoodsApi(Long goodsApi) {
this.goodsApi = goodsApi;
}
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public String getApiName() {
return apiName;
}
public void setApiName(String apiName) {
this.apiName = apiName;
}
public String getRequestType() {
return requestType;
}
public void setRequestType(String requestType) {
this.requestType = requestType;
}
public String getApiUrl() {
return apiUrl;
}
public void setApiUrl(String apiUrl) {
this.apiUrl = apiUrl;
}
public String getApiMethod() {
return apiMethod;
}
public void setApiMethod(String apiMethod) {
this.apiMethod = apiMethod;
}
public String getApiProtocl() {
return apiProtocl;
}
public void setApiProtocl(String apiProtocl) {
this.apiProtocl = apiProtocl;
}
public String getReturnDataExample() {
return returnDataExample;
}
public void setReturnDataExample(String returnDataExample) {
this.returnDataExample = returnDataExample;
}
public String getRequestExample() {
return requestExample;
}
public void setRequestExample(String requestExample) {
this.requestExample = requestExample;
}
public String getReturnType() {
return returnType;
}
public void setReturnType(String returnType) {
this.returnType = returnType;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getRequestToken() {
return requestToken;
}
public void setRequestToken(String requestToken) {
this.requestToken = requestToken;
}
public List<DataGoodsApiParamsDto> getApiParamsDto() {
return apiParamsDto;
}
public void setApiParamsDto(List<DataGoodsApiParamsDto> apiParamsDto) {
this.apiParamsDto = apiParamsDto;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.order.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* api商品参数配置(TDataGoodsApiParams)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:31
*/
@ApiModel
public class DataGoodsApiParamsDto implements Serializable {
private static final long serialVersionUID = 944366688061324185L;
/**
* api参数id
*/
@ApiModelProperty(value = "api参数id")
private Long apiParamsId;
/**
* api商品id
*/
@ApiModelProperty(value = "api商品id")
private Long goodsApi;
/**
* 参数分类:01公共参数,02请求参数,03响应参数,04请求头参数,05状态码参数
*/
@ApiModelProperty(value = "参数分类:01公共参数,02请求参数,03响应参数,04请求头参数,05状态码参数")
private String paramsDiff;
/**
* 参数名称
*/
@ApiModelProperty(value = "参数名称")
private String paramsName;
/**
* 参数类型
*/
@ApiModelProperty(value = "参数类型")
private String paramsType;
/**
* 参数描述
*/
@ApiModelProperty(value = "参数描述")
private String paramsDesc;
/**
* 默认值
*/
@ApiModelProperty(value = "默认值")
private String defaultValue;
/**
* 是否必选:Y是,N否
*/
@ApiModelProperty(value = "是否必选:Y是,N否")
private String ifRequird;
/*
* 参数分类:名称
* */
@ApiModelProperty(value = "参数分类名称")
private String paramsDiffName;
public Long getGoodsApi() {
return goodsApi;
}
public void setGoodsApi(Long goodsApi) {
this.goodsApi = goodsApi;
}
public String getParamsDiff() {
return paramsDiff;
}
public void setParamsDiff(String paramsDiff) {
this.paramsDiff = paramsDiff;
}
public String getParamsName() {
return paramsName;
}
public void setParamsName(String paramsName) {
this.paramsName = paramsName;
}
public String getParamsType() {
return paramsType;
}
public void setParamsType(String paramsType) {
this.paramsType = paramsType;
}
public String getParamsDesc() {
return paramsDesc;
}
public void setParamsDesc(String paramsDesc) {
this.paramsDesc = paramsDesc;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public String getIfRequird() {
return ifRequird;
}
public void setIfRequird(String ifRequird) {
this.ifRequird = ifRequird;
}
public String getParamsDiffName() {
return paramsDiffName;
}
public void setParamsDiffName(String paramsDiffName) {
this.paramsDiffName = paramsDiffName;
}
public Long getApiParamsId() {
return apiParamsId;
}
public void setApiParamsId(Long apiParamsId) {
this.apiParamsId = apiParamsId;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.order.bean; package com.jz.dm.mall.moduls.controller.order.bean;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -18,50 +20,63 @@ public class OrderDto { ...@@ -18,50 +20,63 @@ public class OrderDto {
/** /**
* 订单id * 订单id
*/ */
@ApiModelProperty(value = "订单id")
private Long orderId; private Long orderId;
/** /**
* 订单编号 * 订单编号
*/ */
@ApiModelProperty(value = "订单编号")
private String orderNumber; private String orderNumber;
/** /**
* 用户id * 用户id
*/ */
@ApiModelProperty(value = "用户id")
private Long customerId; private Long customerId;
/** /**
* 订单状态:01待支付,02已支付,03已取消 * 订单状态:01待支付,02已支付,03已取消
*/ */
@ApiModelProperty(value = "订单状态:01待支付,02已支付,03已取消")
private String orderStatus; private String orderStatus;
/** /**
* 订单金额 * 订单金额
*/ */
@ApiModelProperty(value = "订单金额")
private BigDecimal orderMoney; private BigDecimal orderMoney;
/** /**
* 订单时间 * 订单时间
*/ */
@ApiModelProperty(value = "订单时间")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date orderTime; private Date orderTime;
/** /**
* 卖家id * 卖家id
*/ */
@ApiModelProperty(value = "卖家id")
private Long sellerId; private Long sellerId;
/** /**
* 支付金额 * 支付金额
*/ */
@ApiModelProperty(value = "支付金额")
private BigDecimal paymentMoney; private BigDecimal paymentMoney;
/** /**
* 支付时间 * 支付时间
*/ */
@ApiModelProperty(value = "支付时间")
private Date paymentTime; private Date paymentTime;
/** /**
* 支付方式:01余额 * 支付方式:01余额
*/ */
@ApiModelProperty(value = "支付方式:01余额")
private String paymentMethod; private String paymentMethod;
/** /**
* 优惠金额 * 优惠金额
*/ */
@ApiModelProperty(value = "优惠金额")
private BigDecimal districtMoney; private BigDecimal districtMoney;
/** /**
* 购买方式:01年,02季,03月,04次(服务类型) * 购买方式:01年,02季,03月,04次(服务类型)
*/ */
@ApiModelProperty(value = "购买方式:01年,02季,03月,04次(服务类型)")
private String purchaseMethod; private String purchaseMethod;
/** /**
* 商品token * 商品token
...@@ -70,18 +85,22 @@ public class OrderDto { ...@@ -70,18 +85,22 @@ public class OrderDto {
/** /**
* 盐值 * 盐值
*/ */
@ApiModelProperty(value = "盐值")
private String saltValue; private String saltValue;
/** /**
* apikey * apikey
*/ */
@ApiModelProperty(value = "apikey")
private String apiKey; private String apiKey;
/** /**
* 生效日期 * 生效日期
*/ */
@ApiModelProperty(value = "生效日期")
private Date takeEffectTime; private Date takeEffectTime;
/** /**
* 失效日期 * 失效日期
*/ */
@ApiModelProperty(value = "失效日期")
private Date invalidTime; private Date invalidTime;
/** /**
* 价格类型:01免费,02收费 * 价格类型:01免费,02收费
...@@ -110,10 +129,12 @@ public class OrderDto { ...@@ -110,10 +129,12 @@ public class OrderDto {
/** /**
* 数据名称 * 数据名称
*/ */
@ApiModelProperty(value = "数据名称")
private String dataName; private String dataName;
/** /**
* 数据分类 * 数据分类
*/ */
@ApiModelProperty(value = "数据分类")
private String dataType; private String dataType;
......
...@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.controller.order.bean; ...@@ -2,6 +2,7 @@ package com.jz.dm.mall.moduls.controller.order.bean;
import com.jz.common.bean.BasePageBean; import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/** /**
* 订单表(TOrder)实体类 * 订单表(TOrder)实体类
...@@ -16,22 +17,27 @@ public class OrderRequest extends BasePageBean { ...@@ -16,22 +17,27 @@ public class OrderRequest extends BasePageBean {
/** /**
* 订单编号 * 订单编号
*/ */
@ApiModelProperty(value = "订单编号")
private String orderNumber; private String orderNumber;
/** /**
* 数据行业 * 数据行业
*/ */
@ApiModelProperty(value = "数据行业")
private String categoryId; private String categoryId;
/** /**
* 购买方式:01年,02季,03月,04次(服务类型) * 购买方式:01年,02季,03月,04次(服务类型)
*/ */
@ApiModelProperty(value = "购买方式:01年,02季,03月,04次(服务类型)")
private String purchaseMethod; private String purchaseMethod;
/** /**
* 数据名称 * 数据名称
*/ */
@ApiModelProperty(value = "数据名称")
private String dataName; private String dataName;
/** /**
* 数据分类 * 数据分类
*/ */
@ApiModelProperty(value = "数据分类")
private String dataType; private String dataType;
......
package com.jz.dm.mall.moduls.mapper; package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper; import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiDto;
import com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiParamsDto;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto; import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.entity.Order; import com.jz.dm.mall.moduls.entity.Order;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -16,5 +19,13 @@ import java.util.Map; ...@@ -16,5 +19,13 @@ import java.util.Map;
public interface OrderDao extends BaseMapper<Order> { public interface OrderDao extends BaseMapper<Order> {
List<OrderDto> findList(Map<String, Object> param)throws Exception; List<OrderDto> findList(Map<String, Object> param) throws Exception;
OrderDto getOrderDetail(@Param("orderId") String orderId) throws Exception;
List<DataGoodsApiDto> getApiInterfaceDetail(Map params) throws Exception;
List<DataGoodsApiDto> getApiInterface(Map params) throws Exception;
List<DataGoodsApiParamsDto> getApiParamsInfo(@Param("goodsApi") Long goodsApi);
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ import com.jz.dm.mall.moduls.controller.order.bean.OrderDto; ...@@ -5,6 +5,7 @@ import com.jz.dm.mall.moduls.controller.order.bean.OrderDto;
import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest; import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/** /**
* 订单表(TOrder)表服务接口 * 订单表(TOrder)表服务接口
...@@ -15,5 +16,9 @@ import javax.servlet.http.HttpServletRequest; ...@@ -15,5 +16,9 @@ import javax.servlet.http.HttpServletRequest;
public interface OrderService { public interface OrderService {
PageInfoResponse<OrderDto> findList(OrderRequest order, HttpServletRequest req)throws Exception; PageInfoResponse<OrderDto> findList(OrderRequest order, HttpServletRequest req) throws Exception;
OrderDto getOrderDetail(String orderId) throws Exception;
Map getApiInterfaceDetail(Map params) throws Exception;
} }
\ No newline at end of file
...@@ -4,18 +4,16 @@ import com.github.pagehelper.PageHelper; ...@@ -4,18 +4,16 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants; import com.jz.common.constant.Constants;
import com.jz.dm.mall.moduls.controller.order.bean.OrderDto; import com.jz.dm.mall.moduls.controller.order.bean.*;
import com.jz.dm.mall.moduls.controller.order.bean.OrderRequest;
import com.jz.dm.mall.moduls.mapper.OrderDao; import com.jz.dm.mall.moduls.mapper.OrderDao;
import com.jz.dm.mall.moduls.service.OrderService; import com.jz.dm.mall.moduls.service.OrderService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* 订单表(TOrder)表服务实现类 * 订单表(TOrder)表服务实现类
...@@ -28,32 +26,36 @@ import java.util.Map; ...@@ -28,32 +26,36 @@ import java.util.Map;
public class OrderServiceImpl implements OrderService { public class OrderServiceImpl implements OrderService {
@Autowired @Autowired
private OrderDao tOrderDao; private OrderDao orderDao;
@Override @Override
public PageInfoResponse<OrderDto> findList(OrderRequest order, HttpServletRequest req) throws Exception{ public PageInfoResponse<OrderDto> findList(OrderRequest order, HttpServletRequest req) throws Exception {
PageInfoResponse<OrderDto> pageInfoResponse = new PageInfoResponse<>(); PageInfoResponse<OrderDto> pageInfoResponse = new PageInfoResponse<>();
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
//数据商品id //数据编号
if (order.getOrderNumber() != null) { if (StringUtils.isNotEmpty(order.getOrderNumber())) {
param.put("orderNumber", order.getOrderNumber()); param.put("orderNumber", order.getOrderNumber());
} }
//商品分类id(行业) //购买(订单)方式
if (order.getPurchaseMethod() != null) { if (StringUtils.isNotEmpty(order.getPurchaseMethod())) {
param.put("purchaseMethod", order.getPurchaseMethod()); param.put("purchaseMethod", order.getPurchaseMethod());
} }
/* //数据商户id //数据类型
if (order.getUserId() != null) { if (StringUtils.isNotEmpty(order.getDataType())) {
param.put("userId", order.getUserId()); param.put("dataType", order.getDataType());
} }
//数据商品名称 //数据商品名称
if (!StringUtils.isEmpty(order.getDataName())) { if (!StringUtils.isEmpty(order.getDataName())) {
param.put("dataName", order.getDataName()); param.put("dataName", order.getDataName());
}*/ }
//商品分类id(行业)
if (!StringUtils.isEmpty(order.getCategoryId())) {
param.put("categoryId", order.getCategoryId());
}
PageHelper.startPage(order.getPageNum(), order.getPageSize()); PageHelper.startPage(order.getPageNum(), order.getPageSize());
List<OrderDto> list = tOrderDao.findList(param); List<OrderDto> list = orderDao.findList(param);
PageInfo<OrderDto> pageInfo = new PageInfo<>(list); PageInfo<OrderDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE); pageInfoResponse.setCode(Constants.SUCCESS_CODE);
...@@ -61,4 +63,72 @@ public class OrderServiceImpl implements OrderService { ...@@ -61,4 +63,72 @@ public class OrderServiceImpl implements OrderService {
pageInfoResponse.setData(pageInfo); pageInfoResponse.setData(pageInfo);
return pageInfoResponse; return pageInfoResponse;
} }
@Override
public OrderDto getOrderDetail(String orderId) throws Exception {
OrderDto orderDto = null;
if (StringUtils.isNotEmpty(orderId)) {
orderDto = orderDao.getOrderDetail(orderId);
if (orderDto != null) {
/*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long effectTimes = orderDto.getTakeEffectTime().getTime(); //开始生效日期
long invalidTimes = orderDto.getInvalidTime().getTime(); //有效结束日期
long syTime = invalidTimes - effectTimes; //有效时间毫秒数
Date mtime = new Date(syTime);
int month = mtime.getMonth();*/
//getEffectTime(orderDto.getTakeEffectTime(), orderDto.getInvalidTime());
}
}
return orderDto;
}
@Override
public Map getApiInterfaceDetail(Map params) throws Exception {
Map returnMap = new HashMap();
DataGoodsApiDto dataGoodsApi = new DataGoodsApiDto(); //接口文档信息
List<DataGoodsApiParamsDto> goodsApiParamsLst = new ArrayList<>(); //接口参数信息
if (params.size() > 0) {
List<DataGoodsApiDto> dataGoodsApiDto = orderDao.getApiInterface(params);//接口文档信息
dataGoodsApi = dataGoodsApiDto.get(0);
Long goodsApiId = dataGoodsApi.getGoodsApi();
goodsApiParamsLst = orderDao.getApiParamsInfo(goodsApiId);//接口参数信息
}
returnMap.put("dataGoodsApi", dataGoodsApi);
returnMap.put("goodsApiParamsLst", goodsApiParamsLst);
return returnMap;
}
public void getEffectTime(Date takeEffectTime, Date invalidTime) {
Calendar startTime = Calendar.getInstance();
startTime.setTime(takeEffectTime); //开始日期
Calendar endCalendar = Calendar.getInstance();
endCalendar.setTime(invalidTime); //结束日期
int hour = endCalendar.get(Calendar.HOUR_OF_DAY) - startTime.get(Calendar.HOUR_OF_DAY);
int day = endCalendar.get(Calendar.DAY_OF_MONTH) - startTime.get(Calendar.DAY_OF_MONTH);
int month = endCalendar.get(Calendar.MONTH) - startTime.get(Calendar.MONTH);
int year = endCalendar.get(Calendar.YEAR) - startTime.get(Calendar.YEAR);
// 按照减法原理,先day相减,不够向month借;然后month相减,不够向year借;最后year相减。
if (day < 0) {
month -= 1;
endCalendar.add(Calendar.MONTH, -1);// 得到上一个月,用来得到上个月的天数。
day = day + endCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
}
if (month < 0) {
month = (month + 12) % 12;
year--;
}
System.out.println("结果:" + year + "年" + month + "月" + day + "天");
/*for (int i = 0; i < month; i++) {
endCalendar.add(Calendar.MONTH, -1);// 得到上一个月,用来得到上个月的天数。
day = day + endCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
}
System.out.println("过去时间与现在有:" + year + "年" + "" + day + "天");*/
}
} }
\ No newline at end of file
...@@ -225,27 +225,27 @@ ...@@ -225,27 +225,27 @@
<select id="findList" resultType="com.jz.dm.mall.moduls.controller.order.bean.OrderDto" parameterType="map"> <select id="findList" resultType="com.jz.dm.mall.moduls.controller.order.bean.OrderDto" parameterType="map">
select select
t.order_id as orderId, t.order_id as orderId,
t.order_number as orderNumber, t.order_number as orderNumber,
t.customer_id as customerId, t.customer_id as customerId,
(case when t.order_status ='01' then '待支付' (case when t.order_status ='01' then '待支付'
when t.order_status ='02' then '已支付' when t.order_status ='02' then '已支付'
when t.order_status ='03' then '已取消' when t.order_status ='03' then '已取消'
end) as orderStatus, end) as orderStatus,
t.order_money as orderMoney, t.order_money as orderMoney,
t.order_time as orderTime, t.order_time as orderTime,
t.payment_money as paymentMoney, t.payment_money as paymentMoney,
t.payment_time as paymentTime, t.payment_time as paymentTime,
t.payment_method AS paymentMethod, t.payment_method AS paymentMethod,
(case when t.purchase_method ='01' then '年' (case when t.purchase_method ='01' then '年'
when t.purchase_method ='02' then '季' when t.purchase_method ='02' then '季'
when t.purchase_method ='03' then '月' when t.purchase_method ='03' then '月'
when t.purchase_method ='04' then '次' when t.purchase_method ='04' then '次'
end) as purchaseMethod, end) as purchaseMethod,
t.price_type as priceType, t.price_type as priceType,
t.cre_time as creTime, t.cre_time as creTime,
t2.data_name as dataName, t2.data_name as dataName,
(case when t2.data_type ='01' then 'API' when t2.data_type ='02' then '数据包' end) as dataType (case when t2.data_type ='01' then 'API' when t2.data_type ='02' then '数据包' end) as dataType
from t_order t from t_order t
left join t_order_goods_info t1 on t.order_id=t1.order_id left join t_order_goods_info t1 on t.order_id=t1.order_id
inner join t_data_goods t2 on t2.data_goods_id=t1.data_goods_id inner join t_data_goods t2 on t2.data_goods_id=t1.data_goods_id
...@@ -259,5 +259,116 @@ ...@@ -259,5 +259,116 @@
<if test="orderStatus != null and orderStatus != ''">and t.order_status = #{orderStatus}</if> <if test="orderStatus != null and orderStatus != ''">and t.order_status = #{orderStatus}</if>
<if test="orderTime != null">and t.order_time = #{orderTime}</if> <if test="orderTime != null">and t.order_time = #{orderTime}</if>
</select> </select>
<!--根据订单id 查询详情-->
<select id="getOrderDetail" resultType="com.jz.dm.mall.moduls.controller.order.bean.OrderDto" parameterType="map">
select
t.order_id as orderId,
t.order_number as orderNumber,
(case when t.order_status ='01' then '待支付' when t.order_status ='02' then '已支付' when t.order_status ='03' then '已取消' end) as orderStatus,
t.order_time as orderTime,
(case when t.purchase_method ='01' then '年' when t.purchase_method ='02' then '季' when t.purchase_method ='03' then '月'
when t.purchase_method ='04' then '次' end) as purchaseMethod,
t.take_effect_time as takeEffectTime,
t.invalid_time as invalidTime,
t.api_key as apiKey,
t2.data_name as dataName,
(case when t2.data_type ='01' then 'API' when t2.data_type ='02' then '数据包' end) as dataType
from t_order t
left join t_order_goods_info t1 on t.order_id=t1.order_id
inner join t_data_goods t2 on t2.data_goods_id=t1.data_goods_id
where 1=1
<if test="orderId != null">and t.order_id = #{orderId}</if>
</select>
<resultMap id="apiParamsInfo" type="com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiDto">
<id column="goods_api" property="goodsApi" />
<result column="api_name" property="apiName" />
<result column="request_type" property="requestType" />
<result column="api_url" property="apiUrl" />
<result column="api_method" property="apiMethod" />
<result column="api_protocl" property="apiProtocl" />
<result column="return_data_example" property="returnDataExample" />
<result column="return_type" property="returnType" />
<result column="api_key" property="apiKey" />
<result column="request_token" property="requestToken" />
<collection property="apiParamsDto" ofType="com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiParamsDto">
<id column="api_params_id" property="apiParamsId" />
<result column="params_diff" property="paramsDiff" />
<result column="params_name" property="paramsName" />
<result column="params_type" property="paramsType" />
<result column="params_desc" property="paramsDesc" />
<result column="if_requird" property="ifRequird" />
</collection>
</resultMap>
<select id="getApiInterfaceDetail" resultMap="apiParamsInfo" parameterType="map">
select
t3.goods_api as goodsApi,
t3.api_name as apiName,
t3.request_type as requestType,
t3.api_url as apiUrl,
t3.api_method as apiMethod,
t3.api_protocl as apiProtocl,
t3.return_data_example as returnDataExample,
t3.request_example as requestExample,
t3.return_type as returnType,
t3.api_key as apiKey,
t3.request_token as requestToken,
(case when t4.params_diff ='01' then '公共参数' when t4.params_diff ='02' then '请求参数'
when t4.params_diff ='03' then '响应参数'
when t4.params_diff ='04' then '请求头参数' when t4.params_diff ='05' then '状态码参数' end) as paramsDiff,
t4.params_name as paramsName,
t4.params_type as paramsType,
t4.params_desc as paramsDesc,
t4.default_value as defaultValue,
t4.if_requird as ifRequird,
t4.api_params_id as apiParamsId
from t_order t
inner join t_order_goods_info t1 on t.order_id=t1.order_id
inner join t_data_goods t2 on t2.data_goods_id=t1.data_goods_id <if test="dataGoodsId != null">and t2.data_goods_id = #{dataGoodsId}</if>
inner join t_data_goods_api t3 on t3.data_goods_id=t2.data_goods_id
left join t_data_goods_api_params t4 on t4.goods_api=t3.goods_api
where 1=1 and t.order_status='02'
<if test="orderId != null">and t.order_id = #{orderId}</if>
</select>
<select id="getApiInterface" resultType="com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiDto" parameterType="map">
select
t3.goods_api as goodsApi,
t3.api_name as apiName,
t3.request_type as requestType,
t3.api_url as apiUrl,
t3.api_method as apiMethod,
t3.api_protocl as apiProtocl,
t3.return_data_example as returnDataExample,
t3.request_example as requestExample,
t3.return_type as returnType,
t3.api_key as apiKey,
t3.request_token as requestToken
from t_order t
inner join t_order_goods_info t1 on t.order_id=t1.order_id
inner join t_data_goods t2 on t2.data_goods_id=t1.data_goods_id <if test="dataGoodsId != null">and t2.data_goods_id = #{dataGoodsId}</if>
inner join t_data_goods_api t3 on t3.data_goods_id=t2.data_goods_id
where 1=1 and t.order_status='02'
<if test="orderId != null">and t.order_id = #{orderId}</if>
</select>
<select id="getApiParamsInfo" resultType="com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiParamsDto" parameterType="map">
select
(case when t4.params_diff ='01' then '公共参数' when t4.params_diff ='02' then '请求参数'
when t4.params_diff ='03' then '响应参数'
when t4.params_diff ='04' then '请求头参数' when t4.params_diff ='05' then '状态码参数' end) as paramsDiffName ,
t4.params_diff as paramsDiff,
t4.params_name as paramsName,
t4.params_type as paramsType,
t4.params_desc as paramsDesc,
t4.default_value as defaultValue,
t4.if_requird as ifRequird,
t4.api_params_id as apiParamsId
from t_data_goods_api t3
inner join t_data_goods_api_params t4 on t4.goods_api=t3.goods_api
where 1=1
<if test="goodsApi != null">and t4.goods_api = #{goodsApi}</if>
</select>
</mapper> </mapper>
\ No newline at end of file
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