大于创建4小时,没有实时数据且该枪之后有结算订单,标记未正常
This commit is contained in:
parent
754f2005ab
commit
5b343c0d63
@ -189,7 +189,20 @@ public interface XhpcChargeOrderMapper {
|
|||||||
/**
|
/**
|
||||||
* 标记异常大于创建4小时,标记为异常
|
* 标记异常大于创建4小时,标记为异常
|
||||||
*/
|
*/
|
||||||
void updateStatus();
|
void updateStatus(@Param("status")Integer status,@Param("chargeOrderId")Long chargeOrderId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4小时订单未结算的订单
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<XhpcChargeOrder> getFourTimsStatus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询相同桩之后是否有订单结算
|
||||||
|
* @param serialNumber 订单号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getSerialNumberLike(@Param("serialNumber")String serialNumber,@Param("chargeOrderId")Long chargeOrderId);
|
||||||
|
|
||||||
|
|
||||||
List<Map<String, Object>> selectDate3rdNeedBy(@Param(value = "serialNumber") String serialNumber);
|
List<Map<String, Object>> selectDate3rdNeedBy(@Param(value = "serialNumber") String serialNumber);
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.xhpc.common.api.PowerPileService;
|
|||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.data.down.StartChargingData;
|
import com.xhpc.common.data.down.StartChargingData;
|
||||||
|
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||||
import com.xhpc.common.data.redis.StaticBeanUtil;
|
import com.xhpc.common.data.redis.StaticBeanUtil;
|
||||||
import com.xhpc.common.domain.XhpcRate;
|
import com.xhpc.common.domain.XhpcRate;
|
||||||
import com.xhpc.common.domain.XhpcTerminal;
|
import com.xhpc.common.domain.XhpcTerminal;
|
||||||
@ -509,7 +510,27 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateStatus() {
|
public void updateStatus() {
|
||||||
xhpcChargeOrderMapper.updateStatus();
|
//标记异常大于创建4小时,标记为异常 且没有实时数据的订单
|
||||||
|
//查询是否有实时数据,没有实时数据查看该桩是否有成功的数据,有成功的数据表示该订单是无效的
|
||||||
|
List<XhpcChargeOrder> list = xhpcChargeOrderMapper.getFourTimsStatus();
|
||||||
|
if(list !=null && list.size()>0){
|
||||||
|
for (XhpcChargeOrder xhpcChargeOrder:list) {
|
||||||
|
CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:" + xhpcChargeOrder.getSerialNumber() + ".lord");
|
||||||
|
Long chargeOrderId = xhpcChargeOrder.getChargeOrderId();
|
||||||
|
if(cacheRealtimeData ==null){
|
||||||
|
int count = xhpcChargeOrderMapper.getSerialNumberLike(xhpcChargeOrder.getSerialNumber().substring(0, 16), chargeOrderId);
|
||||||
|
if(count>0){
|
||||||
|
//有充电改为 由充电中变为启动充电中
|
||||||
|
xhpcChargeOrderMapper.updateStatus(-1,chargeOrderId);
|
||||||
|
}else{
|
||||||
|
//标记异常
|
||||||
|
xhpcChargeOrderMapper.updateStatus(2,chargeOrderId);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
xhpcChargeOrderMapper.updateStatus(2,chargeOrderId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -603,7 +603,15 @@
|
|||||||
where operator_id_evcs = #{operatorIdEvcs}
|
where operator_id_evcs = #{operatorIdEvcs}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="updateStatus">
|
<update id="updateStatus">
|
||||||
update xhpc_charge_order set status=2 where now() >DATE_ADD(create_time,interval 4 hour) and status=0
|
update xhpc_charge_order set status=#{status} where status=0 and charge_order_id = #{chargeOrderId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="getFourTimsStatus" resultMap="XhpcChargeOrderResult">
|
||||||
|
select * from xhpc_charge_order where now() >DATE_ADD(create_time,interval 4 hour) and status=0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getSerialNumberLike" resultType="Integer">
|
||||||
|
select count(charge_order_id) xhpc_charge_order where serial_number like concat('%', #{serialNumber}, '%') and charge_order_id > #{chargeOrderId} and status=1
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -210,6 +210,9 @@
|
|||||||
<if test="phone != null">
|
<if test="phone != null">
|
||||||
phone,
|
phone,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="chargingMode != null">
|
||||||
|
charging_mode,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="chargingStationId != null">
|
<if test="chargingStationId != null">
|
||||||
@ -353,6 +356,9 @@
|
|||||||
<if test="phone != null">
|
<if test="phone != null">
|
||||||
#{phone,jdbcType=VARCHAR},
|
#{phone,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="chargingMode != null">
|
||||||
|
#{chargingMode,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@ -647,7 +647,10 @@
|
|||||||
type,
|
type,
|
||||||
</if>
|
</if>
|
||||||
<if test="null != historyOrderId ">
|
<if test="null != historyOrderId ">
|
||||||
history_order_id
|
history_order_id,
|
||||||
|
</if>
|
||||||
|
<if test="chargingMode != null">
|
||||||
|
charging_mode,
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
@ -727,7 +730,10 @@
|
|||||||
#{type},
|
#{type},
|
||||||
</if>
|
</if>
|
||||||
<if test="null != historyOrderId ">
|
<if test="null != historyOrderId ">
|
||||||
#{historyOrderId}
|
#{historyOrderId},
|
||||||
|
</if>
|
||||||
|
<if test="chargingMode != null">
|
||||||
|
#{chargingMode},
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user