订单核销
This commit is contained in:
parent
38f6c4acff
commit
5e38ad18dd
|
|
@ -220,4 +220,16 @@ public class OrderInfoController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(orderInfoService.deleteOrderInfoByOrderIds(ids));
|
return toAjax(orderInfoService.deleteOrderInfoByOrderIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SysLog(title = "核销", module = "订单", businessType = OperaType.UPDATE)
|
||||||
|
@PostMapping( "/write-off")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult writeOff(@RequestBody @Valid OrderWriteOffParam param)
|
||||||
|
{
|
||||||
|
if(CollUtil.isEmpty(param.getOrderIdList())) {
|
||||||
|
throw new ServiceException("订单ID不能为空");
|
||||||
|
}
|
||||||
|
orderInfoService.writeOffOrderByOrderIds(param);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ public class OrderQueryParam implements Serializable
|
||||||
|
|
||||||
private Long orderId;
|
private Long orderId;
|
||||||
|
|
||||||
|
private List<Long> orderIdList;
|
||||||
|
|
||||||
private List<Long> deptIdList;
|
private List<Long> deptIdList;
|
||||||
|
|
||||||
/** 设备编号 */
|
/** 设备编号 */
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.bonus.canteen.core.order.domain.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
@Data
|
||||||
|
public class OrderWriteOffParam implements Serializable {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private List<Long> orderIdList;
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import com.bonus.canteen.core.order.domain.OrderPayResultDTO;
|
||||||
import com.bonus.canteen.core.order.domain.OrderRefundHistoryVO;
|
import com.bonus.canteen.core.order.domain.OrderRefundHistoryVO;
|
||||||
import com.bonus.canteen.core.order.domain.param.OrderQueryParam;
|
import com.bonus.canteen.core.order.domain.param.OrderQueryParam;
|
||||||
import com.bonus.canteen.core.order.domain.param.OrderRefundHistoryParam;
|
import com.bonus.canteen.core.order.domain.param.OrderRefundHistoryParam;
|
||||||
|
import com.bonus.canteen.core.order.domain.param.OrderWriteOffParam;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -70,4 +71,6 @@ public interface OrderInfoMapper
|
||||||
public int deleteOrderInfoByOrderIds(List<Long> orderIds);
|
public int deleteOrderInfoByOrderIds(List<Long> orderIds);
|
||||||
|
|
||||||
public List<OrderRefundHistoryVO> orderRefundHistory(@Param("param") OrderRefundHistoryParam param);
|
public List<OrderRefundHistoryVO> orderRefundHistory(@Param("param") OrderRefundHistoryParam param);
|
||||||
|
|
||||||
|
public void writeOffOrderByOrderIds(@Param("param") OrderWriteOffParam param);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,5 +70,7 @@ public interface IOrderInfoService
|
||||||
|
|
||||||
public void refund(Long orderId, String operationUser);
|
public void refund(Long orderId, String operationUser);
|
||||||
public void pay(Long orderId);
|
public void pay(Long orderId);
|
||||||
List<OrderRefundHistoryVO> orderRefundHistory(@Param("param") OrderRefundHistoryParam param);
|
List<OrderRefundHistoryVO> orderRefundHistory(OrderRefundHistoryParam param);
|
||||||
|
|
||||||
|
public void writeOffOrderByOrderIds(OrderWriteOffParam param);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -234,6 +234,23 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
return orderInfoMapper.orderRefundHistory(param);
|
return orderInfoMapper.orderRefundHistory(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeOffOrderByOrderIds(OrderWriteOffParam param) {
|
||||||
|
OrderQueryParam orderQueryParam = new OrderQueryParam();
|
||||||
|
orderQueryParam.setOrderIdList(param.getOrderIdList());
|
||||||
|
orderQueryParam.setStartDateTime(null);
|
||||||
|
orderQueryParam.setEndDateTime(null);
|
||||||
|
List<OrderInfo> orderInfoList = orderInfoMapper.selectOrderInfoList(orderQueryParam);
|
||||||
|
if(CollUtil.isNotEmpty(orderInfoList)) {
|
||||||
|
orderInfoList.forEach(orderInfo -> {
|
||||||
|
if(!OrderStateEnum.PLACE.getKey().equals(orderInfo.getOrderState())) {
|
||||||
|
throw new ServiceException("仅已下单订单才能核销");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
orderInfoMapper.writeOffOrderByOrderIds(param);
|
||||||
|
}
|
||||||
|
|
||||||
private void checkOrdersTotalAmount(List<OrderInfo> orderInfoList ,BigDecimal totalAmountParam) {
|
private void checkOrdersTotalAmount(List<OrderInfo> orderInfoList ,BigDecimal totalAmountParam) {
|
||||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
if(CollUtil.isNotEmpty(orderInfoList)) {
|
if(CollUtil.isNotEmpty(orderInfoList)) {
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectOrderInfoList" parameterType="com.bonus.canteen.core.order.domain.param.OrderQueryParam" resultMap="OrderInfoResult">
|
<select id="selectOrderInfoList" parameterType="com.bonus.canteen.core.order.domain.param.OrderQueryParam" resultMap="OrderInfoResult">
|
||||||
<include refid="selectOrderInfoVo"/>
|
<include refid="selectOrderInfoVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
<if test="orderIdList != null and orderIdList.size >0">
|
||||||
|
oi.order_id in
|
||||||
|
<foreach collection="orderIdList" item="orderId" open="(" separator="," close=")">
|
||||||
|
#{orderId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="orderId != null"> and oi.order_id = #{orderId}</if>
|
<if test="orderId != null"> and oi.order_id = #{orderId}</if>
|
||||||
<if test="deviceOrderId != null and deviceOrderId != ''"> and oi.device_order_id = #{deviceOrderId}</if>
|
<if test="deviceOrderId != null and deviceOrderId != ''"> and oi.device_order_id = #{deviceOrderId}</if>
|
||||||
<if test="deviceSn != null and deviceSn != ''"> and oi.device_sn = #{deviceSn}</if>
|
<if test="deviceSn != null and deviceSn != ''"> and oi.device_sn = #{deviceSn}</if>
|
||||||
|
|
@ -430,4 +436,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
order by at2.trade_time desc
|
order by at2.trade_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="writeOffOrderByOrderIds">
|
||||||
|
update order_info set
|
||||||
|
order_state = 2
|
||||||
|
where order_id in
|
||||||
|
<foreach item="orderId" collection="param.orderIdList" open="(" separator="," close=")">
|
||||||
|
#{orderId}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue