个人黑名单、双枪

This commit is contained in:
yjh_yyds 2024-07-01 09:31:42 +08:00
parent 1822d29311
commit cf8f608ecb
70 changed files with 1748 additions and 298 deletions

View File

@ -103,6 +103,8 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
CommonRequest<ChargeOrderInfo> commonRequest = new CommonRequest<>();
commonRequest.setData(data);
String responseBody = ok(commonRequest, "/notification_charge_order_info", authSecretTokenOut);
return DTOJsonHelper.parseResponseData(responseBody,
ChargeOrderInfoResponse.class, authSecretTokenOut);
}

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -16,10 +16,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置
@ -35,7 +35,7 @@ spring:
datasource:
ds1:
nacos:
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
dataId: sentinel-ruoyi-gateway
groupId: DEFAULT_GROUP
data-type: json

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -145,6 +145,7 @@ public class XhpcClearingHistoryOrderServiceImpl extends BaseService implements
writer.addHeaderAlias("endSoc", "结算SOC");
writer.addHeaderAlias("startTime", "开始充电时间");
writer.addHeaderAlias("endTime", "结束充电时间");
writer.addHeaderAlias("totalPower", "电量");
// 默认的未添加alias的属性也会写出如果想只写出加了别名的字段可以调用此方法排除之
writer.setOnlyAlias(true);
// 一次性写出内容使用默认样式强制输出标题

View File

@ -19,10 +19,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8858
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: 127.0.0.1:8858
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -244,7 +244,7 @@ public class XhpcChargingPileController extends BaseController {
if(powerNumber<1 || powerNumber>100){
return AjaxResult.error("充电桩最大允许输出功率1~100之内");
}
REDIS.setCacheObject(serialNumber+":powerNumber",powerNumber);
redisService.setCacheObject("pile:"+serialNumber+":powerNumber",powerNumber);
R r = powerPileService.pileConfigSettings(serialNumber,powerNumber.toString());
if(r.getCode() !=200){
return AjaxResult.error(r.getMsg());

View File

@ -163,6 +163,20 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
xhpcTimingChargingModel.setCreateTime(new Date());
xhpcTimingChargingModel.setChargingStationId(chargingStationId);
xhpcTimingChargingModel.setPhone(xhpcTimingChargingModelDto.getPhone());
Integer[] chargingPileIds = xhpcTimingChargingModelDto.getChargingPileIds();
String PileIds ="";
for (int i = 0; i <chargingPileIds.length ; i++) {
if(i==0 && chargingPileIds.length>1){
PileIds =PileIds+chargingPileIds[i];
}else if(chargingPileIds.length==1){
PileIds =chargingPileIds[i]+"";
}else{
PileIds =PileIds+","+chargingPileIds[i];
}
}
xhpcTimingChargingModel.setPileIds(PileIds);
if(xhpcTimingChargingModelDto.getTimingChargingModelId() !=null){
xhpcTimingChargingModel.setTimingChargingModelId(xhpcTimingChargingModelDto.getTimingChargingModelId());
xhpcTimingChargingModelMapper.updateXhpcTimingChargingModel(xhpcTimingChargingModel);
@ -415,6 +429,16 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
}
//查询是否是未执行状态
map = xhpcTimingChargingModelMapper.getXhpcTimingChargingModelMapById(timingChargingModelId,loginUser.getTenantId());
if(map.get("pileIds")!=null){
String[] split = map.get("pileIds").toString().split(",");
Integer [] piles =new Integer [split.length];
for (int i = 0; i <split.length ; i++) {
String s = split[i];
piles[i] = Integer.parseInt(s);
}
map.put("chargingPileIds",piles);
}
//费率
List<Map<String, Object>> xhpcRateList = xhpcTimingChargingModelMapper.getXhpcTimingChargingRateList(timingChargingModelId);

View File

@ -88,7 +88,7 @@ public class XhpcTimingChargingPowerServiceImpl implements IXhpcTimingChargingPo
String st ="";
for (int i = 0; i <chargingPileIds.length ; i++) {
if(i==0 && chargingPileIds.length>1){
st =st+chargingPileIds[i]+",";
st =st+chargingPileIds[i];
}else if(chargingPileIds.length==1){
st =chargingPileIds[i]+"";
}else{

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -599,7 +599,8 @@
tcm.timing_time as timingTime,
tcm.status as status,
tcm.create_time as createTime,
tcm.phone as phone
tcm.phone as phone,
tcm.pile_ids as pileIds
from xhpc_timing_charging_model as tcm
left join xhpc_charging_station as cs on cs.charging_station_id = tcm.charging_station_id
where tcm.timing_charging_model_id =#{timingChargingModelId}

View File

@ -159,9 +159,13 @@
</insert>
<select id="getXhpcTimingChargingPowerModelById" resultMap="BaseResultMap">
select * from xhpc_timing_charging_power where timing_charging_power_id =#{timingChargingPowerId} and del_flag=0
select xtcp.*,xcs.name as chargingStationName
from xhpc_timing_charging_power xtcp
left join xhpc_charging_station xcs on xtcp.charging_station_id = xcs.charging_station_id
where xtcp.timing_charging_power_id =#{timingChargingPowerId}
and xtcp.del_flag=0
<if test="tenantId !=null and ''!=tenantId">
and tenant_id=#{tenantId}
and xtcp.tenant_id=#{tenantId}
</if>
</select>

View File

@ -20,4 +20,6 @@ public class XhpcTimingChargingModelDto extends XhpcTimingChargingModel {
//默认时段费率
String defaultPeriodId;
}

View File

@ -56,4 +56,8 @@ public class XhpcTimingChargingModel extends BaseEntity {
private String tenantId;
private String phone;
private String pileIds;
private Integer [] chargingPileIds;
}

View File

@ -61,5 +61,7 @@ public class XhpcTimingChargingPowerModel extends BaseEntity {
private String pileIds;
private String chargingStationName;
private Integer [] chargingPileIds;
}

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -1,5 +1,6 @@
package com.xhpc.order.api;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.xhpc.common.api.WebSocketService;
@ -14,6 +15,7 @@ import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcHistoryOrderService;
import com.xhpc.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,10 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author yuyang
@ -221,7 +220,6 @@ public class XhpcChargeOrderController extends BaseController {
* @param userId
* @param serialNumber 终端编码
* @param type 1 微信
* @param type 1 微信
* @return
*/
@GetMapping("/cycStartUp")
@ -250,4 +248,11 @@ public class XhpcChargeOrderController extends BaseController {
return iXhpcChargeOrderService.chargingCapacityStartUp(request,userId, serialNumber, type,chargingCapacity);
}
@GetMapping("/ceshi")
public AjaxResult ceshi(String phone,String vin, String plateNnum,Long chargingStationId,String time){
String format = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
int blacklistUser = iXhpcChargeOrderService.getBlacklistUser(phone, vin, plateNnum, chargingStationId, format);
return AjaxResult.success(blacklistUser);
}
}

View File

@ -335,7 +335,7 @@ public class XhpcPileOrderController extends BaseController {
//停止充电
xhpcChargeOrder.setRemark("充电桩校验故障");
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
powerPileService.stopCharging(orderNo, substring,orderNo.substring(0, 16), "0A");
powerPileService.stopCharging(orderNo, substring,orderNo.substring(0, 16), "0C");
System.out.println("=====================p平台下发停止充电=============================="+xhpcChargeOrder.getSerialNumber());
return R.fail(500,"充电桩校验故障");
}
@ -538,7 +538,12 @@ public class XhpcPileOrderController extends BaseController {
xhpcChargeOrder.setEndTime(date);
xhpcChargeOrder.setChargingTime("0分");
xhpcChargeOrder.setChargingDegree(bigDecimal1);
xhpcChargeOrder.setType("199");
if(cacheMap.get("stopReasonHex")!=null){
xhpcChargeOrder.setType(cacheMap.get("stopReasonHex").toString());
}else{
xhpcChargeOrder.setType("199");
}
xhpcChargeOrder.setAmountCharged(bigDecimal1);
xhpcChargeOrder.setChargingTimeNumber(0L);
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
@ -557,7 +562,7 @@ public class XhpcPileOrderController extends BaseController {
xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue());
xhpcHistoryOrder.setVinNormal(xhpcChargeOrder.getVinNormal());
xhpcHistoryOrder.setType(1);
xhpcHistoryOrder.setChargingMode(xhpcChargeOrder.getChargingMode());
Map<String, Object> userMessage =new HashMap<>();
if(!UserTypeUtil.INTERNET_TYPE.equals(source)||(UserTypeUtil.INTERNET_TYPE.equals(source) && userId>1000)){
@ -906,6 +911,23 @@ public class XhpcPileOrderController extends BaseController {
// }else{
// xhpcHistoryOrderService.addXhpcChargeOrder(null,orderNo,1);
// }
//双枪修改逻辑查询是否是双枪
if(xhpcChargeOrder.getSunchaStatus()!=0){
String userType =UserTypeUtil.USER;
if(UserTypeUtil.COMMUNIT_TYPE==xhpcChargeOrder.getSource()){
userType =UserTypeUtil.COMMUNIT;
}else if(UserTypeUtil.CUSTOMERS_TYPE==xhpcChargeOrder.getSource()){
userType =UserTypeUtil.CUSTOMERS;
}
Map<String, Object> map = new HashMap<>();
if(xhpcChargeOrder.getSunchaStatus()==1){
map.put("aBalanceStatus",2);
}else{
map.put("bBalanceStatus",2);
}
String key = "user:" + xhpcChargeOrder.getUserId() + userType + ".order";
redisService.setCacheMap(key,map);
}
Date date = new Date();
xhpcChargeOrder.setStatus(2);
xhpcChargeOrder.setEndTime(date);
@ -947,6 +969,24 @@ public class XhpcPileOrderController extends BaseController {
if(status==0){
xhpcChargeOrder.setStatus(0);
xhpcChargeOrder.setStartTime(date);
//查询是否是双枪
if(xhpcChargeOrder.getSunchaStatus()!=0){
String userType =UserTypeUtil.USER;
if(UserTypeUtil.COMMUNIT_TYPE==xhpcChargeOrder.getSource()){
userType =UserTypeUtil.COMMUNIT;
}else if(UserTypeUtil.CUSTOMERS_TYPE==xhpcChargeOrder.getSource()){
userType =UserTypeUtil.CUSTOMERS;
}
Map<String, Object> map = new HashMap<>();
if(xhpcChargeOrder.getSunchaStatus()==1){
map.put("aBalanceStatus",0);
}else{
map.put("bBalanceStatus",0);
}
String key = "user:" + xhpcChargeOrder.getUserId() + userType + ".order";
redisService.setCacheMap(key,map);
}
} else{
xhpcChargeOrder.setStatus(-1);
xhpcChargeOrder.setDelFlag(1);

View File

@ -52,7 +52,7 @@ public class XhpcPileRegularInspectController extends BaseController {
//费率定时任务
@GetMapping("/getRateTime")
@Scheduled(cron = "0 0/4 * * * ?")
//@Scheduled(cron = "0 0/4 * * * ?")
public void getRateTime()
{
xhpcPileRegularInspectService.getRateTime();

View File

@ -64,10 +64,6 @@ public class XhpcStopChargingOrderController extends BaseController {
if(cacheMap.get("version") !=null){
version =cacheMap.get("version").toString();
}
System.out.println("=================111========停止充电命令已下发==================停止 充电=================="+serialNumberOrderMap);
System.out.println("=================111========停止充电命令已下发==================停止 充电=================="+serialNumberOrderMap);
System.out.println("=================111========停止充电命令已下发==================停止 充电=================="+serialNumberOrderMap);
R r = powerPileService.stopCharging(serialNumberOrderMap, serialNumberOrderMap.substring(0,14), serialNumberOrderMap.substring(0,16), version);
if(r.getCode()==200){

View File

@ -157,6 +157,9 @@ public class XhpcChargeOrder extends BaseEntity {
private String vinNormal;
private Integer chargingCapacity;
private Integer sunchaStatus;
public Integer getStopReasonEvcs() {
return stopReasonEvcs;
@ -494,4 +497,12 @@ public class XhpcChargeOrder extends BaseEntity {
public void setChargingCapacity(Integer chargingCapacity) {
this.chargingCapacity = chargingCapacity;
}
public Integer getSunchaStatus() {
return sunchaStatus;
}
public void setSunchaStatus(Integer sunchaStatus) {
this.sunchaStatus = sunchaStatus;
}
}

View File

@ -52,6 +52,15 @@ public interface XhpcChargeOrderMapper {
*/
int updateUserBalance(@Param("userId")Long userId, @Param("balance")BigDecimal balance);
/**
* 双枪修改金额
* @param userId
* @param balance
* @param sunchaStatus
* @return
*/
int updateUserSunchaBalance(@Param("userId")Long userId, @Param("balance")BigDecimal balance, @Param("sunchaStatus")Integer sunchaStatus);
/**
* 社区用户修改余额
* @param userId
@ -60,7 +69,14 @@ public interface XhpcChargeOrderMapper {
*/
int updateCommunityBalance(@Param("userId")Long userId, @Param("balance")BigDecimal balance);
/**
* 双枪修改金额
* @param userId
* @param balance
* @param sunchaStatus
* @return
*/
int updateCommunitySunchaBalance(@Param("userId")Long userId, @Param("balance")BigDecimal balance, @Param("sunchaStatus")Integer sunchaStatus);
/**
* B端用户修改余额
* @param userId
@ -68,6 +84,15 @@ public interface XhpcChargeOrderMapper {
* @return
*/
int updateCustomersBalance(@Param("userId")Long userId, @Param("balance")BigDecimal balance);
/**
* 双枪修改金额
* @param userId
* @param balance
* @param sunchaStatus
* @return
*/
int updateCustomersSunchaBalance(@Param("userId")Long userId, @Param("balance")BigDecimal balance, @Param("sunchaStatus")Integer sunchaStatus);
/**
* 更新川逸充用户余额
@ -248,5 +273,17 @@ public interface XhpcChargeOrderMapper {
//获取充电站信息
Map<String,Object> getChargingStationById(@Param("chargingStationId")Long chargingStationId);
//修改账户金额C端
int updateXhpcAppUser(@Param("userId")Long userId,@Param("aBalance")BigDecimal aBalance,@Param("bBalance")BigDecimal bBalance);
//修改账户金额社区用户
int updateXhpcCommunityPersonnel(@Param("userId")Long userId,@Param("aBalance")BigDecimal aBalance,@Param("bBalance")BigDecimal bBalance);
//修改账户金额B端用户
int updateXhpcCustomersPersonnel(@Param("userId")Long userId,@Param("aBalance")BigDecimal aBalance,@Param("bBalance")BigDecimal bBalance);
//查询是否可以充电
int getBlacklistUser(@Param("phone")String phone,@Param("vin")String vin,@Param("plateNnum")String plateNnum,@Param("chargingStationId")Long chargingStationId,@Param("time")String time);
}

View File

@ -5,6 +5,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcRate;
import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcOrderRedisRecord;
import org.apache.ibatis.annotations.Param;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
@ -114,6 +115,11 @@ public interface IXhpcChargeOrderService {
*/
int updateUserBalance(Long userId, BigDecimal balance,Integer source,String tenantId);
/**
* 修改双枪余额
*/
int updateUserSunchaBalance(Long userId, BigDecimal balance,Integer source,String tenantId,Integer sunchaStatus);
/**
* 获取运营商信息
* @param chargingStationId
@ -216,4 +222,11 @@ public interface IXhpcChargeOrderService {
*/
AjaxResult chargingCapacityStartUp(HttpServletRequest request, Long userId, String serialNumber, Integer type,Integer chargingCapacity);
/**
* 判断用户是否在充电中
*/
String countXhpcRealTimeOrder(Long userId,Integer source,String tenantId);
int getBlacklistUser(String phone,String vin,String plateNnum,Long chargingStationId,String time);
}

View File

@ -191,6 +191,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "此账号不能在该场站充电,请使用手机号登录");
}
}
xhpcChargeOrder.setDriverId(userMessage.get("phone").toString());
String pattern = "^([0-9]{16})";
Pattern compile = Pattern.compile(pattern);
@ -226,10 +227,16 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
if (Integer.parseInt(userMessage.get("isRefundApplication").toString()) != 0) {
return AjaxResult.error(1101, "你有申请退款订单在审核中,需要充电请取消申请退款");
}
//充电用户是否在充电中
String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId,userType,tenantId);
if (!"".equals(i) && i!=null) {
return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息");
// String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId,userType,tenantId);
// if (!"".equals(i) && i!=null) {
// return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息");
// }
if(Integer.valueOf(userMessage.get("sunchaSwitch").toString()) ==0){
//充电用户是否在充电中
String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId,userType,tenantId);
if (!"".equals(i) && i!=null) {
return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息");
}
}
//终端状态是否空闲
//是否插枪
@ -273,6 +280,15 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
}
}
//判断是否可以充电(黑名单)
int blacklistUser = xhpcChargeOrderMapper.getBlacklistUser(userMessage.get("phone").toString(), userMessage.get("vinSpecCode").toString(), userMessage.get("vehicleName").toString(), xhpcTerminal.getChargingStationId(), DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
if(blacklistUser>0){
return AjaxResult.error(1104, "该车辆暂停充电,请联系客服");
}
if(Integer.valueOf(userMessage.get("sunchaSwitch").toString()) !=0){
return startUpSuncha(userMessage,xhpcChargeOrder,xhpcTerminal,tenantId,userType,terminalSerialNumber,type);
}
//余额
String balance = new BigDecimal(userMessage.get("balance").toString()).multiply(new BigDecimal(100)).toString();
//获取桩信息
@ -332,6 +348,12 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
}
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<number>>>>>>>>>>>>>>>>>:"+number);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<Soc>>>>>>>>>>>>>>>>>:"+startChargingData.getSoc());
//创建充电订单(充电启动soc初始值结束是获取,并修改状态)
xhpcChargeOrder.setChargingStationId(xhpcTerminal.getChargingStationId());
@ -496,6 +518,19 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
return 0;
}
@Override
public int updateUserSunchaBalance(Long userId, BigDecimal balance, Integer source, String tenantId,Integer sunchaStatus) {
//修改用户余额
if(UserTypeUtil.USER_TYPE.equals(source)){
return xhpcChargeOrderMapper.updateUserSunchaBalance(userId, balance,sunchaStatus);
}else if (UserTypeUtil.COMMUNIT_TYPE.equals(source)){
return xhpcChargeOrderMapper.updateCommunitySunchaBalance(userId, balance,sunchaStatus);
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
return xhpcChargeOrderMapper.updateCustomersSunchaBalance(userId, balance,sunchaStatus);
}
return 0;
}
@Override
public Map<String, Object> getOperatorMessage(Long chargingStationId) {
@ -562,6 +597,9 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
r.setMsg("场站不支持该流量方充电");
return r;
}
StartChargingData startChargingData = new StartChargingData();
//500000 equals 500 yuan
startChargingData.setBalance(chargingAmt * 100);
@ -639,7 +677,13 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
}
}
//判断是否可以充电(黑名单)
int blacklistUser = xhpcChargeOrderMapper.getBlacklistUser(driverId, null, plateNum, xhpcTerminal.getChargingStationId(), DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
if(blacklistUser>0){
r.setCode(500);
r.setMsg("该车辆暂停充电,请联系客服");
return r;
}
//启动充电
//订单流水号 终端号+年月日时分秒+自增4位 共32位
@ -1817,6 +1861,225 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "请确认设备网络状况正常和枪正确插好后重新尝试");
}
@Override
public String countXhpcRealTimeOrder(Long userId, Integer source, String tenantId) {
return xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId,source,tenantId);
}
@Override
public int getBlacklistUser(String phone, String vin, String plateNnum, Long chargingStationId, String time) {
return xhpcChargeOrderMapper.getBlacklistUser(phone, vin, plateNnum, chargingStationId, time);
}
//判断双枪启规则
private AjaxResult startUpSuncha(Map<String, Object> userMessage,XhpcChargeOrder xhpcChargeOrder,XhpcTerminal xhpcTerminal,String tenantId,Integer source,String terminalSerialNumber,Integer type){
//余额
String balance = new BigDecimal(userMessage.get("balance").toString()).multiply(new BigDecimal(100)).toString();
Long appUserId = Long.valueOf(userMessage.get("appUserId").toString());
//获取桩信息
Map<String, Object> xhpcChargingPileById =xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(),tenantId);
String userType =UserTypeUtil.USER;
if(UserTypeUtil.COMMUNIT_TYPE==source){
userType =UserTypeUtil.COMMUNIT;
}else if(UserTypeUtil.CUSTOMERS_TYPE==source){
userType =UserTypeUtil.CUSTOMERS;
}
//判断是否有车充电
Map<String, Object> cacheMap = redisService.getCacheMap("user:" + appUserId + userType + ".order");
if(cacheMap!=null){
boolean a =true; //A账户未启动
boolean b =true; //b账户未启动
//查看AB账户启动情况
if(cacheMap.get("aBalanceStatus")!=null){
Integer status = Integer.valueOf(cacheMap.get("aBalanceStatus").toString());
if(status==0 || status==2){
a =false;
}
}
if(cacheMap.get("bBalanceStatus")!=null){
Integer status = Integer.valueOf(cacheMap.get("bBalanceStatus").toString());
if(status==0 || status==2){
b =false;
}
}
if(a && b){
//账号金额平分修改账号金额
BigDecimal aBigDecimal = new BigDecimal(userMessage.get("balance").toString()).divide(new BigDecimal(2)).setScale(0, BigDecimal.ROUND_UP);
BigDecimal bBigDecimal =new BigDecimal(userMessage.get("balance").toString()).subtract(aBigDecimal);
if(UserTypeUtil.USER_TYPE==source){
xhpcChargeOrderMapper.updateXhpcAppUser(appUserId,aBigDecimal,bBigDecimal);
}else if(UserTypeUtil.COMMUNIT_TYPE==source){
xhpcChargeOrderMapper.updateXhpcCommunityPersonnel(appUserId,aBigDecimal,bBigDecimal);
}else if(UserTypeUtil.CUSTOMERS_TYPE==source){
xhpcChargeOrderMapper.updateXhpcCustomersPersonnel(appUserId,aBigDecimal,bBigDecimal);
}
String key = "user:" + appUserId + userType + ".order";
redisService.deleteObject(key);
return getAjaxResult(userMessage, xhpcChargeOrder, xhpcTerminal, tenantId, source, terminalSerialNumber, type, xhpcChargingPileById, appUserId, userType, aBigDecimal.multiply(new BigDecimal(100)).toString(),1);
}else if(a){
BigDecimal bigDecimal = new BigDecimal(userMessage.get("aBalance").toString());
return getAjaxResult(userMessage, xhpcChargeOrder, xhpcTerminal, tenantId, source, terminalSerialNumber, type, xhpcChargingPileById, appUserId, userType, bigDecimal.multiply(new BigDecimal(100)).toString(),1);
}else{
BigDecimal bigDecimal = new BigDecimal(userMessage.get("bBalance").toString());
return getAjaxResult(userMessage, xhpcChargeOrder, xhpcTerminal, tenantId, source, terminalSerialNumber, type, xhpcChargingPileById, appUserId, userType, bigDecimal.multiply(new BigDecimal(100)).toString(),2);
}
}else{
//账号金额平分修改账号金额
BigDecimal aBigDecimal = new BigDecimal(balance).divide(new BigDecimal(2)).setScale(0, BigDecimal.ROUND_UP);
BigDecimal bBigDecimal =new BigDecimal(balance).subtract(aBigDecimal);
if(UserTypeUtil.USER_TYPE==source){
xhpcChargeOrderMapper.updateXhpcAppUser(appUserId,aBigDecimal,bBigDecimal);
}else if(UserTypeUtil.COMMUNIT_TYPE==source){
xhpcChargeOrderMapper.updateXhpcCommunityPersonnel(appUserId,aBigDecimal,bBigDecimal);
}else if(UserTypeUtil.CUSTOMERS_TYPE==source){
xhpcChargeOrderMapper.updateXhpcCustomersPersonnel(appUserId,aBigDecimal,bBigDecimal);
}
return getAjaxResult(userMessage, xhpcChargeOrder, xhpcTerminal, tenantId, source, terminalSerialNumber, type, xhpcChargingPileById, appUserId, userType, aBigDecimal.toString(),1);
}
}
private AjaxResult getAjaxResult(Map<String, Object> userMessage, XhpcChargeOrder xhpcChargeOrder, XhpcTerminal xhpcTerminal, String tenantId, Integer source, String terminalSerialNumber, Integer type, Map<String, Object> xhpcChargingPileById, Long appUserId, String userType, String bigDecimal,Integer sunchaStatus) {
//启动充电
StartChargingData startChargingData = new StartChargingData();
//订单流水号 终端号+年月日时分秒+自增4位 共32位
String orderNo = genOrder(terminalSerialNumber);
startChargingData.setOrderNo(orderNo);
if(userMessage.get("phone") !=null){
startChargingData.setTel(userMessage.get("phone").toString());
xhpcChargeOrder.setDriverId(userMessage.get("phone").toString());
}
startChargingData.setPileNo(xhpcTerminal.getPileSerialNumber());
startChargingData.setGunId(xhpcTerminal.getSerialNumber().substring(14));
startChargingData.setBalance(Double.valueOf(bigDecimal).intValue());
if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){
startChargingData.setVersion(xhpcChargingPileById.get("communicationProtocolVersion").toString());
}else{
startChargingData.setVersion("0A");
}
//用户平台最小的
int number =0;
if(!"".equals(userMessage.get("socUser")) && userMessage.get("socUser") !=null && userMessage.get("socProtect") !=null && !"0".equals(userMessage.get("socProtect").toString())){
number =Integer.parseInt(userMessage.get("socUser").toString());
logger.info("=========用户、桩、平台(最小的)===number==="+number);
}
//平台
String soc = redisService.getCacheObject("global:"+ tenantId +":SOC");
logger.info("=========用户、桩、平台(最小的)===soc==="+soc);
if(!"".equals(soc) && soc!=null){
if(number!=0){
if(Integer.parseInt(soc)-number<0){
number=Integer.parseInt(soc);
logger.info("=========用户、桩、平台最小的1===number==="+number);
}
}else{
number=Integer.parseInt(soc);
logger.info("=========用户、桩、平台最小的2===number==="+number);
}
}
Map<String, Object> operatorMessage = xhpcChargeOrderMapper.getOperatorMessage(xhpcTerminal.getChargingStationId());
if(operatorMessage !=null && operatorMessage.get("soc") !=null && !"".equals(operatorMessage.get("soc"))){
if(number!=0){
if(Integer.parseInt(operatorMessage.get("soc").toString())-number<0){
number=Integer.parseInt(operatorMessage.get("soc").toString());
logger.info("=========用户、桩、平台最小的3===number==="+number);
}
}else{
number=Integer.parseInt(operatorMessage.get("soc").toString());
logger.info("=========用户、桩、平台最小的4===number==="+number);
}
}
if(number !=0){
startChargingData.setSoc(number);
}
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<number>>>>>>>>>>>>>>>>>:"+number);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<Soc>>>>>>>>>>>>>>>>>:"+startChargingData.getSoc());
//创建充电订单(充电启动soc初始值结束是获取,并修改状态)
xhpcChargeOrder.setChargingStationId(xhpcTerminal.getChargingStationId());
xhpcChargeOrder.setUserId(appUserId);
xhpcChargeOrder.setTerminalId(xhpcTerminal.getTerminalId());
xhpcChargeOrder.setGunId(xhpcTerminal.getSerialNumber());
xhpcChargeOrder.setSerialNumber(orderNo);
xhpcChargeOrder.setSource(source);
xhpcChargeOrder.setStatus(-1);
xhpcChargeOrder.setTenantId(tenantId);
if (xhpcChargingPileById != null && xhpcChargingPileById.get("power") != null) {
xhpcChargeOrder.setPower(xhpcChargingPileById.get("power").toString());
}
if (type == 1) {
xhpcChargeOrder.setChargingMode("微信");
} else if (type == 2){
xhpcChargeOrder.setChargingMode("支付宝");
}else{
xhpcChargeOrder.setChargingMode("App");
}
xhpcChargeOrder.setCreateTime(Calendar.getInstance().getTime());
xhpcChargeOrder.setType("91");
if(sunchaStatus==1){
xhpcChargeOrder.setSunchaStatus(1);
}else{
xhpcChargeOrder.setSunchaStatus(2);
}
//获取车牌
Map<String, Object> xhpcUserVehicleMessage = xhpcChargeOrderMapper.getXhpcUserVehicleMessage(xhpcChargeOrder.getUserId(), xhpcChargeOrder.getSource());
if(xhpcUserVehicleMessage !=null && xhpcUserVehicleMessage.get("vehicleName") !=null){
xhpcChargeOrder.setPlateNum(xhpcUserVehicleMessage.get("vehicleName").toString());
}
xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
String finalUserType = userType;
executorService.execute(new Runnable() {
@Override
public void run() {
R r1 = powerPileService.startCharging(startChargingData);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<双枪充电返回>>>>>>>>>>>>>>>>>");
//添加缓存数据
String key = "user:" + appUserId + finalUserType + ".order";
Map<String, Object> map = new HashMap<>();
if(sunchaStatus==1){
map.put("aBalance", bigDecimal);
map.put("aBalanceStatus",-1);
}else{
map.put("bBalance", bigDecimal);
map.put("bBalanceStatus",-1);
}
redisService.setCacheMap(key,map);
if(r1.getCode() == 200){
try{
xhpcChargeOrder.setRateModelId(Long.valueOf(r1.getData().toString()));
xhpcChargeOrderMapper.updateXhpcChargeOrder(xhpcChargeOrder);
//插一帧实时数据
extracted(xhpcChargeOrder);
//修改双枪缓存状态
if(sunchaStatus==1){
map.put("aBalanceStatus",0);
}else{
map.put("bBalanceStatus",0);
}
redisService.setCacheMap(key,map);
}catch (Exception e){
e.printStackTrace();
logger.error("update order[{}] failed.", orderNo);
}
}
}
});
logger.info("<<<<<<<<<1111<<<<<<<<<<双枪启动<<<<<C端订单号>>>>>>>>>>>>>>>>>:" + orderNo+"用户id:"+ appUserId);
return AjaxResult.success();
}
public static void main(String[] args) {
try{
// //String alipayPublicKey1 = getAlipayPublicKey("C:\\Users\\Administrator\\Downloads\\alipayCertPublicKey_RSA2.crt");

View File

@ -60,29 +60,29 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
return AjaxResult.error(500, "请重新登录");
}
if(xhpcPileRegularInspect.getVersionNumberTime()==null || "".equals(xhpcPileRegularInspect.getVersionNumberTime())){
return AjaxResult.error(500, "版本号检查时间必填");
}
// if(xhpcPileRegularInspect.getVersionNumberTime()==null || "".equals(xhpcPileRegularInspect.getVersionNumberTime())){
// return AjaxResult.error(500, "版本号检查时间必填");
// }
if(xhpcPileRegularInspect.getTimingPriceTime()==null || "".equals(xhpcPileRegularInspect.getTimingPriceTime())){
return AjaxResult.error(500, "校时校价时间必填");
}
if(xhpcPileRegularInspect.getRateTime()==null || "".equals(xhpcPileRegularInspect.getRateTime())){
return AjaxResult.error(500, "费率时间必填");
}
if(xhpcPileRegularInspect.getCopyingAdministratorTime()==null || "".equals(xhpcPileRegularInspect.getCopyingAdministratorTime())){
return AjaxResult.error(500, "定期抄发给管理员时间必填");
}
try{
String[] split = xhpcPileRegularInspect.getVersionNumberTime().split(",");
for (int i = 0; i <split.length ; i++) {
int s = Integer.parseInt(split[i]);
if(s<0 ||s>24){
return AjaxResult.error(500, "版本号检查时间格式不对");
}
}
}catch (Exception e){
return AjaxResult.error(500, "版本号检查时间格式不对");
}
// if(xhpcPileRegularInspect.getRateTime()==null || "".equals(xhpcPileRegularInspect.getRateTime())){
// return AjaxResult.error(500, "费率时间必填");
// }
// if(xhpcPileRegularInspect.getCopyingAdministratorTime()==null || "".equals(xhpcPileRegularInspect.getCopyingAdministratorTime())){
// return AjaxResult.error(500, "定期抄发给管理员时间必填");
// }
// try{
// String[] split = xhpcPileRegularInspect.getVersionNumberTime().split(",");
// for (int i = 0; i <split.length ; i++) {
// int s = Integer.parseInt(split[i]);
// if(s<0 ||s>24){
// return AjaxResult.error(500, "版本号检查时间格式不对");
// }
// }
// }catch (Exception e){
// return AjaxResult.error(500, "版本号检查时间格式不对");
// }
try{
String[] split = xhpcPileRegularInspect.getTimingPriceTime().split(",");
for (int i = 0; i <split.length ; i++) {
@ -95,26 +95,26 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
return AjaxResult.error(500, "校时校价时格式不对");
}
try{
String[] split = xhpcPileRegularInspect.getRateTime().split(",");
for (int i = 0; i <split.length ; i++) {
int s = Integer.parseInt(split[i]);
if(s<0 ||s>24){
return AjaxResult.error(500, "定期抄发给管理员时间格式不对");
}
}
}catch (Exception e){
return AjaxResult.error(500, "定期抄发给管理员时间格式不对");
}
// try{
// String[] split = xhpcPileRegularInspect.getRateTime().split(",");
// for (int i = 0; i <split.length ; i++) {
// int s = Integer.parseInt(split[i]);
// if(s<0 ||s>24){
// return AjaxResult.error(500, "定期抄发给管理员时间格式不对");
// }
// }
// }catch (Exception e){
// return AjaxResult.error(500, "定期抄发给管理员时间格式不对");
// }
try{
String[] split = xhpcPileRegularInspect.getCopyingAdministratorTime().split(",");
for (int i = 0; i <split.length ; i++) {
int s = Integer.parseInt(split[i]);
if(s<0 ||s>24){
return AjaxResult.error(500, "费率式不对");
}
}
// String[] split = xhpcPileRegularInspect.getCopyingAdministratorTime().split(",");
// for (int i = 0; i <split.length ; i++) {
// int s = Integer.parseInt(split[i]);
// if(s<0 ||s>24){
// return AjaxResult.error(500, "费率式不对");
// }
// }
if(xhpcPileRegularInspect.getPileRegularInspectId()==null){
Map<String, Object> map = xhpcPileRegularInspectMapper.getPileRegularInspectTenantId(tenantId);
if(map !=null){

View File

@ -1323,6 +1323,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
final String refundTypes =refundType;
Map<String, Object> xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId());
// 另起线程处理业务上传redis数据
BigDecimal finalActPrice = actPrice;
executorService.execute(new Runnable() {
@Override
public void run() {
@ -1391,11 +1392,85 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1);
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
try{
//充电结算后自动申请退款
if(userMessage !=null && "1".equals(userMessage.get("isRefund").toString()) && map !=null){
if(UserTypeUtil.CHARGING_MODE_WX.equals(xhpcChargeOrder.getChargingMode()) ||UserTypeUtil.CHARGING_MODE_ZFB.equals(xhpcChargeOrder.getChargingMode()) ){
if(UserTypeUtil.USER_TYPE.equals(source) || UserTypeUtil.COMMUNIT_TYPE.equals(source)){
refundOrderService.sendNotice(balance2,openids,xhpcChargeOrder.getSource(),refundTypes,xhpcChargeOrder.getUserId().toString(),xhpcChargeOrder.getTenantId(),"充电结算自动申请退款");
//双枪修改逻辑查询是否是双枪
if(xhpcChargeOrder.getSunchaStatus()!=0){
String userType =UserTypeUtil.USER;
if(UserTypeUtil.COMMUNIT_TYPE==xhpcChargeOrder.getSource()){
userType =UserTypeUtil.COMMUNIT;
}else if(UserTypeUtil.CUSTOMERS_TYPE==xhpcChargeOrder.getSource()){
userType =UserTypeUtil.CUSTOMERS;
}
Map<String, Object> map = new HashMap<>();
String key = "user:" + xhpcChargeOrder.getUserId() + userType + ".order";
Map<String, Object> cacheMap = redisService.getCacheMap(key);
if(xhpcChargeOrder.getSunchaStatus()==1){
map.put("aBalanceStatus",1);
BigDecimal aBalance = new BigDecimal(cacheMap.get("aBalance").toString()).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_CEILING);
BigDecimal subtract = aBalance.subtract(finalActPrice);
map.put("aBalance",subtract.multiply(new BigDecimal(100)).toString());
xhpcChargeOrderService.updateUserSunchaBalance(userId, subtract,xhpcChargeOrder.getSource(),xhpcChargeOrder.getTenantId(),1);
}else{
map.put("bBalanceStatus",1);
BigDecimal bBalance = new BigDecimal(cacheMap.get("bBalance").toString()).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_CEILING);
BigDecimal subtract = bBalance.subtract(finalActPrice);
map.put("bBalance",subtract.multiply(new BigDecimal(100)).toString());
xhpcChargeOrderService.updateUserSunchaBalance(userId, subtract,xhpcChargeOrder.getSource(),xhpcChargeOrder.getTenantId(),2);
}
redisService.setCacheMap(key,map);
boolean a =true; //A账户未有充电中异常订单
boolean b =true; //b账户未有充电中异常订单
//查询所有状态
if(cacheMap.get("aBalanceStatus")!=null){
Integer status = Integer.valueOf(cacheMap.get("aBalanceStatus").toString());
if(status==0 || status==2){
a =false;
}
}
if(cacheMap.get("bBalanceStatus")!=null){
Integer status = Integer.valueOf(cacheMap.get("bBalanceStatus").toString());
if(status==0 || status==2){
b =false;
}
}
if(a && b){
String i = xhpcChargeOrderService.countXhpcRealTimeOrder(xhpcChargeOrder.getUserId(),xhpcChargeOrder.getSource(),xhpcChargeOrder.getTenantId());
if (!"".equals(i) && i!=null) {
//"车辆正在充电,请查询车辆充电信息"
}else{
//退款判断A+B账号金额 = 总金额
R user = userTypeService.getUser(null, userId, source, null, tenantId);
if(user !=null && user.getData() !=null ){
Map<String, Object> userMap = (Map<String, Object>)user.getData();
if (userMap == null || userMap.get("balance") == null) {
//获取用户信息失败
}else{
BigDecimal balance = new BigDecimal(userMap.get("balance").toString());
BigDecimal aBalance = new BigDecimal(userMap.get("aBalance").toString());
BigDecimal bBbalance = new BigDecimal(userMap.get("bBbalance").toString());
if(balance.compareTo(aBalance.add(bBbalance))==0){
//退款
if(userMessage !=null && "1".equals(userMessage.get("isRefund").toString()) && map !=null){
if(UserTypeUtil.CHARGING_MODE_WX.equals(xhpcChargeOrder.getChargingMode()) ||UserTypeUtil.CHARGING_MODE_ZFB.equals(xhpcChargeOrder.getChargingMode()) ){
if(UserTypeUtil.USER_TYPE.equals(source) || UserTypeUtil.COMMUNIT_TYPE.equals(source)){
refundOrderService.sendNotice(balance2,openids,xhpcChargeOrder.getSource(),refundTypes,xhpcChargeOrder.getUserId().toString(),xhpcChargeOrder.getTenantId(),"充电结算自动申请退款");
redisService.deleteObject(key);
}
}
}
}
}
}
}
}
}else{
//充电结算后自动申请退款
if(userMessage !=null && "1".equals(userMessage.get("isRefund").toString()) && map !=null){
if(UserTypeUtil.CHARGING_MODE_WX.equals(xhpcChargeOrder.getChargingMode()) ||UserTypeUtil.CHARGING_MODE_ZFB.equals(xhpcChargeOrder.getChargingMode()) ){
if(UserTypeUtil.USER_TYPE.equals(source) || UserTypeUtil.COMMUNIT_TYPE.equals(source)){
refundOrderService.sendNotice(balance2,openids,xhpcChargeOrder.getSource(),refundTypes,xhpcChargeOrder.getUserId().toString(),xhpcChargeOrder.getTenantId(),"充电结算自动申请退款");
}
}
}
}
@ -1421,6 +1496,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
evcsService.getCYCNotificationConnectorChargeStatus(orderMap);
logger.info("<<<<<<<<<22<<<<<<<川逸充,调用订单结束推送>>>>>>>>>>>>>orderMap>>>>"+orderMap.toString());
}
}
});
//小华充电二台子社区充电站 道闸

View File

@ -14,15 +14,15 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
#logging:
# level:
# com.xhpc.order.mapper: debug
logging:
level:
com.xhpc.order.mapper: debug

View File

@ -34,6 +34,7 @@
<result column="charging_time_number" property="chargingTimeNumber"/>
<result column="tenant_id" property="tenantId"/>
<result column="charging_capacity" property="chargingCapacity"/>
<result column="suncha_status" property="sunchaStatus"/>
</resultMap>
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
@ -144,13 +145,42 @@
<update id="updateUserBalance">
update xhpc_app_user set balance=#{balance} where app_user_id=#{userId}
</update>
<update id="updateUserSunchaBalance">
update xhpc_app_user
<set>
<if test="sunchaStatus==1">a_balance = #{balance}</if>
<if test="sunchaStatus==2">b_balance = #{balance}</if>
</set>
where app_user_id=#{userId}
</update>
<update id="updateCommunityBalance">
update xhpc_community_personnel set surplus_money=#{balance} where community_personnel_id=#{userId}
</update>
<update id="updateCommunitySunchaBalance">
update xhpc_community_personnel
<set>
<if test="sunchaStatus==1">a_balance = #{balance}</if>
<if test="sunchaStatus==2">b_balance = #{balance}</if>
</set>
where community_personnel_id=#{userId}
</update>
<update id="updateCustomersBalance">
update xhpc_customers_personnel set surplus_money=#{balance} where customers_personnel_id=#{userId}
</update>
<update id="updateCustomersSunchaBalance">
update xhpc_customers_personnel
<set>
<if test="sunchaStatus==1">a_balance = #{balance}</if>
<if test="sunchaStatus==2">b_balance = #{balance}</if>
</set>
where customers_personnel_id=#{userId}
</update>
<update id="updateAppInternetUserBalance">
update xhpc_app_internet_user set balance=#{balance} where app_internet_user_id=#{userId}
</update>
@ -279,6 +309,9 @@
<if test="null != chargingCapacity">
charging_capacity,
</if>
<if test="null != sunchaStatus">
suncha_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != chargingStationId ">
@ -365,6 +398,9 @@
<if test="null != chargingCapacity">
#{chargingCapacity},
</if>
<if test="null != sunchaStatus">
#{sunchaStatus},
</if>
</trim>
</insert>
@ -821,4 +857,49 @@
from xhpc_charging_station xcs
where xcs.charging_station_id =#{chargingStationId}
</select>
<update id="updateXhpcAppUser">
update xhpc_app_user set a_balance=#{aBalance}, b_balance =#{bBalance} where app_user_id=#{userId}
</update>
<update id="updateXhpcCommunityPersonnel">
update xhpc_community_personnel set a_balance=#{aBalance}, b_balance =#{bBalance} where community_personnel_id=#{userId}
</update>
<update id="updateXhpcCustomersPersonnel">
update xhpc_customers_personnel set a_balance=#{aBalance}, b_balance =#{bBalance} where customers_personnel_id=#{userId}
</update>
<select id="getBlacklistUser" resultType="int">
select count(blacklist_id)
from xhpc_blacklist
where distinguish =1
and (
<choose>
<when test="phone !=null and phone !='' and vin !=null and vin !='' and plateNnum !=null and plateNnum !=''">
phone=#{phone} or vin =#{vin} or plate_num=#{plateNnum}
</when>
<when test="phone !=null and phone !='' and vin !=null and vin !=''">
phone=#{phone} or vin =#{vin}
</when>
<when test="vin !=null and vin !='' and plateNnum !=null and plateNnum !=''">
vin =#{vin} or plate_num=#{plateNnum}
</when>
<when test="phone !=null and phone !='' and plateNnum !=null and plateNnum !=''">
phone=#{phone} or plate_num=#{plateNnum}
</when>
<when test="phone !=null and phone !=''">
phone=#{phone}
</when>
<when test="vin !=null and vin !=''">
vin =#{vin}
</when>
<otherwise>
plate_num=#{plateNnum}
</otherwise>
</choose>
)
and blacklist_id in (select mechanism_id from xhpc_mechanism where source =2 and del_flag =0 and charging_station_id =#{chargingStationId} )
and start_time &lt;= #{time} and end_time &gt;= #{time}
</select>
</mapper>

View File

@ -22,6 +22,7 @@ import com.xhpc.common.data.down.StartChargingData;
import com.xhpc.common.domain.XhpcRechargeOrder;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.domain.AlipayNotifyParam;
@ -74,6 +75,10 @@ public class AlipayPaymentController {
private IXhpcCommonPayment xhpcCommonPayment;
@Autowired
private UserTypeService userTypeService;
@Autowired
private RedisService redisService;
private ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
@ -303,34 +308,92 @@ public class AlipayPaymentController {
R user = userTypeService.getUser(null,userId, source, null, tenantId);
if(user !=null && user.getData() !=null){
Map<String, Object> map = (Map<String, Object>)user.getData();
String balance = StringUtils.valueOf(map.get("balance"));
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
//判断用户是否在充电中
String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId(),source,tenantId);
logger.info("<<<<<<<<<<<<充电终端>>>>>>>>>serialMumber"+serialMumber);
if(!"".equals(serialMumber) && serialMumber !=null){
//充电中
postRefreshBalance(money, serialMumber);
}
if(UserTypeUtil.USER_TYPE.equals(xhpcRechargeOrder.getSource())){
//增加用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
xhpcAppUser.setBalance(money);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
xhpcUserAccountStatement.setCreateTime(new Date());
xhpcUserAccountStatement.setRemark("支付宝充值订单!");
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
Integer sunchaSwitch = Integer.valueOf(map.get("sunchaSwitch").toString());
if(sunchaSwitch==0){
String balance = StringUtils.valueOf(map.get("balance"));
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
//判断用户是否在充电中
String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId(),source,tenantId);
logger.info("<<<<<<<<<<<<充电终端>>>>>>>>>serialMumber"+serialMumber);
if(!"".equals(serialMumber) && serialMumber !=null){
//充电中
postRefreshBalance(money, serialMumber);
}
if(UserTypeUtil.USER_TYPE.equals(xhpcRechargeOrder.getSource())){
//增加用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
xhpcAppUser.setBalance(money);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
xhpcUserAccountStatement.setCreateTime(new Date());
xhpcUserAccountStatement.setRemark("支付宝充值订单!");
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
}else{
//增加用户余额
userTypeService.insertUserBalance(xhpcRechargeOrder.getAmount(),userId,source,tenantId,UserTypeUtil.RECHARGE_ZHB,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
}
}else{
//增加用户余额
userTypeService.insertUserBalance(xhpcRechargeOrder.getAmount(),userId,source,tenantId,UserTypeUtil.RECHARGE_ZHB,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
String balance = StringUtils.valueOf(map.get("balance"));
BigDecimal aBigDecimal = xhpcRechargeOrder.getAmount().divide(new BigDecimal(2)).setScale(0, BigDecimal.ROUND_UP);
BigDecimal bBigDecimal =xhpcRechargeOrder.getAmount().subtract(aBigDecimal);
BigDecimal aBalance = new BigDecimal(map.get("aBalance").toString()).add(aBigDecimal);
BigDecimal bBalance = new BigDecimal(map.get("bBalance").toString()).add(bBigDecimal);
String userType =UserTypeUtil.USER;
if(UserTypeUtil.COMMUNIT_TYPE==xhpcRechargeOrder.getSource()){
userType =UserTypeUtil.COMMUNIT;
}else if(UserTypeUtil.CUSTOMERS_TYPE==xhpcRechargeOrder.getSource()){
userType =UserTypeUtil.CUSTOMERS;
}
String key = "user:" + xhpcRechargeOrder.getUserId() + userType + ".order";
//判断用户是否在充电中
String serialMumberA = xhpcUserAccountStatementMapper.getUserHistotyChargeOrderSuncha(xhpcRechargeOrder.getUserId(),source,tenantId,1);
if(!"".equals(serialMumberA) && serialMumberA !=null){
//充电中
postRefreshBalance(aBalance, serialMumberA);
Map<String, Object> mapA = new HashMap<>();
map.put("aBalance", aBalance);
redisService.setCacheMap(key,mapA);
}
String serialMumberB = xhpcUserAccountStatementMapper.getUserHistotyChargeOrderSuncha(xhpcRechargeOrder.getUserId(),source,tenantId,2);
if(!"".equals(serialMumberB) && serialMumberB !=null){
//充电中
postRefreshBalance(bBalance, serialMumberB);
Map<String, Object> mapA = new HashMap<>();
map.put("bBalance", bBalance);
redisService.setCacheMap(key,mapA);
}
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
if(UserTypeUtil.USER_TYPE.equals(xhpcRechargeOrder.getSource())){
//增加用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
xhpcAppUser.setBalance(money);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
xhpcUserAccountStatement.setCreateTime(new Date());
xhpcUserAccountStatement.setRemark("支付宝充值订单!");
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
}else{
//增加用户余额
userTypeService.insertUserBalance(xhpcRechargeOrder.getAmount(),userId,source,tenantId,UserTypeUtil.RECHARGE_ZHB,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
}
}
}
}
@ -347,7 +410,7 @@ public class AlipayPaymentController {
String s1 =money.multiply(new BigDecimal(100)).toString();
startChargingData.setBalance(Double.valueOf(s1).intValue());
R r = powerPileService.refreshBalance(startChargingData);
logger.info("<<<<<<<<<<<<余额下发>>>>>>>>>");
logger.info("<<<<<<<<<<<<余额下发>>>>>>>>>"+s1);
logger.info("<<<<<<<<<<<<"+r.getCode()+">>>>>>>>>");
logger.info("<<<<<<<<<<<<"+r.getMsg()+">>>>>>>>>");

View File

@ -13,6 +13,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.data.down.StartChargingData;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.domain.XhpcAppInternetUser;
@ -80,6 +81,9 @@ public class WxPaymentController {
private UserTypeService userTypeService;
@Autowired
private IXhpcCommonPayment xhpcCommonPayment;
@Autowired
private RedisService redisService;
private static final Logger logger = LoggerFactory.getLogger(WxPaymentController.class);
private ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
@ -445,33 +449,89 @@ public class WxPaymentController {
R user = userTypeService.getUser(null,userId, source, null, tenantId);
if(user !=null && user.getData() !=null){
Map<String, Object> map = (Map<String, Object>)user.getData();
String balance = StringUtils.valueOf(map.get("balance"));
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
//判断用户是否在充电中
String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId(),source,tenantId);
logger.info("<<<<<<<<<<<<充电终端>>>>>>>>>serialMumber"+serialMumber);
if(!"".equals(serialMumber) && serialMumber !=null){
//充电中
postRefreshBalance(money, serialMumber);
}
if(UserTypeUtil.USER_TYPE.equals(source)){
//增加用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
xhpcAppUser.setBalance(money);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
xhpcUserAccountStatement.setCreateTime(new Date());
xhpcUserAccountStatement.setRemark("微信充值订单!");
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
Integer sunchaSwitch = Integer.valueOf(map.get("sunchaSwitch").toString());
if(sunchaSwitch==0){
String balance = StringUtils.valueOf(map.get("balance"));
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
//判断用户是否在充电中
String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId(),source,tenantId);
logger.info("<<<<<<<<<<<<充电终端>>>>>>>>>serialMumber"+serialMumber);
if(!"".equals(serialMumber) && serialMumber !=null){
//充电中
postRefreshBalance(money, serialMumber);
}
if(UserTypeUtil.USER_TYPE.equals(source)){
//增加用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
xhpcAppUser.setBalance(money);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
xhpcUserAccountStatement.setCreateTime(new Date());
xhpcUserAccountStatement.setRemark("微信充值订单!");
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
}else{
//增加用户余额
userTypeService.insertUserBalance(xhpcRechargeOrder.getAmount(),userId,source,tenantId, UserTypeUtil.RECHARGE_WX,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
}
}else{
//增加用户余额
userTypeService.insertUserBalance(xhpcRechargeOrder.getAmount(),userId,source,tenantId, UserTypeUtil.RECHARGE_WX,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
String balance = StringUtils.valueOf(map.get("balance"));
BigDecimal aBigDecimal = xhpcRechargeOrder.getAmount().divide(new BigDecimal(2)).setScale(0, BigDecimal.ROUND_UP);
BigDecimal bBigDecimal =xhpcRechargeOrder.getAmount().subtract(aBigDecimal);
BigDecimal aBalance = new BigDecimal(map.get("aBalance").toString()).add(aBigDecimal);
BigDecimal bBalance = new BigDecimal(map.get("bBalance").toString()).add(bBigDecimal);
String userType =UserTypeUtil.USER;
if(UserTypeUtil.COMMUNIT_TYPE==xhpcRechargeOrder.getSource()){
userType =UserTypeUtil.COMMUNIT;
}else if(UserTypeUtil.CUSTOMERS_TYPE==xhpcRechargeOrder.getSource()){
userType =UserTypeUtil.CUSTOMERS;
}
String key = "user:" + xhpcRechargeOrder.getUserId() + userType + ".order";
//判断用户是否在充电中
String serialMumberA = xhpcUserAccountStatementMapper.getUserHistotyChargeOrderSuncha(xhpcRechargeOrder.getUserId(),source,tenantId,1);
if(!"".equals(serialMumberA) && serialMumberA !=null){
//充电中
Map<String, Object> mapA = new HashMap<>();
map.put("aBalance", aBalance);
redisService.setCacheMap(key,mapA);
postRefreshBalance(aBalance, serialMumberA);
}
String serialMumberB = xhpcUserAccountStatementMapper.getUserHistotyChargeOrderSuncha(xhpcRechargeOrder.getUserId(),source,tenantId,2);
if(!"".equals(serialMumberB) && serialMumberB !=null){
//充电中
Map<String, Object> mapA = new HashMap<>();
map.put("bBalance", bBalance);
redisService.setCacheMap(key,mapA);
postRefreshBalance(bBalance, serialMumberB);
}
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
if(UserTypeUtil.USER_TYPE.equals(source)){
//增加用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
xhpcAppUser.setBalance(money);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
xhpcUserAccountStatement.setCreateTime(new Date());
xhpcUserAccountStatement.setRemark("微信充值订单!");
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
}else{
//增加用户余额
userTypeService.insertUserBalance(xhpcRechargeOrder.getAmount(),userId,source,tenantId, UserTypeUtil.RECHARGE_WX,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
}
}
}
}
@ -490,7 +550,7 @@ public class WxPaymentController {
String s1 =money.multiply(new BigDecimal(100)).toString();
startChargingData.setBalance(Double.valueOf(s1).intValue());
R r = powerPileService.refreshBalance(startChargingData);
logger.info("<<<<<<<<<<<<余额下发>>>>>>>>>");
logger.info("<<<<<<<<<<<<余额下发>>>>>>>>>"+s1);
logger.info("<<<<<<<<<<<<"+r.getCode()+">>>>>>>>>");
logger.info("<<<<<<<<<<<<"+r.getMsg()+">>>>>>>>>");
if(r.getCode() !=200){

View File

@ -411,7 +411,7 @@ public class XhpcRefundOriginalOrderController extends BaseController {
//川逸充自动退款 每5分钟一次
@Scheduled(cron = "0 0/5 * * * ? ")
//@Scheduled(cron = "0 0/5 * * * ? ")
@GetMapping("/cycMoneyPage")
public void cycMoneyPage(){
logger.info("++++++++++++川逸充没有充电订单自动退款 每5分钟一次++++++++++++++++");

View File

@ -80,4 +80,5 @@ public interface XhpcUserAccountStatementMapper {
*/
String getUserHistotyChargeOrder(@Param("userId") Long userId,@Param("source") Integer source,@Param("tenantId")String tenantId);
String getUserHistotyChargeOrderSuncha(@Param("userId") Long userId,@Param("source") Integer source,@Param("tenantId")String tenantId,@Param("sunchaStatus")Integer sunchaStatus);
}

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -244,4 +244,11 @@
from xhpc_terminal
where terminal_id =(select terminal_id from xhpc_charge_order where user_id = #{userId} and source=#{source} and tenant_id=#{tenantId} and status=0 and del_flag =0 limit 1)
</select>
<select id="getUserHistotyChargeOrderSuncha" resultType="String">
select
serial_number as serialMumber
from xhpc_terminal
where terminal_id =(select terminal_id from xhpc_charge_order where user_id = #{userId} and source=#{source} and tenant_id=#{tenantId} and status=0 and del_flag =0 and suncha_status=#{sunchaStatus} limit 1)
</select>
</mapper>

View File

@ -418,7 +418,7 @@ public class ChargingController {
String pileNo = startChargingData.getPileNo();
String pkey = "pile:".concat(pileNo);
log.info("==================pkey======================"+pkey);
//log.info("==================pkey======================"+pkey);
Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
R<Object> r = checkPile(cachePile);
if (r.getCode() == 200) {
@ -542,10 +542,10 @@ public class ChargingController {
// Integer FFFF = HexUtils.reverseHexInt("0452");
// System.out.println("51 转化成="+FFFF);
Integer F402 = HexUtils.reverseHexInt("4C");
System.out.println("F402 转化成="+F402);
// Integer F402 = HexUtils.reverseHexInt("D8400000");
// System.out.println("F402 转化成="+F402);
// Integer D007 = HexUtils.reverseHexInt("D007");
// Integer D007 = HexUtils.reverseHexInt("0CF30500");
// System.out.println("D007 转化成="+D007);
//
// Integer F620 = HexUtils.reverseHexInt("F620");
@ -591,16 +591,18 @@ public class ChargingController {
// System.out.println(df.format(v));
// String s = CP56Time2a.p56toDateStr("C05D2011200318");
//
// System.out.println("-111-变为--:" + s);
//
// String s1 = cp56toDateStr("88903507220418");
//
// System.out.println("-111-变为--:" + s1);
String ascii = HexUtils.toAscii("4C465A3733464C34374E44303032343535");
// String ascii = HexUtils.toAscii("4C465A3733464C34374E44303032343535");
//
// System.out.println("ascii :"+ascii);
System.out.println("ascii :"+ascii);
}
}

View File

@ -433,6 +433,7 @@ public class PileController {
@PostMapping("pile/{pileNo}/{powerNumber}/configSettings")
public R pileConfigSettings(@PathVariable("pileNo") String pileNo,@PathVariable("powerNumber") String powerNumber) {
String pkey = "pile:".concat(pileNo);
Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
R<Object> r = checkPileConfig(cachePile);

View File

@ -40,7 +40,6 @@ public class StationController {
public void addNotificationStationInfo(@RequestParam("stationId")Long stationId){
CDStationInfo xhpcChargingStation = deviceMessageMapper.getXhpcChargingStation(stationId);
if(xhpcChargingStation !=null){
System.out.println("=================生成场站推送数据信息===================");
//场站信息入缓存
String skey = "cdjgpc:station:".concat(stationId.toString())+".notification";
REDIS.deleteObject(skey);

View File

@ -18,6 +18,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.Map;
@ -42,10 +43,45 @@ public class BmsReqChargerOutputDataLogic implements ServiceLogic {
ObjectMapper objectMapper = new ObjectMapper();
BmsReqChargerOutputData orderData = objectMapper.convertValue(req, BmsReqChargerOutputData.class);
String hex = (String) req.get("hex");
int idxStart = 60;
int bmsVoltageRequest = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 电压需求
idxStart = 4 + idxStart;
int bmsCurrentRequest = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 电流需求
idxStart = 6 + idxStart;
int bmsChargingVolt = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 充电电压测量值
idxStart = 4 + idxStart;
int bmsChargingCurrent = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 充电电流测量值
idxStart = 88;
int pileVoltageOutput = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//电桩电压输出值
idxStart = 4 + idxStart;
int pileCurrentOutput = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//电桩电流输出值
String orderNo = (String) req.get("orderNo");
String orderKey = "order:".concat(orderNo).concat(".bms");
orderData.setBmsVoltageRequest(bmsVoltageRequest+"");
orderData.setBmsCurrentRequest(bmsCurrentRequest+"");
orderData.setBmsChargingVolt(bmsChargingVolt+"");
orderData.setBmsChargingCurrent(bmsChargingCurrent+"");
orderData.setPileVoltageOutput(pileVoltageOutput+"");
orderData.setPileCurrentOutput(pileCurrentOutput+"");
CacheBmsReqChargerOutputData cacheBmsReqChargerOutputData = translate(orderData);
REDIS.setCacheObject(orderKey, cacheBmsReqChargerOutputData);
pileOrderService.pileRimeOrderBms(orderNo);
@ -67,16 +103,44 @@ public class BmsReqChargerOutputDataLogic implements ServiceLogic {
cacheBmsReqChargerOutputData.setOrderNo(orderData.getOrderNo());
cacheBmsReqChargerOutputData.setPileNo(orderData.getPileNo());
cacheBmsReqChargerOutputData.setGunId(orderData.getGunId());
cacheBmsReqChargerOutputData.setBmsVoltageRequest(convertDouble(HexUtils.reverseHexInt(orderData.getBmsVoltageRequest()) * 0.1));
cacheBmsReqChargerOutputData.setBmsCurrentRequest(convertDouble(HexUtils.reverseHexInt(orderData.getBmsCurrentRequest()) * 0.1));
cacheBmsReqChargerOutputData.setBmsVoltageRequest(new BigDecimal(orderData.getBmsVoltageRequest()).divide(new BigDecimal(10),BigDecimal.ROUND_DOWN).doubleValue());
try{
BigDecimal subtract1 = new BigDecimal(orderData.getBmsCurrentRequest()).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
if(subtract1.compareTo(new BigDecimal(0))<0){
subtract1 =subtract1.abs();
}
cacheBmsReqChargerOutputData.setBmsCurrentRequest(subtract1.doubleValue());
}catch (Exception e){
}
cacheBmsReqChargerOutputData.setBmsChargingMod(HexUtils.reverseHexInt(orderData.getBmsChargingMod()));
cacheBmsReqChargerOutputData.setBmsChargingVolt(convertDouble(HexUtils.reverseHexInt(orderData.getBmsChargingVolt()) * 0.1));
cacheBmsReqChargerOutputData.setBmsChargingCurrent(convertDouble(HexUtils.reverseHexInt(orderData.getBmsChargingCurrent()) * 0.1));
cacheBmsReqChargerOutputData.setBmsChargingVolt(new BigDecimal(orderData.getBmsChargingVolt()).divide(new BigDecimal(10),BigDecimal.ROUND_DOWN).doubleValue());
try{
BigDecimal subtract2 = new BigDecimal(orderData.getBmsChargingCurrent()).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
if(subtract2.compareTo(new BigDecimal(0))<0){
subtract2 =subtract2.abs();
}
cacheBmsReqChargerOutputData.setBmsChargingCurrent(subtract2.doubleValue());
}catch (Exception e){
}
cacheBmsReqChargerOutputData.setMonoBatteryVolt(convertDouble(Integer.parseInt(orderData.getMonoBatteryVoltGroupId().substring(0, 3), 16) * 0.01));
cacheBmsReqChargerOutputData.setSoc(HexUtils.reverseHexInt(orderData.getSoc()));
cacheBmsReqChargerOutputData.setBmsEstRemainingTime(HexUtils.reverseHexInt(orderData.getBmsEstRemainingTime()));
cacheBmsReqChargerOutputData.setPileVoltageOutput(convertDouble(HexUtils.reverseHexInt(orderData.getPileVoltageOutput()) * 0.1));
cacheBmsReqChargerOutputData.setPileCurrentOutput(convertDouble(HexUtils.reverseHexInt(orderData.getPileVoltageOutput()) * 0.1));
cacheBmsReqChargerOutputData.setPileVoltageOutput(new BigDecimal(orderData.getPileVoltageOutput()).divide(new BigDecimal(10),BigDecimal.ROUND_DOWN).doubleValue());
try{
BigDecimal subtract = new BigDecimal(orderData.getPileCurrentOutput()).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
if(subtract.compareTo(new BigDecimal(0))<0){
subtract =subtract.abs();
}
cacheBmsReqChargerOutputData.setPileCurrentOutput(subtract.doubleValue());
}catch (Exception e){
}
cacheBmsReqChargerOutputData.setChargingTimeSummary(HexUtils.reverseHexInt(orderData.getChargingTimeSummary()));
cacheBmsReqChargerOutputData.setMonoBatteryVoltGroupId(Integer.parseInt(orderData.getMonoBatteryVoltGroupId().substring(3), 16));
cacheBmsReqChargerOutputData.setHex(orderData.getHex());
@ -94,4 +158,36 @@ public class BmsReqChargerOutputDataLogic implements ServiceLogic {
return Double.parseDouble(nf.format(oldVar));
}
public static void main(String[] args) {
String hex = "68300C4F0023808360002800010124013106220062138083600028000101420E730C026C0DC30C58012656005801730C00006EB3";
int idxStart = 64;
int bmsCurrentRequest = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 电流需求
System.out.println("===================bmsCurrentRequest========================="+bmsCurrentRequest);
System.out.println("===================bmsCurrentRequest========================="+bmsCurrentRequest);
System.out.println("===================bmsCurrentRequest========================="+bmsCurrentRequest);
idxStart = 88;
int pileVoltageOutput = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//电桩电压输出值
System.out.println("===================pileVoltageOutput========================="+pileVoltageOutput);
System.out.println("===================pileVoltageOutput========================="+pileVoltageOutput);
System.out.println("===================pileVoltageOutput========================="+pileVoltageOutput);
idxStart = 4 + idxStart;
int pileCurrentOutput = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//电桩电流输出值
System.out.println("===================pileCurrentOutput========================="+pileCurrentOutput);
System.out.println("===================pileCurrentOutput========================="+pileCurrentOutput);
System.out.println("===================pileCurrentOutput========================="+pileCurrentOutput);
BigDecimal subtract1 = new BigDecimal(2904).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
if(subtract1.compareTo(new BigDecimal(0))<0){
subtract1 =subtract1.abs();
}
System.out.println("===================subtract1========================="+subtract1);
BigDecimal subtract = new BigDecimal(2905).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
if(subtract.compareTo(new BigDecimal(0))<0){
subtract =subtract.abs();
}
System.out.println("===================subtract========================="+subtract);
}
}

View File

@ -57,9 +57,6 @@ public class OrderDataLogic implements ServiceLogic {
public ServiceResult service(ServiceParameter sp) throws Exception {
Map<String, Object> req = sp.getParameters();
log.info("================订单结束报文==============================");
log.info("================订单结束报文================req=============="+req.toString());
log.info("================订单结束报文==============================");
ObjectMapper objectMapper = new ObjectMapper();
OrderData orderData = objectMapper.convertValue(req, OrderData.class);
String orderNo = orderData.getOrderNo();
@ -155,6 +152,6 @@ public class OrderDataLogic implements ServiceLogic {
Integer stopReasonInt = Integer.valueOf("72", 16);
System.out.println(stopReasonInt);
String st ="充电完成(0X".concat("72").concat(")");
System.out.println("==========st==========="+st);
//System.out.println("==========st==========="+st);
}
}

View File

@ -38,7 +38,9 @@ public class PileConfigReplyDataLogic implements ServiceLogic {
int hibsn = Integer.parseInt(hex.substring(idxStart, 2 + idxStart), 16);
try{
if(hibsn==1){
String nacosServer = REDIS.getCacheObject(serialNumber+":powerNumber").toString();
log.error("进入入库步骤");
System.out.println();
String nacosServer = REDIS.getCacheObject("pile:"+serialNumber+":powerNumber").toString();
deviceMessageMapper.updateXhpcChargingPile(serialNumber,Integer.valueOf(nacosServer));
}
}catch (Exception e){

View File

@ -53,10 +53,8 @@ public class PileStartChargingDataLogic implements ServiceLogic {
@Override
public ServiceResult service(ServiceParameter sp) throws Exception {
log.info("=============================刷卡启动=======sp================================"+sp.toString());
String resultStr = "00";
String result = ServiceResult.HEX_00;
log.info("=============================刷卡启动=======sp.getParameters================================"+sp.getParameters());
Map<String, Object> req = sp.getParameters();
ObjectMapper objectMapper = new ObjectMapper();
PileStartChargingData pileStartChargingData = objectMapper.convertValue(req, PileStartChargingData.class);
@ -78,30 +76,20 @@ public class PileStartChargingDataLogic implements ServiceLogic {
} else {
physicCardNo = accountOrCardNo;
}
log.info("=============================刷卡启动=======启动================================"+physicCardNo);
criteria.andCardidEqualTo(physicCardNo);//.andCorpnoEqualTo(corpNo); // todo remove corpNo alrity
List<IccardInfo> iccardInfos = iccardInfoMapper.selectByExample(example);
log.info("=============================刷卡启动=======返回================================"+iccardInfos.size());
log.info("=============================刷卡启动=======iccardInfos================================"+iccardInfos.toString());
log.info("=============================刷卡启动=======返回================================");
if (iccardInfos.size() == 1) {
IccardInfo iccardInfo = iccardInfos.get(0);
if (iccardInfo.getCardtype() == 0) {
resultStr = INVALID_OPERATOR;
} else {
log.info("=============================刷卡启动=======调用订单接口================================");
// 调用订单接口
cardNo = iccardInfo.getCardno();
Integer rateModelId = pileStartChargingData.getRateModelId(); // todo not very strict.
if (rateModelId == null)
rateModelId = ((Long) REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)),
"rateModelId")).intValue();
log.info("=============================刷卡启动=======调用订单接口================================"+cardNo.toString());
log.info("=============================刷卡启动=======调用订单接口================================"+connectorId.toString());
log.info("=============================刷卡启动=======调用订单接口================================"+rateModelId.toString());
R r = cardService.cardStartup(cardNo, connectorId, rateModelId.toString());
log.info("=============================刷卡启动=======r================================"+r.getCode());
log.info("=============================刷卡启动=======r================================"+r.getMsg());
int code = r.getCode();
if (code == 200) {
result = ServiceResult.HEX_01;
@ -162,10 +150,6 @@ public class PileStartChargingDataLogic implements ServiceLogic {
R r = pileOrderService.pileVin(connectorId, vinCode);
int code = r.getCode();
log.info("=============================VIN码充电=======返回================================");
log.info("=============================VIN码充电=======返回================================"+code);
log.info("=============================VIN码充电=======返回================================");
if (code == 200) {
if(r.getData() == null){
return new ServiceResult(ServiceResult.FAIL);
@ -219,15 +203,9 @@ public class PileStartChargingDataLogic implements ServiceLogic {
Integer startFlag = result.equals(ServiceResult.HEX_01) ? 2: 4;
log.info("======================ServiceResult.HEX_01========================="+ServiceResult.HEX_01);
log.info("======================result========================="+result);
log.info("======================startFlag========================="+startFlag);
String pushOrderKey = "pushOrder:".concat(orderNo);
Map<String, Object> pushOrder = REDIS.getCacheMap(pushOrderKey);
if (pushOrder != null) {
log.info("======================startChargeSeqStat========================="+startFlag);
REDIS.setCacheMapValue(pushOrderKey, "startChargeSeqStat", startFlag);
} else {
Map map = new HashMap<>();
@ -244,8 +222,6 @@ public class PileStartChargingDataLogic implements ServiceLogic {
deviceMessage.setContent((String) req.get("hex"));
deviceMessageMapper.insertByDomain(deviceMessage);
log.info("===========PileStartChargingDataLogic===========发送报文=========================");
return new ServiceResult(HexUtils.toBytes(hex), result);
}

View File

@ -1,7 +1,6 @@
package com.xhpc.pp.logic;
import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.common.data.redis.CacheRateModel;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
@ -38,7 +37,6 @@ public class RateModelValidateLogic implements ServiceLogic {
Map<String, Object> req = sp.getParameters();
String pileNo = (String) req.get("pileNo");
String rateModelIdStr = req.get("rateModelId").toString();
System.out.println("=================rateModelIdStr==================="+rateModelIdStr);
Map<String, Object> cachePile = REDIS.getCacheMap("pile:".concat(pileNo));
Integer gunNum = (Integer) cachePile.get("gunNum");
@ -70,13 +68,11 @@ public class RateModelValidateLogic implements ServiceLogic {
String skey = "pile:".concat(pileNo).concat(".seqhex");
String seq = seqHex(skey);
String resultStr;
if (!"0C".equals(version)){
System.out.println("=======111==========version==================="+version);
resultStr = "680E".concat(seq).concat("0006").concat(pileNo).concat(String.format("%04X", csRateModelId)).concat(hexCode);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
}else{
System.out.println("=======2222==========version==================="+version);
System.out.println("=======2222==========version==================="+HexUtils.toHexInt(csRateModelId));
resultStr = "6810".concat(seq).concat("0006").concat(pileNo).concat(HexUtils.toHexInt(csRateModelId)).concat(hexCode);
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
}

View File

@ -165,17 +165,11 @@ public class RealtimeDataLogic implements ServiceLogic {
cacheOrder.put("lastOrderTime", DateUtil.now());
R r1 = pileOrderService.pileRimeOrder(orderNo);
if (r1 == null || (r1.getMsg()!=null && r1.getMsg().contains("无效订单")) || (r1.getCode() >=500 && r1.getCode() != 3886)) {
System.out.println("==========================无效订单============");
System.out.println("==========================r1.getCode()=================="+r1.getCode());
chargingController.stopInvalidOrder(orderNo);
} else {
Integer vul = (Integer) cachePile.get("voltageUpperLimits");
Integer cul = (Integer) cachePile.get("currentLimit");
if(vul != null && cul != null && (wc > cul || wv > vul)) {
System.out.println("==========================wc=========停止 充电======充电传电流============"+wc);
System.out.println("==========================cul=========停止 充电=================="+cul);
System.out.println("==========================wv=========停止 充电=================="+wv);
System.out.println("==========================vul=========停止 充电=================="+vul);
System.out.println("==========================wc > cul || wv > vul==================停止 充电=================="+pileNo);
R r = chargingController.stopCharging(pileNo, gunId, default_version);
if (r.getCode() == 200) {
@ -186,8 +180,6 @@ public class RealtimeDataLogic implements ServiceLogic {
} else {
Integer stopSoc = (Integer) cacheOrder.get("stopSoc");
if (stopSoc != null && socInt >= stopSoc) {
System.out.println("==========================stopSoc===="+stopSoc+"==============停止 充电=================="+pileNo);
System.out.println("==========================socInt====="+socInt+"=============停止 充电=================="+pileNo);
R r = chargingController.stopCharging(pileNo, gunId, default_version);
String alerted = (String) cacheOrder.get("socalerted");
String tel = (String) cacheOrder.get("tel");
@ -211,9 +203,6 @@ public class RealtimeDataLogic implements ServiceLogic {
Integer amountCharged =cacheRealtimeData.getAmountCharged();
if(chargingDegree < 10000 && amountCharged > 200000){
// 充电度数小于1并且充电金额大于10
System.out.println("==========================chargingDegree < 10000==================停止 充电=================="+pileNo);
System.out.println("==========================chargingDegree < 10000==================停止 充电=================="+pileNo);
System.out.println("==========================chargingDegree < 10000==================停止 充电=================="+pileNo);
R r = chargingController.stopCharging(pileNo, gunId, default_version);
}
@ -241,9 +230,6 @@ public class RealtimeDataLogic implements ServiceLogic {
cacheRealtimeData.getAmountCharged(),
cacheRealtimeData.getOrderNo());
chargingController.stopCharging(pileNo, gunId, default_version);
System.out.println("==========================实时数据充电度数:{}, 实时充电金==================停止 充电=================="+pileNo);
System.out.println("==========================实时数据充电度数:{}, 实时充电金==================停止 充电=================="+pileNo);
System.out.println("==========================实时数据充电度数:{}, 实时充电金==================停止 充电=================="+pileNo);
}
}
}
@ -270,9 +256,6 @@ public class RealtimeDataLogic implements ServiceLogic {
cacheOrder.put("abnormal", "1.2 lord as orderData");
log.error("abnormal.1.2 order[{}]", orderNo);
}
System.out.println("==========================abnormal.1.2 orde==================停止 充电=================="+pileNo);
System.out.println("==========================abnormal.1.2 orde==================停止 充电=================="+pileNo);
System.out.println("==========================abnormal.1.2 orde==================停止 充电=================="+pileNo);
chargingController.stopCharging(pileNo, gunId, default_version);
cacheOrder.put("status", "空闲>2下发中止");
if (r == null || r.getCode() != 200) {
@ -285,9 +268,6 @@ public class RealtimeDataLogic implements ServiceLogic {
REDIS.setCacheMap(orderkey, cacheOrder);
} else {
if (statusInt == 3) {
System.out.println("==========================statusInt == 3==================停止 充电=================="+pileNo);
System.out.println("==========================statusInt == 3==================停止 充电=================="+pileNo);
System.out.println("==========================statusInt == 3==================停止 充电=================="+pileNo);
chargingController.stopCharging(pileNo, gunId, default_version);
Integer bpcnt = (Integer) cacheGun.get("pleek.bp.cnt");
cacheGun.put("pleek.bp.cnt", bpcnt==null?1:bpcnt++);

View File

@ -63,10 +63,7 @@ public class RemoteStartReplyDataLogic implements ServiceLogic {
REDIS.setCacheMap(gunkey, cacheGun);
String pushOrderKey = orderkey.replace("order:", "pushOrder:");
Map<String, Object> pushOrder = REDIS.getCacheMap(pushOrderKey);
log.info("===================11===启动成功或失败===11==RemoteStartReplyDataLogic===================="+remoteStartReplyData.toString());
log.info("===================222===启动成功或失败===33==RemoteStartReplyDataLogic===================="+remoteStartReplyData.getStartResult());
if (HEX_01.equals(remoteStartReplyData.getStartResult())) {
log.info("======================启动充电成功=====RemoteStartReplyDataLogic====================");
final String orderstarttime = DateUtil.format(Calendar.getInstance().getTime(), NORM_DATETIME_FORMAT);
cacheGun.put("pileStartTime", orderstarttime);
cacheGun.put("orderstoptime", null);
@ -78,24 +75,19 @@ public class RemoteStartReplyDataLogic implements ServiceLogic {
REDIS.setCacheMap(orderkey, cacheOrder);
pileOrderService.pileStartup(orderNo, 1, "启动充电成功");
if (pushOrder != null) {
log.info("==========11========RemoteStartReplyDataLogic======11==============");
REDIS.setCacheMapValue(pushOrderKey, "startChargeSeqStat", 2);
} else {
log.info("==========22========RemoteStartReplyDataLogic======22==============");
Map map = new HashMap<>();
map.put("startChargeSeqStat", Integer.valueOf(2));
REDIS.setCacheMap(pushOrderKey, map);
}
} else {
log.info("======================启动成功或失败=====RemoteStartReplyDataLogic====================");
final String remark = frs.get(remoteStartReplyData.getFailReason());
pileOrderService.pileStartup(orderNo, 2, remark == null ? "未知错误" : remark);
if (pushOrder != null) {
log.info("==========33========RemoteStartReplyDataLogic======33==============");
REDIS.setCacheMapValue(pushOrderKey, "startChargeSeqStat", 4);
} else {
log.info("=========44========RemoteStartReplyDataLogic======44==============");
Map map = new HashMap<>();
map.put("startChargeSeqStat", Integer.valueOf(4));
REDIS.setCacheMap(pushOrderKey, map);

View File

@ -21,10 +21,6 @@ public class ServiceMainLogic {
private Map<String, ServiceLogic> serviceLogics;
public ServiceResult process(ServiceParameter sp) {
log.error("==========getServiceName================"+sp.getServiceName());
log.error("==========getPileNo================"+sp.getPileNo());
log.error("==========getParameters================"+sp.getParameters());
log.error("==========getVersion================"+sp.getVersion());
ServiceResult result;
try {
ServiceLogic logic = getServiceLogic(sp.getServiceName());

View File

@ -37,8 +37,6 @@ public class HBCheckTask {
hbtime = hbtime == null ? 0 : hbtime;
if ((now - hbtime) > 75000) {
String pileId = StrUtil.sub(gunkey.substring(gunkey.lastIndexOf(":") + 1), 0, -2);
System.out.println("================充电桩心跳掉线==========pileId========"+pileId);
System.out.println("================充电桩心跳掉线==========pileId========"+pileId);
// if (!DISCONNECTED.equals(cacheGun.get("status"))) {
// cacheGun.put("statusInt", OFF_LINE);
// cacheGun.put("status", DISCONNECTED);

View File

@ -219,8 +219,8 @@ public class CP56Time2a {
// String hex = toCp56Hex(time);
// System.out.println("--编码1--:" + hex);
// System.out.println(HexUtils.toBinaryString("90E223133D0416"));
System.out.println("--下达1--:" + DateUtil.format(cp56toDate("E880380D170518"), NORM_DATETIME_FORMATTER));
System.out.println("--下达2--:" + DateUtil.format(cp56toDate("A50F3A0D170518"), NORM_DATETIME_FORMATTER));
// System.out.println("--下达1--:" + DateUtil.format(cp56toDate("E880380D170518"), NORM_DATETIME_FORMATTER));
// System.out.println("--下达2--:" + DateUtil.format(cp56toDate("A50F3A0D170518"), NORM_DATETIME_FORMATTER));
// System.out.println("toCp56Hex = " + toCp56Hex(cp56toDate("C05D0D171F0116")));
//// System.out.println("--下达2--:" + DateUtil.format(cp56toDate(""), NORM_DATETIME_FORMAT));
// String dateStr = "2017-03-01 22:33:23";
@ -234,13 +234,13 @@ public class CP56Time2a {
// System.out.println(String.format("--编码2--:%s", encode));
// System.out.println("--解码2--:" + decode(HexUtils.toBytes(encode)));
String s = cp56toDateStr("1804080B0E22");
String s = cp56toDateStr("E0AB0E10190618");
System.out.println("-111-变为--:" + s);
System.out.println("-时间解析--:" + s);
String s1 = cp56toDateStr("88903507220418");
String s1 = cp56toDateStr("581B1610190618");
System.out.println("-111-变为--:" + s1);
System.out.println("-时间解析--:" + s1);
}
}

View File

@ -18,10 +18,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -401,6 +401,6 @@
</select>
<update id="updateXhpcChargingPile">
update from xhpc_charging_pile set power_number=#{powerNumber} where serial_number =#{serialNumber}
update xhpc_charging_pile set power_number=#{powerNumber} where serial_number =#{serialNumber}
</update>
</mapper>

View File

@ -235,47 +235,71 @@ public class XhpcAppUserController extends BaseController {
}
R r = settingConfigService.settingConfig(1, tenantId);
if (r != null && r.getCode() == 200) {
System.out.println("===========111========sessionKey:==============111=============");
Map<String, Object> mapConfig = (Map<String, Object>) r.getData();
String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + mapConfig.get("wxAppId").toString() + "&secret=" + mapConfig.get("wxAppSecret").toString() + "&js_code=" + jsCode + "&grant_type=authorization_code";
String result = HttpUtils.get(url);
JSONObject json = JSON.parseObject(result);
//logger.info("========222===========sessionKey:============222===============");
if (null != json) {
String openid = json.getString("openid");
String sessionKey = json.getString("session_key");
//logger.info("========333===========sessionKey:============333===============");
if (StringUtils.isEmpty(openid)) {
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
Map<String, Object> map = new HashMap<>(16);
map.put("openid", "ot6ul4nlSC5ZZOC4rTLS5hedFTGk");
if (phoneCode != null && !phoneCode.equals("")) {
System.out.println("phoneCode:" + phoneCode);
//小程序登录获取token
String accesToken = "123456";
//获取手机号
String phoneCode1 = getPhoneCode(phoneCode, accesToken);
if(phoneCode1 !=null &&!phoneCode1.equals("")){
map.put("phone", phoneCode1);
}
if (StringUtils.isEmpty(sessionKey)) {
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
}
Map<String, Object> map = new HashMap<>(16);
map.put("openid", openid);
if (phoneCode != null && !phoneCode.equals("")) {
System.out.println("phoneCode:" + phoneCode);
//小程序登录获取token
String accesToken = getAccesToken(mapConfig.get("wxAppId").toString(), mapConfig.get("wxAppSecret").toString());
//获取手机号
String phoneCode1 = getPhoneCode(phoneCode, accesToken);
if(phoneCode1 !=null &&!phoneCode1.equals("")){
map.put("phone", phoneCode1);
}
logger.info("1111phone:"+ phoneCode1);
}
// JSONObject jsonObject = new JSONObject();
// if ((!"".equals(encryptedData) && encryptedData != null) && (!"".equals(iv) && iv != null)) {
// jsonObject = getPhoneNumber(encryptedData, sessionKey, iv);
// if (jsonObject !=null) {
// map.put("name", jsonObject.get("nickName"));
// map.put("sex", jsonObject.get("gender"));
// map.put("avatar", jsonObject.get("avatarUrl"));
// map.put("phone", jsonObject.get("purePhoneNumber"));
// }
// }
return R.ok(map);
logger.info("1111phone:"+ phoneCode1);
}
return R.ok(map);
// System.out.println("===========111========sessionKey:==============111=============");
// Map<String, Object> mapConfig = (Map<String, Object>) r.getData();
// String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + mapConfig.get("wxAppId").toString() + "&secret=" + mapConfig.get("wxAppSecret").toString() + "&js_code=" + jsCode + "&grant_type=authorization_code";
// String result = HttpUtils.get(url);
// JSONObject json = JSON.parseObject(result);
// //logger.info("========222===========sessionKey:============222===============");
// if (null != json) {
// String openid = json.getString("openid");
// String sessionKey = json.getString("session_key");
// //logger.info("========333===========sessionKey:============333===============");
// if (StringUtils.isEmpty(openid)) {
// return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
// }
// if (StringUtils.isEmpty(sessionKey)) {
// return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
// }
// Map<String, Object> map = new HashMap<>(16);
// map.put("openid", openid);
// if (phoneCode != null && !phoneCode.equals("")) {
// System.out.println("phoneCode:" + phoneCode);
// //小程序登录获取token
// String accesToken = getAccesToken(mapConfig.get("wxAppId").toString(), mapConfig.get("wxAppSecret").toString());
// //获取手机号
// String phoneCode1 = getPhoneCode(phoneCode, accesToken);
// if(phoneCode1 !=null &&!phoneCode1.equals("")){
// map.put("phone", phoneCode1);
// }
// logger.info("1111phone:"+ phoneCode1);
// }
//// JSONObject jsonObject = new JSONObject();
//// if ((!"".equals(encryptedData) && encryptedData != null) && (!"".equals(iv) && iv != null)) {
//// jsonObject = getPhoneNumber(encryptedData, sessionKey, iv);
//// if (jsonObject !=null) {
//// map.put("name", jsonObject.get("nickName"));
//// map.put("sex", jsonObject.get("gender"));
//// map.put("avatar", jsonObject.get("avatarUrl"));
//// map.put("phone", jsonObject.get("purePhoneNumber"));
//// }
//// }
// return R.ok(map);
// }
}
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
}
@ -579,6 +603,23 @@ public class XhpcAppUserController extends BaseController {
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
/**
* 设置小程序用户双枪并充功能
* @param
*/
@ApiOperation("设置小程序用户双枪并充功能")
@PostMapping("/doubleGunCharging")
public R<?> doubleGunCharging(@RequestBody Map<String, Object> map) {
if (map != null) {
Long userId = Long.parseLong(map.get("userId").toString());
Integer userType = Integer.parseInt(map.get("userType").toString());
Integer sunchaSwitch = Integer.parseInt(map.get("sunchaSwitch").toString());
return iXhpcAppUserUserService.doubleGunCharging(userId, userType, sunchaSwitch);
}
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
/**
* 设置小程序用户电池保护
*

View File

@ -0,0 +1,62 @@
package com.xhpc.user.controller;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.user.domain.XhpcBlacklist;
import com.xhpc.user.domain.XhpcCustomers;
import com.xhpc.user.service.IXhpcBlacklistService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/blacklist")
public class XhpcBlacklistController extends BaseController {
@Resource
private IXhpcBlacklistService xhpcBlacklistService;
@GetMapping("/getList")
public TableDataInfo getList(String phone, String plateNum, String vin, String startTime, String endTime,Integer distinguish){
Map<String, Object> params = new HashMap<>();
params.put("phone", phone);
params.put("plateNum", plateNum);
params.put("vin", vin);
params.put("startTime", startTime);
params.put("endTime", endTime);
params.put("distinguish", distinguish);
List<Map<String, Object>> list = xhpcBlacklistService.getList(params);
return getDataTable(list);
}
@PostMapping(value = "/addBlacklist")
public AjaxResult addBlacklist(HttpServletRequest request, @RequestBody XhpcBlacklist xhpcBlacklist) {
return xhpcBlacklistService.addBlacklist(request,xhpcBlacklist);
}
@GetMapping(value = "/getBlacklistById")
public AjaxResult getBlacklistById(Long blacklistId) {
return AjaxResult.success(xhpcBlacklistService.getBlacklistById(blacklistId));
}
@GetMapping(value = "/deleteBlacklistById")
public AjaxResult deleteBlacklistById(Long blacklistId) {
xhpcBlacklistService.deleteBlacklistById(blacklistId);
return AjaxResult.success();
}
}

View File

@ -0,0 +1,74 @@
package com.xhpc.user.domain;
import com.xhpc.common.core.web.domain.BaseEntity;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
@Data
public class XhpcBlacklist extends BaseEntity {
private Long blacklistId;
/**
* 数据维度 0 地区 1.运营商 2. 运营商地区
*/
@NotEmpty(message = "数据维度不能为空")
private String dimension;
/**
* 是否有不参与合作的场站 0 没有 1有
*/
private Integer status;
/**
* 删除标志0代表存在 2代表删除
*/
private Integer delFlag;
/**
* 电站id
*/
private String chargingStationIds;
/**
* 制造厂商
*/
private String manufacturers;
/**
* 车辆类型
*/
private String vehicleType;
/**
* 发送机型式
*/
private String vehicleEngine;
/**
* 企业车型代码
*/
private String vehicleCode;
/**
* 电话
*/
private String phone;
/**
* 电话
*/
private String plateNum;
/**
* 车牌
*/
private String vin;
/**
* 限制开始时间
*/
private Date startTime;
/**
* 限制开始时间
*/
private Date endTime;
/**
* 1 个人 2 车型
*/
private Integer distinguish;
}

View File

@ -95,8 +95,13 @@ public interface XhpcAppUserMapper {
int updateUserIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund);
int updateUserSunchaSwitch(@Param("userId")Long userId, @Param("sunchaSwitch")Integer sunchaSwitch);
int updateCommunityIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund, @Param("socProtect")Integer socProtect, @Param("soc")Integer soc);
int updateCommunityPersonnelSunchaSwitch(@Param("userId")Long userId, @Param("sunchaSwitch")Integer sunchaSwitch, @Param("socProtect")Integer socProtect, @Param("soc")Integer soc);
int updateCustomersPersonnelSunchaSwitch(@Param("userId")Long userId, @Param("sunchaSwitch")Integer sunchaSwitch, @Param("socProtect")Integer socProtect, @Param("soc")Integer soc);
int updateCustomersSocProtect(@Param("userId")Long userId, @Param("socProtect")Integer socProtect, @Param("soc")Integer soc);
/**
* 记录登录用户的最后一次数据

View File

@ -0,0 +1,27 @@
package com.xhpc.user.mapper;
import com.xhpc.user.domain.XhpcBlacklist;
import com.xhpc.user.domain.XhpcCustomers;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface XhpcBlacklistMapper {
List<Map<String,Object>> getList(@Param("params")Map<String, Object> params);
//判断手机号或者车牌是否重复
int getPhoneOrVin(@Param("phone")String phone,@Param("plateNum")String plateNum,@Param("blacklistId")Long blacklistId,@Param("distinguish")Integer distinguish);
int getManufacturersOrVehicletype(@Param("manufacturers")String manufacturers,@Param("vehicleType")String vehicleType,@Param("vehicleEngine")String vehicleEngine,@Param("vehicleCode")String vehicleCode,@Param("blacklistId")Long blacklistId,@Param("distinguish")Integer distinguish);
int insertBlacklist(XhpcBlacklist xhpcBlacklist);
Map<String, Object> getBlacklistById(@Param("blacklistId")Long blacklistId);
int updateBlacklist(XhpcBlacklist xhpcBlacklist);
int deleteBlacklistById(@Param("blacklistId")Long blacklistId);
}

View File

@ -138,6 +138,12 @@ public interface IXhpcAppUserUserService {
*/
public R<?> updateIsRefund(Long userId, Integer userType,Integer isRefund);
/**
* 设置小程序用户自动退款功能
* @return
*/
public R<?> doubleGunCharging(Long userId, Integer userType,Integer sunchaSwitch);
/**
* 设置小程序用户电池保护
* @return

View File

@ -0,0 +1,21 @@
package com.xhpc.user.service;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.user.domain.XhpcBlacklist;
import com.xhpc.user.domain.XhpcCustomers;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
public interface IXhpcBlacklistService {
List<Map<String, Object>> getList(Map<String, Object> params);
AjaxResult addBlacklist(HttpServletRequest request, XhpcBlacklist xhpcBlacklist);
Map<String, Object> getBlacklistById(Long blacklistId);
void deleteBlacklistById(Long blacklistId);
}

View File

@ -828,6 +828,36 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
return R.fail(HttpStatus.ERROR_STATUS, "参数错误");
}
@Override
public R<?> doubleGunCharging(Long userId, Integer userType, Integer sunchaSwitch) {
if(sunchaSwitch>2 || sunchaSwitch<0){
return R.fail(HttpStatus.ERROR_STATUS, "参数错误");
}
if(userType==0){
int i = xhpcAppUserMapper.updateUserSunchaSwitch(userId, sunchaSwitch);
if(i>0){
return R.ok();
}else{
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
}else if(userType==1){
int i = xhpcAppUserMapper.updateCommunityPersonnelSunchaSwitch(userId, sunchaSwitch,null,null);
if(i>0){
return R.ok();
}else{
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
}else if(userType==2){
int i = xhpcAppUserMapper.updateCustomersPersonnelSunchaSwitch(userId, sunchaSwitch,null,null);
if(i>0){
return R.ok();
}else{
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
}
return R.fail(HttpStatus.ERROR_STATUS, "参数错误");
}
@Override
public R<?> batteryProtect(HttpServletRequest request, Integer soc,Integer socProtect,Integer userType) {
LoginUser loginUser = logUserUtils.getLogUser(request);

View File

@ -0,0 +1,120 @@
package com.xhpc.user.service.impl;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.user.domain.XhpcBlacklist;
import com.xhpc.user.mapper.XhpcBlacklistMapper;
import com.xhpc.user.service.IMechanismService;
import com.xhpc.user.service.IXhpcBlacklistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Service
public class XhpcBlacklistServiceImpl extends BaseService implements IXhpcBlacklistService {
@Resource
private XhpcBlacklistMapper xhpcBlacklistMapper;
@Resource
private TokenService tokenService;
@Autowired
private IMechanismService mechanismService;
@Override
public List<Map<String, Object>> getList(Map<String, Object> params) {
startPage();
return xhpcBlacklistMapper.getList(params);
}
@Override
public AjaxResult addBlacklist(HttpServletRequest request, XhpcBlacklist xhpcBlacklist) {
R r = judgeXhpcCustomers(xhpcBlacklist);
if(r.getCode()!=200){
return AjaxResult.error(r.getMsg());
}
//名称重复不能入库
Integer distinguish = xhpcBlacklist.getDistinguish();
if(distinguish==1){
int phoneOrVin = xhpcBlacklistMapper.getPhoneOrVin(xhpcBlacklist.getPhone(), xhpcBlacklist.getPlateNum(),xhpcBlacklist.getBlacklistId(),distinguish);
if(phoneOrVin >0 ){
return AjaxResult.error("手机号或者车牌号重复");
}
}else{
// int i = xhpcBlacklistMapper.getManufacturersOrVehicletype(xhpcBlacklist.getManufacturers(),null,null,null,xhpcBlacklist.getBlacklistId(),distinguish);
// if(i >0 ){
// return AjaxResult.error("制造厂商重复");
// }
// int i1 = xhpcBlacklistMapper.getManufacturersOrVehicletype(null,xhpcBlacklist.getVehicleType(),null,null,xhpcBlacklist.getBlacklistId(),distinguish);
// if(i1 >0 ){
// return AjaxResult.error("车辆类型重复");
// }
// int i2 = xhpcBlacklistMapper.getManufacturersOrVehicletype(null,null,xhpcBlacklist.getVehicleEngine(),null,xhpcBlacklist.getBlacklistId(),distinguish);
// if(i2 >0 ){
// return AjaxResult.error("发动机型式重复");
// }
// int i3 = xhpcBlacklistMapper.getManufacturersOrVehicletype(null,null,null,xhpcBlacklist.getVehicleCode(),xhpcBlacklist.getBlacklistId(),distinguish);
// if(i3 >0 ){
// return AjaxResult.error("企业车型代码重复");
// }
}
String chargingStationIds = xhpcBlacklist.getChargingStationIds();
if("".equals(chargingStationIds) || chargingStationIds ==null){
xhpcBlacklist.setStatus(0);
}else{
xhpcBlacklist.setStatus(1);
}
if(xhpcBlacklist.getBlacklistId() ==null){
xhpcBlacklistMapper.insertBlacklist(xhpcBlacklist);
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcBlacklist.getBlacklistId(),2);
}
}else{
xhpcBlacklistMapper.updateBlacklist(xhpcBlacklist);
mechanismService.updateMechanism(xhpcBlacklist.getBlacklistId(),2);
if(!"".equals(chargingStationIds) && chargingStationIds !=null){
mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcBlacklist.getBlacklistId(),2);
}
}
return AjaxResult.success();
}
@Override
public Map<String, Object> getBlacklistById(Long blacklistId) {
return xhpcBlacklistMapper.getBlacklistById(blacklistId);
}
@Override
public void deleteBlacklistById(Long blacklistId) {
xhpcBlacklistMapper.deleteBlacklistById(blacklistId);
}
public R judgeXhpcCustomers(XhpcBlacklist xhpcBlacklist){
if(xhpcBlacklist.getDistinguish()==1){
if(xhpcBlacklist.getPhone()==null || "".equals(xhpcBlacklist.getPhone())){
return R.fail("电话必填");
}
if(xhpcBlacklist.getPlateNum()==null || "".equals(xhpcBlacklist.getPlateNum())){
return R.fail("车牌必填");
}
}
if(xhpcBlacklist.getStartTime().getTime()>xhpcBlacklist.getEndTime().getTime()){
return R.fail("限制充电开始时间大于结束时间");
}
return R.ok();
}
}

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -264,6 +264,10 @@
update xhpc_app_user set is_refund=#{isRefund} where app_user_id=#{userId}
</update>
<update id="updateUserSunchaSwitch">
update xhpc_app_user set suncha_switch=#{sunchaSwitch} where app_user_id=#{userId}
</update>
<update id="updateCommunityIsRefund">
UPDATE xhpc_community_personnel
<set>
@ -274,6 +278,26 @@
WHERE community_personnel_id = #{userId}
</update>
<update id="updateCommunityPersonnelSunchaSwitch">
UPDATE xhpc_community_personnel
<set>
<if test="null != suncha_switch">suncha_switch = #{sunchaSwitch},</if>
<if test="null != socProtect">soc_protect = #{socProtect},</if>
<if test="null != soc ">soc = #{soc},</if>
</set>
WHERE community_personnel_id = #{userId}
</update>
<update id="updateCustomersPersonnelSunchaSwitch">
UPDATE xhpc_customers_personnel
<set>
<if test="null != suncha_switch">suncha_switch = #{sunchaSwitch},</if>
<if test="null != socProtect">soc_protect = #{socProtect},</if>
<if test="null != soc ">soc = #{soc},</if>
</set>
WHERE customers_personnel_id = #{userId}
</update>
<update id="updateCustomersSocProtect">
UPDATE xhpc_customers_personnel
<set>

View File

@ -0,0 +1,303 @@
<?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.user.mapper.XhpcBlacklistMapper">
<resultMap type="com.xhpc.user.domain.XhpcBlacklist" id="XhpcBlacklistResult">
<result column="blacklist_id" property="blacklistId"/>
<result column="vehicle_type" property="vehicleType"/>
<result column="dimension" property="dimension"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/>
<result column="manufacturers" property="manufacturers"/>
<result column="vehicle_engine" property="vehicleEngine"/>
<result column="vehicle_code" property="vehicleCode"/>
<result column="phone" property="phone"/>
<result column="plate_num" property="plateNum"/>
<result column="vin" property="vin"/>
<result column="start_time" property="startTime"/>
<result column="end_time" property="endTime"/>
<result column="distinguish" property="distinguish"/>
</resultMap>
<select id="getList" resultType="map">
select
blacklist_id as blacklistId,
manufacturers as manufacturers,
vehicle_type as vehicleType,
vehicle_engine as vehicleEngine,
vehicle_code as vehicleCode,
phone as phone,
vin as vin,
plate_num as plateNum,
(select group_concat(name) from xhpc_charging_station where charging_station_id in (select charging_station_id from xhpc_mechanism where mechanism_id = blacklist_id and source =2 and del_flag =0)) as chargingStationName,
concat(start_time," 至 ",end_time) as limitTime
from xhpc_blacklist
where del_flag =0
<if test="params.phone !=null and params.phone !=''">
and phone like CONCAT('%',#{params.phone},'%')
</if>
<if test="params.plateNum !=null and params.plateNum !=''">
and plate_num like CONCAT('%',#{params.plateNum},'%')
</if>
<if test="params.vin !=null and params.vin !=''">
and vin like CONCAT('%',#{params.vin},'%')
</if>
<if test="params.startTime !=null">
and start_time &gt;= #{params.startTime}
</if>
<if test="params.endTime !=null">
and end_time &lt;= #{params.endTime}
</if>
<if test="params.distinguish !=null">
and distinguish = #{params.distinguish}
</if>
order by create_time desc
</select>
<select id="getPhoneOrVin" resultType="int">
select count(blacklist_id)
from xhpc_blacklist
where del_flag=0 and (phone=#{phone} or plate_num=#{plateNum})
<if test="blacklistId !=null">
and blacklist_id !=#{blacklistId}
</if>
<if test="distinguish !=null">
and distinguish =#{distinguish}
</if>
</select>
<select id="getManufacturersOrVehicletype" resultType="int">
select count(blacklist_id)
from xhpc_blacklist
where del_flag=0 and (phone=#{phone} or plate_num=#{plateNum})
<if test="blacklistId !=null">
and blacklist_id !=#{blacklistId}
</if>
<if test="distinguish !=null">
and distinguish =#{distinguish}
</if>
<if test="manufacturers !=null and manufacturers !=''">
and manufacturers =#{manufacturers}
</if>
<if test="vehicleType !=null and vehicleType !=''">
and vehicle_type =#{vehicleType}
</if>
<if test="vehicleEngine !=null and vehicleEngine !=''">
and vehicle_engine =#{vehicleEngine}
</if>
<if test="vehicleCode !=null and vehicleCode !=''">
and vehicle_code =#{vehicleCode}
</if>
</select>
<insert id="insertBlacklist" parameterType="com.xhpc.user.domain.XhpcBlacklist" useGeneratedKeys="true" keyProperty="blacklistId">
insert into xhpc_blacklist
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != dimension and dimension !=''">
dimension,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != manufacturers and '' != manufacturers">
manufacturers,
</if>
<if test="null != vehicleType and ''!=vehicleType">
vehicle_type,
</if>
<if test="null != vehicleEngine and ''!=vehicleEngine">
vehicle_engine,
</if>
<if test="null != vehicleCode and vehicleCode!=''">
vehicle_code,
</if>
<if test="null != vin and vin!=''">
vin,
</if>
<if test="null != plateNum and plateNum!=''">
plate_num,
</if>
<if test="null != startTime">
start_time,
</if>
<if test="null != endTime">
end_time,
</if>
<if test="null != phone and phone !=''">
phone,
</if>
<if test="null != distinguish">
distinguish,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != dimension and dimension !=''">
#{dimension},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != manufacturers and '' != manufacturers">
#{manufacturers},
</if>
<if test="null != vehicleType and vehicleType!=''">
#{vehicleType},
</if>
<if test="null != vehicleEngine and vehicleEngine!=''">
#{vehicleEngine},
</if>
<if test="null != vehicleCode and vehicleCode!=''">
#{vehicleCode},
</if>
<if test="null != vin and vin!=''">
#{vin},
</if>
<if test="null != plateNum and plateNum!=''">
#{plateNum},
</if>
<if test="null != startTime">
#{startTime},
</if>
<if test="null != endTime">
#{endTime},
</if>
<if test="null != phone and phone !=''">
#{phone},
</if>
<if test="null != distinguish">
#{distinguish},
</if>
</trim>
</insert>
<update id="updateBlacklist" parameterType="com.xhpc.user.domain.XhpcBlacklist" useGeneratedKeys="true" keyProperty="blacklistId">
update xhpc_blacklist
<trim prefix="SET" suffixOverrides=",">
<if test="null != dimension and dimension !=''">
dimension=#{dimension},
</if>
<if test="null != status ">
status=#{status},
</if>
<if test="null != delFlag ">
del_flag=#{delFlag},
</if>
<if test="null != createTime ">
create_time=#{createTime},
</if>
<if test="null != createBy and '' != createBy">
create_by=#{createBy},
</if>
<if test="null != updateTime ">
update_time=#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
update_by=#{updateBy},
</if>
<if test="null != remark and '' != remark">
remark=#{remark},
</if>
<if test="null != manufacturers and '' != manufacturers">
manufacturers=#{manufacturers},
</if>
<if test="null != vehicleType and vehicleType!=''">
vehicle_type=#{vehicleType},
</if>
<if test="null != vehicleEngine and vehicleEngine!=''">
vehicle_engine=#{vehicleEngine},
</if>
<if test="null != vehicleCode and vehicleCode!=''">
vehicle_code=#{vehicleCode},
</if>
<if test="null != vin and vin!=''">
vin=#{vin},
</if>
<if test="null != plateNum and plateNum!=''">
plate_num= #{plateNum},
</if>
<if test="null != startTime">
start_time= #{startTime},
</if>
<if test="null != endTime">
end_time=#{endTime},
</if>
<if test="null != phone and phone !=''">
phone= #{phone},
</if>
<if test="null != distinguish">
distinguish=#{distinguish},
</if>
</trim>
where blacklist_id=#{blacklistId}
</update>
<update id="deleteBlacklistById">
update xhpc_blacklist set del_flag =1 where blacklist_id=#{blacklistId}
</update>
<select id="getBlacklistById" resultType="map">
select
xb.blacklist_id as blacklistId,
xb.manufacturers as manufacturers,
xb.vehicle_type as vehicleType,
xb.vehicle_engine as vehicleEngine,
xb.vehicle_code as vehicleCode,
xb.phone as phone,
xb.vin as vin,
xb.plate_num as plateNum,
xb.start_time as startTime,
xb.end_time as endTime,
xb.distinguish as distinguish,
group_concat(me.charging_station_id) chargingStationIds
from xhpc_blacklist xb
left join xhpc_mechanism me on me.mechanism_id = xb.blacklist_id and me.source = 2 and me.del_flag =0
where xb.blacklist_id=#{blacklistId}
limit 1
</select>
</mapper>

View File

@ -28,6 +28,10 @@
xau.tenant_id tenantId,
xau.soc_protect socProtect,
ten.status tenantStatus,
xau.suncha_switch as sunchaSwitch,
xau.a_balance as aBalance,
xau.b_balance as bBalance,
(select vin_spec_code as vinSpecCode from xhpc_user_vehicle where app_user_id = xau.app_user_id and source=0 and del_flag=0 and vin_blacklist !=1 order by type,create_time desc LIMIT 1) as vinSpecCode,
(select vehicle_name as vehicleName from xhpc_user_vehicle where app_user_id = xau.app_user_id and source=0 and del_flag=0 and vin_blacklist !=1 order by type,create_time desc LIMIT 1) as vehicleName,
xau.create_time as createTime
from xhpc_app_user xau
@ -66,6 +70,10 @@
xcp.soc_protect socProtect,
ten.status tenantStatus,
concat("ST") as userTypeName,
xcp.suncha_switch as sunchaSwitch,
xcp.a_balance as aBalance,
xcp.b_balance as bBalance,
(select vin_spec_code as vinSpecCode from xhpc_user_vehicle where app_user_id = xcp.community_personnel_id and source=2 and del_flag=0 and vin_blacklist !=1 order by type,create_time desc LIMIT 1) as vinSpecCode,
(select vehicle_name as vehicleName from xhpc_user_vehicle where app_user_id = xcp.community_personnel_id and source=2 and del_flag=0 and vin_blacklist !=1 order by type,create_time desc LIMIT 1) as vehicleName,
<if test="serialNumber !=null and serialNumber !=''">
(select count(charging_station_id) from xhpc_mechanism where community_id=mechanism_id and source=0 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number,
@ -106,6 +114,10 @@
xcp.soc_protect socProtect,
ten.status tenantStatus,
concat("BE") as userTypeName,
xcp.suncha_switch as sunchaSwitch,
xcp.a_balance as aBalance,
xcp.b_balance as bBalance,
(select vin_spec_code as vinSpecCode from xhpc_user_vehicle where app_user_id = xcp.customers_personnel_id and source=3 and del_flag=0 and vin_blacklist !=1 order by type,create_time desc LIMIT 1) as vinSpecCode,
(select vehicle_name as vehicleName from xhpc_user_vehicle where app_user_id = xcp.customers_personnel_id and source=3 and del_flag=0 and vin_blacklist !=1 order by type,create_time desc LIMIT 1) as vehicleName,
<if test="serialNumber !=null and serialNumber !=''">
(select count(charging_station_id) from xhpc_mechanism where customers_id=mechanism_id and source=1 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number,

View File

@ -16,10 +16,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
config:
# 配置中心地址
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
server-addr: 120.26.46.180:8858
# 配置文件格式
file-extension: yml
# 共享配置