Ver código fonte

feature: 管理后台
1.自助机充值后更新本地余额

luoyb 1 ano atrás
pai
commit
fb04a2f2a3

+ 14 - 1
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/BalanceUpdateEnum.java

@@ -33,7 +33,11 @@ public enum BalanceUpdateEnum {
     /**
      * 错扣补款
      */
-    COMPENSATE(4,"补款");
+    COMPENSATE(4,"补款"),
+    /**
+     * 未知
+     */
+    NULL(99,"未知");
 
     private final Integer code;
     private final String message;
@@ -76,6 +80,15 @@ public enum BalanceUpdateEnum {
         return null;
     }
 
+    public static BalanceUpdateEnum fromCode(int code) {
+        for (BalanceUpdateEnum item : BalanceUpdateEnum.values()) {
+            if (item.code().equals(code)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
     @Override
     public String toString() {
         return this.name();

+ 0 - 51
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/CloudMqEventEnum.java

@@ -1,51 +0,0 @@
-package org.dromara.common.core.enums;
-
-/**
- * @ClassName CloudMqEventEnum
- * @Description TODO
- * @Author luoyibo
- * @Date 2025-01-04 22:53
- * @Version 1.0
- * @since jdk17
- */
-public enum CloudMqEventEnum {
-    CONSUME("00000001","消费信息"),
-    DEPT("00000002","部门信息"),
-    USER("00000003","用户信息"),
-    ACCOUNT("00000004","账户信息"),
-    CARD("00000005","卡片信息"),
-    CONSUME_RECORD("00500001","消费记录"),
-    REPORTED("00500002","报到状态");
-
-
-
-    private final String code;
-    private final String name;
-
-    CloudMqEventEnum(String code, String name) {
-        this.code = code;
-        this.name = name;
-    }
-
-    public String code() {
-        return this.code;
-    }
-
-    public String message() {
-        return this.name;
-    }
-
-    public static String getMessage(String code) {
-        for (CloudMqEventEnum item : CloudMqEventEnum.values()) {
-            if (item.code().equals(code)) {
-                return item.name;
-            }
-        }
-        return "未知";
-    }
-
-    @Override
-    public String toString() {
-        return this.name();
-    }
-}

+ 14 - 11
ruoyi-server/ruoyi-server-mqdata/src/main/java/org/dromara/server/mq/event/kafka/impl/local/BackStageEventStrategyImpl.java

@@ -61,18 +61,21 @@ public class BackStageEventStrategyImpl implements IYktEventStrategy {
                 remoteCardService.saveOrUpdate(remoteBo);
             }
             case EventTypeConstants.RECHARGE -> {
-                JSONObject object = JSONUtil.parseObj(msg);
-                RemotePurseInOutBo remoteBo = new RemotePurseInOutBo();
-                remoteBo.setUserId(Long.valueOf(object.getStr("userId")));
-                remoteBo.setBagCode(object.getStr("bagCode"));
-                remoteBo.setPayStyle(object.getStr("payStyle"));
-                remoteBo.setReceiptMoney(new BigDecimal(object.getStr("receiptMoney")));
-                remoteBo.setTakeCommission(object.getStr("takeCommission"));
-                remoteBo.setOperatorId(Long.valueOf(object.getStr("operatorId")));
-                remoteBo.setUseType(SystemUseTypeEnum.CONSUME);
-                remoteBo.setOperationMode(BalanceUpdateEnum.RECHARGE);
-                remoteBo.setCreditType(CreditTypeEnum.WECHAT_RECHARGE);
+                RemotePurseInOutBo remoteBo = JSONUtil.toBean(JSONUtil.parseObj(msg), RemotePurseInOutBo.class);
+                //JSONObject object = JSONUtil.parseObj(msg);
+                //RemotePurseInOutBo remoteBo = new RemotePurseInOutBo();
+                //remoteBo.setUserId(Long.valueOf(object.getStr("userId")));
+                //remoteBo.setBagCode(object.getStr("bagCode"));
+                //remoteBo.setPayStyle(object.getStr("payStyle"));
+                //remoteBo.setReceiptMoney(new BigDecimal(object.getStr("receiptMoney")));
+                //remoteBo.setTakeCommission(object.getStr("takeCommission"));
+                //remoteBo.setOperatorId(Long.valueOf(object.getStr("operatorId")));
+                //remoteBo.setUseType(SystemUseTypeEnum.CONSUME);
+                //remoteBo.setOperationMode(BalanceUpdateEnum.RECHARGE);
+                //remoteBo.setCreditType(CreditTypeEnum.WECHAT_RECHARGE);
                 log.info("[处理云端->本地充值请求]-[充值信息:{}]", JSONUtil.toJsonStr(remoteBo));
+
+
                 remoteBagService.recharge(remoteBo);
             }
         }