|
|
@@ -1,19 +1,17 @@
|
|
|
package com.uas.platform.b2c.prod.commodity.service.impl;
|
|
|
|
|
|
+import com.uas.platform.b2c.core.utils.NumberUtil;
|
|
|
import com.uas.platform.b2c.logistics.model.InvoiceDetail;
|
|
|
-import com.uas.platform.b2c.logistics.model.InvoiceFOrderDetail;
|
|
|
-import com.uas.platform.b2c.logistics.model.InvoiceFPurchaseDetail;
|
|
|
+import com.uas.platform.b2c.prod.commodity.constant.DoubleConstant;
|
|
|
import com.uas.platform.b2c.prod.commodity.model.InOutboundDetail;
|
|
|
import com.uas.platform.b2c.prod.commodity.dao.InOutboundDetailDao;
|
|
|
import com.uas.platform.b2c.prod.commodity.service.InOutboundDetailService;
|
|
|
+import com.uas.platform.b2c.prod.commodity.type.InOutBoundType;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* description
|
|
|
@@ -66,4 +64,27 @@ public class InOutboundDetailServiceImpl implements InOutboundDetailService {
|
|
|
}
|
|
|
return inOutBoundset;
|
|
|
}
|
|
|
+
|
|
|
+ public Map<String, Set<InOutboundDetail>> initInOutboundDetailByQty (Set<InOutboundDetail> newInOutboundDetail) {
|
|
|
+ Map<String, Set<InOutboundDetail>> inOutMap = new HashMap<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(newInOutboundDetail)) {
|
|
|
+ Set<InOutboundDetail> inBoundDetail = new HashSet<>();
|
|
|
+ Set<InOutboundDetail> outBoundDetail = new HashSet<>();
|
|
|
+ for (InOutboundDetail detail1 : newInOutboundDetail) {
|
|
|
+ if (NumberUtil.compare(detail1.getQty(), DoubleConstant.zero) < 0) {
|
|
|
+ detail1.setQty(Math.abs(detail1.getQty()));
|
|
|
+ outBoundDetail.add(detail1);
|
|
|
+ } else if (NumberUtil.compare(detail1.getQty(), DoubleConstant.zero) > 0) {
|
|
|
+ inBoundDetail.add(detail1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(inBoundDetail)) {
|
|
|
+ inOutMap.put(InOutBoundType.OTHER_INBOUND, inBoundDetail);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(outBoundDetail)) {
|
|
|
+ inOutMap.put(InOutBoundType.OTHER_OUTBOUND, outBoundDetail);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return inOutMap;
|
|
|
+ }
|
|
|
}
|