From 347737414ce8552486d16fc62ab29138a94304a8 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 19 三月 2024 12:34:43 +0800
Subject: [PATCH] 合并代码
---
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAuthenticationServiceImpl.java | 85 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 84 insertions(+), 1 deletions(-)
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAuthenticationServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAuthenticationServiceImpl.java
index f94da46..2552fdd 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAuthenticationServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAuthenticationServiceImpl.java
@@ -1,10 +1,23 @@
package com.ruoyi.shop.service.impl.shop;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsStatusResult;
+import com.google.common.base.Joiner;
import com.ruoyi.shop.domain.pojo.shop.ShopAuthentication;
+import com.ruoyi.shop.enums.WxApplyMentSignStateEnum;
+import com.ruoyi.shop.enums.WxApplyMentStateEnum;
+import com.ruoyi.shop.enums.dict.IDict;
import com.ruoyi.shop.mapper.shop.ShopAuthenticationMapper;
import com.ruoyi.shop.service.shop.ShopAuthenticationService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
/**
* <p>
@@ -17,4 +30,74 @@
@Service
public class ShopAuthenticationServiceImpl extends ServiceImpl<ShopAuthenticationMapper, ShopAuthentication> implements ShopAuthenticationService {
+ @Override
+ public List<ShopAuthentication> getShopAuthNeedUpdateStatus() {
+ List<Integer> auditStatusList = Arrays.asList(1, 2, 3, 5);
+ LambdaQueryWrapper<ShopAuthentication> queryWrapper = Wrappers.lambdaQuery();
+ queryWrapper.in(ShopAuthentication::getAuditStatus, auditStatusList);
+ queryWrapper.isNotNull(ShopAuthentication::getApplymentId);
+ return this.list(queryWrapper);
+ }
+
+ @Override
+ public void updateAuditStatusByApplymentId(String applymentId, ApplymentsStatusResult result) {
+ // WxApplyMentStateEnum
+ String applymentState = result.getApplymentState();
+ Integer auditStatus = IDict.getCodeByText(WxApplyMentStateEnum.class, applymentState);
+
+ Integer signState = IDict.getCodeByText(WxApplyMentSignStateEnum.class, result.getSignState());
+
+ LambdaUpdateWrapper<ShopAuthentication> updateWrapper = Wrappers.lambdaUpdate();
+ updateWrapper.eq(ShopAuthentication::getApplymentId, applymentId)
+ .set(ShopAuthentication::getAuditStatus, auditStatus)
+ .set(ShopAuthentication::getSignState, signState);
+
+ if(WxApplyMentStateEnum.ACCOUNT_NEED_VERIFY.getCode().equals(auditStatus)){
+ // ACCOUNT_NEED_VERIFY 待账户验证
+ updateWrapper.set(ShopAuthentication::getLegalValidationUrl, result.getLegalValidationUrl());
+ ApplymentsStatusResult.AccountValidation accountValidation = result.getAccountValidation();
+ if(null != accountValidation) {
+ updateWrapper.set(ShopAuthentication::getAvAccountName, accountValidation.getAccountName())
+ .set(ShopAuthentication::getAvAccountNo, accountValidation.getAccountNo())
+ .set(ShopAuthentication::getAvPayAmount, accountValidation.getPayAmount())
+ .set(ShopAuthentication::getDaNumber, accountValidation.getDestinationAccountNumber())
+ .set(ShopAuthentication::getDaName, accountValidation.getDestinationAccountName())
+ .set(ShopAuthentication::getDaBank, accountValidation.getDestinationAccountBank())
+ .set(ShopAuthentication::getDaCity, accountValidation.getCity())
+ .set(ShopAuthentication::getDaRemark, accountValidation.getRemark())
+ .set(ShopAuthentication::getDaDeadline, accountValidation.getDeadline());
+ }
+ } else if(WxApplyMentStateEnum.NEED_SIGN.getCode().equals(auditStatus)){
+ // NEED_SIGN 待签约
+ updateWrapper.set(ShopAuthentication::getSignUrl, result.getSignUrl());
+ updateWrapper.set(ShopAuthentication::getSubMchid, result.getSubMchid());
+
+ } else if(WxApplyMentStateEnum.FINISH.getCode().equals(auditStatus)){
+ // FINISH 完成
+ updateWrapper.set(ShopAuthentication::getSubMchid, result.getSubMchid());
+
+ } else if(WxApplyMentStateEnum.REJECTED.getCode().equals(auditStatus)
+ || WxApplyMentStateEnum.FROZEN.getCode().equals(auditStatus)){
+ List<ApplymentsStatusResult.AuditDetail> auditDetail = result.getAuditDetail();
+ if(null != auditDetail && !auditDetail.isEmpty()){
+ List<String> paramNameList = auditDetail.stream().map(ApplymentsStatusResult.AuditDetail::getParamName).collect(Collectors.toList());
+ List<String> rejectReason = auditDetail.stream().map(ApplymentsStatusResult.AuditDetail::getRejectReason).collect(Collectors.toList());
+ updateWrapper.set(ShopAuthentication::getAdParamName, Joiner.on(";").join(paramNameList))
+ .set(ShopAuthentication::getAdRejectReason, Joiner.on(";").join(rejectReason));
+ }
+
+ }
+ if("UNSIGNED".equals(result.getSignState())&&StringUtils.isNotBlank(result.getSignUrl())){
+ updateWrapper.set(ShopAuthentication::getSignUrl, result.getSignUrl());
+ }
+ this.update(updateWrapper);
+ }
+
+ @Override
+ public ShopAuthentication getByShopId(Long shopId) {
+ LambdaQueryWrapper<ShopAuthentication> queryWrapper = Wrappers.lambdaQuery();
+ queryWrapper.eq(ShopAuthentication::getShopId, shopId)
+ .last(" limit 1 ");
+ return this.getOne(queryWrapper);
+ }
}
--
Gitblit v1.7.1