Pu Zhibing
2025-01-04 c542c56572ea8936301a6bdc736e23b846c8c006
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
@@ -9,14 +9,20 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.GeodesyUtil;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.domain.ShopScore;
import com.ruoyi.other.mapper.ShopMapper;
import com.ruoyi.other.service.ShopScoreService;
import com.ruoyi.other.service.ShopService;
import com.ruoyi.other.vo.NearbyShopVO;
import com.ruoyi.other.vo.SaveWithdrawalAccount;
import com.ruoyi.other.vo.ShopDetailVO;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -46,6 +52,8 @@
    private AppUserClient appUserClient;
    @Resource
    private TokenService tokenService;
    @Resource
    private SysUserClient sysUserClient;
    @Override
@@ -58,11 +66,17 @@
    @Override
    public List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude) {
        Long userid = tokenService.getLoginUserApplet().getUserid();
        AppUser appUser = appUserClient.getAppUserById(userid);
        String token = SecurityUtils.getToken(ServletUtils.getRequest());
        AppUser appUser = null;
        if(StringUtils.isNotEmpty(token)){
            Long userid = tokenService.getLoginUserApplet().getUserid();
            appUser = appUserClient.getAppUserById(userid);
        }
        List<NearbyShopVO> nearbyShopVOS = shopMapper.selectNearbyShopList(longitude, longitude);
        if(null != appUser.getShopId()){
            NearbyShopVO nearbyShopVO = nearbyShopVOS.stream().filter(s -> s.getId().equals(appUser.getShopId().longValue())).findFirst().get();
        if(null != appUser && null != appUser.getShopId()){
            AppUser finalAppUser = appUser;
            NearbyShopVO nearbyShopVO = nearbyShopVOS.stream().filter(s -> s.getId().equals(finalAppUser.getShopId().longValue())).findFirst().get();
            if(null != nearbyShopVO){
                nearbyShopVOS.remove(nearbyShopVO);
            }
@@ -128,4 +142,23 @@
        }
        return r.getData() != null;
    }
    /**
     * 保存提现账户
     * @param saveWithdrawalAccount
     */
    @Override
    public void saveWithdrawalAccount(SaveWithdrawalAccount saveWithdrawalAccount) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        Shop shop = this.getById(sysUser.getObjectId());
        if(null != shop){
            shop.setReceiverAccountNoEnc(saveWithdrawalAccount.getReceiverAccountNoEnc());
            shop.setReceiverNameEnc(saveWithdrawalAccount.getReceiverNameEnc());
            shop.setReceiverAccountType(saveWithdrawalAccount.getReceiverAccountType());
            shop.setReceiverBankChannelNo(saveWithdrawalAccount.getReceiverBankChannelNo());
            this.updateById(shop);
        }
    }
}