From 33632d86bbf74e922ce406d9032fadc90f6bba5e Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 02 七月 2025 18:58:13 +0800 Subject: [PATCH] 更新用户端功能 --- UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/model/SendSmsRequest.java | 33 ++ UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/UserUtil.java | 42 -- UserQYTTravel/guns-admin/src/main/resources/application-dev.yml | 116 +++++++ UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TaxiCardServiceImpl.java | 41 +- UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/account/controller/AccountController.java | 13 UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongProperties.java | 73 +++- UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java | 56 +- UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/SMSUtil.java | 59 +++ UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java | 34 +- UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/call/server/impl/OrderCallServiceImpl.java | 19 UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java | 178 +++++----- UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java | 59 +- UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/AESUtils.java | 155 +++++++++ UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 60 +- UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java | 3 15 files changed, 655 insertions(+), 286 deletions(-) diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/account/controller/AccountController.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/account/controller/AccountController.java index fc497c8..a122797 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/account/controller/AccountController.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/account/controller/AccountController.java @@ -12,7 +12,6 @@ import com.stylefeng.guns.modular.account.server.UserWithdrawalService; import com.stylefeng.guns.modular.system.model.UserBankAccount; import com.stylefeng.guns.modular.system.model.UserInfo; -import com.stylefeng.guns.modular.system.model.UserWithdrawal; import com.stylefeng.guns.modular.system.service.IUserInfoService; import com.stylefeng.guns.modular.system.util.ResultUtil; import io.swagger.annotations.Api; @@ -68,14 +67,14 @@ int count = bankAccountService.selectCount(new EntityWrapper<UserBankAccount>().eq("userId", uid) .eq("userType", 1).eq("bankCardCode", userBankAccount.getBankCardCode()) .eq("status", 1)); - if(count > 0){ + if (count > 0) { return ResultUtil.error("不能重复添加银行卡"); } - List<UserWithdrawal> userId = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", user.getPhone()).eq("userType",1)); - if(userId.size()==0){ - return ResultUtil.error("请先进行个人用户进件信息填写"); - } +// List<UserWithdrawal> userId = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", user.getPhone()).eq("userType",1)); +// if(userId.size()==0){ +// return ResultUtil.error("请先进行个人用户进件信息填写"); +// } userBankAccount.setUserId(uid); UserBankAccount userBankAccount1 = new UserBankAccount(); BeanUtils.copyProperties(userBankAccount, userBankAccount1); @@ -93,7 +92,7 @@ // userBankAccount1.setAcctValidationFailureMsg(settleAcctResp.getAcctValidationFailureMsg()); // userBankAccount1.setAcctValidationFinishedAt(settleAcctResp.getAcctValidationFinishedAt().toString()); // userBankAccount1.setSettleAcctId(settleAcctResp.getSettleAcctId()); - bankAccountService.updateById(userBankAccount1); +// bankAccountService.updateById(userBankAccount1); return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java index 586961f..731daf1 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java @@ -1568,15 +1568,12 @@ System.out.println("完成订单微信支付回调"); Map<String, String> map = payMoneyUtil.weixinpayCallback(request); System.out.println("wx支付信息:"+map); - - if(null != map){ String order_id = map.get("transaction_id"); String out_trade_no = map.get("out_trade_no"); String result = map.get("result"); String total_fee = map.get("total_fee"); String transaction_id = map.get("transaction_id"); - if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ PrintWriter out = response.getWriter(); out.write(result); diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/call/server/impl/OrderCallServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/call/server/impl/OrderCallServiceImpl.java index c178691..5e457f8 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/call/server/impl/OrderCallServiceImpl.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/call/server/impl/OrderCallServiceImpl.java @@ -2,7 +2,6 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.stylefeng.guns.modular.CharteredCar.model.OrderCharteredCar; import com.stylefeng.guns.modular.account.controller.AppOrderController; import com.stylefeng.guns.modular.call.dao.OrderCallMapper; import com.stylefeng.guns.modular.call.model.OrderCall; @@ -68,23 +67,23 @@ paymentRecordService.saveData(1, uid, 1, orderId, 7, 2, money, "", 1);//添加预支付数据 } if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < money){ + if (userInfo.getBalance() == null || userInfo.getBalance() < money) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } - +// resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } + userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - + SysIntegral query1 = sysIntegralService.selectOne(new EntityWrapper<SysIntegral>().eq("companyId", orderCall.getCompanyId())); userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分 - + //添加交易明细 transactionDetailsService.saveData(uid, "助老模式-感谢费", money, 2, 1, 1, 7, orderId); userInfoService.updateById(userInfo); - + orderCall.setThankYouFee(money); this.updateById(orderCall); diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java index 64a7c27..57cd0f5 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java @@ -1028,23 +1028,22 @@ paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 2, orderMoney, "", 1);//添加预支付数据 } if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ + if (userInfo.getBalance() == null || userInfo.getBalance() < orderMoney) { return ResultUtil.error("余额不足,无法完成支付"); } - if(orderMoney > 0){ - resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),orderMoney); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } - } - - - +// if(orderMoney > 0){ +// resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),orderMoney); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } +// } + + userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - + SysIntegral query1 = sysIntegralMapper.query(orderCrossCity.getCompanyId()); userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 - + //添加交易明细 transactionDetailsService.saveData(uid, "跨城出行订单", orderMoney, 2, 1, 1, 3, orderId); userInfoService.updateById(userInfo); @@ -1525,22 +1524,22 @@ // resultUtil = ResultUtil.error(map.get("msg"), ""); // } } - if(payType == 3){//余额支付 - if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ + if(payType == 3) {//余额支付 + if (userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(id,userInfo.getId(),query.getMoney()); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } - +// resultUtil= appOrderController.moneyPay(id,userInfo.getId(),query.getMoney()); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } + userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); //添加交易明细 transactionDetailsService.saveData(uid, "跨城出行取消订单", query.getMoney(), 2, 1, 1, 3, id); userInfoService.updateById(userInfo); - + //解除小号绑定 - if(orderCrossCity.getBindId() != null){ + if (orderCrossCity.getBindId() != null) { chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId(), orderCrossCity.getTelX(), (System.currentTimeMillis() + 600000)); } @@ -2569,24 +2568,24 @@ resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_3_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee"); paymentRecordService.saveData(1, uid, 1, orderId, 3, 2, money, "", 1);//添加预支付数据 } - if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < money){ + if(payType == 3) {//余额支付 + if (userInfo.getBalance() == null || userInfo.getBalance() < money) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } +// resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - + SysIntegral query1 = sysIntegralMapper.query(orderCrossCity.getCompanyId()); userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分 - + //添加交易明细 transactionDetailsService.saveData(uid, "跨城出行-感谢费", money, 2, 1, 1, 3, orderId); userInfoService.updateById(userInfo); - + orderCrossCity.setThankYouFee(money); this.updateById(orderCrossCity); diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java index 8b6c8c1..41f1961 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java @@ -774,24 +774,24 @@ paymentRecordService.saveData(1, orderLogistics.getUserId(), 1, orderId, orderLogistics.getType(), 2, orderMoney, "", 1);//添加预支付数据 } if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ + if (userInfo.getBalance() == null || userInfo.getBalance() < orderMoney) { return ResultUtil.error("余额不足,无法完成支付"); } - if(orderMoney>0) { - resultUtil = appOrderController.moneyPay(orderId, userInfo.getId(), orderMoney); - if (resultUtil.getCode() == 500) { - return ResultUtil.error("电子余额不足,无法完成支付"); - } - } +// if(orderMoney>0) { +// resultUtil = appOrderController.moneyPay(orderId, userInfo.getId(), orderMoney); +// if (resultUtil.getCode() == 500) { +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } +// } userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - + SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 - + //添加交易明细 transactionDetailsService.saveData(uid, (orderLogistics.getType() == 4 ? "同城" : "跨城") + "小件物流下单", orderMoney, 2, 1, 1, 4, orderId); userInfoService.updateById(userInfo); - + orderLogistics.setState(1);//小件物流先支付后司机抢单 orderLogistics.setPayType(3); orderLogistics.setPayMoney(orderMoney); @@ -863,24 +863,24 @@ resultUtil = payMoneyUtil.alipay("小件物流补差价", "小件物流补差价", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/aliPayOrderLogisticsSpread"); paymentRecordService.saveData(1, orderLogistics.getUserId(), 1, orderId, orderLogistics.getType(), 2, orderMoney, "", 1);//添加预支付数据 } - if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ + if(payType == 3) {//余额支付 + if (userInfo.getBalance() == null || userInfo.getBalance() < orderMoney) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),orderMoney); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } - +// resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),orderMoney); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } + userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - + SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 - + //添加交易明细 transactionDetailsService.saveData(uid, (orderLogistics.getType() == 4 ? "同城" : "跨城") + "小件物流补差价", orderMoney, 2, 1, 1, 4, orderId); userInfoService.updateById(userInfo); - + orderLogistics.setState(12);//已支付差价 this.updateById(orderLogistics); @@ -1614,24 +1614,24 @@ resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee"); paymentRecordService.saveData(1, uid, 1, orderId, orderLogistics.getType(), 2, money, "", 1);//添加预支付数据 } - if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < money){ + if(payType == 3) {//余额支付 + if (userInfo.getBalance() == null || userInfo.getBalance() < money) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } - +// resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } + userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - + SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分 - + //添加交易明细 transactionDetailsService.saveData(uid, (orderLogistics.getType() == 4 ? "同城小件物流-" : "跨城小件物流-") + "感谢费", money, 2, 1, 1, orderLogistics.getType(), orderId); userInfoService.updateById(userInfo); - + orderLogistics.setThankYouFee(money); this.updateById(orderLogistics); diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java index e905d03..3fca710 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java @@ -1092,23 +1092,23 @@ paymentRecordService.saveData(1, orderPrivateCar.getUserId(), 1, id, 1, 2, query.getMoney(), "", 1);//添加预支付数据 } if(payType == 3){//余额支付 - if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ + if (userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(id,userInfo.getId(),query.getMoney()); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } +// resultUtil= appOrderController.moneyPay(id,userInfo.getId(),query.getMoney()); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); //添加交易明细 transactionDetailsService.saveData(uid, "快车取消订单", query.getMoney(), 2, 1, 1, 1, id); userInfoService.updateById(userInfo); - + //解除小号绑定 - if(orderPrivateCar.getBindId() != null){ + if (orderPrivateCar.getBindId() != null) { chinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(), orderPrivateCar.getTelX(), (System.currentTimeMillis() + 600000)); } - + orderPrivateCar.setState(10); orderPrivateCar.setTelX(""); orderPrivateCar.setBindId(""); @@ -2609,23 +2609,23 @@ resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_1_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee"); paymentRecordService.saveData(3, uid, 1, orderId, 1, 2, money, "", 1);//添加预支付数据 } - if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < money){ + if(payType == 3) {//余额支付 + if (userInfo.getBalance() == null || userInfo.getBalance() < money) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } +// resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - + SysIntegral query1 = sysIntegralMapper.query(orderPrivateCar.getCompanyId()); userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分 - + //添加交易明细 transactionDetailsService.saveData(uid, "快车订单-感谢费", money, 2, 1, 1, 1, orderId); userInfoService.updateById(userInfo); - + orderPrivateCar.setThankYouFee(money); this.updateById(orderPrivateCar); diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TaxiCardServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TaxiCardServiceImpl.java index 867ba25..51edc59 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TaxiCardServiceImpl.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TaxiCardServiceImpl.java @@ -24,7 +24,10 @@ import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; import java.util.stream.Collectors; @Service @@ -362,24 +365,24 @@ paymentRecordService.saveData(4, taxiCardPayment.getUserId(), 1, taxiCardPayment.getId(), null, 2, taxiCard.getSellingPrice(), "", 1);//添加预支付数据 } if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < taxiCard.getSellingPrice()){ - return ResultUtil.error("余额不足,无法完成支付", ""); - } - resultUtil= appOrderController.moneyPay(taxiCardPayment.getId(),userInfo.getId(),taxiCard.getSellingPrice()); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } - userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(taxiCard.getSellingPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - //添加交易明细 - transactionDetailsService.saveData(uid, "购买出行卡", taxiCard.getSellingPrice(), 2, 1, 1, 6, taxiCardPayment.getId()); - userInfoService.updateById(userInfo); - - taxiCardPayment.setPayStatus(2);//已支付 - taxiCardPayment.setPayTime(new Date()); - taxiCardPaymentService.updateById(taxiCardPayment); - - - //已购买没过期的增加有效期 + if (userInfo.getBalance() == null || userInfo.getBalance() < taxiCard.getSellingPrice()) { + return ResultUtil.error("余额不足,无法完成支付", ""); + } +// resultUtil= appOrderController.moneyPay(taxiCardPayment.getId(),userInfo.getId(),taxiCard.getSellingPrice()); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } + userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(taxiCard.getSellingPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + //添加交易明细 + transactionDetailsService.saveData(uid, "购买出行卡", taxiCard.getSellingPrice(), 2, 1, 1, 6, taxiCardPayment.getId()); + userInfoService.updateById(userInfo); + + taxiCardPayment.setPayStatus(2);//已支付 + taxiCardPayment.setPayTime(new Date()); + taxiCardPaymentService.updateById(taxiCardPayment); + + + //已购买没过期的增加有效期 UserTaxiCard userTaxiCard = userTaxiCardService.selectOne(new EntityWrapper<UserTaxiCard>().eq("userId", uid).eq("taxiCardId", taxiCardPayment.getTaxiCardId()) .eq("companyId", taxiCardPayment.getCompanyId()).where("now() between startTime and endTime")); if(null != userTaxiCard){ diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java index 12cf97d..b4fbaf5 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java @@ -16,12 +16,13 @@ import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.*; +import com.stylefeng.guns.modular.system.util.qianyuntong.AESUtils; import com.stylefeng.guns.modular.system.util.qianyuntong.SMSUtil; import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; -import com.stylefeng.guns.modular.system.util.qianyuntong.model.LoginWeChatXiao; import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTUserInfo; import com.stylefeng.guns.modular.system.util.qianyuntong.model.RegisterViaMobile; import com.stylefeng.guns.modular.system.util.qianyuntong.model.RegisterViaMobileRequest; +import com.stylefeng.guns.modular.system.util.qianyuntong.model.SendSmsRequest; import com.stylefeng.guns.modular.system.warpper.LoginWarpper; import com.stylefeng.guns.modular.taxi.model.PaymentRecord; import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; @@ -142,25 +143,25 @@ public ResultUtil queryCaptcha(String phone, Integer type) throws Exception { Random random = new Random(); StringBuffer sb = new StringBuffer(); - for(int i = 0; i < 4; i++){ + for (int i = 0; i < 4; i++) { sb.append((int) (random.nextDouble() * 10)); } String authCode = sb.toString(); - String templateCode = ""; - switch (type){ - case 1: - templateCode = "SMS_154775435";//身份验证 - break; - case 2: - templateCode = "SMS_154775434";//登录确认 - break; - case 3: - templateCode = "SMS_154775432";//用户注册 - break; - case 4: - templateCode = "SMS_154775431";//修改密码 - break; - } +// String templateCode = ""; +// switch (type){ +// case 1: +// templateCode = "SMS_154775435";//身份验证 +// break; +// case 2: +// templateCode = "SMS_154775434";//登录确认 +// break; +// case 3: +// templateCode = "SMS_154775432";//用户注册 +// break; +// case 4: +// templateCode = "SMS_154775431";//修改密码 +// break; +// } // String sData = aLiSendSms.sendSms(phone, "SMS_229715276", "{\"code\":\"" + authCode + "\"}"); // JSONObject jsonObject = JSON.parseObject(sData); // String message = jsonObject.getString("Message"); @@ -168,11 +169,24 @@ // System.err.println(message); // return ResultUtil.error(message); // } - SMSUtil.sendVerifyCode(phone); - String sms = "短信验证码【" + authCode + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"; - //发送验证码短信 - redisTemplate.opsForValue().set(phone, authCode, 5, TimeUnit.MINUTES);//设置五分钟过期 - System.out.println("【" + phone + "】" + sms); + + //中台没有用户数据,需要走注册接口,验证码校验走中台 + List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); + if (null == infoByPhone || infoByPhone.isEmpty()) { + SMSUtil.sendVerifyCode(phone); + } else { + SendSmsRequest request = new SendSmsRequest(); + request.setDestAddress(phone); + request.setTemplateId("TPL202410290001"); + Map<String, String> templateParams = new HashMap<>(); + templateParams.put("code", authCode); + request.setTemplateParams(templateParams); + request.setCode("code"); + request.setSpId("T8d5hdfg"); + SMSUtil.sendSms(request); + //发送验证码短信 + redisTemplate.opsForValue().set(phone, authCode, 5, TimeUnit.MINUTES);//设置五分钟过期 + } return ResultUtil.success(); } @@ -208,19 +222,39 @@ */ @Override public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType) throws Exception { - boolean b = this.checkCaptcha(phone, code); - if (!b) { - return ResultUtil.error("验证码无效"); + UserInfo userInfo = userInfoMapper.queryByPhone(phone); + String nickName = null; + if (null == userInfo) { + nickName = this.getDefaultName(); + } else { + nickName = userInfo.getNickName(); + } + //调中台接口查询用户 + List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); + if (null == infoByPhone || infoByPhone.isEmpty()) { + RegisterViaMobileRequest request = new RegisterViaMobileRequest(); + request.setMobile(phone); + request.setEncryptType("aesbase64"); + request.setPassword(AESUtils.encryptBase64("123456")); + request.setNickname(nickName); + request.setVerify_code(code); + request.setVerify_code_type("0"); + RegisterViaMobile register = UserUtil.registerViaMobile(request); + if (!"0".equals(register.getStatus())) { + return ResultUtil.error(register.getDesc()); + } + } else { + boolean b = this.checkCaptcha(phone, code); + if (!b) { + return ResultUtil.error("验证码无效"); + } } - UserInfo userInfo = userInfoMapper.queryByPhone(phone); if (null == userInfo) { - ArrayList<UserBankAccount> userBankAccounts = new ArrayList<>(); - userInfo = new UserInfo(); userInfo.setPhone(phone); userInfo.setPassWord(ShiroKit.md5("", salt)); - userInfo.setNickName(this.getDefaultName()); + userInfo.setNickName(nickName); userInfo.setRegistIp(registIp); userInfo.setIsAuth(1); userInfo.setConsumption(0D); @@ -250,20 +284,6 @@ } }).start(); - } - //调中台接口查询用户 - List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); - if (null == infoByPhone || infoByPhone.isEmpty()) { - RegisterViaMobileRequest request = new RegisterViaMobileRequest(); - request.setMobile(phone); - request.setPassword("123456"); - request.setNickname(userInfo.getNickName()); - request.setVerify_code(code); - request.setVerify_code_type("1"); - RegisterViaMobile register = UserUtil.registerViaMobile(request); - if (!"0".equals(register.getStatus())) { - return ResultUtil.error(register.getDesc()); - } } if (userInfo.getState() == 2) { return ResultUtil.error("账号被冻结"); @@ -547,15 +567,9 @@ } jsonObject.put(userInfo.getId().toString(), userInfo.getAppletsOpenId()); redisTemplate.opsForValue().set("appletOpenId", jsonObject.toJSONString()); - - //调中台微信登录接口 - LoginWeChatXiao loginWeChatXiao = UserUtil.loginWeChatXiao(jscode); - if (null == loginWeChatXiao) { - return ResultUtil.error("微信登录请求失败,请重试"); - } //调用单点登录的逻辑 this.singlePointLogin(userInfo.getId(), loginType); - String token = loginWeChatXiao.getToken(); + String token = this.getToken(userInfo, "", loginType); redisTemplate.opsForValue().set(token.substring(token.length() - 32), String.valueOf(userInfo.getId()), 180, TimeUnit.DAYS); redisTemplate.opsForValue().set("USER_" + type + "_" + userInfo.getPhone(), token.substring(token.length() - 32)); redisTemplate.opsForValue().set("USER_" + type + "_" + userInfo.getId(), token); @@ -837,30 +851,35 @@ */ @Override public ResultUtil bindingPhone(Integer uid, String phone, String code,String loginType) throws Exception { - boolean b = this.checkCaptcha(phone, code); - if (!b) { - return ResultUtil.error("验证码无效"); - } - - UserInfo userInfo = this.selectById(uid); + String nickName = null; + if (null == userInfo) { + nickName = this.getDefaultName(); + } else { + nickName = userInfo.getNickName(); + } + //调中台接口查询用户 + List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); + if (null == infoByPhone || infoByPhone.isEmpty()) { + RegisterViaMobileRequest request = new RegisterViaMobileRequest(); + request.setMobile(phone); + request.setEncryptType("aesbase64"); + request.setPassword(AESUtils.encryptBase64("123456")); + request.setNickname(nickName); + request.setVerify_code(code); + request.setVerify_code_type("0"); + RegisterViaMobile register = UserUtil.registerViaMobile(request); + if (!"0".equals(register.getStatus())) { + return ResultUtil.error(register.getDesc()); + } + } else { + boolean b = this.checkCaptcha(phone, code); + if (!b) { + return ResultUtil.error("验证码无效"); + } + } UserInfo userInfo1 = userInfoMapper.queryByPhone(phone); if (null != userInfo1) { - //调中台接口查询用户 - List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); - if (null == infoByPhone || infoByPhone.isEmpty()) { - RegisterViaMobileRequest request = new RegisterViaMobileRequest(); - request.setMobile(phone); - request.setPassword("123456"); - request.setNickname(userInfo.getNickName()); - request.setVerify_code(code); - request.setVerify_code_type("1"); - RegisterViaMobile register = UserUtil.registerViaMobile(request); - if (!"0".equals(register.getStatus())) { - return ResultUtil.error(register.getDesc()); - } - } - userInfo1.setOpenId(userInfo.getOpenId()); userInfo1.setUnionid(userInfo.getUnionid()); userInfo1.setAppletsOpenId(userInfo.getAppletsOpenId()); @@ -916,21 +935,6 @@ loginWarpper.setPhone(2); return ResultUtil.success(loginWarpper); } - //调中台接口查询用户 - List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); - if (null == infoByPhone || infoByPhone.isEmpty()) { - RegisterViaMobileRequest request = new RegisterViaMobileRequest(); - request.setMobile(phone); - request.setPassword("123456"); - request.setNickname(userInfo.getNickName()); - request.setVerify_code(code); - request.setVerify_code_type("1"); - RegisterViaMobile register = UserUtil.registerViaMobile(request); - if (!"0".equals(register.getStatus())) { - return ResultUtil.error(register.getDesc()); - } - } - userInfo.setPhone(phone); userInfo.setUpdateTime(new Date()); @@ -1435,7 +1439,7 @@ */ public String getDefaultName(){ int num = this.selectCount(new EntityWrapper<UserInfo>().ne("flag", 3)) + 1000001; - return "JYX" + String.valueOf(num).substring(1); + return "GRJY" + String.valueOf(num).substring(1); } /** diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/AESUtils.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/AESUtils.java new file mode 100644 index 0000000..0acac07 --- /dev/null +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/AESUtils.java @@ -0,0 +1,155 @@ +package com.stylefeng.guns.modular.system.util.qianyuntong; + +import org.apache.commons.codec.binary.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.SecretKeySpec; +import java.io.UnsupportedEncodingException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +public class AESUtils { + + private static Logger logger = LoggerFactory.getLogger(AESUtils.class); + private static String ALG = "AES"; + private static String CHARSET = "UTF-8"; + private static String KEY1 = "lur8apa4zu484pvj"; + + public AESUtils() { + } + + private static byte[] encrypt(byte[] content, String password, String iv) { + try { + SecretKeySpec key = new SecretKeySpec(password.getBytes(CHARSET), ALG); + Cipher cipher = Cipher.getInstance(ALG); + cipher.init(1, key); + return cipher.doFinal(content); + } catch (NoSuchAlgorithmException var5) { + var5.printStackTrace(); + } catch (NoSuchPaddingException var6) { + var6.printStackTrace(); + } catch (InvalidKeyException var7) { + var7.printStackTrace(); + } catch (UnsupportedEncodingException var8) { + var8.printStackTrace(); + } catch (IllegalBlockSizeException var9) { + var9.printStackTrace(); + } catch (BadPaddingException var10) { + var10.printStackTrace(); + } + + return null; + } + + private static byte[] decrypt(byte[] content, String password, String iv) { + try { + SecretKeySpec key = new SecretKeySpec(password.getBytes(CHARSET), ALG); + Cipher cipher = Cipher.getInstance(ALG); + cipher.init(2, key); + return cipher.doFinal(content); + } catch (NoSuchAlgorithmException var5) { + var5.printStackTrace(); + } catch (NoSuchPaddingException var6) { + var6.printStackTrace(); + } catch (InvalidKeyException var7) { + var7.printStackTrace(); + } catch (IllegalBlockSizeException var8) { + var8.printStackTrace(); + } catch (BadPaddingException var9) { + var9.printStackTrace(); + } catch (UnsupportedEncodingException var10) { + var10.printStackTrace(); + } + + return null; + } + + private static String parseByte2HexStr(byte[] buf) { + StringBuffer sb = new StringBuffer(); + + for(int i = 0; i < buf.length; ++i) { + String hex = Integer.toHexString(buf[i] & 255); + if (hex.length() == 1) { + hex = '0' + hex; + } + + sb.append(hex.toUpperCase()); + } + + return sb.toString(); + } + + private static byte[] parseHexStr2Byte(String hexStr) { + if (hexStr.length() < 1) { + return null; + } else { + byte[] result = new byte[hexStr.length() / 2]; + + for(int i = 0; i < hexStr.length() / 2; ++i) { + int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); + int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); + result[i] = (byte)(high * 16 + low); + } + + return result; + } + } + + public static String decryptHex(String content) { + return decryptHex(content, KEY1); + } + + public static String decryptHex(String content, String password) { + try { + return new String(decrypt(parseHexStr2Byte(content), password, ""), CHARSET); + } catch (Exception var3) { + return ""; + } + } + + public static String decryptBase64(String content) { + try { + return decryptBase64(content, KEY1); + } catch (Exception var2) { + return ""; + } + } + + public static String decryptBase64(String content, String password) { + try { + return new String(decrypt(Base64.decodeBase64(content), password, ""), CHARSET); + } catch (Exception var3) { + return ""; + } + } + + public static String encryptHex(String content) { + return encryptHex(content, KEY1); + } + + public static String encryptHex(String content, String password) { + try { + return parseByte2HexStr(encrypt(content.getBytes(CHARSET), password, "")); + } catch (Exception var3) { + return ""; + } + } + + public static String encryptBase64(String content) { + return encryptBase64(content, KEY1); + } + + public static String encryptBase64(String content, String password) { + try { + return Base64.encodeBase64String(encrypt(content.getBytes(CHARSET), password, "")); + } catch (Exception var3) { + logger.error("", var3); + return ""; + } + } +} diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongProperties.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongProperties.java index 26212d6..4438e9b 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongProperties.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/QianYunTongProperties.java @@ -7,18 +7,43 @@ * @Date 2025/6/6 15:03 */ public interface QianYunTongProperties { - /** - * 小程序appId - */ - String appId = "wxcc3c9058e2b294db"; - /** - * - */ - String encryptedData = "645HaSm7meo0GLKQZZvagq3JkWZXYlOfvhf8YKqNjWklpzx3IjM2S/wkmlUOz/iPvDVYRgBD2+V1WCHT6fMbOjJnR/0W9bwVGOSSaoyYpZdPR5x8f/6OR1B3e3qfJWFKJf0Za4n9JJTwStCTuMHWRIE0IgYtj3zSb2WI1AzDyLeR7MMgW0q+red2ujtrKGR4pe0NoXB2qZKHj4whBuGUiw=="; - /** - * - */ - String iv = "Zz2ZL9Yu43pp38p5CcocJA=="; + /************************************开发/测试start***********************************/ + +// /** +// * appkey +// */ +// String appkey = "10001104"; +// /** +// * 私钥地址 +// */ +// String privateKeyPath = "C:\\Users\\39373\\Desktop\\黔云通\\private_key_test.pem"; +// /** +// * 私钥地址 +// */ +// String privateKeyPath = "/root/server/app/key/private_key_test.pem"; +// /** +// * 消费者账号 +// */ +// String userName = "xiaofei"; +// /** +// * 状态 +// * 1:生产环境 +// * 2:测试环境 +// */ +// String status = "1"; +// /** +// * API地址 +// */ +// String apiUrl = "https://test-zhongtai.stqcloud.com:10070"; +// /** +// * 桶名 +// */ +// String bucketName = "bucuTest0625"; + + /************************************开发/测试end***********************************/ + + /************************************生产start***********************************/ + /** * appkey */ @@ -26,11 +51,15 @@ /** * 私钥地址 */ - String privateKeyPath = "/root/server/app/key/private_key_test.pem"; +// String privateKeyPath = "C:\\Users\\39373\\Desktop\\黔云通\\private_key.pem"; + /** + * 私钥地址 + */ + String privateKeyPath = "/root/server/app/key/private_key.pem"; /** * 消费者账号 */ - String userName = "xiaofei"; + String userName = "xiwang"; /** * 状态 * 1:生产环境 @@ -40,11 +69,23 @@ /** * API地址 */ - String apiUrl = "https://test-zhongtai.stqcloud.com:10070"; + String apiUrl = "http://jjzhongtai.stqcloud.com:10010"; + /** + * 桶名 + */ + String bucketName = "qyt20250702"; + + /************************************生产end***********************************/ + + + /** + * 小程序appId + */ + String appId = "wxcc3c9058e2b294db"; /** * HOS的基础路径(公共前缀) */ - String endPoint = "119.4.112.68:27741"; + String endPoint = "http://119.4.112.68:27741/v1"; /** * 账户的ID */ diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/SMSUtil.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/SMSUtil.java index 131392f..5872231 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/SMSUtil.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/SMSUtil.java @@ -2,8 +2,10 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; import com.open.common.util.OpenApiClient; import com.open.common.util.SystemParameterNames; +import com.stylefeng.guns.modular.system.util.qianyuntong.model.SendSmsRequest; import lombok.extern.slf4j.Slf4j; import java.text.SimpleDateFormat; @@ -64,4 +66,61 @@ } return object.getString("code"); } + + public static void main(String[] args) { + SendSmsRequest request = new SendSmsRequest(); + request.setDestAddress("15828353127"); + request.setTemplateId("TPL202410290001"); + Map<String, String> templateParams = new HashMap<>(); + templateParams.put("code", "1234"); + request.setTemplateParams(templateParams); + request.setCode("code"); + request.setSpId("T8d5hdfg"); + SMSUtil.sendSms(request); + } + + /** + * 根据模板发送短信 + * + * @param request + * @return + */ + public static Boolean sendSms(SendSmsRequest request) { + //请求路径 + String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/sendSmsByTpl"; + //私钥文件 + String skprivateKeyFile = QianYunTongProperties.privateKeyPath; + //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 + String appKey = QianYunTongProperties.appkey;//appkey + Map<String, String> headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + Map<String, Object> contentMap = new HashMap<String, Object>(); + Date nowdate = new Date(); + SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); + + String timeStamp = date.format(nowdate); + String messageId = UUID.randomUUID().toString().replaceAll("-", ""); + contentMap.put(SystemParameterNames.getAppKey(), appKey); + contentMap.put(SystemParameterNames.getMessage_id(), messageId); + contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); + contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); + contentMap.put("content", new Gson().toJson(request)); + log.info("【根据模板发送短信】请求地址:" + url); + log.info("【根据模板发送短信】请求参数:" + JSON.toJSONString(contentMap)); + String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); + log.info("【根据模板发送短信】请求结果:" + result); + JSONObject jsonObject = JSON.parseObject(result); + String retCode = jsonObject.getString("retCode"); + if (!"0".equals(retCode)) { + log.error("【根据模板发送短信】请求失败:" + result); + throw new RuntimeException("【根据模板发送短信】请求失败:" + result); + } + JSONObject object = jsonObject.getJSONObject("object"); + String status = object.getString("status"); + if (!"0".equals(status)) { + log.error("【根据模板发送短信】失败:" + object.toJSONString()); + throw new RuntimeException("【根据模板发送短信】失败:" + object.toJSONString()); + } + return true; + } } diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/UserUtil.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/UserUtil.java index 0bcc9f9..3282f16 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/UserUtil.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/UserUtil.java @@ -1,15 +1,11 @@ package com.stylefeng.guns.modular.system.util.qianyuntong; -import cn.hutool.http.HttpRequest; -import cn.hutool.http.HttpResponse; -import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.open.common.util.OpenApiClient; import com.open.common.util.SystemParameterNames; -import com.stylefeng.guns.modular.system.util.UUIDUtil; import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; import lombok.extern.slf4j.Slf4j; @@ -215,43 +211,5 @@ } - /** - * 微信小程序登录 - * - * @param code - * @return - */ - public static LoginWeChatXiao loginWeChatXiao(String code) { - HttpRequest post = HttpUtil.createPost("https://casme.teamshub.com/webapp-backstage/ajax/loginWeChatXiao/v1.0"); - post.header("Content-Type", "text/plain;charset=UTF-8"); - post.header("Accept-encodeing", "UTF-8"); - JSONObject body = new JSONObject(); - body.put("version", "1.0"); - try { - body.put("id", UUIDUtil.getRandomCode(6)); - } catch (Exception e) { - throw new RuntimeException(e); - } - body.put("type", "loginWeChatXiao"); - body.put("action", "request"); - body.put("code", code); - body.put("appId", QianYunTongProperties.appId); - body.put("encryptedData", QianYunTongProperties.encryptedData); - body.put("iv", QianYunTongProperties.iv); - post.body(body.toJSONString()); - HttpResponse execute = post.execute(); - if (200 != execute.getStatus()) { - log.error("微信登录失败"); - return null; - } - JSONObject jsonObject = JSON.parseObject(execute.body()); - Integer status = jsonObject.getInteger("status"); - if (0 != status) { - log.error("微信登录失败:" + jsonObject.getString("desc")); - return null; - } - LoginWeChatXiao loginWeChatXiao = jsonObject.getObject("data", LoginWeChatXiao.class); - return loginWeChatXiao; - } } diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/model/SendSmsRequest.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/model/SendSmsRequest.java new file mode 100644 index 0000000..cf44a4d --- /dev/null +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/qianyuntong/model/SendSmsRequest.java @@ -0,0 +1,33 @@ +package com.stylefeng.guns.modular.system.util.qianyuntong.model; + +import lombok.Data; + +import java.util.Map; + +/** + * @author zhibing.pu + * @Date 2025/7/2 15:41 + */ +@Data +public class SendSmsRequest { + /** + * 目标地址 + */ + private String destAddress; + /** + * 模板id + */ + private String templateId; + /** + * 参数集合 + */ + private Map<String, String> templateParams; + /** + * 模板中占位符key + */ + private String code; + /** + * 签名SPID + */ + private String spId; +} diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java index 364d0d8..087157d 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java @@ -204,20 +204,26 @@ public synchronized ResultUtil<BaseWarpper> taxiOrder(OrderTaxi orderTaxi, Integer uid) throws Exception { //定义用户所属公司 UserInfo userInfo1 = userInfoService.selectById(uid); + if (null == userInfo1 || userInfo1.getFlag() == 3) { + return ResultUtil.error("无效的账户"); + } + if (2 == userInfo1.getState()) { + return ResultUtil.error("账号已被冻结,请联系管理员"); + } Company query = companyCityService.query(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat())); - if(null == query){ + if (null == query) { return ResultUtil.error("出发点暂未开通"); } - if(null != userInfo1.getCompanyId() && 0 != userInfo1.getCompanyId()){ + if (null != userInfo1.getCompanyId() && 0 != userInfo1.getCompanyId()) { userInfo1.setCompanyId(query.getId()); userInfoService.updateById(userInfo1); } - - if(orderTaxi.getTravelTime().getTime() > (System.currentTimeMillis() + 600000)){ + + if (orderTaxi.getTravelTime().getTime() > (System.currentTimeMillis() + 600000)) { orderTaxi.setOrderType(2); } - - + + /** * 1.出租车、专车、跨城有待支付的订单不能叫车 * 2.小件物流有未完成的订单可以下跨城、专车、出租车 @@ -609,22 +615,22 @@ // resultUtil = ResultUtil.error(map.get("msg"), ""); // } } - if(payType == 3){//余额支付 - if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ + if(payType == 3) {//余额支付 + if (userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(id,userInfo.getId(),query.getMoney()); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } - +// resultUtil= appOrderController.moneyPay(id,userInfo.getId(),query.getMoney()); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } + userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); //添加交易明细 transactionDetailsService.saveData(uid, "出租车取消订单", query.getMoney(), 2, 1, 1, 2, id); userInfoService.updateById(userInfo); - + //解除小号绑定 - if(orderTaxi.getBindId() != null){ + if (orderTaxi.getBindId() != null) { chinaMobileUtil.midAxbUnBindSend(orderTaxi.getBindId(), orderTaxi.getTelX(), (System.currentTimeMillis() + 600000)); } @@ -1880,7 +1886,7 @@ userRedPacketRecord.setUserId(orderTaxi.getUserId()); userRedPacketRecordService.insert(userRedPacketRecord); } - appOrderController.moneyPay(orderTaxi.getId(),orderTaxi.getUserId(),money); +// appOrderController.moneyPay(orderTaxi.getId(),orderTaxi.getUserId(),money); return ResultUtil.success(baseWarpper); } @@ -2159,23 +2165,23 @@ resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_2_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee"); paymentRecordService.saveData(1, uid, 1, orderId, 2, 2, money, "", 1);//添加预支付数据 } - if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < money){ + if(payType == 3) {//余额支付 + if (userInfo.getBalance() == null || userInfo.getBalance() < money) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } +// resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - + SysIntegral query1 = sysIntegralMapper.query(orderTaxi.getCompanyId()); userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分 - + //添加交易明细 transactionDetailsService.saveData(uid, "出租车-感谢费", money, 2, 1, 1, 2, orderId); userInfoService.updateById(userInfo); - + orderTaxi.setThankYouFee(money); this.updateById(orderTaxi); diff --git a/UserQYTTravel/guns-admin/src/main/resources/application-dev.yml b/UserQYTTravel/guns-admin/src/main/resources/application-dev.yml new file mode 100644 index 0000000..1f46a52 --- /dev/null +++ b/UserQYTTravel/guns-admin/src/main/resources/application-dev.yml @@ -0,0 +1,116 @@ +server: + port: 8006 + +guns: + swagger-open: true #是否开启swagger (true/false) + kaptcha-open: false #是否开启登录时验证码 (true/false) + file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) + picture-server-address: http://192.168.0.43/resources/ #图片服务器地址 + spring-session-open: false #是否开启spring session,如果是多机环境需要开启(true/false) + session-invalidate-time: 1800 #session失效时间(只在单机环境下生效,多机环境在SpringSessionConfig类中配置) 单位:秒 + session-validation-interval: 900 #多久检测一次失效的session(只在单机环境下生效) 单位:秒 + +spring: + application: + name: user-server + profiles: +# active: dev + active: prod + mvc: + static-path-pattern: /static/** + view: + prefix: /WEB-INF/view + devtools: + restart: + enabled: false + additional-paths: src/main/java + exclude: static/**,WEB-INF/view/** + servlet: + multipart: + max-request-size: 100MB + max-file-size: 100MB + redis: + host: 172.21.35.151 + port: 6512 + password: SC_cache@20#25 + database: 0 + timeout: 1000 + cluster: + nodes: 172.21.35.151:6512,172.21.35.152:6512,172.21.35.153:6512,172.21.35.151:6513,172.21.35.152:6513,172.21.35.153:6513 + +mybatis-plus: + typeAliasesPackage: com.stylefeng.guns.modular + configuration: + log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl + + + +eureka: + client: + service-url: #注册中心地址 + defaultZone: http://sinata:sinata@127.0.0.1:8000/eureka #启用身份验证的方式连接 + register-with-eureka: true #在注册中心进行注册 + fetch-registry: true #从Eureka中获取注册信息。 + +--- + + +#配置Swagger接口扫描范围 +swagger: + base-package: com.stylefeng.guns.modular + + +spring: + datasource: + url: jdbc:mysql://172.21.35.140:8066/traffic_scdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai + username: traffic_scusr + password: QYT_sc@20#25 + db-name: traffic_scdb #用来搜集数据库的所有表 + filters: wall,mergeStat + + +--- +spring: + data: + mongodb: + uri: mongodb://qyt_jtcx:qyt_jtcx2025@172.21.35.195:27017,172.21.35.196:27017/traveling_track + + +--- + + + +wx: + grantType: authorization_code #填authorization_code + appid: 111 #应用唯一标识,在微信开放平台提交应用审核通过后获得 + appSecret: 111 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 + appletsAppid: wxcc3c9058e2b294db #小程序APPid + appletsAppSecret: 5610fc6126255ca5f7bd9fa4330338b6 # + mchId: 111 #微信支付分配的商户号 + key: 111 #key为商户平台设置的密钥key: + +--- + +alipay: + appid: 111 #应用程序唯一标识 + appPrivateKey: 111 #开发者应用私钥 + alipayPublicKey: ; #应用公钥 + alipay_public_key: 111 #支付宝公钥 + +--- + +juhe: #聚合数据 + appKey: 111 # + + +--- + +#支付回调地址 +#正式环境 +callbackPath: https://traffic.qytzt.cn/user + + +--- + +#交通部推送数据功能开关 +pushMinistryOfTransport: false -- Gitblit v1.7.1