修改订单回调参数为空问题

This commit is contained in:
yuyang 2021-08-27 15:46:45 +08:00
parent 2f8d0c3a90
commit 7b18183318
3 changed files with 35 additions and 51 deletions

View File

@ -242,6 +242,8 @@
GROUP_CONCAT(DISTINCT xdbp.dict_value ORDER BY xdbp.create_time ASC separator ',' ) peripheryFacilitiesName GROUP_CONCAT(DISTINCT xdbp.dict_value ORDER BY xdbp.create_time ASC separator ',' ) peripheryFacilitiesName
from xhpc_charging_station as ct from xhpc_charging_station as ct
left join xhpc_operator as op on op.operator_id = ct.operator_id left join xhpc_operator as op on op.operator_id = ct.operator_id
left JOIN xhpc_dict_biz as xdbs on xdbs.code='service_facilities' and xdbs.dict_key !=-1 and xdbs.del_flag=0
left JOIN xhpc_dict_biz as xdbp on xdbp.code='charging_periphery_facilities' and xdbp.dict_key !=-1 and xdbp.del_flag=0
where ct.charging_station_id = #{chargingStationId} where ct.charging_station_id = #{chargingStationId}
and ct.del_flag = 0 and ct.del_flag = 0
</select> </select>

View File

@ -228,22 +228,24 @@ public class HxpcPileOrderController extends BaseController {
DateTime startTime = DateUtil.parse(cacheOrderData.getStartTime()); DateTime startTime = DateUtil.parse(cacheOrderData.getStartTime());
DateTime endTime = DateUtil.parse(cacheOrderData.getEndTime()); DateTime endTime = DateUtil.parse(cacheOrderData.getEndTime());
hxpcChargeOrder.setStartTime(startTime);
hxpcChargeOrder.setEndTime(endTime); hxpcChargeOrder.setEndTime(endTime);
System.out.println(endTime.getTime());
System.out.println(startTime.getTime());
//充电时长 //充电时长
Long tiem = (endTime.getTime()-startTime.getTime())%1000; Long tiem = (endTime.getTime()-startTime.getTime())/1000;
if(tiem>60){ if(tiem>3600){
long mins = tiem % 60; long hours = tiem / 3600;
long hours = tiem / 60; double mins =(double)((tiem-(hours*3600))/60);
hxpcChargeOrder.setChargingTime(hours+""+mins+""); hxpcChargeOrder.setChargingTime(hours+""+new BigDecimal(mins).setScale(0)+"");
}else{ }else{
long mins = tiem % 60; double mins = (double)(tiem / 60);
hxpcChargeOrder.setChargingTime(mins+""); hxpcChargeOrder.setChargingTime(new BigDecimal(mins).setScale(0)+"");
} }
hxpcChargeOrder.setChargingTimeNumber(tiem.intValue()); hxpcChargeOrder.setChargingTimeNumber(tiem.intValue());
BigDecimal divide = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal); BigDecimal divide = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal);
hxpcChargeOrder.setChargingDegree(divide.divide(bigDecimal)); hxpcChargeOrder.setChargingDegree(divide);
hxpcChargeOrder.setAmountCharged(money.divide(bigDecimal)); hxpcChargeOrder.setAmountCharged(money);
String stopReason = cacheOrderData.getStopReason(); String stopReason = cacheOrderData.getStopReason();
hxpcChargeOrder.setErroRemark(stopReason); hxpcChargeOrder.setErroRemark(stopReason);
hxpcChargeOrder.setUpdateTime(date); hxpcChargeOrder.setUpdateTime(date);
@ -252,7 +254,8 @@ public class HxpcPileOrderController extends BaseController {
Long userId =hxpcChargeOrder.getUserId(); Long userId =hxpcChargeOrder.getUserId();
//生成一条历史订单 //生成一条历史订单
XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder(); XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder();
xhpcHistoryOrder.setPowerPriceTotal(powerPrice);
xhpcHistoryOrder.setServicePriceTotal(servicePrice);
Map<String, Object> userMessage = hxpcChargeOrderService.getUserMessage(userId); Map<String, Object> userMessage = hxpcChargeOrderService.getUserMessage(userId);
if(userMessage ==null || userMessage.get("balance") ==null){ if(userMessage ==null || userMessage.get("balance") ==null){
//订单异常 //订单异常
@ -420,7 +423,7 @@ public class HxpcPileOrderController extends BaseController {
try{ try{
//发送短信 //发送短信
if(user.get("phone") !=null){ if(user.get("phone") !=null){
String content="【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:"+hxpcChargeOrder.getChargingDegree()+",总费用为:"+actPrice+"元,充电费用明细,请查询小华充电小程序,谢谢。"; String content="【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:"+endSoc+"%,总费用为:"+actPrice+"元,充电费用明细,请查询小华充电小程序,谢谢。";
smsService.sendNotice(user.get("phone").toString(),content); smsService.sendNotice(user.get("phone").toString(),content);
} }
}catch (Exception e){ }catch (Exception e){
@ -541,20 +544,22 @@ public class HxpcPileOrderController extends BaseController {
Integer soc = cacheRealtimeData.getSoc(); Integer soc = cacheRealtimeData.getSoc();
xhpcRealTimeOrder.setSoc(soc.toString()); xhpcRealTimeOrder.setSoc(soc.toString());
xhpcRealTimeOrder.setMaxTemperature(cacheRealtimeData.getMaxTemperature()); xhpcRealTimeOrder.setMaxTemperature(cacheRealtimeData.getMaxTemperature());
xhpcRealTimeOrder.setChargingTime(cacheRealtimeData.getChargingTime().toString()); Integer chargingTime = cacheRealtimeData.getChargingTime();
if(cacheRealtimeData.getChargingTime()>60){ if(chargingTime>60){
int mins = cacheRealtimeData.getChargingTime() % 60; int hours = chargingTime / 60;
int hours = cacheRealtimeData.getChargingTime() / 60; int mins = (chargingTime-(hours*60)) % 60;
xhpcRealTimeOrder.setChargingTime(hours+""+mins+""); xhpcRealTimeOrder.setChargingTime(hours+""+mins+"");
}else{ }else{
xhpcRealTimeOrder.setChargingTime(cacheRealtimeData.getChargingTime()+""); xhpcRealTimeOrder.setChargingTime(chargingTime+"");
} }
if(cacheRealtimeData.getRemainingTime()>60){ Integer remainingTime = cacheRealtimeData.getRemainingTime();
int mins = cacheRealtimeData.getChargingTime() % 60; if(remainingTime>60){
int hours = cacheRealtimeData.getChargingTime() / 60; int hours = remainingTime / 60;
xhpcRealTimeOrder.setRemainingTime(hours+""+mins+""); double mins = (remainingTime-(hours*60))/60;
xhpcRealTimeOrder.setRemainingTime(hours+""+new BigDecimal(mins).setScale(0)+"");
}else{ }else{
xhpcRealTimeOrder.setRemainingTime(cacheRealtimeData.getChargingTime()+""); double mins = (double)(remainingTime/60);
xhpcRealTimeOrder.setRemainingTime(new BigDecimal(mins).setScale(0)+"");
} }
BigDecimal decimal = new BigDecimal(10000); BigDecimal decimal = new BigDecimal(10000);
BigDecimal divide = new BigDecimal(cacheRealtimeData.getLossChargingDegree()).divide(decimal); BigDecimal divide = new BigDecimal(cacheRealtimeData.getLossChargingDegree()).divide(decimal);
@ -671,28 +676,4 @@ public class HxpcPileOrderController extends BaseController {
} }
} }
public static void main(String[] args) {
// long time = DateUtil.parse("2021-08-18 12:12:12").getTime();
//
// long time1 = DateUtil.parse("2021-08-19 12:12:12").getTime();
// String orderNo="order:69852145896547022108191121220010";
// //解析订单编号
// String s = orderNo.split("\\.")[0];
// String s1 = s.split(":")[1];
// String s2 = orderNo.substring(6);
//
// String s3 = s2.substring(0,16);
// System.out.println(s);
// System.out.println("<<<<"+s2);
// System.out.println("<<<<"+s3);
int cacheRealtimeData =3000;
int mins = cacheRealtimeData % 60;
int hours = cacheRealtimeData / 60;
System.out.println("<<<<"+mins);
System.out.println("<<<<"+hours);
}
} }

View File

@ -160,7 +160,8 @@
<if test="null != createTime ">create_time = #{createTime},</if> <if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if> <if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != updateTime ">update_time = #{updateTime},</if> <if test="null != updateTime ">update_time = #{updateTime},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if> <if test="null != remark and '' != remark">remark = #{remark},</if>
<if test="null != soc and '' != soc">soc = #{soc}</if>
</set> </set>
WHERE app_user_id = #{appUserId} WHERE app_user_id = #{appUserId}
</update> </update>
@ -175,14 +176,14 @@
alipay_open_id alipayOpenId, avatar, balance, password, alipay_open_id alipayOpenId, avatar, balance, password,
`status`,create_by createBy ,create_time createTime, `status`,create_by createBy ,create_time createTime,
update_time updateTime, update_by updateBy, update_time updateTime, update_by updateBy,
del_flag delflag, remark, del_flag delflag, remark,soc,
CASE WHEN `status` = 0 THEN '正常' else '禁用' end statusName CASE WHEN `status` = 0 THEN '正常' else '禁用' end statusName
from xhpc_app_user from xhpc_app_user
WHERE del_flag = 0 and app_user_id = #{appUserId} WHERE del_flag = 0 and app_user_id = #{appUserId}
</select> </select>
<select id="selectAppUserList" parameterType="java.lang.Long" resultType="java.util.Map"> <select id="selectAppUserList" parameterType="java.lang.Long" resultType="java.util.Map">
select xau.app_user_id appUserId, xau.phone, xau.balance, select xau.app_user_id appUserId, xau.phone, xau.balance,soc,
xau.`status`,xau.create_time createTime,xau.is_refund_application isRefundApplication, xau.`status`,xau.create_time createTime,xau.is_refund_application isRefundApplication,
CASE WHEN xau.`status` = 0 THEN '正常' else '禁用' end statusName, CASE WHEN xau.`status` = 0 THEN '正常' else '禁用' end statusName,
CASE WHEN a.count > 0 THEN '老用户' else '新用户' end newUser CASE WHEN a.count > 0 THEN '老用户' else '新用户' end newUser