| | |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.model.LoginUserInfo; |
| | | import com.ruoyi.worker.entity.Evaluate; |
| | | import com.ruoyi.worker.entity.MasterWorker; |
| | | import com.ruoyi.worker.entity.Order; |
| | | import com.ruoyi.worker.entity.ServeRecord; |
| | | import com.ruoyi.worker.entity.*; |
| | | import com.ruoyi.worker.request.OrderSubmitRequest; |
| | | import com.ruoyi.worker.service.EvaluateService; |
| | | import com.ruoyi.worker.service.MasterWorkerService; |
| | | import com.ruoyi.worker.service.OrderService; |
| | | import com.ruoyi.worker.service.ServeRecordService; |
| | | import com.ruoyi.worker.service.*; |
| | | import com.ruoyi.worker.vo.OrderDetailVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | private ServeRecordService serveRecordService; |
| | | @Resource |
| | | private EvaluateService evaluateService; |
| | | @Resource |
| | | private SysServeCoordinateService serveCoordinateService; |
| | | |
| | | /** |
| | | * 师傅端-获取订单列表 |
| | |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "改派原因", name = "reason", dataType = "String", required = true) |
| | | }) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<String> applyChange(@RequestParam Integer orderId, @RequestParam String reason) { |
| | | LoginUserInfo loginWorker = tokenService.getLoginUserByWorker(); |
| | | if (null == loginWorker) { |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "orderId", name = "orderId", dataType = "Integer", required = true) |
| | | }) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> reachPosition(@RequestParam Integer orderId) { |
| | | LoginUserInfo loginWorker = tokenService.getLoginUserByWorker(); |
| | | if (null == loginWorker) { |
| | |
| | | if (null == order) { |
| | | throw new GlobalException("请确认当前订单所派单师傅是否是您!"); |
| | | } |
| | | order.setState(Constants.THREE); |
| | | // 待完工状态 |
| | | order.setState(Constants.TWO); |
| | | order.setArriveTime(new Date()); |
| | | return R.ok(orderService.updateById(order)); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "订单详情", tags = {"师傅端-订单列表"}) |
| | | @GetMapping(value = "/orderDetail") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "orderId", name = "orderId", dataType = "Integer", required = true) |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "Integer", required = true) |
| | | }) |
| | | public R<OrderDetailVO> orderDetail(@RequestParam Integer orderId) { |
| | | // 订单信息 |
| | |
| | | */ |
| | | @ApiOperation(value = "订单完工-提交订单", tags = {"师傅端-订单列表"}) |
| | | @PostMapping(value = "/orderSubmit") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> orderSubmit(@RequestBody OrderSubmitRequest orderSubmitRequest) { |
| | | // 订单信息 |
| | | Order order = orderService.lambdaQuery().eq(Order::getId, orderSubmitRequest.getOrderId()) |
| | |
| | | return R.ok(update && save); |
| | | } |
| | | |
| | | /** |
| | | * 师傅端-定时调度记录师傅所走路线经纬度 |
| | | * |
| | | * @param orderId 订单id |
| | | * @param longitude 经度 |
| | | * @param latitude 纬度 |
| | | */ |
| | | @ApiOperation(value = "订单进行-记录路线经纬度", tags = {"师傅端-订单列表"}) |
| | | @GetMapping(value = "/coordinate") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "经度", name = "longitude", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "纬度", name = "latitude", dataType = "Integer", required = true) |
| | | }) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> coordinate(@RequestParam Integer orderId, @RequestParam Double longitude, |
| | | @RequestParam Double latitude) { |
| | | LoginUserInfo loginWorker = tokenService.getLoginUserByWorker(); |
| | | if (null == loginWorker) { |
| | | return R.loginExpire("登录失效!"); |
| | | } |
| | | SysServeCoordinate sysServeCoordinate = new SysServeCoordinate(); |
| | | sysServeCoordinate.setWorkerId(loginWorker.getUserid()); |
| | | sysServeCoordinate.setOrderId(orderId); |
| | | sysServeCoordinate.setCoordinate(longitude + "," + latitude); |
| | | sysServeCoordinate.setLongitude(BigDecimal.valueOf(longitude)); |
| | | sysServeCoordinate.setLatitude(BigDecimal.valueOf(latitude)); |
| | | return R.ok(serveCoordinateService.save(sysServeCoordinate)); |
| | | } |
| | | |
| | | } |