[add]增加统计总金额接口

master
NH-LHG 1 year ago
parent a6261d84ce
commit 8619d730ef

@ -1,17 +1,18 @@
package org.jeecg.modules.demo.erp.controller;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import org.jeecg.modules.demo.erp.entity.StoreInfo;
import org.jeecg.modules.demo.erp.entity.ext.OrderDetailExt;
@ -127,6 +128,23 @@ public class OrderController {
return Result.OK(pageExt);
}
@ApiOperation(value="统计总金额", notes="统计总金额")
@GetMapping(value = "/getTotalAmount")
public Result<String> getTotalAmount(Order order,HttpServletRequest req){
AtomicReference<BigDecimal> totalAmount = new AtomicReference<>(
new BigDecimal(BigDecimal.ZERO.toString())
);
List<Order> orderList = orderService.list(
QueryGenerator.initQueryWrapper(
order, req.getParameterMap()
)
);
orderList.forEach(e ->{
totalAmount.set(totalAmount.get().add(e.getTotalAmount()));
});
return Result.OK(totalAmount.toString());
}
@ApiOperation(value="订单状态统计", notes="订单状态统计")
@GetMapping(value = "/queryState")
public Result<OrderStateVo> queryState(@RequestParam(name="userId",required=true) String userId){

Loading…
Cancel
Save