xin
2025-07-14 d2985d31ba7b387749b2350882172f675b923347
订单流程补充
1 files added
30 files modified
776 ■■■■■ changed files
oying-common/src/main/java/com/oying/utils/RedisUtils.java 20 ●●●●● patch | view | raw | blame | history
oying-common/src/main/java/com/oying/utils/enums/OrderStatusEnum.java 11 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/hwc/service/impl/CallbackServiceImpl.java 9 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/Order.java 33 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/OrderAddressSnapshot.java 13 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/OrderOperationLog.java 10 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/OrderReturn.java 50 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/OrderReturnProductSnapshot.java 32 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/UserAddress.java 2 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/dto/OrderQueryCriteria.java 20 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/dto/OrderReturnQueryCriteria.java 8 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/request/SubmitOrder.java 2 ●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/domain/vo/OrderResponse.java 26 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/mapper/OrderMapper.java 15 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/mapper/OrderReturnMapper.java 14 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/rest/OrderController.java 10 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/rest/UserAddressController.java 6 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/service/OrderOperationLogService.java 7 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/service/OrderService.java 5 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderOperationLogServiceImpl.java 41 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java 7 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java 49 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/system/domain/dto/MerchantsQueryCriteria.java 3 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java 15 ●●●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/message/MessageOrderSellerMapper.xml 2 ●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/sh/OrderAddressSnapshotMapper.xml 3 ●●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/sh/OrderMapper.xml 175 ●●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml 4 ●●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml 176 ●●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/sh/OrderReturnOperationLogMapper.xml 2 ●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/system/MerchantMapper.xml 6 ●●●● patch | view | raw | blame | history
oying-common/src/main/java/com/oying/utils/RedisUtils.java
@@ -21,14 +21,15 @@
 * @author Z
 */
@Component
@SuppressWarnings({"unchecked","all"})
@SuppressWarnings({"unchecked", "all"})
public class RedisUtils {
    private static final Logger log = LoggerFactory.getLogger(RedisUtils.class);
    @Value("${jwt.generate-order-sn}")
    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) {
@@ -46,7 +47,7 @@
    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));
@@ -58,7 +59,7 @@
        }
        if (wxEnabled) {
            // 生产环境
            return sb.toString();
            return OY + sb.toString();
        } else {
            // 测试环境
            return T + sb.toString();
@@ -227,9 +228,10 @@
    /**
     * 批量模糊删除key
     *
     * @param pattern
     */
    public void scanDel(String pattern){
    public void scanDel(String pattern) {
        ScanOptions options = ScanOptions.scanOptions().match(pattern).build();
        try (Cursor<byte[]> cursor = redisTemplate.executeWithStickyConnection(
                (RedisCallback<Cursor<byte[]>>) connection -> (Cursor<byte[]>) new ConvertingCursor<>(
@@ -273,7 +275,7 @@
    /**
     * 普通缓存获取
     *
     * @param key 键
     * @param key   键
     * @param clazz 列表中元素的类型
     * @return 值
     */
@@ -300,7 +302,7 @@
     * @return 值
     */
    public String getStr(String key) {
        if(StrUtil.isBlank(key)){
        if (StrUtil.isBlank(key)) {
            return null;
        }
        Object value = redisTemplate.opsForValue().get(key);
@@ -320,7 +322,7 @@
    public List<Object> multiGet(List<String> keys) {
        List list = redisTemplate.opsForValue().multiGet(Sets.newHashSet(keys));
        List resultList = Lists.newArrayList();
        Optional.ofNullable(list).ifPresent(e-> list.forEach(ele-> Optional.ofNullable(ele).ifPresent(resultList::add)));
        Optional.ofNullable(list).ifPresent(e -> list.forEach(ele -> Optional.ofNullable(ele).ifPresent(resultList::add)));
        return resultList;
    }
@@ -816,6 +818,7 @@
    /**
     * 递增
     *
     * @param key
     * @return
     */
@@ -825,6 +828,7 @@
    /**
     * 递减
     *
     * @param key
     * @return
     */
oying-common/src/main/java/com/oying/utils/enums/OrderStatusEnum.java
@@ -11,12 +11,11 @@
    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;
oying-system/src/main/java/com/oying/modules/hwc/service/impl/CallbackServiceImpl.java
@@ -5,8 +5,8 @@
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;
@@ -46,21 +46,22 @@
                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"));
                                    // 处理成功
oying-system/src/main/java/com/oying/modules/sh/domain/Order.java
@@ -33,12 +33,16 @@
    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 = "订单状态")
@@ -48,12 +52,29 @@
    @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")
@@ -139,14 +160,14 @@
        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){
oying-system/src/main/java/com/oying/modules/sh/domain/OrderAddressSnapshot.java
@@ -3,6 +3,7 @@
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;
@@ -15,10 +16,10 @@
import lombok.Setter;
/**
* @description /
* @author lixin
* @date 2025-06-11
**/
 * @author lixin
 * @description /
 * @date 2025-06-11
 **/
@Getter
@Setter
@TableName("sh_order_address_snapshot")
@@ -71,7 +72,7 @@
    @ApiModelProperty(value = "地址标签(家/公司/学校等)")
    private String tag;
    public void copy(OrderAddressSnapshot source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    public void copy(OrderAddressSnapshot source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
oying-system/src/main/java/com/oying/modules/sh/domain/OrderOperationLog.java
@@ -26,6 +26,10 @@
    private Long logId;
    @NotBlank
    @ApiModelProperty(value = "订单号")
    private String orderNum;
    @NotBlank
    @ApiModelProperty(value = "用户账号")
    private String username;
@@ -45,17 +49,13 @@
    @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));
oying-system/src/main/java/com/oying/modules/sh/domain/OrderReturn.java
@@ -1,5 +1,6 @@
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;
@@ -10,6 +11,8 @@
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;
@@ -46,6 +49,31 @@
    @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 = "支付类型")
@@ -116,6 +144,28 @@
    @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));
    }
oying-system/src/main/java/com/oying/modules/sh/domain/OrderReturnProductSnapshot.java
@@ -4,19 +4,22 @@
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
* @date 2025-06-11
**/
 * @author lixin
 * @description /
 * @date 2025-06-11
 **/
@Data
@TableName("sh_order_return_product_snapshot")
public class OrderReturnProductSnapshot implements Serializable {
@@ -83,7 +86,24 @@
    @ApiModelProperty(value = "实付金额")
    private BigDecimal actuallyPayPrice;
    public void copy(OrderReturnProductSnapshot source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    @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));
    }
}
oying-system/src/main/java/com/oying/modules/sh/domain/UserAddress.java
@@ -6,7 +6,6 @@
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;
@@ -65,7 +64,6 @@
    @ApiModelProperty(value = "纬度")
    private BigDecimal latitude;
    @NotNull
    @ApiModelProperty(value = "是否默认: false")
    private Boolean isDefault = false;
oying-system/src/main/java/com/oying/modules/sh/domain/dto/OrderQueryCriteria.java
@@ -1,16 +1,18 @@
package com.oying.modules.sh.domain.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lixin
* @date 2025-06-11
**/
 * @author lixin
 * @date 2025-06-11
 **/
@Data
public class OrderQueryCriteria{
public class OrderQueryCriteria {
    @ApiModelProperty(value = "页码", example = "1")
    private Integer page = 1;
@@ -18,25 +20,25 @@
    @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 = "支付状态")
oying-system/src/main/java/com/oying/modules/sh/domain/dto/OrderReturnQueryCriteria.java
@@ -18,11 +18,17 @@
    @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;
oying-system/src/main/java/com/oying/modules/sh/domain/request/SubmitOrder.java
@@ -32,7 +32,7 @@
    private List<ProductOrder> products;
    @ApiModelProperty(value = "备注")
    private String remark;
    @NotBlank(message = "支付类型不能为空")
    @NotNull(message = "支付类型不能为空")
    @ApiModelProperty(value = "支付类型")
    private PayTypeEnum payType;
oying-system/src/main/java/com/oying/modules/sh/domain/vo/OrderResponse.java
New file
@@ -0,0 +1,26 @@
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;
}
oying-system/src/main/java/com/oying/modules/sh/mapper/OrderMapper.java
@@ -2,6 +2,7 @@
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;
@@ -11,21 +12,23 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* @author lixin
* @date 2025-06-11
**/
 * @author lixin
 * @date 2025-06-11
 **/
@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);
}
oying-system/src/main/java/com/oying/modules/sh/mapper/OrderReturnMapper.java
@@ -2,7 +2,9 @@
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;
@@ -10,17 +12,19 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* @author lixin
* @date 2025-06-11
**/
 * @author lixin
 * @date 2025-06-11
 **/
@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);
}
oying-system/src/main/java/com/oying/modules/sh/rest/OrderController.java
@@ -1,6 +1,7 @@
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;
@@ -59,6 +60,15 @@
        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("小程序:生成确认订单")
oying-system/src/main/java/com/oying/modules/sh/rest/UserAddressController.java
@@ -62,12 +62,10 @@
    @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
oying-system/src/main/java/com/oying/modules/sh/service/OrderOperationLogService.java
@@ -1,5 +1,7 @@
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;
@@ -38,6 +40,11 @@
    void create(OrderOperationLog resources);
    /**
     * 创建
     */
    void create(Order order, OrderAddressSnapshot addressSnapshot);
    /**
    * 编辑
    * @param resources /
    */
oying-system/src/main/java/com/oying/modules/sh/service/OrderService.java
@@ -13,6 +13,7 @@
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;
@@ -44,9 +45,9 @@
    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);
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderOperationLogServiceImpl.java
@@ -1,7 +1,11 @@
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;
@@ -10,20 +14,20 @@
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
* @date 2025-06-11
**/
 * @author lixin
 * @description 服务实现
 * @date 2025-06-11
 **/
@Service
@RequiredArgsConstructor
public class OrderOperationLogServiceImpl extends ServiceImpl<OrderOperationLogMapper, OrderOperationLog> implements OrderOperationLogService {
@@ -31,12 +35,12 @@
    private final OrderOperationLogMapper orderOperationLogMapper;
    @Override
    public PageResult<OrderOperationLog> queryAll(OrderOperationLogQueryCriteria criteria, Page<Object> page){
    public PageResult<OrderOperationLog> queryAll(OrderOperationLogQueryCriteria criteria, Page<Object> page) {
        return PageUtil.toPage(orderOperationLogMapper.findAll(criteria, page));
    }
    @Override
    public List<OrderOperationLog> queryAll(OrderOperationLogQueryCriteria criteria){
    public List<OrderOperationLog> queryAll(OrderOperationLogQueryCriteria criteria) {
        return orderOperationLogMapper.findAll(criteria);
    }
@@ -53,6 +57,25 @@
    @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);
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderReturnServiceImpl.java
@@ -36,12 +36,15 @@
    @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
oying-system/src/main/java/com/oying/modules/sh/service/impl/OrderServiceImpl.java
@@ -9,18 +9,14 @@
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;
@@ -29,7 +25,6 @@
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;
@@ -59,19 +54,20 @@
    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
@@ -122,19 +118,26 @@
        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);
@@ -163,10 +166,14 @@
            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;
    }
@@ -228,13 +235,18 @@
    @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
@@ -246,7 +258,7 @@
    @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("订单不存在");
        }
@@ -271,6 +283,7 @@
    @Transactional(rollbackFor = Exception.class)
    public void create(Order resources) {
        orderMapper.insert(resources);
        throw new BadRequestException("未开放");
    }
    @Override
oying-system/src/main/java/com/oying/modules/system/domain/dto/MerchantsQueryCriteria.java
@@ -24,6 +24,9 @@
    private String blurry;
    @ApiModelProperty(value = "状态")
    private String merchantType;
    @ApiModelProperty(value = "状态")
    private String enabled;
    private List<Timestamp> createTime;
}
oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java
@@ -15,19 +15,21 @@
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
* @date 2025-05-29
**/
 * @author lixin
 * @description 服务实现
 * @date 2025-05-29
 **/
@Service
@RequiredArgsConstructor
public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService {
@@ -36,12 +38,12 @@
    private final UserMerchantService userMerchantService;
    @Override
    public PageResult<Merchant> queryAll(MerchantsQueryCriteria criteria, Page<Object> page){
    public PageResult<Merchant> queryAll(MerchantsQueryCriteria criteria, Page<Object> page) {
        return PageUtil.toPage(merchantMapper.findAll(criteria, page));
    }
    @Override
    public List<Merchant> queryAll(MerchantsQueryCriteria criteria){
    public List<Merchant> queryAll(MerchantsQueryCriteria criteria) {
        return merchantMapper.findAll(criteria);
    }
@@ -76,6 +78,7 @@
        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());
oying-system/src/main/resources/mapper/message/MessageOrderSellerMapper.xml
@@ -65,4 +65,4 @@
    </update>
</mapper>
</mapper>
oying-system/src/main/resources/mapper/sh/OrderAddressSnapshotMapper.xml
@@ -18,7 +18,8 @@
    </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">
oying-system/src/main/resources/mapper/sh/OrderMapper.xml
@@ -4,20 +4,23 @@
    <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"/>
@@ -33,6 +36,9 @@
        <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"/>
@@ -53,16 +59,71 @@
    </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">
@@ -79,6 +140,13 @@
        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"/>
@@ -86,59 +154,27 @@
        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)
@@ -152,47 +188,10 @@
        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>
oying-system/src/main/resources/mapper/sh/OrderOperationLogMapper.xml
@@ -35,12 +35,12 @@
                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>
oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
@@ -7,15 +7,19 @@
        <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"/>
@@ -31,63 +35,137 @@
        <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}
                               where order_num = #{orderNum}
        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>
oying-system/src/main/resources/mapper/sh/OrderReturnOperationLogMapper.xml
@@ -42,6 +42,6 @@
        <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>
oying-system/src/main/resources/mapper/system/MerchantMapper.xml
@@ -3,6 +3,7 @@
<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"/>
@@ -20,7 +21,7 @@
    </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">
@@ -36,6 +37,9 @@
                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>