Authored by chenchao

add deposit order DAL

package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.DepositOrder;
public interface DepositOrderMapper {
int insertSelective(DepositOrder record);
DepositOrder selectByOrderCode(Long orderCode);
int updateByPrimaryKeySelective(DepositOrder record);
}
\ No newline at end of file
... ...
package com.yohoufo.dal.order.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class DepositOrder {
private Integer id;
private Integer uid;
private Long orderCode;
private String depositCode;
private BigDecimal amount;
private Integer payment;
private Integer clientType;
private Integer eventType;
private Integer status;
private Integer createTime;
private Integer updateTime;
}
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yohoufo.dal.order.DepositOrderMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.DepositOrder">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="uid" jdbcType="INTEGER" property="uid" />
<result column="order_code" jdbcType="BIGINT" property="orderCode" />
<result column="deposit_code" jdbcType="VARCHAR" property="depositCode" />
<result column="amount" jdbcType="DECIMAL" property="amount" />
<result column="payment" jdbcType="INTEGER" property="payment" />
<result column="client_type" jdbcType="INTEGER" property="clientType" />
<result column="event_type" jdbcType="INTEGER" property="eventType" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="INTEGER" property="createTime" />
<result column="update_time" jdbcType="INTEGER" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, uid, order_code, deposit_code, amount, payment, client_type, event_type, status,
create_time, update_time
</sql>
<select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from deposit_order
where order_code = #{orderCode,jdbcType=INTEGER}
</select>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.DepositOrder" useGeneratedKeys="true">
insert into deposit_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">
uid,
</if>
<if test="orderCode != null">
order_code,
</if>
<if test="depositCode != null">
deposit_code,
</if>
<if test="amount != null">
amount,
</if>
<if test="payment != null">
payment,
</if>
<if test="clientType != null">
client_type,
</if>
<if test="eventType != null">
event_type,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">
#{uid,jdbcType=INTEGER},
</if>
<if test="orderCode != null">
#{orderCode,jdbcType=BIGINT},
</if>
<if test="depositCode != null">
#{depositCode,jdbcType=VARCHAR},
</if>
<if test="amount != null">
#{amount,jdbcType=DECIMAL},
</if>
<if test="payment != null">
#{payment,jdbcType=INTEGER},
</if>
<if test="clientType != null">
#{clientType,jdbcType=INTEGER},
</if>
<if test="eventType != null">
#{eventType,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.DepositOrder">
update deposit_order
<set>
<if test="payment != null">
payment = #{payment,jdbcType=INTEGER},
</if>
<if test="clientType != null">
client_type = #{clientType,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
package com.yohoufo.order.service.impl;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohoufo.dal.order.DepositOrderMapper;
import com.yohoufo.dal.order.model.DepositOrder;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.model.response.PrepayResponse;
import com.yohoufo.order.service.AbstractOrderPaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class DeposiOrderPaymentService extends AbstractOrderPaymentService {
public class DepositOrderPaymentService extends AbstractOrderPaymentService {
@Autowired
private DepositOrderMapper depositOrderMapper;
@Override
public boolean isTimeoutCancelStatus(OrderInfo orderInfo) {
return false;
}
@Override
public OrderInfo getOrderInfo(long orderCode, int uid) {
return null;
DepositOrder depositOrder = depositOrderMapper.selectByOrderCode(orderCode);
return OrderInfo.builder().orderCode(orderCode)
.uid(depositOrder.getUid())
.payment(depositOrder.getPayment())
.amount(depositOrder.getAmount())
.build()
;
}
@Override
... ... @@ -65,6 +81,6 @@ public class DeposiOrderPaymentService extends AbstractOrderPaymentService {
@Override
public void processAfterPay(OrderInfo orderInfo) {
//todo
}
}
... ...
... ... @@ -160,6 +160,10 @@ public class PaymentServiceImpl implements IPaymentService {
@Autowired
private TradeMqSender tradeMqSender;
@Autowired
private DepositOrderPaymentService depositOrderPaymentService;
/**
* 获取主场的订单service
*
... ... @@ -184,6 +188,8 @@ public class PaymentServiceImpl implements IPaymentService {
paymentService = this.sellerOrderPaymentService;
} else if (codeMeta.getType() == OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType()) {
paymentService = this.merchantOrderPaymentService;
}else if(codeMeta.getType() == OrderCodeType.STORAGE_MANAGEMENT.getType()){
paymentService = this.depositOrderPaymentService;
}
logger.info("orderCode is {}, type is {}, service is {}", orderCode, codeMeta.getType(), paymentService);
return paymentService;
... ...