|
@@ -81,7 +81,7 @@ public class KwOrderService {
|
|
|
* @Param pageSize:
|
|
* @Param pageSize:
|
|
|
* @return: com.sckw.core.model.page.PageResult
|
|
* @return: com.sckw.core.model.page.PageResult
|
|
|
*/
|
|
*/
|
|
|
- private PageResult getResult(Criteria criteria, int page, int pageSize) {
|
|
|
|
|
|
|
+ public PageResult getResult(Criteria criteria, Integer page, Integer pageSize) {
|
|
|
Query query = new Query();
|
|
Query query = new Query();
|
|
|
query.addCriteria(criteria);
|
|
query.addCriteria(criteria);
|
|
|
long count = mongoTemplate.count(query, SckwTradeOrder.class);
|
|
long count = mongoTemplate.count(query, SckwTradeOrder.class);
|
|
@@ -254,8 +254,20 @@ public class KwOrderService {
|
|
|
* @return: com.sckw.core.model.vo.TableStatisticRes
|
|
* @return: com.sckw.core.model.vo.TableStatisticRes
|
|
|
*/
|
|
*/
|
|
|
public TableStatisticRes tradeOrderStatistic(TradeOrderListStatisticParam params) {
|
|
public TableStatisticRes tradeOrderStatistic(TradeOrderListStatisticParam params) {
|
|
|
- TableStatisticRes res = new TableStatisticRes();
|
|
|
|
|
Criteria criteria = buildCriteria(params, true);
|
|
Criteria criteria = buildCriteria(params, true);
|
|
|
|
|
+ return getTableStatistic(criteria, DictEnum.getEnumsByType(DictTypeEnum.TORDER_STATUS.getType()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @desc: 列表统计
|
|
|
|
|
+ * @author: yzc
|
|
|
|
|
+ * @date: 2023-09-14 14:18
|
|
|
|
|
+ * @Param criteria:
|
|
|
|
|
+ * @Param enums:
|
|
|
|
|
+ * @return: com.sckw.core.model.vo.TableStatisticRes
|
|
|
|
|
+ */
|
|
|
|
|
+ public TableStatisticRes getTableStatistic(Criteria criteria, List<DictEnum> enums) {
|
|
|
|
|
+ TableStatisticRes res = new TableStatisticRes();
|
|
|
Aggregation aggregation = Aggregation.newAggregation(
|
|
Aggregation aggregation = Aggregation.newAggregation(
|
|
|
Aggregation.match(criteria),
|
|
Aggregation.match(criteria),
|
|
|
Aggregation.group("status").count().as("total"),
|
|
Aggregation.group("status").count().as("total"),
|
|
@@ -270,9 +282,8 @@ public class KwOrderService {
|
|
|
(TableTop::getValue, TableTop::getTotal, (k1, k2) -> k2));
|
|
(TableTop::getValue, TableTop::getTotal, (k1, k2) -> k2));
|
|
|
}
|
|
}
|
|
|
List<TableTop> list = new ArrayList<>();
|
|
List<TableTop> list = new ArrayList<>();
|
|
|
- List<DictEnum> tOrderStatusEnums = DictEnum.getEnumsByType(DictTypeEnum.TORDER_STATUS.getType());
|
|
|
|
|
int count = 0;
|
|
int count = 0;
|
|
|
- for (DictEnum e : tOrderStatusEnums) {
|
|
|
|
|
|
|
+ for (DictEnum e : enums) {
|
|
|
Integer value = Integer.valueOf(e.getValue());
|
|
Integer value = Integer.valueOf(e.getValue());
|
|
|
int total = Objects.isNull(map.get(value)) ? 0 : map.get(value);
|
|
int total = Objects.isNull(map.get(value)) ? 0 : map.get(value);
|
|
|
TableTop tableTop = new TableTop();
|
|
TableTop tableTop = new TableTop();
|
|
@@ -282,7 +293,7 @@ public class KwOrderService {
|
|
|
}
|
|
}
|
|
|
TableTop all = new TableTop();
|
|
TableTop all = new TableTop();
|
|
|
all.setName("全部").setTotal(count);
|
|
all.setName("全部").setTotal(count);
|
|
|
- list.add(all);
|
|
|
|
|
|
|
+ list.add(0, all);
|
|
|
TableBottom tableBottom = new TableBottom();
|
|
TableBottom tableBottom = new TableBottom();
|
|
|
tableBottom.setTotal(count);
|
|
tableBottom.setTotal(count);
|
|
|
res.setTableTops(list).setTableBottom(tableBottom);
|
|
res.setTableTops(list).setTableBottom(tableBottom);
|
|
@@ -334,7 +345,6 @@ public class KwOrderService {
|
|
|
* @Param params:
|
|
* @Param params:
|
|
|
* @return: java.util.List<com.sckw.report.service.param.TradeOrderListExport>
|
|
* @return: java.util.List<com.sckw.report.service.param.TradeOrderListExport>
|
|
|
*/
|
|
*/
|
|
|
-
|
|
|
|
|
public List<TradeOrderListExport> export(TradeOrderListExportParam params) {
|
|
public List<TradeOrderListExport> export(TradeOrderListExportParam params) {
|
|
|
Query query = new Query();
|
|
Query query = new Query();
|
|
|
if (StringUtils.isNotBlank(params.getIds())) {
|
|
if (StringUtils.isNotBlank(params.getIds())) {
|
|
@@ -348,6 +358,17 @@ public class KwOrderService {
|
|
|
query.addCriteria(buildCriteria(params, false));
|
|
query.addCriteria(buildCriteria(params, false));
|
|
|
}
|
|
}
|
|
|
query.with(Sort.by(Sort.Order.desc("createTime")));
|
|
query.with(Sort.by(Sort.Order.desc("createTime")));
|
|
|
|
|
+ return getExportResult(query);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @desc: 获取导出结果
|
|
|
|
|
+ * @author: yzc
|
|
|
|
|
+ * @date: 2023-09-14 14:41
|
|
|
|
|
+ * @Param query:
|
|
|
|
|
+ * @return: java.util.List<com.sckw.report.service.param.TradeOrderListExport>
|
|
|
|
|
+ */
|
|
|
|
|
+ public List<TradeOrderListExport> getExportResult(Query query) {
|
|
|
List<SckwTradeOrder> orders = mongoTemplate.find(query, SckwTradeOrder.class);
|
|
List<SckwTradeOrder> orders = mongoTemplate.find(query, SckwTradeOrder.class);
|
|
|
if (CollectionUtils.isEmpty(orders)) {
|
|
if (CollectionUtils.isEmpty(orders)) {
|
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
@@ -438,15 +459,28 @@ public class KwOrderService {
|
|
|
*/
|
|
*/
|
|
|
public PageResult tradeOrderContractList(TradeOrderContractParam params) {
|
|
public PageResult tradeOrderContractList(TradeOrderContractParam params) {
|
|
|
Long entId = LoginUserHolder.getEntId();
|
|
Long entId = LoginUserHolder.getEntId();
|
|
|
- Query query = new Query();
|
|
|
|
|
Criteria criteria = new Criteria();
|
|
Criteria criteria = new Criteria();
|
|
|
String topEnt = Objects.equals(params.getOrderType(), 1) ? "procureTopEntId" : "supplyTopEntId";
|
|
String topEnt = Objects.equals(params.getOrderType(), 1) ? "procureTopEntId" : "supplyTopEntId";
|
|
|
List<Long> ids = StringUtils.splitStrToList(params.getContractIds(), ",", Long.class);
|
|
List<Long> ids = StringUtils.splitStrToList(params.getContractIds(), ",", Long.class);
|
|
|
criteria.and("contractId").in(ids).and(topEnt).is(entId).and("delFlag").is(0);
|
|
criteria.and("contractId").in(ids).and(topEnt).is(entId).and("delFlag").is(0);
|
|
|
|
|
+ return getContractResult(criteria, params.getPage(), params.getPageSize());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @desc: 获取关联合同结果
|
|
|
|
|
+ * @author: yzc
|
|
|
|
|
+ * @date: 2023-09-14 14:58
|
|
|
|
|
+ * @Param criteria:
|
|
|
|
|
+ * @Param page:
|
|
|
|
|
+ * @Param pageSize:
|
|
|
|
|
+ * @return: com.sckw.core.model.page.PageResult
|
|
|
|
|
+ */
|
|
|
|
|
+ public PageResult getContractResult(Criteria criteria, Integer page, Integer pageSize) {
|
|
|
|
|
+ Query query = new Query();
|
|
|
query.addCriteria(criteria);
|
|
query.addCriteria(criteria);
|
|
|
long count = mongoTemplate.count(query, SckwTradeOrder.class);
|
|
long count = mongoTemplate.count(query, SckwTradeOrder.class);
|
|
|
Sort sort = Sort.by(Sort.Direction.DESC, "contractId", "createTime");
|
|
Sort sort = Sort.by(Sort.Direction.DESC, "contractId", "createTime");
|
|
|
- SpringDataPageAble pageAble = new SpringDataPageAble(params.getPage(), params.getPageSize(), sort);
|
|
|
|
|
|
|
+ SpringDataPageAble pageAble = new SpringDataPageAble(page, pageSize, sort);
|
|
|
query.with(pageAble);
|
|
query.with(pageAble);
|
|
|
List<SckwTradeOrder> list = mongoTemplate.find(query, SckwTradeOrder.class);
|
|
List<SckwTradeOrder> list = mongoTemplate.find(query, SckwTradeOrder.class);
|
|
|
List<OrderListRes> result = new ArrayList<>();
|
|
List<OrderListRes> result = new ArrayList<>();
|
|
@@ -469,6 +503,6 @@ public class KwOrderService {
|
|
|
.setSourceLabel(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()));
|
|
.setSourceLabel(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()));
|
|
|
result.add(order);
|
|
result.add(order);
|
|
|
});
|
|
});
|
|
|
- return PageResult.build(params.getPage(), params.getPageSize(), count, result);
|
|
|
|
|
|
|
+ return PageResult.build(page, pageSize, count, result);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|