|
|
@@ -42,6 +42,7 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.NumberUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.management.OperationsException;
|
|
|
@@ -259,9 +260,13 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
|
|
|
Long userUU = SystemSession.getUser().getUserUU();
|
|
|
InvoiceFPurchase invoiceFPurchase = inFpuDao.getOne(id);
|
|
|
Purchase purchase = purchaseDao.findOne(invoiceFPurchase.getPuid());
|
|
|
- String deliveryType = sendInfo.getString("deliveryType");
|
|
|
-
|
|
|
- if(StringUtils.isEmpty(deliveryType)) {
|
|
|
+// String deliveryType = sendInfo.getString("deliveryType");
|
|
|
+ Integer sendType = Integer.parseInt(sendInfo.getString("sendType"));
|
|
|
+
|
|
|
+// if(StringUtils.isEmpty(deliveryType)) {
|
|
|
+// return new ResultMap(CodeType.NO_INFO, "配送方式的信息为空,请重新操作");
|
|
|
+// }
|
|
|
+ if (sendType == null){
|
|
|
return new ResultMap(CodeType.NO_INFO, "配送方式的信息为空,请重新操作");
|
|
|
}
|
|
|
|
|
|
@@ -274,31 +279,37 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
|
|
|
&&purchase.getLaunchPuExApplyStatus().equals(AfterSaleStatus.FINISHED)) {
|
|
|
return new ResultMap(CodeType.NOT_PERMIT, "您的异常申请流程还不是已完成或已取消状态,不能做发货的动作!");
|
|
|
}
|
|
|
-
|
|
|
- if("logistics".equals(deliveryType)) {
|
|
|
- JSONObject logisjson= sendInfo.getJSONObject("logisticsInfo");
|
|
|
- Logistics logistics = logisticsService.bornLogisticsByCompanyNameAndNum(logisjson.getString("companyName"), logisjson.getString("number"));
|
|
|
+ JSONObject logisticsJson = sendInfo.getJSONObject("logisticsInfo");
|
|
|
+ if (logisticsJson != null){
|
|
|
+ Logistics logistics = logisticsService.bornLogisticsByCompanyNameAndNum(logisticsJson.getString("companyName"), logisticsJson.getString("number"));
|
|
|
invoiceFPurchase.setLogistics(logistics);
|
|
|
-
|
|
|
- }else if("selfDelivery".equals(deliveryType)){
|
|
|
- JSONObject logisticsJson= sendInfo.getJSONObject("selfDeliveryPerson");
|
|
|
- String name = logisticsJson.getString("name");
|
|
|
- if(StringUtils.isEmpty(name)) {
|
|
|
- return new ResultMap(CodeType.NO_INFO, "送货人信息为空,请重新操作");
|
|
|
- }
|
|
|
- String phone = logisticsJson.getString("phone");
|
|
|
- if(StringUtils.isEmpty(phone)) {
|
|
|
- return new ResultMap(CodeType.NO_INFO, "送货人电话信息为空,请重新操作");
|
|
|
- }
|
|
|
- invoiceFPurchase.setSelfDeliveryName(name);
|
|
|
- invoiceFPurchase.setSelfDeliveryPhone(phone);
|
|
|
}
|
|
|
+// if("logistics".equals(deliveryType)) {
|
|
|
+// JSONObject logisjson= sendInfo.getJSONObject("logisticsInfo");
|
|
|
+// Logistics logistics = logisticsService.bornLogisticsByCompanyNameAndNum(logisjson.getString("companyName"), logisjson.getString("number"));
|
|
|
+// invoiceFPurchase.setLogistics(logistics);
|
|
|
+//
|
|
|
+// }else if("selfDelivery".equals(deliveryType)){
|
|
|
+// JSONObject logisticsJson= sendInfo.getJSONObject("selfDeliveryPerson");
|
|
|
+// String name = logisticsJson.getString("name");
|
|
|
+// if(StringUtils.isEmpty(name)) {
|
|
|
+// return new ResultMap(CodeType.NO_INFO, "送货人信息为空,请重新操作");
|
|
|
+// }
|
|
|
+// String phone = logisticsJson.getString("phone");
|
|
|
+// if(StringUtils.isEmpty(phone)) {
|
|
|
+// return new ResultMap(CodeType.NO_INFO, "送货人电话信息为空,请重新操作");
|
|
|
+// }
|
|
|
+// invoiceFPurchase.setSelfDeliveryName(name);
|
|
|
+// invoiceFPurchase.setSelfDeliveryPhone(phone);
|
|
|
+// }
|
|
|
+
|
|
|
String jsonSdAddress = sendInfo.getString("jsonSdAddress");
|
|
|
if(StringUtils.isEmpty(jsonSdAddress)) {
|
|
|
return new ResultMap(CodeType.NO_INFO, "发货人的地址信息为空,请重新操作");
|
|
|
}
|
|
|
invoiceFPurchase.setJsonSdAddress(jsonSdAddress);
|
|
|
- invoiceFPurchase.setDeliveryType(deliveryType);
|
|
|
+// invoiceFPurchase.setDeliveryType(deliveryType);
|
|
|
+ invoiceFPurchase.setSendType(sendType);
|
|
|
|
|
|
invoiceFPurchase.setStatusInBound(userUU);
|
|
|
Set<InvoiceFPurchaseDetail> invoiceFPurchaseDetails = invoiceFPurchase.getInvoiceFPurchaseDetails();
|
|
|
@@ -318,13 +329,17 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
|
|
|
}
|
|
|
}
|
|
|
purchase.setStatusInBound(userUU);
|
|
|
- if("logistics".equals(inFpu.getDeliveryType())) {
|
|
|
+ if (inFpu.getLogistics() != null){
|
|
|
purchase.setLgtId(inFpu.getLogistics().getId());
|
|
|
- }else {
|
|
|
- purchase.setSelfDeliveryName(inFpu.getSelfDeliveryName());
|
|
|
- purchase.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
|
|
|
}
|
|
|
- purchase.setDeliveryType(inFpu.getDeliveryType());
|
|
|
+// if("logistics".equals(inFpu.getDeliveryType())) {
|
|
|
+// purchase.setLgtId(inFpu.getLogistics().getId());
|
|
|
+// }else {
|
|
|
+// purchase.setSelfDeliveryName(inFpu.getSelfDeliveryName());
|
|
|
+// purchase.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
|
|
|
+// }
|
|
|
+// purchase.setDeliveryType(inFpu.getDeliveryType());
|
|
|
+
|
|
|
purchase.setJsonSdAddress(inFpu.getJsonSdAddress());
|
|
|
purchase.setSendName(SystemSession.getUser().getUserName());
|
|
|
purchase.setSenduu(SystemSession.getUser().getUserUU());
|
|
|
@@ -337,12 +352,15 @@ public class InvoiceFPurchaseServiceImpl implements InvoiceFPurchaseService {
|
|
|
if(order == null) {
|
|
|
return new ResultMap(CodeType.NOT_PERMIT, "您订单的信息有误,请重新提交");
|
|
|
}
|
|
|
- if("logistics".equals(inFpu.getDeliveryType())) {
|
|
|
+ if (inFpu.getLogistics() != null){
|
|
|
order.setLgtId(inFpu.getLogistics().getId());
|
|
|
- }else {
|
|
|
- order.setSelfDeliveryName(inFpu.getSelfDeliveryName());
|
|
|
- order.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
|
|
|
}
|
|
|
+// if("logistics".equals(inFpu.getDeliveryType())) {
|
|
|
+// order.setLgtId(inFpu.getLogistics().getId());
|
|
|
+// }else {
|
|
|
+// order.setSelfDeliveryName(inFpu.getSelfDeliveryName());
|
|
|
+// order.setSelfDeliveryPhone(inFpu.getSelfDeliveryPhone());
|
|
|
+// }
|
|
|
order.setJsonSdAddress(inFpu.getJsonSdAddress());
|
|
|
order.setStatusInBound(userUU);
|
|
|
for (OrderDetail detail : order.getOrderDetails()) {
|