|
|
@@ -11,6 +11,7 @@ import com.uas.platform.b2c.core.support.log.TradeBufferedLogger;
|
|
|
import com.uas.platform.b2c.core.utils.DoubleArith;
|
|
|
import com.uas.platform.b2c.core.utils.FastjsonUtils;
|
|
|
import com.uas.platform.b2c.core.utils.NumberUtil;
|
|
|
+import com.uas.platform.b2c.core.utils.StringUtilB2C;
|
|
|
import com.uas.platform.b2c.logistics.dao.InvoiceFOrderDao;
|
|
|
import com.uas.platform.b2c.logistics.model.InvoiceFOrder;
|
|
|
import com.uas.platform.b2c.logistics.model.InvoiceFOrderDetail;
|
|
|
@@ -40,7 +41,7 @@ import com.uas.platform.core.model.Status;
|
|
|
import com.uas.platform.core.persistence.criteria.PredicateUtils;
|
|
|
import com.uas.platform.core.persistence.criteria.SimpleExpression;
|
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
-import org.apache.commons.collections.MapUtils;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
@@ -351,12 +352,12 @@ public class InvoiceFOrderServiceImpl implements InvoiceFOrderService {
|
|
|
if (org.apache.commons.lang.StringUtils.isEmpty(shipList)) {
|
|
|
return new ResultMap(CodeType.NO_INFO, "发货明细缺失");
|
|
|
}
|
|
|
- Map<Long, Double> map = FlexJsonUtils.fromJson(shipList, Map.class);
|
|
|
- if (MapUtils.isEmpty(map)) {
|
|
|
+ List<Map<String, Object>> list = FlexJsonUtils.fromJsonArray(shipList, Map.class);
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
return new ResultMap(CodeType.NO_INFO, "发货明细缺失");
|
|
|
}
|
|
|
InvoiceFOrder thisFor = null;
|
|
|
- ResultMap resultMap = createInvoiceFromOrder(order, map);
|
|
|
+ ResultMap resultMap = createInvoiceFromOrder(order, list);
|
|
|
if (resultMap.getCode() == CodeType.OK.code()) {
|
|
|
thisFor = (InvoiceFOrder) resultMap.getData();
|
|
|
} else {
|
|
|
@@ -452,11 +453,11 @@ public class InvoiceFOrderServiceImpl implements InvoiceFOrderService {
|
|
|
* @param order 订单
|
|
|
* @param order 需要发货的订单
|
|
|
*/
|
|
|
- private ResultMap createInvoiceFromOrder(Order order, Map<Long, Double> map) {
|
|
|
+ private ResultMap createInvoiceFromOrder(Order order, List<Map<String, Object>> list) {
|
|
|
if (order == null) {
|
|
|
return new ResultMap(CodeType.NO_INFO, "找不到对应订单");
|
|
|
}
|
|
|
- if (MapUtils.isEmpty(map)) {
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
return new ResultMap(CodeType.NO_INFO, "发货明细为空");
|
|
|
}
|
|
|
Long userUU = SystemSession.getUser().getUserUU();
|
|
|
@@ -474,7 +475,20 @@ public class InvoiceFOrderServiceImpl implements InvoiceFOrderService {
|
|
|
Double qty = 0.0d;
|
|
|
for (OrderDetail orDetail : order.getOrderDetails()) {
|
|
|
qty = 0.0d;
|
|
|
- qty = map.get(orDetail.getId());
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
+ Object id = map.get("id");
|
|
|
+ if (StringUtilB2C.isEmpty(id)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (Long.valueOf(id.toString()).longValue() == orDetail.getId().longValue()) {
|
|
|
+ Object qty1 = map.get("qty");
|
|
|
+ if (StringUtilB2C.isEmpty(qty1)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ qty = Double.valueOf(qty1.toString());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
if ((Status.SHIPPED.value() != orDetail.getStatus()) || (NumberUtil.compare(qty, DoubleConstant.zero) < 1)) {
|
|
|
continue;
|
|
|
}
|