Commit 64b65468 authored by machengbo's avatar machengbo

平台 订单管理 和 订单详情

parent 72556a16
package com.jz.manage.moduls.controller.order; package com.jz.manage.moduls.controller.order;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.BaseController; import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.controller.order.bean.OrderDetailDto;
import com.jz.manage.moduls.controller.order.bean.OrderDto;
import com.jz.manage.moduls.controller.order.bean.OrderRequest;
import com.jz.manage.moduls.service.OrderService; import com.jz.manage.moduls.service.OrderService;
import io.swagger.annotations.Api;
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.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/** /**
* 订单表(TOrder)表控制层 * 订单表(TOrder)表控制层
...@@ -13,13 +23,51 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -13,13 +23,51 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2020-12-01 10:41:41 * @since 2020-12-01 10:41:41
*/ */
@RestController @RestController
@RequestMapping("order") @RequestMapping("/order")
@Api(tags = "平台--订单管理")
public class OrderController extends BaseController { public class OrderController extends BaseController {
/** /**
* 服务对象 * 服务对象
*/ */
@Autowired @Autowired
private OrderService tOrderService; private OrderService orderService;
/**
* 订单管理列表(分页查询)
*
* @author Bellamy
*/
@PostMapping(value = "/list")
@ApiOperation(value = "订单管理列表(分页查询)", notes = "订单列表(分页查询)")
public PageInfoResponse<OrderDto> queryPageList(@RequestBody OrderRequest orderRequest, HttpServletRequest req) throws Exception {
PageInfoResponse<OrderDto> pageInfo = new PageInfoResponse<OrderDto>();
try {
pageInfo = orderService.queryListOrderInfo(orderRequest, req);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}
/**
* 根据订单主键查询,订单详情
*
* @param orderId
* @author Bellamy
*/
@GetMapping(value = "/orderDetail")
@ApiOperation(value = "订单详情", notes = "订单详情")
public Result<OrderDetailDto> getOrderDetail(@RequestParam(value = "orderId") String orderId, HttpServletRequest req) throws Exception {
Result<OrderDetailDto> result = new Result<OrderDetailDto>();
if (StringUtils.isNotEmpty(orderId)) {
OrderDetailDto orderDto = orderService.queryOrderDetail(orderId);
result.setData(orderDto);
} else {
result.setMessage("参数为不能为空!");
}
return result;
}
} }
\ No newline at end of file
package com.jz.manage.moduls.controller.order.bean;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
/**
* 订单表(TOrder)实体类
*
* @author makejava
* @since 2020-12-01 10:41:40
*/
@ApiModel(value = "订单管理--订单列表返回参数对象", description = "订单列表返回参数对象")
public class OrderDto {
private static final long serialVersionUID = 651546246975691600L;
/**
* 订单id
*/
@ApiModelProperty(value = "订单id")
private Long orderId;
/**
* 订单编号
*/
@ApiModelProperty(value = "订单编号")
private String orderNumber;
/**
* 用户id
*/
@ApiModelProperty(value = "用户id")
private Long customerId;
/**
* 订单状态:01待支付,02已支付,03已取消
*/
@ApiModelProperty(value = "订单状态:01待支付,02已支付,03已取消")
private String orderStatus;
/**
* 订单金额
*/
@ApiModelProperty(value = "订单金额")
private BigDecimal orderMoney;
/**
* 订单时间
*/
@ApiModelProperty(value = "订单时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date orderTime;
/**
* 支付金额
*/
@ApiModelProperty(value = "支付金额")
private BigDecimal paymentMoney;
/**
* 支付时间
*/
@ApiModelProperty(value = "支付时间")
private Date paymentTime;
/**
* 支付方式:01余额
*/
@ApiModelProperty(value = "支付方式:01余额")
private String paymentMethod;
/**
* 购买方式:01年,02季,03月,04次(服务类型)
*/
@ApiModelProperty(value = "购买方式:01年,02季,03月,04次(服务类型)")
private String purchaseMethod;
/**
* 生效日期
*/
@ApiModelProperty(value = "生效日期")
private Date takeEffectTime;
/**
* 失效日期
*/
@ApiModelProperty(value = "失效日期")
private Date invalidTime;
/**
* 数据名称
*/
@ApiModelProperty(value = "数据名称")
private String dataName;
/**
* 数据分类
*/
@ApiModelProperty(value = "数据分类")
private String dataType;
/**
* 企业名称
*/
@ApiModelProperty(value = "企业名称")
private String departmentName;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public String getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public BigDecimal getOrderMoney() {
return orderMoney;
}
public void setOrderMoney(BigDecimal orderMoney) {
this.orderMoney = orderMoney;
}
public Date getOrderTime() {
return orderTime;
}
public void setOrderTime(Date orderTime) {
this.orderTime = orderTime;
}
public BigDecimal getPaymentMoney() {
return paymentMoney;
}
public void setPaymentMoney(BigDecimal paymentMoney) {
this.paymentMoney = paymentMoney;
}
public Date getPaymentTime() {
return paymentTime;
}
public void setPaymentTime(Date paymentTime) {
this.paymentTime = paymentTime;
}
public String getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
public String getPurchaseMethod() {
return purchaseMethod;
}
public void setPurchaseMethod(String purchaseMethod) {
this.purchaseMethod = purchaseMethod;
}
public Date getTakeEffectTime() {
return takeEffectTime;
}
public void setTakeEffectTime(Date takeEffectTime) {
this.takeEffectTime = takeEffectTime;
}
public Date getInvalidTime() {
return invalidTime;
}
public void setInvalidTime(Date invalidTime) {
this.invalidTime = invalidTime;
}
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}
\ No newline at end of file
package com.jz.manage.moduls.controller.order.bean;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 订单表(TOrder)实体类
*
* @author makejava
* @since 2020-12-01 10:41:40
*/
@ApiModel
public class OrderRequest extends BasePageBean {
private static final long serialVersionUID = 651546246975691600L;
/**
* 订单编号
*/
@ApiModelProperty(value = "订单编号")
private String departmentName;
/**
* 数据行业
*/
@ApiModelProperty(value = "数据行业")
private String categoryId;
/**
* 购买方式:01年,02季,03月,04次(服务类型)
*/
@ApiModelProperty(value = "购买方式:01年,02季,03月,04次(服务类型)")
private String purchaseMethod;
/**
* 数据名称
*/
@ApiModelProperty(value = "数据名称")
private String dataName;
/**
* 数据分类
*/
@ApiModelProperty(value = "数据分类")
private String dataType;
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getPurchaseMethod() {
return purchaseMethod;
}
public void setPurchaseMethod(String purchaseMethod) {
this.purchaseMethod = purchaseMethod;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}
\ No newline at end of file
package com.jz.manage.moduls.mapper; package com.jz.manage.moduls.mapper;
import com.jz.common.base.BaseMapper; import com.jz.common.base.BaseMapper;
import com.jz.manage.moduls.controller.order.bean.OrderDetailDto;
import com.jz.manage.moduls.controller.order.bean.OrderDto;
import com.jz.manage.moduls.entity.Order; import com.jz.manage.moduls.entity.Order;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/** /**
* 订单表(TOrder)表数据库访问层 * 订单表(TOrder)表数据库访问层
...@@ -12,4 +18,7 @@ import com.jz.manage.moduls.entity.Order; ...@@ -12,4 +18,7 @@ import com.jz.manage.moduls.entity.Order;
public interface OrderDao extends BaseMapper<Order> { public interface OrderDao extends BaseMapper<Order> {
List<OrderDto> queryListOrderInfo(Map param) throws Exception;
OrderDetailDto queryOrderDetail(@Param("orderId") String orderId) throws Exception;
} }
\ No newline at end of file
package com.jz.manage.moduls.service; package com.jz.manage.moduls.service;
import com.jz.common.bean.PageInfoResponse;
import com.jz.manage.moduls.controller.order.bean.OrderDetailDto;
import com.jz.manage.moduls.controller.order.bean.OrderDto;
import com.jz.manage.moduls.controller.order.bean.OrderRequest;
import javax.servlet.http.HttpServletRequest;
/** /**
* 订单表(TOrder)表服务接口 * 订单表(TOrder)表服务接口
* *
...@@ -9,5 +16,7 @@ package com.jz.manage.moduls.service; ...@@ -9,5 +16,7 @@ package com.jz.manage.moduls.service;
public interface OrderService { public interface OrderService {
PageInfoResponse<OrderDto> queryListOrderInfo(OrderRequest orderRequest, HttpServletRequest req) throws Exception;
OrderDetailDto queryOrderDetail(String orderId) throws Exception;
} }
\ No newline at end of file
...@@ -97,6 +97,7 @@ public class FinanceCustomerBalanceServiceImpl implements FinanceCustomerBalance ...@@ -97,6 +97,7 @@ public class FinanceCustomerBalanceServiceImpl implements FinanceCustomerBalance
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> uptBalanceInfoAuditByid(BalanceAuditRequest balanceAuditRequest) throws Exception { public Result<Object> uptBalanceInfoAuditByid(BalanceAuditRequest balanceAuditRequest) throws Exception {
//1.修改充值记录状态 //1.修改充值记录状态
FinanceCustomerBalance balance = new FinanceCustomerBalance(); FinanceCustomerBalance balance = new FinanceCustomerBalance();
......
package com.jz.manage.moduls.service.impl; package com.jz.manage.moduls.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.manage.moduls.controller.order.bean.OrderDetailDto;
import com.jz.manage.moduls.controller.order.bean.OrderDto;
import com.jz.manage.moduls.controller.order.bean.OrderRequest;
import com.jz.manage.moduls.mapper.OrderDao; import com.jz.manage.moduls.mapper.OrderDao;
import com.jz.manage.moduls.service.OrderService; import com.jz.manage.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 javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 订单表(TOrder)表服务实现类 * 订单表(TOrder)表服务实现类
...@@ -12,8 +26,54 @@ import org.springframework.stereotype.Service; ...@@ -12,8 +26,54 @@ import org.springframework.stereotype.Service;
* @since 2020-12-01 10:41:40 * @since 2020-12-01 10:41:40
*/ */
@Service("orderService") @Service("orderService")
@Transactional
public class OrderServiceImpl implements OrderService { public class OrderServiceImpl implements OrderService {
@Autowired @Autowired
private OrderDao tOrderDao; private OrderDao orderDao;
@Override
public PageInfoResponse<OrderDto> queryListOrderInfo(OrderRequest orderRequest, HttpServletRequest req) throws Exception {
PageInfoResponse<OrderDto> pageInfoResponse = new PageInfoResponse<>();
Map param = new HashMap();
//从session中获取平台用户id
//SysUserDto user = (SysUserDto) SessionUtils.getUserCurrent(requset,"sysUser");
//param.put("userId", user.getUserId());
//数据行业
if (StringUtils.isNotEmpty(orderRequest.getCategoryId())) {
param.put("categoryId", orderRequest.getCategoryId());
}
//订单方式
if (StringUtils.isNotEmpty(orderRequest.getPurchaseMethod())) {
param.put("orderMethod", orderRequest.getPurchaseMethod());
}
//企业名
if (StringUtils.isNotEmpty(orderRequest.getDepartmentName())) {
param.put("departmentName", orderRequest.getDepartmentName());
}
//数据名称
if (StringUtils.isNotEmpty(orderRequest.getDataName())) {
param.put("dataName", orderRequest.getDataName());
}
//数据类型
if (StringUtils.isNotEmpty(orderRequest.getDataType())) {
param.put("dataType", orderRequest.getDataType());
}
PageHelper.startPage(orderRequest.getPageNum(), orderRequest.getPageSize());
List<OrderDto> list = orderDao.queryListOrderInfo(param);
PageInfo<OrderDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
@Override
public OrderDetailDto queryOrderDetail(String orderId) throws Exception {
return orderDao.queryOrderDetail(orderId);
}
} }
\ No newline at end of file
...@@ -223,4 +223,70 @@ ...@@ -223,4 +223,70 @@
delete from t_order where order_id = #{orderId} delete from t_order where order_id = #{orderId}
</delete> </delete>
<select id="queryListOrderInfo" resultType="com.jz.manage.moduls.controller.order.bean.OrderDto" parameterType="map">
select
t.order_id as orderId,
t.order_number as orderNumber,
t.customer_id as customerId,
(case when t.order_status ='01' then '待支付'
when t.order_status ='02' then '已支付'
when t.order_status ='03' then '已取消'
end) as orderStatus,
t.order_money as orderMoney,
t.order_time as orderTime,
t.payment_money as paymentMoney,
t.payment_time as paymentTime,
t.payment_method AS paymentMethod,
(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.price_type as priceType,
t.cre_time as creTime,
t2.data_name as dataName,
(case when t2.data_type ='01' then 'API' when t2.data_type ='02' then '数据包' end) as dataType,
t4.department_name as departmentName
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
left join t_mall_customer t3 on t3.customer_id=t.customer_id
inner join t_department t4 on t4.department_id=t3.department_id
where 1=1 and t.del_flag='N'
<if test="orderId != null">and t.order_id = #{orderId}</if>
<if test="dataType != null and dataType != ''">and t2.data_type = #{dataType}</if>
<if test="orderNumber != null and orderNumber != ''">and t.order_number = #{orderNumber}</if>
<if test="dataName != null and dataName != ''">and t2.data_name like concat('%',#{dataName},'%')</if>
<if test="purchaseMethod != null and purchaseMethod != ''">and t.purchase_method = #{purchaseMethod}</if>
<if test="categoryId != null">and t2.category_id = #{categoryId}</if>
<if test="departmentName != null">and t4.department_name = #{departmentName}</if>
</select>
<select id="queryOrderDetail" resultType="com.jz.manage.moduls.controller.order.bean.OrderDetailDto" parameterType="map">
select
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_money as orderMoney,
t.order_time as orderTime,
(case when t.payment_method ='01' then '余额' else '其他' end)AS paymentMethod,
(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,
t2.data_name as dataName,
(case when t2.data_type ='01' then 'API' when t2.data_type ='02' then '数据包' end) as dataType,
t4.department_name as departmentName
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
left join t_mall_customer t3 on t3.customer_id=t.customer_id
inner join t_department t4 on t4.department_id=t3.department_id
where 1=1 and t.del_flag='N'
<if test="orderId != null">and t.order_id = #{orderId}</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