202506171818

This commit is contained in:
张潘 2025-06-17 18:18:16 +08:00
parent f495c1655f
commit 0a8cfe078b
8 changed files with 197 additions and 18 deletions

View File

@ -4652,16 +4652,32 @@ public class AppletController extends BaseController {
order.setReceiveTime(new Date()); order.setReceiveTime(new Date());
order.setIsAccept(1); // 1:已接单 order.setIsAccept(1); // 1:已接单
order.setJsonStatus(2); // 服务进度2=接单 order.setJsonStatus(2); // 服务进度2=接单
order.setStatus(2l);
order.setLogStatus(9); order.setLogStatus(9);
JSONObject json=new JSONObject(); JSONObject json=new JSONObject();
json.put("type",1); json.put("type",1);
order.setLogJson(json.toJSONString()); order.setLogJson(json.toJSONString());
orderService.updateOrder(order);
//绑定号码
// 5. 写入日志 // 5. 写入日志
OrderUtil orderUtil = new OrderUtil(); OrderLog orderLog=new OrderLog();
orderUtil.SaveOrderLog(order); orderLog.setOid(order.getId());
orderLog.setOrderId(order.getOrderId());
orderLog.setTitle("师傅接单");
orderLog.setType(new BigDecimal(2.0));
JSONObject js=new JSONObject();
js.put("type", 1);
orderLog.setContent(js.toJSONString());
orderLog.setWorkerId(order.getWorkerId());
orderLog.setWorkerLogId(order.getWorkerId());
orderLogService.insertOrderLog(orderLog);
// OrderUtil orderUtil = new OrderUtil();
// orderUtil.SaveOrderLog(order);
//绑定号码
Map<String, Object> bindmap= OrderBindWorkerUtil.getOrderBindWorker(order.getId());
//发送微信推送通知客户师傅已接单
// 6. 返回成功 // 6. 返回成功
return AjaxResult.success("接单成功"); return AjaxResult.success("接单成功");
} catch (Exception e) { } catch (Exception e) {

View File

@ -14,7 +14,7 @@ import java.nio.charset.StandardCharsets;
public class GaoDeMapUtil { public class GaoDeMapUtil {
// 请替换为你自己的高德Web服务Key // 请替换为你自己的高德Web服务Key
private static final String GAODE_KEY = "YOUR_GAODE_WEB_KEY"; private static final String GAODE_KEY = "308ad08f306d74daddffba44f5537767";
/** /**
* 根据经纬度获取所在城市名称 * 根据经纬度获取所在城市名称

View File

@ -0,0 +1,125 @@
package com.ruoyi.system.ControllerUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.Area;
import com.ruoyi.system.domain.MobileMiddle;
import com.ruoyi.system.domain.Order;
import com.ruoyi.system.domain.UserAddress;
import com.ruoyi.system.domain.Users;
import com.ruoyi.system.service.IAreaService;
import com.ruoyi.system.service.IMobileMiddleService;
import com.ruoyi.system.service.IOrderService;
import com.ruoyi.system.service.IUserAddressService;
import com.ruoyi.system.service.IUsersService;
import com.winnerlook.model.VoiceResponseResult;
/**
* 师傅绑定订单的电话号码操作
*
*
* @author Mr. Zhang Pan
* @date 2025-01-03
* @version 1.0
*/
public class OrderBindWorkerUtil {
private static final IUsersService usersService= SpringUtils.getBean(IUsersService.class);
private static final IUserAddressService userAddressService= SpringUtils.getBean(IUserAddressService.class);
private static final IMobileMiddleService mobileMiddleService= SpringUtils.getBean(IMobileMiddleService.class);
private static final IOrderService orderService= SpringUtils.getBean(IOrderService.class);
private static final IAreaService areaService= SpringUtils.getBean(IAreaService.class);
/**
* 订单绑定师傅电话号码操作
* @param orderId 订单ID
* @return 绑定结果Map包含code和msg
*/
public static Map<String, Object> getOrderBindWorker(long orderId) {
Map<String, Object> result = new HashMap<>();
try {
// 1. 查询订单
Order order = orderService.selectOrderById(orderId);
if (order == null) {
result.put("code", 404);
result.put("msg", "订单不存在");
return result;
}
// 2. 查询师傅信息
Users workerUser = usersService.selectUsersById(order.getWorkerId());
if (workerUser == null) {
result.put("code", 404);
result.put("msg", "师傅信息不存在");
return result;
}
// 3. 查询订单地址
UserAddress userAddress = userAddressService.selectUserAddressById(order.getAddressId());
if (userAddress == null) {
result.put("code", 404);
result.put("msg", "订单地址不存在");
return result;
}
// 4. 经纬度转城市
double lng = Double.parseDouble(userAddress.getLongitude());
double lat = Double.parseDouble(userAddress.getLatitude());
String city = GaoDeMapUtil.getCityByLocation(lng, lat);
if (city == null || city.isEmpty()) {
result.put("code", 500);
result.put("msg", "无法根据经纬度获取城市信息");
return result;
}
// 5. 查询城市编码
Area area = new Area();
area.setTitle(city);
List<Area> areaList = areaService.selectAreaList(area);
if (areaList == null || areaList.isEmpty()) {
result.put("code", 404);
result.put("msg", "未找到城市编码");
return result;
}
Long cityCode = areaList.get(0).getId();
// 6. 查询可用中间号
MobileMiddle mobileMiddleQuery = new MobileMiddle();
mobileMiddleQuery.setCityId(cityCode);
List<MobileMiddle> mobileMiddleList = mobileMiddleService.selectMobileMiddleList(mobileMiddleQuery);
if (mobileMiddleList == null || mobileMiddleList.isEmpty()) {
result.put("code", 404);
result.put("msg", "该城市暂无可用中间号");
return result;
}
// 7. 获取用户和师傅手机号
String userPhone = userAddress.getPhone();
String workerPhone = workerUser.getPhone();
if (userPhone == null || workerPhone == null) {
result.put("code", 400);
result.put("msg", "用户或师傅手机号为空");
return result;
}
// 8. 绑定中间号直到成功
for (MobileMiddle middle : mobileMiddleList) {
VoiceResponseResult bindResult = YunXinPhoneUtilAPI.httpsPrivacyBindAxb(middle.getPhone(), userPhone, workerPhone);
if ("000000".equals(bindResult.getResult())) {
// 绑定成功更新订单
order.setMiddlePhone(middle.getPhone());
order.setUserPhone(userPhone);
order.setWorkerPhone(workerPhone);
orderService.updateOrder(order);
result.put("code", 200);
result.put("msg", "绑定成功");
return result;
}
}
// 9. 所有中间号都绑定失败
result.put("code", 500);
result.put("msg", "所有中间号均绑定失败");
} catch (Exception e) {
result.put("code", 500);
result.put("msg", "绑定异常: " + e.getMessage());
}
return result;
}
}

View File

@ -19,7 +19,13 @@ public interface OrderLogMapper
*/ */
public OrderLog selectOrderLogById(Long id); public OrderLog selectOrderLogById(Long id);
/**
* 查询最新一条日志记录
*
* @param oid 订单服务记录主键
* @return 订单服务记录
*/
public OrderLog selectDataTheFirstNew(Long oid);
public int selectCountOrderLogByOrderId(String orderId); public int selectCountOrderLogByOrderId(String orderId);
public List<OrderLog> selectOrderLogByOrderId(String orderId); public List<OrderLog> selectOrderLogByOrderId(String orderId);

View File

@ -21,6 +21,15 @@ public interface IOrderLogService
/**
* 查询最新一条日志记录
*
* @param oid 订单服务记录主键
* @return 订单服务记录
*/
public OrderLog selectDataTheFirstNew(Long oid);
/** /**
* 查询订单服务记录数量 * 查询订单服务记录数量
* *

View File

@ -32,6 +32,18 @@ public class OrderLogServiceImpl implements IOrderLogService
} }
/**
* 查询最新一条日志记录
*
* @param oid 订单服务记录主键
* @return 订单服务记录
*/
public OrderLog selectDataTheFirstNew(Long oid) {
return orderLogMapper.selectDataTheFirstNew(oid);
}
/** /**
* 查询订单服务记录数量 * 查询订单服务记录数量
* *

View File

@ -81,7 +81,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectDataTheFirstNew" parameterType="Long" resultMap="OrderLogResult">
<include refid="selectOrderLogVo"/>
where oid = #{oid}
ORDER BY created_at DESC LIMIT 1;
</select>
<select id="selectOrderLogByOrderId" parameterType="String" resultMap="OrderLogResult"> <select id="selectOrderLogByOrderId" parameterType="String" resultMap="OrderLogResult">
select * from order_log where order_id = #{orderId} order by id DESC select * from order_log where order_id = #{orderId} order by id DESC

View File

@ -7,6 +7,7 @@
v-model="loginForm.username" v-model="loginForm.username"
type="text" type="text"
auto-complete="off" auto-complete="off"
size="medium"
placeholder="账号" placeholder="账号"
> >
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
@ -18,6 +19,7 @@
type="password" type="password"
auto-complete="off" auto-complete="off"
placeholder="密码" placeholder="密码"
size="medium"
@keyup.enter.native="handleLogin" @keyup.enter.native="handleLogin"
> >
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
@ -44,6 +46,7 @@
size="medium" size="medium"
type="primary" type="primary"
style="width:100%;" style="width:100%;"
class="submit"
@click.native.prevent="handleLogin" @click.native.prevent="handleLogin"
> >
<span v-if="!loading"> </span> <span v-if="!loading"> </span>
@ -56,7 +59,7 @@
</el-form> </el-form>
<!-- 底部 --> <!-- 底部 -->
<div class="el-login-footer"> <div class="el-login-footer">
<span>Copyright © 2018-2025 ruoyi.vip All Rights Reserved.</span>
</div> </div>
</div> </div>
</template> </template>
@ -156,7 +159,7 @@ export default {
} }
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style lang="scss" scoped>
.login { .login {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -177,16 +180,19 @@ export default {
width: 400px; width: 400px;
padding: 25px 25px 5px 25px; padding: 25px 25px 5px 25px;
z-index: 1; z-index: 1;
.el-input {
height: 38px;
input {
height: 38px;
}
}
.input-icon { .input-icon {
height: 39px; height: 46px;
width: 14px; width: 14px;
margin-left: 2px; margin-left: 10px;
}
.submit{
padding: 15px;
}
::v-deep .el-input__inner {
line-height: 46px !important;
height: 46px !important;
padding-left: 40px;
} }
} }
.login-tip { .login-tip {
@ -196,7 +202,7 @@ export default {
} }
.login-code { .login-code {
width: 33%; width: 33%;
height: 38px; height: 46px;
float: right; float: right;
img { img {
cursor: pointer; cursor: pointer;
@ -216,6 +222,6 @@ export default {
letter-spacing: 1px; letter-spacing: 1px;
} }
.login-code-img { .login-code-img {
height: 38px; height: 46px;
} }
</style> </style>