瀏覽代碼

更新!

TRX 1 年之前
父節點
當前提交
21f626b3f6

+ 2 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/org/UserCountUpdateParam.java

@@ -23,4 +23,6 @@ public class UserCountUpdateParam {
 
     @Schema(description = "证件号码")
     private String cardNumber;
+
+    private String profilePic;
 }

+ 1 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/oss/NetDiskOssBusService.java

@@ -83,8 +83,8 @@ public class NetDiskOssBusService extends SuperService {
     private String applicationName;
 
     /**
-     * @param file
      * @return
+     * @param file
      */
     public ResultContent<String> uploadMinioFile(MultipartFile file, OidParam param) throws IOException {
         @Cleanup var inputStream = file.getInputStream();

+ 0 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/payment/ExpenseFlowServiceImpl.java

@@ -159,7 +159,6 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
      * @param entity
      * @return
      */
-    @Transactional
     public ResultContent<ExpenseFlow> orderPay(ExpenseFlow entity) {
         // 判断参数是否符合要求
         if (entity.getVerifyParamIsSuccess() == null || !entity.getVerifyParamIsSuccess()) {

+ 34 - 5
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/payment/PayCallService.java

@@ -119,11 +119,11 @@ public class PayCallService extends SuperService {
                 unionFrictionlessPay(entity);
             }
 
-            boolean isPaying = isPaying(entity.getPaymentNo(), paymentType);
+            boolean isPaying = orderIsPaying(entity.getPaymentNo(), paymentType);
             if (isPaying) {
                 AtomicInteger atomicInteger = new AtomicInteger(0);
                 while (atomicInteger.get() <= maxTime) {
-                    isPaying = isPaying(entity.getPaymentNo(), paymentType);
+                    isPaying = orderIsPaying(entity.getPaymentNo(), paymentType);
                     if (!isPaying) {
                         break;
                     }
@@ -135,6 +135,7 @@ public class PayCallService extends SuperService {
                     atomicInteger.addAndGet(300);
                 }
             }
+
             if (entity.getIsPaySuccess() != null && entity.getIsPaySuccess()) {
                 b = true;
                 break;
@@ -195,6 +196,7 @@ public class PayCallService extends SuperService {
             paymentProcess.setTimeStr(DateUtils.paresTime(System.currentTimeMillis(), DateUtils.FORMAT_LONG));
             paymentProcessDao.save(paymentProcess);
 
+            // 记录订单的现在支付类型
             orderNoInfoService.saveInfo(entity.getPaymentNo(), OrderNoType.Pay, entity.getPaymentType());
         } else {
             String msg = resultContent.getMsg();
@@ -251,6 +253,8 @@ public class PayCallService extends SuperService {
      * @return
      */
     public ResultContent unionFrictionlessPay(ExpenseFlow entity) {
+        orderNoInfoService.saveInfo(entity.getPaymentNo(), OrderNoType.Pay, entity.getPaymentType());
+
         String desc = "消费";
         OperationLogsAddParam logsAddParam = initLog(entity.getUserId());
         logsAddParam.setTitle(desc);
@@ -278,7 +282,6 @@ public class PayCallService extends SuperService {
             logsAddParam.setMessageType(MessageType.Info);
             logsAddParam.setLevel(LogsLevel.Low);
             logsAddParam.setContent(msg);
-            orderNoInfoService.saveInfo(entity.getPaymentNo(), OrderNoType.Pay, entity.getPaymentType());
         } else {
             String msg = resultContent.getMsg();
             if (StringUtils.isNotEmpty(msg) && msg.contains("Connection reset")) {
@@ -315,6 +318,7 @@ public class PayCallService extends SuperService {
         entity.setPayMillis(entity.getPayEndTime() - entity.getPayStartTime());
         expenseFlowDao.save(entity);
 
+        // 支付产品日志
         paymentProcess.setPayEndTime(System.currentTimeMillis());
         paymentProcess.setPayMillis(paymentProcess.getPayEndTime() - paymentProcess.getPayStartTime());
         paymentProcess.setTimeStr(DateUtils.paresTime(System.currentTimeMillis(), DateUtils.FORMAT_LONG));
@@ -328,13 +332,38 @@ public class PayCallService extends SuperService {
      * @param paymentNo
      * @return
      */
-    public ResultContent unionFrictionlessPayFinish(String paymentNo, com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> resultContent, String state) {
+    public ResultContent unionFrictionlessPayFinish(String paymentNo,
+            com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> resultContent, String state) {
         if (StringUtils.isEmpty(paymentNo)) {
             return ResultContent.buildFail("paymentNo为空");
         }
+        log.info("云闪付支付回调: {}", paymentNo);
         ExpenseFlow entity = expenseFlowDao.findTopByPaymentNo(paymentNo);
+        PaymentProcess paymentProcess = paymentProcessDao.findTopByPaymentNoAndPaymentTypeOrderByCreateTimeDesc(paymentNo, PaymentType.UnionFrictionlessPay);
         if (ObjectUtils.isNotEmpty(entity)) {
+            if (state.equals("TRADE_SUCCESS")) {
+                entity.setOrderType(OrderState.HAVE_PAID);
+                entity.setIsPaySuccess(Boolean.TRUE);
+
+                paymentProcess.setIsPaySuccess(Boolean.TRUE);
+                paymentProcess.setPayRemark("支付成功");
+                paymentProcess.setIsPaying(Boolean.FALSE);
+                if (resultContent.getState() == ResultState.Success) {
+                    List<TransactionLogModel> list = resultContent.getContent();
+                    if (ObjectUtils.isNotEmpty(list)) {
+                        entity.setTransactionIds(list.stream().map(it -> it.getId()).collect(Collectors.toUnmodifiableList()));
+                    }
+                }
+            } else {
+                entity.setOrderType(OrderState.PAID_ERROR);
+                entity.setIsPaySuccess(Boolean.FALSE);
 
+                paymentProcess.setIsPaySuccess(Boolean.FALSE);
+                paymentProcess.setPayRemark("支付失败");
+                paymentProcess.setIsPaying(Boolean.FALSE);
+            }
+            expenseFlowDao.save(entity);
+            paymentProcessDao.save(paymentProcess);
         }
         return ResultContent.buildSuccess();
     }
@@ -346,7 +375,7 @@ public class PayCallService extends SuperService {
      * @param paymentType
      * @return
      */
-    public boolean isPaying(String paymentNo, PaymentType paymentType) {
+    public boolean orderIsPaying(String paymentNo, PaymentType paymentType) {
         PaymentProcess paymentProcess = paymentProcessDao.findTopByPaymentNoAndPaymentTypeOrderByCreateTimeDesc(paymentNo, paymentType);
         if (ObjectUtils.isNotEmpty(paymentProcess) && paymentProcess.getIsPaying() != null && paymentProcess.getIsPaying()) {
             return true;

+ 1 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/user/UserAccountServiceImpl.java

@@ -353,6 +353,7 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
         BeanUtils.copyProperties(param, account);
         account.setSpellCode(CommonUtil.getPinyin(account.getName()));
         userCountDao.save(account);
+
         String projectOid = getCurrentProjectOid();
         organizationUserService.changeUserBaseInfo(account.getUserId(), projectOid);
         return ResultContent.buildSuccess();