rk
14 小时以前 2acc40db4dd14c3d27ea1645f2b5833969e5c1cb
server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java
@@ -236,11 +236,9 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void applyShop(ShopApplyDTO request, Member member) {
        Integer memberId = member.getId();
    public void applyShop(ShopApplyDTO request) {
        Member member = memberMapper.selectById(request.getMemberId());
        // 1. 校验门店手机号唯一性(shop_info.telephone)
        checkTelephoneUnique(request.getTelephone(), null);
        // 2. 根据类型校验附件
        if (Constants.equalsInteger(request.getCompanyType(), Constants.ZERO)) {
@@ -275,7 +273,7 @@
        // 3. 查询该会员是否已有门店记录
        QueryWrapper<ShopInfo> existQw = new QueryWrapper<>();
        existQw.lambda()
                .eq(ShopInfo::getRegionMemberId, memberId)
                .eq(ShopInfo::getRegionMemberId, member.getId())
                .eq(ShopInfo::getDeleted, Constants.ZERO)
                .last("limit 1");
        ShopInfo existing = shopInfoMapper.selectOne(existQw);
@@ -315,15 +313,17 @@
            existing.setPassword(encryptedPassword);
            existing.setSalt(salt);
            existing.setAliAccount(request.getAliAccount());
            existing.setAuditStatus(Constants.ZERO);
            existing.setAliName(request.getAliName());
            existing.setUpdateTime(now);
            existing.setUpdateUser(memberId);
            existing.setAuditRemark(null);
            existing.setAuditTime(null);
            existing.setAuditUserId(null);
            existing.setAuditStatus(Constants.ZERO);
            shopInfoMapper.updateById(existing);
            shopId = existing.getId();
        } else {
            // 1. 校验门店手机号唯一性(shop_info.telephone)
            checkTelephoneUnique(request.getTelephone(), null);
            // 新建
            ShopInfo shopInfo = new ShopInfo();
            shopInfo.setCompanyType(request.getCompanyType());
@@ -345,14 +345,12 @@
            shopInfo.setPassword(encryptedPassword);
            shopInfo.setSalt(salt);
            shopInfo.setAliAccount(request.getAliAccount());
            shopInfo.setOpenid(member.getOpenid());
            shopInfo.setAuditStatus(Constants.ZERO);
            shopInfo.setAliName(request.getAliName());
            shopInfo.setStatus(Constants.ZERO);
            shopInfo.setDeleted(Constants.ZERO);
            shopInfo.setCreateTime(now);
            shopInfo.setUpdateTime(now);
            shopInfo.setCreateUser(memberId);
            shopInfo.setRegionMemberId(memberId);
            shopInfo.setRegionMemberId(member.getId());
            shopInfoMapper.insert(shopInfo);
            shopId = shopInfo.getId();
        }
@@ -554,6 +552,8 @@
        shopInfo.setLegalPersonName(request.getLegalPersonName());
        shopInfo.setLegalPersonPhone(request.getLegalPersonPhone());
        shopInfo.setLegalPersonCard(request.getLegalPersonCard());
        shopInfo.setAliAccount(request.getAliAccount());
        shopInfo.setAliName(request.getAliName());
        shopInfo.setUpdateTime(now);
        shopInfoMapper.updateById(shopInfo);
@@ -657,12 +657,15 @@
        vo.setPayStatus(shopInfo.getPayStatus());
        vo.setScore(shopInfo.getScore());
        vo.setCreateTime(shopInfo.getCreateTime());
        vo.setAliAccount(shopInfo.getAliAccount());
        vo.setAliName(shopInfo.getAliName());
        vo.setDepositAmount(shopInfo.getDepositAmount());
        // 拼接图片前缀
        String imgPrefix = "";
        try {
            imgPrefix = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode()
                    + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.SHOP_FILES).getCode();
                    + systemDictDataBiz.queryByCode(Constants.OSS, Constants.SHOP_FILES).getCode();
        } catch (Exception e) {
            // 未配置时忽略
        }
@@ -720,7 +723,7 @@
                String memberPrefix = "";
                try {
                    memberPrefix = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode()
                            + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.MEMBER_FILES).getCode();
                            + systemDictDataBiz.queryByCode(Constants.OSS, Constants.MEMBER_FILES).getCode();
                } catch (Exception e) {
                    // 未配置时忽略
                }
@@ -761,6 +764,12 @@
            qw.lambda().like(ShopInfo::getName, dto.getName());
        }
        // 城市筛选(areaId是区县,需匹配其parentId等于城市ID)
        if (dto.getCityId() != null) {
            qw.inSql("AREA_ID",
                    "SELECT id FROM areas WHERE parent_id = " + dto.getCityId() + " AND isdeleted = 0");
        }
        // 距离筛选(单位:米 → 转换为km比较)
        if (distanceMeter != null && distanceMeter > 0) {
            double maxKm = distanceMeter / 1000.0;
@@ -793,6 +802,8 @@
            vo.setShopHours(shop.getShopHours());
            vo.setAddress(shop.getAddress());
            vo.setScore(shop.getScore());
            vo.setLatitude(shop.getLatitude());
            vo.setLongitude(shop.getLongitude());
            // 门头照第一张
            vo.setCoverImg(getFirstImage(shop.getId(), Constants.FileType.STORE_FRONT.getKey(), imgPrefix));
            // 距离
@@ -823,6 +834,10 @@
        vo.setName(shop.getName());
        vo.setAddress(shop.getAddress());
        vo.setContent(shop.getContent());
        vo.setDepositTypes(shop.getDepositTypes());
        vo.setFeeStandard(shop.getFeeStandard());
        vo.setLatitude(shop.getLatitude());
        vo.setLongitude(shop.getLongitude());
        // 门头照 + 内部照 全路径集合
        String imgPrefix = getShopPrefix();
@@ -911,7 +926,7 @@
    private String getShopPrefix() {
        try {
            return systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode()
                    + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.SHOP_FILES).getCode();
                    + systemDictDataBiz.queryByCode(Constants.OSS, Constants.SHOP_FILES).getCode();
        } catch (Exception e) {
            return "";
        }
@@ -965,7 +980,7 @@
        vo.setCoverImg(shop.getCoverImg());
        if (StringUtils.isNotBlank(shop.getCoverImg())) {
            String path = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode()
                    + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.SHOP_FILES).getCode();
                    + systemDictDataBiz.queryByCode(Constants.OSS, Constants.SHOP_FILES).getCode();
            vo.setFullCoverImg(path + shop.getCoverImg());
        }
        vo.setHasMessage(false);
@@ -1055,7 +1070,6 @@
        if (shop == null) {
            return null;
        }
        // 创建token(generateTokenForRedis 已自动清除该用户旧token,保证唯一有效)
        String token = JwtTokenUtil.generateTokenForRedis(shop.getId(), Constants.TWO, JSONObject.toJSONString(shop), redisTemplate);