From 59380c11771d47459b8db5425bc21293823ada74 Mon Sep 17 00:00:00 2001 From: xuefei <564615061@qq.com> Date: 星期日, 13 十二月 2020 10:26:00 +0800 Subject: [PATCH] areaId参数的转换 --- platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java | 88 +++++++++++++++++++++++++++++-------------- 1 files changed, 59 insertions(+), 29 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..86d24d0 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 @@ -9,30 +9,29 @@ 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 +42,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 +85,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 +100,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,8 +118,14 @@ @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<>(); @@ -136,28 +156,42 @@ @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> 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); - wrapper.eq("state",0); - wrapper.orderByAsc("creat_time"); + if (StrUtil.isNotBlank(areaId)){ + wrapper.eq("area_id",areaId); + } + +// wrapper.eq("state",0); + wrapper.orderByAsc("create_time"); List<Order> list = iOrderService.list(wrapper); int count = iOrderService.count(wrapper); List<OrderByExecute> orderByExecuteList=new ArrayList<>(); @@ -175,8 +209,4 @@ map.put("orderByExecuteList",orderByExecuteList); return new ResultUtil<Object>().setData(map); } - - - - } -- Gitblit v1.9.1