|
@@ -9,16 +9,17 @@ import com.github.zuihou.business.barrel.entity.EquBarrel;
|
|
|
import com.github.zuihou.business.barrel.service.EquBarrelService;
|
|
|
import com.github.zuihou.business.order.entity.Order;
|
|
|
import com.github.zuihou.business.order.service.OrderService;
|
|
|
-import com.github.zuihou.business.productionresource.dto.ProductionResourcePageDTO;
|
|
|
import com.github.zuihou.business.productionresource.dto.ReloadMtrDto;
|
|
|
import com.github.zuihou.business.productionresource.entity.ProductionResource;
|
|
|
import com.github.zuihou.business.productionresource.service.ProductionTenantResourceService;
|
|
|
import com.github.zuihou.business.util.CommonUtil;
|
|
|
+import com.github.zuihou.common.util.DateUtil;
|
|
|
import com.github.zuihou.context.BaseContextHandler;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
|
|
|
import com.github.zuihou.utils.DateUtils;
|
|
|
+import org.apache.commons.compress.utils.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -26,7 +27,7 @@ import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 运维小程序接口
|
|
@@ -120,16 +121,33 @@ public class OpsAppApi {
|
|
|
orderQueryWrap.eq("order_status","SUCCESS").eq("order_equ_id", order.getOrderEquId()).orderByDesc("create_time");
|
|
|
IPage<Order> list = orderService.pageList(page, orderQueryWrap);
|
|
|
|
|
|
- orderQueryWrap.select("sum(order_amount) as orderSum");
|
|
|
+ orderQueryWrap.select("ifnull(sum(order_amount), 0.0) as orderSum");
|
|
|
Order sumOrder = orderService.getOne(orderQueryWrap);
|
|
|
- if (sumOrder== null){
|
|
|
- sumOrder = Order.builder().build().setOrderSum(BigDecimal.ZERO);
|
|
|
+ if(list.getRecords().size()>0){
|
|
|
+ list.getRecords().add(0, sumOrder);
|
|
|
+ }else{
|
|
|
+ list.setRecords(new ArrayList<Order>(Arrays.asList(sumOrder)));
|
|
|
}
|
|
|
- list.getRecords().add(0, sumOrder);
|
|
|
return R.success(list);
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 设备详情接口
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/orderDetails")
|
|
|
+ public R<Order> orderDetails(@RequestParam("id") Long id) {
|
|
|
+ BaseContextHandler.setTenant("0000");
|
|
|
+ QueryWrap<Order> queryWrap = new QueryWrap<>();
|
|
|
+ queryWrap.eq("id", id);
|
|
|
+ Page<Order> page = new Page<Order>(1L,1);
|
|
|
+ IPage<Order> orderList = orderService.pageList(page, queryWrap);
|
|
|
+ return R.success(orderList.getRecords().size()>0? orderList.getRecords().get(0) : Order.builder().build());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 今日订单接口
|
|
|
*
|
|
@@ -181,10 +199,26 @@ public class OpsAppApi {
|
|
|
return R.success(list);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 订单统计数据
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @GetMapping("/orderStatistics")
|
|
|
+ public R<Map> statisticsList(@RequestParam("equId") Long equId) {
|
|
|
+ BaseContextHandler.setTenant("0000");
|
|
|
+ QueryWrap<Order> orderStatisticWrap = new QueryWrap<>();
|
|
|
+ orderStatisticWrap.eq("id", equId).orderByDesc("create_time");
|
|
|
+ Map<String, String> paramsMap = new HashMap<String,String>();
|
|
|
+ String now = DateUtil.dateToString(new Date());
|
|
|
+ String sevenAgo = DateUtil.dateToString(DateUtil.getBeforeDate(new Date(), 7));
|
|
|
+ String nextDay = DateUtil.dateToString(DateUtil.getAddSecondsTime(new Date(), 60*60*24*1000));
|
|
|
+ paramsMap.put("now", now);
|
|
|
+ paramsMap.put("sevenAgo", sevenAgo);
|
|
|
+ paramsMap.put("nextDay", nextDay);
|
|
|
+ paramsMap.put("id", equId.toString());
|
|
|
+ Map map = orderService.getStatisticMap(paramsMap);
|
|
|
+ return R.success(map);
|
|
|
+ }
|
|
|
|
|
|
//
|
|
|
/**
|