| | |
| | | import cn.afterturn.easypoi.cache.manager.IFileLoader; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.admin.api.feignClient.AdminClient; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.Result; |
| | |
| | | import com.ruoyi.order.api.feignClient.ExchangeDispatchClient; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.system.api.model.LoginUserInfo; |
| | | import com.ruoyi.worker.entity.IamConfig; |
| | | import com.ruoyi.worker.entity.MasterWorker; |
| | | import com.ruoyi.worker.entity.RecoveryServe; |
| | | import com.ruoyi.worker.service.IamConfigService; |
| | | import com.ruoyi.worker.service.MasterWorkerService; |
| | | import com.ruoyi.worker.service.RecoveryServeService; |
| | | import com.ruoyi.worker.vo.ServeCoordinate; |
| | | import com.ruoyi.worker.voice.util.AXBUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | |
| | | import lombok.Synchronized; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | @Resource |
| | | private IamConfigService iamConfigService; |
| | | |
| | | /** |
| | | * linux服务器保存订单轨迹文件夹 |
| | |
| | | * |
| | | * @param state 订单状态(0:全部、1:待上门、2:已完结) |
| | | */ |
| | | @ApiOperation(value = "订单列表", tags = {"师傅端-订单列表"}) |
| | | @ApiOperation(value = "订单列表", tags = {"师傅端-订单列表[2.0]"}) |
| | | @GetMapping(value = "/orderList") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单状态(0:全部、1:待上门、2:已完结)", name = "state", dataType = "Integer", required = true) |
| | | @ApiImplicitParam(value = "订单状态(0:全部、1:待上门、2:已完结、7:待预约)", name = "state", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "姓名,电话,地址搜索", name = "searchValues", dataType = "String", required = false), |
| | | }) |
| | | public R<Page<Order>> orderList(@RequestParam Integer state, |
| | | @RequestParam String searchValues, |
| | | @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | LoginUserInfo loginWorker = tokenService.getLoginUserByWorker(); |
| | | if (null == loginWorker) { |
| | | return R.loginExpire("登录失效!"); |
| | | } |
| | | Page<Order> dataList = orderClient.orderListWorker(loginWorker.getUserid(), state, pageNum, pageSize).getData(); |
| | | Page<Order> dataList = orderClient.orderListWorker(loginWorker.getUserid(), state,searchValues, pageNum, pageSize).getData(); |
| | | List<Order> orderList = dataList.getRecords(); |
| | | List<Integer> ids = orderList.stream().map(Order::getServeId).collect(Collectors.toList()); |
| | | if (!ids.isEmpty()) { |
| | |
| | | if (null == loginWorker) { |
| | | return R.loginExpire("登录失效!"); |
| | | } |
| | | return orderClient.orderSubmit(orderSubmitRequest); |
| | | R<String> result = orderClient.orderSubmit(orderSubmitRequest); |
| | | String subscriptionId = result.getData(); |
| | | boolean flag = false; |
| | | if (StringUtils.hasLength(subscriptionId)) { |
| | | IamConfig iamConfig = iamConfigService.getById(1); |
| | | // 查询音频链接 |
| | | OrderDetailVO data = orderClient.orderDetail(orderSubmitRequest.getOrderId()).getData(); |
| | | if(Objects.nonNull(data)){ |
| | | Order orderInfo = data.getOrderInfo(); |
| | | if (Objects.nonNull(orderInfo) && Objects.nonNull(orderInfo.getIsOpenVirtualNumber()) && orderInfo.getIsOpenVirtualNumber() == 1){ |
| | | String recordDomain = orderInfo.getRecordDomain(); |
| | | String recordObjectName = orderInfo.getRecordObjectName(); |
| | | String audioUrl = AXBUtil.axbGetRecordDownloadLink(iamConfig.getAppKey(), iamConfig.getAppSecret(),recordDomain, recordObjectName); |
| | | orderInfo.setPhoneRecording(audioUrl); |
| | | // 设置音频 |
| | | orderClient.updatePhoneRecording(orderInfo.getId(), audioUrl); |
| | | // 虚拟号码解绑 |
| | | AXBUtil.axbUnbindNumber(iamConfig.getAppKey(), iamConfig.getAppSecret(),subscriptionId, iamConfig.getVirtualNumber()); |
| | | } |
| | | } |
| | | flag = true; |
| | | } |
| | | return R.ok(flag); |
| | | } |
| | | private static final double EARTH_RADIUS_METERS = 6371000.0; |
| | | /** |
| | |
| | | // 读取订单ID的JSON文件内容 |
| | | try { |
| | | String jsonContent = new String(Files.readAllBytes(Paths.get(jsonFilePath))); |
| | | System.out.println("JSON 文件内容:" + jsonContent); |
| | | List<ServeCoordinate> coordinate = JSONObject.parseObject(jsonContent, List.class); |
| | | // 订单轨迹信息 |
| | | ServeCoordinate data = new ServeCoordinate(); |
| | |
| | | String nowStr = now.format(formatter); |
| | | |
| | | |
| | | redisService.setCacheObject("MARK:"+workerId+":"+nowStr,longitude + "," + latitude); |
| | | redisService.setCacheObject("MARK:"+workerId+":"+nowStr,longitude + "," + latitude, 10L, TimeUnit.MINUTES); |
| | | |
| | | String cacheObject = redisService.getCacheObject("MARK:" + workerId + ":" + formattedTime); |
| | | if (cacheObject!=null){ |
| | |
| | | System.err.println("-----当前距离"+distance); |
| | | //如果超出一定范围,存入Mark文件 |
| | | if (distance<50){ |
| | | redisService.setCacheObject("TIME:"+workerId,LocalDateTime.now()); |
| | | redisService.setCacheObject("TIME:"+workerId,LocalDateTime.now(), 10L, TimeUnit.MINUTES); |
| | | marker(longitude,latitude); |
| | | } |
| | | } |
| | |
| | | // 读取订单ID的JSON文件内容 |
| | | try { |
| | | String jsonContent = new String(Files.readAllBytes(Paths.get(jsonFilePath))); |
| | | System.out.println("JSON 文件内容:" + jsonContent); |
| | | List<ServeCoordinate> coordinate = JSONObject.parseObject(jsonContent, List.class); |
| | | // 订单轨迹信息 |
| | | ServeCoordinate data = new ServeCoordinate(); |
| | |
| | | // |
| | | // } |
| | | |
| | | @ApiOperation(value = "上传经纬度", tags = {"师傅端-首页"}) |
| | | @ApiOperation(value = "上传经纬度", tags = {"师傅端-首页[2.0]"}) |
| | | @GetMapping(value = "/putLocation") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "workId", name = "workId", dataType = "int", required = true), |
| | |
| | | public R<Object> orderNavigation(@RequestParam Integer workId, @RequestParam String longitude, |
| | | @RequestParam String latitude) { |
| | | Result<String> address = GaoDeMapUtil.getCityCode(longitude, latitude); |
| | | System.err.println(address.getDatas()); |
| | | String cityCode = address.getDatas(); |
| | | System.err.println("城市code"+cityCode); |
| | | String provinceCode = cityCode.substring(0, 2) + "0000"; |
| | | System.err.println("省份code"+provinceCode); |
| | | Set<Integer> strings = new HashSet<>(); |
| | | strings.add(workId); |
| | | redisService.setCacheSet("workerLocation:"+address.getDatas()+":", strings); |
| | | redisService.setCacheSet("workerLocation:"+cityCode+":", strings); |
| | | redisService.setCacheSet("workerLocation:"+provinceCode+":", strings); |
| | | redisService.setCacheObject("work:"+workId+":", longitude+","+latitude); |
| | | masterWorkerService.lambdaUpdate() |
| | | .set(MasterWorker::getWorkerLon, longitude) |
| | | .set(MasterWorker::getWorkerLat, latitude) |
| | | .eq(MasterWorker::getId, workId) |
| | | .eq(MasterWorker::getIsDelete, 0).update(); |
| | | return R.ok(); |
| | | |
| | | } |