From 431dde90aa20f7652092fc0bfa9e6a1a28b06b9f Mon Sep 17 00:00:00 2001 From: jiangqs <343695869@qq.com> Date: 星期日, 06 八月 2023 12:41:23 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/HongRuiTang --- ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopAuthenticationServiceImpl.java | 81 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 81 insertions(+), 0 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..0061371 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.Wrappers; +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.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; /** * <p> @@ -17,4 +30,72 @@ @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)); + } + + } + 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