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

B2B商务平台订单总金额接口返回结果调整

hejq 7 лет назад
Родитель
Сommit
9dc42a4427

+ 5 - 2
src/main/java/com/uas/platform/b2b/publicapi/controller/TradeCountController.java

@@ -5,10 +5,12 @@ import com.uas.platform.b2b.publicapi.service.TradeCountService;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Sort;
 import org.springframework.data.domain.Sort;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -33,11 +35,12 @@ public class TradeCountController {
      * @return
      * @return
      */
      */
     @RequestMapping(method = RequestMethod.GET)
     @RequestMapping(method = RequestMethod.GET)
-    public List<TradeCount> findByParameters(String tradeType, String currency, String fromDate, String endDate) {
+    public BigDecimal findByParameters(String tradeType, String currency, String fromDate, String endDate) {
         PageInfo pageInfo = new PageInfo();
         PageInfo pageInfo = new PageInfo();
         pageInfo.setPageNumber(1);
         pageInfo.setPageNumber(1);
         pageInfo.setPageSize(20);
         pageInfo.setPageSize(20);
         pageInfo.setSort(new Sort(Sort.Direction.DESC, "id"));
         pageInfo.setSort(new Sort(Sort.Direction.DESC, "id"));
-        return tradeCountService.findByParameters(tradeType, currency, fromDate, endDate, pageInfo);
+        List<TradeCount> counts = tradeCountService.findByParameters(tradeType, currency, fromDate, endDate, pageInfo);
+        return !CollectionUtils.isEmpty(counts) ? counts.get(0).getAmount() : new BigDecimal(0);
     }
     }
 }
 }