Просмотр исходного кода

处理规格信息在出入库不展示的问题。

yujia 7 лет назад
Родитель
Сommit
7c9d39e51b

+ 2 - 2
src/main/java/com/uas/platform/b2c/logistics/controller/InvoiceController.java

@@ -388,7 +388,7 @@ public class InvoiceController {
 	 * @return ResultMap
 	 */
 	@RequestMapping(value = "/enterprise/inbound", method = RequestMethod.GET)
-    public Page<Invoice> getEnterpriseInboundInvoice(PageParams pageParams, String keyword) {
-		return invoiceService.getEnterpriseInboundInvoice(pageParams, keyword);
+    public Page<Invoice> getEnterpriseInboundInvoice(PageParams pageParams, String keyword, Long fromDate, Long toDate) {
+		return invoiceService.getEnterpriseInboundInvoice(pageParams, keyword, fromDate, toDate);
 	}
 }

+ 1 - 0
src/main/java/com/uas/platform/b2c/logistics/model/InvoiceDetail.java

@@ -608,6 +608,7 @@ public class InvoiceDetail {
 		this.b2cMaxDelivery = puDetail.getB2cMaxDelivery();
 		this.remark = puDetail.getRemark();
 		this.goodsnumber = puDetail.getGoodsnumber();
+		this.spec = puDetail.getSpec();
 		this.productid = puDetail.getProductid();
 		this.orderDetailId = puDetail.getOrDetailId();
 		this.orderDetailid = puDetail.getOrderdetailid();

+ 5 - 1
src/main/java/com/uas/platform/b2c/logistics/service/InvoiceService.java

@@ -213,7 +213,11 @@ public interface InvoiceService {
 
     /**
      * 获取买家的待收货出库单
+     * @param pageParams 分页信息。
+     * @param keyword 搜索关键字
+     * @param fromDate 开始时间
+     * @param toDate 结束时间
      * @return Page<Invoice>
      */
-    Page<Invoice> getEnterpriseInboundInvoice(PageParams pageParams, String keyword);
+    Page<Invoice> getEnterpriseInboundInvoice(PageParams pageParams, String keyword, Long fromDate, Long toDate);
 }

+ 14 - 3
src/main/java/com/uas/platform/b2c/logistics/service/impl/InvoiceServiceImpl.java

@@ -57,6 +57,7 @@ import com.uas.sso.util.FlexJsonUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Sort;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -923,10 +924,10 @@ public class InvoiceServiceImpl implements InvoiceService {
         Invoice inFpu = new Invoice(purchase);
 
         //保存适用配送规则和自提点信息
-        if (purchase.getJsonRule() != null){
+        if (purchase.getJsonRule() != null) {
             inFpu.setJsonRule(purchase.getJsonRule());
         }
-        if (purchase.getJsonTakeSelf() != null){
+        if (purchase.getJsonTakeSelf() != null) {
             inFpu.setJsonTakeSelf(purchase.getJsonTakeSelf());
         }
         // 生成出货单号
@@ -1225,7 +1226,7 @@ public class InvoiceServiceImpl implements InvoiceService {
     }
 
     @Override
-    public Page<Invoice> getEnterpriseInboundInvoice(PageParams pageParams, String keyword) {
+    public Page<Invoice> getEnterpriseInboundInvoice(PageParams pageParams, String keyword, Long fromDate, Long toDate) {
         final PageInfo info = new PageInfo(pageParams);
         User user = SystemSession.getUser();
         Enterprise enterprise = user.getEnterprise();
@@ -1235,6 +1236,9 @@ public class InvoiceServiceImpl implements InvoiceService {
         } else {
             info.filter("buyerenuu", user.getEnterprise().getUu());
         }
+        if (StringUtilB2C.isEmpty(info.getSort())) {
+            info.sorting("createtime", Sort.Direction.DESC);
+        }
         if (org.apache.commons.lang3.StringUtils.isNotEmpty(keyword)) {
             CriterionExpression[] expressions = new CriterionExpression[2];
             expressions[0] = PredicateUtils.like("invoiceid", keyword, true);
@@ -1243,6 +1247,13 @@ public class InvoiceServiceImpl implements InvoiceService {
             LogicalExpression logicalExpression = PredicateUtils.or(expressions);
             info.expression(logicalExpression);
         }
+        if (fromDate != null && toDate != null) {
+            CriterionExpression[] expressions = new CriterionExpression[2];
+            expressions[0] = PredicateUtils.gte("createtime", new Date(fromDate), false);
+            expressions[1] = PredicateUtils.lte("createtime", new Date(toDate), false);
+            LogicalExpression logicalExpression = PredicateUtils.and(expressions);
+            info.expression(logicalExpression);
+        }
         info.filter("status", com.uas.platform.b2c.core.constant.Status.INBOUND.value());
         return invoiceDao.findAll(new Specification<Invoice>() {
             @Override