Преглед изворни кода

feat : 德扬数据同步接口调试修改

bilingfeng пре 1 година
родитељ
комит
166528752f

+ 18 - 8
game-platform/game-platform-serve/src/main/java/com/zanxiang/game/platform/serve/controller/api/PlatformDeYangApiController.java

@@ -1,5 +1,9 @@
 package com.zanxiang.game.platform.serve.controller.api;
 
+import com.zanxiang.game.platform.serve.pojo.dto.PlatformDeYangOrderDTO;
+import com.zanxiang.game.platform.serve.pojo.dto.PlatformDeYangUserDTO;
+import com.zanxiang.game.platform.serve.service.IPlatformDeYangOrderService;
+import com.zanxiang.game.platform.serve.service.IPlatformDeYangUserService;
 import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.module.util.pojo.ResultVO;
 import io.swagger.annotations.Api;
@@ -7,13 +11,13 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Map;
-
 /**
  * @author : lingfeng
  * @time : 2023-05-22
@@ -25,20 +29,26 @@ import java.util.Map;
 @RequestMapping("/api/deYang/game")
 public class PlatformDeYangApiController {
 
+    @Autowired
+    private IPlatformDeYangOrderService platformDeYangOrderService;
+
+    @Autowired
+    private IPlatformDeYangUserService platformDeYangUserService;
+
     @ApiOperation(value = "用户信息推送接口")
     @PostMapping("/user")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
-    public ResultVO<Boolean> pushUserInfo(@RequestBody Map<String, String> userParam) {
-        log.error("接收到德扬用户信息推送, userParam : {}", JsonUtil.toString(userParam));
-        return ResultVO.ok(Boolean.FALSE);
+    public ResultVO<Boolean> pushUserInfo(@RequestBody @Validated PlatformDeYangUserDTO userDTO) {
+        log.error("接收到德扬用户信息推送, userDTO : {}", JsonUtil.toString(userDTO));
+        return ResultVO.ok(platformDeYangUserService.addOrUpdate(userDTO));
     }
 
     @ApiOperation(value = "订单信息推送接口")
     @PostMapping("/order")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
-    public ResultVO<Boolean> pushOrderInfo(@RequestBody Map<String, String> orderParam) {
-        log.error("接收到德扬订单信息推送, orderParam : {}", JsonUtil.toString(orderParam));
-        return ResultVO.ok(Boolean.FALSE);
+    public ResultVO<Boolean> pushOrderInfo(@RequestBody @Validated PlatformDeYangOrderDTO orderDTO) {
+        log.error("接收到德扬订单信息推送, orderParam : {}", JsonUtil.toString(orderDTO));
+        return ResultVO.ok(platformDeYangOrderService.addOrUpdate(orderDTO));
     }
 
 }

+ 29 - 33
game-platform/game-platform-serve/src/main/java/com/zanxiang/game/platform/serve/pojo/dto/PlatformDeYangOrderDTO.java

@@ -2,7 +2,7 @@ package com.zanxiang.game.platform.serve.pojo.dto;
 
 import lombok.Data;
 
-import java.time.LocalDateTime;
+import javax.validation.constraints.NotBlank;
 
 /**
  * @author : lingfeng
@@ -15,75 +15,71 @@ public class PlatformDeYangOrderDTO {
     /**
      * 订单id
      */
-    private String orderId;
+    @NotBlank(message = "订单id不可为空")
+    private String orderid;
 
     /**
-     * openId
+     * 平台账号id, 用户唯一标识
      */
-    private String openId;
+    private Long uid;
 
     /**
-     * 状态
+     * 公众号openId
      */
-    private Integer status;
+    private String wecha_id;
 
     /**
-     * 金额(单位:分)
+     * 游戏名称
      */
-    private Long amount;
+    private String game_name;
 
     /**
-     * 下单时间
+     * 支付状态:0未支付,1已支付
      */
-    private LocalDateTime createdTime;
+    private Integer pay_status;
 
     /**
-     * 支付时间
+     * 充值金额(单位:分)
      */
-    private LocalDateTime payTime;
+    private Long price;
 
     /**
-     * 是否首充
-     */
-    private Boolean isFirst;
-
-    /**
-     * 游戏角色名
+     * 下单时间
      */
-    private String roleName;
+    private Long addtime;
 
     /**
-     * 游戏区服
+     * 支付类型
      */
-    private String severName;
+    private String pay_type;
 
     /**
-     * 商户订单号
+     * 支付时间
      */
-    private String merchantNumber;
+    private String pay_time;
 
     /**
-     * 商户类型
+     * 角色名称
      */
-    private String merchantType;
+    private String role_name;
 
     /**
-     * 游戏商品ID
+     * 角色区服
      */
-    private String productId;
+    private String role_area;
 
     /**
-     * 游戏商品名称
+     * 渠道id
      */
-    private String productName;
+    private Long tunnel_id;
 
     /**
-     * 游戏名称
+     * 商品名称
      */
-    private String gameName;
+    private String product_name;
 
     /**
-     * 更新时间
+     * 回传信息
      */
-    private LocalDateTime updateTime;
+    private String toufang_back;
 }

+ 36 - 35
game-platform/game-platform-serve/src/main/java/com/zanxiang/game/platform/serve/pojo/dto/PlatformDeYangUserDTO.java

@@ -2,7 +2,7 @@ package com.zanxiang.game.platform.serve.pojo.dto;
 
 import lombok.Data;
 
-import java.time.LocalDateTime;
+import javax.validation.constraints.NotNull;
 
 /**
  * @author : lingfeng
@@ -13,92 +13,93 @@ import java.time.LocalDateTime;
 public class PlatformDeYangUserDTO {
 
     /**
-     * 用户id
+     * 平台账号id, 用户唯一标识
      */
-    private String userId;
+    @NotNull(message = "用户唯一标识不可为空")
+    private Long uid;
 
     /**
-     * openId
+     * 公众号openId
      */
-    private String openId;
+    private String wecha_id;
 
     /**
-     * 注册IP
+     * 趣程标识
      */
-    private String registerIp;
+    private String n_wecha_id;
 
     /**
-     * 注册UA
+     * 注册时间
      */
-    private String registerUa;
+    private String time;
 
     /**
-     * 注册时间
+     * 渠道id
      */
-    private LocalDateTime registerTime;
+    private Long tunnel_id;
 
     /**
      * 最后登录时间
      */
-    private LocalDateTime lastLoginTime;
+    private String update_time;
 
     /**
      * 支付金额(单位:分)
      */
-    private Long payAmount;
+    private Long all_price;
 
     /**
-     * 手机号
+     * 游戏付费金额(单位:分)
      */
-    private Long phoneNumber;
+    private Long game_price;
 
     /**
-     * 游戏名称
+     * 手机号
      */
-    private String gameName;
+    private String mobile;
 
     /**
-     * 游戏角色
+     * 真实姓名
      */
-    private String gameRole;
+    private String true_name;
 
     /**
-     * 游戏等级
+     * 身份证号
      */
-    private String gameLevel;
+    private String code;
 
     /**
-     * 游戏付费金额(单位:分)
+     * 游戏名称
      */
-    private Long gamePayAmount;
+    private String game_name;
 
     /**
-     * 实名信息
+     * 角色名称
      */
-    private String realNameAuth;
+    private String role_name;
 
     /**
-     * 公众号appId
+     * 角色区服
      */
-    private String mpAppId;
+    private String role_area;
 
     /**
-     * 公众号名称
+     * 注册IP
      */
-    private String mpAppName;
+    private String ip;
 
     /**
-     * 渠道id
+     * 公众号id
      */
-    private String channelId;
+    private String appid;
 
     /**
-     * 趣程标识
+     * 公众号名称
      */
-    private String quChengSign;
+    private String appname;
 
     /**
-     * 更新时间
+     * 注册UA
      */
-    private LocalDateTime updateTime;
+    private String user_agent;
 }

+ 26 - 30
game-platform/game-platform-serve/src/main/java/com/zanxiang/game/platform/serve/pojo/entity/PlatformDeYangOrder.java

@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  * @author : lingfeng
@@ -32,72 +33,67 @@ public class PlatformDeYangOrder implements Serializable {
     private String orderId;
 
     /**
-     * openId
+     * 平台账号id, 用户唯一标识
      */
-    private String openId;
+    private Long uid;
 
     /**
-     * 状态
+     * 公众号openId
      */
-    private Integer status;
+    private String mpOpenId;
 
     /**
-     * 金额(单位:分)
+     * 游戏名称
      */
-    private Long amount;
+    private String gameName;
 
     /**
-     * 下单时间
+     * 支付状态:0未支付,1已支付
      */
-    private LocalDateTime createdTime;
+    private Integer payStatus;
 
     /**
-     * 支付时间
+     * 充值金额(单位:分)
      */
-    private LocalDateTime payTime;
+    private Long price;
 
     /**
-     * 是否首充
+     * 下单时间
      */
-    private Boolean isFirst;
+    private LocalDateTime addTime;
 
     /**
-     * 游戏角色名
+     * 支付类型
      */
-    private String roleName;
+    private String payType;
 
     /**
-     * 游戏区服
+     * 支付时间
      */
-    private String severName;
+    private LocalDateTime payTime;
 
     /**
-     * 商户订单号
+     * 角色名称
      */
-    private String merchantNumber;
+    private String roleName;
 
     /**
-     * 商户类型
+     * 角色区服
      */
-    private String merchantType;
+    private String roleArea;
 
     /**
-     * 游戏商品ID
+     * 渠道id
      */
-    private String productId;
+    private Long tunnelId;
 
     /**
-     * 游戏商品名称
+     * 商品名称
      */
     private String productName;
 
     /**
-     * 游戏名称
-     */
-    private String gameName;
-
-    /**
-     * 更新时间
+     * 回传信息
      */
-    private LocalDateTime updateTime;
+    private String touFangBack;
 }

+ 36 - 35
game-platform/game-platform-serve/src/main/java/com/zanxiang/game/platform/serve/pojo/entity/PlatformDeYangUser.java

@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  * @author : lingfeng
@@ -26,93 +27,93 @@ public class PlatformDeYangUser implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
-     * 用户id
+     * 平台账号id, 用户唯一标识
      */
-    @TableId(value = "user_id", type = IdType.INPUT)
-    private String userId;
+    @TableId(value = "uid", type = IdType.INPUT)
+    private Long uid;
 
     /**
-     * openId
+     * 公众号openId
      */
-    private String openId;
+    private String mpOpenId;
 
     /**
-     * 注册IP
+     * 趣程标识
      */
-    private String registerIp;
+    private String qcSign;
 
     /**
-     * 注册UA
+     * 注册时间
      */
-    private String registerUa;
+    private LocalDateTime time;
 
     /**
-     * 注册时间
+     * 渠道id
      */
-    private LocalDateTime registerTime;
+    private Long tunnelId;
 
     /**
      * 最后登录时间
      */
-    private LocalDateTime lastLoginTime;
+    private LocalDateTime updateTime;
 
     /**
      * 支付金额(单位:分)
      */
-    private Long payAmount;
+    private Long allPrice;
 
     /**
-     * 手机号
+     * 游戏付费金额(单位:分)
      */
-    private Long phoneNumber;
+    private Long gamePrice;
 
     /**
-     * 游戏名称
+     * 手机号
      */
-    private String gameName;
+    private String mobile;
 
     /**
-     * 游戏角色
+     * 真实姓名
      */
-    private String gameRole;
+    private String trueName;
 
     /**
-     * 游戏等级
+     * 身份证号
      */
-    private String gameLevel;
+    private String code;
 
     /**
-     * 游戏付费金额(单位:分)
+     * 游戏名称
      */
-    private Long gamePayAmount;
+    private String gameName;
 
     /**
-     * 实名信息
+     * 角色名称
      */
-    private String realNameAuth;
+    private String roleName;
 
     /**
-     * 公众号appId
+     * 角色区服
      */
-    private String mpAppId;
+    private String roleArea;
 
     /**
-     * 公众号名称
+     * 注册IP
      */
-    private String mpAppName;
+    private String ip;
 
     /**
-     * 渠道id
+     * 公众号id
      */
-    private String channelId;
+    private String appId;
 
     /**
-     * 趣程标识
+     * 公众号名称
      */
-    private String quChengSign;
+    private String appName;
 
     /**
-     * 更新时间
+     * 注册UA
      */
-    private LocalDateTime updateTime;
+    private String userAgent;
 }

+ 18 - 2
game-platform/game-platform-serve/src/main/java/com/zanxiang/game/platform/serve/service/impl/PlatformDeYangOrderServiceImpl.java

@@ -5,8 +5,9 @@ import com.zanxiang.game.platform.serve.dao.mapper.PlatformDeYangOrderMapper;
 import com.zanxiang.game.platform.serve.pojo.dto.PlatformDeYangOrderDTO;
 import com.zanxiang.game.platform.serve.pojo.entity.PlatformDeYangOrder;
 import com.zanxiang.game.platform.serve.service.IPlatformDeYangOrderService;
-import com.zanxiang.module.util.bean.BeanUtil;
+import com.zanxiang.module.util.DateUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.logging.log4j.util.Strings;
 import org.springframework.stereotype.Service;
 
 /**
@@ -20,6 +21,21 @@ public class PlatformDeYangOrderServiceImpl extends ServiceImpl<PlatformDeYangOr
 
     @Override
     public Boolean addOrUpdate(PlatformDeYangOrderDTO orderDTO) {
-        return super.saveOrUpdate(BeanUtil.copy(orderDTO, PlatformDeYangOrder.class));
+        return super.saveOrUpdate(PlatformDeYangOrder.builder()
+                .orderId(orderDTO.getOrderid())
+                .uid(orderDTO.getUid())
+                .mpOpenId(orderDTO.getWecha_id())
+                .gameName(orderDTO.getGame_name())
+                .payStatus(orderDTO.getPay_status())
+                .price(orderDTO.getPrice())
+                .addTime(orderDTO.getAddtime() == null ? null : DateUtil.secondToLocalDateTime(orderDTO.getAddtime()))
+                .payType(orderDTO.getPay_type())
+                .payTime(Strings.isBlank(orderDTO.getPay_time()) ? null : DateUtil.parseLocalDateTime(orderDTO.getPay_time()))
+                .roleName(orderDTO.getRole_name())
+                .roleArea(orderDTO.getRole_area())
+                .tunnelId(orderDTO.getTunnel_id())
+                .productName(orderDTO.getProduct_name())
+                .touFangBack(orderDTO.getToufang_back())
+                .build());
     }
 }

+ 22 - 2
game-platform/game-platform-serve/src/main/java/com/zanxiang/game/platform/serve/service/impl/PlatformDeYangUserServiceImpl.java

@@ -5,8 +5,9 @@ import com.zanxiang.game.platform.serve.dao.mapper.PlatformDeYangUserMapper;
 import com.zanxiang.game.platform.serve.pojo.dto.PlatformDeYangUserDTO;
 import com.zanxiang.game.platform.serve.pojo.entity.PlatformDeYangUser;
 import com.zanxiang.game.platform.serve.service.IPlatformDeYangUserService;
-import com.zanxiang.module.util.bean.BeanUtil;
+import com.zanxiang.module.util.DateUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.logging.log4j.util.Strings;
 import org.springframework.stereotype.Service;
 
 /**
@@ -20,6 +21,25 @@ public class PlatformDeYangUserServiceImpl extends ServiceImpl<PlatformDeYangUse
 
     @Override
     public Boolean addOrUpdate(PlatformDeYangUserDTO userDTO) {
-        return super.saveOrUpdate(BeanUtil.copy(userDTO, PlatformDeYangUser.class));
+        return super.saveOrUpdate(PlatformDeYangUser.builder()
+                .uid(userDTO.getUid())
+                .mpOpenId(userDTO.getWecha_id())
+                .qcSign(userDTO.getN_wecha_id())
+                .time(Strings.isBlank(userDTO.getTime()) ? null : DateUtil.parseLocalDateTime(userDTO.getTime()))
+                .tunnelId(userDTO.getTunnel_id())
+                .updateTime(Strings.isBlank(userDTO.getUpdate_time()) ? null : DateUtil.parseLocalDateTime(userDTO.getUpdate_time()))
+                .allPrice(userDTO.getAll_price())
+                .gamePrice(userDTO.getGame_price())
+                .mobile(userDTO.getMobile())
+                .trueName(userDTO.getTrue_name())
+                .code(userDTO.getCode())
+                .gameName(userDTO.getGame_name())
+                .roleName(userDTO.getRole_name())
+                .roleArea(userDTO.getRole_area())
+                .ip(userDTO.getIp())
+                .appId(userDTO.getAppid())
+                .appName(userDTO.getAppname())
+                .userAgent(userDTO.getUser_agent())
+                .build());
     }
 }