| | |
| | | import com.ruoyi.admin.utils.AddressDto; |
| | | import com.ruoyi.admin.utils.DescribeInstances; |
| | | import com.ruoyi.admin.utils.OcrBase; |
| | | import com.ruoyi.admin.vo.OrderByServeRecordVO; |
| | | import com.ruoyi.admin.vo.OrderDetailVO; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | |
| | | import com.ruoyi.common.core.utils.GaoDeMapUtil; |
| | | import com.ruoyi.common.core.utils.SnowflakeIdWorker; |
| | | import com.ruoyi.common.core.vo.CityInfoVO; |
| | | import com.ruoyi.common.core.vo.PaperInVo; |
| | | import com.ruoyi.common.core.vo.PrintDto; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Paths; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | |
| | | @ApiImplicitParam(value = "改派原因", name = "applyReason", dataType = "String") |
| | | }) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<String> reassignment(@RequestParam Integer type, @RequestParam String orderId, |
| | | public R<String> reassignment(@RequestParam Integer type, @RequestParam String orderIds, |
| | | @RequestParam Integer workerId, String applyReason) { |
| | | String[] split = orderIds.split(","); |
| | | for (String orderId : split) { |
| | | |
| | | MasterWorker masterWorker = masterWorkerService.lambdaQuery() |
| | | .eq(MasterWorker::getId, workerId) |
| | | .eq(MasterWorker::getIsDelete, 0).one(); |
| | |
| | | // } catch (IOException e) { |
| | | // return R.fail("订单推送失败!"); |
| | | // } |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | return R.ok() ; |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.ok(data); |
| | | } |
| | | |
| | | @ApiOperation(value = "打印计数", tags = {"后台-订单管理"}) |
| | | @PostMapping(value = "/print") |
| | | public R print(@RequestParam Long id) { |
| | | |
| | | orderClient.count(String.valueOf(id)); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "打印入库单子", tags = {"后台-订单管理"}) |
| | | @PostMapping(value = "/paperCount") |
| | | public R paperCount(@RequestParam Integer id,@RequestParam String date) { |
| | | R<List<PaperInVo>> papercount = orderClient.papercount(String.valueOf(id),date); |
| | | for (PaperInVo datum : papercount.getData()) { |
| | | datum.setName(recoveryServeService.getById(datum.getServeId()).getServeName()); |
| | | } |
| | | PrintDto printDto =new PrintDto(); |
| | | printDto.setName(masterWorkerService.getById(id).getRealName()); |
| | | printDto.setPapers(papercount.getData()); |
| | | printDto.setDate(date); |
| | | return R.ok(printDto); |
| | | } |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | @ApiOperation(value = "地图统计", tags = {"后台-订单管理-地图统计"}) |
| | | @PostMapping(value = "/map/works") |
| | | public R<List<MasterWorker>> map(String cityCode) { |
| | | |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (null == loginUser) { |
| | | return R.loginExpire("登录失效!"); |
| | | } |
| | | if (cityCode==null) { |
| | | if (loginUser.getIsFranchisee()) { |
| | | cityCode = loginUser.getCityList().get(0); |
| | | } else { |
| | | cityCode = "420100"; |
| | | } |
| | | } |
| | | Set<Integer> workIds = redisService.getCacheSet("workerLocation:" + cityCode+":"); |
| | | if (workIds==null||workIds.isEmpty()){ |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | List<MasterWorker> list = masterWorkerService.lambdaQuery().in(MasterWorker::getId, workIds).list(); |
| | | for (MasterWorker masterWorker : list) { |
| | | masterWorker.setLacation(redisService.getCacheObject("work:"+masterWorker.getId()+":")); |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "获师傅", tags = {"后台-订单管理-地图统计"}) |
| | | @PostMapping(value = "/map/line") |
| | | public R<List<OrderByServeRecordVO>> line(Integer id) { |
| | | R<List<Order>> workday = orderClient.workday(id); |
| | | System.out.println(workday.getData()); |
| | | List<OrderByServeRecordVO> list = new ArrayList<>(); |
| | | for (Order datum : workday.getData()) { |
| | | OrderByServeRecordVO orderByServeRecord = new OrderByServeRecordVO(); |
| | | |
| | | // String masterFolderPath = "/usr/local/coordinate/" + datum.getServerId(); |
| | | // File masterFolder = new File(masterFolderPath); |
| | | // 检查师傅ID的文件夹是否存在,存在就读取轨迹数据 |
| | | // System.out.println("文件是否存在:" + masterFolder.exists()); |
| | | // if (masterFolder.exists()) { |
| | | // 检查订单ID的JSON文件是否存在,不存在则创建 |
| | | // String jsonFilePath = masterFolderPath + "/" + datum.getId() + ".json"; |
| | | String jsonFilePath = "C:\\Users\\Admin\\Desktop\\1814257493315514369.json"; |
| | | File jsonFile = new File(jsonFilePath); |
| | | System.out.println("订单Json文件是否存在:" + jsonFile.exists()); |
| | | if (jsonFile.exists()) { |
| | | try { |
| | | String jsonContent = new String(Files.readAllBytes(Paths.get(jsonFilePath))); |
| | | System.out.println("JSON 文件内容:" + jsonContent); |
| | | List<com.alibaba.fastjson2.JSONObject> coordinate = com.alibaba.fastjson2.JSONObject.parseObject(jsonContent, List.class); |
| | | List<String> coordinateList = new ArrayList<>(); |
| | | if (null != coordinate) { |
| | | for (com.alibaba.fastjson2.JSONObject jsonObject : coordinate) { |
| | | Object s = jsonObject.get("coordinate"); |
| | | coordinateList.add(String.valueOf(s)); |
| | | } |
| | | orderByServeRecord.setCoordinate(coordinateList); |
| | | } |
| | | } catch (IOException e) { |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | // } |
| | | } |
| | | list.add(orderByServeRecord); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @Resource |
| | | private RegionService regionService; |
| | | |
| | | @ApiOperation(value = "获取城市名字", tags = {"后台-订单管理-地图统计"}) |
| | | @PostMapping(value = "/map/cityName") |
| | | public R line(String cityCode) { |
| | | Region one = regionService.lambdaQuery().eq(Region::getCode, cityCode).one(); |
| | | return R.ok(one.getName(),""); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // @ApiOperation(value = "获取司机的订单路线", tags = {"后台-订单管理-地图统计"}) |
| | | // @PostMapping(value = "/map/works/line") |
| | | // public R<List<MasterWorker>> map(@RequestParam Integer workId) { |
| | | // |
| | | // |
| | | // return R.ok(list); |
| | | // } |
| | | |
| | | |
| | | |
| | | } |