huliguo
2 天以前 07fb617c686699435cde29e8147f11a125d7d618
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -245,6 +245,16 @@
            shopFileService.deleteByShopId(shop.getShopId());
            shopRelTagService.deleteByShopId(shop.getShopId());
            shopRelUserService.deleteByShopId(shop.getShopId());
            //默认登录账号开关 开启后原默认账号开关关闭
            List<Long> openIdList = Arrays.stream(mgtEditShopDto.getRelUserOpenIds().split(","))
                    .map(String::trim)
                    .filter(StringUtils::isNotBlank)
                    .map(Long::valueOf)
                    .collect(Collectors.toList());
            if ( !openIdList.isEmpty()) {
                shopRelUserService.setDefaultCloseByUserIdList(openIdList);
            }
            //清空归属
            shopStaffService.clearShopStaffRelation(shop.getShopId());
            if(!shop.getShopName().equals(mgtEditShopDto.getShopName())){
@@ -308,6 +318,7 @@
            handleShopStaff(shop.getShopId(),belongSysUser);
        }*/
        //商户关联人员
        String[] openIds = mgtEditShopDto.getRelUserOpenIds().split(",");//开启默认登录账号
        if(StringUtils.isNotBlank(relUserIds)){
            shopStaffService.clearShopStaffRelation(shop.getShopId());
            String[] relUserIdArray = relUserIds.split(",");
@@ -324,6 +335,7 @@
                shopRelUser.setUserName(sysUser.getNickName());
                shopRelUser.setUserMobile(sysUser.getPhonenumber());
                shopRelUser.setUserDeptId(sysUser.getDeptId());
                shopRelUser.setIsDefault((openIds.length > 0  && Arrays.asList(openIds).contains(str)) ? 1 : 0);
                shopRelUserService.save(shopRelUser);
                handleShopStaff(shop.getShopId(),sysUser);
            }
@@ -659,12 +671,17 @@
        if(shopRelUserList!=null&&!shopRelUserList.isEmpty()){
            StringJoiner shopUserJs = new StringJoiner(",");
            StringJoiner shopUserNameJs = new StringJoiner(",");
            StringJoiner relUserOpenIds = new StringJoiner(",");
            for(ShopRelUser shopRelUser : shopRelUserList){
                shopUserJs.add(shopRelUser.getUserId().toString());
                shopUserNameJs.add(shopRelUser.getUserName());
                if (shopRelUser.getIsDefault()==1){
                    relUserOpenIds.add(shopRelUser.getUserId().toString());
                }
            }
            mgtShopInfoVo.setRelUserIds(shopUserJs.toString());
            mgtShopInfoVo.setRelUsers(shopUserNameJs.toString());
            mgtShopInfoVo.setRelUserOpenIds(relUserOpenIds.toString());
        }
        //商户图片
        List<ShopFile> shopFileList = shopFileService.listShopFileByShopId(shopId);