修改充值金额,登录,页面请求速度

This commit is contained in:
18123374652 2024-03-07 11:19:20 +08:00
parent 52d5b1afff
commit 35355b33ce
18 changed files with 143 additions and 46 deletions

View File

@ -100,6 +100,24 @@ public class TokenController extends BaseController
return R.fail(HttpStatus.ERROR_STATUS, "手机号验证码错误");
}
}
String code = form.getCode();
String uuid = form.getUuid();
if (StringUtils.isEmpty(code))
{
return R.fail("1003", "图形验证码不能为空");
}
if (StringUtils.isEmpty(uuid))
{
return R.fail("1003", "图形验验证码已失效");
}
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String captcha = redisService.getCacheObject(verifyKey);
if (!code.equalsIgnoreCase(captcha)) {
redisService.deleteObject(verifyKey);
return R.fail("1003", "图形验证码错误");
}
// 用户登录
LoginUser userInfo = sysLoginService.login(form.getUsername(), "123456",1,form.getTenantId());
// 获取登录token
@ -125,12 +143,10 @@ public class TokenController extends BaseController
return R.fail("1003", "图形验验证码已失效");
}
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
System.out.println("=============uuid========="+uuid);
String captcha = redisService.getCacheObject(verifyKey);
System.out.println("=============captcha========="+captcha);
redisService.deleteObject(verifyKey);
if (!code.equalsIgnoreCase(captcha) && !code.equals("741852963")) {
return R.fail("1003", "手机号验证码错误");
if (!code.equalsIgnoreCase(captcha)) {
redisService.deleteObject(verifyKey);
return R.fail("1003", "图形验证码错误");
}
}
//验证 输入的验证码
@ -143,7 +159,6 @@ public class TokenController extends BaseController
return R.fail("1003", "请输入正确的手机号");
}
String random = getRandom();
String content ="【小华充电】您的验证码是:"+random+"有效期为5分钟。如非本人操作可不用理会。";
//添加短信记录
try {
//用户使用的Key

View File

@ -19,6 +19,10 @@ public class LoginBody
private String tenantId;
private String code;
private String uuid;
public String getUsername()
{
return username;
@ -46,4 +50,20 @@ public class LoginBody
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
}

View File

@ -9,6 +9,7 @@ import com.xhpc.activity.service.StationLogService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@ -21,14 +22,16 @@ public class StationLogController extends BaseController {
StationLogService stationLogService;
@GetMapping("/getPage")
public TableDataInfo getPilePage(@RequestParam(required = false) String tenantId,
public TableDataInfo getPilePage(
HttpServletRequest request,
@RequestParam(required = false) String tenantId,
@RequestParam(required = false) Integer number) {
startPage();
Map<String, Object> params = new HashMap<>();
params.put("operatorId", SecurityUtils.getUserId());
params.put("number", number);
params.put("tenantId", tenantId);
return getDataTable(stationLogService.getStationPage(params));
return getDataTable(stationLogService.getStationPage(request,params));
}

View File

@ -62,12 +62,14 @@ public class XhpcClearingCheckoutController extends BaseController {
@GetMapping("/getCheckoutPage")
public TableDataInfo getCheckoutPage(Long operatorId,
String tenantId) {
String tenantId,String startTime,String endTime) {
startPage();
Map<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId);
params.put("operatorId", operatorId);
params.put("startTime", startTime);
params.put("endTime", endTime);
return getDataTable(checkoutService.getCheckoutPage(params));
}

View File

@ -1,12 +1,13 @@
package com.xhpc.activity.service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
public interface StationLogService {
List<Map<String, Object>> getStationPage(Map<String, Object> params);
List<Map<String, Object>> getStationPage(HttpServletRequest request, Map<String, Object> params);
List<Map<String, Object>> getStationRatePage(Long stationId);

View File

@ -2,23 +2,58 @@ package com.xhpc.activity.service.impl;
import com.xhpc.activity.mapper.XhpcChargingStationMapper;
import com.xhpc.activity.service.StationLogService;
import com.xhpc.common.core.web.service.BaseService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class StationLogServiceImpl implements StationLogService {
public class StationLogServiceImpl extends BaseService implements StationLogService {
@Resource
XhpcChargingStationMapper stationMapper;
@Autowired
private TokenService tokenService;
@Override
public List<Map<String, Object>> getStationPage(Map<String, Object> params){
return stationMapper.selectXhpcChargingStationList(params);
public List<Map<String, Object>> getStationPage(HttpServletRequest request, Map<String, Object> params){
//获取登陆用户
LoginUser loginUser = tokenService.getLoginUser(request);
SysUser sysUser = loginUser.getSysUser();
Long sysUserId = sysUser.getUserId();
//桩的统计该时段金额
List<Map<String, Object>> list =new ArrayList<>();
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
Long operatorId = sysUser.getOperatorId();
params.put("type",1);
params.put("operatorId",operatorId);
//运营商看自己的场站
list = stationMapper.selectXhpcChargingStationList(params);
}else{
//查询赋值的场站
params.put("type",2);
params.put("operatorId",sysUserId);
list = stationMapper.selectXhpcChargingStationList(params);
}
}else{
startPage();
params.put("type",0);
list = stationMapper.selectXhpcChargingStationList(params);
}
return list;
}

View File

@ -16,10 +16,16 @@
from xhpc_charging_station as cs
left join xhpc_operator as ope on cs.operator_id = ope.operator_id
where cs.del_flag =0
<if test="params.number == 1">
<if test="params.chargingStationId !=null">
and cs.charging_station_id = #{params.chargingStationId}
</if>
<if test="params.operatorId !=null">
and cs.operator_id = #{params.operatorId}
</if>
<if test="params.type == 1">
and cs.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId})
</if>
<if test="params.number == 2">
<if test="params.type == 2">
and cs.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{params.operatorId})
</if>
<if test="params.tenantId != null and params.tenantId != ''">

View File

@ -96,6 +96,12 @@
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
where ho.check_status not in (1,2) and ho.del_flag=0
<if test="params.startTime!=null and params.startTime!='' ">
and ho.end_time &gt;= #{params.startTime}
</if>
<if test="params.endTime!=null and params.endTime!='' ">
and ho.end_time &lt;= #{params.endTime}
</if>
GROUP BY ct.operator_id
) ho on ho.operatorId = xo.operator_id
LEFT JOIN (
@ -103,7 +109,8 @@
ifnull(sum(ho.act_power_price + ho.act_service_price), 0) as 'cashAmount',
ho.operator_id as 'operatorId'
from xhpc_clearing_history_order as ho
where ho.check_status=2 and ho.del_flag=0 and ho.clearing_checkout_id is null GROUP BY ho.operator_id
where ho.check_status=2 and ho.del_flag=0 and ho.clearing_checkout_id is null
GROUP BY ho.operator_id
) cho on cho.operatorId= xo.operator_id
where xo.del_flag = 0
<if test="params.tenantId!=null and params.tenantId!=''">

View File

@ -193,7 +193,7 @@ public class XhpcChargeOrderController extends BaseController {
{
logger.info("<<<<<<<<<<VIN码启动前判断<<<<<<<<<<<<<<serialNumber>>>>>>>>"+serialNumber+">>>vinNumber>>>"+vinNumber+">>>");
return R.fail(1880, "无效VIN码");
// return iXhpcChargeOrderService.pileVin(serialNumber,vinNumber);
//return iXhpcChargeOrderService.pileVin(serialNumber,vinNumber);
}
@GetMapping("/constantSoc")

View File

@ -889,7 +889,7 @@ public class XhpcHistoryOrderController extends BaseController {
* 24小时异常订单自动结算
*/
@GetMapping("/test4")
//@Scheduled(cron = "0 0/5 * * * ?")
@Scheduled(cron = "0 0/5 * * * ?")
public void test4(){
//获取异常的订单 24小时之外的异常订单
List<Map<String,Object>> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2);
@ -916,7 +916,7 @@ public class XhpcHistoryOrderController extends BaseController {
* @param
*/
@GetMapping("/test5")
//@Scheduled(cron = "0 0/5 * * * ?")
@Scheduled(cron = "0 0/5 * * * ?")
public void test5(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>标记异常大于创建4小时标记为异常>>>>>>>>>>>>>>>>>>>>>");
chargeOrderService.updateStatus();

View File

@ -402,9 +402,6 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
return AjaxResult.error(1104, "请登陆相应账号停止充电");
}
}
System.out.println("=================111========请登陆相应账号停止充电==================停止 充电=================="+order.getSerialNumber());
System.out.println("=================111========请登陆相应账号停止充电==================停止 充电=================="+order.getSerialNumber());
System.out.println("=================111========请登陆相应账号停止充电==================停止 充电=================="+order.getSerialNumber());
R oa = powerPileService.stopCharging(order.getSerialNumber(), xhpcTerminal.getPileSerialNumber(),
xhpcTerminal.getSerialNumber(), version);
@ -950,9 +947,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
if (serialNumber.length() != 16 || !m.matches()) {
return R.fail(1104, "无效的终端编号");
}
//查看充电用户金额是否大于5元
//Map<String, Object> userMessage = xhpcChargeOrderMapper.getUserMessage(userId);
BigDecimal a = new BigDecimal(5);
if (userMessage == null || userMessage.get("balance") == null || a.compareTo(new BigDecimal(userMessage.get("balance").toString())) == 1) {
return R.fail(1100, "金额小于5元,不能充电,请充值后再进行充电");
@ -1006,9 +1001,6 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
}
}
}
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<终端编号>>>>"+serialNumber+">>>>>>>>>>>>>"+tenantId);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<终端编号>>>>>>>>>>>>>>>>");
//余额
String balance = new BigDecimal(userMessage.get("balance").toString()).multiply(new BigDecimal(100)).toString();
//获取桩信息
@ -1084,7 +1076,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
@Override
public void run() {
R r1 = powerPileService.startCharging(startChargingData);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<充电返回>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<VIN<<<充电返回>>>>>>VIN>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getCode() + ">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getMsg() + ">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getData() + ">>>>>>>>>>>>>>>>>");

View File

@ -1154,6 +1154,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
if("刷卡".equals(xhpcChargeOrder.getChargingMode())){
xhpcHistoryOrder.setChargingMode("刷卡");
}
if("VIN码".equals(xhpcChargeOrder.getChargingMode())){
xhpcHistoryOrder.setChargingMode("VIN码");
}
}else{
//订单异常
xhpcChargeOrder.setStatus(2);

View File

@ -96,9 +96,9 @@ public class AlipayPaymentController {
if(new BigDecimal(5).compareTo(new BigDecimal(amount))==1){
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能少于5元");
}
// if(new BigDecimal(200).compareTo(new BigDecimal(amount))==-1){
// return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于200元");
// }
if(new BigDecimal(600).compareTo(new BigDecimal(amount))==-1){
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于600元");
}
}
//用户信息id
String userId = StringUtils.valueOf(map.get("userId"));

View File

@ -97,10 +97,11 @@ public class WxPaymentController {
if(new BigDecimal(5).compareTo(new BigDecimal(amount))==1){
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能少于5元");
}
// if(new BigDecimal(200).compareTo(new BigDecimal(amount))==-1){
// return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于200元");
// }
if(new BigDecimal(600).compareTo(new BigDecimal(amount))==-1){
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于600元");
}
}
//用户信息id
if(map.get("userId") ==null || "".equals(map.get("userId").toString())){
return AjaxResult.error(HttpStatus.NOT_NULL, "请在我的里面进行充值");

View File

@ -397,8 +397,8 @@ public class ChargingController {
public static void main(String[] args) {
Integer F401 = HexUtils.reverseHexInt("A6010000");
System.out.println("F401 转化成="+F401);
Integer FFFF = HexUtils.reverseHexInt("51");
System.out.println("51 转化成="+FFFF);
Integer F402 = HexUtils.reverseHexInt("B602");
System.out.println("F402 转化成="+F402);

View File

@ -203,9 +203,15 @@ 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<>();

View File

@ -28,14 +28,12 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
import static com.xhpc.pp.server.ChargingPileServer.default_version;
import static com.xhpc.pp.utils.HexUtils.reverseHexInt;
@ -130,6 +128,9 @@ public class RealtimeDataLogic implements ServiceLogic {
R r = pileOrderService.pileStartup(orderNo, 1, "启动充电成功");
if (r.getCode() == 200) {
cacheGun.put("ac.on", true);
cacheGun.put("orderkey","order:"+orderNo);
final String orderstarttime = DateUtil.format(Calendar.getInstance().getTime(), NORM_DATETIME_FORMAT);
cacheGun.put("pileStartTime", orderstarttime);
}
}
List<CacheRealtimeData> realtimeDataList = (List<CacheRealtimeData>) cacheOrder.get("realtimeDataList");
@ -169,8 +170,6 @@ public class RealtimeDataLogic implements ServiceLogic {
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 > cul || wv > vul==================停止 充电=================="+pileNo);
System.out.println("==========================wc > cul || wv > vul==================停止 充电=================="+pileNo);
System.out.println("==========================wc > cul || wv > vul==================停止 充电=================="+pileNo);
R r = chargingController.stopCharging(pileNo, gunId, default_version);
if (r.getCode() == 200) {
@ -181,9 +180,8 @@ public class RealtimeDataLogic implements ServiceLogic {
} else {
Integer stopSoc = (Integer) cacheOrder.get("stopSoc");
if (stopSoc != null && socInt >= stopSoc) {
System.out.println("==========================stopSoc==================停止 充电=================="+pileNo);
System.out.println("==========================stopSoc==================停止 充电=================="+pileNo);
System.out.println("==========================stopSoc==================停止 充电=================="+pileNo);
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");

View File

@ -63,8 +63,10 @@ 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);
@ -76,18 +78,24 @@ 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);