main^2
黄海 11 months ago
parent aa57218b13
commit d2afc44864

@ -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, "发现了一个未知的闸机厂商,请联系开发人员!"));
}
/**
*
* listuserId
*
* @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, "获取数据成功!"));
}
}

@ -122,4 +122,30 @@ public class YltModel {
record.set("result", result);
Db.save("t_ext_dz_log", "order_no", record);
}
/**
*
*
* @param phone
* @return
*/
public List<Record> queryUserByPhone(String phone) {
String sql = "select * from t_user where relation_phone=? or phone=?";
List<Record> list = Db.find(sql, phone, phone);
return list;
}
/**
* 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
*/
public Record getHungUpOrderByUserId(int user_id) {
String sql = "select order_no,state,order_type from t_equipment_charge_order where user_id=? order by id desc limit 1";
return Db.findFirst(sql, user_id);
}
}

Loading…
Cancel
Save