From 428519bd1056dd90cd4589dbf85b380e403ff254 Mon Sep 17 00:00:00 2001 From: hjl <1657978663@qq.com> Date: 星期五, 05 七月 2024 18:13:08 +0800 Subject: [PATCH] feat: 代码初始化、腾讯云短信SDK --- ruoyi-service/ruoyi-worker/src/main/java/com/ruoyi/worker/controller/OrderController.java | 53 +++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 43 insertions(+), 10 deletions(-) diff --git a/ruoyi-service/ruoyi-worker/src/main/java/com/ruoyi/worker/controller/OrderController.java b/ruoyi-service/ruoyi-worker/src/main/java/com/ruoyi/worker/controller/OrderController.java index 2ed177b..db2b943 100644 --- a/ruoyi-service/ruoyi-worker/src/main/java/com/ruoyi/worker/controller/OrderController.java +++ b/ruoyi-service/ruoyi-worker/src/main/java/com/ruoyi/worker/controller/OrderController.java @@ -9,23 +9,19 @@ 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; @@ -54,6 +50,8 @@ private ServeRecordService serveRecordService; @Resource private EvaluateService evaluateService; + @Resource + private SysServeCoordinateService serveCoordinateService; /** * 师傅端-获取订单列表 @@ -84,6 +82,7 @@ @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) { @@ -157,6 +156,7 @@ @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) { @@ -167,7 +167,9 @@ if (null == order) { throw new GlobalException("请确认当前订单所派单师傅是否是您!"); } - order.setState(Constants.THREE); + // 待完工状态 + order.setState(Constants.TWO); + order.setArriveTime(new Date()); return R.ok(orderService.updateById(order)); } @@ -179,7 +181,7 @@ @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) { // 订单信息 @@ -199,6 +201,7 @@ */ @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()) @@ -218,4 +221,34 @@ 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)); + } + } -- Gitblit v1.7.1