|
|
@@ -1,25 +1,17 @@
|
|
|
package com.sckw.report.controller;
|
|
|
|
|
|
-import com.alibaba.fastjson2.JSON;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
|
+import com.sckw.core.model.page.PageHelperUtil;
|
|
|
+import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
-import com.sckw.mongo.model.SckwTradeOrder;
|
|
|
-import com.sckw.report.dao.SckwTradeOrderRepository;
|
|
|
-import com.sckw.stream.model.SckwBusSum;
|
|
|
+import com.sckw.report.model.vo.KwfCapacityVo;
|
|
|
+import com.sckw.report.service.KwFleetService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.cloud.stream.function.StreamBridge;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
-import org.springframework.data.domain.PageRequest;
|
|
|
-import org.springframework.data.domain.Pageable;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.time.LocalDate;
|
|
|
-import java.util.Date;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -33,50 +25,20 @@ import java.util.List;
|
|
|
public class KwFleetController {
|
|
|
|
|
|
@Autowired
|
|
|
- SckwTradeOrderRepository tradeOrderRepository;
|
|
|
-
|
|
|
- @Resource
|
|
|
- StreamBridge streamBridge;
|
|
|
-
|
|
|
- @GetMapping("/detailV2")
|
|
|
- public HttpResult selectByKey2(Long id, int method) throws SystemException {
|
|
|
- SckwTradeOrder order = new SckwTradeOrder();
|
|
|
- order.setTOrderId(id);
|
|
|
- order.setTOrderNo("D" + id);
|
|
|
- order.setContractName(new Date()+"");
|
|
|
-
|
|
|
- SckwBusSum busSum = new SckwBusSum();
|
|
|
- busSum.setBusSumType("tradeOrder");
|
|
|
- busSum.setMethod(method);
|
|
|
- busSum.setObject(order);
|
|
|
- streamBridge.send("sckw-busSum", JSON.toJSONString(busSum));
|
|
|
-
|
|
|
-
|
|
|
- for (int i =0; i<10000; i++) {
|
|
|
- order.setTOrderId(System.currentTimeMillis());
|
|
|
- order.setTOrderNo("D" + order.getTOrderId());
|
|
|
- order.setContractName(new Date()+"");
|
|
|
- order.setActualAmount(new BigDecimal(0));
|
|
|
- order.setContractId(1L);
|
|
|
- order.setContractNo("11");
|
|
|
- order.setEndTime(LocalDate.now());
|
|
|
- order.setSupplyEntId(1L);
|
|
|
-
|
|
|
- busSum.setBusSumType("tradeOrder");
|
|
|
- busSum.setMethod(method);
|
|
|
- busSum.setObject(order);
|
|
|
- streamBridge.send("sckw-busSum", JSON.toJSONString(busSum));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //根据条件查询所有并排序,且分页
|
|
|
- Pageable pageable = PageRequest.of(0, 2);
|
|
|
- Page<SckwTradeOrder> all3 = tradeOrderRepository.findAll(pageable);
|
|
|
- List<SckwTradeOrder> content = all3.getContent();
|
|
|
- for (SckwTradeOrder stu : content) {
|
|
|
- System.out.println(stu);
|
|
|
- }
|
|
|
-
|
|
|
- return HttpResult.ok(content);
|
|
|
+ KwFleetService fleetService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param params {page:页数、pageSize:每页条数、。。。}
|
|
|
+ * @desc 分页查询
|
|
|
+ * @author zk
|
|
|
+ * @date 2023/9/1
|
|
|
+ **/
|
|
|
+ @PostMapping("/capacity")
|
|
|
+ public HttpResult capacity(@RequestBody HashMap params) throws SystemException {
|
|
|
+ // 设置分页参数
|
|
|
+ PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
|
|
|
+ List<KwfCapacityVo> list = fleetService.capacity(params);
|
|
|
+ PageResult pageResult = PageHelperUtil.getPageResult(new PageInfo<>(list));
|
|
|
+ return HttpResult.ok(pageResult);
|
|
|
}
|
|
|
}
|