xixi178 1 anno fa
parent
commit
8cb650ed76
61 ha cambiato i file con 2389 aggiunte e 1115 eliminazioni
  1. 1 1
      .idea/dataSources.local.xml
  2. 2 25
      .idea/dataSources/a06efed9-eef7-4bc7-9f23-4e9d60c2cb7e.xml
  3. 3 0
      .idea/inspectionProfiles/Project_Default.xml
  4. 0 1
      .idea/misc.xml
  5. 116 308
      .idea/workspace.xml
  6. 25 1
      client-api/src/main/java/com/wteam/controller/card/CardController.java
  7. 1 1
      client-api/src/main/java/com/wteam/controller/court/CourtController.java
  8. 201 78
      client-api/src/main/java/com/wteam/controller/hardware/HardwareController.java
  9. 37 4
      client-api/src/main/java/com/wteam/controller/hardware/PollingController.java
  10. 2 7
      client-api/src/main/java/com/wteam/controller/order/OrderController.java
  11. 81 14
      client-api/src/main/java/com/wteam/controller/order/QrCodeController.java
  12. 44 20
      client-api/src/main/java/com/wteam/controller/payment/CashierController.java
  13. 135 5
      client-api/src/main/java/com/wteam/controller/payment/CashierRefundController.java
  14. 5 1
      client-api/src/main/java/com/wteam/controller/user/UserController.java
  15. 11 0
      client-api/src/main/java/com/wteam/controller/wxlogin/WxMaUserController.java
  16. 9 5
      client-api/src/main/java/com/wteam/security/ClientAuthenticationFilter.java
  17. 11 13
      client-api/src/main/java/com/wteam/security/ClientSecurityConfig.java
  18. BIN
      client-api/target/classes/com/wteam/controller/wxlogin/WxMaUserController.class
  19. BIN
      client-api/target/classes/com/wteam/security/ClientAuthenticationFilter.class
  20. BIN
      client-api/target/classes/com/wteam/security/ClientSecurityConfig.class
  21. 8 4
      framework/src/main/java/com/wteam/framework/common/enums/PayMentEnums.java
  22. 1 0
      framework/src/main/java/com/wteam/framework/common/enums/PermissionEnum.java
  23. 19 2
      framework/src/main/java/com/wteam/framework/common/enums/ResultCode.java
  24. 10 10
      framework/src/main/java/com/wteam/framework/common/security/token/TokenUtils.java
  25. 3 4
      framework/src/main/java/com/wteam/framework/common/security/token/manager/ManagerTokenGenerate.java
  26. 32 0
      framework/src/main/java/com/wteam/framework/common/utils/WeChatUtil.java
  27. 8 6
      framework/src/main/java/com/wteam/framework/modules/book/entity/OrderInfo.java
  28. 4 8
      framework/src/main/java/com/wteam/framework/modules/book/entity/dto/OrderReq.java
  29. 116 0
      framework/src/main/java/com/wteam/framework/modules/book/entity/dto/RefundResult.java
  30. 2 0
      framework/src/main/java/com/wteam/framework/modules/book/entity/vo/OrderInfoVo.java
  31. 40 4
      framework/src/main/java/com/wteam/framework/modules/book/entity/vo/TimerOrderInfoVo.java
  32. 2 0
      framework/src/main/java/com/wteam/framework/modules/book/service/CardService.java
  33. 2 0
      framework/src/main/java/com/wteam/framework/modules/book/service/OrderInfoService.java
  34. 215 41
      framework/src/main/java/com/wteam/framework/modules/book/service/impl/CardServiceImpl.java
  35. 139 68
      framework/src/main/java/com/wteam/framework/modules/book/service/impl/OrderInfoServiceImpl.java
  36. 0 1
      framework/src/main/java/com/wteam/framework/modules/card/service/impl/CardAdminServiceImpl.java
  37. 1 10
      framework/src/main/java/com/wteam/framework/modules/hardware/ApiCallerUtil.java
  38. 105 105
      framework/src/main/java/com/wteam/framework/modules/hardware/ApiQrCodeUtil.java
  39. 151 0
      framework/src/main/java/com/wteam/framework/modules/hardware/QrCodeRegistrationUtil.java
  40. 22 11
      framework/src/main/java/com/wteam/framework/modules/hardware/RegistrationTask.java
  41. 1 0
      framework/src/main/java/com/wteam/framework/modules/pay/entity/enums/PaymentMethodEnum.java
  42. 4 4
      framework/src/main/java/com/wteam/framework/modules/pay/service/Payment.java
  43. 32 5
      framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/CashierSupport.java
  44. 113 4
      framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/RefundSupport.java
  45. 112 21
      framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/WxV3PayPlugin.java
  46. 499 251
      framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/handler/MyPayMessageHandler.java
  47. 4 1
      framework/src/main/java/com/wteam/framework/modules/permission/service/impl/AdminUserServiceImpl.java
  48. 1 1
      framework/src/main/java/com/wteam/framework/modules/specialValue/service/impl/CbSpecialValueServiceImpl.java
  49. 1 1
      framework/src/main/java/com/wteam/framework/modules/user/entity/User.java
  50. 1 8
      framework/src/main/java/com/wteam/framework/modules/user/service/UserService.java
  51. 54 58
      framework/src/main/java/com/wteam/framework/modules/user/service/impl/UserServiceImpl.java
  52. BIN
      framework/target/classes/com/wteam/framework/common/enums/PermissionEnum.class
  53. BIN
      framework/target/classes/com/wteam/framework/common/enums/ResultCode.class
  54. BIN
      framework/target/classes/com/wteam/framework/common/security/token/TokenUtils.class
  55. BIN
      framework/target/classes/com/wteam/framework/common/security/token/manager/ManagerTokenGenerate.class
  56. BIN
      framework/target/classes/com/wteam/framework/modules/permission/service/impl/AdminUserServiceImpl.class
  57. BIN
      framework/target/classes/com/wteam/framework/modules/user/entity/User.class
  58. BIN
      framework/target/classes/com/wteam/framework/modules/user/service/UserService.class
  59. BIN
      framework/target/classes/com/wteam/framework/modules/user/service/impl/UserServiceImpl.class
  60. 2 2
      manager-api/src/main/java/com/wteam/manager/ManagerAuthenticationFilter.java
  61. 1 1
      spring.iml

+ 1 - 1
.idea/dataSources.local.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="dataSourceStorageLocal" created-in="IU-231.8109.175">
+  <component name="dataSourceStorageLocal" created-in="IU-232.9921.47">
     <data-source name="cb@1.14.25.22" uuid="a06efed9-eef7-4bc7-9f23-4e9d60c2cb7e">
       <database-info product="MySQL" version="5.7.40-log" jdbc-version="4.0" driver-name="MySQL Connector Java" driver-version="mysql-connector-java-5.1.40 ( Revision: 402933ef52cad9aa82624e80acbea46e3a701ce6 )" dbms="MYSQL" exact-version="5.7.40" exact-driver-version="5.1">
         <extra-name-characters>#@</extra-name-characters>

+ 2 - 25
.idea/dataSources/a06efed9-eef7-4bc7-9f23-4e9d60c2cb7e.xml

@@ -1,30 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <dataSource name="cb@1.14.25.22">
-  <database-model serializer="dbm" dbms="MYSQL" family-id="MYSQL" format-version="4.48">
-    <root id="1">
-      <DefaultCasing>exact</DefaultCasing>
-      <DefaultEngine>InnoDB</DefaultEngine>
-      <DefaultTmpEngine>InnoDB</DefaultTmpEngine>
-      <Grants>cb|schema||cb||ALTER|G
-cb|schema||cb||ALTER ROUTINE|G
-cb|schema||cb||CREATE|G
-cb|schema||cb||CREATE ROUTINE|G
-cb|schema||cb||CREATE TEMPORARY TABLES|G
-cb|schema||cb||CREATE VIEW|G
-cb|schema||cb||DELETE|G
-cb|schema||cb||DROP|G
-cb|schema||cb||EVENT|G
-cb|schema||cb||EXECUTE|G
-cb|schema||cb||INDEX|G
-cb|schema||cb||INSERT|G
-cb|schema||cb||LOCK TABLES|G
-cb|schema||cb||REFERENCES|G
-cb|schema||cb||SELECT|G
-cb|schema||cb||SHOW VIEW|G
-cb|schema||cb||TRIGGER|G
-cb|schema||cb||UPDATE|G</Grants>
-      <ServerVersion>5.7.40</ServerVersion>
-    </root>
+  <database-model serializer="dbm" dbms="MYSQL" family-id="MYSQL" format-version="4.49">
+    <root id="1"/>
     <collation id="2" parent="1" name="big5_chinese_ci">
       <Charset>big5</Charset>
       <DefaultForCharset>1</DefaultForCharset>

+ 3 - 0
.idea/inspectionProfiles/Project_Default.xml

@@ -15,6 +15,7 @@
       <option name="m_reportAllNonLibraryCalls" value="false" />
       <option name="callCheckString" value="java.io.File,.*,java.io.InputStream,read|skip|available|markSupported,java.io.Reader,read|skip|ready|markSupported,java.lang.AbstractStringBuilder,capacity|codePointAt|codePointBefore|codePointCount|indexOf|lastIndexOf|offsetByCodePoints|substring|subSequence,java.lang.Boolean,.*,java.lang.Byte,.*,java.lang.Character,.*,java.lang.Double,.*,java.lang.Float,.*,java.lang.Integer,.*,java.lang.Long,.*,java.lang.Math,.*,java.lang.Object,equals|hashCode|toString,java.lang.Short,.*,java.lang.StrictMath,.*,java.lang.String,.*,java.lang.Thread,interrupted,java.math.BigDecimal,.*,java.math.BigInteger,.*,java.net.InetAddress,.*,java.net.URI,.*,java.nio.channels.AsynchronousChannelGroup,.*,java.nio.channels.Channel,isOpen,java.nio.channels.FileChannel,open|map|lock|tryLock|write,java.nio.channels.ScatteringByteChannel,read,java.nio.channels.SocketChannel,open|socket|isConnected|isConnectionPending,java.util.Arrays,.*,java.util.Collections,(?!addAll).*,java.util.List,of,java.util.Map,of|ofEntries|entry,java.util.Set,of,java.util.UUID,.*,java.util.concurrent.BlockingQueue,offer|remove,java.util.concurrent.CountDownLatch,await|getCount,java.util.concurrent.ExecutorService,awaitTermination|isShutdown|isTerminated,java.util.concurrent.ForkJoinPool,awaitQuiescence,java.util.concurrent.Semaphore,tryAcquire|availablePermits|isFair|hasQueuedThreads|getQueueLength|getQueuedThreads,java.util.concurrent.locks.Condition,await|awaitNanos|awaitUntil,java.util.concurrent.locks.Lock,tryLock|newCondition,java.util.regex.Matcher,pattern|toMatchResult|start|end|group|groupCount|matches|find|lookingAt|quoteReplacement|replaceAll|replaceFirst|regionStart|regionEnd|hasTransparentBounds|hasAnchoringBounds|hitEnd|requireEnd,java.util.regex.Pattern,.*,java.util.stream.BaseStream,.*,java.util.stream.DoubleStream,.*,java.util.stream.IntStream,.*,java.util.stream.LongStream,.*,java.util.stream.Stream,.*" />
     </inspection_tool>
+    <inspection_tool class="LoggingPlaceholderCountMatchesArgumentCount" enabled="false" level="WARNING" enabled_by_default="false" />
     <inspection_tool class="MavenModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
     <inspection_tool class="MismatchedCollectionQueryUpdate" enabled="false" level="WARNING" enabled_by_default="false">
       <option name="queryNames">
@@ -28,10 +29,12 @@
       </option>
     </inspection_tool>
     <inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" />
+    <inspection_tool class="SpringConfigurationProxyMethods" enabled="false" level="ERROR" enabled_by_default="false" />
     <inspection_tool class="SpringJavaInjectionPointsAutowiringInspection" enabled="false" level="ERROR" enabled_by_default="false" />
     <inspection_tool class="SuspiciousMethodCalls" enabled="false" level="WARNING" enabled_by_default="false">
       <option name="REPORT_CONVERTIBLE_METHOD_CALLS" value="true" />
     </inspection_tool>
+    <inspection_tool class="ThrowablePrintStackTrace" enabled="false" level="WARNING" enabled_by_default="false" />
     <inspection_tool class="VulnerableCodeUsages" enabled="false" level="WARNING" enabled_by_default="false" />
   </profile>
 </component>

+ 0 - 1
.idea/misc.xml

@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ExternalStorageConfigurationManager" enabled="true" />
   <component name="MavenProjectsManager">

+ 116 - 308
.idea/workspace.xml

@@ -4,244 +4,68 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="8eaaf244-eba9-47b2-a128-7c46802a5971" name="Changes" comment="">
-      <change afterPath="$PROJECT_DIR$/.drone.yml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/card/CardAdminController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/card/CardController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/coupon/CouponController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/court/CourtController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/hardware/HardwareController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/order/OrderController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/order/QrCodeController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/payment/CashierController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/user/UserController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/develop.sh" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/formal.sh" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/enums/CardTypeEnum.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/enums/OrderStatus.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/enums/OrderStatusEnum.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/enums/OrderTypeEnums.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/enums/orderTypeEnum.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/utils/AesCbcUtil.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/LongJsonDeserializer.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/LongJsonSerializer.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/dto/OrderCardReq.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/dto/OrderReq.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/dto/StoreForm.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/dto/StorePhotoDto.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/dto/StoredCardDto.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/reqp/TimeCalculation.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/reqp/hardwareReq.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/CardVo.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/OrderInfoVo.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/OrderTicketVo.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/OrderVo.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/PaymentRequest.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/StoreDetailsVo.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/StoreVo.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/TimeCodeVo.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/VenueVo.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/mapper/CardMapper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/mapper/CouponMapper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/mapper/CouponUserMapper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/mapper/OrderInfoMapper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/mapper/PaymentInfoMapper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/mapper/StoreMapper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/mapper/VenueMapper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/CardService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/CouponService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/OrderInfoService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/PaymentInfoService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/StoreService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/VenueService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/CardServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/CouponServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/OrderInfoServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/PaymentInfoServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/StoreServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/VenueServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/card/entity/CbCardAdmin.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/card/mapper/CardAdminMapper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/card/service/CardAdminService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/card/service/impl/CardAdminServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/hardware/ApiCallerUtil.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/hardware/ApiQrCodeUtil.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/hardware/RegistrationTask.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/image/entity/CbImage.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/image/mapper/CbImageMapper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/image/service/CbImageService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/image/service/impl/CbImageServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/entity/vo/OrderStatusEnum.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/interceptor/WxV3PayMessageInterceptor.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/service/Payment.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/CashierSupport.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/WxV3PayPlugin.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/handler/BasePayMessageHandler.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/handler/MyPayMessageHandler.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/handler/WxV3PayMessageHandler.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/service/SmsCheckService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/serviceimpl/SmsCheckServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/specialValue/entity/CbSpecialValue.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/specialValue/mapper/CbSpecialValueMapper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/specialValue/service/CbSpecialValueService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/specialValue/service/impl/CbSpecialValueServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dto/WechatPaymentSetting.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/entity/form/UpdateUserForm.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/local_history.patch" afterDir="false" />
+    <list default="true" id="8eaaf244-eba9-47b2-a128-7c46802a5971" name="Changes" comment="init2">
+      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/hardware/PollingController.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/payment/CashierRefundController.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/enums/PayMentEnums.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/utils/WeChatUtil.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/dto/RefundResult.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/TimerOrderInfoVo.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/hardware/QrCodeRegistrationUtil.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/RefundSupport.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/dataSources.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/dataSources/a06efed9-eef7-4bc7-9f23-4e9d60c2cb7e.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/a06efed9-eef7-4bc7-9f23-4e9d60c2cb7e.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/easyCodeTableSetting.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/easyCodeTableSetting.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/pom.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/passport/ConnectMemberWebController.java" beforeDir="false" afterPath="$PROJECT_DIR$/common-api/src/main/java/com/wteam/controller/passport/ConnectMemberWebController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/passport/FileController.java" beforeDir="false" afterPath="$PROJECT_DIR$/common-api/src/main/java/com/wteam/controller/passport/FileController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/passport/MemberController.java" beforeDir="false" afterPath="$PROJECT_DIR$/common-api/src/main/java/com/wteam/controller/passport/MemberController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/sms/GetSmsController.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/sms/GetSmsController.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/wxlogin/QRCodeController.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/wxlogin/QRCodeController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/card/CardController.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/card/CardController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/court/CourtController.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/court/CourtController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/hardware/HardwareController.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/hardware/HardwareController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/order/OrderController.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/order/OrderController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/order/QrCodeController.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/order/QrCodeController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/payment/CashierController.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/payment/CashierController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/user/UserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/user/UserController.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/wxlogin/WxMaUserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/controller/wxlogin/WxMaUserController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/security/ClientAuthenticationFilter.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/security/ClientAuthenticationFilter.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/security/ClientSecurityConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/java/com/wteam/security/ClientSecurityConfig.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/src/main/resources/application.yml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/target/classes/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/target/classes/application.yml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/target/classes/com/wteam/controller/passport/ConnectMemberWebController.class" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/target/classes/com/wteam/controller/passport/FileController.class" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/target/classes/com/wteam/controller/passport/MemberController.class" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/target/classes/com/wteam/controller/sms/GetSmsController.class" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/target/classes/com/wteam/controller/sms/GetSmsController.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/client-api/target/classes/com/wteam/controller/wxlogin/QRCodeController.class" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/target/classes/com/wteam/controller/wxlogin/QRCodeController.class" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/client-api/target/classes/com/wteam/controller/wxlogin/WxMaUserController.class" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/target/classes/com/wteam/controller/wxlogin/WxMaUserController.class" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/client-api/target/classes/com/wteam/security/ClientAuthenticationFilter.class" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/target/classes/com/wteam/security/ClientAuthenticationFilter.class" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/client-api/target/classes/com/wteam/security/ClientSecurityConfig.class" beforeDir="false" afterPath="$PROJECT_DIR$/client-api/target/classes/com/wteam/security/ClientSecurityConfig.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/common-api/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/common-api/src/main/resources/application.yml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/framework/pom.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/enums/PermissionEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/enums/PermissionEnum.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/enums/ResultCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/enums/ResultCode.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/security/AuthUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/security/AuthUser.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/security/context/UserContext.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/security/context/UserContext.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/security/token/TokenUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/security/token/TokenUtils.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/security/token/manager/ManagerTokenGenerate.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/security/token/manager/ManagerTokenGenerate.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/utils/SnowFlake.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/common/utils/SnowFlake.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/AdminUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/AdminUser.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Card.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Card.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Coupon.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Coupon.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/CouponUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/CouponUser.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Notice.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Notice.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/OrderInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/OrderInfo.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/OrderUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/OrderUser.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/PaymentInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/PaymentInfo.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Role.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Role.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/RoleMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/RoleMenu.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Store.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Store.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Vdstate.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Vdstate.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Venue.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/Venue.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/config/AuthConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/config/AuthConfig.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/entity/dto/WechatMPLoginParams.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/entity/dto/WechatMPLoginParams.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/entity/enums/AuthUserGender.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/entity/enums/AuthUserGender.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/request/AuthRequest.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/request/AuthRequest.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/request/BaseAuthAlipayRequest.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/request/BaseAuthAlipayRequest.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/util/AuthChecker.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/util/AuthChecker.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/util/ConnectUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/connect/util/ConnectUtil.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/entity/dos/File.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/entity/dos/File.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/entity/dto/FileDto.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/entity/dto/FileDto.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/mapper/FileMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/mapper/FileMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/plugin/FilePluginFactory.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/plugin/FilePluginFactory.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/plugin/impl/AliFilePlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/plugin/impl/AliFilePlugin.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/service/FileService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/service/FileService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/serviceimpl/FileServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/file/serviceimpl/FileServiceImpl.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/entity/dto/MemberAddDTO.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/entity/dto/MemberAddDTO.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/entity/dto/MemberAddressDTO.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/entity/dto/MemberAddressDTO.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/entity/dto/MemberEditDTO.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/entity/dto/MemberEditDTO.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/entity/enums/QRCodeLoginSessionStatusEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/entity/enums/QRCodeLoginSessionStatusEnum.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/entity/vo/MemberSearchVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/entity/vo/MemberSearchVO.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/mapper/MemberMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/mapper/MemberMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/service/MemberService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/member/service/MemberService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/oss/service/OssService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/oss/service/OssService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/payment/entity/dto/PayParam.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/entity/dto/PayParam.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/payment/entity/enums/OrderOrItemEnum.java" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/payment/entity/enums/PayStatusEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/entity/enums/PayStatusEnum.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/payment/entity/enums/PaymentClientEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/entity/enums/PaymentClientEnum.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/payment/entity/enums/PaymentMethodEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/entity/enums/PaymentMethodEnum.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/payment/entity/vo/CallbackParamVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/entity/vo/CallbackParamVO.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/entity/enums/userEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/entity/enums/userEnum.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/entity/vo/AdminUserVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/entity/vo/AdminUserVO.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/entity/vo/SystemLogVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/entity/vo/SystemLogVO.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/entity/vo/UserMenuVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/entity/vo/UserMenuVO.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/mapper/AdminUserMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/mapper/AdminUserMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/mapper/RoleMenuMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/mapper/RoleMenuMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/mapper/RolePermissionMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/mapper/RolePermissionMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/mapper/UserRoleMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/mapper/UserRoleMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/service/AdminUserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/service/AdminUserService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/service/RoleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/service/RoleService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/service/UserRoleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/service/UserRoleService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/service/impl/RoleMenuServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/service/impl/RoleMenuServiceImpl.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/AliSmsUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/AliSmsUtil.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/entity/dos/SmsSign.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/entity/dos/SmsSign.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/entity/dos/SmsTemplate.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/entity/dos/SmsTemplate.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/mapper/SmsSignMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/mapper/SmsSignMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/mapper/SmsTemplateMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/mapper/SmsTemplateMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/service/SmsSignService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/service/SmsSignService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/serviceimpl/SmsSignServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/serviceimpl/SmsSignServiceImpl.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/serviceimpl/SmsTemplateServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/serviceimpl/SmsTemplateServiceImpl.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/serviceimpl/SmsUtilAliImplService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/sms/serviceimpl/SmsUtilAliImplService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dos/Region.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dos/Region.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dos/Setting.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dos/Setting.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dto/SmsSetting.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dto/SmsSetting.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dto/connect/WechatConnectSetting.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dto/connect/WechatConnectSetting.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dto/connect/WechatConnectSettingItem.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/entity/dto/connect/WechatConnectSettingItem.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/mapper/RegionMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/mapper/RegionMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/mapper/SettingMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/mapper/SettingMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/mapper/VerificationSourceMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/mapper/VerificationSourceMapper.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/Cpu.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/Cpu.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/Jvm.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/Jvm.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/Mem.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/Mem.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/Server.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/Server.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/Sys.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/Sys.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/SysFile.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/server/SysFile.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/service/SettingService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/system/service/SettingService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/config/wechat/WxMaConfiguration.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/config/wechat/WxMaConfiguration.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/dto/OrderReq.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/dto/OrderReq.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/OrderInfoVo.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/entity/vo/OrderInfoVo.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/CardService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/CardService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/OrderInfoService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/OrderInfoService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/CardServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/CardServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/OrderInfoServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/OrderInfoServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/card/service/impl/CardAdminServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/card/service/impl/CardAdminServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/hardware/ApiCallerUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/hardware/ApiCallerUtil.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/hardware/ApiQrCodeUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/hardware/ApiQrCodeUtil.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/hardware/RegistrationTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/hardware/RegistrationTask.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/entity/enums/PaymentMethodEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/entity/enums/PaymentMethodEnum.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/service/Payment.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/service/Payment.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/CashierSupport.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/CashierSupport.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/WxV3PayPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/WxV3PayPlugin.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/handler/MyPayMessageHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/handler/MyPayMessageHandler.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/service/impl/AdminUserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/permission/service/impl/AdminUserServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/specialValue/service/impl/CbSpecialValueServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/specialValue/service/impl/CbSpecialValueServiceImpl.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/entity/User.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/entity/User.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/service/UserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/service/UserService.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/service/impl/UserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/service/impl/UserServiceImpl.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/token/UserTokenGenerate.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/user/token/UserTokenGenerate.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/verification/aop/annotation/Verification.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/verification/aop/annotation/Verification.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/verification/entity/dos/VerificationSource.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/verification/entity/dos/VerificationSource.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/wxcode/WxAccessToken.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/wxcode/WxAccessToken.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/wxcode/WxCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/wxcode/WxCode.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/META-INF/spring-configuration-metadata.json" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/META-INF/spring-configuration-metadata.json" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/enums/PermissionEnum.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/enums/PermissionEnum.class" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/enums/ResultCode.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/enums/ResultCode.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/security/AuthUser.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/security/AuthUser.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/security/context/UserContext.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/security/context/UserContext.class" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/security/token/TokenUtils.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/security/token/TokenUtils.class" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/security/token/manager/ManagerTokenGenerate.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/common/security/token/manager/ManagerTokenGenerate.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/connect/entity/dto/WechatMPLoginParams.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/connect/entity/dto/WechatMPLoginParams.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/connect/request/AuthRequest.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/connect/request/AuthRequest.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/connect/util/ConnectUtil$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/connect/util/ConnectUtil$1.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/connect/util/ConnectUtil.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/connect/util/ConnectUtil.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/file/entity/dto/FileDto.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/file/entity/dto/FileDto.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/file/plugin/impl/AliFilePlugin.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/file/plugin/impl/AliFilePlugin.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/member/entity/enums/QRCodeLoginSessionStatusEnum.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/member/entity/enums/QRCodeLoginSessionStatusEnum.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/payment/entity/dto/PayParam.class" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/payment/entity/enums/OrderOrItemEnum.class" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/payment/entity/enums/PayStatusEnum.class" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/payment/entity/enums/PaymentClientEnum.class" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/payment/entity/enums/PaymentMethodEnum.class" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/payment/entity/vo/CallbackParamVO.class" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/permission/entity/enums/userEnum.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/permission/entity/enums/userEnum.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/sms/serviceimpl/SmsSignServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/sms/serviceimpl/SmsSignServiceImpl.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/sms/serviceimpl/SmsTemplateServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/sms/serviceimpl/SmsTemplateServiceImpl.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/entity/dos/Region.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/entity/dos/Region.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/entity/dos/Setting.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/entity/dos/Setting.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/entity/dto/SmsSetting.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/entity/dto/SmsSetting.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/entity/dto/connect/WechatConnectSetting.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/entity/dto/connect/WechatConnectSetting.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/entity/dto/connect/WechatConnectSettingItem.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/entity/dto/connect/WechatConnectSettingItem.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/Cpu.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/Cpu.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/Jvm.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/Jvm.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/Mem.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/Mem.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/Server.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/Server.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/Sys.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/Sys.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/SysFile.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/system/server/SysFile.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/user/config/wechat/WxMaConfiguration.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/user/config/wechat/WxMaConfiguration.class" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/permission/service/impl/AdminUserServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/permission/service/impl/AdminUserServiceImpl.class" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/user/entity/User.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/user/entity/User.class" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/user/service/UserService.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/user/service/UserService.class" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/user/service/impl/UserServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/user/service/impl/UserServiceImpl.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/user/token/UserTokenGenerate.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/user/token/UserTokenGenerate.class" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/verification/entity/dos/VerificationSource.class" beforeDir="false" afterPath="$PROJECT_DIR$/framework/target/classes/com/wteam/framework/modules/verification/entity/dos/VerificationSource.class" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/manager-api/src/main/java/com/wteam/manager/ManagerAuthenticationFilter.java" beforeDir="false" afterPath="$PROJECT_DIR$/manager-api/src/main/java/com/wteam/manager/ManagerAuthenticationFilter.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/spring.iml" beforeDir="false" afterPath="$PROJECT_DIR$/spring.iml" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -272,17 +96,15 @@
     <option name="stateVersion" value="1" />
   </component>
   <component name="MavenImportPreferences">
-    <option name="generalSettings">
-      <MavenGeneralSettings>
-        <option name="useMavenConfig" value="true" />
-      </MavenGeneralSettings>
-    </option>
     <option name="importingSettings">
       <MavenImportingSettings>
         <option name="downloadSourcesAutomatically" value="true" />
       </MavenImportingSettings>
     </option>
   </component>
+  <component name="ProjectColorInfo">{
+  &quot;associatedIndex&quot;: 1
+}</component>
   <component name="ProjectId" id="2VQyBxCGebSHWD3BxMfBmNM5QW4" />
   <component name="ProjectLevelVcsManager" settingsEditedManually="true">
     <ConfirmationsSetting value="2" id="Add" />
@@ -291,37 +113,37 @@
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
-  <component name="PropertiesComponent"><![CDATA[{
-  "keyToString": {
-    "ASKED_ADD_EXTERNAL_FILES": "true",
-    "RequestMappingsPanelOrder0": "0",
-    "RequestMappingsPanelOrder1": "1",
-    "RequestMappingsPanelWidth0": "75",
-    "RequestMappingsPanelWidth1": "75",
-    "RunOnceActivity.OpenProjectViewOnStart": "true",
-    "RunOnceActivity.ShowReadmeOnStart": "true",
-    "ToolWindowRun.ShowToolbar": "false",
-    "WebServerToolWindowFactoryState": "false",
-    "git-widget-placeholder": "master",
-    "last_opened_file_path": "D:/gdou-canteen",
-    "node.js.detected.package.eslint": "true",
-    "node.js.detected.package.tslint": "true",
-    "node.js.selected.package.eslint": "(autodetect)",
-    "node.js.selected.package.tslint": "(autodetect)",
-    "nodejs_package_manager_path": "npm",
-    "project.structure.last.edited": "Project",
-    "project.structure.proportion": "0.0",
-    "project.structure.side.proportion": "0.0",
-    "settings.editor.selected.configurable": "editing.templates",
-    "spring.configuration.checksum": "8c885b1d9b6b77e9df49058579a3cf2a",
-    "vue.rearranger.settings.migration": "true"
+  <component name="PropertiesComponent">{
+  &quot;keyToString&quot;: {
+    &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
+    &quot;RequestMappingsPanelOrder0&quot;: &quot;0&quot;,
+    &quot;RequestMappingsPanelOrder1&quot;: &quot;1&quot;,
+    &quot;RequestMappingsPanelWidth0&quot;: &quot;75&quot;,
+    &quot;RequestMappingsPanelWidth1&quot;: &quot;75&quot;,
+    &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;ToolWindowRun.ShowToolbar&quot;: &quot;false&quot;,
+    &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
+    &quot;git-widget-placeholder&quot;: &quot;master&quot;,
+    &quot;last_opened_file_path&quot;: &quot;D:/pojo/dts-shop&quot;,
+    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+    &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
+    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
+    &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
+    &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
+    &quot;project.structure.last.edited&quot;: &quot;Project&quot;,
+    &quot;project.structure.proportion&quot;: &quot;0.0&quot;,
+    &quot;project.structure.side.proportion&quot;: &quot;0.0&quot;,
+    &quot;settings.editor.selected.configurable&quot;: &quot;reference.settingsdialog.IDE.editor.colors.Language Defaults&quot;,
+    &quot;spring.configuration.checksum&quot;: &quot;8c885b1d9b6b77e9df49058579a3cf2a&quot;,
+    &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
   },
-  "keyToStringList": {
-    "DatabaseDriversLRU": [
-      "mysql"
+  &quot;keyToStringList&quot;: {
+    &quot;DatabaseDriversLRU&quot;: [
+      &quot;mysql&quot;
     ]
   }
-}]]></component>
+}</component>
   <component name="ReactorSettings">
     <option name="notificationShown" value="true" />
   </component>
@@ -362,12 +184,12 @@
     </option>
   </component>
   <component name="RunManager" selected="Spring Boot.ClientApiApplication">
-    <configuration name="ApiCallerUtil" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
-      <option name="MAIN_CLASS_NAME" value="com.wteam.framework.modules.hardware.ApiCallerUtil" />
-      <module name="framework" />
+    <configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
+      <option name="MAIN_CLASS_NAME" value="com.wteam.security.Main" />
+      <module name="client-api" />
       <extension name="coverage">
         <pattern>
-          <option name="PATTERN" value="com.wteam.framework.modules.hardware.*" />
+          <option name="PATTERN" value="com.wteam.security.*" />
           <option name="ENABLED" value="true" />
         </pattern>
       </extension>
@@ -388,12 +210,12 @@
         <option name="Make" enabled="true" />
       </method>
     </configuration>
-    <configuration name="SnowFlake" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
-      <option name="MAIN_CLASS_NAME" value="com.wteam.framework.common.utils.SnowFlake" />
-      <module name="framework" />
+    <configuration name="StringDataExtractionTest" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
+      <option name="MAIN_CLASS_NAME" value="com.wteam.controller.card.StringDataExtractionTest" />
+      <module name="client-api" />
       <extension name="coverage">
         <pattern>
-          <option name="PATTERN" value="com.wteam.framework.common.utils.*" />
+          <option name="PATTERN" value="com.wteam.controller.card.*" />
           <option name="ENABLED" value="true" />
         </pattern>
       </extension>
@@ -401,12 +223,12 @@
         <option name="Make" enabled="true" />
       </method>
     </configuration>
-    <configuration name="TimeCalculation" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
-      <option name="MAIN_CLASS_NAME" value="com.wteam.framework.modules.book.entity.reqp.TimeCalculation" />
-      <module name="framework" />
+    <configuration name="com.wteam.controller.card.Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
+      <option name="MAIN_CLASS_NAME" value="com.wteam.controller.card.Main" />
+      <module name="client-api" />
       <extension name="coverage">
         <pattern>
-          <option name="PATTERN" value="com.wteam.framework.modules.book.entity.reqp.*" />
+          <option name="PATTERN" value="com.wteam.controller.card.*" />
           <option name="ENABLED" value="true" />
         </pattern>
       </extension>
@@ -414,12 +236,12 @@
         <option name="Make" enabled="true" />
       </method>
     </configuration>
-    <configuration name="WechatUtil" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
-      <option name="MAIN_CLASS_NAME" value="com.wteam.framework.common.utils.WechatUtil" />
-      <module name="framework" />
+    <configuration name="main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
+      <option name="MAIN_CLASS_NAME" value="com.wteam.controller.card.main" />
+      <module name="client-api" />
       <extension name="coverage">
         <pattern>
-          <option name="PATTERN" value="com.wteam.framework.common.utils.*" />
+          <option name="PATTERN" value="com.wteam.controller.card.*" />
           <option name="ENABLED" value="true" />
         </pattern>
       </extension>
@@ -475,11 +297,11 @@
       </method>
     </configuration>
     <list>
-      <item itemvalue="Application.SnowFlake" />
-      <item itemvalue="Application.WechatUtil" />
-      <item itemvalue="Application.ApiCallerUtil" />
+      <item itemvalue="Application.main" />
+      <item itemvalue="Application.Main" />
+      <item itemvalue="Application.StringDataExtractionTest" />
+      <item itemvalue="Application.com.wteam.controller.card.Main" />
       <item itemvalue="Application.RegistrationTask" />
-      <item itemvalue="Application.TimeCalculation" />
       <item itemvalue="Remote JVM Debug.139" />
       <item itemvalue="Spring Boot.ClientApiApplication" />
       <item itemvalue="Spring Boot.CommonApiApplication" />
@@ -488,10 +310,10 @@
     <recent_temporary>
       <list>
         <item itemvalue="Application.RegistrationTask" />
-        <item itemvalue="Application.ApiCallerUtil" />
-        <item itemvalue="Application.WechatUtil" />
-        <item itemvalue="Application.SnowFlake" />
-        <item itemvalue="Application.TimeCalculation" />
+        <item itemvalue="Application.main" />
+        <item itemvalue="Application.com.wteam.controller.card.Main" />
+        <item itemvalue="Application.StringDataExtractionTest" />
+        <item itemvalue="Application.Main" />
       </list>
     </recent_temporary>
   </component>
@@ -514,8 +336,23 @@
       <workItem from="1696019978925" duration="151008000" />
       <workItem from="1696601308312" duration="675000" />
       <workItem from="1696674064486" duration="8434000" />
-      <workItem from="1696685203750" duration="20365000" />
+      <workItem from="1696685203750" duration="45247000" />
+      <workItem from="1696942478933" duration="29422000" />
+      <workItem from="1697102857964" duration="50076000" />
+      <workItem from="1697271166115" duration="44304000" />
+      <workItem from="1697465578455" duration="11466000" />
+      <workItem from="1697610300076" duration="13582000" />
+      <workItem from="1697626429470" duration="6966000" />
+      <workItem from="1697713030681" duration="1835000" />
+    </task>
+    <task id="LOCAL-00001" summary="init2">
+      <created>1696846465336</created>
+      <option name="number" value="00001" />
+      <option name="presentableId" value="LOCAL-00001" />
+      <option name="project" value="LOCAL" />
+      <updated>1696846465336</updated>
     </task>
+    <option name="localTasksCounter" value="2" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -534,37 +371,8 @@
   </component>
   <component name="VcsManagerConfiguration">
     <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
-  </component>
-  <component name="XDebuggerManager">
-    <breakpoint-manager>
-      <breakpoints>
-        <line-breakpoint enabled="true" type="java-line">
-          <url>file://$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/OrderInfoServiceImpl.java</url>
-          <line>344</line>
-          <option name="timeStamp" value="1" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="java-line">
-          <url>file://$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/OrderInfoServiceImpl.java</url>
-          <line>343</line>
-          <option name="timeStamp" value="2" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="java-line">
-          <url>file://$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/OrderInfoServiceImpl.java</url>
-          <line>342</line>
-          <option name="timeStamp" value="3" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="java-line">
-          <url>file://$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/OrderInfoServiceImpl.java</url>
-          <line>341</line>
-          <option name="timeStamp" value="4" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="java-line">
-          <url>file://$PROJECT_DIR$/framework/src/main/java/com/wteam/framework/modules/book/service/impl/OrderInfoServiceImpl.java</url>
-          <line>340</line>
-          <option name="timeStamp" value="5" />
-        </line-breakpoint>
-      </breakpoints>
-    </breakpoint-manager>
+    <MESSAGE value="init2" />
+    <option name="LAST_COMMIT_MESSAGE" value="init2" />
   </component>
   <component name="XSLT-Support.FileAssociations.UIState">
     <expand />

+ 25 - 1
client-api/src/main/java/com/wteam/controller/card/CardController.java

@@ -84,6 +84,16 @@ public class CardController {
 //        return cardService.chargeCard(accessToken, id);
 //    }
 
+    /**
+     * 租场订单超时的情况为
+     * 支付的时候可以使用微信和储值卡支付
+     * 支付成功变成待使用
+     * 扫码成功第一次变成使用中 第二次如果在规定时间内出来则直接变成已经使用
+     * 如果存在超时的情况 那将会存在超时金额
+     * 前端如果显示存在超时金额 则需要支付
+     * 这里支付也是可以微信支付或者储值卡支付
+     * 两者都是如果支付成功就将状态改为已使用
+     */
 
     /**
      * 使用储值卡支付
@@ -99,6 +109,20 @@ public class CardController {
     }
 
 
+    /**
+     * 使用散客储值卡支付
+     * 散客储值卡只能支付计时订单和次卡
+     *
+     * @param orderId
+     * @param cardId
+     * @return
+     */
+    @Operation(summary = "使用散客储值卡支付")
+    @PostMapping("/personCardPay/{orderId}/{cardId}")
+    public ResultMessage personCardPay(@PathVariable String orderId, @PathVariable Integer cardId) {
+        return cardService.personCardPay(orderId, cardId);
+    }
+
 //    /**
 //     * 储值卡的充值操作
 //     *
@@ -134,7 +158,7 @@ public class CardController {
     }
 
     @Operation(summary = "提交充值卡订单信息")
-    @PostMapping("/getQrCodeByCard/{accessToken}")
+    @PostMapping("/getChargeCardOrder/{accessToken}/{cardId}")
     public ResultMessage getChargeCardOrder(@PathVariable("accessToken") String accessToken,
                                             @ApiParam(value = "卡id", required = true) @PathVariable Integer cardId,
                                             @RequestParam Double currentBalance) {

+ 1 - 1
client-api/src/main/java/com/wteam/controller/court/CourtController.java

@@ -54,7 +54,7 @@ public class CourtController {
      * @param id 门店id
      * @return
      */
-    @Cacheable(value = "storeDetails", key = "#id")
+//    @Cacheable(value = "storeDetails", key = "#id")
     @Operation(summary = "门店信息")
     @GetMapping("/getCourtDetails/{id}")
     public ResultMessage<StoreDetailsVo> getCourtDetails(@ApiParam(value = "门店ID", required = true) @PathVariable("id") Long id) {

+ 201 - 78
client-api/src/main/java/com/wteam/controller/hardware/HardwareController.java

@@ -5,19 +5,21 @@ package com.wteam.controller.hardware;
  * @date 2023/9/27 19:13
  */
 
-import cn.hutool.core.util.ObjectUtil;
-import com.wteam.framework.common.enums.*;
+import cn.hutool.core.util.RandomUtil;
+import com.wteam.framework.common.enums.OrderStatusEnum;
+import com.wteam.framework.common.enums.ResultCode;
+import com.wteam.framework.common.enums.ResultUtil;
+import com.wteam.framework.common.enums.orderTypeEnum;
 import com.wteam.framework.common.security.AuthUser;
 import com.wteam.framework.common.security.context.UserContext;
 import com.wteam.framework.common.vo.ResultMessage;
 import com.wteam.framework.modules.book.entity.Card;
 import com.wteam.framework.modules.book.entity.OrderInfo;
-import com.wteam.framework.modules.book.entity.reqp.hardwareReq;
 import com.wteam.framework.modules.book.entity.vo.TimeCodeVo;
 import com.wteam.framework.modules.book.mapper.CardMapper;
 import com.wteam.framework.modules.book.mapper.OrderInfoMapper;
 import com.wteam.framework.modules.book.service.OrderInfoService;
-import com.wteam.framework.modules.hardware.ApiQrCodeUtil;
+import com.wteam.framework.modules.hardware.QrCodeRegistrationUtil;
 import com.wteam.framework.modules.user.entity.User;
 import com.wteam.framework.modules.user.mapper.UserMapper;
 import io.swagger.v3.oas.annotations.Operation;
@@ -33,6 +35,7 @@ import java.time.Duration;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.Temporal;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
@@ -53,6 +56,35 @@ public class HardwareController {
     @Autowired
     private CardMapper cardMapper;
 
+    private static String lastRequestTime = null; // 用来记录上一次请求的时间
+    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    private static SimpleDateFormat sdfTimer = new SimpleDateFormat("HH:mm");
+
+    /**
+     * 这个时间判断是为了避免存在:因为扫码头会有多次扫到同一个码的情况
+     *
+     * @return
+     */
+    private static boolean isTimeElapsed() {
+        String currentTime = sdf.format(new Date()); // 获取当前时间的字符串表示
+        if (lastRequestTime == null) {
+            // 如果是第一次请求,记录当前时间并返回true
+            lastRequestTime = currentTime;
+            return true;
+        } else {
+            try {
+                Date currentDateTime = sdf.parse(currentTime);
+                Date lastRequestDateTime = sdf.parse(lastRequestTime);
+                long timeElapsed = currentDateTime.getTime() - lastRequestDateTime.getTime();
+                return timeElapsed >= 5000; // 5秒等于5000毫秒
+            } catch (Exception e) {
+                e.printStackTrace();
+                return true; // 如果出现异常,默认返回true以执行程序
+            }
+        }
+    }
+
+
     /**
      * 这里理一下思路
      * 这里是反扫码设置,先前已经使用hutool接口进行第三方的url回调设置了
@@ -68,41 +100,55 @@ public class HardwareController {
      * 然后进行业务处理
      */
     @Operation(summary = "反扫码设备第三方二维码核销说明")
-    @PostMapping("/verification")
-    public ResultMessage hardware(@RequestBody hardwareReq hardwareReq) throws ParseException {
-        //获取请求体中的具体数据
-        String qcode = hardwareReq.getQcode();
-        String time = hardwareReq.getTime();
+    @RequestMapping(value = "/verification", method = RequestMethod.GET)
+    public ResultMessage hardware(@RequestParam(value = "data") String data) throws ParseException {
+        log.info("此时回调的data数据为:{}", data);
+
+        // 使用正则表示判断传入的回调数据是否正确
+        // 定义正则表达式来匹配格式
+        String pattern1 = "\\d{15}_pxo_\\d{8}_\\d{5}_\\d{9}_\\d{2}";
+
+        if (!data.matches(pattern1)) {
+            return ResultUtil.success(ResultCode.HARD_CALL_BACK_DATA_ERROR);
+        }
+
+        String orderId = null;
+
+        // 获取当前时间
+        Date now = new Date();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String time = sdf.format(now); // 格式化当前时间为字符串
         log.info("此时扫码的时间为:{}", time);
-        String devmac = hardwareReq.getDevmac();
-        log.info("此时获取的二维码为{}", qcode);
+
+        boolean timeElapsed = isTimeElapsed();
+        log.info("此时的间隔是否大于5秒:{}", timeElapsed);
+
+        if (!timeElapsed) {
+            return ResultUtil.success(ResultCode.SAOMA_TIME_TAI_DUAN);
+        }
+
         // 定义正则表达式来匹配数字
-        Pattern pattern = Pattern.compile("\\d+");
-        Matcher matcher = pattern.matcher(qcode);
-        //解析qcode的值
-        String date = null;
-        String userId = null;
-        String orderId = null;
-        // 查找并存储匹配的数字
-        int count = 0;
-        while (matcher.find() && count < 3) {
-            String number = matcher.group();
-            if (count == 0) {
-                date = number;
-            } else if (count == 1) {
-                userId = number;
-            } else if (count == 2) {
-                orderId = number;
-            }
-            count++;
+        String pattern2 = "\\d{9}"; // 匹配9位数字
+
+        Pattern r = Pattern.compile(pattern2);
+        Matcher m = r.matcher(data);
+
+        String result = null;
+
+        while (m.find()) {
+            result = m.group(); // 获取匹配的子字符串
+        }
+
+        if (result != null) {
+            // 将result的值赋给orderId
+            orderId = result;
+        } else {
+            log.info("此时获得错误的orderId为:{}", result);
         }
-        log.info("此时获取出来的userId为{}", userId);
-        log.info("此时获取出来的orderId为{}", orderId);
+
         OrderInfo orderInfo = orderInfoMapper.selectById(orderId);
         log.info("此时的订单信息为{}", orderInfo);
-        if (orderInfo == null) {
-            return ResultUtil.error(ResultCode.ENTITY_NULL);
-        }
+
         //这里先判断是什么订单
         String orderType = orderInfo.getOrderType();
 
@@ -116,20 +162,20 @@ public class HardwareController {
                 return TicketOrder(orderId, time);
             case "TIMER":
                 // 处理计时订单类型的二维码注销逻辑
+                // 将时间转化为HH:mm 形式
                 return TimerOrder(orderId, time);
             case "MONTHLY":
                 // 处理月卡订单类型的二维码注销逻辑
                 return MonthlyOrder(orderId, time);
             default:
                 // 处理未知订单类型的情况
-                break;
+                return null;
         }
-        return null;
     }
 
+
     /**
      * 门票的扫码逻辑
-     * 只要数据库存在这个二维码即可
      * 在二维码注册的时候就已经限制的门票只能核销两次
      *
      * @param orderId
@@ -138,32 +184,36 @@ public class HardwareController {
     private ResultMessage TicketOrder(String orderId, String time) throws ParseException {
         //获取订单信息
         OrderInfo orderInfo = orderInfoMapper.selectById(orderId);
+
         //处理时间格式
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
         Date currentTime = dateFormat.parse(time);
+
         //处理业务代码
         //先处理订场订单的情况
         if (orderTypeEnum.TICKET.toString().equals(orderInfo.getOrderType())) {
+
             if (orderInfo.getStartTime() == null) {
+
                 // 第一次调用接口,设置startTime
                 orderInfo.setStartTime(currentTime);
+                log.info("使用次卡二维码第一次进入的时间为:{}", currentTime);
                 orderInfo.setOrderState(String.valueOf(OrderStatusEnum.IN_USE));
                 orderInfoMapper.updateById(orderInfo);
-                String qrCode = orderInfo.getQrCode();
-                if (ObjectUtil.isNull(qrCode)) {
-                    return ResultUtil.error(ResultCode.QRCODE_ERROR);
-                }
+
             } else {
+
                 if (orderInfo.getEndTime() == null) {
                     // 第二次调用接口,设置endTime,并计算费用
                     orderInfo.setEndTime(currentTime);
+                    log.info("使用次卡二维码出门的时间为:{}", currentTime);
                     orderInfo.setOrderState(String.valueOf(OrderStatusEnum.USED));
                     orderInfoMapper.updateById(orderInfo);
-                    return ResultUtil.success(ResultCode.QRCODE);
+
                 }
             }
         }
-        return ResultUtil.error(ResultCode.QRCODE_ERROR);
+        return ResultUtil.error(ResultCode.TICKET_HARD_ERROR);
     }
 
     /**
@@ -182,8 +232,6 @@ public class HardwareController {
         //获取order信息
         //获取订单信息
         OrderInfo orderInfo = orderInfoMapper.selectById(orderId);
-        //处理业务代码
-        String qrCode = orderInfo.getQrCode();
         //获得卡信息
         Integer cardId = orderInfo.getCardId();
         Card card = cardMapper.selectById(cardId);
@@ -194,12 +242,9 @@ public class HardwareController {
         Date endDateDate = sdf.parse(endDate);
         //处理扫码业务
         if (timeDate.before(endDateDate)) {
-            if (ObjectUtil.isNotNull(qrCode)) {
-                return ResultUtil.success(ResultCode.QRCODE);
-            }
+            return ResultUtil.success();
         }
-        // time 在 endDate 之后或者相等
-        return ResultUtil.error(ResultCode.QRCODE_ERROR);
+        return ResultUtil.error(ResultCode.MONTHLY_HARD_ERROR);
     }
 
 
@@ -214,63 +259,99 @@ public class HardwareController {
     private ResultMessage TimerOrder(String orderId, String time) {
         //获取订单信息
         OrderInfo orderInfo = orderInfoMapper.selectById(orderId);
-        //处理时间格式
-        //处理时间格式
-        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
+
+        // 处理时间格式
+        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
+        // 获取当前日期和时间
+        Date currentDate = new Date();
+        String format = sdf1.format(currentDate);
+
         Date date = sdf.parse(time);
+        log.info("此刻的传入的时间为:{}", date);
+
         // 设置不同时间段的价格
-        Date startTime1 = sdf.parse("09:30");
-        Date endTime1 = sdf.parse("18:00");
-        Date startTime2 = sdf.parse("18:30");
+        Date startTime1 = sdf.parse(format + " 09:30:00");
+        Date endTime1 = sdf.parse(format + " 18:00:00");
+        Date startTime2 = sdf.parse(format + " 18:30:00");
+        log.info("此时格式化的三个时间段为:{},{},{}", startTime1, endTime1, startTime2);
 
         //先处理订场订单的情况
         if (orderInfo.getStartTime() == null) {
+
             // 第一次调用接口,设置startTime
             orderInfo.setStartTime(date);
             orderInfo.setOrderState(String.valueOf(OrderStatusEnum.IN_USE));
-            log.info("此时的订单信息为:{}", orderInfo);
+            log.info("此时第一次调用接口设置的计时订单的进场时间为:{}", date);
             orderInfoMapper.updateById(orderInfo);
+
             if (date.after(startTime1) && date.before(endTime1)) {
+
                 // 当前时间在 09:30 - 18:00 之间,价格为 8 元/小时
                 double initialPrice = 8.0;
                 orderInfo.setOrderPrice(initialPrice);
                 orderInfo.setOrderState(String.valueOf(OrderStatusEnum.WAITING_TO_PAY));
+                log.info("09:30 - 18:00这个时间段的订单信息为:{}", orderInfo);
                 orderInfoService.updateById(orderInfo);
-                return ResultUtil.success(ResultCode.QRCODE);
+
             } else if (date.after(startTime2)) {
+
                 // 当前时间在 18:30 之后,价格为 10 元/小时
                 double initialPrice = 10.0;
                 orderInfo.setOrderPrice(initialPrice);
                 orderInfo.setOrderState(String.valueOf(OrderStatusEnum.WAITING_TO_PAY));
+                log.info("18 :30 之后的这个时间段的订单信息为:{}", orderInfo);
                 orderInfoService.updateById(orderInfo);
-                return ResultUtil.success(ResultCode.QRCODE);
+
             }
+
         } else {
+
             if (orderInfo.getEndTime() == null) {
+
                 // 第二次调用接口,设置endTime,并计算费用
                 orderInfo.setEndTime(date);
+                log.info("此时第二次调用接口设置的计时订单的进场时间为:{}", date);
+
                 // 计算时间差(以分钟为单位)
                 long timeDifferenceMillis = orderInfo.getEndTime().getTime() - orderInfo.getStartTime().getTime();
                 long minutesDifference = TimeUnit.MILLISECONDS.toMinutes(timeDifferenceMillis);
+
                 // 计算超出一分钟的时间
-                long extraMinutes = Math.max(0, minutesDifference - 1);
-                // 根据超出的分钟计算费用
-                double pricePerMinute = 8.0 / 60.0; // 8元/60分钟
-                double totalPrice = pricePerMinute * extraMinutes;
-                orderInfo.setOverPrice(totalPrice);
-                orderInfo.setOrderState(String.valueOf(OrderStatusEnum.WAITING_SUPPLEMENTS));
+                long extraMinutes = Math.max(0, minutesDifference - 60);
+                log.info("计时订单超出一分钟的时间为:{}", extraMinutes);
+
+                // 考虑超时的情况
+                if (extraMinutes > 0) {
+
+                    // 计算超时分钟数
+                    long l = extraMinutes % 60;
+
+                    // 根据超出的分钟计算费用
+                    // 8元/60分钟
+                    double pricePerMinute = 8.0 / 60.0;
+                    double totalPrice = pricePerMinute * l;
+                    orderInfo.setOverPrice(totalPrice);
+                    log.info("计时订单超时金额为:{}", totalPrice);
+                    orderInfo.setOrderState(String.valueOf(OrderStatusEnum.WAITING_SUPPLEMENTS));
+
+                    orderInfoService.updateById(orderInfo);
+                }
+
+                //如果没有超时 该计时订单完成
+                orderInfo.setOrderState(String.valueOf(OrderStatusEnum.USED));
+                log.info("使用完成的计时订单信息为:{}", orderInfo);
                 orderInfoService.updateById(orderInfo);
+
             }
-            return ResultUtil.success(ResultCode.QRCODE);
         }
-        return ResultUtil.success(ResultCode.QRCODE);
+        return ResultUtil.error(ResultCode.TIMER_HARD_ERROR);
     }
 
 
     /**
      * 租场订单实现逻辑
      * 先获取第一次时间设置为用户进场时间 第二次时间先判断是否在订场时间段之内 如果在就直接放行
-     * 超过订场时间段,则计算超出订场时间、
+     * 超过订场时间段,则计算超出订场时间
      *
      * @param orderId
      * @return
@@ -278,46 +359,83 @@ public class HardwareController {
     private ResultMessage RentalOrder(String orderId, String time) throws ParseException {
         //获取订单信息
         OrderInfo orderInfo = orderInfoMapper.selectById(orderId);
+        log.info("传入的时间为:{}", time);
+
         //处理时间格式
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Date currentTime = dateFormat.parse(time);
+        log.info("此刻的时间为:{}", currentTime);
+
+
+        //处理可能会出现提前扫码的情况
+        // 1-->保证在订场开始时间的前30分钟扫码才有效
+        // 获取原始时间
+        Date orderSt = orderInfo.getOrderSt();
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(orderSt);
+
+        // 减去30分钟
+        calendar.add(Calendar.MINUTE, -30);
+        Date newTime = calendar.getTime();
+        log.info("该订单开始时间减去30分钟之后的时间为:{}", newTime);
+
+        // 判断时间
+        if (currentTime.after(newTime)) {
+            return ResultUtil.success(ResultCode.TIME_BU_DAO);
+        }
+
         //先处理订场订单的情况
         if (orderTypeEnum.RENTAL.toString().equals(orderInfo.getOrderType())) {
-            if (orderInfo.getStartTime() == null) {
+
+            if (orderInfo.getStartTime() == null && orderInfo.getOrderState().equals(OrderStatusEnum.WAITING_TO_USE)) {
+
                 // 第一次调用接口,设置startTime
                 orderInfo.setStartTime(currentTime);
+                log.info("使用租场二维码的进场时间为:{}", currentTime);
                 orderInfo.setOrderState(String.valueOf(OrderStatusEnum.IN_USE));
                 orderInfoMapper.updateById(orderInfo);
-                return ResultUtil.data(ResultCode.QRCODE);
+
             } else {
+
                 if (orderInfo.getEndTime() == null) {
+
                     // 第二次调用接口,设置endTime,并计算费用
                     orderInfo.setEndTime(currentTime);
+                    log.info("使用租场二维码的出场时间为:{}", currentTime);
                     orderInfoMapper.updateById(orderInfo);
+
                     // 校验当前时间是否在ordered时间之前
                     if (currentTime.before(orderInfo.getOrderEd())) {
+
                         // 在ordered时间之前,返回状态码200
                         orderInfo.setOrderState(String.valueOf(OrderStatusEnum.USED));
                         orderInfoMapper.updateById(orderInfo);
-                        return ResultUtil.data(ResultCode.QRCODE);
+
                     } else {
+
                         // 超过ordered时间,计算超过的分钟数
                         long minutesDifference = calculateMinutesDifference(orderInfo.getOrderEd(), currentTime);
-                        //计算超时需要付钱金额
+
+                        //  计算超时需要付钱金额
                         double v = calculateAmount(minutesDifference);
+
                         //获取订单支付金额
                         Double orderPrice = orderInfo.getOrderPrice();
+
                         //需要支付的金额
                         double v1 = v * orderPrice;
+                        log.info("租场超时金额为:{}", v1);
                         orderInfo.setOverPrice(v1);
                         orderInfoService.updateById(orderInfo);
+
                     }
                 }
             }
         }
-        return ResultUtil.error(ResultCode.QRCODE_ERROR);
+        return ResultUtil.error(ResultCode.RENTAL_HARD_ERROR);
     }
 
+
     // 计算分钟差
     private long calculateMinutesDifference(Date startTime, Date endTime) {
         Duration duration = Duration.between((Temporal) startTime, (Temporal) endTime);
@@ -339,7 +457,7 @@ public class HardwareController {
         return billingAmount;
     }
 
-    //        // 查询是否存在相同的二维码订单信息
+//        // 查询是否存在相同的二维码订单信息
 //        LambdaQueryWrapper<OrderInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 //        lambdaQueryWrapper.eq(OrderInfo::getQrCode, qcode);
 //        List<OrderInfo> orderInfos = orderInfoMapper.selectList(lambdaQueryWrapper);
@@ -389,15 +507,20 @@ public class HardwareController {
          * 这里存储计时订单信息
          */
         OrderInfo orderInfo = new OrderInfo();
+        String orderId = RandomUtil.randomNumbers(9);
+        orderInfo.setId(orderId);
         orderInfo.setUserId(userId);
         orderInfo.setCreateTime(new Date());
         orderInfo.setStoreId(9376L);
         orderInfo.setOrderType(String.valueOf(orderTypeEnum.TIMER));
-        orderInfo.setOrderPrice((double) 100);
         orderInfoService.save(orderInfo);
 
-        String data = "pxo_" + formattedDate + "_" + userId + "_" + orderInfo.getId() + "_00";
-        Boolean flag = ApiQrCodeUtil.callApiWithUser(data);
+        //生成一个随机数字
+        String numbers = RandomUtil.randomNumbers(5);
+
+        String data = "pxo_" + formattedDate + "_" + numbers + "_" + orderInfo.getId() + "_00";
+
+        Boolean flag = QrCodeRegistrationUtil.registerTimerQrCode(data);
 
         if (flag) {
             orderInfo.setQrCode(data);

+ 37 - 4
client-api/src/main/java/com/wteam/controller/hardware/PollingController.java

@@ -1,5 +1,38 @@
-package com.wteam.controller.hardware;/**
- * @author  doncic
- * @date  2023/10/14 13:34
- */public class PollingController {
+package com.wteam.controller.hardware;
+
+import com.wteam.framework.common.vo.ResultMessage;
+import com.wteam.framework.modules.book.service.OrderInfoService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.nfunk.jep.function.Sum;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.security.KeyStore;
+
+/**
+ * @author doncic
+ * @date 2023/10/14 13:34
+ */
+
+@Slf4j
+@Tag(name = "轮询相关接口管理")
+@RestController
+@RequestMapping("/v1/poll")
+public class PollingController {
+
+    @Autowired
+    private OrderInfoService orderInfoService;
+
+
+    @Operation(summary = "轮询计时码订单状态")
+    @GetMapping("/getTimer/{userId}")
+    public ResultMessage getTimer(@PathVariable String userId) {
+        return orderInfoService.getTimer(userId);
+
+    }
 }

+ 2 - 7
client-api/src/main/java/com/wteam/controller/order/OrderController.java

@@ -1,23 +1,16 @@
 package com.wteam.controller.order;
 
-import com.wteam.framework.common.enums.ResultUtil;
 import com.wteam.framework.common.vo.ResultMessage;
 import com.wteam.framework.modules.book.entity.dto.OrderReq;
 import com.wteam.framework.modules.book.service.OrderInfoService;
-import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiParam;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.bean.WxJsapiSignature;
-import me.chanjar.weixin.common.error.WxErrorException;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.*;
 
-import javax.print.DocFlavor;
-import java.sql.Timestamp;
 import java.util.Date;
 
 /**
@@ -30,6 +23,7 @@ import java.util.Date;
 @RequestMapping("/v1/order")
 public class OrderController {
 
+
     @Autowired
     private OrderInfoService orderInfoService;
 
@@ -50,6 +44,7 @@ public class OrderController {
 
     /**
      * 根据获取当前时间的订单信息,从而得到场地订场情况
+     *
      * @return
      */
     @Operation(summary = "订场情况查询")

+ 81 - 14
client-api/src/main/java/com/wteam/controller/order/QrCodeController.java

@@ -1,23 +1,35 @@
 package com.wteam.controller.order;
 
 import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.RandomUtil;
 import cn.hutool.extra.qrcode.QrCodeUtil;
 import cn.hutool.extra.qrcode.QrConfig;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
+import com.egzosn.pay.common.bean.PayOutMessage;
+import com.wteam.framework.common.enums.ResultCode;
 import com.wteam.framework.common.enums.ResultUtil;
+import com.wteam.framework.common.exception.ServiceException;
 import com.wteam.framework.common.vo.ResultMessage;
+import com.wteam.framework.modules.hardware.ApiCallerUtil;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.web.bind.annotation.*;
 
 import javax.imageio.ImageIO;
 import java.awt.image.BufferedImage;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.Base64;
+import java.util.Random;
+
+import static java.lang.String.valueOf;
 
 /**
  * @author doncic
@@ -29,15 +41,70 @@ import java.util.Base64;
 @RequestMapping("/v1/qrcode")
 public class QrCodeController {
 
-    /**
-     * 生成一个临时二维码
-     *
-     * @return
-     * @throws IOException
-     */
-    @Operation(summary = "生成临时二维码")
-    @PostMapping("/createQrCode")
-    public ResultMessage createQrCode() {
-        return null;
+
+    //TODO :免费场次直接获取二维码进入即可 中间是随机数据 第二位到时候可能加上用户信息
+    @Operation(summary = "获得免费场次的二维码")
+    @GetMapping("/getCode/{userId}")
+    public ResultMessage<String> getCode(@PathVariable String userId) {
+        // 获取当前日期
+        LocalDate currentDate = LocalDate.now();
+        // 格式化日期为字符串
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
+        String formattedDate = currentDate.format(formatter);
+        String numbers1 = RandomUtil.randomNumbers(5);
+        String numbers2 = RandomUtil.randomNumbers(5);
+        String data = "pxo_" + formattedDate + "_" + numbers1 + "_" + numbers2 + "_00";
+        log.info("此时生成的二维码为:{} ", data);
+
+        // 接口地址和参数
+        String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
+        //这个mac为出门
+        String mac1 = "863569068849199";
+        /**
+         * 进
+         * 出
+         * 863569068848969
+         * 863569068849199
+         */
+        //这个mac为进门
+        String mac2 = "863569068848969";
+        String s = callApiWithMac(apiUrl, mac1, mac2, data);
+        log.info("此时mac1注册生成的二维码为:{}", s);
+        return ResultUtil.data(s);
+    }
+
+    public String callApiWithMac(String apiUrl, String mac1, String mac2, String data) {
+        String tk = ApiCallerUtil.callApi(mac1);
+        log.info("此时获取到的token为:{} ", tk);
+
+        // 拼接两个 MAC 地址,以逗号分隔
+        String macParam = mac1 + "_" + mac2;
+        log.info("此时拼接的macParam为:{}", macParam);
+
+
+        //调用hutool接口注册二维码信息
+        HttpResponse response = HttpRequest.post(apiUrl)
+                .form("mac", macParam)
+                .form("tk", tk)
+                .form("qcodetxt", data)
+                .form("enablecount", 100)
+                .execute();
+
+        String body = response.body();
+        JSONObject json = new JSONObject(body);
+        int code = json.getInt("code");
+        log.info("此时返回的code为:{}", code);
+        String qcodetxt = json.getStr("qcodetxt");
+        log.info("此时返回的qcodetxt为:{}", qcodetxt);
+        String desc = json.getStr("desc");
+        log.info("此时返回的desc为:{}", desc);
+
+        if (code != 0 && code != 4) {
+            throw new ServiceException("硬件回调url设置接口异常!");
+        }
+        log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
+        return data;
     }
+
 }
+

+ 44 - 20
client-api/src/main/java/com/wteam/controller/payment/CashierController.java

@@ -1,10 +1,18 @@
 package com.wteam.controller.payment;
 
 
+import cn.hutool.core.util.IdUtil;
 import com.egzosn.pay.common.bean.RefundOrder;
 import com.egzosn.pay.common.bean.RefundResult;
+import com.egzosn.pay.wx.api.WxPayConfigStorage;
+import com.egzosn.pay.wx.v3.api.WxPayService;
+import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
+import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
 import com.wteam.framework.common.exception.ServiceException;
 import com.wteam.framework.common.vo.ResultMessage;
+import com.wteam.framework.modules.book.entity.OrderInfo;
 import com.wteam.framework.modules.book.service.OrderInfoService;
 import com.wteam.framework.modules.pay.entity.enums.PaymentClientEnum;
 import com.wteam.framework.modules.pay.entity.enums.PaymentMethodEnum;
@@ -15,11 +23,15 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.Map;
 
 
 /**
@@ -36,8 +48,6 @@ public class CashierController {
 
     @Autowired
     private CashierSupport cashierSupport;
-
-
     @Autowired
     private OrderInfoService orderInfoService;
 
@@ -52,24 +62,38 @@ public class CashierController {
 //        return ResultUtil.data(cashierParam);
 //    }
 
-    //TODO:退款接口待办 实现的有点问题
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "paymentMethod", value = "支付方式", paramType = "path", allowableValues = "WECHAT"),
-    })
-    @ApiOperation(value = "退款")
-    @RequestMapping(value = "/refund/{paymentMethod}/{sn}", method = {RequestMethod.POST})
-    public RefundResult refund(HttpServletRequest request, @PathVariable String paymentMethod, @PathVariable String sn) {
-        PaymentMethodEnum paymentMethodEnum = PaymentMethodEnum.valueOf(paymentMethod);
-        try {
-            return cashierSupport.refund(paymentMethodEnum, request, sn);
-        } catch (ServiceException se) {
-            log.info("支付异常", se);
-            throw se;
-        } catch (Exception e) {
-            log.error("收银台支付错误", e);
-        }
-        return null;
-    }
+//    //TODO:退款接口待办 实现的有点问题
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "paymentMethod", value = "支付方式", paramType = "path", allowableValues = "WECHAT"),
+//    })
+//    @ApiOperation(value = "退款")
+//    @RequestMapping(value = "/refund/{paymentMethod}/{sn}", method = {RequestMethod.POST})
+//    public RefundResult processRefund(HttpServletRequest request, @PathVariable String paymentMethod, @PathVariable String sn) {
+//        PaymentMethodEnum paymentMethodEnum = PaymentMethodEnum.valueOf(paymentMethod);
+//        try {
+//
+//
+////            return refund(refundOrder);
+//
+//        } catch (ServiceException se) {
+//            log.info("支付异常", se);
+//            throw se;
+//        } catch (Exception e) {
+//            log.error("收银台支付错误", e);
+//        }
+//        return null;
+//    }
+//
+//    /**
+//     * 申请退款接口
+//     *
+//     * @param order 订单的请求体
+//     * @return 返回支付方申请退款后的结果
+//     */
+//    @RequestMapping("refund")
+//    public RefundResult refund(RefundOrder order) {
+//        return service.refund(order);
+//    }
 
 
     @ApiImplicitParams({@ApiImplicitParam(name = "paymentMethod", value = "支付方式", paramType = "path", allowableValues = "WECHAT,ALIPAY"),})

+ 135 - 5
client-api/src/main/java/com/wteam/controller/payment/CashierRefundController.java

@@ -1,5 +1,135 @@
-package com.wteam.controller.payment;/**
- * @author  doncic
- * @date  2023/10/10 20:13
- */public class CashierRefundController {
-}
+package com.wteam.controller.payment;
+
+import com.wteam.framework.common.enums.OrderStatusEnum;
+import com.wteam.framework.common.enums.ResultCode;
+import com.wteam.framework.common.enums.ResultUtil;
+import com.wteam.framework.common.exception.ServiceException;
+import com.wteam.framework.common.vo.ResultMessage;
+import com.wteam.framework.modules.book.entity.Card;
+import com.wteam.framework.modules.book.entity.OrderInfo;
+import com.wteam.framework.modules.book.mapper.CardMapper;
+import com.wteam.framework.modules.book.mapper.OrderInfoMapper;
+import com.wteam.framework.modules.book.service.OrderInfoService;
+import com.wteam.framework.modules.pay.entity.enums.PaymentMethodEnum;
+import com.wteam.framework.modules.pay.serviceimpl.CashierSupport;
+import com.wteam.framework.modules.pay.serviceimpl.RefundSupport;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * @author doncic
+ * @date 2023/10/10 20:13
+ */
+@Slf4j
+@RestController
+@Tag(name = "退款相关接口管理")
+@RequestMapping("/v1/payment/refund")
+public class CashierRefundController {
+
+
+    @Autowired
+    private CashierSupport cashierSupport;
+    @Autowired
+    private OrderInfoMapper orderInfoMapper;
+    @Autowired
+    private CardMapper cardMapper;
+
+
+    //TODO:退款接口待办 实现的有点问题
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "paymentMethod", value = "支付方式", paramType = "path", allowableValues = "WECHAT"),
+    })
+    @ApiOperation(value = "退款")
+    @RequestMapping(value = "/refund/{paymentMethod}/{sn}", method = {RequestMethod.POST})
+    public Object processRefund(HttpServletRequest request, @PathVariable String paymentMethod, @PathVariable String sn) {
+        PaymentMethodEnum paymentMethodEnum = PaymentMethodEnum.valueOf(paymentMethod);
+        try {
+            return cashierSupport.refund(paymentMethodEnum, sn);
+        } catch (ServiceException se) {
+            log.info("支付异常", se);
+            throw se;
+        } catch (Exception e) {
+            log.error("收银台支付错误", e);
+        }
+        return null;
+    }
+
+
+    @Operation(summary = "使用储值卡购买租场订场退款")
+    @PostMapping("/cardRefund/{orderId}")
+    @Transactional
+    public ResultMessage cardRefund(@PathVariable String orderId) {
+        try {
+            OrderInfo orderInfo = orderInfoMapper.selectById(orderId);
+            if (orderInfo == null) {
+                return ResultUtil.success();
+            }
+
+            Double orderPrice = orderInfo.getOrderPrice();
+            Integer cardId = orderInfo.getCardId();
+            Card card = cardMapper.selectById(cardId);
+
+            if (card == null) {
+                return ResultUtil.success();
+            }
+
+            //1、只有订场订单可以进行退款 24小时前退款
+            long orderDate = orderInfo.getOrderDate().getTime();
+            log.info("该订单的预约日期为:{}", orderDate);
+
+            // 获取当前日期前一天的日期
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(new Date());
+            calendar.add(Calendar.DAY_OF_YEAR, -1);
+            Date oneDayBefore = calendar.getTime();
+            long oneDayBeforeTime = oneDayBefore.getTime();
+            log.info("当前日期的前一天为:{}", oneDayBeforeTime);
+
+
+            long isOrderDateBeforeOneDayBefore = orderDate - oneDayBeforeTime;
+            // 转换为天数
+            long millisecondsInDay = 24 * 60 * 60 * 1000; // 1天有多少毫秒
+            long daysDifference = isOrderDateBeforeOneDayBefore / millisecondsInDay;
+            log.info("相减之后天数为:{}", daysDifference);
+
+            //判断时间是否为24小时之内
+            boolean isGreaterThanOneDay = daysDifference > 1;
+
+            String orderState = orderInfo.getOrderState();
+            //判断只有还未使用的订单才能够退款
+            boolean isOrderStateValid = "WAITING_TO_USE".equals(orderState);
+
+            log.info("此时的布尔值为:{},{}", isOrderStateValid, isGreaterThanOneDay);
+
+            // 在订单日期前一天且订单状态符合要求时可以进行退款
+            if (isGreaterThanOneDay && isOrderStateValid) {
+
+                Double currentBalance = card.getCurrentBalance();
+                double newBalance = currentBalance + orderPrice;
+                card.setCurrentBalance(newBalance);
+                cardMapper.updateById(card);
+
+                orderInfo.setOrderState(String.valueOf(OrderStatusEnum.REFUNDED));
+                orderInfoMapper.updateById(orderInfo);
+
+                return ResultUtil.success();
+            }
+        } catch (Exception e) {
+            // 处理异常,如数据库操作失败
+            log.info("储值卡购买的租场订单退款错误为:{}", e.getMessage());
+        }
+        return ResultUtil.error(ResultCode.TIME_NOT_REFUND);
+    }
+}

+ 5 - 1
client-api/src/main/java/com/wteam/controller/user/UserController.java

@@ -70,14 +70,17 @@ public class UserController {
         return userService.showOrder(id);
     }
 
+
+
     @Operation(summary = "查看对应类型的订单信息")
     @GetMapping("/showOrder/{orderTypeEnum}/{id}")
     public ResultMessage showOrderByType(
             @PathVariable("id") String id,
-            @PathVariable OrderTypeEnums orderTypeEnum) {
+            @PathVariable OrderTypeEnums orderTypeEnum) throws NullPointerException {
         return userService.showOrderByType(id, orderTypeEnum);
     }
 
+
     /**
      * 查看我的卡情况
      * id
@@ -94,6 +97,7 @@ public class UserController {
     }
 
 
+
     @Operation(summary = "查看我的优惠卷")
     @PostMapping("/showMyCoupon/{accessToken}")
     private ResultMessage<CouponUser> showMyCoupon(@NotNull @PathVariable String accessToken) {

+ 11 - 0
client-api/src/main/java/com/wteam/controller/wxlogin/WxMaUserController.java

@@ -4,6 +4,7 @@ import com.wteam.framework.common.enums.ResultCode;
 import com.wteam.framework.common.enums.ResultUtil;
 import com.wteam.framework.common.security.enums.UserEnums;
 import com.wteam.framework.common.vo.ResultMessage;
+import com.wteam.framework.modules.permission.service.AdminUserService;
 import com.wteam.framework.modules.user.entity.User;
 import com.wteam.framework.modules.user.entity.dto.WechatMPLoginParams;
 import com.wteam.framework.modules.user.service.UserService;
@@ -18,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.validation.constraints.NotNull;
 import java.util.Map;
 //DONE
 
@@ -36,6 +38,8 @@ public class WxMaUserController {
 
     @Autowired
     private UserService userService;
+    @Autowired
+    private AdminUserService adminUserService;
 
     /**
      * 登陆接口
@@ -160,6 +164,13 @@ public class WxMaUserController {
     }
 
 
+    @Operation(summary = "刷新token")
+    @GetMapping("/refresh/{refreshToken}")
+    public ResultMessage<Object> refreshToken(@NotNull(message = "刷新token不能为空") @PathVariable String refreshToken) {
+        return ResultUtil.data(this.adminUserService.refreshToken(refreshToken));
+    }
+
+
 //    /***
 //     * 退出登录
 //     * @return

+ 9 - 5
client-api/src/main/java/com/wteam/security/ClientAuthenticationFilter.java

@@ -126,7 +126,7 @@ public class ClientAuthenticationFilter extends BasicAuthenticationFilter {
     private final Cache cache;
 
     public ClientAuthenticationFilter(AuthenticationManager authenticationManager,
-                                       Cache cache) {
+                                      Cache cache) {
         super(authenticationManager);
         this.cache = cache;
     }
@@ -175,19 +175,23 @@ public class ClientAuthenticationFilter extends BasicAuthenticationFilter {
             AuthUser authUser = new Gson().fromJson(json, AuthUser.class);
 
             //校验redis中是否有权限
-            if (cache.hasKey(CachePrefix.ACCESS_TOKEN.getPrefix(UserEnums.MEMBER) + jwt)) {
+            // TODO :这里修改USER
+            if (cache.hasKey(CachePrefix.ACCESS_TOKEN.getPrefix(UserEnums.USER) + jwt)) {
                 //用户角色
                 List<GrantedAuthority> auths = new ArrayList<>();
-                auths.add(new SimpleGrantedAuthority("ROLE_" + authUser.getRole().name()));
+                // TODO :这里修改toUpperCase
+                auths.add(new SimpleGrantedAuthority("ROLE_" + authUser.getRole().name().toUpperCase()));
                 //构造返回信息
                 UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(authUser.getUsername(), null, auths);
                 authentication.setDetails(authUser);
                 return authentication;
             }
-            if (cache.hasKey(CachePrefix.ACCESS_TOKEN.getPrefix(UserEnums.MANAGER) + jwt)) {
+            // TODO :这里修改USER
+            if (cache.hasKey(CachePrefix.ACCESS_TOKEN.getPrefix(UserEnums.USER) + jwt)) {
                 //用户角色
                 List<GrantedAuthority> auths = new ArrayList<>();
-                auths.add(new SimpleGrantedAuthority("ROLE_" + authUser.getRole().name()));
+                // TODO :这里修改toUpperCase
+                auths.add(new SimpleGrantedAuthority("ROLE_" + authUser.getRole().name().toUpperCase()));
                 //构造返回信息
                 UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(authUser.getUsername(), null, auths);
                 authentication.setDetails(authUser);

+ 11 - 13
client-api/src/main/java/com/wteam/security/ClientSecurityConfig.java

@@ -58,43 +58,41 @@ public class ClientSecurityConfig extends WebSecurityConfigurerAdapter {
 
     @Override
     public void configure(WebSecurity web) throws Exception {
-        web.ignoring().antMatchers("/v3/api-docs/**", "/swagger-ui/**", "v3/api-docs/swagger-config");
+        web.ignoring().antMatchers("/v3/api-docs/**", "/swagger-ui/**", "v3/api-docs/swagger-config", "/v1/court/**");
     }
 
     @Override
     protected void configure(HttpSecurity http) throws Exception {
 
-        ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = http
-                .authorizeRequests();
+        ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = http.authorizeRequests();
         //配置的url 不需要授权
         for (String url : ignoredUrlsProperties.getUrls()) {
             registry.antMatchers(url).permitAll();
         }
-        registry
-                .and()
+        registry.and()
                 //禁止网页iframe
-                .headers().frameOptions().disable()
+                .headers()
+                .frameOptions()
+                .disable()
                 .and()
                 .logout()
                 .permitAll()
                 .and()
                 .authorizeRequests()
-                .antMatchers("/v1/**").anonymous()
+                .antMatchers("/v1/**")
+                .anonymous()
                 //任何请求
                 .anyRequest()
                 //需要身份认证
-                .authenticated()
-                .and()
+                .authenticated().and()
                 //允许跨域
                 .cors().configurationSource((CorsConfigurationSource) SpringContextUtil.getBean("corsConfigurationSource")).and()
                 //关闭跨站请求防护
                 .csrf().disable()
                 //前后端分离采用JWT 不需要session
-                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
-                .and()
+                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
                 //自定义权限拒绝处理类
-                .exceptionHandling().accessDeniedHandler(accessDeniedHandler)
-                .and()
+                .exceptionHandling().accessDeniedHandler(accessDeniedHandler).and()
                 //添加JWT认证过滤器
                 .addFilter(new ClientAuthenticationFilter(authenticationManager(), cache));
     }

BIN
client-api/target/classes/com/wteam/controller/wxlogin/WxMaUserController.class


BIN
client-api/target/classes/com/wteam/security/ClientAuthenticationFilter.class


BIN
client-api/target/classes/com/wteam/security/ClientSecurityConfig.class


+ 8 - 4
framework/src/main/java/com/wteam/framework/common/enums/PayMentEnums.java

@@ -1,5 +1,9 @@
-package com.wteam.framework.common.enums;/**
- * @author  doncic
- * @date  2023/10/14 18:26
- */public class PayMentEnums {
+package com.wteam.framework.common.enums;
+
+/**
+ * @author doncic
+ * @date 2023/10/14 18:26
+ */
+public enum PayMentEnums {
+    CARD
 }

+ 1 - 0
framework/src/main/java/com/wteam/framework/common/enums/PermissionEnum.java

@@ -3,6 +3,7 @@ package com.wteam.framework.common.enums;
  * @author Khai(951992121 @ qq.com)
  * @date 2022/9/4 4:15 PM
  */
+
 /**
  * 权限枚举值
  *

+ 19 - 2
framework/src/main/java/com/wteam/framework/common/enums/ResultCode.java

@@ -206,7 +206,7 @@ public enum ResultCode {
      * 支付
      */
     PAY_UN_WANTED(32000, "当前订单不需要付款,返回订单列表等待系统订单出库即可"),
-    PAY_SUCCESS(32001, "支付成功"),
+    PAY_SUCCESS(200, "支付成功"),
     PAY_INCONSISTENT_ERROR(32002, "付款金额和应付金额不一致"),
     PAY_DOUBLE_ERROR(32003, "订单已支付,不能再次进行支付"),
     PAY_CASHIER_ERROR(32004, "收银台信息获取错误"),
@@ -524,7 +524,24 @@ public enum ResultCode {
     CURRENTBALANCE_NOT(1024, "余额不足!请充值!"),
     CARD_DAYS_IS_NULl(1025, "卡的有效天数为空!"),
     USER_UPDATE_ERROR(1026, "修改用户信息错误!"),
-    GET_MONTHLY_CODE_ERROR(1027, "获得月卡二维码错误!");
+    GET_MONTHLY_CODE_ERROR(1027, "获得月卡二维码错误!"),
+    GET_ORDER_PROBLEM(1028, "提交订单错误!"),
+    ORDER_REFUND_FAILED(1029, "订单退款失败"),
+    CARD_NOT_REFUND(402, "使用储值卡支付的订单无法退款!"),
+    TIME_NOT_REFUND(402, "24小时内支付的订单无法退款!"),
+
+    ORDER_TYPE_ERROR(1030, "订场类型错误!"),
+    TICKET_HARD_ERROR(10001, "次卡核销二维码错误!"),
+    RENTAL_HARD_ERROR(10002, "租场核销二维码错误!"),
+    MONTHLY_HARD_ERROR(10003, "月卡核销二维码错误!"),
+    TIMER_HARD_ERROR(10004, "计时核销二维码错误!"),
+
+    USER_ALREADY_BUY_STORE_CARD(1033, "用户已经购买过储值卡!"),
+    ORDER_INFO_NOT_EXIT(1034, "订单信息或者卡信息不存在"),
+    HARD_CALL_BACK_DATA_ERROR(1035, "硬件回调数据格式错误!"),
+    SAOMA_TIME_TAI_DUAN(1036, "扫码间隔太短,可能是短时间多次扫码,不需要记录此时时间!"),
+    TIME_BU_DAO(1037, "扫码时间过早,防止二维码失效!");
+
 
     private final Integer code;
     private final String message;

+ 10 - 10
framework/src/main/java/com/wteam/framework/common/security/token/TokenUtils.java

@@ -5,7 +5,7 @@ import com.wteam.framework.common.cache.Cache;
 import com.wteam.framework.common.cache.CachePrefix;
 import com.wteam.framework.common.enums.ResultCode;
 import com.wteam.framework.common.enums.SecurityEnum;
- import com.wteam.framework.common.exception.ServiceException;
+import com.wteam.framework.common.exception.ServiceException;
 import com.wteam.framework.common.properties.JWTTokenProperties;
 import com.wteam.framework.common.security.AuthUser;
 
@@ -46,16 +46,18 @@ public class TokenUtils {
         //访问token
         String accessToken = createToken(username, claim, tokenProperties.getTokenExpireTime());
 
-        cache.put(CachePrefix.ACCESS_TOKEN.getPrefix(userEnums) + accessToken, 1,
-                tokenProperties.getTokenExpireTime(), TimeUnit.MINUTES);
+        cache.put(CachePrefix.ACCESS_TOKEN.getPrefix(userEnums) + accessToken, 1, tokenProperties.getTokenExpireTime(), TimeUnit.MINUTES);
+
         //刷新token生成策略:如果是长时间有效的token(用于app),则默认15天有效期刷新token。如果是普通用户登录,则刷新token为普通token2倍数
-        Long expireTime = longTerm ? 15 * 24 * 60L : tokenProperties.getTokenExpireTime() * 2;
+        //TODO : 这里改了token过期的时间
+        Long expireTime = longTerm ? 60L * 24 * 30 : tokenProperties.getTokenExpireTime() * 2;
         String refreshToken = createToken(username, claim, expireTime);
 
         cache.put(CachePrefix.REFRESH_TOKEN.getPrefix(userEnums) + refreshToken, 1, expireTime, TimeUnit.MINUTES);
 
         token.setAccessToken(accessToken);
         token.setRefreshToken(refreshToken);
+
         return token;
     }
 
@@ -70,10 +72,9 @@ public class TokenUtils {
 
         Claims claims;
         try {
-            claims = Jwts.parser()
-                    .setSigningKey(SecretKeyUtil.generalKeyByDecoders())
-                    .parseClaimsJws(oldRefreshToken).getBody();
-        } catch (ExpiredJwtException | UnsupportedJwtException | MalformedJwtException | SignatureException | IllegalArgumentException e) {
+            claims = Jwts.parser().setSigningKey(SecretKeyUtil.generalKeyByDecoders()).parseClaimsJws(oldRefreshToken).getBody();
+        } catch (ExpiredJwtException | UnsupportedJwtException | MalformedJwtException | SignatureException |
+                 IllegalArgumentException e) {
             //token 过期 认证失败等
             throw new ServiceException(ResultCode.USER_AUTH_EXPIRED);
         }
@@ -133,7 +134,6 @@ public class TokenUtils {
                 //失效时间 当前时间+过期分钟
                 .setExpiration(new Date(System.currentTimeMillis() + expirationTime * 60 * 1000))
                 //签名算法和密钥
-                .signWith(SecretKeyUtil.generalKey())
-                .compact();
+                .signWith(SecretKeyUtil.generalKey()).compact();
     }
 }

+ 3 - 4
framework/src/main/java/com/wteam/framework/common/security/token/manager/ManagerTokenGenerate.java

@@ -5,7 +5,6 @@ package com.wteam.framework.common.security.token.manager;
  */
 
 
-
 import com.wteam.framework.common.cache.Cache;
 
 import com.wteam.framework.common.security.AuthUser;
@@ -34,7 +33,7 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate<AdminUser> {
 
     @Autowired
     private TokenUtils tokenUtil;
-//    @Autowired
+    //    @Autowired
 //    private RoleMenuService roleMenuService;
     @Autowired
     private Cache cache;
@@ -57,7 +56,7 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate<AdminUser> {
 
     @Override
     public Token refreshToken(String refreshToken) {
-        return tokenUtil.refreshToken(refreshToken, UserEnums.MANAGER);
+        return tokenUtil.refreshToken(refreshToken, UserEnums.USER);
     }
 
     /**
@@ -138,7 +137,7 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate<AdminUser> {
 
 
     public Token createToken(Member memberUser, Boolean longTerm) {
-        AuthUser authUser = new AuthUser(memberUser.getUsername(), memberUser.getId(),memberUser.getFace(), memberUser.getNickName(), UserEnums.MEMBER);
+        AuthUser authUser = new AuthUser(memberUser.getUsername(), memberUser.getId(), memberUser.getFace(), memberUser.getNickName(), UserEnums.MEMBER);
 
 
 //        //根据角色集合获取拥有的菜单具体权限

+ 32 - 0
framework/src/main/java/com/wteam/framework/common/utils/WeChatUtil.java

@@ -0,0 +1,32 @@
+package com.wteam.framework.common.utils;
+
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import java.io.ByteArrayInputStream;
+import java.security.KeyStore;
+
+public class WeChatUtil {
+
+
+    /**
+     * 字符串转为对象
+     *
+     * @param xml   json字符串
+     * @param clazz
+     */
+    public static Object xmlToPojo(String xml, Class<?> clazz) {
+        try {
+            JAXBContext context = JAXBContext.newInstance(clazz);
+            Unmarshaller umMarshaller = context.createUnmarshaller();
+            Object pojo = umMarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes("utf-8")));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+
+    }
+}

+ 8 - 6
framework/src/main/java/com/wteam/framework/modules/book/entity/OrderInfo.java

@@ -35,6 +35,8 @@ public class OrderInfo {
     //创建者
     private String createBy;
     //创建时间
+    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
     //修改者
     private String updateBy;
@@ -47,15 +49,15 @@ public class OrderInfo {
     //门店id
     private Long storeId;
     //预约日期
-    @Schema(description = "预约日期")
+    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date orderDate;
     @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "预约开始时间")
     private Date orderSt;
     @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "预约结束时间")
     private Date orderEd;
     //订单状态(枚举)
@@ -76,18 +78,18 @@ public class OrderInfo {
     private String qrCode;
     //用户进场时间
     @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "用户进场时间")
     private Date startTime;
     //用户离开时间
     @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "用户离场时间")
     private Date endTime;
     //购买卡的id
     private Integer cardId;
     //不知名id
-    private Long transactionId;
+    private String transactionId;
     //订单超时金额
     private Double overPrice;
 }

+ 4 - 8
framework/src/main/java/com/wteam/framework/modules/book/entity/dto/OrderReq.java

@@ -1,19 +1,14 @@
 package com.wteam.framework.modules.book.entity.dto;
 
-import com.baomidou.mybatisplus.annotation.TableId;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.springframework.format.annotation.DateTimeFormat;
 
-import io.swagger.annotations.ApiModelProperty;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.time.LocalTime;
 import java.util.Date;
 
 
@@ -35,15 +30,16 @@ public class OrderReq {
     //门店地址
     private String address;
     //预约日期
+    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date orderDate;
     //预约开始时间
     @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "预约开始时间")
     private Date orderSt;
     @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "预约结束时间")
     private Date orderEd;
     //订单类型(枚举)

+ 116 - 0
framework/src/main/java/com/wteam/framework/modules/book/entity/dto/RefundResult.java

@@ -0,0 +1,116 @@
+package com.wteam.framework.modules.book.entity.dto;
+
+import com.egzosn.pay.common.bean.CurType;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Map;
+
+/**
+ * 退款结果
+ * <p>
+ *
+ * @author Egan
+ * <pre>
+ * email egzosn@gmail.com
+ * date 2020/8/16 9:55
+ * </pre>
+ */
+public interface RefundResult extends Serializable {
+    /**
+     * 获取退款结果原信息集
+     *
+     * @return 属性
+     */
+    Map<String, Object> getAttrs();
+
+    /**
+     * 获取退款结果属性值
+     *
+     * @param key 属性名
+     * @return 属性值
+     */
+    Object getAttr(String key);
+
+    /**
+     * 获取退款结果属性值
+     *
+     * @param key 属性名
+     * @return 属性值
+     */
+    String getAttrString(String key);
+
+    /**
+     * 获取退款结果属性值
+     *
+     * @param key 属性名
+     * @return 属性值
+     */
+    BigDecimal getAttrDecimal(String key);
+
+
+    /**
+     * 获取退款请求结果状态码
+     *
+     * @return 状态码
+     */
+    String getCode();
+
+    /**
+     * 获取退款请求结果状态提示信息
+     *
+     * @return 提示信息
+     */
+    String getMsg();
+
+    /**
+     * 返回业务结果状态码
+     *
+     * @return 业务结果状态码
+     */
+    String getResultCode();
+
+    /**
+     * 返回业务结果状态提示信息
+     *
+     * @return 业务结果状态提示信息
+     */
+    String getResultMsg();
+
+    /**
+     * 退款金额
+     *
+     * @return 退款金额
+     */
+    BigDecimal getRefundFee();
+
+    /**
+     * 退款币种信息
+     *
+     * @return 币种信息
+     */
+    CurType getRefundCurrency();
+
+    /**
+     * 支付平台交易号
+     * 发起支付时 支付平台(如支付宝)返回的交易订单号
+     *
+     * @return 支付平台交易号
+     */
+    String getTradeNo();
+
+    /**
+     * 支付订单号
+     * 发起支付时,用户系统的订单号
+     *
+     * @return 支付订单号
+     */
+    String getOutTradeNo();
+
+    /**
+     * 商户退款单号
+     *
+     * @return 商户退款单号
+     */
+    String getRefundNo();
+}

+ 2 - 0
framework/src/main/java/com/wteam/framework/modules/book/entity/vo/OrderInfoVo.java

@@ -27,6 +27,8 @@ public class OrderInfoVo {
     //创建者
     private String createBy;
     //创建时间
+    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
     //修改者
     private String updateBy;

+ 40 - 4
framework/src/main/java/com/wteam/framework/modules/book/entity/vo/TimerOrderInfoVo.java

@@ -1,5 +1,41 @@
-package com.wteam.framework.modules.book.entity.vo;/**
- * @author  doncic
- * @date  2023/10/14 13:46
- */public class TimerOrderInfoVo {
+package com.wteam.framework.modules.book.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @author doncic
+ * @date 2023/10/14 13:46
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TimerOrderInfoVo {
+    @TableId
+    private String id;
+    //订单价格
+    private Double orderPrice;
+    //订单状态(枚举)
+    private String orderState;
+    //订单类型(枚举)
+    private String orderType;
+    //用户进场时间
+    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @Schema(description = "用户进场时间")
+    private Date startTime;
+    //用户离开时间
+    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @Schema(description = "用户离场时间")
+    private Date endTime;
+    //订单超时金额
+    private Double overPrice;
 }

+ 2 - 0
framework/src/main/java/com/wteam/framework/modules/book/service/CardService.java

@@ -35,4 +35,6 @@ public interface CardService extends IService<Card> {
     ResultMessage cardCharge(String orderId, Integer cardId);
 
     ResultMessage getChargeCardOrder(String accessToken, Integer cardId,Double currentBalance);
+
+    ResultMessage personCardPay(String orderId, Integer cardId);
 }

+ 2 - 0
framework/src/main/java/com/wteam/framework/modules/book/service/OrderInfoService.java

@@ -28,4 +28,6 @@ public interface OrderInfoService extends IService<OrderInfo> {
 
 
     ResultMessage bookStatus(Long id, Date dateTime);
+
+    ResultMessage getTimer(String userId);
 }

+ 215 - 41
framework/src/main/java/com/wteam/framework/modules/book/service/impl/CardServiceImpl.java

@@ -1,6 +1,7 @@
 package com.wteam.framework.modules.book.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.RandomUtil;
 import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpResponse;
 import cn.hutool.json.JSONObject;
@@ -33,11 +34,13 @@ import com.wteam.framework.modules.book.service.OrderInfoService;
 import com.wteam.framework.modules.card.entity.CbCardAdmin;
 import com.wteam.framework.modules.card.mapper.CardAdminMapper;
 import com.wteam.framework.modules.hardware.ApiCallerUtil;
+import com.wteam.framework.modules.hardware.QrCodeRegistrationUtil;
 import com.wteam.framework.modules.pay.serviceimpl.CashierSupport;
 import com.wteam.framework.modules.system.entity.dto.WechatPaymentSetting;
 import com.wteam.framework.modules.system.service.SettingService;
 import com.wteam.framework.modules.user.entity.User;
 import com.wteam.framework.modules.user.mapper.UserMapper;
+import lombok.EqualsAndHashCode;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -234,6 +237,21 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
         AuthUser authUser = UserContext.getAuthUser(accessToken);
         String userId = authUser.getId();
 
+
+//        //判断用户是否已经购买过储值卡
+//        LambdaQueryWrapper<Card> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+//
+//        lambdaQueryWrapper.eq(Card::getUserId, userId)
+//                .and(wrapper -> wrapper.eq(Card::getCardType, CardTypeEnum.STORED_VALUE)
+//                        .or()
+//                        .eq(Card::getCardType, CardTypeEnum.PERSON_CARD));
+//
+//        List<Card> cards = cardMapper.selectList(lambdaQueryWrapper);
+//        if (cards != null && !cards.isEmpty()) {
+//            return ResultUtil.success(ResultCode.USER_ALREADY_BUY_STORE_CARD);
+//        }
+
+
         // 检查用户是否存在
         User user = userMapper.selectById(userId);
         log.info("此时用户信息为{}", user);
@@ -244,6 +262,7 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
         //获取卡信息
         Integer cardId = orderCardReq.getCardId();
         CbCardAdmin card = cardAdminMapper.selectById(cardId);
+
         log.info("此时卡信息为{}", card);
 
 //        //要先校验这个卡是否购买多次
@@ -258,6 +277,8 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
 
         //创建订单
         OrderInfo orderInfo = new OrderInfo();
+        String orderId = RandomUtil.randomNumbers(9);
+        orderInfo.setId(orderId);
         orderInfo.setCreateTime(new Date());
         orderInfo.setUserId(userId);
         orderInfo.setStoreId(orderCardReq.getStoreId());
@@ -299,8 +320,57 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
         OrderInfo orderInfo = orderInfoMapper.selectById(orderId);
         log.info("此时的订单信息为:{}", orderInfo);
 
+        Long storeId = orderInfo.getStoreId();
+        Store store = storeMapper.selectById(storeId);
+        Integer realTime = Integer.valueOf(store.getRealTime());
+        realTime = realTime * 2;
+        log.info("此时的核销次数为:{}", realTime);
+
         //获得使用的储值卡具体信息
         Card card = cardMapper.selectById(cardId);
+
+        //设置卡id到订单里面
+        orderInfo.setCardId(cardId);
+        orderInfoMapper.updateById(orderInfo);
+
+        // 获取当前日期
+        LocalDate currentDate = LocalDate.now();
+
+        //生成5位随机数字
+        String numbers1 = RandomUtil.randomNumbers(5);
+        //生成5位随机数字
+        String numbers2 = RandomUtil.randomNumbers(5);
+
+        //生成二维码
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
+        String formattedDate = currentDate.format(formatter);
+        String data = "pxo_" + formattedDate + "_" + numbers1 + "_" + numbers2 + "_00";
+        log.info("此时生成的二维码为:{} ", data);
+
+        //如果是使用储值卡支付订单超时的情况
+        Double overPrice = orderInfo.getOverPrice();
+        if (overPrice != null) {
+            //获取储值卡信息
+            Float discountValue = card.getDiscountValue() != null ? card.getDiscountValue() / 10 : 1.0f;
+            double v = overPrice * discountValue;
+            Double currentBalance = card.getCurrentBalance();
+            if (v < currentBalance) {
+                //计算支付金额
+                double v1 = currentBalance - v;
+                card.setCurrentBalance(v1);
+                cardMapper.updateById(card);
+                orderInfo.setOrderState(String.valueOf(OrderStatusEnum.USED));
+                orderInfo.setOverPrice(v);
+                String qrCode = QrCodeRegistrationUtil.registerOneQrCode(data);
+                log.info("生成的一次核销的二维码为:{}", qrCode);
+                orderInfo.setQrCode(qrCode);
+                orderInfoMapper.updateById(orderInfo);
+                return ResultUtil.success(ResultCode.PAY_SUCCESS);
+            }
+            return ResultUtil.success(ResultCode.CURRENTBALANCE_NOT);
+        }
+
+
         log.info("此时的卡信息为:{}", card);
         try {
             //先获取卡的截至时间,看此储值卡是否过期
@@ -309,13 +379,10 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
             log.info("此时得到卡的截至时间为:{}", endDate);
 
             // 创建DateTimeFormatter对象,用于解析日期时间字符串
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            DateTimeFormatter formatter3 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 
             // 将截至日期字符串转换为LocalDate对象
-            LocalDate endDateStr = LocalDate.parse(endDate, formatter);
-
-            // 获取当前日期
-            LocalDate currentDate = LocalDate.now();
+            LocalDate endDateStr = LocalDate.parse(endDate, formatter3);
 
             // 比较截至日期和当前日期
             if (currentDate.isAfter(endDateStr)) {
@@ -325,9 +392,7 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
                 Double currentBalance = card.getCurrentBalance();
                 log.info("此时的余额为:{}", currentBalance);
                 //这里处理可能为null的情况
-                Float discountValue = Optional.ofNullable(card.getDiscountValue())
-                        .map(value -> value / 10)
-                        .orElse(1.0f);
+                Float discountValue = card.getDiscountValue() != null ? card.getDiscountValue() / 10 : 1.0f;
 
                 Double orderPrice = orderInfo.getOrderPrice();
                 log.info("订单价格为:{}", orderPrice);
@@ -335,11 +400,22 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
                 double v1 = orderPrice * discountValue;
                 log.info("需要支付金额为:{}", v1);
 
+
+                if (v1 > currentBalance) {
+                    return ResultUtil.success(ResultCode.CURRENTBALANCE_NOT);
+                }
+
                 if (v1 < currentBalance) {
+
                     double v = currentBalance - v1;
                     log.info("支付之后的余额为:{}", v);
                     card.setCurrentBalance(v);
                     cardMapper.updateById(card);
+                    //TODO :这里修改订单价格
+                    //更改订单价格
+                    orderInfo.setOverPrice(v1);
+                    orderInfoMapper.updateById(orderInfo);
+
                     // 支付成功生成二维码
                     // 修改订单状态为已支付
                     orderInfo.setOrderState(String.valueOf(OrderStatusEnum.WAITING_TO_USE));
@@ -349,32 +425,31 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
                     orderInfo.setPaymentMethods("CARD");
                     log.info("此时的PaymentMethods信息为{}", orderInfo.getPaymentMethods());
 
-                    orderInfoMapper.updateById(orderInfo);
-
                     // 获取当前日期
                     LocalDate currentDate1 = LocalDate.now();
 
                     //格式转化一下
                     String id = orderInfo.getId();
                     log.info("转化之后的id为:{}", id);
-                    long l = Long.parseLong(id);
-                    log.info("转化之后的id为:{}", l);
+                    String numbers = RandomUtil.randomNumbers(5);
 
                     // 格式化日期为字符串
                     DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyyMMdd");
-                    String formattedDate = currentDate1.format(formatter1);
-                    String data = "pxo_" + formattedDate + "_" + orderInfo.getUserId() + "_" + l + "_00";
-                    log.info("此时生成的二维码为:{} ", data);
+                    String formattedDate1 = currentDate1.format(formatter1);
+                    String data1 = "pxo_" + formattedDate1 + "_" + numbers + "_" + id + "_00";
+                    log.info("此时生成的二维码为:{} ", data1);
 
                     // 保存入数据库
                     orderInfo.setQrCode(data);
                     int save = orderInfoMapper.updateById(orderInfo);
 
                     if (save > 0) {
+                        //TODO : 这里的二维码生成需要修改
                         // 接口地址和参数
                         String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
-                        String mac = "863569068849199";
-                        String tk = ApiCallerUtil.callApi();
+                        String mac1 = "863569068849199";
+                        String mac2 = "863569068848969";
+                        String tk = ApiCallerUtil.callApi(mac1);
                         log.info("此时获取到的token为:{} ", tk);
                         //获取订单开始和结束时间
                         Date orderSt = orderInfo.getOrderSt();
@@ -395,45 +470,65 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
                         orderStTimestamp = Math.max(orderStTimestamp, currentTimeMillis);
                         orderEdTimestamp = Math.max(orderEdTimestamp, currentTimeMillis);
 
-                        //使用hutool调用接口
-                        HttpResponse response = HttpRequest.post(apiUrl)
-                                .form("mac", mac)
-                                .form("tk", tk)
-                                .form("qcodetxt", data)
-                                .form("starttime", orderStTimestamp)
-                                .form("enabletime", orderEdTimestamp)
-                                .form("enablecount", 100)
-                                .execute();
-
-                        //获取响应结果
-                        String body = response.body();
+                        // 拼接两个 MAC 地址,以逗号分隔
+                        String macParam = mac1 + "_" + mac2;
+                        log.info("此时拼接的macParam为:{}", macParam);
+
 
-                        // 处理返回结果
+                        //调用hutool接口注册二维码信息
+                        HttpResponse response = HttpRequest.post(apiUrl).form("mac", macParam).form("tk", tk).form("qcodetxt", data).form("starttime", orderStTimestamp).form("enabletime", orderEdTimestamp).form("enablecount", realTime).execute();
+
+                        String body = response.body();
                         JSONObject json = new JSONObject(body);
                         int code = json.getInt("code");
                         log.info("此时返回的code为:{}", code);
-
                         String qcodetxt = json.getStr("qcodetxt");
                         log.info("此时返回的qcodetxt为:{}", qcodetxt);
-
                         String desc = json.getStr("desc");
                         log.info("此时返回的desc为:{}", desc);
 
-                        //对响应结果处理
-                        if (code != 0) {
+                        if (code != 0 && code != 4) {
                             throw new ServiceException("硬件回调url设置接口异常!");
                         }
                         log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
-                        return ResultUtil.success();
+                        return ResultUtil.data(orderInfo.getId());
                     }
                 }
-                return ResultUtil.error(ResultCode.CURRENTBALANCE_NOT);
             }
         } catch (DateTimeParseException e) {
-            // 日期字符串解析失败,处理异常情况
+            //日期字符串解析失败,处理异常情况
             log.error("Failed to parse date string: {}", e);
         }
-        return null;
+        return ResultUtil.data(orderInfo.getId());
+    }
+
+
+    public String callApiWithMac(String apiUrl, String mac1, String mac2, String data) {
+        String tk = ApiCallerUtil.callApi(mac1);
+        log.info("此时获取到的token为:{} ", tk);
+
+        // 拼接两个 MAC 地址,以逗号分隔
+        String macParam = mac1 + "_" + mac2;
+        log.info("此时拼接的macParam为:{}", macParam);
+
+
+        //调用hutool接口注册二维码信息
+        HttpResponse response = HttpRequest.post(apiUrl).form("mac", macParam).form("tk", tk).form("qcodetxt", data).form("enablecount", 100).execute();
+
+        String body = response.body();
+        JSONObject json = new JSONObject(body);
+        int code = json.getInt("code");
+        log.info("此时返回的code为:{}", code);
+        String qcodetxt = json.getStr("qcodetxt");
+        log.info("此时返回的qcodetxt为:{}", qcodetxt);
+        String desc = json.getStr("desc");
+        log.info("此时返回的desc为:{}", desc);
+
+        if (code != 0 && code != 4) {
+            throw new ServiceException("硬件回调url设置接口异常!");
+        }
+        log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
+        return data;
     }
 
     /**
@@ -499,12 +594,14 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
         }
 
         OrderInfo orderInfo = new OrderInfo();
+        String orderId = RandomUtil.randomNumbers(9);
+        orderInfo.setId(orderId);
         orderInfo.setOrderType(String.valueOf(orderTypeEnum.STORED_VALUE));
         orderInfo.setCardId(card.getId());
         orderInfo.setStoreId(9376L);
         orderInfo.setCreateTime(new Date());
         orderInfo.setUserId(userId);
-        orderInfo.setOverPrice(currentBalance);
+        orderInfo.setOrderPrice(currentBalance);
         log.info("此时的订单信息为:{}", orderInfo);
         boolean save = orderInfoService.save(orderInfo);
         if (save) {
@@ -517,8 +614,85 @@ public class CardServiceImpl extends ServiceImpl<CardMapper, Card> implements Ca
         return ResultUtil.success();
     }
 
-    private PayOrderCreateRequest buildPaymentRequest(Card card, Integer faceValue, WechatPaymentSetting
-            paymentSetting) {
+    /**
+     * 散客储值卡支付只能支付计时订单
+     *
+     * @param orderId
+     * @param cardId
+     * @return
+     */
+    @Override
+    public ResultMessage personCardPay(@NotNull String orderId, @NotNull Integer cardId) {
+        // 获取订单信息
+        OrderInfo orderInfo = orderInfoService.getById(orderId);
+
+        // 获取卡信息
+        Card card = cardService.getById(cardId);
+
+        if (orderInfo == null || card == null) {
+            // 处理订单信息或卡信息不存在的情况
+            return ResultUtil.success(ResultCode.ORDER_INFO_NOT_EXIT);
+        }
+
+        boolean equals = card.getCardType().equals(CardTypeEnum.PERSON_CARD.name());
+        boolean equals1 = orderInfo.getOrderType().equals(OrderTypeEnums.TIMER.name());
+
+        if (equals1 && equals) {
+            // 获得订单价格和卡余额和折扣信息
+            Double orderPrice = orderInfo.getOrderPrice();
+            Double currentBalance = card.getCurrentBalance();
+            Float discountValue = card.getDiscountValue() != null ? card.getDiscountValue() : 1.0f;
+
+            // 获取需要支付的金额
+            double v = orderPrice * discountValue;
+
+            // 超时金额
+            Double overdueAmount = orderInfo.getOrderPrice() != null ? orderInfo.getOrderPrice() : 0.0;
+            log.info("此时的超时金额为:{}", overdueAmount);
+
+
+            if (orderInfo.getOrderState().equals(OrderStatusEnum.WAITING_SUPPLEMENTS.name())) {
+                //校验超时金额
+                if (overdueAmount != null) {
+                    double newBalance = currentBalance - overdueAmount;
+                    if (newBalance >= 0) {
+                        card.setCurrentBalance(newBalance);
+                        cardService.updateById(card);
+
+                        // 修改订单状态
+                        orderInfo.setOrderState(OrderStatusEnum.USED.toString());
+                        orderInfoService.updateById(orderInfo);
+
+                        return ResultUtil.success(ResultCode.PAY_SUCCESS);
+                    } else {
+                        // Handle insufficient balance, e.g., raise an error or take appropriate action
+                        return ResultUtil.success(ResultCode.CURRENTBALANCE_NOT);
+                    }
+                }
+            }
+
+            if (v < currentBalance) {
+                double totalAmountToDeduct = v;
+                if (totalAmountToDeduct <= currentBalance) {
+                    double newBalance = currentBalance - totalAmountToDeduct;
+                    card.setCurrentBalance(newBalance);
+                    cardService.updateById(card);
+
+                    // 修改订单状态
+                    orderInfo.setOrderState(OrderStatusEnum.IN_USE.toString());
+                    orderInfoService.updateById(orderInfo);
+                    return ResultUtil.success(ResultCode.PAY_SUCCESS);
+                } else {
+                    // 处理余额不足的情况
+                    return ResultUtil.success(ResultCode.CURRENTBALANCE_NOT);
+                }
+            }
+        }
+        return ResultUtil.success(ResultCode.ORDER_TAKE_ERROR);
+
+    }
+
+    private PayOrderCreateRequest buildPaymentRequest(Card card, Integer faceValue, WechatPaymentSetting paymentSetting) {
         PayOrderCreateRequest request = new PayOrderCreateRequest();
         PayOrderCreateReqModel model = new PayOrderCreateReqModel();
         model.setMchNo(paymentSetting.getMchId());

+ 139 - 68
framework/src/main/java/com/wteam/framework/modules/book/service/impl/OrderInfoServiceImpl.java

@@ -1,24 +1,29 @@
 package com.wteam.framework.modules.book.service.impl;
 
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.gson.Gson;
-import com.sun.org.apache.bcel.internal.generic.NEW;
+import com.wteam.framework.common.enums.OrderStatus;
 import com.wteam.framework.common.enums.OrderTypeEnums;
 import com.wteam.framework.common.enums.ResultCode;
 import com.wteam.framework.common.enums.ResultUtil;
 import com.wteam.framework.common.exception.ServiceException;
 import com.wteam.framework.common.security.AuthUser;
 import com.wteam.framework.common.security.context.UserContext;
+import com.wteam.framework.common.utils.BeanUtil;
 import com.wteam.framework.common.vo.ResultMessage;
 import com.wteam.framework.modules.book.entity.OrderInfo;
 import com.wteam.framework.modules.book.entity.Venue;
 import com.wteam.framework.modules.book.entity.dto.OrderReq;
+import com.wteam.framework.modules.book.entity.vo.TimerOrderInfoVo;
 import com.wteam.framework.modules.book.mapper.OrderInfoMapper;
 import com.wteam.framework.modules.book.mapper.VenueMapper;
 import com.wteam.framework.modules.book.service.OrderInfoService;
@@ -40,8 +45,10 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.validation.constraints.NotNull;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * (OrderInfo)表服务实现类
@@ -65,8 +72,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
     @Autowired
     private VenueMapper venueMapper;
     @Autowired
-    private PaymentInfoService paymentInfoService;
-    @Autowired
     private RedisTemplate redisTemplate;
 
 
@@ -77,55 +82,85 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
         if (accessToken == null || orderReq == null) {
             return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
         }
+
         // 获取用户ID
-        Long userId = getUserIdFromAccessToken(accessToken);
-        // 检查用户是否存在
-        User user = userMapper.selectById(userId);
-        if (user == null) {
+        String userId = getUserIdFromAccessToken(accessToken);
+
+        if (userId.isEmpty()) {
             return ResultUtil.error(ResultCode.USER_NEED_LOGIN);
         }
 
+        User user = userMapper.selectById(userId);
 
-        //要进行时间的校验
-        LambdaQueryWrapper<OrderInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-        lambdaQueryWrapper.eq(OrderInfo::getOrderDate, orderReq.getOrderDate());
-        List<OrderInfo> orderInfos = orderInfoMapper.selectList(lambdaQueryWrapper);
-        boolean b = isOrderTimeValid(orderInfos, orderReq.getOrderSt(), orderReq.getOrderEd());
-
-        if (b) {
-            // 创建订单
-            OrderInfo orderInfo = mapOrderRequestToOrderInfo(orderReq, String.valueOf(userId));
-            Double orderPrice = orderInfo.getOrderPrice();
-            Double reqOrderPrice = orderReq.getOrderPrice();
-            if (orderPrice != reqOrderPrice) {
-                return ResultUtil.error(ResultCode.PRICE_ERROR);
-            }
-            int insert = orderInfoMapper.insert(orderInfo);
-            String id = orderInfo.getId();
-            log.info("这里的订单id为:{}", id);
-            if (insert > 0) {
-                // 订单成功保存后,设置订单的过期时间为15分钟
-                String key = "orderInfo:" + orderInfo.getId();
-                redisTemplate.opsForValue().set(key, orderInfo, 15, TimeUnit.MINUTES);
-                log.info("这里的订单id为:{}", orderInfo.getId());
-                return ResultUtil.data(id);
-            }
-            return ResultUtil.error(ResultCode.ERROR);
-        }
-        return ResultUtil.error(ResultCode.ORDER_EXIST);
-    }
+//        //要进行时间的校验
+//        LambdaQueryWrapper<OrderInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+//        lambdaQueryWrapper.eq(OrderInfo::getOrderDate, orderReq.getOrderDate());
+//        List<OrderInfo> orderInfos = orderInfoMapper.selectList(lambdaQueryWrapper);
 
 
-    public boolean isOrderTimeValid(List<OrderInfo> orderInfos, Date newOrderStart, Date newOrderEnd) {
-        for (OrderInfo existingOrder : orderInfos) {
-            Date existingOrderStart = existingOrder.getOrderSt();
-            Date existingOrderEnd = existingOrder.getOrderEd();
+        // 创建订单
+//            OrderInfo orderInfo = mapOrderRequestToOrderInfo(orderReq, userId);
 
-            if (newOrderStart.equals(existingOrderStart) && newOrderEnd.equals(existingOrderEnd)) {
-                return false;
-            }
+        OrderInfo orderInfo = new OrderInfo();
+        String orderId = RandomUtil.randomNumbers(9);
+        log.info("此时的生成的订单id为:{}", orderId);
+        orderInfo.setId(orderId);
+        orderInfo.setUserId(userId);
+        orderInfo.setStoreId(orderReq.getStoreId());
+        orderInfo.setCreateTime(new Date());
+        orderInfo.setCreateBy(user.getNickName());
+        orderInfo.setVenueId(orderReq.getVenueId());
+        orderInfo.setOrderDate(orderReq.getOrderDate());
+        orderInfo.setOrderSt(orderReq.getOrderSt());
+        orderInfo.setOrderEd(orderReq.getOrderEd());
+        orderInfo.setOrderType(orderReq.getOrderType());
+        orderInfo.setPhoneNumber(orderReq.getPhoneNumber());
+        orderInfo.setOrderPrice(orderReq.getOrderPrice());
+        log.info("此时的请求参数为:{}", orderReq);
+        log.info("此时的订单信息为:{}", orderInfo);
+
+        Double orderPrice = orderInfo.getOrderPrice();
+        Double reqOrderPrice = orderReq.getOrderPrice();
+        if (orderPrice != reqOrderPrice) {
+            return ResultUtil.error(ResultCode.PRICE_ERROR);
+        }
+        boolean save = orderInfoService.save(orderInfo);
+        log.info("保存之后的订单信息为:{}", orderInfo);
+        String id = orderInfo.getId();
+        if (save) {
+            // TODO:这个功能好像问题,实际并没有实现
+            // 订单成功保存后,设置订单的过期时间为15分钟
+            String key = "orderInfo:" + orderInfo.getId();
+            redisTemplate.opsForValue().set(key, orderInfo, 15, TimeUnit.MINUTES);
+            log.info("这里的订单id为:{}", orderInfo.getId());
+            // 启动一个定时任务,在15分钟后检查订单支付状态
+            // 这里使用异步任务来执行检查订单支付状态的操作
+            CompletableFuture.runAsync(() -> {
+                try {
+                    // 等待15分钟
+                    Thread.sleep(15 * 60 * 1000);
+                    // 检查订单支付状态,这部分需要根据实际逻辑实现
+                    // 如果订单未支付,可以从Redis中删除订单
+                    if (!isOrderPaid(orderInfo)) {
+                        redisTemplate.delete(key);
+                        log.info("订单{}未支付,已删除。", orderInfo.getId());
+                    }
+                } catch (InterruptedException e) {
+                    // 处理异常
+                    log.error("定时任务被中断:{}", e.getMessage());
+                }
+            });
+            return ResultUtil.data(id);
         }
-        return true; // 时间不重叠且不完全相同
+        return ResultUtil.error(ResultCode.GET_ORDER_PROBLEM);
+    }
+
+    private boolean isOrderPaid(OrderInfo orderInfo) {
+        String orderState = orderInfo.getOrderState();
+        if (ObjectUtil.isNull(orderState)) {
+            return true;
+        }
+        return false;
     }
 
 
@@ -171,15 +206,27 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
         String targetDate = dateFormat.format(dateTime);
         log.info("此时的时间为:{}", targetDate);
+
         // 使用 LambdaQueryWrapper 构造查询条件
+        // 删除退款成功的订场信息
         LambdaQueryWrapper<OrderInfo> wrapper = Wrappers.lambdaQuery();
-        wrapper.eq(OrderInfo::getStoreId, id).eq(OrderInfo::getOrderDate, targetDate).eq(OrderInfo::getOrderType, OrderTypeEnums.RENTAL);
+        wrapper.eq(OrderInfo::getStoreId, id).eq(OrderInfo::getOrderDate, targetDate).eq(OrderInfo::getOrderType, OrderTypeEnums.RENTAL).ne(OrderInfo::getOrderState, com.wteam.framework.common.enums.OrderStatusEnum.REFUNDED);
         List<OrderInfo> orderInfos = orderInfoMapper.selectList(wrapper);
+
         log.info("对应的订单信息为:{}", orderInfos);
-        List<OrderInfo> collect = orderInfos.stream()
-                .filter(orderInfo -> orderInfo.getOrderState() != null)
-                .collect(Collectors.toList());
+
+        /**
+         * 这里过滤掉订场情况为null的订单信息
+         * 也要除去退款的情况
+         *
+         */
+
+        //过滤掉订场信息为null的订单信息
+        List<OrderInfo> collect = orderInfos.stream().filter(orderInfo -> orderInfo.getOrderState() != null).collect(Collectors.toList());
+
+
         log.info("此时过滤后对应的订单信息为:{}", collect);
+
         /**
          * 这里订场情况拆线呢分为
          * 1-->根据该场地id没有查到关联id,就把当天的订场情况全部返回
@@ -260,6 +307,21 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
         return ResultUtil.data(stringListMap);
     }
 
+    @Override
+    public ResultMessage getTimer(@NotNull String userId) {
+        //构造查询条件
+        LambdaQueryWrapper<OrderInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(OrderInfo::getUserId, userId).eq(OrderInfo::getOrderType, OrderTypeEnums.TIMER);
+        List<OrderInfo> orderInfos = orderInfoMapper.selectList(lambdaQueryWrapper);
+        List<TimerOrderInfoVo> timerOrderInfoVoList = new ArrayList<>();
+        for (OrderInfo orderInfo : orderInfos) {
+            TimerOrderInfoVo timerOrderInfoVo = new TimerOrderInfoVo();
+            BeanUtil.copyProperties(orderInfo, timerOrderInfoVo);
+            timerOrderInfoVoList.add(timerOrderInfoVo);
+        }
+        return ResultUtil.data(timerOrderInfoVoList);
+    }
+
 
     public Map<String, List<Map<String, Object>>> formatOrderInfo(List<OrderInfo> orderInfos, String targetDate) {
         Map<String, List<Map<String, Object>>> result = new HashMap<>();
@@ -326,29 +388,38 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
     }
 
 
-    private Long getUserIdFromAccessToken(String accessToken) {
+    private String getUserIdFromAccessToken(String accessToken) {
         AuthUser authUser = UserContext.getAuthUser(accessToken);
-        return Long.valueOf(authUser.getId());
+        String id = authUser.getId();
+        return id;
     }
 
-
-    private OrderInfo mapOrderRequestToOrderInfo(OrderReq orderReq, String userId) {
-        User user = userMapper.selectById(userId);
-        OrderInfo orderInfo = new OrderInfo();
-        orderInfo.setUserId(userId);
-        orderInfo.setStoreId(orderReq.getStoreId());
-        orderInfo.setCreateTime(new Date());
-        orderInfo.setCreateBy(user.getNickName());
-        orderInfo.setVenueId(orderReq.getVenueId());
-        orderInfo.setOrderDate(orderReq.getOrderDate());
-        orderInfo.setOrderSt(orderReq.getOrderSt());
-        log.info("此时的订场时间为:{}", orderReq.getOrderSt());
-        orderInfo.setOrderEd(orderReq.getOrderEd());
-        orderInfo.setOrderType(orderReq.getOrderType());
-        orderInfo.setPhoneNumber(orderReq.getPhoneNumber());
-        orderInfo.setOrderPrice(orderReq.getOrderPrice());
-        return orderInfo;
-    }
+//
+//    private OrderInfo mapOrderRequestToOrderInfo(OrderReq orderReq, String userId) {
+//        log.info("此时的请求参数为:{}", orderReq);
+//        User user = userMapper.selectById(userId);
+//        OrderInfo orderInfo = new OrderInfo();
+////        SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+////        Date orderSt = orderInfo.getOrderSt();
+////        Date orderEd = orderInfo.getOrderEd();
+////        String formatSt = sim.format(orderSt);
+////        String formatEd = sim.format(orderEd);
+////        Date dateSt = Convert.toDate(formatSt);
+////        Date dateEd = Convert.toDate(formatEd);
+//        orderInfo.setUserId(userId);
+//        orderInfo.setStoreId(orderReq.getStoreId());
+//        orderInfo.setCreateTime(new Date());
+//        orderInfo.setCreateBy(user.getNickName());
+//        orderInfo.setVenueId(orderReq.getVenueId());
+//        orderInfo.setOrderDate(orderReq.getOrderDate());
+//        orderInfo.setOrderSt(orderReq.getOrderSt());
+//        orderInfo.setOrderEd(orderReq.getOrderEd());
+//        orderInfo.setOrderType(orderReq.getOrderType());
+//        orderInfo.setPhoneNumber(orderReq.getPhoneNumber());
+//        orderInfo.setOrderPrice(orderReq.getOrderPrice());
+//        log.info("此时的订单信息为:{}", orderInfo);
+//        return orderInfo;
+//    }
 
     // 在这里添加订单状态的验证逻辑,例如检查订单时间是否有效等
 // 如果订单有效返回true,否则返回false

+ 0 - 1
framework/src/main/java/com/wteam/framework/modules/card/service/impl/CardAdminServiceImpl.java

@@ -40,7 +40,6 @@ public class CardAdminServiceImpl extends ServiceImpl<CardAdminMapper, CbCardAdm
      * @param cardTypeEnum
      * @return
      */
-    //TODO:这里是管理员对卡进行操作
     @Override
     public ResultMessage<List<CbCardAdmin>> showAllCard(@NotNull CardTypeEnum cardTypeEnum) {
         // 使用 LambdaQueryWrapper 进行查询

+ 1 - 10
framework/src/main/java/com/wteam/framework/modules/hardware/ApiCallerUtil.java

@@ -7,17 +7,15 @@ import com.wteam.framework.common.exception.ServiceException;
 
 /**
  * 固定方法用来获取token
- *
  */
 public class ApiCallerUtil {
 
-    public static String callApi() {
+    public static String callApi(String mac) {
 
         // 固定的接口URL
         String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/get_tokenv2.x";
 
         // 固定的参数
-        String mac = "863569068849199";
         String pwd = "239818";
         String apikey = "889a7a889678edfef18fa669def89";
 
@@ -37,11 +35,4 @@ public class ApiCallerUtil {
             throw new ServiceException("请求接口有误!");
         }
     }
-
-
-    public static void main(String[] args) {
-        String s = ApiCallerUtil.callApi();
-        System.out.println(s);
-
-    }
 }

+ 105 - 105
framework/src/main/java/com/wteam/framework/modules/hardware/ApiQrCodeUtil.java

@@ -1,105 +1,105 @@
-package com.wteam.framework.modules.hardware;
-
-/**
- * @author doncic
- * @date 2023/9/29 15:42
- */
-
-
-import cn.hutool.http.HttpRequest;
-import cn.hutool.http.HttpResponse;
-import cn.hutool.http.HttpUtil;
-import cn.hutool.json.JSONObject;
-import com.wteam.framework.common.enums.ResultUtil;
-import com.wteam.framework.common.exception.ServiceException;
-import com.wteam.framework.modules.book.entity.Card;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.logging.Log;
-
-import java.time.LocalDate;
-import java.time.ZoneOffset;
-
-@Slf4j
-public class ApiQrCodeUtil {
-    private static final String API_URL = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
-    private static final String MAC_ADDRESS = "863569068849199";
-
-    // 这个方法获取token,你需要根据你的实际需求实现它
-    public static String getToken() {
-        // 实现获取token的逻辑
-        String token = ApiCallerUtil.callApi();
-        return token;
-    }
-
-    public static Boolean callApiWithOrderInfo(Card card, String data) {
-        //获得token
-        String tk = getToken();
-        //获取二维码有效时间
-        Integer days = card.getDays();
-        // 计算二维码的过期时间
-        LocalDate baseDate = LocalDate.now();
-        LocalDate targetDate = baseDate.plusDays(days);
-        long timestamp = targetDate.atStartOfDay().toInstant(ZoneOffset.UTC).toEpochMilli();
-        // 使用hutool调用接口
-        HttpResponse response = HttpRequest.post(API_URL)
-                .form("mac", MAC_ADDRESS)
-                .form("tk", tk)
-                .form("qcodetxt", data)
-                .form("enabletime", timestamp)
-                .form("enablecount", 6000)
-                .execute();
-        // 获取响应结果
-        String responseBody = response.body();
-        int status = response.getStatus();
-
-        // 处理响应
-        if (status == 200) {
-            // 请求成功,可以处理响应数据
-            JSONObject jsonObject = new JSONObject(responseBody);
-            int code = jsonObject.getInt("code");
-            String desc = jsonObject.getStr("desc");
-            log.info("此时的code为:{}", code);
-            log.info("此时的desc为:{}", desc);
-            return true;
-        }
-        return false;
-    }
-
-    public static Boolean callApiWithUser(String data) {
-        //获得token
-        String tk = getToken();
-        // 使用hutool调用接口
-        String baseUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
-        String mac = "863569068849199";
-        String qcodetxt = data;
-        int enablecount = 2;
-        // 使用StringBuilder拼接URL
-        StringBuilder urlBuilder = new StringBuilder(baseUrl);
-        urlBuilder.append("?mac=").append(mac)
-                .append("&tk=").append(tk)
-                .append("&qcodetxt=").append(qcodetxt)
-                .append("&enablecount=").append(enablecount);
-        String finalUrl = urlBuilder.toString();
-        // 发送HTTP GET 请求
-        HttpResponse response = HttpUtil.createGet(finalUrl)
-                .execute();
-        // 获取响应状态码
-        int statusCode = response.getStatus();
-        // 获取响应内容
-        String responseBody = response.body();
-        // 处理响应
-        if (statusCode == 200) {
-            // 请求成功,可以处理响应数据
-            JSONObject jsonObject = new JSONObject(responseBody);
-            int code = jsonObject.getInt("code");
-            String desc = jsonObject.getStr("desc");
-            log.info("此时的code为:{}", code);
-            log.info("此时的desc为:{}", desc);
-            return true;
-        }
-        return false;
-    }
-}
-
-
-
+//package com.wteam.framework.modules.hardware;
+//
+///**
+// * @author doncic
+// * @date 2023/9/29 15:42
+// */
+//
+//
+//import cn.hutool.http.HttpRequest;
+//import cn.hutool.http.HttpResponse;
+//import cn.hutool.http.HttpUtil;
+//import cn.hutool.json.JSONObject;
+//import com.wteam.framework.common.enums.ResultUtil;
+//import com.wteam.framework.common.exception.ServiceException;
+//import com.wteam.framework.modules.book.entity.Card;
+//import lombok.extern.slf4j.Slf4j;
+//import org.apache.ibatis.logging.Log;
+//
+//import java.time.LocalDate;
+//import java.time.ZoneOffset;
+//
+//@Slf4j
+//public class ApiQrCodeUtil {
+//    private static final String API_URL = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
+//    private static final String MAC_ADDRESS = "863569068849199";
+//
+//    // 这个方法获取token,你需要根据你的实际需求实现它
+//    public static String getToken(String mac) {
+//        // 实现获取token的逻辑
+//        String token = ApiCallerUtil.callApi(mac);
+//        return token;
+//    }
+//
+//    public static Boolean callApiWithOrderInfo(Card card, String data) {
+//        //获得token
+//        String tk = getToken();
+//        //获取二维码有效时间
+//        Integer days = card.getDays();
+//        // 计算二维码的过期时间
+//        LocalDate baseDate = LocalDate.now();
+//        LocalDate targetDate = baseDate.plusDays(days);
+//        long timestamp = targetDate.atStartOfDay().toInstant(ZoneOffset.UTC).toEpochMilli();
+//        // 使用hutool调用接口
+//        HttpResponse response = HttpRequest.post(API_URL)
+//                .form("mac", MAC_ADDRESS)
+//                .form("tk", tk)
+//                .form("qcodetxt", data)
+//                .form("enabletime", timestamp)
+//                .form("enablecount", 6000)
+//                .execute();
+//        // 获取响应结果
+//        String responseBody = response.body();
+//        int status = response.getStatus();
+//
+//        // 处理响应
+//        if (status == 200) {
+//            // 请求成功,可以处理响应数据
+//            JSONObject jsonObject = new JSONObject(responseBody);
+//            int code = jsonObject.getInt("code");
+//            String desc = jsonObject.getStr("desc");
+//            log.info("此时的code为:{}", code);
+//            log.info("此时的desc为:{}", desc);
+//            return true;
+//        }
+//        return false;
+//    }
+//
+//    public static Boolean callApiWithUser(String data) {
+//        //获得token
+//        String tk = getToken();
+//        // 使用hutool调用接口
+//        String baseUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
+//        String mac = "863569068849199";
+//        String qcodetxt = data;
+//        int enablecount = 2;
+//        // 使用StringBuilder拼接URL
+//        StringBuilder urlBuilder = new StringBuilder(baseUrl);
+//        urlBuilder.append("?mac=").append(mac)
+//                .append("&tk=").append(tk)
+//                .append("&qcodetxt=").append(qcodetxt)
+//                .append("&enablecount=").append(enablecount);
+//        String finalUrl = urlBuilder.toString();
+//        // 发送HTTP GET 请求
+//        HttpResponse response = HttpUtil.createGet(finalUrl)
+//                .execute();
+//        // 获取响应状态码
+//        int statusCode = response.getStatus();
+//        // 获取响应内容
+//        String responseBody = response.body();
+//        // 处理响应
+//        if (statusCode == 200) {
+//            // 请求成功,可以处理响应数据
+//            JSONObject jsonObject = new JSONObject(responseBody);
+//            int code = jsonObject.getInt("code");
+//            String desc = jsonObject.getStr("desc");
+//            log.info("此时的code为:{}", code);
+//            log.info("此时的desc为:{}", desc);
+//            return true;
+//        }
+//        return false;
+//    }
+//}
+//
+//
+//

+ 151 - 0
framework/src/main/java/com/wteam/framework/modules/hardware/QrCodeRegistrationUtil.java

@@ -0,0 +1,151 @@
+package com.wteam.framework.modules.hardware;
+
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.json.JSONObject;
+import com.wteam.framework.common.exception.ServiceException;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class QrCodeRegistrationUtil {
+
+
+    /**
+     * @param data
+     * @return
+     */
+    public static Boolean registerTimerQrCode(String data) {
+
+        // 获取当前时间戳
+        long currentTime = System.currentTimeMillis() / 1000;
+
+        // 获取60秒之后的时间戳
+        long sixtySecondsLater = currentTime + 60;
+
+
+        String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
+        String mac1 = "863569068849199";
+        String mac2 = "863569068848969";
+        String tk = ApiCallerUtil.callApi(mac1);
+        log.info("此时获取到的token为:{} ", tk);
+
+        String macParam = mac1 + "_" + mac2;
+        log.info("此时拼接的macParam为:{}", macParam);
+
+        HttpResponse response = HttpRequest.post(apiUrl)
+                .form("mac", macParam)
+                .form("tk", tk)
+                .form("qcodetxt", data)
+                .form("starttime", currentTime)
+                .form("enabletime", sixtySecondsLater)
+                .form("enablecount", 2)
+                .execute();
+
+        String body = response.body();
+        JSONObject json = new JSONObject(body);
+        int code = json.getInt("code");
+        log.info("此时返回的code为:{}", code);
+        String qcodetxt = json.getStr("qcodetxt");
+        log.info("此时返回的qcodetxt为:{}", qcodetxt);
+        String desc = json.getStr("desc");
+        log.info("此时返回的desc为:{}", desc);
+        if (code != 0 && code != 4) {
+            throw new ServiceException("硬件回调url设置接口异常!");
+        }
+        log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
+        return true;
+    }
+
+
+    /**
+     * @param data
+     * @return
+     */
+    public static Boolean registerMonthQrCode(String data) {
+        String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
+        String mac1 = "863569068849199";
+        String mac2 = "863569068848969";
+        String tk = ApiCallerUtil.callApi(mac1);
+        log.info("此时获取到的token为:{} ", tk);
+
+        String macParam = mac1 + "_" + mac2;
+        log.info("此时拼接的macParam为:{}", macParam);
+
+        HttpResponse response = HttpRequest.post(apiUrl)
+                .form("mac", macParam)
+                .form("tk", tk)
+                .form("qcodetxt", data)
+                .form("enablecount", 50)
+                .execute();
+
+        String body = response.body();
+        JSONObject json = new JSONObject(body);
+        int code = json.getInt("code");
+        log.info("此时返回的code为:{}", code);
+        String qcodetxt = json.getStr("qcodetxt");
+        log.info("此时返回的qcodetxt为:{}", qcodetxt);
+        String desc = json.getStr("desc");
+        log.info("此时返回的desc为:{}", desc);
+        if (code != 0 && code != 4) {
+            throw new ServiceException("硬件回调url设置接口异常!");
+        }
+        log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
+        return true;
+    }
+
+    public static Boolean registerTicketQrCode(String data) {
+        String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
+        String mac1 = "863569068849199";
+        String mac2 = "863569068848969";
+        String tk = ApiCallerUtil.callApi(mac1);
+        log.info("此时获取到的token为:{} ", tk);
+
+
+        String macParam = mac1 + "_" + mac2;
+        log.info("此时拼接的macParam为:{}", macParam);
+
+        HttpResponse response = HttpRequest.post(apiUrl).form("mac", macParam).form("tk", tk).form("qcodetxt", data).form("enablecount", 2).execute();
+
+        String body = response.body();
+        JSONObject json = new JSONObject(body);
+        int code = json.getInt("code");
+        log.info("此时返回的code为:{}", code);
+        String qcodetxt = json.getStr("qcodetxt");
+        log.info("此时返回的qcodetxt为:{}", qcodetxt);
+        String desc = json.getStr("desc");
+        log.info("此时返回的desc为:{}", desc);
+        if (code != 0 && code != 4) {
+            throw new ServiceException("硬件回调url设置接口异常!");
+        }
+        log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
+        return true;
+    }
+
+
+    public static String registerOneQrCode(String data) {
+        String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
+        String mac1 = "863569068849199";
+        String mac2 = "863569068848969";
+        String tk = ApiCallerUtil.callApi(mac1);
+        log.info("此时获取到的token为:{} ", tk);
+
+        String macParam = mac1 + "_" + mac2;
+        log.info("此时拼接的macParam为:{}", macParam);
+
+        HttpResponse response = HttpRequest.post(apiUrl).form("mac", macParam).form("tk", tk).form("qcodetxt", data).form("enablecount", 1).execute();
+
+        String body = response.body();
+        JSONObject json = new JSONObject(body);
+        int code = json.getInt("code");
+        log.info("此时返回的code为:{}", code);
+        String qcodetxt = json.getStr("qcodetxt");
+        log.info("此时返回的qcodetxt为:{}", qcodetxt);
+        String desc = json.getStr("desc");
+        log.info("此时返回的desc为:{}", desc);
+        if (code != 0 && code != 4) {
+            throw new ServiceException("硬件回调url设置接口异常!");
+        }
+        log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
+        return data;
+    }
+}

+ 22 - 11
framework/src/main/java/com/wteam/framework/modules/hardware/RegistrationTask.java

@@ -16,17 +16,13 @@ import java.util.concurrent.TimeUnit;
  */
 @Slf4j
 public class RegistrationTask {
-    public static void main(String[] args) {
-        // 创建一个定时任务执行器
-        ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
 
-        // 接口地址和参数
-//        https://xiaofeng.pankzone.com/api/openapi/get_tokenv2.x?mac=863569068849199&pwd=239818&apikey=889a7a889678edfef18fa669def89
-        String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/set_dev_callbackv2.x";
-        String mac = "863569068849199";
-        String url = "http://139.9.38.185:8889/v1/hardware/verification";
-        String tk = ApiCallerUtil.callApi();
-        log.info("此时获取到的token为:{}", tk);
+    private static final String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/set_dev_callbackv2.x";
+    private static final String url = "http://139.9.38.185:8889/v1/hardware/verification?data=";
+
+    public static void setCallbackForMAC(String mac) {
+        String tk = ApiCallerUtil.callApi(mac);
+        log.info("获取到的token为:{}", tk);
 
         // 初始化任务,立即执行一次
         Runnable registrationTask = () -> {
@@ -43,14 +39,29 @@ public class RegistrationTask {
             if (code != 0) {
                 throw new ServiceException("硬件回调url设置接口异常!");
             }
-            log.info("此时的响应结果为:{}", json);
+            log.info("响应结果为:{}", json);
         };
 
         // 每24小时执行一次任务
         long initialDelay = 0; // 初始延迟为0秒,即立即执行
         long period = 24 * 60 * 60; // 24小时,以秒为单位
 
+        // 创建一个定时任务执行器
+        ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
+
         // 启动定时任务
         scheduler.scheduleAtFixedRate(registrationTask, initialDelay, period, TimeUnit.SECONDS);
     }
+
+    public static void main(String[] args) {
+        // 分别调用设置回调地址方法,传入不同的MAC地址
+        String mac1 = "863569068848969";
+        String mac2 = "863569068849199";
+        setCallbackForMAC(mac1);
+        setCallbackForMAC(mac2);
+    }
 }
+
+
+
+

+ 1 - 0
framework/src/main/java/com/wteam/framework/modules/pay/entity/enums/PaymentMethodEnum.java

@@ -17,6 +17,7 @@ public enum PaymentMethodEnum {
      */
     ALIPAY("aliPayPlugin", "支付宝", "PAGE"),
 
+
     /**
      * 银联-云闪付
      */

+ 4 - 4
framework/src/main/java/com/wteam/framework/modules/pay/service/Payment.java

@@ -1,7 +1,6 @@
 package com.wteam.framework.modules.pay.service;
 
 
-import com.egzosn.pay.common.bean.RefundOrder;
 import com.egzosn.pay.common.bean.RefundResult;
 import com.wteam.framework.common.enums.ResultCode;
 import com.wteam.framework.common.exception.ServiceException;
@@ -9,10 +8,11 @@ import com.wteam.framework.common.vo.ResultMessage;
 
 import com.wteam.framework.modules.pay.entity.dto.PayParam;
 import com.wteam.framework.modules.pay.entity.enums.PaymentMethodEnum;
+import com.wteam.framework.modules.pay.serviceimpl.WxV3PayPlugin;
 import org.springframework.stereotype.Service;
-import org.springframework.web.bind.annotation.RequestMapping;
 
 import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
 import java.util.Map;
 
 /**
@@ -27,12 +27,12 @@ public interface Payment {
 
     /**
      * 退款
+     *
      * @param paymentMethodEnum
-     * @param request
      * @param sn
      * @return
      */
-    default RefundResult refund(PaymentMethodEnum paymentMethodEnum, HttpServletRequest request, String sn) {
+    default RefundResult refund(PaymentMethodEnum paymentMethodEnum, String sn) throws ParseException {
         throw new ServiceException(ResultCode.PAY_ERROR);
     }
 

+ 32 - 5
framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/CashierSupport.java

@@ -1,9 +1,13 @@
 package com.wteam.framework.modules.pay.serviceimpl;
 
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.json.JSONUtil;
 import com.egzosn.pay.common.bean.PayOrder;
 import com.egzosn.pay.common.bean.RefundOrder;
 import com.egzosn.pay.common.bean.RefundResult;
 import com.egzosn.pay.wx.v3.bean.WxTransactionType;
+import com.wteam.framework.common.enums.OrderStatus;
+import com.wteam.framework.common.enums.OrderStatusEnum;
 import com.wteam.framework.common.enums.ResultCode;
 import com.wteam.framework.common.exception.ServiceException;
 import com.wteam.framework.common.utils.SpringContextUtil;
@@ -13,8 +17,10 @@ import com.wteam.framework.modules.book.service.OrderInfoService;
 import com.wteam.framework.modules.pay.entity.dto.PayParam;
 import com.wteam.framework.modules.pay.entity.enums.PaymentClientEnum;
 import com.wteam.framework.modules.pay.entity.enums.PaymentMethodEnum;
-import com.wteam.framework.modules.pay.entity.vo.OrderStatusEnum;
 import com.wteam.framework.modules.pay.service.Payment;
+import com.wteam.framework.modules.system.entity.dos.Setting;
+import com.wteam.framework.modules.system.entity.dto.WechatPaymentSetting;
+import com.wteam.framework.modules.system.entity.enums.SettingEnum;
 import com.wteam.framework.modules.system.service.SettingService;
 import com.wteam.framework.modules.user.entity.User;
 import com.wteam.framework.modules.user.mapper.UserMapper;
@@ -25,6 +31,9 @@ import org.springframework.stereotype.Component;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * 收银台工具
@@ -154,7 +163,8 @@ public class CashierSupport {
     public PayOrder cashierParam(String sn, PaymentMethodEnum paymentMethodEnum) {
         OrderInfo orderInfo = orderInfoService.query().eq("id", sn).one();
         //如果订单不需要付款,则抛出异常,直接返回
-        if (orderInfo.getOrderPrice() <= 0 || OrderStatusEnum.PAID.name().equals(orderInfo.getOrderState())) {
+//        OrderStatusEnum.PAID.name().
+        if (orderInfo.getOrderPrice() <= 0 || OrderStatus.PAYMENT_SUCCESSFUL.equals(orderInfo.getOrderState())) {
             throw new ServiceException(ResultCode.PAY_UN_WANTED);
         }
         WxTransactionType transactionType = WxTransactionType.valueOf(paymentMethodEnum.paymentMethod());
@@ -185,15 +195,32 @@ public class CashierSupport {
     }
 
 
+    /**
+     * 获取微信支付配置
+     *
+     * @return
+     */
+    private static WechatPaymentSetting wechatPaymentSetting() {
+        try {
+            SettingService settingService = SpringContextUtil.getBean(SettingService.class);
+            Setting setting = settingService.get(SettingEnum.WECHAT_PAYMENT.name());
+            WechatPaymentSetting wechatPaymentSetting = JSONUtil.toBean(setting.getSettingValue(), WechatPaymentSetting.class);
+            return wechatPaymentSetting;
+        } catch (Exception e) {
+            log.error("微信支付暂不支持", e);
+            throw new ServiceException(ResultCode.PAY_NOT_SUPPORT);
+        }
+    }
+
+
     /**
      * 退款参数封装
      *
      * @param paymentMethodEnum 支付渠道枚举
-     * @param request
      * @param sn
      * @return 退款消息
      */
-    public RefundResult refund(PaymentMethodEnum paymentMethodEnum, HttpServletRequest request, String sn) {
+    public RefundResult refund(PaymentMethodEnum paymentMethodEnum, String sn) throws ParseException {
         if (paymentMethodEnum == null) {
             throw new ServiceException(ResultCode.PAY_NOT_SUPPORT);
         }
@@ -201,6 +228,6 @@ public class CashierSupport {
         Payment payment = (Payment) SpringContextUtil.getBean(paymentMethodEnum.getPlugin());
         log.info("支付请求:支付类型:{},请求订单号:{}", paymentMethodEnum.name(), sn);
         //退款插件调用
-        return payment.refund(paymentMethodEnum, request, sn);
+        return payment.refund(paymentMethodEnum, sn);
     }
 }

+ 113 - 4
framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/RefundSupport.java

@@ -1,5 +1,114 @@
-package com.wteam.framework.modules.pay.serviceimpl;/**
- * @author  doncic
- * @date  2023/10/10 20:14
- */public class RefundSupport {
+package com.wteam.framework.modules.pay.serviceimpl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.egzosn.pay.common.bean.CurType;
+import com.egzosn.pay.common.bean.OrderParaStructure;
+import com.egzosn.pay.common.bean.RefundOrder;
+import com.egzosn.pay.common.bean.RefundResult;
+import com.egzosn.pay.common.util.Util;
+import com.egzosn.pay.wx.v3.bean.WxTransactionType;
+import com.egzosn.pay.wx.v3.bean.order.RefundAmount;
+import com.egzosn.pay.wx.v3.bean.response.WxRefundResult;
+import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
+import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.WxPayService;
+import com.wteam.framework.common.enums.ResultCode;
+import com.wteam.framework.common.enums.ResultUtil;
+import com.wteam.framework.common.exception.ServiceException;
+import com.wteam.framework.modules.book.entity.OrderInfo;
+import com.wteam.framework.modules.book.mapper.OrderInfoMapper;
+import com.wteam.framework.modules.book.service.OrderInfoService;
+import com.wteam.framework.modules.pay.entity.enums.PaymentMethodEnum;
+import com.wteam.framework.modules.system.service.SettingService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+import static com.egzosn.pay.wx.api.WxConst.OUT_TRADE_NO;
+
+/**
+ * @author doncic
+ * @date 2023/10/10 20:14
+ */
+
+@Component
+@Slf4j
+@Service
+public class RefundSupport {
+
+    @Autowired
+    private SettingService settingService;
+
+    @Autowired
+    private OrderInfoService orderInfoService;
 }
+//    @Autowired
+//    private OrderInfoMapper orderInfoMapper
+//    @Autowired
+//    private WxV3PayPlugin wxV3PayPlugin;
+
+//
+//    /**
+//     * 退款
+//     *
+//     * @param paymentMethodEnum
+//     * @param sn
+//     * @return
+//     */
+//    @Transactional
+//    public Object refund(PaymentMethodEnum paymentMethodEnum, String sn) {
+//        if (paymentMethodEnum == null) {
+//            throw new ServiceException(ResultCode.PAY_NOT_SUPPORT);
+//        }
+//        //获取订单信息
+//        OrderInfo orderInfo = orderInfoMapper.selectById(sn);
+//        if (ObjectUtil.isNull(orderInfo)) {
+//            return ResultUtil.error(ResultCode.ENTITY_NULL);
+//        }
+//
+//        //参数需要订单号和退款金额
+//        Double orderPrice = orderInfo.getOrderPrice();
+//        BigDecimal orderPriceBigDecimal = new BigDecimal(orderPrice);
+//        String refundNo = "refund_" + sn;
+//
+//        //封装退款参数
+//        RefundOrder refundOrder = new RefundOrder(refundNo, sn, orderPriceBigDecimal);
+//        log.info("此时封装好的退款参数为:{}", refundOrder);
+//
+//        // 调用退款接口
+//        return wxV3PayPlugin.refund(refundOrder);
+//    }
+//}
+
+
+//    // 微信退款
+//    WxPayRefundRequest wxPayRefundRequest = new WxPayRefundRequest();
+//        wxPayRefundRequest.setOutTradeNo(sn);
+//        wxPayRefundRequest.setOutRefundNo("refund_" + sn);
+//
+//    // 元转成分
+//    double v = orderInfo.getOrderPrice() * 100;
+//    Integer round = Math.toIntExact(Math.round(v));
+//        wxPayRefundRequest.setTotalFee(round);
+//        wxPayRefundRequest.setRefundFee(round);
+//
+//    WxPayRefundResult wxPayRefundResult = null;
+//        log.info("这里的退款参数是:{}", wxPayRefundResult);
+//        try {
+//        wxPayRefundResult = wxPayService.refund(wxPayRefundRequest);
+//    } catch (WxPayException e) {
+//        e.printStackTrace();
+//        return ResultUtil.error(ResultCode.ORDER_REFUND_FAILED);
+//    }
+//        if (!wxPayRefundResult.getResultCode().equals("SUCCESS")) {
+//        log.info("refund fail:" + wxPayRefundResult.getReturnMsg());
+//        return ResultUtil.error(ResultCode.ORDER_REFUND_FAILED);
+//    }
+//        return wxPayRefundResult;
+//}

+ 112 - 21
framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/WxV3PayPlugin.java

@@ -1,4 +1,3 @@
-
 package com.wteam.framework.modules.pay.serviceimpl;
 
 
@@ -8,13 +7,19 @@ import com.egzosn.pay.web.support.HttpRequestNoticeParams;
 import com.egzosn.pay.wx.v3.api.WxPayConfigStorage;
 import com.egzosn.pay.wx.v3.api.WxPayService;
 import com.egzosn.pay.wx.v3.bean.WxTransactionType;
+import com.wteam.framework.common.enums.OrderStatusEnum;
+import com.wteam.framework.common.enums.PayMentEnums;
 import com.wteam.framework.common.enums.ResultCode;
 import com.wteam.framework.common.enums.ResultUtil;
 import com.wteam.framework.common.exception.ServiceException;
+import com.wteam.framework.common.security.enums.PermissionEnum;
 import com.wteam.framework.common.utils.SpringContextUtil;
 import com.wteam.framework.common.vo.ResultMessage;
 
+import com.wteam.framework.modules.book.entity.Card;
 import com.wteam.framework.modules.book.entity.OrderInfo;
+import com.wteam.framework.modules.book.mapper.CardMapper;
+import com.wteam.framework.modules.book.mapper.OrderInfoMapper;
 import com.wteam.framework.modules.book.service.OrderInfoService;
 import com.wteam.framework.modules.pay.entity.dto.PayParam;
 import com.wteam.framework.modules.pay.entity.enums.PaymentMethodEnum;
@@ -28,13 +33,16 @@ import com.wteam.framework.modules.system.entity.enums.SettingEnum;
 import com.wteam.framework.modules.system.service.SettingService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseStatus;
 
 import javax.annotation.PostConstruct;
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.Map;
 
@@ -57,7 +65,10 @@ public class WxV3PayPlugin implements Payment {
     private MyPayMessageHandler myPayMessageHandler;
     @Autowired
     private OrderInfoService orderInfoService;
-
+    @Autowired
+    private OrderInfoMapper orderInfoMapper;
+    @Autowired
+    private CardMapper cardMapper;
 
     /**
      * 获取微信支付配置
@@ -76,14 +87,14 @@ public class WxV3PayPlugin implements Payment {
         }
     }
 
-//    @PostConstruct
+    @PostConstruct
     // 没有证书的情况下注释掉,避免启动报错
     public void init() {
         WechatPaymentSetting wechatPaymentSetting = wechatPaymentSetting();
         WxPayConfigStorage wxPayConfigStorage = new WxPayConfigStorage();
         wxPayConfigStorage.setAppId(wechatPaymentSetting.getAppId());
         wxPayConfigStorage.setMchId(wechatPaymentSetting.getMchId());
-//        V3密钥 https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay3_2.shtml
+// V3密钥 https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay3_2.shtml
         wxPayConfigStorage.setV3ApiKey(wechatPaymentSetting.getApiKey3());
         wxPayConfigStorage.setNotifyUrl("http://139.9.38.185:8889/v1/payment/callback/WECHAT");
         wxPayConfigStorage.setReturnUrl("http://sailinmu.iok.la/wxV3/payBack.json");
@@ -95,13 +106,13 @@ public class WxV3PayPlugin implements Payment {
         wxPayConfigStorage.setCertStoreType(CertStoreType.PATH);
         service = new WxPayService(wxPayConfigStorage);
         // 微信海外支付:东南亚
-//        service.setApiServerUrl("https://apihk.mch.weixin.qq.com");
+//service.setApiServerUrl("https://apihk.mch.weixin.qq.com");
         // 增加支付回调消息拦截器
         service.addPayMessageInterceptor(new WxV3PayMessageInterceptor());
         // 设置回调消息处理
         // TODO {@link com.egzosn.pay.demo.controller.WxPayController#payBack}
         service.setPayMessageHandler(new WxV3PayMessageHandler());
-//        service.setApiServerUrl("https://api.mch.weixin.qq.com");
+// service.setApiServerUrl("https://api.mch.weixin.qq.com");
     }
 
 
@@ -121,32 +132,112 @@ public class WxV3PayPlugin implements Payment {
         return ResultUtil.data(orderInfo);
     }
 
+    //TODO:退款的业务代码还需要完善
     @Override
-    public RefundResult refund(PaymentMethodEnum paymentMethodEnum, HttpServletRequest request, String sn) {
+//    @ResponseStatus(HttpStatus.PAYMENT_REQUIRED) // 设置状态码为402
+    public RefundResult refund(PaymentMethodEnum paymentMethodEnum, String sn) {
         //获得要退款订单信息
         OrderInfo orderInfo = orderInfoService.query().eq("id", sn).one();
         log.info("此时的订单信息为:{}", orderInfo);
-        // 获得订单价格
+
+        // 获取订单相关信息
+        String paymentMethod = orderInfo.getPaymentMethods();
+        String name = paymentMethodEnum.name();
+        log.info("此时的paymentMethod和name分别为:{},{}", paymentMethod, name);
         Double orderPrice = orderInfo.getOrderPrice();
-        log.info("此时的订单价格为:{}", orderPrice);
 
-        // 构造退款订单号,可以使用当前时间戳作为一部分,以确保唯一性
-        long timestamp = System.currentTimeMillis();
-        String refundOrderNumber = "REFUND_" + sn + "_" + timestamp;
-        log.info("此时的生成的退款订单号为:{}", refundOrderNumber);
 
-        // 创建一个RefundOrder对象,并设置退款金额和退款订单号
-        RefundOrder refundOrder = new RefundOrder();
-        refundOrder.setRefundAmount(BigDecimal.valueOf(orderPrice));
-        refundOrder.setRefundNo(refundOrderNumber);
-        refundOrder.setOrderDate(new Date());
-        refundOrder.setUserId(orderInfo.getUserId());
+        // 退款业务逻辑判断
+        //1、只有订场订单可以进行退款 24小时前退款
+        long orderDate = orderInfo.getOrderDate().getTime();
+        log.info("该订单的预约日期为:{}", orderDate);
+
+        // 获取当前日期前一天的日期
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        calendar.add(Calendar.DAY_OF_YEAR, -1);
+        Date oneDayBefore = calendar.getTime();
+        long oneDayBeforeTime = oneDayBefore.getTime();
+        log.info("当前日期的前一天为:{}", oneDayBeforeTime);
+
+        /**
+         这里的"需要退款的订单状态"应该替换为实际的订单状态条件
+         如果订单状态也需要满足特定条件,请将其添加到if语句中
+         否则,只需判断日期条件
+         进行退款的逻辑**/
+
+
+        long isOrderDateBeforeOneDayBefore = orderDate - oneDayBeforeTime;
+        // 转换为天数
+        long millisecondsInDay = 24 * 60 * 60 * 1000; // 1天有多少毫秒
+        long daysDifference = isOrderDateBeforeOneDayBefore / millisecondsInDay;
+        log.info("相减之后天数为:{}", daysDifference);
+
+        boolean isGreaterThanOneDay = daysDifference > 1;
+
+        String orderState = orderInfo.getOrderState();
+        boolean isOrderStateValid = "WAITING_TO_USE".equals(orderState);
+
+        log.info("此时的布尔值为:{},{}", isOrderStateValid, isGreaterThanOneDay);
+
+        // 在订单日期前一天且订单状态符合要求时可以进行退款
+        if (isGreaterThanOneDay && isOrderStateValid) {
+
+            orderInfo.setOrderState(String.valueOf(OrderStatusEnum.REFUNDED));
+            orderInfoMapper.updateById(orderInfo);
+
+            log.info("修改订单状态之后的订单状态为:{}", orderInfo);
 
+            String refundOrderNumber = "REFUND_" + sn;
+            log.info("此时的生成的退款订单号为:{}", refundOrderNumber);
 
-        // 调用支付服务的退款方法,返回退款结果
-        return service.refund(refundOrder);
+            // 创建一个RefundOrder对象,并设置退款金额和退款订单号
+            RefundOrder refundOrder = new RefundOrder();
+
+            //退款金额
+            refundOrder.setRefundAmount(BigDecimal.valueOf(orderPrice));
+
+            //退款订单号
+            refundOrder.setRefundNo(refundOrderNumber);
+
+            //应该是订单sn
+            refundOrder.setOutTradeNo(sn);
+            log.info("此时的OutTradeNo为:{}", sn);
+
+            //交易日期
+            refundOrder.setOrderDate(new Date());
+
+            //用户id
+            refundOrder.setUserId(orderInfo.getUserId());
+
+            //订单总金额
+            refundOrder.setTotalAmount(BigDecimal.valueOf(orderPrice));
+            log.info("此时的TotalAmount为:{}", BigDecimal.valueOf(orderPrice));
+
+            //支付交易平台订单号
+            refundOrder.setTradeNo(orderInfo.getTransactionId());
+
+            log.info("此时的TradeNo为:{}", orderInfo.getTransactionId());
+
+            return service.refund(refundOrder);
+
+        }
+        // 不能退款
+        throw new ServiceException(ResultCode.TIME_NOT_REFUND);
     }
 
+//    public class CustomException extends Exception {
+//        private HttpStatus statusCode;
+//
+//        public CustomException(int message, String statusCode) {
+//            super(String.valueOf(message));
+//            this.statusCode = HttpStatus.valueOf(statusCode);
+//        }
+//
+//        public HttpStatus getStatusCode() {
+//            return statusCode;
+//        }
+//    }
 
     /**
      * 支付回调地址

+ 499 - 251
framework/src/main/java/com/wteam/framework/modules/pay/serviceimpl/handler/MyPayMessageHandler.java

@@ -1,45 +1,41 @@
 package com.wteam.framework.modules.pay.serviceimpl.handler;
 
 
-import   cn.hutool.http.HttpRequest;
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpResponse;
 import cn.hutool.json.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.egzosn.pay.common.api.PayMessageHandler;
 import com.egzosn.pay.common.api.PayService;
 import com.egzosn.pay.common.bean.PayMessage;
 import com.egzosn.pay.common.bean.PayOutMessage;
 import com.egzosn.pay.common.exception.PayErrorException;
-
 import com.wteam.framework.common.enums.CardTypeEnum;
 import com.wteam.framework.common.enums.OrderStatus;
 import com.wteam.framework.common.enums.OrderStatusEnum;
-
 import com.wteam.framework.common.exception.ServiceException;
-
 import com.wteam.framework.modules.book.entity.Card;
 import com.wteam.framework.modules.book.entity.OrderInfo;
+import com.wteam.framework.modules.book.entity.Store;
 import com.wteam.framework.modules.book.mapper.CardMapper;
 import com.wteam.framework.modules.book.mapper.OrderInfoMapper;
+import com.wteam.framework.modules.book.mapper.StoreMapper;
 import com.wteam.framework.modules.book.service.CardService;
-
 import com.wteam.framework.modules.book.service.OrderInfoService;
 import com.wteam.framework.modules.card.entity.CbCardAdmin;
 import com.wteam.framework.modules.card.mapper.CardAdminMapper;
 import com.wteam.framework.modules.hardware.ApiCallerUtil;
+import com.wteam.framework.modules.hardware.QrCodeRegistrationUtil;
 import com.wteam.framework.modules.user.entity.User;
+import com.wteam.framework.modules.user.mapper.UserMapper;
 import lombok.extern.slf4j.Slf4j;
-
 import org.springframework.beans.factory.annotation.Autowired;
-
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
-
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
-
 import java.time.format.DateTimeFormatter;
 import java.util.Date;
 import java.util.Map;
@@ -59,6 +55,10 @@ public class MyPayMessageHandler implements PayMessageHandler {
     private CardMapper cardMapper;
     @Autowired
     private CardAdminMapper cardAdminMapper;
+    @Autowired
+    private UserMapper userMapper;
+    @Autowired
+    private StoreMapper storeMapper;
 
     /**
      * 重写这个接口处理支付业务请求
@@ -77,95 +77,114 @@ public class MyPayMessageHandler implements PayMessageHandler {
                 throw new IllegalArgumentException("Invalid payMessage");
             }
 
+            //TODO :这里需要的是map集合里面的另外两个参数
+
             // 处理支付逻辑
             String outTradeNo = payMessage.getOutTradeNo(); // 获取交易订单号
-            Number totalFee = payMessage.getTotalFee(); // 获取总费用(可能是一个数字)
-            String subject = payMessage.getSubject(); // 获取交易主题
-            String payType = payMessage.getPayType(); // 获取支付类型
-            String transactionType = payMessage.getTransactionType();  // 获取交易类型
             log.info("此时的支付订单号为{}", outTradeNo);
-            log.info("此时的支付总费用为{}", totalFee);
-            log.info("此时的支付交易主题为{}", subject);
-            log.info("此时的支付支付类型为{}", payType);
-            log.info("获取交易类型为{}", transactionType);
+
+            Map<String, Object> message = payMessage.getPayMessage();
+            // 获取transaction_id
+            String transactionId = (String) message.get("transaction_id");
+            log.info("此时的transactionId为:{}", transactionId);
 
             // 根据订单ID查询订单信息
             OrderInfo orderInfo = orderInfoMapper.selectById(outTradeNo);
+            orderInfo.setTransactionId(transactionId);
             log.info("此时的order信息为{}", orderInfo);
 
-            //如果是超时的情况,单独考虑
-            Double overPrice = orderInfo.getOverPrice();
-            if (overPrice != null && overPrice > 0) {
-                // overPrice 大于 0 表示超时,需要处理超时情况
-                // 在这里可以执行超时处理的逻辑
-                //生成一个只能通过一次的二维码
-                // 获取当前日期
-                LocalDate currentDate = LocalDate.now();
-                // 格式化日期为字符串
-                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
-                String formattedDate = currentDate.format(formatter);
-                String data = "pxo_" + formattedDate + "_" + orderInfo.getUserId() + "_" + orderInfo.getId() + "_00";
-                log.info("此时生成的二维码为:{} ", data);
-                //更新数据库里面此时二维码信息
-                orderInfo.setQrCode(data);
-                orderInfoMapper.updateById(orderInfo);
-                // 注册二维码
-                // 接口地址和参数
-                String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
-                String mac = "863569068849199";
-                String tk = ApiCallerUtil.callApi();
-                log.info("此时获取到的token为:{} ", tk);
-
-                //调用hutool接口注册二维码信息
-                HttpResponse response = HttpRequest.post(apiUrl).form("mac", mac).form("tk", tk).form("qcodetxt", data).form("enablecount", 1).execute();
-                //获取响应结果
-                String body = response.body();
-                // 处理返回结果
-                JSONObject json = new JSONObject(body);
-                int code = json.getInt("code");
-                String qcodetxt = json.getStr("qcodetxt");
-                log.info("此时返回的qcodetxt为:{}", qcodetxt);
-                String desc = json.getStr("desc");
-                log.info("此时返回的desc为:{}", desc);
-                //对响应结果处理
-                if (code != 0) {
-                    throw new ServiceException("硬件回调url设置接口异常!");
-                }
-                log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
-            }
-
-            if (orderInfo != null) {
-
-                //这里根据订单的类型生成不同的二维码注销
-                String orderType = orderInfo.getOrderType();
-                /**
-                 * 租场订单-->生成的二维码有时间限制,前5后15,进出次数不限制
-                 * 门票订单-->生成的二维码没有时间限制,任何时候来都可以,但是进出限制2次,一出一进就结束
-                 * 计时订单-->生成的二维码没有时间限制,也是先支付一个小时的钱,支付成功后修改订单状态!
-                 * 月卡订单-->生成的二维码截至时间为月卡结束时间,进出没有限制
-                 * 储值卡订单-->直接完成支付业务逻辑即可
-                 */
-
-                switch (orderType) {
-                    case "RENTAL":
-                        // 处理租场订单类型的支付逻辑
-                        return RentalOrder(orderInfo);
-                    case "TICKET":
-                        // 处理门票订单类型的支付逻辑
-                        return TicketOrder(orderInfo);
-                    case "TIMER":
-                        // 处理计时订单类型的支付逻辑
-                        return TimerOrder(orderInfo);
-                    case "MONTHLY":
-                        // 处理月卡订单类型的支付逻辑
-                        return MonthlyOrder(orderInfo);
-                    case "STORED_VALUE":
-                        // 处理卡片订单类型的支付逻辑
-                        return CardOrder(orderInfo);
-                    default:
-                        // 处理未知订单类型的情况
-                        break;
-                }
+//            //如果是超时的情况,单独考虑
+//            Double overPrice = orderInfo.getOverPrice();
+//            if (overPrice != null && overPrice > 0) {
+//                // overPrice 大于 0 表示超时,需要处理超时情况
+//                // 在这里可以执行超时处理的逻辑
+//                //生成一个只能通过一次的二维码
+//                // 获取当前日期
+//                LocalDate currentDate = LocalDate.now();
+//                //TODO :这里的
+//
+//                String numbers = RandomUtil.randomNumbers(5);
+//                // 格式化日期为字符串
+//                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
+//                String formattedDate = currentDate.format(formatter);
+//                String data = "pxo_" + formattedDate + "_" + numbers + "_" + orderInfo.getId() + "_00";
+//                log.info("此时生成的二维码为:{} ", data);
+//
+//                //更新数据库里面此时二维码信息
+//                orderInfo.setQrCode(data);
+//                orderInfo.setOrderState(String.valueOf(OrderStatusEnum.IN_USE));
+//                orderInfoMapper.updateById(orderInfo);
+//
+//                // 注册二维码
+//                // 接口地址和参数
+//                String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
+//                String mac1 = "863569068849199";
+//                String mac2 = "863569068848969";
+//                String tk = ApiCallerUtil.callApi(mac1);
+//                log.info("此时获取到的token为:{} ", tk);
+//
+//                // 拼接两个 MAC 地址,以逗号分隔
+//                String macParam = mac1 + "_" + mac2;
+//                log.info("此时拼接的macParam为:{}", macParam);
+//
+//                //调用hutool接口注册二维码信息
+//                HttpResponse response = HttpRequest.post(apiUrl).form("mac", macParam).form("tk", tk)
+//                        .form("qcodetxt", data)
+//                        .form("enablecount", 1).execute();
+//
+//                //获取响应结果
+//                String body = response.body();
+//
+//                // 处理返回结果
+//                JSONObject json = new JSONObject(body);
+//                int code = json.getInt("code");
+//                log.info("此时的超时的code为:{}", code);
+//                String qcodetxt = json.getStr("qcodetxt");
+//                log.info("此时返回的qcodetxt为:{}", qcodetxt);
+//                String desc = json.getStr("desc");
+//                log.info("此时返回的desc为:{}", desc);
+//
+//                //对响应结果处理
+//                if (code != 0) {
+//                    throw new ServiceException("硬件回调url设置接口异常!");
+//                }
+//                log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
+//            }
+
+            //这里根据订单的类型生成不同的二维码注销
+            String orderType = orderInfo.getOrderType();
+
+            /**
+             * 租场订单-->生成的二维码有时间限制,前30后30,进出次数不限制
+             * 门票订单-->生成的二维码没有时间限制,任何时候来都可以,但是进出限制2次,一出一进就结束
+             * 计时订单-->生成的二维码没有时间限制,也是先支付一个小时的钱,支付成功后修改订单状态!
+             * 月卡订单-->生成的二维码截至时间为月卡结束时间,进出没有限制
+             * 储值卡订单-->直接完成支付业务逻辑即可
+             */
+
+            switch (orderType) {
+                case "RENTAL":
+                    // 处理租场订单类型的支付逻辑
+                    return RentalOrder(orderInfo);
+                case "TICKET":
+                    // 处理门票订单类型的支付逻辑
+                    return TicketOrder(orderInfo);
+                case "TIMER":
+                    // 处理计时订单类型的支付逻辑
+                    return TimerOrder(orderInfo);
+                case "MONTHLY":
+                    // 处理月卡订单类型的支付逻辑
+                    return MonthlyOrder(orderInfo);
+                case "STORED_VALUE":
+                    // 合并储值卡订单和散客储值卡订单的支付逻辑
+                    // 处理储值卡订单类型的支付逻辑
+                    return CardOrder(orderInfo);
+                case "PERSON_CARD":
+                    // 处理散客储值卡订单类型的支付逻辑
+                    return PersonCardOrder(orderInfo);
+                default:
+                    // 处理未知订单类型的情况
+                    break;
             }
         } catch (Exception e) {
             log.info("此时的异常为:{}", e.getMessage());
@@ -173,75 +192,197 @@ public class MyPayMessageHandler implements PayMessageHandler {
         return PayOutMessage.TEXT().content("fail").build();
     }
 
+    //TODO:散客储值卡购买完成并没有获取到
+    private PayOutMessage PersonCardOrder(OrderInfo orderInfo) {
+
+        // 修改订单支付方式和支付状态
+        orderInfo.setPaymentMethods("WECHAT");
+        orderInfo.setOrderState(String.valueOf(OrderStatus.PAYMENT_SUCCESSFUL));
+        orderInfoMapper.updateById(orderInfo);
+
+        // 格式化日期为字符串
+        // 获取当前日期
+        LocalDate currentDate = LocalDate.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
+        String formattedDate = currentDate.format(formatter);
+
+        // 微信购买卡之后支付回调信息
+        Integer cardId = orderInfo.getCardId();
+        log.info("此时卡id为{}", cardId);
+
+        /**
+         * 可能是储值卡充值也可能是购买储值卡
+         */
+        // 储值卡充值
+        Card card = cardMapper.selectById(cardId);
+        log.info("此时卡信息为{}", card);
+
+        String userId = null;
+
+        if (card != null) {
+            userId = card.getUserId();
+            log.info("此时的useId为:{}", userId);
+            // 这种情况就证明此时该用户进行的是储值卡充值的操作
+            Double orderPrice = orderInfo.getOrderPrice();
+            Double currentBalance = card.getCurrentBalance();
+            double v = orderPrice + currentBalance;
+            log.info("此时的储值卡充值之后的余额为:{}", v);
+            card.setCurrentBalance(v);
+            cardMapper.updateById(card);
+            // 给用户加上累计消费
+            // addUserTotalConsumption(orderInfo);
+            return PayOutMessage.TEXT().content("success").build();
+        }
+
+        // 购买储值卡
+        CbCardAdmin cbCardAdmin = cardAdminMapper.selectById(cardId);
+
+        if (cbCardAdmin != null) {
+            Card cardUser = new Card();
+
+            // 获取余额
+            Integer faceValue = cbCardAdmin.getFaceValue();
+            cardUser.setCreateTime(new Date());
+            cardUser.setCardName(cbCardAdmin.getCardName());
+            cardUser.setCardType(cbCardAdmin.getCardType());
+            Integer days = cbCardAdmin.getDays();
+            cardUser.setDays(days);
+            cardUser.setStartDate(formattedDate);
+
+            // 将天数添加到日期
+            LocalDate newDate = currentDate.plusDays(days);
+
+            // 将新日期格式化为字符串
+            String newFormattedDate = newDate.format(formatter);
+            cardUser.setEndDate(newFormattedDate);
+            cardUser.setFaceValue(faceValue);
+            cardUser.setBonusAmount(cbCardAdmin.getBonusAmount());
+            cardUser.setCurrentBalance(Double.valueOf(faceValue + cbCardAdmin.getBonusAmount()));
+            cardUser.setUserId(orderInfo.getUserId());
+            cardUser.setStoreId(9376L);
+            cardUser.setDiscountValue(cbCardAdmin.getDiscountValue());
+            cardUser.setOrderId(orderInfo.getId());
+            log.info("此时的cardUser信息为:{}", cardUser);
+            // 给用户加上累计消费
+            // addUserTotalConsumption(orderInfo);
+            boolean save = cardService.save(cardUser);
+
+            Integer cardUserId = cardUser.getId();
+            orderInfo.setCardId(cardUserId);
+            log.info("此时的卡id为:{}", cardUserId);
+            orderInfoMapper.updateById(orderInfo);
+
+            if (save) {
+                return PayOutMessage.TEXT().content("success").build();
+            }
+        }
+
+        return PayOutMessage.TEXT().content("fail").build();
+
+    }
+
+
     /**
-     * 购买卡之后的支付回调
+     * 购买储值卡之后的支付回调
      *
      * @param orderInfo
      * @return
      */
+
+//TODO :储值卡不能重复购买 购买前需要先行校验
     private PayOutMessage CardOrder(OrderInfo orderInfo) {
-        //修改订单状态
+        //修改订单支付方式和支付状态
         orderInfo.setPaymentMethods("WECHAT");
         orderInfo.setOrderState(String.valueOf(OrderStatus.PAYMENT_SUCCESSFUL));
         orderInfoMapper.updateById(orderInfo);
+
         // 格式化日期为字符串
         // 获取当前日期
         LocalDate currentDate = LocalDate.now();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
         String formattedDate = currentDate.format(formatter);
+
         //微信购买卡之后支付回调信息
         Integer cardId = orderInfo.getCardId();
         log.info("此时卡id为{}", cardId);
-        //获取卡信息
+
+        /**
+         * 可能是储值卡充值 也可能是购买储值卡
+         */
+        //储值卡充值
         Card card = cardMapper.selectById(cardId);
         log.info("此时卡信息为{}", card);
-        String userId = card.getUserId();
-        log.info("此时userId信息为{}", userId);
-        if (userId != null && !userId.isEmpty()) {
-            try {
-                // 这种情况就证明此时该用户进行的是储值卡充值的操作
-                Double orderPrice = orderInfo.getOrderPrice();
-                card.setCurrentBalance(orderPrice);
-                cardMapper.updateById(card);
-                return PayOutMessage.TEXT().content("success").build();
-            } catch (Exception e) {
-                // 处理异常,可以记录日志或返回适当的错误信息
-                e.printStackTrace(); // 这里仅作示例,实际中请根据需求处理异常
-                return PayOutMessage.TEXT().content("充值失败,请联系客服").build();
-            }
+        String userId = null;
+        if (card != null) {
+            userId = card.getUserId();
+            log.info("此时的useId为:{}", userId);
+            // 这种情况就证明此时该用户进行的是储值卡充值的操作
+            Double orderPrice = orderInfo.getOrderPrice();
+            Double currentBalance = card.getCurrentBalance();
+            double v = orderPrice + currentBalance;
+            log.info("此时的储值卡充值之后的余额为:{}", v);
+            card.setCurrentBalance(v);
+            cardMapper.updateById(card);
+            //给用户加上累计消费
+//                addUserTotalConsumption(orderInfo);
+            return PayOutMessage.TEXT().content("success").build();
         }
+
+        // 购买储值卡
         CbCardAdmin cbCardAdmin = cardAdminMapper.selectById(cardId);
         Card cardUser = new Card();
+
         //获取余额
         Integer faceValue = cbCardAdmin.getFaceValue();
-        cardUser.setCardName(cbCardAdmin.getCardName());
-        cardUser.setUserId(orderInfo.getUserId());
-        cardUser.setFaceValue(faceValue);
         cardUser.setCreateTime(new Date());
-        log.info("当前的余额为:{}", faceValue);
+        cardUser.setCardName(cbCardAdmin.getCardName());
         cardUser.setCardType(cbCardAdmin.getCardType());
-        cardUser.setDays(cbCardAdmin.getDays());
-        cardUser.setStartDate(formattedDate);
-        cardUser.setCurrentBalance(Double.valueOf(faceValue));
         cardUser.setUserId(orderInfo.getUserId());
-        log.info("此时获取出来的userId为:{}", orderInfo.getUserId());
-        cardUser.setDiscountValue(cbCardAdmin.getDiscountValue());
-        Integer days = card.getDays();
+        Integer days = cbCardAdmin.getDays();
+        cardUser.setDays(days);
+        cardUser.setStartDate(formattedDate);
+
         // 将天数添加到日期
         LocalDate newDate = currentDate.plusDays(days);
+
         // 将新日期格式化为字符串
         String newFormattedDate = newDate.format(formatter);
         cardUser.setEndDate(newFormattedDate);
-        log.info("此时的enddate为:{}", newFormattedDate);
+        cardUser.setFaceValue(faceValue);
+        cardUser.setBonusAmount(cbCardAdmin.getBonusAmount());
+        cardUser.setCurrentBalance(Double.valueOf(faceValue + cbCardAdmin.getBonusAmount()));
+        cardUser.setUserId(orderInfo.getUserId());
+        cardUser.setStoreId(9376L);
+        cardUser.setDiscountValue(cbCardAdmin.getDiscountValue());
+        cardUser.setOrderId(orderInfo.getId());
         log.info("此时的cardUser信息为:{}", cardUser);
+        //给用户加上累计消费
+//        addUserTotalConsumption(orderInfo);
         boolean save = cardService.save(cardUser);
+
+        Integer cardUserId = cardUser.getId();
+        orderInfo.setCardId(cardUserId);
+        log.info("此时的卡id为:{}", cardUserId);
+        orderInfoMapper.updateById(orderInfo);
+
         if (save) {
-            return PayOutMessage.TEXT().content("success").build();
+            return PayOutMessage.TEXT()
+
+                    .content("success")
+
+                    .build();
         }
-        return PayOutMessage.TEXT().content("fail").build();
+        return PayOutMessage.TEXT().
+
+                content("fail").
+
+                build();
+
     }
 
-    private PayOutMessage MonthlyOrder(OrderInfo orderInfo) {
+    //TODO:月卡无法进入
+
+    private PayOutMessage MonthlyOrder(OrderInfo orderInfo) throws ParseException {
         // 修改订单状态为已支付
         orderInfo.setOrderState(String.valueOf(OrderStatus.PAYMENT_SUCCESSFUL));
         log.info("此时的OrderState信息为{}", orderInfo.getOrderState());
@@ -252,19 +393,19 @@ public class MyPayMessageHandler implements PayMessageHandler {
 
         orderInfoMapper.updateById(orderInfo);
 
-        //格式转化一下
+//        //给用户加上累计消费
+//        addUserTotalConsumption(orderInfo);
+
+        // 获得
         String id = orderInfo.getId();
-        log.info("转化之后的id为:{}", id);
-        long l = Long.parseLong(id);
-        log.info("转化之后的id为:{}", l);
+        log.info("此时的orderId为:{}", id);
 
         //获取卡信息
         Integer cardId = orderInfo.getCardId();
         log.info("此时的卡id为:{}", cardId);
         CbCardAdmin card = cardAdminMapper.selectById(cardId);
-        log.info("此时的卡信息为:{}", card);
-        String endDate = card.getEndDate();
-        log.info("此时的结束时间为{}", endDate);
+        log.info("此时的基础卡信息为:{}", card);
+
 
         // 格式化日期为字符串
         // 获取当前日期
@@ -274,117 +415,152 @@ public class MyPayMessageHandler implements PayMessageHandler {
 
         //创建卡信息
         Card cardUser = new Card();
-        Integer faceValue = card.getFaceValue();
-        cardUser.setCardName(card.getCardName());
-        cardUser.setUserId(orderInfo.getUserId());
-        cardUser.setFaceValue(faceValue);
         cardUser.setCreateTime(new Date());
-        log.info("当前的余额为:{}", faceValue);
+        cardUser.setCardName(card.getCardName());
         cardUser.setCardType(card.getCardType());
-        cardUser.setDays(card.getDays());
-        cardUser.setStartDate(formattedDate);
-        cardUser.setCurrentBalance(Double.valueOf(faceValue));
-        cardUser.setUserId(orderInfo.getUserId());
-        cardUser.setDiscountValue(card.getDiscountValue());
         Integer days = card.getDays();
+        cardUser.setDays(days);
+        cardUser.setStartDate(formattedDate);
+
         // 将天数添加到日期
         LocalDate newDate = currentDate.plusDays(days);
+
         // 将新日期格式化为字符串
         String newFormattedDate = newDate.format(formatter);
         cardUser.setEndDate(newFormattedDate);
-        log.info("此时的enddate为:{}", newFormattedDate);
+        cardUser.setUserId(orderInfo.getUserId());
+        cardUser.setStoreId(9376L);
+        cardUser.setOrderId(id);
         log.info("此时的cardUser信息为:{}", cardUser);
         cardService.save(cardUser);
 
+        //将购买的卡存入对应的订单信息
+        Integer cardUserId = cardUser.getId();
+        orderInfo.setCardId(cardUserId);
+        log.info("此时的卡id为:{}", cardUserId);
+        orderInfoMapper.updateById(orderInfo);
 
-        //此时的结束时间为卡二维码截至时间
-        try {
-            // 获取当前日期
-            LocalDate currentDate1 = LocalDate.now();
-            log.info("此时的时间为{}", currentDate);
-
-            // 创建 SimpleDateFormat 对象,指定日期格式
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
-            // 将日期字符串解析为 Date 对象
-            Date date = sdf.parse(endDate);
-            log.info("此时的date为:{}", date);
+//        // 获取当前日期
+//        LocalDate currentDate1 = LocalDate.now();
+//        log.info("此时的时间为{}", currentDate1);
 
-            // 将 Date 对象转化为秒级时间戳
-            // 除以1000以获取秒级时间戳
-            long timestamp = date.getTime() / 1000;
+        String numbers = RandomUtil.randomNumbers(5);
 
-            // 格式化日期为字符串
-            DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyyMMdd");
-            String formattedDate1 = currentDate1.format(formatter1);
-            log.info("此时格式化的日期为:{}", formattedDate);
 
-            String data = "pxo_" + formattedDate1 + "_" + orderInfo.getUserId() + "_" + l + "_00";
-            log.info("此时生成的二维码为:{} ", data);
-            orderInfo.setQrCode(data);
-            orderInfoService.updateById(orderInfo);
+//        // 格式化日期为字符串
+//        DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyyMMdd");
+//        String formattedDate1 = currentDate1.format(formatter1);
+//        log.info("此时格式化的日期为:{}", formattedDate);
 
-            // 注册二维码
-            // 接口地址和参数
-            String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
-            String mac = "863569068849199";
-            String tk = ApiCallerUtil.callApi();
-            log.info("此时获取到的token为:{} ", tk);
+        String data = "pxo_" + formattedDate + "_" + numbers + "_" + id + "_00";
+        log.info("此时生成的二维码为:{} ", data);
+        orderInfo.setQrCode(data);
+        orderInfoMapper.updateById(orderInfo);
 
-            //使用hutool调用接口
-            HttpResponse response = HttpRequest.post(apiUrl).form("mac", mac).form("tk", tk).form("qcodetxt", data).form("enabletime", timestamp).form("enablecount", 5000).execute();
-            //获取响应结果
-            String body = response.body();
-            // 处理返回结果
-            JSONObject json = new JSONObject(body);
-            int code = json.getInt("code");
-            String qcodetxt = json.getStr("qcodetxt");
-            log.info("此时返回的qcodetxt为:{}", qcodetxt);
-            String desc = json.getStr("desc");
-            log.info("此时返回的desc为:{}", desc);
-            //对响应结果处理
-            if (code != 0) {
-                throw new ServiceException("硬件回调url设置接口异常!");
-            }
-            log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
-        } catch (ParseException e) {
-            log.info("此时的异常为:{}", e.getMessage());
+//        此时的结束时间为卡二维码截至时间
+        // 创建 SimpleDateFormat 对象,指定日期格式
+//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//
+//        // 将日期字符串解析为 Date 对象
+//        Date date = sdf.parse(newFormattedDate);
+//        log.info("此时的date为:{}", date);
+//
+//        // 将 Date 对象转化为秒级时间戳
+//        // 除以1000以获取秒级时间戳
+//        long EdTimestamp = date.getTime() / 1000;
+//
+//        // 将时间戳转换为Date对象
+//        Date endTime = new Date(EdTimestamp * 1000);
+//        log.info("此时的有效截至时间为:{}", endTime);
+//
+//        // 获取当前时间的时间戳(秒级) 这是的时间戳为月卡的开始有效时间戳
+//        long StTimestamp = System.currentTimeMillis() / 1000;
+//        Date StTime = new Date(StTimestamp * 1000);
+//        log.info("此时的有效开始时间为:{}", StTime);
+
+//        // 注册二维码
+//        // 接口地址和参数
+//        String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
+//        String mac1 = "863569068849199";
+//        String mac2 = "863569068848969";
+//        String tk = ApiCallerUtil.callApi(mac2);
+//        log.info("此时获取到的token为:{} ", tk);
+//
+//        String macParam = mac1 + "_" + mac2;
+//        log.info("此时拼接的macParam为:{}", macParam);
+//
+//        //使用hutool调用接口
+//        HttpResponse response = HttpRequest.post(apiUrl)
+//                .form("mac", macParam)
+//                .form("tk", tk)
+//                .form("qcodetxt", data)
+////                .form("starttime", StTimestamp)
+////                .form("enabletime", EdTimestamp)
+//                .form("enablecount", 100)
+//                .execute();
+//
+//        //获取响应结果
+//        String body = response.body();
+//        // 处理返回结果
+//        JSONObject json = new JSONObject(body);
+//        int code = json.getInt("code");
+//        log.info("此时返回的code为:{}", code);
+//        String qcodetxt = json.getStr("qcodetxt");
+//        log.info("此时返回的qcodetxt为:{}", qcodetxt);
+//        String desc = json.getStr("desc");
+//        log.info("此时返回的desc为:{}", desc);
+//
+//        //对响应结果处理
+//        if (code != 0) {
+//            throw new ServiceException("硬件回调url设置接口异常!");
+//        }
+//        log.info("此时接口响应数据为:{} (不要记录敏感信息在日志中)", body);
+//        // 返回适当的PayOutMessage
+//        return PayOutMessage.TEXT().content("success").build();
+        Boolean b = QrCodeRegistrationUtil.registerMonthQrCode(data);
+        if (b) {
+            return PayOutMessage.TEXT().content("success").build();
         }
-        // 返回适当的PayOutMessage
-        return PayOutMessage.TEXT().
+        return PayOutMessage.TEXT().content("fail").build();
+    }
 
-                content("success").
 
-                build();
+    private PayOutMessage TimerOrder(OrderInfo orderInfo) {
+        // 要分为超时的支付情况和正常的支付情况
+        // 获取此时的超时金额
+        Double overPrice = orderInfo.getOverPrice();
 
-    }
+        if (overPrice != null) {
 
+            orderInfo.setOrderState(String.valueOf(OrderStatusEnum.IN_USE));
+            return PayOutMessage.TEXT().content("success").build();
 
-    private PayOutMessage TimerOrder(OrderInfo orderInfo) {
-        // 修改订单状态为已支付
-        orderInfo.setOrderState(String.valueOf(OrderStatus.PAYMENT_SUCCESSFUL));
+        }
+
+        // 正常的支付情况
+        orderInfo.setOrderState(String.valueOf(OrderStatusEnum.IN_USE));
         log.info("此时的OrderState信息为{}", orderInfo.getOrderState());
 
         // 修改订单支付方式
         orderInfo.setPaymentMethods("WECHAT");
         log.info("此时的PaymentMethods信息为{}", orderInfo.getPaymentMethods());
 
-        orderInfoMapper.updateById(orderInfo);
+        int i = orderInfoMapper.updateById(orderInfo);
 
-        //设置进出时间
-        orderInfo.setStartTime(new Date());
+//        //设置进出时间
+//        orderInfo.setStartTime(new Date());
 
-        //格式转化一下
-        String id = orderInfo.getId();
-        log.info("转化之后的id为:", id);
-        long l = Long.parseLong(id);
-        log.info("转化之后的id为:", l);
+//        //格式转化一下
+//        String id = orderInfo.getId();
+//        log.info("此时获得的订单id为:{}:", id);
 
-        int i = orderInfoMapper.updateById(orderInfo);
+//        int i = orderInfoMapper.updateById(orderInfo);
 
         if (i > 0) {
             return PayOutMessage.TEXT().content("success").build();
         }
+
         // 返回适当的PayOutMessage
         return PayOutMessage.TEXT().content("fail").build();
     }
@@ -401,65 +577,106 @@ public class MyPayMessageHandler implements PayMessageHandler {
 
         orderInfoMapper.updateById(orderInfo);
 
+
+        //给用户加上累计消费
+//        addUserTotalConsumption(orderInfo);
+
+        //得到此时的cardId
+        Integer cardId = orderInfo.getCardId();
+        CbCardAdmin cbCardAdmin = cardAdminMapper.selectById(cardId);
+        Integer days = cbCardAdmin.getDays();
+
         // 获取当前日期
         LocalDate currentDate = LocalDate.now();
 
         //格式转化一下
         String id = orderInfo.getId();
-        log.info("转化之后的id为:", id);
-        long l = Long.parseLong(id);
-        log.info("转化之后的id为:", l);
+        log.info("此时得到的订单id为:{}:", id);
 
         //创建卡信息
         Card cardUser = new Card();
-        cardUser.setCardType(String.valueOf(CardTypeEnum.TICKET));
-        cardUser.setDiscountValue(null);
-        cardUser.setUserId(orderInfo.getUserId());
         cardUser.setCreateTime(new Date());
         cardUser.setCardName("篮球次卡");
+        cardUser.setCardType(String.valueOf(CardTypeEnum.TICKET));
+        cardUser.setDays(days);
+        cardUser.setUserId(orderInfo.getUserId());
+        cardUser.setStoreId(9376L);
+        cardUser.setDiscountValue(null);
+        cardUser.setTimes(cbCardAdmin.getTimes());
+        cardUser.setOrderId(id);
+        log.info("此时的card信息为:{}", cardUser);
+
+        //存入数据库
         cardService.save(cardUser);
 
+        //修改订单表里面的对应的卡id
+        Integer cardUserId = cardUser.getId();
+        orderInfo.setCardId(cardUserId);
+        orderInfoMapper.updateById(orderInfo);
+        log.info("此时的卡id为:{}", cardUserId);
+
+        //生成5位随机数字
+        String numbers = RandomUtil.randomNumbers(5);
 
         // 格式化日期为字符串
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
         String formattedDate = currentDate.format(formatter);
-        String data = "pxo_" + formattedDate + "_" + orderInfo.getUserId() + "_" + l + "_00";
+        String data = "pxo_" + formattedDate + "_" + numbers + "_" + id + "_00";
         log.info("此时生成的二维码为:{} ", data);
 
-        // 保存入数据库
+        // 二维码保存入数据库
         orderInfo.setQrCode(data);
         log.info("此时的orderInfo为:{}", orderInfo);
-        boolean b = orderInfoService.updateById(orderInfo);
+        orderInfoService.updateById(orderInfo);
+        Boolean b = QrCodeRegistrationUtil.registerTicketQrCode(data);
 
         if (b) {
-            // 接口地址和参数
-            String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
-            String mac = "863569068849199";
-            String tk = ApiCallerUtil.callApi();
-            log.info("此时获取到的token为:{} ", tk);
-            //使用hutool调用接口
-            HttpResponse response = HttpRequest.post(apiUrl).form("mac", mac).form("tk", tk).form("qcodetxt", data).form("enablecount", 2).execute();
-            //获取响应结果
-            String body = response.body();
-            // 处理返回结果
-            JSONObject json = new JSONObject(body);
-            int code = json.getInt("code");
-            String qcodetxt = json.getStr("qcodetxt");
-            log.info("此时返回的qcodetxt为:{}", qcodetxt);
-            String desc = json.getStr("desc");
-            log.info("此时返回的desc为:{}", desc);
-            //对响应结果处理
-            if (code != 0) {
-                throw new ServiceException("硬件回调url设置接口异常!");
-            }
-            log.info("此时接口响应数据为:{} ", body);
+            // 返回适当的PayOutMessage
+            return PayOutMessage.TEXT().content("success").build();
         }
         // 返回适当的PayOutMessage
-        return PayOutMessage.TEXT().content("success").build();
+        return PayOutMessage.TEXT().content("fail").build();
+    }
+
+    public void addUserTotalConsumption(OrderInfo orderInfo) {
+        String userId = orderInfo.getUserId();
+        User user = userMapper.selectById(userId);
+
+        if (user != null) {
+            double newCredit = user.getCredit() + orderInfo.getOrderPrice() + orderInfo.getOverPrice();
+            log.info("此时的消费为:{}", newCredit);
+            user.setCredit(newCredit);
+            userMapper.updateById(user);
+        } else {
+            log.error("用户不存在,无法更新消费信息。");
+            // 可以抛出异常或记录其他错误信息,具体根据需求而定。
+        }
     }
 
 
     private PayOutMessage RentalOrder(OrderInfo orderInfo) {
+        //这里也要区分是否是超时支付超时的情况
+        //如果是补款超时金额的情况 只需要将其订单状态改为已完成订单即可
+        if (orderInfo.getOverPrice() != null) {
+            orderInfo.setOrderState(String.valueOf(OrderStatusEnum.USED));
+            // 获取当前日期
+            LocalDate currentDate = LocalDate.now();
+            //生成随机5位数字
+            String numbers1 = RandomUtil.randomNumbers(5);
+            String numbers2 = RandomUtil.randomNumbers(5);
+            // 格式化日期为字符串
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
+            String formattedDate = currentDate.format(formatter);
+            String data = "pxo_" + formattedDate + "_" + numbers1 + "_" + numbers2 + "_e0";
+            String qrCode = QrCodeRegistrationUtil.registerOneQrCode(data);
+            log.info("生成的一次核销的二维码为:{}", qrCode);
+            orderInfo.setQrCode(qrCode);
+            orderInfoMapper.updateById(orderInfo);
+
+            // 返回适当的PayOutMessage
+            return PayOutMessage.TEXT().content("success").build();
+        }
+
         // 修改订单状态为已支付
         orderInfo.setOrderState(String.valueOf(OrderStatusEnum.WAITING_TO_USE));
         log.info("此时的OrderState信息为{}", orderInfo.getOrderState());
@@ -468,21 +685,31 @@ public class MyPayMessageHandler implements PayMessageHandler {
         orderInfo.setPaymentMethods("WECHAT");
         log.info("此时的PaymentMethods信息为{}", orderInfo.getPaymentMethods());
 
+        Long storeId = orderInfo.getStoreId();
+        Store store = storeMapper.selectById(storeId);
+        Integer realTime = Integer.valueOf(store.getRealTime());
+        realTime = realTime * 2;
+        log.info("此时的核销次数为:{}", realTime);
+
         orderInfoMapper.updateById(orderInfo);
 
+//        //给用户加上累计消费
+//        addUserTotalConsumption(orderInfo);
+
         // 获取当前日期
         LocalDate currentDate = LocalDate.now();
 
         //格式转化一下
         String id = orderInfo.getId();
-        log.info("转化之后的id为:{}", id);
-        long l = Long.parseLong(id);
-        log.info("转化之后的id为:{}", l);
+        log.info("此时获取到的订单id为:{}", id);
+
+        //生成随机5位数字
+        String numbers = RandomUtil.randomNumbers(5);
 
         // 格式化日期为字符串
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
         String formattedDate = currentDate.format(formatter);
-        String data = "pxo_" + formattedDate + "_" + orderInfo.getUserId() + "_" + l + "_00";
+        String data = "pxo_" + formattedDate + "_" + numbers + "_" + id + "_00";
         log.info("此时生成的二维码为:{} ", data);
 
         // 保存入数据库
@@ -492,37 +719,58 @@ public class MyPayMessageHandler implements PayMessageHandler {
         if (save > 0) {
             // 接口地址和参数
             String apiUrl = "https://xiaofeng.pankzone.com/api/openapi/reg_access_qcode.x";
-            String mac = "863569068849199";
-            String tk = ApiCallerUtil.callApi();
+            String mac1 = "863569068849199";
+            String mac2 = "863569068848969";
+            String tk = ApiCallerUtil.callApi(mac1);
             log.info("此时获取到的token为:{} ", tk);
+
             //获取订单开始和结束时间
             Date orderSt = orderInfo.getOrderSt();
             Date orderEd = orderInfo.getOrderEd();
+
             // 转化为时间戳
-            // 前5后15
-            // 获取当前时间的时间戳(毫秒级)
-            long currentTimeMillis = System.currentTimeMillis();
+            // 前30后30
+            // 获取当前时间的时间戳(秒级)
+//            long currentTimeMillis = System.currentTimeMillis() / 1000;
+
+            // 将订单开始时间前推30分钟并转换为时间戳
+            long orderStTimestamp = (orderSt.getTime() / 1000) - (30 * 60);
+            log.info("此时的订单开始时间戳为:{}", orderStTimestamp);
+            Date stTime = new Date(orderStTimestamp * 1000);
+            log.info("订单{}" + "的订单开始时间(二维码有效开始时间)为:{}", id, stTime);
+
 
-            // 将订单开始时间前推5分钟并转换为时间戳
-            long orderStTimestamp = orderSt.getTime() - (5 * 60 * 1000);
+            // 将订单结束时间后推30分钟并转换为时间戳
+            long orderEdTimestamp = (orderEd.getTime() / 1000) + (30 * 60);
+            log.info("此时的订单结束时间戳为:{}", orderEdTimestamp);
+            Date endTime = new Date(orderEdTimestamp * 1000);
+            log.info("订单{}" + "的订单结束时间(二维码失效时间)为:{}", id, endTime);
 
-            // 将订单结束时间后推10分钟并转换为时间戳
-            long orderEdTimestamp = orderEd.getTime() + (10 * 60 * 1000);
+//            // 如果需要确保不早于当前时间,可以添加以下逻辑
+//            orderStTimestamp = Math.max(orderStTimestamp, currentTimeMillis);
+//            orderEdTimestamp = Math.max(orderEdTimestamp, currentTimeMillis);
+
+            // 拼接两个 MAC 地址,以逗号分隔
+            String macParam = mac1 + "_" + mac2;
+            log.info("此时拼接的macParam为:{}", macParam);
 
-            // 如果需要确保不早于当前时间,可以添加以下逻辑
-            orderStTimestamp = Math.max(orderStTimestamp, currentTimeMillis);
-            orderEdTimestamp = Math.max(orderEdTimestamp, currentTimeMillis);
             //使用hutool调用接口
-            HttpResponse response = HttpRequest.post(apiUrl).form("mac", mac).form("tk", tk).form("qcodetxt", data).form("starttime", orderStTimestamp).form("enabletime", orderEdTimestamp).form("enablecount", 100).execute();
+            HttpResponse response = HttpRequest.post(apiUrl).form("mac", macParam).form("tk", tk).form("qcodetxt", data).form("starttime", orderStTimestamp).form("enabletime", orderEdTimestamp).form("enablecount", realTime).execute();
+
             //获取响应结果
             String body = response.body();
+
             // 处理返回结果
             JSONObject json = new JSONObject(body);
             int code = json.getInt("code");
+            log.info("此时返回的code为:{}", code);
+
             String qcodetxt = json.getStr("qcodetxt");
             log.info("此时返回的qcodetxt为:{}", qcodetxt);
+
             String desc = json.getStr("desc");
             log.info("此时返回的desc为:{}", desc);
+
             //对响应结果处理
             if (code != 0) {
                 throw new ServiceException("硬件回调url设置接口异常!");

+ 4 - 1
framework/src/main/java/com/wteam/framework/modules/permission/service/impl/AdminUserServiceImpl.java

@@ -27,6 +27,7 @@ import com.wteam.framework.modules.permission.mapper.AdminUserMapper;
 import com.wteam.framework.modules.permission.service.*;
 
 import com.wteam.framework.modules.system.aspect.annotation.SystemLogPoint;
+import com.wteam.framework.modules.user.token.UserTokenGenerate;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -57,6 +58,8 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
     private MenuService menuService;
     @Autowired
     private ManagerTokenGenerate managerTokenGenerate;
+    @Autowired
+    private UserTokenGenerate userTokenGenerate;
 
     @Autowired
     private Cache cache;
@@ -137,7 +140,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
 
     @Override
     public Token refreshToken(String refreshToken) {
-        return managerTokenGenerate.refreshToken(refreshToken);
+        return userTokenGenerate.refreshToken(refreshToken);
     }
 
     @Override

+ 1 - 1
framework/src/main/java/com/wteam/framework/modules/specialValue/service/impl/CbSpecialValueServiceImpl.java

@@ -61,7 +61,7 @@ public class CbSpecialValueServiceImpl extends ServiceImpl<CbSpecialValueMapper,
     }
 
     private String formatTime(Date time) {
-        SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
+        SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         return timeFormat.format(time);
     }
 

+ 1 - 1
framework/src/main/java/com/wteam/framework/modules/user/entity/User.java

@@ -61,7 +61,7 @@ public class User {
     //邮件
     private String email;
     //积分
-    private String credit;
+    private Double credit;
     //姓名
     private String name;
     //状态 默认true正常 false禁用

+ 1 - 8
framework/src/main/java/com/wteam/framework/modules/user/service/UserService.java

@@ -66,13 +66,6 @@ public interface UserService extends IService<User> {
      */
     void logout(UserEnums userEnums);
 
-    /**
-     * 查看我的订单
-     *
-     * @param accessToken
-     * @param orderTypeEnum
-     * @return
-     */
     ResultMessage showOrderType(String accessToken, orderTypeEnum orderTypeEnum);
 
     ResultMessage showMyCard(Long id, CardTypeEnum cardTypeEnum);
@@ -81,5 +74,5 @@ public interface UserService extends IService<User> {
 
     ResultMessage showOrder(String id);
 
-    ResultMessage showOrderByType(String id, OrderTypeEnums orderTypeEnum);
+    ResultMessage showOrderByType(String id, OrderTypeEnums orderTypeEnum) throws NullPointerException;
 }

+ 54 - 58
framework/src/main/java/com/wteam/framework/modules/user/service/impl/UserServiceImpl.java

@@ -5,6 +5,7 @@ import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
 import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
 import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
 import cn.binarywang.wx.miniapp.util.WxMaConfigHolder;
+import cn.hutool.core.date.DateTime;
 import cn.hutool.core.text.CharSequenceUtil;
 
 
@@ -162,6 +163,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 log.info("此时的电话为:{}", phoneNumber);
                 User newUser = new User();
                 newUser.setOpenId(openId);
+//                newUser.setCreateTime(new Date().toString());
 //                log.info("此时的昵称为:{}", userInfo.getNickName());
 //                newUser.setNickName(userInfo.getNickName());
 //                newUser.setAvatar(userInfo.getAvatarUrl());
@@ -345,85 +347,79 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     }
 
 
+    public void queryOrdersAndDeleteNullStatusOrders() {
+        //构成查询条件
+        LambdaQueryWrapper<OrderInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(OrderInfo::getOrderState, null);
+        orderInfoMapper.delete(lambdaQueryWrapper);
+    }
+
+
+    //TODO:这里的订单状态要修改
     @Override
-    public ResultMessage showOrderByType(@NotNull String id, OrderTypeEnums orderTypeEnum) {
+    public ResultMessage showOrderByType(@NotNull String id, OrderTypeEnums orderTypeEnum) throws NullPointerException {
+        log.info("此时传入的订单类型为:{}", orderTypeEnum);
+        //删除订单状态为null的订单
+        //构成查询条件
+        LambdaQueryWrapper<OrderInfo> deleteQueryWrapper = new LambdaQueryWrapper<>();
+        deleteQueryWrapper.eq(OrderInfo::getOrderState, null);
+        orderInfoService.remove(deleteQueryWrapper);
+
         //先获取到这个用户的所有订单
         LambdaQueryWrapper<OrderInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-        lambdaQueryWrapper.eq(OrderInfo::getOrderType, orderTypeEnum)
-                .eq(OrderInfo::getUserId, id);
+        lambdaQueryWrapper.eq(OrderInfo::getOrderType, orderTypeEnum).eq(OrderInfo::getUserId, id);
         List<OrderInfo> orderInfos = orderInfoMapper.selectList(lambdaQueryWrapper);
-        List<OrderInfo> collect = orderInfos.stream()
-                .filter(orderInfo -> orderInfo.getOrderState() != null)
-                .filter(orderInfo -> orderInfo.getQrCode() != null)
-                .collect(Collectors.toList());
+
+        //过滤掉订单状态异常和没有二维码的订单
+        List<OrderInfo> collect = orderInfos.stream().filter(orderInfo -> orderInfo.getOrderState() != null).filter(orderInfo -> orderInfo.getQrCode() != null).collect(Collectors.toList());
         log.info("过滤之后的订单信息为:{}", collect);
 
+        //TODO:这里查询出来过期的订单对应的订单状态需要修改
+        //修改过期的订单状态
         List<OrderInfo> orderInfoList = new ArrayList<>();
+
         // 获取当前时间
         Date currentTime = new Date();
         for (OrderInfo orderInfo : collect) {
-            // 自定义方法,将订单结束时间字符串解析为Date对象
-            Date orderEndTime = parseDate(orderInfo.getOrderEd());
+            // 订单结束时间字符串解析为Date对象
+            Date orderEndTime = orderInfo.getOrderEd();
+            log.info("订单结束时间为:{}", orderEndTime);
+
             // 假设订单已经过期的阈值为5分钟
             long threshold = 5 * 60 * 1000;
             if (orderEndTime != null && orderEndTime.getTime() + threshold < currentTime.getTime()) {
                 // 订单已经过期,将订单状态设置为已经过期
                 orderInfo.setOrderState(String.valueOf(OrderStatusEnum.EXPIRED));
-                orderInfoList.add(orderInfo);
-                // 更新订单状态到数据库(具体的数据库更新操作需要根据您的项目需求来实现)
+
+                // 更新订单状态到数据库
                 orderInfoService.updateById(orderInfo);
+                orderInfoList.add(orderInfo);
+                log.info("更新的订单信息为:{}", orderInfo);
+
+            } else {
+
+                orderInfoList.add(orderInfo);
+
             }
-            orderInfoList.add(orderInfo);
         }
 
-        List<OrderInfoVo> orderInfoVos = new ArrayList<>();
-        List<OrderTicketVo> order = new ArrayList<>();
-        //增强for循环遍历
-        for (OrderInfo orderInfo : orderInfoList) {
-            String orderType = orderInfo.getOrderType();
-            log.info("此时的订单类型为:{}", orderType);
-            if ("TICKET".equals(orderType)) {
-                log.info("此时的orderInfo信息为:{}", orderInfo);
-                Integer cardId = orderInfo.getCardId();
-                log.info("此时的卡id为为:{}", cardId);
-                OrderTicketVo orderTicketVo = new OrderTicketVo();
-                Card card = cardMapper.selectById(cardId);
-                log.info("此时的卡为:{}", card);
-                Integer days = card.getDays();
-                if (days != null && days == 0) {
-                    return ResultUtil.success(ResultCode.CARD_DAYS_IS_NULl);
-                }
-                String endDate = card.getEndDate();
-                String startDate = card.getStartDate();
-                BeanUtil.copyProperties(orderInfo, orderTicketVo);
-                orderTicketVo.setDays(days);
-                orderTicketVo.setEndDate(endDate);
-                orderTicketVo.setStartDate(startDate);
-                order.add(orderTicketVo);
-                return ResultUtil.data(order);
-            }
-            OrderInfoVo orderInfoVo = new OrderInfoVo();
-            Long venueId = orderInfo.getVenueId();
-            log.info("此时的场地id为:{}", venueId);
-            if (venueId == null) {
-                return ResultUtil.data(null);
+        List<OrderInfoVo> rentalOrders = new ArrayList<>();
+
+        // 租场订单提供租场信息
+        if (orderTypeEnum.equals(OrderTypeEnums.RENTAL)) {
+            for (OrderInfo orderInfo : orderInfoList) {
+                Long venueId = orderInfo.getVenueId();
+                Venue venue = venueMapper.selectById(venueId);
+                OrderInfoVo orderInfoVo = new OrderInfoVo();
+                BeanUtil.copyProperties(orderInfo, orderInfoVo);
+                orderInfoVo.setVenueType(venue.getVenueType());
+                orderInfoVo.setVenueName(venue.getVenueName());
+                log.info("此时的返回数据为:{}", orderInfoVo);
+                rentalOrders.add(orderInfoVo);
             }
-            Venue venue = venueMapper.selectById(venueId);
-            log.info("此时的场地为:{}", venue);
-            String venueName = venue.getVenueName();
-            log.info("此时的场地名称为:{}", venueName);
-            String venueType = venue.getVenueType();
-            log.info("此时的场地类型为:{}", venueType);
-            BeanUtil.copyProperties(orderInfo, orderInfoVo);
-            orderInfoVo.setVenueType(venueType);
-            orderInfoVo.setVenueName(venueName);
-            log.info("此时的返回数据为:{}", orderInfoVo);
-            orderInfoVos.add(orderInfoVo);
-        }
-        if (ObjectUtil.isNull(orderInfoVos)) {
-            return ResultUtil.success();
         }
-        return ResultUtil.data(orderInfoVos);
+        log.info("此时的rentalOrders为:{}", rentalOrders);
+        return orderTypeEnum.equals(OrderTypeEnums.RENTAL) ? ResultUtil.data(rentalOrders) : ResultUtil.data(orderInfoList);
     }
 
 

BIN
framework/target/classes/com/wteam/framework/common/enums/PermissionEnum.class


BIN
framework/target/classes/com/wteam/framework/common/enums/ResultCode.class


BIN
framework/target/classes/com/wteam/framework/common/security/token/TokenUtils.class


BIN
framework/target/classes/com/wteam/framework/common/security/token/manager/ManagerTokenGenerate.class


BIN
framework/target/classes/com/wteam/framework/modules/permission/service/impl/AdminUserServiceImpl.class


BIN
framework/target/classes/com/wteam/framework/modules/user/entity/User.class


BIN
framework/target/classes/com/wteam/framework/modules/user/service/UserService.class


BIN
framework/target/classes/com/wteam/framework/modules/user/service/impl/UserServiceImpl.class


+ 2 - 2
manager-api/src/main/java/com/wteam/manager/ManagerAuthenticationFilter.java

@@ -99,8 +99,8 @@ public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
             if (cache.hasKey(CachePrefix.ACCESS_TOKEN.getPrefix(UserEnums.MANAGER) + jwt)) {
                 //用户角色
                 List<GrantedAuthority> auths = new ArrayList<>();
-                auths.add(new SimpleGrantedAuthority("ROLE_" + authUser.getRole().name()));
-
+                //TODO :修改过toUpperCase
+                auths.add(new SimpleGrantedAuthority("ROLE_" + authUser.getRole().name().toUpperCase()));
 
 
                 //构造返回信息

+ 1 - 1
spring.iml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module relativePaths="false" type="JAVA_MODULE" version="4">
+<module version="4">
   <component name="AdditionalModuleElements">
     <content url="file://$MODULE_DIR$" dumb="true">
       <excludeFolder url="file://$MODULE_DIR$/target" />