|
|
|
@ -2,6 +2,7 @@ package com.dsideal.ZhuQue.Ylt.Controller;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.cybermkd.mongo.kit.MongoQuery;
|
|
|
|
|
import com.dsideal.ZhuQue.Interceptor.EmptyInterface;
|
|
|
|
|
import com.dsideal.ZhuQue.Interceptor.IsLoginInterface;
|
|
|
|
|
import com.dsideal.ZhuQue.Util.CommonUtil;
|
|
|
|
@ -11,6 +12,7 @@ import com.jfinal.aop.Before;
|
|
|
|
|
import com.jfinal.core.Controller;
|
|
|
|
|
import com.jfinal.ext.interceptor.GET;
|
|
|
|
|
import com.jfinal.ext.interceptor.POST;
|
|
|
|
|
import com.jfinal.kit.Kv;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
@ -22,6 +24,7 @@ import java.util.UUID;
|
|
|
|
|
public class YltController extends Controller {
|
|
|
|
|
Logger log = LoggerFactory.getLogger(YltController.class);
|
|
|
|
|
YltModel ym = new YltModel();
|
|
|
|
|
MongoQuery query = new MongoQuery();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取当前订单是不是在有合作的道闸车场内,这样的车场停车有减免
|
|
|
|
@ -152,7 +155,7 @@ public class YltController extends Controller {
|
|
|
|
|
.execute().body(); // 发送请求并获取响应体
|
|
|
|
|
//记录到数据库中闸机的流水记录
|
|
|
|
|
ym.recordDzLog(order_no, charge_plate_no, jo.toString(), result);
|
|
|
|
|
renderJson(CommonUtil.getRet(JSONObject.parseObject(result),true, "已经向科拓闸机平台发送了减免消息!" ));
|
|
|
|
|
renderJson(CommonUtil.getRet(JSONObject.parseObject(result), true, "已经向科拓闸机平台发送了减免消息!"));
|
|
|
|
|
return;
|
|
|
|
|
} else if ("智门科技".equals(name)) {
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
@ -176,10 +179,68 @@ public class YltController extends Controller {
|
|
|
|
|
.execute().body(); // 发送请求并获取响应体
|
|
|
|
|
//记录到数据库中闸机的流水记录
|
|
|
|
|
ym.recordDzLog(order_no, charge_plate_no, jo.toString(), result);
|
|
|
|
|
renderJson(CommonUtil.getRet(JSONObject.parseObject(result),true, "已经向智门科技闸机平台发送了减免消息!"));
|
|
|
|
|
renderJson(CommonUtil.getRet(JSONObject.parseObject(result), true, "已经向智门科技闸机平台发送了减免消息!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
renderJson(CommonUtil.getRet(false, "发现了一个未知的闸机厂商,请联系开发人员!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:根据手机号查询用户信息
|
|
|
|
|
* 因为一个手机号可能有多个用户,所以返回的是一个list,由管理员手动挑选是哪条,然后转化为userId进行下一步处理
|
|
|
|
|
*
|
|
|
|
|
* @param phone
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void queryUserByPhone(String phone) {
|
|
|
|
|
List<Record> list = ym.queryUserByPhone(phone);
|
|
|
|
|
renderJson(CommonUtil.getRet(list, true, "获取数据成功!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:根据用户id查询挂起订单
|
|
|
|
|
* state: 订单状态 0 创建中 1准备充电中 2 充电中 3完成 4 取消 5挂起 6需要手动补单 7结算中
|
|
|
|
|
* order_type: 订单类型 1普通用户订单 3 企业用户订单 4第三方平台订单
|
|
|
|
|
* order_type =1 or 3 的使用正向方式处理 【直连】
|
|
|
|
|
* order_type =4 使用反向方式处理 【互联互通】
|
|
|
|
|
*
|
|
|
|
|
* @param user_id
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getHungUpOrderByUserId(int user_id) {
|
|
|
|
|
Record record = ym.getHungUpOrderByUserId(user_id);
|
|
|
|
|
if (record == null) {
|
|
|
|
|
renderJson(CommonUtil.getRet(false, "没有挂起订单!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
|
res.put("data", record);
|
|
|
|
|
|
|
|
|
|
//订单号
|
|
|
|
|
String order_no = record.getStr("order_no");
|
|
|
|
|
//订单类型
|
|
|
|
|
int order_type = record.getInt("order_type");
|
|
|
|
|
|
|
|
|
|
//订单状态 0 创建中 1准备充电中 2 充电中 3完成 4 取消 5挂起 6需要手动补单 7结算中
|
|
|
|
|
int state = record.getInt("state");
|
|
|
|
|
//互联互通
|
|
|
|
|
if (order_type == 4) {
|
|
|
|
|
//显示对接平台发过来的金额,并且需要显示我方的金额,两者对比,差额等,让管理员决策判断是否可以补单
|
|
|
|
|
|
|
|
|
|
} else {//直连
|
|
|
|
|
//最后一次通讯记录
|
|
|
|
|
JSONObject jo = query.use("equipmentOrder").eq("_id", order_no).findOne();
|
|
|
|
|
res.put("extInfo", jo);
|
|
|
|
|
//chargeBeginTime 开始充电时间
|
|
|
|
|
//chargeEndTime 结束充电时间
|
|
|
|
|
//charge_degree 充电度数
|
|
|
|
|
//chargeBeginSoc 充电开始soc
|
|
|
|
|
//chargeEndSoc 充电结束soc
|
|
|
|
|
//chargeDuration 充电时长 单位:秒
|
|
|
|
|
}
|
|
|
|
|
renderJson(CommonUtil.getRet(res, true, "获取数据成功!"));
|
|
|
|
|
}
|
|
|
|
|
}
|