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

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

@ -241,7 +241,9 @@
GROUP_CONCAT(DISTINCT xdbs.dict_value ORDER BY xdbs.create_time ASC separator ',' ) serviceFacilitiesName,
GROUP_CONCAT(DISTINCT xdbp.dict_value ORDER BY xdbp.create_time ASC separator ',' ) peripheryFacilitiesName
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}
and ct.del_flag = 0
</select>

View File

@ -228,22 +228,24 @@ public class HxpcPileOrderController extends BaseController {
DateTime startTime = DateUtil.parse(cacheOrderData.getStartTime());
DateTime endTime = DateUtil.parse(cacheOrderData.getEndTime());
hxpcChargeOrder.setStartTime(startTime);
hxpcChargeOrder.setEndTime(endTime);
System.out.println(endTime.getTime());
System.out.println(startTime.getTime());
//充电时长
Long tiem = (endTime.getTime()-startTime.getTime())%1000;
if(tiem>60){
long mins = tiem % 60;
long hours = tiem / 60;
hxpcChargeOrder.setChargingTime(hours+""+mins+"");
Long tiem = (endTime.getTime()-startTime.getTime())/1000;
if(tiem>3600){
long hours = tiem / 3600;
double mins =(double)((tiem-(hours*3600))/60);
hxpcChargeOrder.setChargingTime(hours+""+new BigDecimal(mins).setScale(0)+"");
}else{
long mins = tiem % 60;
hxpcChargeOrder.setChargingTime(mins+"");
double mins = (double)(tiem / 60);
hxpcChargeOrder.setChargingTime(new BigDecimal(mins).setScale(0)+"");
}
hxpcChargeOrder.setChargingTimeNumber(tiem.intValue());
BigDecimal divide = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal);
hxpcChargeOrder.setChargingDegree(divide.divide(bigDecimal));
hxpcChargeOrder.setAmountCharged(money.divide(bigDecimal));
hxpcChargeOrder.setChargingDegree(divide);
hxpcChargeOrder.setAmountCharged(money);
String stopReason = cacheOrderData.getStopReason();
hxpcChargeOrder.setErroRemark(stopReason);
hxpcChargeOrder.setUpdateTime(date);
@ -252,7 +254,8 @@ public class HxpcPileOrderController extends BaseController {
Long userId =hxpcChargeOrder.getUserId();
//生成一条历史订单
XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder();
xhpcHistoryOrder.setPowerPriceTotal(powerPrice);
xhpcHistoryOrder.setServicePriceTotal(servicePrice);
Map<String, Object> userMessage = hxpcChargeOrderService.getUserMessage(userId);
if(userMessage ==null || userMessage.get("balance") ==null){
//订单异常
@ -420,7 +423,7 @@ public class HxpcPileOrderController extends BaseController {
try{
//发送短信
if(user.get("phone") !=null){
String content="【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:"+hxpcChargeOrder.getChargingDegree()+",总费用为:"+actPrice+"元,充电费用明细,请查询小华充电小程序,谢谢。";
String content="【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:"+endSoc+"%,总费用为:"+actPrice+"元,充电费用明细,请查询小华充电小程序,谢谢。";
smsService.sendNotice(user.get("phone").toString(),content);
}
}catch (Exception e){
@ -428,7 +431,7 @@ public class HxpcPileOrderController extends BaseController {
}
}
hxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder);
hxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder);
Map<String, Object> map = new HashMap<>();
map.put("code", 500);
map.put("userId", userId);
@ -541,20 +544,22 @@ public class HxpcPileOrderController extends BaseController {
Integer soc = cacheRealtimeData.getSoc();
xhpcRealTimeOrder.setSoc(soc.toString());
xhpcRealTimeOrder.setMaxTemperature(cacheRealtimeData.getMaxTemperature());
xhpcRealTimeOrder.setChargingTime(cacheRealtimeData.getChargingTime().toString());
if(cacheRealtimeData.getChargingTime()>60){
int mins = cacheRealtimeData.getChargingTime() % 60;
int hours = cacheRealtimeData.getChargingTime() / 60;
Integer chargingTime = cacheRealtimeData.getChargingTime();
if(chargingTime>60){
int hours = chargingTime / 60;
int mins = (chargingTime-(hours*60)) % 60;
xhpcRealTimeOrder.setChargingTime(hours+""+mins+"");
}else{
xhpcRealTimeOrder.setChargingTime(cacheRealtimeData.getChargingTime()+"");
xhpcRealTimeOrder.setChargingTime(chargingTime+"");
}
if(cacheRealtimeData.getRemainingTime()>60){
int mins = cacheRealtimeData.getChargingTime() % 60;
int hours = cacheRealtimeData.getChargingTime() / 60;
xhpcRealTimeOrder.setRemainingTime(hours+""+mins+"");
Integer remainingTime = cacheRealtimeData.getRemainingTime();
if(remainingTime>60){
int hours = remainingTime / 60;
double mins = (remainingTime-(hours*60))/60;
xhpcRealTimeOrder.setRemainingTime(hours+""+new BigDecimal(mins).setScale(0)+"");
}else{
xhpcRealTimeOrder.setRemainingTime(cacheRealtimeData.getChargingTime()+"");
double mins = (double)(remainingTime/60);
xhpcRealTimeOrder.setRemainingTime(new BigDecimal(mins).setScale(0)+"");
}
BigDecimal decimal = new BigDecimal(10000);
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 != updateBy and '' != updateBy">update_by = #{updateBy},</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>
WHERE app_user_id = #{appUserId}
</update>
@ -175,14 +176,14 @@
alipay_open_id alipayOpenId, avatar, balance, password,
`status`,create_by createBy ,create_time createTime,
update_time updateTime, update_by updateBy,
del_flag delflag, remark,
del_flag delflag, remark,soc,
CASE WHEN `status` = 0 THEN '正常' else '禁用' end statusName
from xhpc_app_user
WHERE del_flag = 0 and app_user_id = #{appUserId}
</select>
<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,
CASE WHEN xau.`status` = 0 THEN '正常' else '禁用' end statusName,
CASE WHEN a.count > 0 THEN '老用户' else '新用户' end newUser