|
@@ -50,6 +50,7 @@ import com.yohoufo.order.service.concurrent.ThreadPoolFactory; |
|
@@ -50,6 +50,7 @@ import com.yohoufo.order.service.concurrent.ThreadPoolFactory; |
50
|
import com.yohoufo.order.service.handler.SellerOrderComputeHandler;
|
50
|
import com.yohoufo.order.service.handler.SellerOrderComputeHandler;
|
51
|
import com.yohoufo.order.service.handler.SellerOrderSubmitHandler;
|
51
|
import com.yohoufo.order.service.handler.SellerOrderSubmitHandler;
|
52
|
import com.yohoufo.order.service.impl.processor.ChangePricePrepareProcessor;
|
52
|
import com.yohoufo.order.service.impl.processor.ChangePricePrepareProcessor;
|
|
|
53
|
+import com.yohoufo.order.service.impl.processor.PriceComputePrepareProcessor;
|
53
|
import com.yohoufo.order.service.impl.processor.SellerBatchCancelPrepareProcessor;
|
54
|
import com.yohoufo.order.service.impl.processor.SellerBatchCancelPrepareProcessor;
|
54
|
import com.yohoufo.order.service.impl.processor.SellerOrderPrepareProcessor;
|
55
|
import com.yohoufo.order.service.impl.processor.SellerOrderPrepareProcessor;
|
55
|
import com.yohoufo.order.service.impl.visitor.OffShelveCancelCase;
|
56
|
import com.yohoufo.order.service.impl.visitor.OffShelveCancelCase;
|
|
@@ -128,58 +129,56 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
@@ -128,58 +129,56 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
128
|
@Autowired
|
129
|
@Autowired
|
129
|
private MerchantOrderPaymentService merchantOrderPaymentService;
|
130
|
private MerchantOrderPaymentService merchantOrderPaymentService;
|
130
|
|
131
|
|
|
|
132
|
+ @Autowired
|
|
|
133
|
+ private PriceComputePrepareProcessor priceComputePrepareProcessor;
|
131
|
|
134
|
|
132
|
public SoldPrdComputeBo computePublishPrd(SellerOrderComputeReq req) throws GatewayException {
|
135
|
public SoldPrdComputeBo computePublishPrd(SellerOrderComputeReq req) throws GatewayException {
|
133
|
log.info("in computePublishPrd, req {}", req);
|
136
|
log.info("in computePublishPrd, req {}", req);
|
134
|
- int uid = req.getUid();
|
|
|
135
|
- if(uid <= 0){
|
|
|
136
|
- log.warn("in computePublishPrd uid illegal , req {}", req);
|
|
|
137
|
- throw new GatewayException(400, "用户ID错误");
|
137
|
+ PriceComputePrepareProcessor.PriceComputeNode pcn = priceComputePrepareProcessor.checkBasePrice(req);
|
|
|
138
|
+ int uid = pcn.getUid();
|
|
|
139
|
+ Integer storageId = pcn.getStorageId();
|
|
|
140
|
+ int num = pcn.getNum();
|
|
|
141
|
+ BigDecimal prdPrice = pcn.getPrdPrice();
|
|
|
142
|
+ String tips = null;
|
|
|
143
|
+ try {
|
|
|
144
|
+ sellerOrderPrepareProcessor.checkPrice(storageId, prdPrice, false);
|
|
|
145
|
+ }catch (Exception ex){
|
|
|
146
|
+ if (ex instanceof UfoServiceException && ((UfoServiceException) ex).getCode() == SellerOrderPrepareProcessor.TIPS_ERROR_CODE){
|
|
|
147
|
+ tips = ((UfoServiceException) ex).getMessage();
|
138
|
}
|
148
|
}
|
139
|
- //
|
|
|
140
|
- Integer storageId = req.getStorageId();
|
|
|
141
|
- if (storageId <=0 ){
|
|
|
142
|
- log.warn("in computePublishPrd storageId illegal , req {}", req);
|
|
|
143
|
- throw new GatewayException(400, "storageId 错误");
|
|
|
144
|
}
|
149
|
}
|
145
|
- int num;
|
|
|
146
|
- if ((num = req.getNum())<=0){
|
|
|
147
|
- log.warn("in computePublishPrd num illegal , req {}", req);
|
|
|
148
|
- throw new GatewayException(400, "非法数量值");
|
150
|
+
|
|
|
151
|
+ SoldPrdComputeBo spc = buildSoldPrdComputeBo(uid, num, prdPrice);
|
|
|
152
|
+ spc.setTips(tips);
|
|
|
153
|
+ return spc;
|
149
|
}
|
154
|
}
|
150
|
|
155
|
|
151
|
- /*商品鉴定费 ¥10.00
|
|
|
152
|
- 商品包装费 ¥10.00
|
|
|
153
|
- 平台服务费(5%,优惠期间0%) ¥0.00
|
156
|
+ public SoldPrdComputeBo computeChangePrice(SellerOrderComputeReq req) throws GatewayException {
|
|
|
157
|
+ log.info("in computeChangePrice, req {}", req);
|
|
|
158
|
+ PriceComputePrepareProcessor.PriceComputeNode pcn = priceComputePrepareProcessor.checkBasePrice(req);
|
|
|
159
|
+ int uid = pcn.getUid();
|
|
|
160
|
+ Integer storageId = pcn.getStorageId();
|
|
|
161
|
+ int num = pcn.getNum();
|
|
|
162
|
+ BigDecimal prdPrice = pcn.getPrdPrice();
|
|
|
163
|
+
|
|
|
164
|
+ SellerOrderComputeResult computeResult = computeHandler.compute(prdPrice);
|
|
|
165
|
+ /**
|
|
|
166
|
+ * 验证是否是入驻商家
|
154
|
*/
|
167
|
*/
|
155
|
- String price = req.getPrice();
|
|
|
156
|
- if (StringUtils.isBlank(price)){
|
|
|
157
|
- log.warn("in computePublishPrd price illegal , req {}", req);
|
|
|
158
|
- throw new GatewayException(400, "没有价格");
|
|
|
159
|
- }
|
|
|
160
|
- /*
|
|
|
161
|
- if(!price.endsWith("9")){
|
|
|
162
|
- log.warn("in computePublishPrd price illegal , req {}", req);
|
|
|
163
|
- throw new GatewayException(400, "价格须为以9结尾的正整数");
|
|
|
164
|
- }*/
|
|
|
165
|
-
|
|
|
166
|
- BigDecimal prdPrice = null;
|
|
|
167
|
- try{
|
|
|
168
|
- prdPrice = new BigDecimal(price);
|
|
|
169
|
- }catch (Exception e){
|
|
|
170
|
- log.warn("in computePublishPrd price convert BigDecimal fail, {}", req);
|
|
|
171
|
- throw new GatewayException(400, "非法数字");
|
168
|
+ if(sellerOrderPrepareProcessor.checkIsEntry(uid)){
|
|
|
169
|
+ sellerOrderPrepareProcessor.checkNGetMergeEarnestMoney(uid, computeResult.getEarnestMoney().getEarnestMoney(), num, prdPrice);
|
172
|
}
|
170
|
}
|
|
|
171
|
+
|
|
|
172
|
+ SoldPrdComputeBo spc = SellerOrderConvertor.computeResult2SoldPrdComputeBo(computeResult);
|
|
|
173
|
+
|
173
|
String tips = null;
|
174
|
String tips = null;
|
174
|
try {
|
175
|
try {
|
175
|
- sellerOrderPrepareProcessor.checkPrice(storageId, prdPrice, false);
|
176
|
+ sellerOrderPrepareProcessor.checkPrice(storageId, prdPrice, true);
|
176
|
}catch (Exception ex){
|
177
|
}catch (Exception ex){
|
177
|
if (ex instanceof UfoServiceException && ((UfoServiceException) ex).getCode() == SellerOrderPrepareProcessor.TIPS_ERROR_CODE){
|
178
|
if (ex instanceof UfoServiceException && ((UfoServiceException) ex).getCode() == SellerOrderPrepareProcessor.TIPS_ERROR_CODE){
|
178
|
tips = ((UfoServiceException) ex).getMessage();
|
179
|
tips = ((UfoServiceException) ex).getMessage();
|
179
|
}
|
180
|
}
|
180
|
}
|
181
|
}
|
181
|
-
|
|
|
182
|
- SoldPrdComputeBo spc = buildSoldPrdComputeBo(uid, num, prdPrice);
|
|
|
183
|
spc.setTips(tips);
|
182
|
spc.setTips(tips);
|
184
|
return spc;
|
183
|
return spc;
|
185
|
}
|
184
|
}
|
|
@@ -553,7 +552,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
@@ -553,7 +552,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
553
|
@Autowired
|
552
|
@Autowired
|
554
|
private SellerFeeService sellerFeeService;
|
553
|
private SellerFeeService sellerFeeService;
|
555
|
/**
|
554
|
/**
|
556
|
- * todo
|
555
|
+ * 批量调价
|
557
|
* @param req
|
556
|
* @param req
|
558
|
* @return
|
557
|
* @return
|
559
|
*/
|
558
|
*/
|
|
@@ -615,7 +614,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
@@ -615,7 +614,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
615
|
failCnt = skupMap.size();
|
614
|
failCnt = skupMap.size();
|
616
|
}
|
615
|
}
|
617
|
BatchChangePriceResp resp = BatchChangePriceResp.builder().successCnt(successCnt).failCnt(failCnt)
|
616
|
BatchChangePriceResp resp = BatchChangePriceResp.builder().successCnt(successCnt).failCnt(failCnt)
|
618
|
- .tips("变价成功").build();
|
617
|
+ .tips(cppDto.getTips()).build();
|
619
|
return resp;
|
618
|
return resp;
|
620
|
}
|
619
|
}
|
621
|
|
620
|
|