parent
0090949543
commit
f95e0b92ea
@ -0,0 +1,189 @@ |
||||
package com.web.controller.business; |
||||
|
||||
import com.alibaba.excel.EasyExcel; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.hai.common.exception.ErrorCode; |
||||
import com.hai.common.exception.ErrorHelp; |
||||
import com.hai.common.exception.SysCode; |
||||
import com.hai.common.security.UserCenter; |
||||
import com.hai.common.utils.ResponseMsgUtil; |
||||
import com.hai.entity.HighCoupon; |
||||
import com.hai.entity.HighGasOrder; |
||||
import com.hai.enum_type.UserObjectTypeEnum; |
||||
import com.hai.enum_type.UserRoleTypeEnum; |
||||
import com.hai.model.ResponseData; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.order.model.ExportGasOrderModel; |
||||
import com.hai.order.model.OrderCouponModel; |
||||
import com.hai.order.service.OrderService; |
||||
import com.hai.order.service.OrderServiceExt; |
||||
import com.hai.order.type.OrderOilStatus; |
||||
import com.hai.service.HighCouponService; |
||||
import com.hai.service.HighGasOrderService; |
||||
import com.web.config.SysConst; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.io.File; |
||||
import java.math.BigDecimal; |
||||
import java.util.*; |
||||
|
||||
@Controller |
||||
@RequestMapping(value = "coupon") |
||||
@Api(value = "卡券订单业务") |
||||
public class OrderCouponController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(OrderCouponController.class); |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@Resource |
||||
private OrderService orderService; |
||||
|
||||
@Resource |
||||
private HighCouponService couponService; |
||||
|
||||
@Resource |
||||
private OrderServiceExt orderServiceExt; |
||||
|
||||
@RequestMapping(value = "/getOrderList", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询卡券订单列表") |
||||
public ResponseData getOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, |
||||
@RequestParam(name = "memPhone", required = false) String memPhone, |
||||
@RequestParam(name = "couponName", required = false) String couponName, |
||||
@RequestParam(name = "payType", required = false) Integer payType, |
||||
@RequestParam(name = "orderStatus", required = false) Integer orderStatus, |
||||
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
||||
@RequestParam(name = "createTimeE", required = false) Long createTimeE, |
||||
@RequestParam(name = "payTimeS", required = false) Long payTimeS, |
||||
@RequestParam(name = "payTimeE", required = false) Long payTimeE, |
||||
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS, |
||||
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE, |
||||
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(name = "pageSize", required = true) Integer pageSize, |
||||
HttpServletRequest request) { |
||||
try { |
||||
|
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userInfoModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
|
||||
Map<String,Object> map = new HashMap<>(); |
||||
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { |
||||
|
||||
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { |
||||
map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId())); |
||||
} else { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
|
||||
map.put("orderNo", orderNo); |
||||
map.put("memPhone", memPhone); |
||||
map.put("couponName", couponName); |
||||
map.put("payType", payType); |
||||
map.put("orderStatus", orderStatus); |
||||
map.put("createTimeS", createTimeS); |
||||
map.put("createTimeE", createTimeE); |
||||
map.put("payTimeS", payTimeS); |
||||
map.put("payTimeE", payTimeE); |
||||
map.put("finishTimeS", finishTimeS); |
||||
map.put("finishTimeE", finishTimeE); |
||||
|
||||
PageHelper.startPage(pageNum,pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(orderServiceExt.getOrderCouponList(map))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("OrderCouponController --> getOrderList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/exportOrderCouponExcel", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "导出卡券订单") |
||||
public ResponseData exportOrderCouponExcel(@RequestParam(name = "orderNo", required = false) String orderNo, |
||||
@RequestParam(name = "memPhone", required = false) String memPhone, |
||||
@RequestParam(name = "couponName", required = false) String couponName, |
||||
@RequestParam(name = "payType", required = false) Integer payType, |
||||
@RequestParam(name = "orderStatus", required = false) Integer orderStatus, |
||||
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
||||
@RequestParam(name = "createTimeE", required = false) Long createTimeE, |
||||
@RequestParam(name = "payTimeS", required = false) Long payTimeS, |
||||
@RequestParam(name = "payTimeE", required = false) Long payTimeE, |
||||
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS, |
||||
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE, |
||||
HttpServletRequest request) { |
||||
try { |
||||
|
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userInfoModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
Map<String,Object> map = new HashMap<>(); |
||||
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { |
||||
|
||||
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { |
||||
map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId())); |
||||
} else { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
map.put("orderNo", orderNo); |
||||
map.put("memPhone", memPhone); |
||||
map.put("couponName", couponName); |
||||
map.put("payType", payType); |
||||
map.put("orderStatus", orderStatus); |
||||
map.put("createTimeS", createTimeS); |
||||
map.put("createTimeE", createTimeE); |
||||
map.put("payTimeS", payTimeS); |
||||
map.put("payTimeE", payTimeE); |
||||
map.put("finishTimeS", finishTimeS); |
||||
map.put("finishTimeE", finishTimeE); |
||||
|
||||
List<OrderCouponModel> list = orderServiceExt.getOrderCouponList(map); |
||||
|
||||
String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; |
||||
EasyExcel.write(SysConst.getSysConfig().getFileUrl() + fileName, OrderCouponModel.class) |
||||
.sheet("卡券订单") |
||||
.doWrite(list); |
||||
|
||||
return ResponseMsgUtil.success(fileName); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOrderController --> getUserOrderList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getOrderDetail",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询卡券订单详情") |
||||
public ResponseData getOrderDetail(@RequestParam(name = "orderNo", required = false) String orderNo) { |
||||
try { |
||||
|
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("tradeOrder", orderService.getOrderDetailByNo(orderNo)); |
||||
|
||||
return ResponseMsgUtil.success(param); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("OrderCouponController -> getOrderDetail() error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,72 +0,0 @@ |
||||
package com.hai.order.model; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 卡券订单模型 |
||||
* @className: OrderCouponModal |
||||
* @author: HuRui |
||||
* @date: 2022/9/14 |
||||
**/ |
||||
@Data |
||||
public class OrderCouponModal { |
||||
|
||||
// 交易订单id
|
||||
private Long orderId; |
||||
|
||||
// 交易订单号
|
||||
private String orderNo; |
||||
|
||||
// 第三方交易流水号
|
||||
private String paySerialNo; |
||||
|
||||
// 子订单id
|
||||
private Long childOrderId; |
||||
|
||||
// 子订单号
|
||||
private String childOrderNo; |
||||
|
||||
// 用户手机号
|
||||
private String memPhone; |
||||
|
||||
// 积分抵扣
|
||||
private Integer integralDeduct; |
||||
|
||||
// 支付方式
|
||||
private Integer payType; |
||||
|
||||
// 产品id
|
||||
private Long goodsId; |
||||
|
||||
// 产品名称
|
||||
private String goodsName; |
||||
|
||||
// 产品价格
|
||||
private BigDecimal goodsPrice; |
||||
|
||||
// 产品实际价格
|
||||
private BigDecimal goodsActualPrice; |
||||
|
||||
// 子订单状态
|
||||
private Integer childOrderStatus; |
||||
|
||||
// 创建时间
|
||||
private Date createTime; |
||||
|
||||
// 支付时间
|
||||
private Date payTime; |
||||
|
||||
// 完成时间
|
||||
private Date finishTime; |
||||
|
||||
// 取消时间
|
||||
private Date cancelTime; |
||||
|
||||
// 退款时间
|
||||
private Date refundTime; |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue