Adding a filter logic.

This commit is contained in:
little-cat-sweet 2021-11-04 15:42:44 +08:00
parent 21e0c3415e
commit a3deb63185
3 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,13 @@
package com.xhpc.order.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @Author HongYun on 2021/11/4
*/
@Mapper
public interface XhpcInternetUserMapper {
int selectByOperatorIdEvcs(@Param("operatorIdEvcs") String operatorIdEvcs);
}

View File

@ -12,6 +12,7 @@ import com.xhpc.common.redis.service.RedisService;
import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcOrderRedisRecord;
import com.xhpc.order.mapper.XhpcChargeOrderMapper;
import com.xhpc.order.mapper.XhpcInternetUserMapper;
import com.xhpc.order.service.IXhpcChargeOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -348,6 +349,9 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
return xhpcChargeOrderMapper.getXhpcChargeOrderStatus(status, source);
}
@Autowired
private XhpcInternetUserMapper xhpcInternetUserMapper;
@Override
@Transactional
public R startUpBy3rd(String internetSerialNumber, String driverId, Integer chargingAmt, String plateNum, Integer status, String connectorId) {
@ -364,6 +368,11 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
return r;
}
int resTime = xhpcInternetUserMapper.selectByOperatorIdEvcs(internetSerialNumber.substring(0, 9));
if (resTime == 0) {
r.setCode(500);
return r;
}
StartChargingData startChargingData = new StartChargingData();
//500000 equals 500 yuan

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.order.mapper.XhpcInternetUserMapper">
<select id="selectByOperatorIdEvcs" resultType="int">
select count(*)
from xhpc_internet_user
where operator_id_evcs = #{operatorIdEvcs}
and cooperation_start_time &lt;= now()
and cooperation_end_time &gt;= now()
</select>
</mapper>