| | |
| | | import cn.exrick.xboot.core.common.utils.ResultUtil; |
| | | import cn.exrick.xboot.core.common.vo.PageVo; |
| | | import cn.exrick.xboot.core.common.vo.Result; |
| | | import cn.exrick.xboot.your.entity.Car; |
| | | import cn.exrick.xboot.your.entity.EventLog; |
| | | import cn.exrick.xboot.your.entity.OrderTask; |
| | | import cn.exrick.xboot.your.service.ICarService; |
| | | import cn.exrick.xboot.your.service.IEventLogService; |
| | | import cn.exrick.xboot.your.service.IOrderTaskService; |
| | | import cn.exrick.xboot.your.entity.*; |
| | | import cn.exrick.xboot.your.service.*; |
| | | import cn.exrick.xboot.your.util.HaiKangPost; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | @Autowired |
| | | private ICarService iCarService; |
| | | |
| | | @Autowired |
| | | private HaiKangPost haiKangPost; |
| | | |
| | | @Autowired |
| | | private IAreaService iAreaService; |
| | | |
| | | @Autowired |
| | | private IAreaSectionService iAreaSectionService; |
| | | |
| | | @RequestMapping(value = "/getIndex1", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取首页数据") |
| | |
| | | return new ResultUtil<Object>().setData(data.getRecords()); |
| | | } |
| | | |
| | | // @RequestMapping(value = "/getCars", method = RequestMethod.GET) |
| | | // @ApiOperation(value = "获取车辆信息") |
| | | // public Result<Object> getCars() { |
| | | // List<Car> list = iCarService.list(); |
| | | // String codes[] = new String[list.size()]; |
| | | // |
| | | // HaiKangPost.findLatestGps() |
| | | // return new ResultUtil<Object>().setData(data.getRecords()); |
| | | // } |
| | | @RequestMapping(value = "/getCars", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取车辆定位信息") |
| | | public Result<Object> getCars() { |
| | | List<Car> list = iCarService.list(); |
| | | String codes[] = new String[list.size()]; |
| | | |
| | | for(int i=0;i<list.size();i++){ |
| | | codes[i] = list.get(i).getCode(); |
| | | } |
| | | String latestGps = haiKangPost.findLatestGps(codes); |
| | | return new ResultUtil<Object>().setData(JSONUtil.parseObj(latestGps)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getAnalysis", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取配送分析") |
| | | public Result<Object> getAnalysis() { |
| | | List<Area> list = iAreaService.list2(); |
| | | for(Area area:list){ |
| | | double sum = 0; |
| | | int flag = 0; |
| | | for(AreaSection areaSection: area.getChildren()){ |
| | | sum+=areaSection.getStability(); |
| | | flag++; |
| | | } |
| | | if(flag>0){ |
| | | double v = sum / flag; |
| | | area.setVariance(trans2(v)); |
| | | } |
| | | } |
| | | return new ResultUtil<Object>().setData(list); |
| | | } |
| | | |
| | | public double trans2(double v2){ |
| | | return (double) Math.round(v2 * 100) / 100; |
| | | } |
| | | } |