diff --git a/hai-order/src/main/java/com/web/controller/OrderBWebController.java b/hai-order/src/main/java/com/web/controller/OrderBWebController.java new file mode 100644 index 00000000..f04a891c --- /dev/null +++ b/hai-order/src/main/java/com/web/controller/OrderBWebController.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 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 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); + } + } + +} diff --git a/hai-order/src/main/java/com/web/controller/OrderController.java b/hai-order/src/main/java/com/web/controller/OrderController.java index a88ad785..039a246c 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -140,7 +140,7 @@ public class OrderController { @RequestMapping(value="/refundOrder",method = RequestMethod.POST) @ResponseBody - @ApiOperation(value = "订单退款") + @ApiOperation(value = "交易订单退款") public ResponseData refundOrder(@RequestBody JSONObject body) { try { if (body == null || StringUtils.isBlank(body.getString("orderNo"))) { diff --git a/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java index 7b775d88..f6e33b25 100644 --- a/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java @@ -1,8 +1,12 @@ package com.hai.dao.order; +import com.hai.order.model.OrderCouponModal; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; +import java.util.List; +import java.util.Map; + /** * @className: OrderExtMapper * @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}") int userBuyCouponNum(@Param("userId") Long userId,@Param("couponId") Long couponId); + /** + * 查询卡券订单列表 + * @param param + * @return + */ + @Select("") + List queryOrderCouponList(@Param("param") Map param); + } diff --git a/hai-service/src/main/java/com/hai/order/model/OrderCouponModal.java b/hai-service/src/main/java/com/hai/order/model/OrderCouponModal.java new file mode 100644 index 00000000..0d28ae19 --- /dev/null +++ b/hai-service/src/main/java/com/hai/order/model/OrderCouponModal.java @@ -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; + + +} diff --git a/hai-service/src/main/java/com/hai/order/service/OrderServiceExt.java b/hai-service/src/main/java/com/hai/order/service/OrderServiceExt.java index 1afb4f15..ee7fddec 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderServiceExt.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderServiceExt.java @@ -1,5 +1,13 @@ 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 @@ -16,4 +24,11 @@ public interface OrderServiceExt { */ int userBuyCouponNum(Long userId,Long couponId); + /** + * 查询卡券订单列表 + * @param param + * @return + */ + List getOrderCouponList(Map param); + } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceExtImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceExtImpl.java index 4abc7a2f..a19c2aaf 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceExtImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceExtImpl.java @@ -1,10 +1,15 @@ package com.hai.order.service.impl; 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.service.HighGasOrderService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.List; +import java.util.Map; /** * @className: OrderExtServiceImpl @@ -21,4 +26,10 @@ public class OrderServiceExtImpl implements OrderServiceExt { public int userBuyCouponNum(Long userId, Long couponId) { return orderMapperExt.userBuyCouponNum(userId,couponId); } + + @Override + public List getOrderCouponList(Map param) { + return orderMapperExt.queryOrderCouponList(param); + } + } diff --git a/hai-service/src/main/java/com/hai/service/HighGasOrderService.java b/hai-service/src/main/java/com/hai/service/HighGasOrderService.java index b209459c..59ebaf9c 100644 --- a/hai-service/src/main/java/com/hai/service/HighGasOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighGasOrderService.java @@ -2,6 +2,9 @@ package com.hai.service; import com.hai.entity.HighGasOrder; +import java.util.List; +import java.util.Map; + /** * 加油订单 * @className: HighGasOrderService @@ -29,4 +32,11 @@ public interface HighGasOrderService { */ HighGasOrder getDetailByChildOrderNo(String childOrderNo); + /** + * 查询油站订单列表 + * @param param + * @return + */ + List getGasOrderList(Map param); + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasOrderServiceImpl.java index d6b28afe..f4d5c085 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGasOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasOrderServiceImpl.java @@ -4,11 +4,14 @@ import com.hai.dao.HighGasOrderMapper; import com.hai.entity.HighGasOrder; import com.hai.entity.HighGasOrderExample; import com.hai.service.HighGasOrderService; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; import java.util.List; +import java.util.Map; /** * @className: HighGasOrderServiceImpl @@ -42,4 +45,77 @@ public class HighGasOrderServiceImpl implements HighGasOrderService { } return null; } + + @Override + public List getGasOrderList(Map 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); + } }