|
|
|
@ -17,9 +17,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
import static com.charge.util.ToolDateTime.dateFormat;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/ZhuQue")
|
|
|
|
|
public class YltControllerForWx {
|
|
|
|
@ -38,6 +42,11 @@ public class YltControllerForWx {
|
|
|
|
|
|
|
|
|
|
YltModel ym = new YltModel();
|
|
|
|
|
|
|
|
|
|
//模拟一下假的订单【中东港】 select * from t_equipment_charge_order where station_id=114
|
|
|
|
|
String tmp_order_no = "2022012911045715187";
|
|
|
|
|
//模拟一下假的订单【西点药业湛江路】 select * from t_equipment_charge_order where station_id=85
|
|
|
|
|
//String tmp_order_no="2020092312312312312";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取当前订单是不是在有合作的道闸车场内,这样的车场停车有减免
|
|
|
|
|
*
|
|
|
|
@ -45,10 +54,12 @@ public class YltControllerForWx {
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/station/isThirdPartyStation")
|
|
|
|
|
public ResultVO isThirdPartyStation(String order_no) {
|
|
|
|
|
Record record = ym.getThirdPartyStation(order_no);
|
|
|
|
|
Record record = ym.getThirdPartyStation(tmp_order_no);
|
|
|
|
|
if (record == null) {
|
|
|
|
|
ym.writeCallLog(order_no, "检查到不是需要免费的道闸所在车场,无需发送减免消息!!", "-1");
|
|
|
|
|
return ResultVO.custom("不在合作的道闸车场内", -1);
|
|
|
|
|
}
|
|
|
|
|
ym.writeCallLog(order_no, "检查到是需要免费的道闸所在车场,发送减免消息!!", "0");
|
|
|
|
|
return ResultVO.success("在合作的道闸车场内");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -68,11 +79,8 @@ public class YltControllerForWx {
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/station/SyncChargePilePay")
|
|
|
|
|
public ResultVO SyncChargePilePay(String order_no, String charge_plate_no) {
|
|
|
|
|
//模拟一下假的订单
|
|
|
|
|
order_no="2023010415453464446";
|
|
|
|
|
|
|
|
|
|
//根据订单号获取到第三方方面提供的车场信息
|
|
|
|
|
Record thirdPartyStation = ym.getThirdPartyStation(order_no);
|
|
|
|
|
Record thirdPartyStation = ym.getThirdPartyStation(tmp_order_no);
|
|
|
|
|
if (thirdPartyStation == null) {
|
|
|
|
|
return ResultVO.custom("检查到不是需要免费的道闸所在车场,无需发送减免消息!!", -1);
|
|
|
|
|
}
|
|
|
|
@ -97,15 +105,13 @@ public class YltControllerForWx {
|
|
|
|
|
//log.info("发现闸机提供商:" + name + ",parkId=" + parkId);
|
|
|
|
|
|
|
|
|
|
//订单信息
|
|
|
|
|
Record ddRecord = ym.getOrderByNo(order_no);
|
|
|
|
|
Record ddRecord = ym.getOrderByNo(tmp_order_no);
|
|
|
|
|
|
|
|
|
|
int stationId = ddRecord.getInt("station_id");//电站ID
|
|
|
|
|
//获取车场名称
|
|
|
|
|
String stationName = ym.getStationById(stationId).getStr("station_name");
|
|
|
|
|
//设备号
|
|
|
|
|
int deviceId = ddRecord.getInt("equipment_id");//充电桩ID
|
|
|
|
|
//充电桩名称
|
|
|
|
|
String deviceName = ym.getEquipmentById(deviceId).getStr("equipment_name");
|
|
|
|
|
//车位号
|
|
|
|
|
String spaceNo = ddRecord.getInt("connector_id").toString();
|
|
|
|
|
//充电量
|
|
|
|
@ -135,8 +141,8 @@ public class YltControllerForWx {
|
|
|
|
|
jo.put("reqId", UUID.randomUUID().toString().toUpperCase());//每次请求的唯一标识,如果是异步接口,异步响应消息的reqId会与原请求的reqId一致。每次请求必须唯一!!!
|
|
|
|
|
jo.put("orderNo", order_no);//订单号
|
|
|
|
|
jo.put("plateNo", charge_plate_no);//车牌号
|
|
|
|
|
jo.put("startTime", charge_begin_time.replace(".0",""));//开始时间
|
|
|
|
|
jo.put("endTime", charge_end_time.replace(".0",""));//结束时间
|
|
|
|
|
jo.put("startTime", charge_begin_time.replace(".0", ""));//开始时间
|
|
|
|
|
jo.put("endTime", charge_end_time.replace(".0", ""));//结束时间
|
|
|
|
|
jo.put("stationId", stationId);//电站ID
|
|
|
|
|
jo.put("stationName", stationName);//电站名称
|
|
|
|
|
jo.put("deviceId", deviceId);//充电桩ID
|
|
|
|
@ -206,5 +212,38 @@ public class YltControllerForWx {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:是不是需要显示 获取优惠卷
|
|
|
|
|
*
|
|
|
|
|
* @param order_no
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/station/needShowYhj")
|
|
|
|
|
public ResultVO needShowYhj(String order_no) {
|
|
|
|
|
//1、如果没有获取过,但不是今天的,不能获取,当前日期年月日拼接成一个8位长度的字符串
|
|
|
|
|
// 获取当前日期
|
|
|
|
|
Date currentDate = new Date();
|
|
|
|
|
// 创建SimpleDateFormat对象,设置日期格式为"yyyyMMdd"
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
// 格式化日期
|
|
|
|
|
String formattedDate = dateFormat.format(currentDate);
|
|
|
|
|
// 输出格式化后的日期字符串
|
|
|
|
|
if (!order_no.substring(0, 8).equals(formattedDate)) {
|
|
|
|
|
return ResultVO.custom("不是今天的订单,无法派发优惠券", -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//2、不是指定场站的订单,不能获取
|
|
|
|
|
Record record = ym.getThirdPartyStation(tmp_order_no);
|
|
|
|
|
if (record == null) {
|
|
|
|
|
return ResultVO.custom("不在合作的道闸车场内", -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//3、如果获取过了,不能再次获取
|
|
|
|
|
Record r = ym.getDZlog(order_no);
|
|
|
|
|
if (r != null) {
|
|
|
|
|
return ResultVO.custom("已经发放过优惠券,不能再次发放!", -1);
|
|
|
|
|
}
|
|
|
|
|
//4、可以获取
|
|
|
|
|
return ResultVO.success();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|