1 files added
30 files modified
| | |
| | | private String generateOrderSn; |
| | | @Value("${wx.enabled}") |
| | | private Boolean wxEnabled; |
| | | private static final String T = "-T-"; |
| | | private static final String T = "T-"; |
| | | private static final String OY = "OY-"; |
| | | private RedisTemplate<Object, Object> redisTemplate; |
| | | |
| | | public RedisUtils(RedisTemplate<Object, Object> redisTemplate) { |
| | |
| | | public String generateOrderSn(Integer i) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | String date = new SimpleDateFormat("yyyyMMdd").format(new Date()); |
| | | String key = generateOrderSn + date; |
| | | String key = generateOrderSn + i + date; |
| | | Long increment = increment(key); |
| | | sb.append(date); |
| | | sb.append(String.format("%04d", i)); |
| | |
| | | } |
| | | if (wxEnabled) { |
| | | // 生产环境 |
| | | return sb.toString(); |
| | | return OY + sb.toString(); |
| | | } else { |
| | | // 测试环境 |
| | | return T + sb.toString(); |
| | |
| | | |
| | | /** |
| | | * 批量模糊删除key |
| | | * |
| | | * @param pattern |
| | | */ |
| | | public void scanDel(String pattern){ |
| | |
| | | |
| | | /** |
| | | * 递增 |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 递减 |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | |
| | | ONE(1, "支付成功"), |
| | | TWO(2, "商家已接单"), |
| | | THREE(3, "骑手已接单"), |
| | | FOUR(4, "商家已接单"), |
| | | FIVE(5, "商家已备货"), |
| | | SIX(6, "骑手已到店"), |
| | | SEVEN(7, "骑手已取货"), |
| | | EIGHT(8, "商品已送达"), |
| | | NINE(9, "订单已完成"), |
| | | FOUR(4, "商家已备货"), |
| | | FIVE(5, "骑手已到店"), |
| | | SIX(6, "骑手已取货,正在送货"), |
| | | SEVEN(7, "商品已送达"), |
| | | EIGHT(8, "订单已完成"), |
| | | UNKNOWN(99, "未知枚举"); |
| | | |
| | | private final Integer key; |
| | |
| | | import com.oying.modules.hwc.utils.SignUtil; |
| | | import com.oying.modules.hwc.utils.XmlUtils; |
| | | import com.oying.modules.security.config.SwiftPassProperties; |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.OrderReturn; |
| | | import com.oying.modules.sh.domain.vo.OrderResponse; |
| | | import com.oying.modules.sh.service.OrderReturnService; |
| | | import com.oying.modules.sh.service.OrderService; |
| | | import com.oying.utils.enums.PayStateEnum; |
| | |
| | | String sign_type = map.get("sign_type"); |
| | | String reSign = map.get("sign"); |
| | | if (map.containsKey("sign")) { |
| | | Order order = orderService.getByOrderNum(map.get("out_trade_no")); |
| | | PayTypeEnum status = PayTypeEnum.find(order.getPayType()); |
| | | OrderResponse order = orderService.getByOrderNum(map.get("out_trade_no")); |
| | | PayTypeEnum status = PayTypeEnum.find(order.getOrder().getPayType()); |
| | | if (SignUtil.verifySign(reSign, sign_type, map, properties, status)) { |
| | | log.error("验证签名错误!:{}", map.toString()); |
| | | } else { |
| | | if ("0".equals(map.get("status"))) { |
| | | if ("0".equals(map.get("result_code"))) { |
| | | //业务处理 |
| | | if (PayStateEnum.SUCCESS.getKey().equals(order.getPayState())) { |
| | | if (PayStateEnum.SUCCESS.getKey().equals(order.getOrder().getPayState())) { |
| | | // 已处理 |
| | | respString = "success"; |
| | | } else { |
| | | PayStateEnum stateEnum = PayStateEnum.NOTPAY; |
| | | if ("0".equals(map.get("pay_result"))) { |
| | | stateEnum = PayStateEnum.SUCCESS; |
| | | orderService.paySuccess(order); |
| | | } |
| | | orderService.updatePayStatus(map.get("out_trade_no"), stateEnum, map.get("pay_info"), map.get("time_end")); |
| | | // 处理成功 |
| | |
| | | private Long orderId; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "用户角色") |
| | | @ApiModelProperty(value = "商品") |
| | | private Set<OrderProductSnapshot> productSnapshots; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNum; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "取单号") |
| | | private String orderStoreNum; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "订单状态") |
| | |
| | | @ApiModelProperty(value = "订单状态描述") |
| | | private String orderStatusDescribe; |
| | | |
| | | @ApiModelProperty(value = "订单状态描述") |
| | | @ApiModelProperty(value = "订单备注") |
| | | private String orderRemark; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "预计送达时间") |
| | | private String orderTime; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "配送费") |
| | | private BigDecimal sendPrice; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "配送类型") |
| | | private String sendType; |
| | | |
| | | @ApiModelProperty(value = "骑手Id") |
| | | private Long riderId; |
| | | |
| | | @ApiModelProperty(value = "骑手手机号") |
| | | private String riderPhone; |
| | | |
| | | @ApiModelProperty(value = "骑手名称") |
| | | private String riderName; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "用户id") |
| | |
| | | if (o == null || getClass() != o.getClass()) { |
| | | return false; |
| | | } |
| | | Order user = (Order) o; |
| | | return Objects.equals(orderId, user.orderId) && |
| | | Objects.equals(orderNum, user.orderNum); |
| | | Order order = (Order) o; |
| | | return Objects.equals(orderId, order.orderId) && |
| | | Objects.equals(orderNum, order.orderNum); |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | return Objects.hash(orderId, username); |
| | | return Objects.hash(orderId, orderNum); |
| | | } |
| | | |
| | | public void copy(Order source){ |
| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | |
| | | import java.math.BigDecimal; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * @description / |
| | | * @author lixin |
| | | * @description / |
| | | * @date 2025-06-11 |
| | | **/ |
| | | @Getter |
| | |
| | | private Long logId; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNum; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "用户账号") |
| | | private String username; |
| | | |
| | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | @NotNull |
| | | @NotBlank |
| | | @ApiModelProperty(value = "操作时的订单快照") |
| | | private String snapshotData; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "操作时间") |
| | | private Timestamp operationTime; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNum; |
| | | |
| | | public void copy(OrderOperationLog source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | |
| | | package com.oying.modules.sh.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.oying.base.BaseEntity; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNum; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "预计送达时间") |
| | | private String orderTime; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "取单号") |
| | | private String orderStoreNum; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "配送费") |
| | | private BigDecimal sendPrice; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "配送类型") |
| | | private String sendType; |
| | | |
| | | @ApiModelProperty(value = "骑手Id") |
| | | private Long riderId; |
| | | |
| | | @ApiModelProperty(value = "骑手手机号") |
| | | private String riderPhone; |
| | | |
| | | @ApiModelProperty(value = "骑手名称") |
| | | private String riderName; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "支付类型") |
| | |
| | | @ApiModelProperty(value = "审核信息") |
| | | private String auditMessage; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "商品") |
| | | private Set<OrderReturnProductSnapshot> productSnapshots; |
| | | |
| | | @Override |
| | | public boolean equals(Object o) { |
| | | if (this == o) { |
| | | return true; |
| | | } |
| | | if (o == null || getClass() != o.getClass()) { |
| | | return false; |
| | | } |
| | | OrderReturn info = (OrderReturn) o; |
| | | return Objects.equals(returnId, info.returnId) && |
| | | Objects.equals(returnNum, info.returnNum); |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | return Objects.hash(returnId, returnNum); |
| | | } |
| | | |
| | | public void copy(OrderReturn source) { |
| | | BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | |
| | | import java.math.BigDecimal; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.Objects; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | /** |
| | | * @description / |
| | | * @author lixin |
| | | * @description / |
| | | * @date 2025-06-11 |
| | | **/ |
| | | @Data |
| | |
| | | @ApiModelProperty(value = "实付金额") |
| | | private BigDecimal actuallyPayPrice; |
| | | |
| | | @Override |
| | | public boolean equals(Object o) { |
| | | if (this == o) { |
| | | return true; |
| | | } |
| | | if (o == null || getClass() != o.getClass()) { |
| | | return false; |
| | | } |
| | | OrderReturnProductSnapshot snapshot = (OrderReturnProductSnapshot) o; |
| | | return Objects.equals(snapshotId, snapshot.snapshotId); |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | return Objects.hash(snapshotId); |
| | | } |
| | | |
| | | public void copy(OrderReturnProductSnapshot source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import java.math.BigDecimal; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | |
| | | @ApiModelProperty(value = "纬度") |
| | | private BigDecimal latitude; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "是否默认: false") |
| | | private Boolean isDefault = false; |
| | | |
| | |
| | | package com.oying.modules.sh.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "每页数据量", example = "10") |
| | | private Integer size = 10; |
| | | |
| | | @ApiModelProperty(value = "商品模糊查询") |
| | | @ApiModelProperty(value = "模糊查询(订单号、用户账号、描述、商品编号、条形码、商品名称、商品标题、商品描述)") |
| | | private String blurry; |
| | | |
| | | @ApiModelProperty(value = "订单状态") |
| | | private Integer orderStatus; |
| | | private List<Integer> orderStatus; |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | @ApiModelProperty(value = "订单号模糊查询") |
| | | private String orderNum; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "用户账号") |
| | | @ApiModelProperty(value = "用户账号模糊查询") |
| | | private String username; |
| | | |
| | | @ApiModelProperty(value = "门店ID") |
| | | private Long storeId; |
| | | |
| | | @ApiModelProperty(value = "描述") |
| | | @ApiModelProperty(value = "描述模糊查询") |
| | | private String orderDescribe; |
| | | |
| | | @ApiModelProperty(value = "支付状态") |
| | |
| | | @ApiModelProperty(value = "每页数据量", example = "10") |
| | | private Integer size = 10; |
| | | |
| | | @ApiModelProperty(value = "偏移量", hidden = true) |
| | | private long offset; |
| | | |
| | | @ApiModelProperty(value = "商品模糊查询") |
| | | private String blurry; |
| | | |
| | | @ApiModelProperty(value = "退单号") |
| | | private String returnNum; |
| | | |
| | | @ApiModelProperty(value = "订单状态") |
| | | private Integer returnStatus; |
| | | private List<Integer> returnStatus; |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNum; |
| | |
| | | private List<ProductOrder> products; |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | @NotBlank(message = "支付类型不能为空") |
| | | @NotNull(message = "支付类型不能为空") |
| | | @ApiModelProperty(value = "支付类型") |
| | | private PayTypeEnum payType; |
| | | |
New file |
| | |
| | | package com.oying.modules.sh.domain.vo; |
| | | |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.OrderAddressSnapshot; |
| | | import com.oying.modules.sh.domain.OrderOperationLog; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author xin |
| | | * @description |
| | | * @date 2025/7/14 14:51 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class OrderResponse { |
| | | |
| | | private Order order; |
| | | |
| | | private OrderAddressSnapshot address; |
| | | |
| | | private List<OrderOperationLog> operation; |
| | | |
| | | } |
| | |
| | | |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.dto.OrderQueryCriteria; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | @Mapper |
| | | public interface OrderMapper extends BaseMapper<Order> { |
| | | |
| | | IPage<Order> findAll(@Param("criteria") OrderQueryCriteria criteria, Page<Object> page); |
| | | IPage<Order> findAll(@Param("criteria") OrderQueryCriteria criteria, @Param("blurry") String blurry, Page<Object> page); |
| | | |
| | | List<Order> findAll(@Param("criteria") OrderQueryCriteria criteria); |
| | | List<Order> findAll(@Param("criteria") OrderQueryCriteria criteria, @Param("blurry") String blurry); |
| | | |
| | | Long countAll(@Param("criteria") OrderQueryCriteria criteria); |
| | | Long countAll(@Param("criteria") OrderQueryCriteria criteria, @Param("blurry") String blurry); |
| | | |
| | | Order getByOrderNum(String orderNum); |
| | | |
| | | void updatePayStatus(String orderNum, String payState, String payMessage, String payTime); |
| | | |
| | | void updateCloseStatus(String orderNum, String payState); |
| | | |
| | | void updateOrderStatus(String orderNum, Integer key, String value); |
| | | } |
| | |
| | | |
| | | import com.oying.modules.sh.domain.OrderReturn; |
| | | import com.oying.modules.sh.domain.dto.OrderReturnQueryCriteria; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | |
| | | @Mapper |
| | | public interface OrderReturnMapper extends BaseMapper<OrderReturn> { |
| | | |
| | | IPage<OrderReturn> findAll(@Param("criteria") OrderReturnQueryCriteria criteria, Page<Object> page); |
| | | IPage<OrderReturn> findAll(@Param("criteria") OrderReturnQueryCriteria criteria, @Param("blurry") String blurry, Page<Object> page); |
| | | |
| | | List<OrderReturn> findAll(@Param("criteria") OrderReturnQueryCriteria criteria); |
| | | List<OrderReturn> findAll(@Param("criteria") OrderReturnQueryCriteria criteria, @Param("criteria") String blurry); |
| | | |
| | | OrderReturn getByReturnNum(String returnNum); |
| | | |
| | | void updatePayStatus(String returnNum, String status, String time); |
| | | |
| | | Long countAll(@Param("criteria") OrderReturnQueryCriteria criteria, @Param("criteria") String blurry); |
| | | } |
| | |
| | | package com.oying.modules.sh.rest; |
| | | |
| | | import com.oying.annotation.Log; |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.request.GeneratorOrder; |
| | | import com.oying.modules.sh.domain.request.SubmitOrder; |
| | | import com.oying.modules.sh.service.OrderService; |
| | |
| | | return new ResponseEntity<>(R.success(orderService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增订单信息") |
| | | @ApiOperation("新增订单信息") |
| | | @PreAuthorize("@el.check('order:add')") |
| | | public ResponseEntity<Object> create(@Validated @RequestBody Order order) { |
| | | orderService.create(order); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PostMapping("generator") |
| | | @Log("小程序:生成确认订单") |
| | | @ApiOperation("小程序:生成确认订单") |
| | |
| | | @Log("小程序:新增用户地址") |
| | | @ApiOperation("小程序:新增用户地址") |
| | | public ResponseEntity<Object> createUserAddress(@Validated @RequestBody UserAddress resources) { |
| | | if (resources.getAddressId() != null) { |
| | | throw new BadRequestException("新增用户地址主键必须为空"); |
| | | } |
| | | resources.setAddressId(null); |
| | | resources.setUserId(SecurityUtils.getCurrentUserId()); |
| | | userAddressService.create(resources); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(resources), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | |
| | | package com.oying.modules.sh.service; |
| | | |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.OrderAddressSnapshot; |
| | | import com.oying.modules.sh.domain.OrderOperationLog; |
| | | import com.oying.modules.sh.domain.dto.OrderOperationLogQueryCriteria; |
| | | import java.util.List; |
| | |
| | | void create(OrderOperationLog resources); |
| | | |
| | | /** |
| | | * 创建 |
| | | */ |
| | | void create(Order order, OrderAddressSnapshot addressSnapshot); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | |
| | | import com.oying.modules.sh.domain.request.GeneratorOrder; |
| | | import com.oying.modules.sh.domain.request.SubmitOrder; |
| | | import com.oying.modules.sh.domain.vo.OrderInfo; |
| | | import com.oying.modules.sh.domain.vo.OrderResponse; |
| | | import com.oying.utils.PageResult; |
| | | import com.oying.utils.enums.PayStateEnum; |
| | | |
| | |
| | | |
| | | Order submitOrder(SubmitOrder submit, HttpServletRequest request); |
| | | |
| | | Order getByOrderNum(String orderNum); |
| | | OrderResponse getByOrderNum(String orderNum); |
| | | |
| | | void paySuccess(Order order); |
| | | void paySuccess(OrderResponse order); |
| | | |
| | | void updatePayStatus(String outTradeNo, PayStateEnum stateEnum, String payInfo, String timeEnd); |
| | | |
| | |
| | | package com.oying.modules.sh.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.OrderAddressSnapshot; |
| | | import com.oying.modules.sh.domain.OrderOperationLog; |
| | | import com.oying.utils.FileUtil; |
| | | import com.oying.utils.*; |
| | | import com.oying.utils.enums.OrderStatusEnum; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.oying.modules.sh.mapper.OrderOperationLogMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.oying.utils.PageUtil; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @description 服务实现 |
| | | * @author lixin |
| | | * @description 服务实现 |
| | | * @date 2025-06-11 |
| | | **/ |
| | | @Service |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(Order order, OrderAddressSnapshot addressSnapshot) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("order", order); |
| | | map.put("address", addressSnapshot); |
| | | String username = SecurityUtils.getCurrentUsername(); |
| | | Timestamp time = new Timestamp(System.currentTimeMillis()); |
| | | OrderOperationLog resources = new OrderOperationLog(); |
| | | resources.setOrderNum(order.getOrderNum()); |
| | | resources.setUsername(username); |
| | | resources.setUserType(ConstantsKey.BUYER); |
| | | resources.setOperation(OrderStatusEnum.ZERO.getKey()); |
| | | resources.setOperationDescribe(OrderStatusEnum.ZERO.getValue()); |
| | | resources.setRemark(username + ":" + time + ">" + OrderStatusEnum.ZERO.getValue() + ":" + order.getOrderNum()); |
| | | resources.setSnapshotData(JSON.toJSONString(map)); |
| | | resources.setOperationTime(time); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(OrderOperationLog resources) { |
| | | OrderOperationLog orderOperationLog = getById(resources.getLogId()); |
| | | orderOperationLog.copy(resources); |
| | |
| | | |
| | | @Override |
| | | public PageResult<OrderReturn> queryAll(OrderReturnQueryCriteria criteria, Page<Object> page) { |
| | | return PageUtil.toPage(orderReturnMapper.findAll(criteria, page)); |
| | | criteria.setOffset(page.offset()); |
| | | List<OrderReturn> list = orderReturnMapper.findAll(criteria, criteria.getBlurry()); |
| | | Long total = orderReturnMapper.countAll(criteria, criteria.getBlurry()); |
| | | return PageUtil.toPage(list, total); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderReturn> queryAll(OrderReturnQueryCriteria criteria) { |
| | | return orderReturnMapper.findAll(criteria); |
| | | return orderReturnMapper.findAll(criteria, criteria.getBlurry()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.oying.modules.pc.product.service.ProductService; |
| | | import com.oying.modules.pc.store.domain.Store; |
| | | import com.oying.modules.pc.store.service.StoreService; |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.OrderAddressSnapshot; |
| | | import com.oying.modules.sh.domain.OrderProductSnapshot; |
| | | import com.oying.modules.sh.domain.UserAddress; |
| | | import com.oying.modules.sh.domain.*; |
| | | import com.oying.modules.sh.domain.request.GeneratorOrder; |
| | | import com.oying.modules.sh.domain.request.ProductOrder; |
| | | import com.oying.modules.sh.domain.request.SubmitOrder; |
| | | import com.oying.modules.sh.domain.vo.OrderInfo; |
| | | import com.oying.modules.sh.domain.vo.OrderResponse; |
| | | import com.oying.modules.sh.domain.vo.ProductInfo; |
| | | import com.oying.modules.sh.service.OrderAddressSnapshotService; |
| | | import com.oying.modules.sh.service.OrderProductSnapshotService; |
| | | import com.oying.modules.sh.service.UserAddressService; |
| | | import com.oying.modules.sh.service.*; |
| | | import com.oying.utils.*; |
| | | import com.oying.utils.enums.GenerateEnum; |
| | | import com.oying.utils.enums.OrderStatusEnum; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.oying.modules.sh.service.OrderService; |
| | | import com.oying.modules.sh.domain.dto.OrderQueryCriteria; |
| | | import com.oying.modules.sh.mapper.OrderMapper; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final OrderAddressSnapshotService addressSnapshotService; |
| | | private final RedisUtils redisUtils; |
| | | private final StoreService storeService; |
| | | private final OrderOperationLogService operationLogService; |
| | | private final static String DESCRIBE = "哦应:"; |
| | | |
| | | @Override |
| | | public PageResult<Order> queryAll(OrderQueryCriteria criteria, Page<Object> page) { |
| | | criteria.setOffset(page.offset()); |
| | | List<Order> list = orderMapper.findAll(criteria); |
| | | Long total = orderMapper.countAll(criteria); |
| | | List<Order> list = orderMapper.findAll(criteria, criteria.getBlurry()); |
| | | Long total = orderMapper.countAll(criteria, criteria.getBlurry()); |
| | | return PageUtil.toPage(list, total); |
| | | } |
| | | |
| | | @Override |
| | | public List<Order> queryAll(OrderQueryCriteria criteria) { |
| | | return orderMapper.findAll(criteria); |
| | | return orderMapper.findAll(criteria, criteria.getBlurry()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (openid == null || openid.isEmpty()) { |
| | | throw new BadRequestException("OPENID错误"); |
| | | } |
| | | |
| | | // 门店信息 |
| | | Store store = storeService.getById(submit.getStoreId()); |
| | | if (amount.compareTo(store.getDeliveryMinimum()) >= 0) { |
| | | throw new BadRequestException("起送金额:" + store.getDeliveryMinimum()); |
| | | } |
| | | // 订单信息 |
| | | Order order = new Order(); |
| | | order.setOrderNum(orderNum); |
| | | order.setOrderStoreNum(redisUtils.generateOrderSn(Math.toIntExact(submit.getStoreId())).substring(orderNum.length() - 4)); |
| | | order.setOrderStatus(OrderStatusEnum.ZERO.getKey()); |
| | | order.setOrderStatusDescribe(OrderStatusEnum.ZERO.getValue()); |
| | | order.setOrderRemark(submit.getRemark() != null ? submit.getRemark() : ""); |
| | | order.setOrderTime(submit.getDateTime()); |
| | | order.setUserId(SecurityUtils.getCurrentUserId()); |
| | | order.setUsername(SecurityUtils.getCurrentUsername()); |
| | | Store store = storeService.getById(submit.getStoreId()); |
| | | order.setStoreId(submit.getStoreId()); |
| | | order.setStoreName(store.getStoreName()); |
| | | order.setStoreLogo(store.getLogoImageUrl()); |
| | | order.setSendPrice(store.getDeliveryFee()); |
| | | order.setOrderDescribe(DESCRIBE + submit.getStoreId()); |
| | | order.setOriginalPrice(amount); |
| | | order.setPaidPrice(amount); |
| | |
| | | order.setPayTime(DateUtil.localDateTimeFormat(now.toLocalDateTime(), DateUtil.SDF_YMDHMS)); |
| | | } |
| | | UserAddress address = userAddressService.getById(submit.getAddressId()); |
| | | OrderAddressSnapshot snapshot = getOrderAddressSnapshot(orderNum, address); |
| | | addressSnapshotService.save(snapshot); |
| | | OrderAddressSnapshot addressSnapshot = getOrderAddressSnapshot(orderNum, address); |
| | | |
| | | addressSnapshotService.save(addressSnapshot); |
| | | orderMapper.insert(order); |
| | | productSnapshotService.saveBatch(snapshots); |
| | | |
| | | order.setProductSnapshots(new HashSet<>(snapshots)); |
| | | operationLogService.create(order, addressSnapshot); |
| | | return order; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Order getByOrderNum(String orderNum) { |
| | | return orderMapper.getByOrderNum(orderNum); |
| | | public OrderResponse getByOrderNum(String orderNum) { |
| | | OrderResponse response = new OrderResponse(); |
| | | response.setOrder(orderMapper.getByOrderNum(orderNum)); |
| | | response.setAddress(addressSnapshotService.queryByOrderNum(orderNum)); |
| | | response.setOperation(operationLogService.getByOrderNum(orderNum)); |
| | | return response; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void paySuccess(Order order) { |
| | | public void paySuccess(OrderResponse order) { |
| | | orderMapper.updateOrderStatus(order.getOrder().getOrderNum(), OrderStatusEnum.TWO.getKey(), OrderStatusEnum.TWO.getValue()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void closeOrder(String orderNum) { |
| | | Order order = getByOrderNum(orderNum); |
| | | Order order = orderMapper.getByOrderNum(orderNum); |
| | | if (order == null) { |
| | | throw new BadRequestException("订单不存在"); |
| | | } |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(Order resources) { |
| | | orderMapper.insert(resources); |
| | | throw new BadRequestException("未开放"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | private String blurry; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private String merchantType; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private String enabled; |
| | | private List<Timestamp> createTime; |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.oying.utils.PageUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @description 服务实现 |
| | | * @author lixin |
| | | * @description 服务实现 |
| | | * @date 2025-05-29 |
| | | **/ |
| | | @Service |
| | |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (Merchant merchant : all) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("商户类型", merchant.getMerchantType()); |
| | | map.put("名称", merchant.getMerchantName()); |
| | | map.put("商户编码", merchant.getMerchantCode()); |
| | | map.put("营业执照号", merchant.getBusinessLicense()); |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | snapshot_id, order_num, receiver_name, receiver_phone, province, city, district, street, short_address, detail, longitude, latitude, tag |
| | | snapshot_id, order_num, receiver_name, receiver_phone, province, city, district, street, short_address, |
| | | detail, longitude, latitude, tag |
| | | </sql> |
| | | |
| | | <select id="findAll" resultMap="BaseResultMap"> |
| | |
| | | <resultMap id="BaseResultMap" type="com.oying.modules.sh.domain.Order"> |
| | | <id column="order_id" property="orderId"/> |
| | | <result column="order_num" property="orderNum"/> |
| | | <result column="order_store_num" property="orderStoreNum"/> |
| | | <result column="order_status" property="orderStatus"/> |
| | | <result column="order_status_describe" property="orderStatusDescribe"/> |
| | | <result column="order_remark" property="orderRemark"/> |
| | | <result column="order_time" property="orderTime"/> |
| | | <result column="send_price" property="sendPrice"/> |
| | | <result column="send_type" property="sendType"/> |
| | | <result column="user_id" property="userId"/> |
| | | <result column="username" property="username"/> |
| | | <result column="store_id" property="storeId"/> |
| | | <result column="store_name" property="storeName"/> |
| | | <result column="store_logo" property="storeLogo"/> |
| | | <result column="order_describe" property="orderDescribe"/> |
| | | <result column="original_price" property="originalPrice"/> |
| | | <result column="paid_price" property="paidPrice"/> |
| | | <result column="actually_pay_price" property="actuallyPayPrice"/> |
| | | <result column="pay_state" property="payState"/> |
| | | <result column="order_original_price" property="originalPrice"/> |
| | | <result column="order_paid_price" property="paidPrice"/> |
| | | <result column="order_actually_pay_price" property="actuallyPayPrice"/> |
| | | <result column="order_pay_state" property="payState"/> |
| | | <result column="pay_message" property="payMessage"/> |
| | | <result column="pay_type" property="payType"/> |
| | | <result column="pay_time" property="payTime"/> |
| | |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_by" property="updateBy"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="rider_id" property="riderId"/> |
| | | <result column="rider_phone" property="riderPhone"/> |
| | | <result column="rider_name" property="riderName"/> |
| | | <collection property="productSnapshots" ofType="com.oying.modules.sh.domain.OrderProductSnapshot"> |
| | | <id column="snapshot_id" property="snapshotId"/> |
| | | <result column="product_id" property="productId"/> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | o.order_id, o.order_num, o.order_status, o.order_status_describe, o.order_remark, o.order_time, o.user_id, o.username, o.store_id, |
| | | o.store_name, o.store_logo, o.order_describe, o.original_price, o.paid_price, o.actually_pay_price, o.pay_state, o.pay_message, |
| | | o.pay_type, o.pay_time, o.expire_time, o.openid, o.app_id, o.timestamp, o.nonce_str, o.package_val, o.sign_type, o.pay_sign, |
| | | o.create_by, o.create_time, o.update_by, o.update_time |
| | | o.order_id, o.order_num, o.order_store_num, o.order_status, o.order_status_describe, |
| | | o.order_remark, o.order_time, o.send_time, o.send_type, o.user_id, o.username, o.store_id, |
| | | o.store_name, o.store_logo, o.order_describe, o.original_price order_original_price, o.paid_price order_paid_price, |
| | | o.actually_pay_price order_actually_pay_price, o.pay_state order_pay_state, o.pay_message, o.pay_type, o.pay_time, o.expire_time, |
| | | o.openid, o.app_id, o.timestamp, o.nonce_str, o.package_val, o.sign_type, o.pay_sign, |
| | | o.create_by, o.create_time, o.update_by, o.update_time, o.rider_id, o.rider_phone, o.rider_name |
| | | </sql> |
| | | |
| | | <sql id="product_Column_List"> |
| | | p.snapshot_id, p.product_id, p.product_code, p.product_barcode, p.product_name, p.product_title, |
| | | p.product_main_image, p.product_description, p.param_data, p.unit_price, p.detail_count, p.original_price, p.paid_price, |
| | | p.actually_pay_price, p.pay_state |
| | | </sql> |
| | | |
| | | <sql id="Where_Sql"> |
| | | <where> |
| | | <if test="criteria.orderNum != null and criteria.orderNum != ''"> |
| | | and o.order_num like concat('%',#{criteria.orderNum},'%') |
| | | </if> |
| | | <if test="criteria.orderStatus != null and criteria.orderStatus.size() > 0"> |
| | | and o.order_status IN |
| | | <foreach collection="criteria.orderStatus" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="criteria.userId != null and criteria.userId != ''"> |
| | | and o.user_id = #{criteria.userId} |
| | | </if> |
| | | <if test="criteria.username != null and criteria.username != ''"> |
| | | and o.username like concat('%',#{criteria.username},'%') |
| | | </if> |
| | | <if test="criteria.storeId != null and criteria.storeId != ''"> |
| | | and o.store_id = #{criteria.storeId} |
| | | </if> |
| | | <if test="criteria.orderDescribe != null and criteria.orderDescribe != ''"> |
| | | and o.order_describe like concat('%',#{criteria.orderDescribe},'%') |
| | | </if> |
| | | <if test="criteria.payState != null and criteria.payState != ''"> |
| | | and o.pay_state = #{criteria.payState} |
| | | </if> |
| | | <if test="criteria.payType != null and criteria.payType != ''"> |
| | | and o.pay_type = #{criteria.payType} |
| | | </if> |
| | | <if test="criteria.payTime != null and criteria.payTime.size() > 0"> |
| | | AND o.pay_time BETWEEN #{criteria.payTime[0]} AND #{criteria.payTime[1]} |
| | | </if> |
| | | <if test="criteria.createTime != null and criteria.createTime.size() > 0"> |
| | | AND o.create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]} |
| | | </if> |
| | | </where> |
| | | </sql> |
| | | |
| | | <sql id="Where_Sql_Product"> |
| | | <where> |
| | | <if test="blurry != null and blurry != ''"> |
| | | and (p.product_code like concat('%',#{blurry},'%') |
| | | or p.product_barcode like concat('%',#{blurry},'%') |
| | | or p.product_name like concat('%',#{blurry},'%') |
| | | or p.product_title like concat('%',#{blurry},'%') |
| | | or p.product_description like concat('%',#{blurry},'%') |
| | | or o.orderNum like concat('%',#{blurry},'%') |
| | | or o.order_describe like concat('%',#{blurry},'%') |
| | | or o.username like concat('%',#{blurry},'%')) |
| | | </if> |
| | | </where> |
| | | </sql> |
| | | |
| | | <update id="updatePayStatus"> |
| | |
| | | where order_num = #{orderNum} |
| | | </update> |
| | | |
| | | <update id="updateOrderStatus"> |
| | | update sh_order |
| | | set order_status = #{key}, |
| | | order_status_describe = #{value} |
| | | where order_num = #{orderNum} |
| | | </update> |
| | | |
| | | <select id="findAll" resultMap="BaseResultMap"> |
| | | select o.*, |
| | | <include refid="product_Column_List"/> |
| | |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from sh_order as o |
| | | <where> |
| | | <if test="criteria.orderNum != null and criteria.orderNum != ''"> |
| | | and o.order_num like concat('%',#{criteria.orderNum},'%') |
| | | </if> |
| | | <if test="criteria.orderStatus != null and criteria.orderStatus != ''"> |
| | | and o.order_status = #{criteria.orderStatus} |
| | | </if> |
| | | <if test="criteria.userId != null and criteria.userId != ''"> |
| | | and o.user_id = #{criteria.userId} |
| | | </if> |
| | | <if test="criteria.username != null and criteria.username != ''"> |
| | | and o.username like concat('%',#{criteria.username},'%') |
| | | </if> |
| | | <if test="criteria.storeId != null and criteria.storeId != ''"> |
| | | and o.store_id = #{criteria.storeId} |
| | | </if> |
| | | <if test="criteria.orderDescribe != null and criteria.orderDescribe != ''"> |
| | | and o.order_describe like concat('%',#{criteria.orderDescribe},'%') |
| | | </if> |
| | | <if test="criteria.payState != null and criteria.payState != ''"> |
| | | and o.pay_state = #{criteria.payState} |
| | | </if> |
| | | <if test="criteria.payType != null and criteria.payType != ''"> |
| | | and o.pay_type = #{criteria.payType} |
| | | </if> |
| | | <if test="criteria.payTime != null and criteria.payTime.size() > 0"> |
| | | AND o.pay_time BETWEEN #{criteria.payTime[0]} AND #{criteria.payTime[1]} |
| | | </if> |
| | | <if test="criteria.createTime != null and criteria.createTime.size() > 0"> |
| | | AND o.create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]} |
| | | </if> |
| | | </where> |
| | | <include refid="Where_Sql"/> |
| | | order by o.order_id desc |
| | | <if test="criteria.offset != null"> |
| | | limit #{criteria.offset}, #{criteria.size} |
| | | </if> |
| | | ) o |
| | | left join sh_order_product_snapshot as p on p.order_num = o.order_num |
| | | where 1=1 |
| | | <if test="criteria.blurry != null and criteria.blurry != ''"> |
| | | and (o.product_code like concat('%',#{criteria.blurry},'%') |
| | | or o.product_barcode like concat('%',#{criteria.blurry},'%') |
| | | or o.product_name like concat('%',#{criteria.blurry},'%') |
| | | or o.product_title like concat('%',#{criteria.blurry},'%') |
| | | or o.product_description like concat('%',#{criteria.blurry},'%')) |
| | | </if> |
| | | <include refid="Where_Sql_Product"/> |
| | | order by o.order_id desc |
| | | </select> |
| | | <select id="getByOrderNum" resultMap="BaseResultMap"> |
| | | select o.*, |
| | | <include refid="product_Column_List"/> |
| | | from ( |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from sh_order as o |
| | | ) o |
| | | left join sh_order_product_snapshot as p on p.order_num = o.order_num |
| | | where o.order_num = #{orderNum} |
| | | order by o.order_id desc |
| | | </select> |
| | | <select id="countAll" resultType="java.lang.Long"> |
| | | select count(1) |
| | |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from sh_order as o |
| | | <where> |
| | | <if test="criteria.orderNum != null and criteria.orderNum != ''"> |
| | | and o.order_num like concat('%',#{criteria.orderNum},'%') |
| | | </if> |
| | | <if test="criteria.orderStatus != null and criteria.orderStatus != ''"> |
| | | and o.order_status = #{criteria.orderStatus} |
| | | </if> |
| | | <if test="criteria.userId != null and criteria.userId != ''"> |
| | | and o.user_id = #{criteria.userId} |
| | | </if> |
| | | <if test="criteria.username != null and criteria.username != ''"> |
| | | and o.username like concat('%',#{criteria.username},'%') |
| | | </if> |
| | | <if test="criteria.storeId != null and criteria.storeId != ''"> |
| | | and o.store_id = #{criteria.storeId} |
| | | </if> |
| | | <if test="criteria.orderDescribe != null and criteria.orderDescribe != ''"> |
| | | and o.order_describe like concat('%',#{criteria.orderDescribe},'%') |
| | | </if> |
| | | <if test="criteria.payState != null and criteria.payState != ''"> |
| | | and o.pay_state = #{criteria.payState} |
| | | </if> |
| | | <if test="criteria.payType != null and criteria.payType != ''"> |
| | | and o.pay_type = #{criteria.payType} |
| | | </if> |
| | | <if test="criteria.payTime != null and criteria.payTime.size() > 0"> |
| | | AND o.pay_time BETWEEN #{criteria.payTime[0]} AND #{criteria.payTime[1]} |
| | | </if> |
| | | <if test="criteria.createTime != null and criteria.createTime.size() > 0"> |
| | | AND o.create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]} |
| | | </if> |
| | | </where> |
| | | <include refid="Where_Sql"/> |
| | | ) o |
| | | left join sh_order_product_snapshot as p on p.order_num = o.order_num |
| | | where 1=1 |
| | | <if test="criteria.blurry != null and criteria.blurry != ''"> |
| | | and (p.product_code like concat('%',#{criteria.blurry},'%') |
| | | or p.product_barcode like concat('%',#{criteria.blurry},'%') |
| | | or p.product_name like concat('%',#{criteria.blurry},'%') |
| | | or p.product_title like concat('%',#{criteria.blurry},'%') |
| | | or p.product_description like concat('%',#{criteria.blurry},'%')) |
| | | </if>) t |
| | | <include refid="Where_Sql_Product"/> |
| | | ) t |
| | | </select> |
| | | </mapper> |
| | |
| | | AND operation_time BETWEEN #{criteria.operationTime[0]} AND #{criteria.operationTime[1]} |
| | | </if> |
| | | </where> |
| | | order by log_id desc |
| | | order by log_id |
| | | </select> |
| | | <select id="getByOrderNum" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from sh_order_operation_log |
| | | where order_num = #{orderNum} order by log_id desc |
| | | where order_num = #{orderNum} order by log_id |
| | | </select> |
| | | </mapper> |
| | |
| | | <result column="return_status" property="returnStatus"/> |
| | | <result column="return_status_describe" property="returnStatusDescribe"/> |
| | | <result column="order_num" property="orderNum"/> |
| | | <result column="order_store_num" property="orderStoreNum"/> |
| | | <result column="order_time" property="orderTime"/> |
| | | <result column="send_price" property="sendPrice"/> |
| | | <result column="send_type" property="sendType"/> |
| | | <result column="pay_type" property="payType"/> |
| | | <result column="user_id" property="userId"/> |
| | | <result column="username" property="username"/> |
| | | <result column="store_id" property="storeId"/> |
| | | <result column="store_name" property="storeName"/> |
| | | <result column="store_logo" property="storeLogo"/> |
| | | <result column="original_price" property="originalPrice"/> |
| | | <result column="paid_price" property="paidPrice"/> |
| | | <result column="actually_pay_price" property="actuallyPayPrice"/> |
| | | <result column="order_original_price" property="originalPrice"/> |
| | | <result column="order_paid_price" property="paidPrice"/> |
| | | <result column="order_actually_pay_price" property="actuallyPayPrice"/> |
| | | <result column="refund_price" property="refundPrice"/> |
| | | <result column="refund_status" property="refundStatus"/> |
| | | <result column="success_time" property="successTime"/> |
| | |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_by" property="updateBy"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="rider_id" property="riderId"/> |
| | | <result column="rider_phone" property="riderPhone"/> |
| | | <result column="rider_name" property="riderName"/> |
| | | <collection property="productSnapshots" ofType="com.oying.modules.sh.domain.OrderReturnProductSnapshot"> |
| | | <id column="snapshot_id" property="snapshotId"/> |
| | | <result column="product_id" property="productId"/> |
| | | <result column="product_code" property="productCode"/> |
| | | <result column="product_barcode" property="productBarcode"/> |
| | | <result column="product_name" property="productName"/> |
| | | <result column="product_title" property="productTitle"/> |
| | | <result column="product_main_image" property="productMainImage"/> |
| | | <result column="product_description" property="productDescription"/> |
| | | <result column="param_data" property="paramData"/> |
| | | <result column="unit_price" property="unitPrice"/> |
| | | <result column="detail_count" property="detailCount"/> |
| | | <result column="original_price" property="originalPrice"/> |
| | | <result column="paid_price" property="paidPrice"/> |
| | | <result column="actually_pay_price" property="actuallyPayPrice"/> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | return_id, return_num, return_status, return_status_describe, order_num, pay_type, user_id, username, store_id, store_name, store_logo, original_price, paid_price, actually_pay_price, refund_price, refund_status, success_time, channel, reason, remark, photos, audit_status, audit_user, audit_time, audit_message, create_by, create_time, update_by, update_time |
| | | o.return_id, o.return_num, o.return_status, o.return_status_describe, o.order_num, o.order_store_num, |
| | | o.order_time, o.send_time, o.send_type, o.pay_type, o.user_id, o.username, o.store_id, o.store_name, o.store_logo, |
| | | o.original_price order_original_price, o.paid_price order_paid_price, o.actually_pay_price order_actually_pay_price, |
| | | o.refund_price, o.refund_status, o.success_time, o.channel, o.reason, o.remark, o.photos, o.audit_status, |
| | | o.audit_user, o.audit_time, o.audit_message, o.rider_id, o.rider_phone, o.rider_name, |
| | | o.create_by, o.create_time, o.update_by, o.update_time |
| | | </sql> |
| | | |
| | | <sql id="Product_Column_List"> |
| | | p.snapshot_id, p.product_id, p.product_code, p.product_barcode, p.product_name, p.product_title, p.product_main_image, |
| | | p.product_description, p.param_data, p.unit_price, p.detail_count, p.original_price, p.paid_price, p.actually_pay_price |
| | | </sql> |
| | | <sql id="Where_sql"> |
| | | <where> |
| | | <if test="criteria.returnNum != null"> |
| | | and o.return_num like concat('%',#{criteria.returnNum},'%') |
| | | </if> |
| | | <if test="criteria.returnStatus != null and criteria.returnStatus.size() > 0"> |
| | | and o.return_status IN |
| | | <foreach collection="criteria.returnStatus" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="criteria.orderNum != null"> |
| | | and o.order_num like concat('%',#{criteria.orderNum},'%') |
| | | </if> |
| | | <if test="criteria.payType != null"> |
| | | and o.pay_type = #{criteria.payType} |
| | | </if> |
| | | <if test="criteria.userId != null"> |
| | | and o.user_id = #{criteria.userId} |
| | | </if> |
| | | <if test="criteria.username != null"> |
| | | and o.username like concat('%',#{criteria.username},'%') |
| | | </if> |
| | | <if test="criteria.storeId != null"> |
| | | and o.store_id = #{criteria.storeId} |
| | | </if> |
| | | <if test="criteria.refundStatus != null"> |
| | | and o.refund_status = #{criteria.refundStatus} |
| | | </if> |
| | | <if test="criteria.auditUser != null"> |
| | | and o.audit_user like concat('%',#{criteria.auditUser},'%') |
| | | </if> |
| | | <if test="criteria.successTime != null and criteria.successTime.size() > 0"> |
| | | AND o.success_time BETWEEN #{criteria.successTime[0]} AND #{criteria.successTime[1]} |
| | | </if> |
| | | <if test="criteria.auditTime != null and criteria.auditTime.size() > 0"> |
| | | AND o.audit_time BETWEEN #{criteria.auditTime[0]} AND #{criteria.auditTime[1]} |
| | | </if> |
| | | <if test="criteria.createTime != null and criteria.createTime.size() > 0"> |
| | | AND o.create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]} |
| | | </if> |
| | | </where> |
| | | </sql> |
| | | |
| | | <sql id="Where_Sql_Product"> |
| | | <where> |
| | | <if test="blurry != null and blurry != ''"> |
| | | and (p.product_code like concat('%',#{blurry},'%') |
| | | or p.product_barcode like concat('%',#{blurry},'%') |
| | | or p.product_name like concat('%',#{blurry},'%') |
| | | or p.product_title like concat('%',#{blurry},'%') |
| | | or p.product_description like concat('%',#{blurry},'%') |
| | | or o.orderNum like concat('%',#{blurry},'%') |
| | | or o.order_describe like concat('%',#{blurry},'%') |
| | | or o.username like concat('%',#{blurry},'%') |
| | | or o.order_num like concat('%',#{blurry},'%')) |
| | | </if> |
| | | </where> |
| | | </sql> |
| | | |
| | | <update id="updatePayStatus"> |
| | | update sh_order_return set return_status = #{payState}, success_time = #{payTime} |
| | | update sh_order_return |
| | | set return_status = #{payState}, |
| | | success_time = #{payTime} |
| | | where order_num = #{orderNum} |
| | | </update> |
| | | |
| | | <select id="findAll" resultMap="BaseResultMap"> |
| | | select |
| | | select o.* , |
| | | <include refid="Product_Column_List"/> |
| | | from ( select |
| | | <include refid="Base_Column_List"/> |
| | | from sh_order_return |
| | | <where> |
| | | <if test="criteria.returnNum != null"> |
| | | and return_num like concat('%',#{criteria.returnNum},'%') |
| | | </if> |
| | | <if test="criteria.returnStatus != null"> |
| | | and return_status = #{criteria.returnStatus} |
| | | </if> |
| | | <if test="criteria.orderNum != null"> |
| | | and order_num like concat('%',#{criteria.orderNum},'%') |
| | | </if> |
| | | <if test="criteria.payType != null"> |
| | | and pay_type = #{criteria.payType} |
| | | </if> |
| | | <if test="criteria.userId != null"> |
| | | and user_id = #{criteria.userId} |
| | | </if> |
| | | <if test="criteria.username != null"> |
| | | and username like concat('%',#{criteria.username},'%') |
| | | </if> |
| | | <if test="criteria.storeId != null"> |
| | | and store_id = #{criteria.storeId} |
| | | </if> |
| | | <if test="criteria.refundStatus != null"> |
| | | and refund_status = #{criteria.refundStatus} |
| | | </if> |
| | | <if test="criteria.auditUser != null"> |
| | | and audit_user like concat('%',#{criteria.auditUser},'%') |
| | | </if> |
| | | <if test="criteria.successTime != null and criteria.successTime.size() > 0"> |
| | | AND success_time BETWEEN #{criteria.successTime[0]} AND #{criteria.successTime[1]} |
| | | </if> |
| | | <if test="criteria.auditTime != null and criteria.auditTime.size() > 0"> |
| | | AND audit_time BETWEEN #{criteria.auditTime[0]} AND #{criteria.auditTime[1]} |
| | | </if> |
| | | <if test="criteria.createTime != null and criteria.createTime.size() > 0"> |
| | | AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]} |
| | | </if> |
| | | </where> |
| | | order by return_id desc |
| | | from sh_order_return as o |
| | | <include refid="Where_sql"/> |
| | | order by o.return_id desc ) o |
| | | left join sh_order_return_product_snapshot as p on p.return_num = o.return_num |
| | | <include refid="Where_Sql_Product"/> |
| | | order by o.order_id desc |
| | | </select> |
| | | <select id="getByReturnNum" resultMap="BaseResultMap"> |
| | | select |
| | | select o.* from ( select |
| | | <include refid="Base_Column_List"/> |
| | | from sh_order_return where return_num = #{returnNum} |
| | | from sh_order_return as o ) o |
| | | left join sh_order_return_product_snapshot as p on p.return_num = o.return_num |
| | | from sh_order_return as o where o.return_num = #{returnNum} |
| | | </select> |
| | | <select id="countAll" resultType="java.lang.Long"> |
| | | select count(1) from ( |
| | | select distinct o.* |
| | | p.product_code, p.product_barcode, p.product_name, p.product_title, p.product_description |
| | | from ( select |
| | | <include refid="Base_Column_List"/> |
| | | from sh_order_return as o |
| | | <include refid="Where_sql"/> |
| | | ) o |
| | | left join sh_order_return_product_snapshot as p on p.return_num = o.return_num |
| | | <include refid="Where_Sql_Product"/> |
| | | ) t |
| | | </select> |
| | | </mapper> |
| | |
| | | <include refid="Base_Column_List"/> |
| | | from sh_order_return_operation_log |
| | | where return_num = #{returnNum} |
| | | order by log_id desc |
| | | order by log_id |
| | | </select> |
| | | </mapper> |
| | |
| | | <mapper namespace="com.oying.modules.system.mapper.MerchantMapper"> |
| | | <resultMap id="BaseResultMap" type="com.oying.modules.system.domain.Merchant"> |
| | | <id column="merchant_id" property="merchantId"/> |
| | | <result column="merchant_type" property="merchantType"/> |
| | | <result column="merchant_name" property="merchantName"/> |
| | | <result column="merchant_code" property="merchantCode"/> |
| | | <result column="business_license" property="businessLicense"/> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | merchant_id, merchant_name, merchant_code, business_license, business_license_path, contact_mobile, merchant_sort, enabled, create_by, update_by, create_time, update_time, audit_user, audit_time, audit_message |
| | | merchant_id, merchant_type, merchant_name, merchant_code, business_license, business_license_path, contact_mobile, merchant_sort, enabled, create_by, update_by, create_time, update_time, audit_user, audit_time, audit_message |
| | | </sql> |
| | | |
| | | <select id="findAll" resultMap="BaseResultMap"> |
| | |
| | | or contact_mobile like concat('%', #{criteria.blurry}, '%') |
| | | ) |
| | | </if> |
| | | <if test="criteria.merchantType != null and criteria.merchantType != ''"> |
| | | and merchant_type = #{criteria.merchantType} |
| | | </if> |
| | | <if test="criteria.enabled != null"> |
| | | and enabled = #{criteria.enabled} |
| | | </if> |