| | |
| | | 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 |
| | |
| | | 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); |
| | |
| | | @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<>(); |
| | |
| | | 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); |
| | |
| | | @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<>(); |
| | |
| | | @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<>(); |
| | |
| | | map.put("orderByExecuteList",orderByExecuteList); |
| | | return new ResultUtil<Object>().setData(map); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |