Просмотр исходного кода

充值提现操作日志增加提现流水号

lc 6 дней назад
Родитель
Сommit
f034493915

+ 13 - 9
cif-service/src/main/java/com/txz/cif/model/BizLog.java

@@ -19,50 +19,54 @@ public class BizLog {
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     @ApiModelProperty(value = "id")
     private Long id;
-    
+
     /**
      * 订单号
      */
     @Column(name = "biz_no")
     @ApiModelProperty(value = "bizNo订单号")
     private String bizNo;
+
+    @Column(name = "third_order_No")
+    @ApiModelProperty(value = "提现流水号")
+    private String thirdOrderNo;
     @ApiModelProperty(value = "备注")
     private String memo;
     @Column(name = "biz_type")
     @ApiModelProperty(value = "类型1充值 2提现")
     private Integer bizType;
-    
+
     /**
      * type类型1提交充值订单 2充值调用第三方 3充值回调通知成功 4提交提现申请 5提现审核通过 6提现审核失败 7提现调用第三方 8提现回调通知成功
      */
     @ApiModelProperty(value = "type类型1提交充值订单 2充值调用第三方 3充值回调通知成功 4提交提现申请 5提现审核通过 6提现审核失败 7提现调用第三方 8提现回调通知成功 9提现回调通知失败")
     private Integer type;
-    
+
     /**
      * 三方接口请求消息
      */
     @Column(name = "send_message")
     private String sendMessage;
-    
+
     /**
      * 三方接口接收消息
      */
     @Column(name = "receive_message")
     private String receiveMessage;
-    
+
     /**
      * 创建人
      */
     @Column(name = "create_user")
     @ApiModelProperty(value = "createUser创建人")
     private String createUser;
-    
+
     /**
      * 创建时间
      */
     @Column(name = "create_time")
     @ApiModelProperty(value = "createTime创建时间")
     private Date createTime;
-    
-    
-}
+
+
+}

+ 16 - 15
cif-service/src/main/java/com/txz/cif/service/impl/WithdrawRecordServiceImpl.java

@@ -43,33 +43,33 @@ import java.util.HashMap;
 @Slf4j
 @Transactional
 public class WithdrawRecordServiceImpl extends AbstractService<WithdrawRecord> implements WithdrawRecordService {
-    
+
     @Resource
     private WithdrawRecordMapper withdrawRecordMapper;
     @Resource
     private AccountService accountService;
-    
+
     @Resource
     private FlowService flowService;
-    
+
     @Resource
     private PaymentChannelService paymentChannelService;
-    
+
     @Resource
     private SequenceService sequenceService;
-    
+
     @Resource
     private UserService userService;
-    
+
     @Resource
     private TFPayService tfPayService;
-    
+
     @Resource
     private BizLogService bizLogService;
-    
+
     @Resource
     private LockTemplate lockTemplate;
-    
+
     @Override
     public void add(WithdrawRecord withdrawRecord) {
         saveUseGeneratedKeys(withdrawRecord);
@@ -87,7 +87,7 @@ public class WithdrawRecordServiceImpl extends AbstractService<WithdrawRecord> i
                 .build());
         update(WithdrawRecord.builder().id(withdrawRecord.getId()).freezeId(Long.valueOf(freeze.getData().toString())).build());
     }
-    
+
     @Override
     public void review(WithdrawRecord w, Integer status, String review, Long channelId, String userName) {
         // 同意提现
@@ -100,7 +100,7 @@ public class WithdrawRecordServiceImpl extends AbstractService<WithdrawRecord> i
                 User user = userService.findById(w.getUserId());
                 DateTime now = DateUtil.date();
                 String thirdOrderNo = sequenceService.genSerialNumber("withdraw_rule", null);
-                
+
                 PaymentChannel paymentChannel = paymentChannelService.findById(channelId);
                 if (ObjectUtil.isEmpty(paymentChannel)) {
                     throw new ServiceException(LocalUtil.get("withdrawal.channel.does.not.exist"));
@@ -129,7 +129,8 @@ public class WithdrawRecordServiceImpl extends AbstractService<WithdrawRecord> i
                             // 新增日志
                             bizLogService.save(BizLog.builder()
                                     .bizType(2)
-                                    .bizNo(thirdOrderNo)
+                                    .bizNo(w.getOrderNo())
+                                    .thirdOrderNo(thirdOrderNo)
                                     .type(4)
                                     .receiveMessage(bizLog.getReceiveMessage())
                                     .sendMessage(bizLog.getSendMessage())
@@ -198,7 +199,7 @@ public class WithdrawRecordServiceImpl extends AbstractService<WithdrawRecord> i
                 .build());
         update(WithdrawRecord.builder().id(record.getId()).successTime(successTime).status(4).build());
     }
-    
+
     @Override
     public void fail(WithdrawRecord record) {
         if (record.getFreezeId() != null) {
@@ -206,12 +207,12 @@ public class WithdrawRecordServiceImpl extends AbstractService<WithdrawRecord> i
         }
         update(WithdrawRecord.builder().id(record.getId()).status(5).build());
     }
-    
+
     @Override
     public Integer countByUserId(HashMap map) {
         return withdrawRecordMapper.countByUserId(map);
     }
-    
+
     @Override
     public BigDecimal sumByStatus(HashMap map) {
         return withdrawRecordMapper.sumByStatus(map);

+ 29 - 28
cif-service/src/main/java/com/txz/cif/web/WithdrawRecordApiController.java

@@ -53,40 +53,40 @@ import static com.txz.cif.core.AbstractApiController.X_CLIENT_TOKEN;
 @RestController
 @RequestMapping("/api/withdraw/record")
 public class WithdrawRecordApiController {
-    
+
     private static Logger log = LoggerFactory.getLogger(WithdrawRecordApiController.class);
-    
+
     @Resource
     private WithdrawRecordService withdrawRecordService;
-    
+
     @Resource
     private SequenceService sequenceService;
-    
+
     @Resource
     private AuthService authService;
-    
+
     @Resource
     private AccountService accountService;
-    
+
     @Resource
     private BizLogService bizLogService;
-    
+
     @Resource
     private PaymentChannelService paymentChannelService;
-    
+
     @Resource
     private UserService userService;
-    
+
     @Resource
     private LockTemplate lockTemplate;
-    
+
     @Resource
     private OperatingConfigDubboServiceClient operatingConfigDubboServiceClient;
-    
-    
+
+
     @Resource
     private NoticeDubboServiceClient noticeDubboServiceClient;
-    
+
     @PostMapping("/add")
     @ApiOperation(value = "新增提现订单", httpMethod = "POST")
     public Result add(@RequestBody WithdrawParam param, @RequestHeader(value = X_CLIENT_TOKEN, required = false) String token) {
@@ -95,7 +95,7 @@ public class WithdrawRecordApiController {
         }
         try {
             Triple<Boolean, String, Claims> result = authService.verifyToken(token);
-            
+
             if (!result.getLeft()) {
                 // token无效
                 String errorMsg = result.getMiddle();
@@ -104,7 +104,7 @@ public class WithdrawRecordApiController {
             }
             Claims claims = result.getRight();
             Long userId = Long.valueOf(claims.get("userId").toString());
-            
+
             User user = userService.findById(userId);
             if (user == null) {
                 return ResultGenerator.genFailResult(ResultCode.USER_IS_NULL);
@@ -149,7 +149,7 @@ public class WithdrawRecordApiController {
             com.txz.operating.result.Result<ConfigDTO> openRedEnvelopeRate = operatingConfigDubboServiceClient.getConfigByCode(key);
             String rate = openRedEnvelopeRate.getData().getValueInfo();
             BigDecimal fee = param.getAmount().multiply(new BigDecimal(rate)).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN);
-            
+
             Account account = accountService.getAccount(userId, param.getAccountType());
             if (account == null) {
                 return ResultGenerator.genFailResult(ResultCode.ACCOUNT_IS_NULL);
@@ -157,9 +157,9 @@ public class WithdrawRecordApiController {
             if (account.getEffectiveBalance().compareTo(param.getAmount().add(fee)) < 0) {
                 return ResultGenerator.genFailResult(ResultCode.EFFECTIVE_BALANCE_IS_INSUFFICIENT);
             }
-            
+
             String orderNo = sequenceService.genSerialNumber("withdraw_rule", null);
-            
+
             WithdrawRecord withdrawRecord = new WithdrawRecord();
             withdrawRecord.setOrderNo(orderNo);
             withdrawRecord.setStatus(1);
@@ -182,10 +182,10 @@ public class WithdrawRecordApiController {
             log.error("新增对象操作异常e:{}", e);
             return ResultGenerator.genFailResult(ResultCode.INTERNAL_SERVER_ERROR);
         }
-        
+
     }
-    
-    
+
+
     @PostMapping("/list")
     @ApiOperation(value = "withdrawRecord获取列表", httpMethod = "POST")
     public Result<List<WithdrawRecord>> list(@RequestBody RecordParam param, HttpServletRequest request) {
@@ -194,7 +194,7 @@ public class WithdrawRecordApiController {
             ResultGenerator.genFailResult(ResultCode.OAUTH_INVALID_ACCESS_TOKEN);
         }
         PageHelper.startPage(param.getPage(), param.getSize());
-        
+
         Condition condition = new Condition(WithdrawRecord.class);
         Criteria criteria = condition.createCriteria();
         criteria.andEqualTo("userId", userId);
@@ -238,7 +238,7 @@ public class WithdrawRecordApiController {
         }
         return ResultGenerator.genSuccessResult(pageInfo);
     }
-    
+
     /**
      * tfpay提现通知
      */
@@ -265,7 +265,7 @@ public class WithdrawRecordApiController {
                 log.error("签名校验失败");
                 return "FAIL";
             }
-            
+
             Condition condition = new Condition(WithdrawRecord.class);
             Example.Criteria criteria = condition.createCriteria();
             criteria.andEqualTo("thirdOrderNo", dto.getOrderid());
@@ -275,7 +275,7 @@ public class WithdrawRecordApiController {
                 log.error("提现订单不存在");
                 return "FAIL";
             }
-            
+
             // //TODO 回调成功
             // JSONObject json = JSONUtil.parseObj(data);
             // String orderNo = json.getStr("orderNo");
@@ -318,7 +318,8 @@ public class WithdrawRecordApiController {
                 // 新增充值回调日志
                 bizLogService.save(BizLog.builder()
                         .bizType(2)
-                        .bizNo(dto.getOrderid())
+                        .bizNo(record.getOrderNo())
+                        .thirdOrderNo(dto.getOrderid())
                         .type(type)
                         .receiveMessage(dto.toString())
                         .createTime(DateUtil.date())
@@ -327,7 +328,7 @@ public class WithdrawRecordApiController {
             } catch (Exception e) {
                 log.error("新增充值回调日志失败", e);
                 // }
-                
+
             }
             try {
                 noticeDubboServiceClient.addMoneyNotice(ne, record.getUserId());
@@ -339,5 +340,5 @@ public class WithdrawRecordApiController {
             lockTemplate.releaseLock(lockInfo);
         }
     }
-    
+
 }