From 08675d26d73c60e1c593e901e09588acf2c39233 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期五, 10 四月 2026 20:03:47 +0800
Subject: [PATCH] 代码生成

---
 server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java |  488 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 483 insertions(+), 5 deletions(-)

diff --git a/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java
index a69fee6..97d1f7d 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/ShopInfoServiceImpl.java
@@ -10,15 +10,31 @@
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.utils.Utils;
+import com.doumee.biz.system.AreasBiz;
+import com.doumee.biz.system.SystemDictDataBiz;
+import com.doumee.dao.business.MemberMapper;
+import com.doumee.dao.business.MultifileMapper;
 import com.doumee.dao.business.ShopInfoMapper;
+import com.doumee.dao.business.model.Areas;
+import com.doumee.dao.business.model.Member;
+import com.doumee.dao.business.model.Multifile;
 import com.doumee.dao.business.model.ShopInfo;
+import com.doumee.dao.dto.AuditDTO;
+import com.doumee.dao.dto.ChangeStatusDTO;
+import com.doumee.dao.dto.ResetPasswordDTO;
+import com.doumee.dao.dto.ShopApplyDTO;
+import com.doumee.dao.dto.ShopUpdateDTO;
+import com.doumee.dao.vo.ShopDetailVO;
 import com.doumee.service.business.ShopInfoService;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.RandomStringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
+import org.springframework.transaction.annotation.Transactional;
 
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 闂ㄥ簵淇℃伅Service瀹炵幇
@@ -30,6 +46,18 @@
 
     @Autowired
     private ShopInfoMapper shopInfoMapper;
+
+    @Autowired
+    private MemberMapper memberMapper;
+
+    @Autowired
+    private MultifileMapper multifileMapper;
+
+    @Autowired
+    private SystemDictDataBiz systemDictDataBiz;
+
+    @Autowired
+    private AreasBiz areasBiz;
 
     @Override
     public Integer create(ShopInfo shopInfo) {
@@ -50,7 +78,7 @@
 
     @Override
     public void deleteByIdInBatch(List<Integer> ids) {
-        if (CollectionUtils.isEmpty(ids)) {
+        if (ids == null || ids.isEmpty()) {
             return;
         }
         shopInfoMapper.deleteBatchIds(ids);
@@ -63,7 +91,7 @@
 
     @Override
     public void updateByIdInBatch(List<ShopInfo> shopInfos) {
-        if (CollectionUtils.isEmpty(shopInfos)) {
+        if (shopInfos == null || shopInfos.isEmpty()) {
             return;
         }
         for (ShopInfo shopInfo : shopInfos) {
@@ -111,6 +139,12 @@
             queryWrapper.lambda().ge(ShopInfo::getCreateTime, Utils.Date.getStart(pageWrap.getModel().getCreateTime()));
             queryWrapper.lambda().le(ShopInfo::getCreateTime, Utils.Date.getEnd(pageWrap.getModel().getCreateTime()));
         }
+        if (pageWrap.getModel().getCreateStartTime() != null) {
+            queryWrapper.lambda().ge(ShopInfo::getCreateTime, Utils.Date.getStart(pageWrap.getModel().getCreateStartTime()));
+        }
+        if (pageWrap.getModel().getCreateEndTime() != null) {
+            queryWrapper.lambda().le(ShopInfo::getCreateTime, Utils.Date.getEnd(pageWrap.getModel().getCreateEndTime()));
+        }
         if (pageWrap.getModel().getUpdateUser() != null) {
             queryWrapper.lambda().eq(ShopInfo::getUpdateUser, pageWrap.getModel().getUpdateUser());
         }
@@ -139,6 +173,9 @@
         if (pageWrap.getModel().getAreaId() != null) {
             queryWrapper.lambda().eq(ShopInfo::getAreaId, pageWrap.getModel().getAreaId());
         }
+        if (pageWrap.getModel().getAuditStatus() != null) {
+            queryWrapper.lambda().eq(ShopInfo::getAuditStatus, pageWrap.getModel().getAuditStatus());
+        }
         if (pageWrap.getModel().getStatus() != null) {
             queryWrapper.lambda().eq(ShopInfo::getStatus, pageWrap.getModel().getStatus());
         }
@@ -168,4 +205,445 @@
         return shopInfoMapper.selectCount(wrapper);
     }
 
+    // ========== 闂ㄥ簵鍏ラ┗涓氬姟 ==========
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void applyShop(ShopApplyDTO request, Member member) {
+        Integer memberId = member.getId();
+
+        // 1. 鏍¢獙闂ㄥ簵鎵嬫満鍙峰敮涓�鎬э紙shop_info.telephone锛�
+        checkTelephoneUnique(request.getTelephone(), null);
+
+        // 2. 鏍规嵁绫诲瀷鏍¢獙闄勪欢
+        if (Constants.equalsInteger(request.getCompanyType(), Constants.ZERO)) {
+            // 涓汉绫诲瀷锛氬繀椤讳笂浼犲姵鍔ㄥ悎鍚屽拰绀句繚璇佹槑
+            if (CollectionUtils.isEmpty(request.getLaborContractImgs())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "涓汉绫诲瀷蹇呴』涓婁紶鏈夋晥鍔冲姩鍚堝悓");
+            }
+            if (CollectionUtils.isEmpty(request.getSocialSecurityImgs())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "涓汉绫诲瀷蹇呴』涓婁紶绀句繚缂寸撼璇佹槑");
+            }
+        } else if (Constants.equalsInteger(request.getCompanyType(), Constants.ONE)) {
+            // 浼佷笟绫诲瀷锛氬繀椤诲~鍐欐硶浜轰俊鎭拰钀ヤ笟鎵х収
+            if (StringUtils.isBlank(request.getBusinessImg())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "浼佷笟绫诲瀷蹇呴』涓婁紶钀ヤ笟鎵х収");
+            }
+            if (StringUtils.isBlank(request.getLegalPersonName())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "浼佷笟绫诲瀷蹇呴』濉啓娉曚汉濮撳悕");
+            }
+            if (StringUtils.isBlank(request.getLegalPersonPhone())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "浼佷笟绫诲瀷蹇呴』濉啓娉曚汉鐢佃瘽");
+            }
+            if (StringUtils.isBlank(request.getLegalPersonCard())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "浼佷笟绫诲瀷蹇呴』濉啓娉曚汉韬唤璇佸彿鐮�");
+            }
+        }
+
+        Date now = new Date();
+        String rawPassword = generateDefaultPassword(request.getTelephone());
+        String salt = RandomStringUtils.randomAlphabetic(6);
+        String encryptedPassword = Utils.Secure.encryptPassword(rawPassword, salt);
+
+        // 3. 鏌ヨ璇ヤ細鍛樻槸鍚﹀凡鏈夐棬搴楄褰�
+        QueryWrapper<ShopInfo> existQw = new QueryWrapper<>();
+        existQw.lambda()
+                .eq(ShopInfo::getRegionMemberId, memberId)
+                .eq(ShopInfo::getDeleted, Constants.ZERO)
+                .last("limit 1");
+        ShopInfo existing = shopInfoMapper.selectOne(existQw);
+
+        Integer shopId;
+        if (existing != null) {
+            // 鏍¢獙鐘舵�侊細鍙湁寰呭鎵�(0)鍜岃椹冲洖(2)鍙慨鏀�
+            if (!Constants.equalsInteger(existing.getAuditStatus(), Constants.ZERO)
+                    && !Constants.equalsInteger(existing.getAuditStatus(), Constants.TWO)) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "褰撳墠闂ㄥ簵鐘舵�佷笉鍏佽淇敼");
+            }
+            // 鏍¢獙openid鍖归厤锛氬綋鍓嶇櫥褰曚細鍛樼殑openid蹇呴』涓庨棬搴楃殑openid涓�鑷�
+            if (existing.getOpenid() != null && !existing.getOpenid().equals(member.getOpenid())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鏃犳潈闄愭搷浣滃綋鍓嶉棬搴椾俊鎭�");
+            }
+            // 鏍¢獙鎵嬫満鍙峰敮涓�鎬э紙鎺掗櫎鑷韩锛�
+            if (!request.getTelephone().equals(existing.getTelephone())) {
+                checkTelephoneUnique(request.getTelephone(), existing.getId());
+            }
+            // 鏇存柊
+            existing.setCompanyType(request.getCompanyType());
+            existing.setName(request.getName());
+            existing.setTelephone(request.getTelephone());
+            existing.setLinkName(request.getLinkName());
+            existing.setLinkPhone(request.getLinkPhone());
+            existing.setIdcard(request.getIdcard());
+            existing.setAreaId(request.getAreaId());
+            existing.setLongitude(request.getLongitude());
+            existing.setLatitude(request.getLatitude());
+            existing.setAddress(request.getAddress());
+            existing.setIdcardImg(request.getIdcardImg());
+            existing.setIdcardImgBack(request.getIdcardImgBack());
+            existing.setBusinessImg(request.getBusinessImg());
+            existing.setLegalPersonName(request.getLegalPersonName());
+            existing.setLegalPersonPhone(request.getLegalPersonPhone());
+            existing.setLegalPersonCard(request.getLegalPersonCard());
+            existing.setPassword(encryptedPassword);
+            existing.setSalt(salt);
+            existing.setAuditStatus(Constants.ZERO);
+            existing.setUpdateTime(now);
+            existing.setUpdateUser(memberId);
+            existing.setAuditRemark(null);
+            existing.setAuditTime(null);
+            existing.setAuditUserId(null);
+            shopInfoMapper.updateById(existing);
+            shopId = existing.getId();
+        } else {
+            // 鏂板缓
+            ShopInfo shopInfo = new ShopInfo();
+            shopInfo.setCompanyType(request.getCompanyType());
+            shopInfo.setName(request.getName());
+            shopInfo.setTelephone(request.getTelephone());
+            shopInfo.setLinkName(request.getLinkName());
+            shopInfo.setLinkPhone(request.getLinkPhone());
+            shopInfo.setIdcard(request.getIdcard());
+            shopInfo.setAreaId(request.getAreaId());
+            shopInfo.setLongitude(request.getLongitude());
+            shopInfo.setLatitude(request.getLatitude());
+            shopInfo.setAddress(request.getAddress());
+            shopInfo.setIdcardImg(request.getIdcardImg());
+            shopInfo.setIdcardImgBack(request.getIdcardImgBack());
+            shopInfo.setBusinessImg(request.getBusinessImg());
+            shopInfo.setLegalPersonName(request.getLegalPersonName());
+            shopInfo.setLegalPersonPhone(request.getLegalPersonPhone());
+            shopInfo.setLegalPersonCard(request.getLegalPersonCard());
+            shopInfo.setPassword(encryptedPassword);
+            shopInfo.setSalt(salt);
+            shopInfo.setOpenid(member.getOpenid());
+            shopInfo.setAuditStatus(Constants.ZERO);
+            shopInfo.setStatus(Constants.ZERO);
+            shopInfo.setDeleted(Constants.ZERO);
+            shopInfo.setCreateTime(now);
+            shopInfo.setUpdateTime(now);
+            shopInfo.setCreateUser(memberId);
+            shopInfo.setRegionMemberId(memberId);
+            shopInfoMapper.insert(shopInfo);
+            shopId = shopInfo.getId();
+        }
+
+        // 4. 鍒犻櫎鏃ч檮浠惰褰�
+        multifileMapper.delete(new QueryWrapper<Multifile>().lambda()
+                .eq(Multifile::getObjId, shopId)
+                .in(Multifile::getObjType,
+                        Constants.FileType.STORE_FRONT.getKey(),
+                        Constants.FileType.STORE_INTERIOR.getKey(),
+                        Constants.FileType.OTHER_MATERIAL.getKey(),
+                        Constants.FileType.LABOR_CONTRACT.getKey(),
+                        Constants.FileType.SOCIAL_SECURITY.getKey()));
+
+        // 5. 淇濆瓨鏂伴檮浠惰褰�
+        saveMultifileList(shopId, Constants.FileType.STORE_FRONT.getKey(), request.getStoreFrontImgs(), now);
+        saveMultifileList(shopId, Constants.FileType.STORE_INTERIOR.getKey(), request.getStoreInteriorImgs(), now);
+        saveMultifileList(shopId, Constants.FileType.OTHER_MATERIAL.getKey(), request.getOtherMaterialImgs(), now);
+        saveMultifileList(shopId, Constants.FileType.LABOR_CONTRACT.getKey(), request.getLaborContractImgs(), now);
+        saveMultifileList(shopId, Constants.FileType.SOCIAL_SECURITY.getKey(), request.getSocialSecurityImgs(), now);
+    }
+
+    @Override
+    public ShopDetailVO getShopDetail(Integer shopId) {
+        ShopInfo shopInfo = shopInfoMapper.selectById(shopId);
+        if (shopInfo == null || Constants.equalsInteger(shopInfo.getDeleted(), Constants.ONE)) {
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        return buildShopDetailVO(shopInfo);
+    }
+
+    @Override
+    public ShopDetailVO getMyShop(Integer memberId) {
+        QueryWrapper<ShopInfo> qw = new QueryWrapper<>();
+        qw.lambda()
+                .eq(ShopInfo::getRegionMemberId, memberId)
+                .eq(ShopInfo::getDeleted, Constants.ZERO)
+                .last("limit 1");
+        ShopInfo shopInfo = shopInfoMapper.selectOne(qw);
+        if (shopInfo == null) {
+            return null;
+        }
+        return buildShopDetailVO(shopInfo);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void auditShop(AuditDTO auditDTO) {
+        if (auditDTO.getId() == null) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "涓婚敭涓嶈兘涓虹┖");
+        }
+        if (auditDTO.getAuditStatus() == null
+                || (auditDTO.getAuditStatus() != 0 && auditDTO.getAuditStatus() != 1)) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀹℃壒鐘舵�佸弬鏁伴敊璇�");
+        }
+        ShopInfo shopInfo = shopInfoMapper.selectById(auditDTO.getId());
+        if (shopInfo == null || Constants.equalsInteger(shopInfo.getDeleted(), Constants.ONE)) {
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if (!Constants.equalsInteger(shopInfo.getAuditStatus(), Constants.ZERO)) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "褰撳墠鐘舵�佷笉鍏佽瀹℃壒");
+        }
+
+        Date now = new Date();
+        // auditDTO.auditStatus: 0=閫氳繃 鈫� auditStatus=1, 1=椹冲洖 鈫� auditStatus=2
+        Integer newAuditStatus = Constants.equalsInteger(auditDTO.getAuditStatus(), Constants.ZERO) ? Constants.ONE : Constants.TWO;
+        shopInfo.setAuditStatus(newAuditStatus);
+        shopInfo.setAuditTime(now);
+        shopInfo.setAuditRemark(auditDTO.getAuditRemark());
+        shopInfo.setAuditUserId(auditDTO.getAuditUser());
+        shopInfo.setUpdateTime(now);
+        shopInfoMapper.updateById(shopInfo);
+    }
+
+    @Override
+    public void changeStatus(ChangeStatusDTO dto) {
+        if (dto.getId() == null) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "涓婚敭涓嶈兘涓虹┖");
+        }
+        if (dto.getStatus() == null || (dto.getStatus() != 0 && dto.getStatus() != 1)) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鐘舵�佸弬鏁伴敊璇紝0=鍚敤锛�1=绂佺敤");
+        }
+        ShopInfo shopInfo = shopInfoMapper.selectById(dto.getId());
+        if (shopInfo == null || Constants.equalsInteger(shopInfo.getDeleted(), Constants.ONE)) {
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        shopInfo.setStatus(dto.getStatus());
+        shopInfo.setUpdateTime(new Date());
+        shopInfoMapper.updateById(shopInfo);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void resetPassword(ResetPasswordDTO dto) {
+        if (dto.getId() == null) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "闂ㄥ簵涓婚敭涓嶈兘涓虹┖");
+        }
+        ShopInfo shopInfo = shopInfoMapper.selectById(dto.getId());
+        if (shopInfo == null || Constants.equalsInteger(shopInfo.getDeleted(), Constants.ONE)) {
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        String rawPassword = generateDefaultPassword(shopInfo.getTelephone());
+        String salt = RandomStringUtils.randomAlphabetic(6);
+        shopInfo.setPassword(Utils.Secure.encryptPassword(rawPassword, salt));
+        shopInfo.setSalt(salt);
+        shopInfo.setUpdateTime(new Date());
+        shopInfoMapper.updateById(shopInfo);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void updateShop(ShopUpdateDTO request) {
+        if (request.getId() == null) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "闂ㄥ簵涓婚敭涓嶈兘涓虹┖");
+        }
+        ShopInfo shopInfo = shopInfoMapper.selectById(request.getId());
+        if (shopInfo == null || Constants.equalsInteger(shopInfo.getDeleted(), Constants.ONE)) {
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+
+        // 鏍¢獙鎵嬫満鍙峰敮涓�鎬э紙鎺掗櫎鑷韩锛�
+        if (!request.getTelephone().equals(shopInfo.getTelephone())) {
+            checkTelephoneUnique(request.getTelephone(), shopInfo.getId());
+        }
+
+        // 鏍规嵁绫诲瀷鏍¢獙蹇呭~
+        if (Constants.equalsInteger(request.getCompanyType(), Constants.ZERO)) {
+            // 涓汉绫诲瀷锛氬繀椤讳笂浼犲姵鍔ㄥ悎鍚屽拰绀句繚璇佹槑
+            if (CollectionUtils.isEmpty(request.getLaborContractImgs())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "涓汉绫诲瀷蹇呴』涓婁紶鏈夋晥鍔冲姩鍚堝悓");
+            }
+            if (CollectionUtils.isEmpty(request.getSocialSecurityImgs())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "涓汉绫诲瀷蹇呴』涓婁紶绀句繚缂寸撼璇佹槑");
+            }
+        } else if (Constants.equalsInteger(request.getCompanyType(), Constants.ONE)) {
+            // 浼佷笟绫诲瀷锛氬繀椤诲~鍐欐硶浜轰俊鎭拰钀ヤ笟鎵х収
+            if (StringUtils.isBlank(request.getBusinessImg())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "浼佷笟绫诲瀷蹇呴』涓婁紶钀ヤ笟鎵х収");
+            }
+            if (StringUtils.isBlank(request.getLegalPersonName())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "浼佷笟绫诲瀷蹇呴』濉啓娉曚汉濮撳悕");
+            }
+            if (StringUtils.isBlank(request.getLegalPersonPhone())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "浼佷笟绫诲瀷蹇呴』濉啓娉曚汉鐢佃瘽");
+            }
+            if (StringUtils.isBlank(request.getLegalPersonCard())) {
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "浼佷笟绫诲瀷蹇呴』濉啓娉曚汉韬唤璇佸彿鐮�");
+            }
+        }
+
+        Date now = new Date();
+        // 鏇存柊鍩虹淇℃伅
+        shopInfo.setCompanyType(request.getCompanyType());
+        shopInfo.setName(request.getName());
+        shopInfo.setTelephone(request.getTelephone());
+        shopInfo.setLinkName(request.getLinkName());
+        shopInfo.setLinkPhone(request.getLinkPhone());
+        shopInfo.setIdcard(request.getIdcard());
+        shopInfo.setAreaId(request.getAreaId());
+        shopInfo.setLongitude(request.getLongitude());
+        shopInfo.setLatitude(request.getLatitude());
+        shopInfo.setAddress(request.getAddress());
+        // 浼佷笟绫讳俊鎭�
+        shopInfo.setIdcardImg(request.getIdcardImg());
+        shopInfo.setIdcardImgBack(request.getIdcardImgBack());
+        shopInfo.setBusinessImg(request.getBusinessImg());
+        shopInfo.setLegalPersonName(request.getLegalPersonName());
+        shopInfo.setLegalPersonPhone(request.getLegalPersonPhone());
+        shopInfo.setLegalPersonCard(request.getLegalPersonCard());
+        shopInfo.setUpdateTime(now);
+        shopInfoMapper.updateById(shopInfo);
+
+        // 鍒犻櫎鏃ч檮浠惰褰�
+        multifileMapper.delete(new QueryWrapper<Multifile>().lambda()
+                .eq(Multifile::getObjId, shopInfo.getId())
+                .in(Multifile::getObjType,
+                        Constants.FileType.STORE_FRONT.getKey(),
+                        Constants.FileType.STORE_INTERIOR.getKey(),
+                        Constants.FileType.OTHER_MATERIAL.getKey(),
+                        Constants.FileType.LABOR_CONTRACT.getKey(),
+                        Constants.FileType.SOCIAL_SECURITY.getKey()));
+
+        // 淇濆瓨鏂伴檮浠惰褰�
+        saveMultifileList(shopInfo.getId(), Constants.FileType.STORE_FRONT.getKey(), request.getStoreFrontImgs(), now);
+        saveMultifileList(shopInfo.getId(), Constants.FileType.STORE_INTERIOR.getKey(), request.getStoreInteriorImgs(), now);
+        saveMultifileList(shopInfo.getId(), Constants.FileType.OTHER_MATERIAL.getKey(), request.getOtherMaterialImgs(), now);
+        saveMultifileList(shopInfo.getId(), Constants.FileType.LABOR_CONTRACT.getKey(), request.getLaborContractImgs(), now);
+        saveMultifileList(shopInfo.getId(), Constants.FileType.SOCIAL_SECURITY.getKey(), request.getSocialSecurityImgs(), now);
+    }
+
+    // ========== 绉佹湁鏂规硶 ==========
+
+    /**
+     * 鐢熸垚榛樿瀵嗙爜锛氭墜鏈哄彿鍚�6浣� + @123456
+     */
+    private String generateDefaultPassword(String telephone) {
+        if (StringUtils.isBlank(telephone) || telephone.length() < 6) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鎵嬫満鍙锋牸寮忓紓甯革紝鏃犳硶鐢熸垚榛樿瀵嗙爜");
+        }
+        return telephone.substring(telephone.length() - 6) + "@123456";
+    }
+
+    private void checkTelephoneUnique(String telephone, Integer excludeId) {
+        QueryWrapper<ShopInfo> qw = new QueryWrapper<>();
+        qw.lambda()
+                .eq(ShopInfo::getTelephone, telephone)
+                .eq(ShopInfo::getDeleted, Constants.ZERO);
+        if (excludeId != null) {
+            qw.lambda().ne(ShopInfo::getId, excludeId);
+        }
+        long count = shopInfoMapper.selectCount(qw);
+        if (count > 0) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "璇ユ墜鏈哄彿宸叉敞鍐岄棬搴�");
+        }
+    }
+
+    private void saveMultifileList(Integer objId, Integer objType, List<String> urls, Date now) {
+        if (CollectionUtils.isEmpty(urls)) {
+            return;
+        }
+        int sortNum = 0;
+        for (String url : urls) {
+            Multifile multifile = new Multifile();
+            multifile.setObjId(objId);
+            multifile.setObjType(objType);
+            multifile.setType(Constants.ZERO);
+            multifile.setFileurl(url);
+            multifile.setIsdeleted(Constants.ZERO);
+            multifile.setCreateDate(now);
+            multifile.setSortnum(sortNum++);
+            multifileMapper.insert(multifile);
+        }
+    }
+
+    private ShopDetailVO buildShopDetailVO(ShopInfo shopInfo) {
+        ShopDetailVO vo = new ShopDetailVO();
+        vo.setId(shopInfo.getId());
+        vo.setCompanyType(shopInfo.getCompanyType());
+        vo.setName(shopInfo.getName());
+        vo.setTelephone(shopInfo.getTelephone());
+        vo.setLinkName(shopInfo.getLinkName());
+        vo.setLinkPhone(shopInfo.getLinkPhone());
+        vo.setIdcard(shopInfo.getIdcard());
+        vo.setAreaId(shopInfo.getAreaId());
+        // 濉厖鐪佸競鍖哄悕绉板強涓婚敭
+        Areas area = areasBiz.resolveArea(shopInfo.getAreaId());
+        if (area != null) {
+            vo.setProvinceId(area.getProvinceId());
+            vo.setCityId(area.getCityId());
+            vo.setProvinceName(area.getProvinceName());
+            vo.setCityName(area.getCityName());
+            vo.setAreaName(area.getName());
+        }
+        vo.setLongitude(shopInfo.getLongitude());
+        vo.setLatitude(shopInfo.getLatitude());
+        vo.setAddress(shopInfo.getAddress());
+        vo.setLegalPersonName(shopInfo.getLegalPersonName());
+        vo.setLegalPersonPhone(shopInfo.getLegalPersonPhone());
+        vo.setLegalPersonCard(shopInfo.getLegalPersonCard());
+        vo.setAuditStatus(shopInfo.getAuditStatus());
+        vo.setStatus(shopInfo.getStatus());
+        vo.setAuditTime(shopInfo.getAuditTime());
+        vo.setAuditRemark(shopInfo.getAuditRemark());
+        vo.setOpenid(shopInfo.getOpenid());
+        vo.setPayStatus(shopInfo.getPayStatus());
+        vo.setScore(shopInfo.getScore());
+        vo.setCreateTime(shopInfo.getCreateTime());
+
+        // 鎷兼帴鍥剧墖鍓嶇紑
+        String imgPrefix = "";
+        try {
+            imgPrefix = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.RESOURCE_PATH).getCode()
+                    + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.SHOP_FILES).getCode();
+        } catch (Exception e) {
+            // 鏈厤缃椂蹇界暐
+        }
+        vo.setImgPrefix(imgPrefix);
+
+        // 鍗曞浘瀛楁杩斿洖鍗婅矾寰�
+        vo.setIdcardImg(shopInfo.getIdcardImg());
+        vo.setIdcardImgBack(shopInfo.getIdcardImgBack());
+        vo.setBusinessImg(shopInfo.getBusinessImg());
+
+        // 鏌ヨ闄勪欢
+        QueryWrapper<Multifile> fileQw = new QueryWrapper<>();
+        fileQw.lambda()
+                .eq(Multifile::getObjId, shopInfo.getId())
+                .eq(Multifile::getIsdeleted, Constants.ZERO)
+                .in(Multifile::getObjType,
+                        Constants.FileType.STORE_FRONT.getKey(),
+                        Constants.FileType.STORE_INTERIOR.getKey(),
+                        Constants.FileType.OTHER_MATERIAL.getKey(),
+                        Constants.FileType.LABOR_CONTRACT.getKey(),
+                        Constants.FileType.SOCIAL_SECURITY.getKey())
+                .orderByAsc(Multifile::getObjType, Multifile::getSortnum);
+        List<Multifile> files = multifileMapper.selectList(fileQw);
+
+        // 鎸� objType 鍒嗙粍锛岃繑鍥炲崐璺緞
+        Map<Integer, List<String>> fileMap = new HashMap<>();
+        for (Multifile f : files) {
+            fileMap.computeIfAbsent(f.getObjType(), k -> new ArrayList<>()).add(f.getFileurl());
+        }
+
+        vo.setStoreFrontImgs(fileMap.getOrDefault(Constants.FileType.STORE_FRONT.getKey(), new ArrayList<>()));
+        vo.setStoreInteriorImgs(fileMap.getOrDefault(Constants.FileType.STORE_INTERIOR.getKey(), new ArrayList<>()));
+        vo.setOtherMaterialImgs(fileMap.getOrDefault(Constants.FileType.OTHER_MATERIAL.getKey(), new ArrayList<>()));
+        vo.setLaborContractImgs(fileMap.getOrDefault(Constants.FileType.LABOR_CONTRACT.getKey(), new ArrayList<>()));
+        vo.setSocialSecurityImgs(fileMap.getOrDefault(Constants.FileType.SOCIAL_SECURITY.getKey(), new ArrayList<>()));
+
+        // 鏌ヨ缁戝畾寮�鎴蜂細鍛樺ご鍍忥紙payMemberOpenId 鍏宠仈 member.openid锛�
+        if (StringUtils.isNotBlank(shopInfo.getPayMemberOpenId())) {
+            QueryWrapper<Member> memberQw = new QueryWrapper<>();
+            memberQw.lambda().eq(Member::getOpenid, shopInfo.getPayMemberOpenId()).last("limit 1");
+            Member payMember = memberMapper.selectOne(memberQw);
+            if (payMember != null) {
+                vo.setPayMemberCoverImage(payMember.getCoverImage());
+            }
+        }
+
+        return vo;
+    }
+
 }

--
Gitblit v1.9.3