From 4745238280ae22f373802470844c66cbcdbf4458 Mon Sep 17 00:00:00 2001
From: xuefei <564615061@qq.com>
Date: 星期二, 22 十二月 2020 15:17:51 +0800
Subject: [PATCH] 新接口修改
---
platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java | 119 ++++++++++++++++++++++++++++++++---------------------------
1 files changed, 65 insertions(+), 54 deletions(-)
diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java
index bd854c8..4797f6f 100644
--- a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java
+++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java
@@ -1,38 +1,34 @@
package cn.cetc54.platform.zhyl.api;
-import cn.cetc54.platform.core.common.utils.PageUtil;
import cn.cetc54.platform.core.common.utils.ResultUtil;
-import cn.cetc54.platform.core.common.vo.PageVo;
import cn.cetc54.platform.core.common.vo.Result;
import cn.cetc54.platform.zhyl.entity.*;
import cn.cetc54.platform.zhyl.entity.vo.FwjgCount;
import cn.cetc54.platform.zhyl.entity.vo.FwnlAndOrderCount;
import cn.cetc54.platform.zhyl.entity.vo.OrderByExecute;
import cn.cetc54.platform.zhyl.service.*;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import javafx.collections.ObservableList;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
-import java.sql.Wrapper;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@RestController
@Api(description = "鏈嶅姟鏈烘瀯椤甸潰鎺ュ彛")
-@RequestMapping("/api/fwjg")
+@RequestMapping("/api2/fwjg")
@Transactional
+@CrossOrigin("*")
public class FwjgController {
- @Autowired
- private IAreaService iAreaService;
@Autowired
private IOrgFuwuService iOrgFuwuService;
@Autowired
@@ -43,30 +39,38 @@
private IFuwuDetailsService iFuwuDetailsService;
- @RequestMapping(value = "/getByPage", method = RequestMethod.GET)
- @ApiOperation(value = "鍒嗛〉鑾峰彇鎵�鏈�")
- public Result<IPage<Area>> getByPage(PageVo page){
-
- IPage<Area> data = iAreaService.page(PageUtil.initMpPage(page));
- return new ResultUtil<IPage<Area>>().setData(data);
- }
-
@RequestMapping(value = "/getCountByAreaId", method = RequestMethod.GET)
@ApiOperation(value = "鏍规嵁鍖哄煙id鑾峰彇鍖哄煙涓嬫墍鏈夋満鏋勫拰浜哄憳鏁伴噺浠ュ強璁㈠崟鎬绘暟")
public Result<Object> getCountByAreaId(String areaId){
+ if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){
+ //濡傛灉鏄叏甯� areaId璁剧疆鏈┖
+ areaId = null;
+ }
QueryWrapper<OrgFuwu> wrapper = new QueryWrapper<>();
- wrapper.eq("area_id",areaId);
+ if (StrUtil.isNotEmpty(areaId)){
+ wrapper.eq("area_id",areaId);
+ }
int orgFuwuCount = iOrgFuwuService.count(wrapper);
+
QueryWrapper<FuwuPerson> wrapper1 = new QueryWrapper<>();
- wrapper1.eq("area_id",areaId);
+ if (StrUtil.isNotEmpty(areaId)){
+ wrapper1.eq("area_id",areaId);
+ }
int fuwuPersonCount = iFuwuPersonService.count(wrapper1);
+
QueryWrapper<Order> wrapper2 = new QueryWrapper<>();
- wrapper2.eq("area_id",areaId);
+ if (StrUtil.isNotEmpty(areaId)){
+ wrapper2.eq("area_id",areaId);
+ }
int orderCount = iOrderService.count(wrapper2);
+
QueryWrapper<Order> wrapper3 = new QueryWrapper<>();
- wrapper2.eq("area_id",areaId);
- wrapper2.eq("state",0);
+ if (StrUtil.isNotEmpty(areaId)){
+ wrapper3.eq("area_id",areaId);
+ }
+ wrapper3.eq("state",0);
int orderCount2 = iOrderService.count(wrapper3);
+
FwjgCount fwjgCount=new FwjgCount();
fwjgCount.setFwjgCount(orgFuwuCount);
fwjgCount.setFwPersonCount(fuwuPersonCount);
@@ -78,9 +82,14 @@
@RequestMapping(value = "/getFwnlByAreaId", method = RequestMethod.GET)
@ApiOperation(value = "鏍规嵁鍖哄煙id鑾峰彇鍖哄煙涓嬫墍鏈夊疄闄呮湇鍔′互鍙婃湇鍔¤鍗曟暟")
public Result<Object> getFwnlByAreaId(String areaId){
+ if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){
+ //濡傛灉鏄叏甯� areaId璁剧疆鏈┖
+ areaId = null;
+ }
QueryWrapper<FuwuDetails> wrapper = new QueryWrapper<>();
wrapper.isNull("pid");
List<FuwuDetails> list = iFuwuDetailsService.list(wrapper);
+
List<FwnlAndOrderCount> fwnlAndOrderCountList=new ArrayList<>();
for (FuwuDetails fuwuDetails : list) {
QueryWrapper<FuwuDetails> wrapper1 = new QueryWrapper<>();
@@ -88,7 +97,9 @@
List<FuwuDetails> list1 = iFuwuDetailsService.list(wrapper1);
for (FuwuDetails details : list1) {
QueryWrapper<Order> wrapper2 = new QueryWrapper<>();
- wrapper2.eq("area_id",areaId);
+ if (StrUtil.isNotBlank(areaId)){
+ wrapper2.eq("area_id",areaId);
+ }
wrapper2.eq("detail_id",details.getId());
int count = iOrderService.count(wrapper2);
details.setOrderNumber(count);
@@ -104,60 +115,64 @@
@RequestMapping(value = "/getFwjgOrderByOrderNumber", method = RequestMethod.GET)
@ApiOperation(value = "鏍规嵁鍖哄煙id鍜岃鍗曢噺鏌ヨ鏈嶅姟鏈烘瀯鎺掑悕鎯呭喌")
public Result<Object> getFwjgOrderByOrderNumber(String areaId){
+ if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){
+ //濡傛灉鏄叏甯� areaId璁剧疆鏈┖
+ areaId = null;
+ }
QueryWrapper<OrgFuwu> wrapper = new QueryWrapper<>();
- wrapper.eq("area_id",areaId);
+ if (StrUtil.isNotEmpty(areaId)){
+ wrapper.eq("area_id",areaId);
+ }
List<OrgFuwu> list = iOrgFuwuService.list(wrapper);
for (OrgFuwu orgFuwu : list) {
- QueryWrapper<FuwuDetails> wrapper1 = new QueryWrapper<>();
- wrapper1.isNull("pid");
- wrapper1.eq("org_fw_id",orgFuwu.getId());
- List<FuwuDetails> list1 = iFuwuDetailsService.list(wrapper1);
- int orgFuwuCount=0;
- for (FuwuDetails fuwuDetails : list1) {
- QueryWrapper<FuwuDetails> wrapper2 = new QueryWrapper<>();
- wrapper2.eq("pid",fuwuDetails.getId());
- List<FuwuDetails> list2 = iFuwuDetailsService.list(wrapper2);
- int fuwuDetailsCount=0;
- for (FuwuDetails details : list2) {
- QueryWrapper<Order> wrapper3 = new QueryWrapper<>();
- wrapper3.eq("area_id",areaId);
- wrapper3.eq("detail_id",details.getId());
- int count = iOrderService.count(wrapper3);
- fuwuDetailsCount+=count;
- }
- orgFuwuCount+=fuwuDetailsCount;
- }
- orgFuwu.setOrderNumber(orgFuwuCount);
+ orgFuwu.setOrderNumber(iOrderService.getOrderNum(orgFuwu.getId()));
}
- List<OrgFuwu> collectList = list.stream().sorted(Comparator.comparing(OrgFuwu::getOrderNumber)).collect(Collectors.toList());
- return new ResultUtil<Object>().setData(collectList.subList(0,10));
+ List<OrgFuwu> collectList = list.stream().sorted(Comparator.comparing(OrgFuwu::getOrderNumber).reversed()).collect(Collectors.toList());
+ List<OrgFuwu> resList = collectList.size()>10?collectList.subList(0,10):collectList;
+ return new ResultUtil<Object>().setData(resList);
}
@RequestMapping(value = "/getFuwuDetailsOrderByOrderNumber", method = RequestMethod.GET)
@ApiOperation(value = "鏍规嵁鍖哄煙id鍜岃鍗曢噺鏌ヨ瀹為檯鏈嶅姟鎺掑悕鎯呭喌")
public Result<Object> getFuwuDetailsOrderByOrderNumber(String areaId){
+ if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){
+ //濡傛灉鏄叏甯� areaId璁剧疆鏈┖
+ areaId = null;
+ }
QueryWrapper<FuwuDetails> wrapper = new QueryWrapper<>();
wrapper.isNotNull("pid");
wrapper.eq("del_flag",0);
List<FuwuDetails> list = iFuwuDetailsService.list(wrapper);
for (FuwuDetails fuwuDetails : list) {
QueryWrapper<Order> wrapper3 = new QueryWrapper<>();
- wrapper3.eq("area_id",areaId);
+ if (StrUtil.isNotBlank(areaId)){
+ wrapper3.eq("area_id",areaId);
+ }
wrapper3.eq("detail_id",fuwuDetails.getId());
int count = iOrderService.count(wrapper3);
fuwuDetails.setOrderNumber(count);
}
- List<FuwuDetails> collectList = list.stream().sorted(Comparator.comparing(FuwuDetails::getOrderNumber)).collect(Collectors.toList());
- return new ResultUtil<Object>().setData(collectList.subList(0,10));
+ List<FuwuDetails> collectList = list.stream().sorted(Comparator.comparing(FuwuDetails::getOrderNumber).reversed()).collect(Collectors.toList());
+ List<FuwuDetails> resList = collectList.size()>10?collectList.subList(0,10):collectList;
+ return ResultUtil.data(resList);
}
@RequestMapping(value = "/getOrder", method = RequestMethod.GET)
@ApiOperation(value = "鎵ц涓鍗�")
public Result<Object> getOrder(String areaId){
+ if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){
+ //濡傛灉鏄叏甯� areaId璁剧疆鏈┖
+ areaId = null;
+ }
QueryWrapper<Order> wrapper = new QueryWrapper<>();
- wrapper.eq("area_id",areaId);
+ if (StrUtil.isNotBlank(areaId)){
+ wrapper.eq("area_id",areaId);
+ }
+
wrapper.eq("state",0);
- wrapper.orderByAsc("creat_time");
+
+ wrapper.orderByDesc("create_time");
+ wrapper.last(" limit 10");
List<Order> list = iOrderService.list(wrapper);
int count = iOrderService.count(wrapper);
List<OrderByExecute> orderByExecuteList=new ArrayList<>();
@@ -175,8 +190,4 @@
map.put("orderByExecuteList",orderByExecuteList);
return new ResultUtil<Object>().setData(map);
}
-
-
-
-
}
--
Gitblit v1.9.1