wanghui před 8 roky
rodič
revize
2904382c84

+ 8 - 0
src/main/java/com/goafanti/order/bo/OperatorActive.java

@@ -7,6 +7,8 @@ package com.goafanti.order.bo;
 public class OperatorActive {
 	/** 确认意向订单 **/
 	private boolean confirmIntention;
+	/** 拒绝意向订单 **/
+	private boolean refuseIntention;
 	/** 支付首付 **/
 	private boolean payForFirst; 
 	/** 确认支付首付 **/
@@ -30,6 +32,12 @@ public class OperatorActive {
 	public void setConfirmIntention(boolean confirmIntention) {
 		this.confirmIntention = confirmIntention;
 	}
+	public boolean isRefuseIntention() {
+		return refuseIntention;
+	}
+	public void setRefuseIntention(boolean refuseIntention) {
+		this.refuseIntention = refuseIntention;
+	}
 	public boolean isPayForFirst() {
 		return payForFirst;
 	}

+ 17 - 0
src/main/java/com/goafanti/order/controller/OrderController.java

@@ -204,4 +204,21 @@ public class OrderController extends CertifyApiController{
 		orderServiceImpl.applyForCancel(Long.valueOf(orderNo));
 		return res;
 	}
+	
+	/**
+	 * 确认意向
+	 * @param orderNo
+	 * @param confirm
+	 * @return
+	 */
+	@RequestMapping(value="/confirmIntention", method = RequestMethod.POST)
+	public Result confirmIntention(String orderNo,boolean confirm){
+		Result res = new Result();
+		if(StringUtils.isBlank(orderNo)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单编号"));
+			return res;
+		}
+		orderServiceImpl.confirmIntention(Long.valueOf(orderNo),confirm);
+		return res;
+	}
 }

+ 1 - 1
src/main/java/com/goafanti/order/enums/OrderAction.java

@@ -3,7 +3,7 @@ package com.goafanti.order.enums;
 
 public enum OrderAction {
 	ADD_INTENTION,
-	INTENTION_CONFIRM,
+	CONFIRM_INTENTION,
 	CONFIRM_PAY_FOR_FIRST,
 	CONFIRM_PAY_FOR_LAST,
 	APPLY_FOR_WITHDRAW,

+ 8 - 0
src/main/java/com/goafanti/order/service/OrderService.java

@@ -82,4 +82,12 @@ public interface OrderService {
 	 * @return
 	 */
 	int applyForCancel(Long orderNo);
+
+	/**
+	 * 确认意向订单
+	 * @param orderNo 订单编号
+	 * @param confirm 是否确认
+	 * @return
+	 */
+	int confirmIntention(Long orderNo, boolean confirm);
 }

+ 20 - 2
src/main/java/com/goafanti/order/service/impl/OrderServiceImpl.java

@@ -124,7 +124,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 			tOrder.setLiquidationStatus(LiquidationSate.WAIT_FOR_PAY.getCode());
 			tOrder.setActuallyFirstPayment(new BigDecimal(0));
 			tOrder.setActuallyTotalPayment(new BigDecimal(0));
-		}else if(orderAction == OrderAction.INTENTION_CONFIRM){ //确认意向订单 (用户确认)
+		}else if(orderAction == OrderAction.CONFIRM_INTENTION){ //确认意向订单 (用户确认)
 			if(tOrder.getOrderStatus() != OrderState.INTENTION.getCode() 
 					|| tOrder.getIntentionStatus() != IntentionSate.WAIT_SELLER_CONFIRM.getCode()
 					|| tOrder.getTradingStatus() != TradingState.WAIT_FOR_TRADE.getCode()
@@ -295,6 +295,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 			active.setConfirmWithdraw(false);
 			if (TokenManager.getUserId().equals(tOrder.getBuyerId())) { // 买方
 				active.setConfirmIntention(false);
+				active.setRefuseIntention(false);
 				active.setApplyForWithdraw(false);
 				if (tOrder.getOrderStatus() == OrderState.WAIT_FOR_PAY.getCode()
 						&& tOrder.getIntentionStatus() == IntentionSate.SELLER_CONFIRM.getCode()
@@ -343,8 +344,10 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 						&& tOrder.getPaymentStatus() == PaymentState.WAIT_PAY_FIRST_BALANCE.getCode()
 						&& tOrder.getLiquidationStatus() == LiquidationSate.WAIT_FOR_PAY.getCode()) {
 					active.setConfirmIntention(true);
+					active.setRefuseIntention(true);
 				} else {
 					active.setConfirmIntention(false);
+					active.setRefuseIntention(false);
 				}
 				if (tOrder.getOrderStatus() == OrderState.COMPLETED.getCode()
 						&& tOrder.getIntentionStatus() == IntentionSate.SELLER_CONFIRM.getCode()
@@ -358,8 +361,9 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 			} else {
 				active.setPayForFirst(false);
 				active.setPayForLast(false);
-				active.setApplyForCancel(false);
 				active.setConfirmIntention(false);
+				active.setRefuseIntention(false);
+				active.setApplyForCancel(false);
 				active.setApplyForWithdraw(false);
 			}
 		}
@@ -374,8 +378,10 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 						&& tOrder.getPaymentStatus() == PaymentState.WAIT_PAY_FIRST_BALANCE.getCode()
 						&& tOrder.getLiquidationStatus() == LiquidationSate.WAIT_FOR_PAY.getCode()) {
 					active.setConfirmIntention(true);
+					active.setRefuseIntention(true);
 				} else {
 					active.setConfirmIntention(false);
+					active.setRefuseIntention(false);
 				}
 				if (tOrder.getOrderStatus() == OrderState.COMPLETED.getCode()
 						&& tOrder.getIntentionStatus() == IntentionSate.SELLER_CONFIRM.getCode()
@@ -467,11 +473,13 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 				bo.setCommodityQuantity(t.getCommodityQuantity());
 				bo.setCommodityMode(t.getCommodityMode());
 				bo.setCommodityId(t.getCommodityId());
+				bo.setCommodityPrice(String.valueOf(t.getCommodityPrice()));
 				bo.setOrderRemarks(t.getOrderRemarks());
 				bo.setCreateTime(DateUtils.formatDate(t.getCreateTime(),AFTConstants.YYYYMMDDHHMMSS));
 				bo.setOrderStatus(OrderState.getStatus(t.getOrderStatus()).getDesc());
 				bo.setCommodityType(t.getCommodityType());
 				bo.setOrderAmount(String.valueOf(t.getOrderAmount()));
+				bo.setFirstPayment(String.valueOf(t.getFirstPayment()));
 				bo.setOperatorActive(setOperatorActive(t));
 				boList.add(bo);
 			}
@@ -492,12 +500,14 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		bo.setCommodityQuantity(t.getCommodityQuantity());
 		bo.setCommodityMode(t.getCommodityMode());
 		bo.setCommodityId(t.getCommodityId());
+		bo.setCommodityPrice(String.valueOf(t.getCommodityPrice()));
 		bo.setOrderRemarks(t.getOrderRemarks());
 		bo.setCreateTime(DateUtils.formatDate(t.getCreateTime(),AFTConstants.YYYYMMDDHHMMSS));
 		bo.setOrderStatus(OrderState.getStatus(t.getOrderStatus()).getDesc());
 		bo.setCommodityType(t.getCommodityType());
 		bo.setOrderAmount(String.valueOf(t.getOrderAmount()));
 		bo.setOperatorActive(setOperatorActive(t));
+		bo.setFirstPayment(String.valueOf(t.getFirstPayment()));
 		return bo;
 	}
 
@@ -558,4 +568,12 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		}
 		return result;
 	}
+
+	@Override
+	public int confirmIntention(Long orderNo, boolean confirm) {
+		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
+		setOrderState(OrderAction.CONFIRM_INTENTION, new BigDecimal(0), tOrder, confirm);
+		tOrderMapper.updateByPrimaryKeySelective(tOrder);
+		return 1;
+	}
 }