提交代码

dev-discount
胡锐 2 years ago
parent 5397b66b1a
commit 74dd3f47bf
  1. 175
      hai-order/src/main/java/com/web/controller/OrderBWebController.java
  2. 2
      hai-order/src/main/java/com/web/controller/OrderController.java
  3. 49
      hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java
  4. 72
      hai-service/src/main/java/com/hai/order/model/OrderCouponModal.java
  5. 15
      hai-service/src/main/java/com/hai/order/service/OrderServiceExt.java
  6. 11
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceExtImpl.java
  7. 10
      hai-service/src/main/java/com/hai/service/HighGasOrderService.java
  8. 76
      hai-service/src/main/java/com/hai/service/impl/HighGasOrderServiceImpl.java

@ -0,0 +1,175 @@
package com.web.controller;
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.enum_type.UserObjectTypeEnum;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.order.service.OrderService;
import com.hai.order.service.OrderServiceExt;
import com.hai.service.HighGasOrderService;
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 java.util.HashMap;
import java.util.Map;
/**
* @className: OrderExtController
* @author: HuRui
* @date: 2022/9/14
**/
@Controller
@RequestMapping(value = "bweb")
@Api(value = "订单业务")
public class OrderBWebController {
private static Logger log = LoggerFactory.getLogger(OrderBWebController.class);
@Resource
private UserCenter userCenter;
@Resource
private OrderService orderService;
@Resource
private OrderServiceExt orderServiceExt;
@Resource
private HighGasOrderService gasOrderService;
@RequestMapping(value="/getCouponOrderList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询卡券订单列表")
public ResponseData getCouponOrderList(@RequestParam(name = "companyId", required = false) Long companyId,
@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "orderStatus", required = false) Integer orderStatus,
@RequestParam(name = "childOrderNo", required = false) String childOrderNo,
@RequestParam(name = "goodsId", required = false) Long goodsId,
@RequestParam(name = "goodsName", required = false) String goodsName,
@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 = "refundTimeS", required = false) Long refundTimeS,
@RequestParam(name = "refundTimeE", required = false) Long refundTimeE,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize
) {
try {
Map<String, Object> param = new HashMap<>();
param.put("companyId", companyId);
param.put("orderNo", orderNo);
param.put("orderStatus", orderStatus);
param.put("childOrderNo", childOrderNo);
param.put("goodsId", goodsId);
param.put("goodsName", goodsName);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
param.put("payTimeS", payTimeS);
param.put("payTimeE", payTimeE);
param.put("refundTimeS", refundTimeS);
param.put("refundTimeE", refundTimeE);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(orderServiceExt.getOrderCouponList(param));
} catch (Exception e) {
log.error("OrderExtController -> getCouponOrderList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getGasOrderList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询油站订单列表")
public ResponseData getGasOrderList(@RequestParam(name = "companyId", required = false) Long companyId,
@RequestParam(name = "merId", required = false) Long merId,
@RequestParam(name = "storeId", required = false) Long storeId,
@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "childOrderNo", required = false) String childOrderNo,
@RequestParam(name = "gasOilType", required = false) Integer gasOilType,
@RequestParam(name = "gasOilNo", required = false) String gasOilNo,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "gasSalesmanId", required = false) Long gasSalesmanId,
@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 = "refundTimeS", required = false) Long refundTimeS,
@RequestParam(name = "refundTimeE", required = false) Long refundTimeE,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize
) {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
log.error("OrderBWebController -> getGasOrderList() error!", "用户身份错误或已过期");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");
}
Map<String, Object> param = new HashMap<>();
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) {
param.put("companyId", companyId);
param.put("merId", merId);
param.put("storeId", storeId);
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) {
param.put("companyId", userInfoModel.getBsCompany().getId());
param.put("merId", merId);
param.put("storeId", storeId);
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type2.getType())) {
param.put("merId", userInfoModel.getMerchant().getId());
param.put("storeId", storeId);
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type3.getType())) {
param.put("storeId", userInfoModel.getMerchantStore().getId());
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type6.getType())) {
param.put("gasAgentId", userInfoModel.getMerchantStore().getId());
param.put("gasSalesmanId", gasSalesmanId);
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type7.getType())) {
param.put("gasSalesmanId", userInfoModel.getMerchantStore().getId());
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type8.getType())) {
param.put("gasStaffId", userInfoModel.getGasStaff().getId());
} else {
log.error("OrderBWebController -> getGasOrderList() error!", "未知用户身份");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知用户身份");
}
param.put("orderNo", orderNo);
param.put("childOrderNo", childOrderNo);
param.put("status", status);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
param.put("payTimeS", payTimeS);
param.put("payTimeE", payTimeE);
param.put("refundTimeS", refundTimeS);
param.put("refundTimeE", refundTimeE);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(gasOrderService.getGasOrderList(param)));
} catch (Exception e) {
log.error("OrderExtController -> getCouponOrderList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -140,7 +140,7 @@ public class OrderController {
@RequestMapping(value="/refundOrder",method = RequestMethod.POST) @RequestMapping(value="/refundOrder",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "订单退款") @ApiOperation(value = "交易订单退款")
public ResponseData refundOrder(@RequestBody JSONObject body) { public ResponseData refundOrder(@RequestBody JSONObject body) {
try { try {
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) { if (body == null || StringUtils.isBlank(body.getString("orderNo"))) {

@ -1,8 +1,12 @@
package com.hai.dao.order; package com.hai.dao.order;
import com.hai.order.model.OrderCouponModal;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/** /**
* @className: OrderExtMapper * @className: OrderExtMapper
* @author: HuRui * @author: HuRui
@ -19,4 +23,49 @@ public interface OrderMapperExt {
@Select("SELECT count(1) FROM high_child_order where mem_id = #{userId} and child_order_status in (2,3) and goods_type = 1 and goods_id = #{couponId}") @Select("SELECT count(1) FROM high_child_order where mem_id = #{userId} and child_order_status in (2,3) and goods_type = 1 and goods_id = #{couponId}")
int userBuyCouponNum(@Param("userId") Long userId,@Param("couponId") Long couponId); int userBuyCouponNum(@Param("userId") Long userId,@Param("couponId") Long couponId);
/**
* 查询卡券订单列表
* @param param
* @return
*/
@Select("<script>" +
" select" +
" a.order_id orderId," +
" a.order_no orderNo," +
" b.pay_serial_no paySerialNo," +
" a.id childOrderId," +
" a.child_order_no childOrderNo," +
" a.mem_phone memPhone," +
" b.pay_gold integralDeduct," +
" b.pay_type payType," +
" a.goods_id goodsId," +
" a.goods_name goodsName," +
" a.goods_price goodsPrice," +
" a.goods_actual_price goodsActualPrice," +
" a.child_order_status childOrderStatus," +
" a.create_time createTime," +
" a.pay_time payTime," +
" a.finish_time finishTime," +
" a.cancel_time cancelTime," +
" a.refund_time refundTime" +
" from high_child_order a" +
" LEFT JOIN high_order b on b.id = a.order_id" +
" where a.goods_type = 1 and a.giveaway_type = 0" +
" <if test='param.orderNo != null'> and a.order_no LIKE concat('%',#{param.orderNo},'%') </if>" +
" <if test='param.paySerialNo != null'> and b.pay_serial_no LIKE concat('%',#{param.paySerialNo},'%') </if>" +
" <if test='param.payType != null'> and a.pay_type = #{param.payType} </if>" +
" <if test='param.childOrderNo != null'> and a.child_order_no = #{param.childOrderNo} </if>" +
" <if test='param.memPhone != null'> and a.mem_phone = #{param.memPhone} </if>" +
" <if test='param.goodsName != null'> and b.goods_name LIKE concat('%',#{param.goodsName},'%') </if>" +
" <if test='param.childOrderStatus != null'> and b.child_order_status = #{param.childOrderStatus} </if>" +
" <if test='param.createTimeS != null'> <![CDATA[ and a.create_time >= #{param.createTimeS} ]]> </if>" +
" <if test='param.createTimeE != null'> <![CDATA[ and a.create_time <= #{param.createTimeE} ]]> </if>" +
" <if test='param.payTimeS != null'> <![CDATA[ and a.pay_time >= #{param.payTimeS} ]]> </if>" +
" <if test='param.payTimeE != null'> <![CDATA[ and a.pay_time <= #{param.payTimeE} ]]> </if>" +
" <if test='param.refundTimeS != null'> <![CDATA[ and a.refund_time >= #{param.refundTimeS} ]]> </if>" +
" <if test='param.refundTimeE != null'> <![CDATA[ and a.refund_time <= #{param.refundTimeE} ]]> </if>" +
" ORDER BY a.create_time desc" +
"</script>")
List<OrderCouponModal> queryOrderCouponList(@Param("param") Map<String, Object> param);
} }

@ -0,0 +1,72 @@
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;
}

@ -1,5 +1,13 @@
package com.hai.order.service; package com.hai.order.service;
import com.hai.entity.HighGasOrder;
import com.hai.model.OrderCountModel;
import com.hai.order.model.OrderCouponModal;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/** /**
* 订单扩展服务 * 订单扩展服务
* @className: OrderExtService * @className: OrderExtService
@ -16,4 +24,11 @@ public interface OrderServiceExt {
*/ */
int userBuyCouponNum(Long userId,Long couponId); int userBuyCouponNum(Long userId,Long couponId);
/**
* 查询卡券订单列表
* @param param
* @return
*/
List<OrderCouponModal> getOrderCouponList(Map<String, Object> param);
} }

@ -1,10 +1,15 @@
package com.hai.order.service.impl; package com.hai.order.service.impl;
import com.hai.dao.order.OrderMapperExt; import com.hai.dao.order.OrderMapperExt;
import com.hai.entity.HighGasOrder;
import com.hai.order.model.OrderCouponModal;
import com.hai.order.service.OrderServiceExt; import com.hai.order.service.OrderServiceExt;
import com.hai.service.HighGasOrderService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/** /**
* @className: OrderExtServiceImpl * @className: OrderExtServiceImpl
@ -21,4 +26,10 @@ public class OrderServiceExtImpl implements OrderServiceExt {
public int userBuyCouponNum(Long userId, Long couponId) { public int userBuyCouponNum(Long userId, Long couponId) {
return orderMapperExt.userBuyCouponNum(userId,couponId); return orderMapperExt.userBuyCouponNum(userId,couponId);
} }
@Override
public List<OrderCouponModal> getOrderCouponList(Map<String, Object> param) {
return orderMapperExt.queryOrderCouponList(param);
}
} }

@ -2,6 +2,9 @@ package com.hai.service;
import com.hai.entity.HighGasOrder; import com.hai.entity.HighGasOrder;
import java.util.List;
import java.util.Map;
/** /**
* 加油订单 * 加油订单
* @className: HighGasOrderService * @className: HighGasOrderService
@ -29,4 +32,11 @@ public interface HighGasOrderService {
*/ */
HighGasOrder getDetailByChildOrderNo(String childOrderNo); HighGasOrder getDetailByChildOrderNo(String childOrderNo);
/**
* 查询油站订单列表
* @param param
* @return
*/
List<HighGasOrder> getGasOrderList(Map<String, Object> param);
} }

@ -4,11 +4,14 @@ import com.hai.dao.HighGasOrderMapper;
import com.hai.entity.HighGasOrder; import com.hai.entity.HighGasOrder;
import com.hai.entity.HighGasOrderExample; import com.hai.entity.HighGasOrderExample;
import com.hai.service.HighGasOrderService; import com.hai.service.HighGasOrderService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @className: HighGasOrderServiceImpl * @className: HighGasOrderServiceImpl
@ -42,4 +45,77 @@ public class HighGasOrderServiceImpl implements HighGasOrderService {
} }
return null; return null;
} }
@Override
public List<HighGasOrder> getGasOrderList(Map<String, Object> param) {
HighGasOrderExample example = new HighGasOrderExample();
HighGasOrderExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(param, "companyId") != null) {
}
if (MapUtils.getLong(param, "merId") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(param, "merId"));
}
if (MapUtils.getLong(param, "storeId") != null) {
criteria.andStoreIdEqualTo(MapUtils.getLong(param, "storeId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "storeName"))) {
criteria.andStoreNameLike("%"+MapUtils.getString(param, "storeName")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "orderNo"))) {
criteria.andOrderNoLike("%"+MapUtils.getString(param, "orderNo")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "childOrderNo"))) {
criteria.andChildOrderNoLike("%"+MapUtils.getString(param, "childOrderNo")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "memPhone"))) {
criteria.andMemPhoneLike("%"+MapUtils.getString(param, "memPhone")+"%");
}
if (MapUtils.getInteger(param, "gasOilType") != null) {
criteria.andGasOilTypeEqualTo(MapUtils.getInteger(param, "storeId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "gasOilNo"))) {
criteria.andGasOilNoEqualTo(MapUtils.getString(param, "gasOilNo"));
}
if (MapUtils.getInteger(param, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status"));
}
if (MapUtils.getLong(param, "createTimeS") != null) {
criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeS")));
}
if (MapUtils.getLong(param, "createTimeE") != null) {
criteria.andCreateTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeE")));
}
if (MapUtils.getLong(param, "payTimeS") != null) {
criteria.andPayTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "payTimeS")));
}
if (MapUtils.getLong(param, "payTimeE") != null) {
criteria.andPayTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "payTimeE")));
}
if (MapUtils.getLong(param, "refundTimeS") != null) {
criteria.andRefundTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "refundTimeS")));
}
if (MapUtils.getLong(param, "refundTimeE") != null) {
criteria.andRefundTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "refundTimeE")));
}
example.setOrderByClause("create_time desc");
return gasOrderMapper.selectByExample(example);
}
} }

Loading…
Cancel
Save