diff --git a/ruoyi-auth/src/main/java/com/xhpc/auth/controller/TokenController.java b/ruoyi-auth/src/main/java/com/xhpc/auth/controller/TokenController.java index 0ca1dfb0..5a3f0f1b 100644 --- a/ruoyi-auth/src/main/java/com/xhpc/auth/controller/TokenController.java +++ b/ruoyi-auth/src/main/java/com/xhpc/auth/controller/TokenController.java @@ -69,12 +69,13 @@ public class TokenController { //验证 输入的验证码 String captcha = redisService.getCacheObject("pcToken:" + form.getUsername()); - if (!form.getPassword().equalsIgnoreCase(captcha)) { - R.fail(HttpStatus.ERROR_STATUS, "验证码错误"); + if (!form.getPassword().equals(captcha)) { + return R.fail(HttpStatus.ERROR_STATUS, "验证码错误"); } // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), "123456",1); // 获取登录token + redisService.deleteObject("pcToken:"+form.getUsername()); return R.ok(tokenService.createToken(userInfo)); } diff --git a/ruoyi-auth/src/main/java/com/xhpc/auth/service/SysLoginService.java b/ruoyi-auth/src/main/java/com/xhpc/auth/service/SysLoginService.java index a34e2444..fa6d45dc 100644 --- a/ruoyi-auth/src/main/java/com/xhpc/auth/service/SysLoginService.java +++ b/ruoyi-auth/src/main/java/com/xhpc/auth/service/SysLoginService.java @@ -91,9 +91,11 @@ public class SysLoginService throw new BaseException("登陆地址错误,请在管理员界面登陆"); } }else{ - if(user.getDataPowerType()!=1||user.getDataPowerType()!=2 ){ + if(user.getDataPowerType()==1 ||user.getDataPowerType()==2){ + + }else{ remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "登陆地址错误"); - throw new BaseException("登陆地址错误,请在管理员界面登陆"); + throw new BaseException("登陆地址错误,请在运营商界面登陆"); } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java index 6dc5cb32..909702b3 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java @@ -317,7 +317,7 @@ public class XhpcPileOrderController extends BaseController { xhpcChargeOrder.setChargingDegree(divide); xhpcChargeOrder.setAmountCharged(money); String stopReason = cacheOrderData.getStopReason(); - xhpcChargeOrder.setErroRemark(stopReason); + xhpcChargeOrder.setRemark(stopReason); xhpcChargeOrder.setUpdateTime(date); xhpcChargeOrder.setStatus(status); XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder(); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index 910d0446..4400f190 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -250,22 +250,22 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { if("1".equals(state)){ //总金额 if(fan){ - promotionDiscount=money.multiply(discount); + promotionDiscount=money.multiply(discount).setScale(2,BigDecimal.ROUND_DOWN); actPrice = money.subtract(promotionDiscount); - surplusPowerPrice = surplusPowerPrice.subtract(promotionDiscount.divide(new BigDecimal(2))); - surplusServicePrice= surplusServicePrice.subtract(promotionDiscount.divide(new BigDecimal(2))); + surplusPowerPrice = surplusPowerPrice.subtract(promotionDiscount.divide(new BigDecimal(2),BigDecimal.ROUND_DOWN)); + surplusServicePrice= surplusServicePrice.subtract(promotionDiscount.divide(new BigDecimal(2),BigDecimal.ROUND_DOWN)); } }else if("2".equals(state)){ if(fan){ //电费 - promotionDiscount =powerPrice.multiply(balance); + promotionDiscount =powerPrice.multiply(balance).setScale(2,BigDecimal.ROUND_DOWN); actPrice = money.subtract(promotionDiscount); surplusPowerPrice=surplusPowerPrice.subtract(promotionDiscount); } }else if("3".equals(state)){ if(fan){ //服务费 - promotionDiscount = servicePrice.multiply(balance); + promotionDiscount = servicePrice.multiply(balance).setScale(2,BigDecimal.ROUND_DOWN); actPrice = money.subtract(promotionDiscount); surplusServicePrice =surplusServicePrice.subtract(promotionDiscount); } @@ -291,31 +291,31 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { if(operatorMessage.get("maintenanceCommissionRate") !=null && operatorMessage.get("commissionType") !=null && operatorMessage.get("platformCommissionRate") !=null){ Integer commissionType = (Integer) operatorMessage.get("commissionType"); //运维提成 - BigDecimal maintenanceCommissionRate = new BigDecimal(operatorMessage.get("maintenanceCommissionRate").toString()).divide(new BigDecimal(100)); + BigDecimal maintenanceCommissionRate = new BigDecimal(operatorMessage.get("maintenanceCommissionRate").toString()).divide(new BigDecimal(100),2,BigDecimal.ROUND_DOWN); //平台提成 - BigDecimal platformCommissionRate = new BigDecimal(operatorMessage.get("platformCommissionRate").toString()).divide(new BigDecimal(100)); + BigDecimal platformCommissionRate = new BigDecimal(operatorMessage.get("platformCommissionRate").toString()).divide(new BigDecimal(100),2,BigDecimal.ROUND_DOWN); //提成类型(0总金额提成 1服务费提成) if(commissionType==0){ - BigDecimal multiply1 = surplusPowerPrice.multiply(platformCommissionRate); - BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate); + BigDecimal multiply1 = surplusPowerPrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_DOWN); + BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_DOWN); platformCommission = multiply1.add(multiply2); //剩下的钱 surplusPowerPrice = surplusPowerPrice.subtract(multiply1); surplusServicePrice = surplusServicePrice.subtract(multiply2); - BigDecimal multiply3 = surplusPowerPrice.multiply(maintenanceCommissionRate); - BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate); + BigDecimal multiply3 = surplusPowerPrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_DOWN); + BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_DOWN); operationCommission = multiply1.add(multiply2); //剩下的钱 surplusPowerPrice = surplusPowerPrice.subtract(multiply3); surplusServicePrice = surplusServicePrice.subtract(multiply4); }else if(commissionType==1){ - BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate); + BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_DOWN); platformSvcCommission=multiply2; //剩下的钱 surplusServicePrice = surplusServicePrice.subtract(multiply2); - BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate); + BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_DOWN); operationCommission = multiply4; //剩下的钱 surplusServicePrice = surplusServicePrice.subtract(multiply4); @@ -376,21 +376,21 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { xhpcHistoryOrderService.insert(xhpcHistoryOrder); //添加流水 - //xhpcChargeOrderService.addUserAccountStatement(userId, actPrice.negate(), subtract, xhpcChargeOrder.getChargeOrderId(), 3, date); + xhpcChargeOrderService.addUserAccountStatement(userId, actPrice.negate(), subtract, xhpcChargeOrder.getChargeOrderId(), 3, date); try{ -// Map xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId()); -// if(xhpcChargingPile !=null){ -// //发送短信 -// if(user.get("phone") !=null){ -// if("1".equals(xhpcChargingPile.get("type").toString())){ -// String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; -// smsService.sendNotice(user.get("phone").toString(),content); -// }else{ -// String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; -// smsService.sendNotice(user.get("phone").toString(),content); -// } -// } -// } + Map xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId()); + if(xhpcChargingPile !=null){ + //发送短信 + if(user.get("phone") !=null){ + if("1".equals(xhpcChargingPile.get("type").toString())){ + String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; + smsService.sendNotice(user.get("phone").toString(),content); + }else{ + String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; + smsService.sendNotice(user.get("phone").toString(),content); + } + } + } }catch (Exception e){ logger.info("<<<<<<<<<<<<<<<<发送短信失败>>>>>>>>>>>>>>>>>"); } @@ -398,7 +398,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { executorService.execute(new Runnable() { @Override public void run() { - // addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1); + addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1); } }); } @@ -421,7 +421,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { int size = reatTimeList.size(); if(size==1){ BigDecimal powerFee = new BigDecimal(reatTimeList.get(0).get("powerFee").toString()); - powerPriceTotal = powerFee.multiply(chargingDegree).setScale(2, RoundingMode.HALF_UP); + powerPriceTotal = powerFee.multiply(chargingDegree).setScale(2, BigDecimal.ROUND_DOWN); }else{ for (int i = 0; i objectMap = reatTimeList.get(i); @@ -451,7 +451,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { private BigDecimal getRateTimeList(String startTime,String endTime,BigDecimal s,BigDecimal powerFee,BigDecimal powerPriceTotal){ BigDecimal decimal = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime())/60000).setScale(2, RoundingMode.HALF_UP); powerPriceTotal = powerPriceTotal.add(decimal.multiply(powerFee).multiply(s)); - return powerPriceTotal.setScale(2, RoundingMode.HALF_UP); + return powerPriceTotal.setScale(2, BigDecimal.ROUND_DOWN); } @Override diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index 57bd02d1..a466308e 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -690,6 +690,7 @@ co.start_time as startTime, co.end_time as endTime, co.update_time as updateTime, + co.charging_time as chargingTimeTotal, ho.total_price as totalPrice, ho.remark as remark, ho.promotion_discount as promotionDiscount, @@ -706,7 +707,19 @@ ho.act_power_price as actPowerPrice, ho.act_service_price as actServicePrice, (SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone, - (SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone + (SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone, + case when ho.stop_reason_evcs=40 then "APP远程停止" + when ho.stop_reason_evcs=41 then "SOC达到100%" + when ho.stop_reason_evcs=42 then "充电电量满足设定条件" + when ho.stop_reason_evcs=43 then "充电金额满足设定条件" + when ho.stop_reason_evcs=44 then "充电时间满足设定条件" + when ho.stop_reason_evcs=45 then "手动停止充电" + when ho.stop_reason_evcs=46 then "手动停止充电." + when ho.stop_reason_evcs=47 then "手动停止充电.." + when ho.stop_reason_evcs=48 then "急停停止充电" + when ho.stop_reason_evcs=49 then "手动停止充电..." + else "手动停止充电!" + end stopReasonRvcsName from xhpc_history_order ho 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