|
|
@@ -5,10 +5,12 @@ import com.uas.platform.b2b.publicapi.service.TradeCountService;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -33,11 +35,12 @@ public class TradeCountController {
|
|
|
* @return
|
|
|
*/
|
|
|
@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.setPageNumber(1);
|
|
|
pageInfo.setPageSize(20);
|
|
|
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);
|
|
|
}
|
|
|
}
|