|
@@ -32,13 +32,17 @@ import com.comtika.ctkcloud.server.core.cache.ServerCache;
|
|
import com.comtika.ctkcloud.server.core.eunms.RefundStrategy;
|
|
import com.comtika.ctkcloud.server.core.eunms.RefundStrategy;
|
|
import com.comtika.ctkcloud.server.dao.*;
|
|
import com.comtika.ctkcloud.server.dao.*;
|
|
import com.comtika.ctkcloud.server.dao.order.CtkServiceOrderDao;
|
|
import com.comtika.ctkcloud.server.dao.order.CtkServiceOrderDao;
|
|
|
|
+import com.comtika.ctkcloud.server.dao.white.CtkWhiteDao;
|
|
import com.comtika.ctkcloud.server.entity.*;
|
|
import com.comtika.ctkcloud.server.entity.*;
|
|
import com.comtika.ctkcloud.server.entity.chargeserver.CtkServiceOrder;
|
|
import com.comtika.ctkcloud.server.entity.chargeserver.CtkServiceOrder;
|
|
import com.comtika.ctkcloud.server.entity.equip.CtkEquipNode;
|
|
import com.comtika.ctkcloud.server.entity.equip.CtkEquipNode;
|
|
import com.comtika.ctkcloud.server.entity.equip.CtkEquipSocket;
|
|
import com.comtika.ctkcloud.server.entity.equip.CtkEquipSocket;
|
|
|
|
+import com.comtika.ctkcloud.server.entity.white.CtkUserWhite;
|
|
import com.comtika.ctkcloud.server.feign.EquipService;
|
|
import com.comtika.ctkcloud.server.feign.EquipService;
|
|
import com.comtika.ctkcloud.server.feign.Instructions;
|
|
import com.comtika.ctkcloud.server.feign.Instructions;
|
|
|
|
+import com.comtika.ctkcloud.server.feign.MyBankFeign;
|
|
import com.comtika.ctkcloud.server.service.ChargeServerService;
|
|
import com.comtika.ctkcloud.server.service.ChargeServerService;
|
|
|
|
+
|
|
import org.beetl.sql.core.engine.PageQuery;
|
|
import org.beetl.sql.core.engine.PageQuery;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -88,8 +92,10 @@ public class ChargeServerServiceImpl implements ChargeServerService{
|
|
@Autowired
|
|
@Autowired
|
|
private CtkOnlineRefundWayDao ctkOnlineRefundWayDao;
|
|
private CtkOnlineRefundWayDao ctkOnlineRefundWayDao;
|
|
|
|
|
|
- /*@Autowired
|
|
|
|
- private MyBankFeign myBankFeign;*/
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private MyBankFeign myBankFeign;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CtkWhiteDao ctkWhiteDao;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 判断用户 是否还在充电
|
|
* 判断用户 是否还在充电
|
|
@@ -108,7 +114,7 @@ public class ChargeServerServiceImpl implements ChargeServerService{
|
|
* @throws //解析数据异常
|
|
* @throws //解析数据异常
|
|
* @变更记录 2018年9月3日 上午11:01:14 actor_miss create
|
|
* @变更记录 2018年9月3日 上午11:01:14 actor_miss create
|
|
*/
|
|
*/
|
|
- private RespWrapper<SiteSimpleCacheDataEntity> checkCharger(ChargeReqData chargeReqData) throws Exception{
|
|
|
|
|
|
+ private RespWrapper<SiteSimpleCacheDataEntity> checkCharger(ChargeReqData chargeReqData,Long userId) throws Exception{
|
|
boolean bl = false;//是否按电量充电
|
|
boolean bl = false;//是否按电量充电
|
|
int num = chargeReqData.getChargerValue();
|
|
int num = chargeReqData.getChargerValue();
|
|
RespWrapper<SiteSimpleCacheDataEntity> siteServerInfo = serverDataHandleUtil.findSiteServerInfo(chargeReqData.getStreamNo());
|
|
RespWrapper<SiteSimpleCacheDataEntity> siteServerInfo = serverDataHandleUtil.findSiteServerInfo(chargeReqData.getStreamNo());
|
|
@@ -120,14 +126,17 @@ public class ChargeServerServiceImpl implements ChargeServerService{
|
|
bl = true;
|
|
bl = true;
|
|
}
|
|
}
|
|
SiteSimpleCacheDataEntity data2 = siteServerInfo.getData();
|
|
SiteSimpleCacheDataEntity data2 = siteServerInfo.getData();
|
|
- int culFee = 0;
|
|
|
|
- if(bl){//下面是按电量校验是否正确
|
|
|
|
- culFee = serverDataHandleUtil.changeTotalFeeByNum(data2, num) ;
|
|
|
|
- }else{
|
|
|
|
- culFee = serverDataHandleUtil.getTotalFeeByTime(data2,num);
|
|
|
|
|
|
+ // 不是白名单需呀校验金额
|
|
|
|
+ if(!checkUserWhite(userId, data2.getSiteId())) {
|
|
|
|
+ int culFee = 0;
|
|
|
|
+ if(bl){//下面是按电量校验是否正确
|
|
|
|
+ culFee = serverDataHandleUtil.changeTotalFeeByNum(data2, num) ;
|
|
|
|
+ }else{
|
|
|
|
+ culFee = serverDataHandleUtil.getTotalFeeByTime(data2,num);
|
|
|
|
+ }
|
|
|
|
+ if(culFee != chargeReqData.getTotalFee())
|
|
|
|
+ return RespWrapper.makeFailResp("充电服务层,校验金额有误");
|
|
}
|
|
}
|
|
- if(culFee != chargeReqData.getTotalFee())
|
|
|
|
- return RespWrapper.makeFailResp("充电服务层,校验金额有误");
|
|
|
|
return siteServerInfo;
|
|
return siteServerInfo;
|
|
}
|
|
}
|
|
public static void main(String[] args){
|
|
public static void main(String[] args){
|
|
@@ -386,7 +395,7 @@ public class ChargeServerServiceImpl implements ChargeServerService{
|
|
if(loginType == CustomerTypeEnum.ALIPAY.getId()) entity.setPayModel(ChargerPayModle.ALI_YE.getId());//支付模式
|
|
if(loginType == CustomerTypeEnum.ALIPAY.getId()) entity.setPayModel(ChargerPayModle.ALI_YE.getId());//支付模式
|
|
|
|
|
|
/***检验充电金额*/
|
|
/***检验充电金额*/
|
|
- SiteSimpleCacheDataEntity data2 = checkChargerAfter(chargeReqData);//优化充电金额校验 2019/7/31 23:27
|
|
|
|
|
|
+ SiteSimpleCacheDataEntity data2 = checkChargerAfter(chargeReqData,userId);//优化充电金额校验 2019/7/31 23:27
|
|
// System.out.println("站点缓存数据为:"+data2.toString());
|
|
// System.out.println("站点缓存数据为:"+data2.toString());
|
|
siteName = data2.getSiteName();
|
|
siteName = data2.getSiteName();
|
|
boolean isKWH = (chargeReqData.getChargerMode() == ChargeMode.C_NUM.getId());
|
|
boolean isKWH = (chargeReqData.getChargerMode() == ChargeMode.C_NUM.getId());
|
|
@@ -467,8 +476,8 @@ public class ChargeServerServiceImpl implements ChargeServerService{
|
|
return chargerTime;
|
|
return chargerTime;
|
|
}
|
|
}
|
|
/**校验金额*/
|
|
/**校验金额*/
|
|
- private SiteSimpleCacheDataEntity checkChargerAfter(ChargeReqData chargeReqData)throws Exception{
|
|
|
|
- return RespResult.resDataChange(checkCharger(chargeReqData));
|
|
|
|
|
|
+ private SiteSimpleCacheDataEntity checkChargerAfter(ChargeReqData chargeReqData,Long userId)throws Exception{
|
|
|
|
+ return RespResult.resDataChange(checkCharger(chargeReqData,userId));
|
|
}
|
|
}
|
|
/**在线支付充电
|
|
/**在线支付充电
|
|
*在线充电去的网商模块
|
|
*在线充电去的网商模块
|
|
@@ -679,7 +688,7 @@ public class ChargeServerServiceImpl implements ChargeServerService{
|
|
try {
|
|
try {
|
|
if(chargeReqData.getRechargeNo() == null) return RespWrapper.makeFailResp("在线支付时必须传充值订单唯一标识");
|
|
if(chargeReqData.getRechargeNo() == null) return RespWrapper.makeFailResp("在线支付时必须传充值订单唯一标识");
|
|
/**检验充电金额*/
|
|
/**检验充电金额*/
|
|
- SiteSimpleCacheDataEntity data2 = checkChargerAfter(chargeReqData);
|
|
|
|
|
|
+ SiteSimpleCacheDataEntity data2 = checkChargerAfter(chargeReqData,userId);
|
|
siteName = data2.getSiteName();
|
|
siteName = data2.getSiteName();
|
|
boolean isKWH = (chargeReqData.getChargerMode() == ChargeMode.C_NUM.getId());
|
|
boolean isKWH = (chargeReqData.getChargerMode() == ChargeMode.C_NUM.getId());
|
|
/** 根据流水号查询插座信息*/
|
|
/** 根据流水号查询插座信息*/
|
|
@@ -1231,10 +1240,18 @@ public class ChargeServerServiceImpl implements ChargeServerService{
|
|
* 小程序 根据流水号查询对应的 站点费用
|
|
* 小程序 根据流水号查询对应的 站点费用
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public RespWrapper<SiteSimpleCacheDataEntity> getServerPayInfo(String serialNum,Integer chargeTime, Integer chargerMode) {
|
|
|
|
|
|
+ public RespWrapper<SiteSimpleCacheDataEntity> getServerPayInfo(String serialNum,Integer chargeTime, Integer chargerMode,Long userId) {
|
|
RespWrapper<SiteSimpleCacheDataEntity> findSiteServerInfo = serverDataHandleUtil.findSiteServerInfo(serialNum);
|
|
RespWrapper<SiteSimpleCacheDataEntity> findSiteServerInfo = serverDataHandleUtil.findSiteServerInfo(serialNum);
|
|
if(findSiteServerInfo.isSuccess()){
|
|
if(findSiteServerInfo.isSuccess()){
|
|
SiteSimpleCacheDataEntity data = findSiteServerInfo.getData();
|
|
SiteSimpleCacheDataEntity data = findSiteServerInfo.getData();
|
|
|
|
+ // TODO 2020 05 10 这里增加白名单处理
|
|
|
|
+ boolean isWhite = checkUserWhite(userId,data.getSiteId());
|
|
|
|
+ if(isWhite){
|
|
|
|
+ data.setChangeFee(0);
|
|
|
|
+ data.setServiceCharge(0);
|
|
|
|
+ return findSiteServerInfo;
|
|
|
|
+ }
|
|
|
|
+ // 这里判断是否是在
|
|
if(chargerMode != ChargeMode.C_NUM.getId()){//不是按电量查询
|
|
if(chargerMode != ChargeMode.C_NUM.getId()){//不是按电量查询
|
|
data.setChangeFee(serverDataHandleUtil.getTotalFeeByTime(data, chargeTime));
|
|
data.setChangeFee(serverDataHandleUtil.getTotalFeeByTime(data, chargeTime));
|
|
}else{//下面是按电量查询
|
|
}else{//下面是按电量查询
|
|
@@ -1245,6 +1262,16 @@ public class ChargeServerServiceImpl implements ChargeServerService{
|
|
return findSiteServerInfo;
|
|
return findSiteServerInfo;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private boolean checkUserWhite(Long userId, Integer siteId) {
|
|
|
|
+ CtkUserWhite white = ctkWhiteDao.findSiteWhite(siteId);
|
|
|
|
+ if(white != null && white.getIsOpen() && white.getRule() != null && white.getRule() == 1){
|
|
|
|
+ // 下面判断用户是否在白名单中
|
|
|
|
+ Integer count = ctkWhiteDao.checkWhiteList(siteId,userId);
|
|
|
|
+ if(count != null && count > 0) return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**清空对应的缓存*/
|
|
/**清空对应的缓存*/
|
|
@Override
|
|
@Override
|