CeDo
2021-04-26 1fbd4413550ebe1b7f7a91f61bffaeb77dc23959
Merge remote-tracking branch 'origin/master'
14个文件已修改
391 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/ShopApi.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommonDataApi.java 162 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommonDataApi.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopGoodsDAO.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/RoleDAO.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/UserDao.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/ShopApi.java
@@ -76,42 +76,6 @@
        return communityService.pageStoreList(pageComShopStoreDTO);
    }
//    @ApiOperation(value = "保存商家Bak")
    @PostMapping("/store/saveBak")
    public R saveStoreBak(@Valid @RequestBody ShopStoreVO storeVO) {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        Long loginUserId = loginUserInfo.getUserId();
        if (storeVO == null) {
            return R.fail();
        }
        R sysUserVO = userService.addSysUser(storeVO);
        JSONObject jsonObject = null;
        if (sysUserVO.getData() != null) {
            return R.fail("账号已存在!");
        }
        AdministratorsUserVO administratorsUserVO = new AdministratorsUserVO();
        administratorsUserVO.setAccount(storeVO.getStoreAccount());
        administratorsUserVO.setPassword(storeVO.getStorePassword());
        administratorsUserVO.setType(5);
        administratorsUserVO.setAreaId(null);
        administratorsUserVO.setStatus(1);
        administratorsUserVO.setPhone(storeVO.getPhone());
        administratorsUserVO.setRoleId(888888888l);
        administratorsUserVO.setShopStoreName(storeVO.getName());
        administratorsUserVO.setShopStorePhone(storeVO.getPhone());
        R r = userService.addUserBackstage(administratorsUserVO);
        //保存sys_user
        if (R.isOk(r)) {
            sysUserVO = userService.getSysUserVOByAccountAndType(storeVO.getStoreAccount(),5);
            jsonObject = JSON.parseObject(JSON.toJSONString(sysUserVO.getData()));
            SysUserVO entityVo = jsonObject.toJavaObject(SysUserVO.class);
            storeVO.setSysUserId(entityVo.getUserId());
            storeVO.setLoginUserId(loginUserId);
            communityService.saveStore(storeVO);
        }
        return R.ok();
    }
    @ApiOperation(value = "保存商家")
    @PostMapping("/store/save")
    @Transactional(rollbackFor = Exception.class)
@@ -127,7 +91,6 @@
        if(isAddStore.getCode() != 200){
            return isAddStore;
        }
        //新增SysUser
        R isAddSysUser = userService.addSysUser(storeVO);
        if(isAddStore.getCode() != 200){
            return isAddSysUser;
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java
@@ -180,7 +180,7 @@
                }
                for (int i = 18; i < headSize; i++) {
                    if (oneData.get(i) != null && oneData.get(i).equals("是")) {
                        vo.getUserTagStr().add(headData.get(i));
                        vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("(")));
                    }
                }
                voList.add(vo);
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -2171,4 +2171,12 @@
     */
    @PostMapping("common/data/special/page")
    R specialInputUser(@RequestBody PageInputUserDTO pageInputUserDTO);
    /**
     * 删除特殊群体人员
     * @param id    特殊群体id
     * @return  删除结果
     */
    @PostMapping("common/data/special/delete")
    R deleteSpecialInputUser(@RequestParam(value = "id") Long id);
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommonDataApi.java
@@ -345,59 +345,129 @@
        return userService.deleteSpecialInputUser(id);
    }
    @ApiOperation(value = "特殊群体 导出特殊群体Excel")
//    @ApiOperation(value = "特殊群体 导出特殊群体Excel")
//    @PostMapping("/special/export")
//    public R exportSpecial(@RequestBody ExportSpecialUserDTO exportSpecialUserDTO) {
//        exportSpecialUserDTO.setCommunityId(this.getCommunityId());
//        String url = excelUrl;
//        String uuid = UUID.randomUUID().toString().replace("-", "");
//        String name = uuid + ".xlsx";
//        String ftpUrl = "/mnt/data/web/excel/";
////        用户搜索了就下载搜索的用户否则下载所有用户
//        R r = userService.specialUserExport(exportSpecialUserDTO);
//        if (R.isOk(r)) {
//            List<EexcelUserDTO> eexcelUserDTOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), EexcelUserDTO.class);
//            try {
//                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
//                sftp.login();
//                boolean existDir = sftp.isExistDir(ftpUrl + name);
//                if (!existDir) {
//                    String property = System.getProperty("user.dir");
//                    String fileName = property + File.separator + name;
//                    // 这里 需要指定写用哪个class去写
//                    ExcelWriter excelWriter = null;
//                    InputStream inputStream = null;
//                    try {
//                        excelWriter = EasyExcel.write(fileName, EexcelUserDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
//                        WriteSheet writeSheet = EasyExcel.writerSheet("模板").build();
//                        excelWriter.write(eexcelUserDTOS, writeSheet);
//                        excelWriter.finish();
//                        File file = new File(fileName);
//                        inputStream = new FileInputStream(file);
//                        sftp.uploadMore(ftpUrl, name, inputStream);
//                        sftp.logout();
//                        inputStream.close();
//                        String absolutePath = file.getAbsolutePath();
//                        boolean delete = file.delete();
//                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
//                    } finally {
//                        // 千万别忘记finish 会帮忙关闭流
//                        if (inputStream != null) {
//                            inputStream.close();
//                        }
//                        if (excelWriter != null) {
//                            excelWriter.finish();
//                        }
//                    }
//                }
//                return R.ok(url + name);
//            } catch (Exception e) {
//                e.printStackTrace();
//                log.error("文件传输失败【{}】", e.getMessage());
//                return R.fail();
//            }
//        }
//        return R.fail("未查询到用户");
//    }
    @ApiOperation(value = "特殊群体-数据导出")
    @PostMapping("/special/export")
    public R exportSpecial(@RequestBody ExportSpecialUserDTO exportSpecialUserDTO) {
        exportSpecialUserDTO.setCommunityId(this.getCommunityId());
        String url = excelUrl;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String name = uuid + ".xlsx";
    public R dataExportSpecilPopulation() {
        //获取登陆用户
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        //获取登陆用户绑定社区id
        Long communityId = loginUserInfo.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
//        用户搜索了就下载搜索的用户否则下载所有用户
        R r = userService.specialUserExport(exportSpecialUserDTO);
        if (R.isOk(r)) {
            List<EexcelUserDTO> eexcelUserDTOS = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), EexcelUserDTO.class);
            try {
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, EexcelUserDTO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("模板").build();
                        excelWriter.write(eexcelUserDTOS, writeSheet);
                        excelWriter.finish();
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
                            inputStream.close();
                        }
                        if (excelWriter != null) {
                            excelWriter.finish();
        String name = "特殊群体导出数据.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<ComMngPopulationVO> populList = JSON.parseArray(JSON.toJSONString(communityService.getPopulationListByCommunityId(communityId).getData()),ComMngPopulationVO.class);
                    List<ComMngPopulationExcelVo> populationExcelVoList = new ArrayList<>();
                    if(populList != null && populList.size() > 0){
                        for (ComMngPopulationVO popul:populList){
                            if(popul.getLabel() == null){
                                continue;
                            }
                            ComMngPopulationExcelVo populationExcelVo = new ComMngPopulationExcelVo();
                            BeanUtils.copyProperties(popul,populationExcelVo);
                            //设置性别
                            populationExcelVo.setSex(PopulSexEnum.getCnDescByName(popul.getSex()));
                            //设置政治面貌
                            populationExcelVo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCnDescByName(popul.getPoliticalOutlook()));
                            //设置是否租住
                            populationExcelVo.setIsRent(PopulIsOkEnum.getCnDescByName(popul.getIsRent()));
                            populationExcelVoList.add(populationExcelVo);
                        }
                    }
                    excelWriter = EasyExcel.write(fileName, ComMngPopulationExcelVo.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                    WriteSheet writeSheet = EasyExcel.writerSheet("特殊群体导出数据").build();
                    excelWriter.write(populationExcelVoList, writeSheet);
                    excelWriter.finish();
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    if (excelWriter != null) {
                        excelWriter.finish();
                    }
                }
                return R.ok(url + name);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
                return R.fail();
            }
            return R.ok(excelUrl + name);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
        return R.fail("未查询到用户");
    }
    @ApiOperation(value = "特殊群体/分页查询标签列表", response = ComMngTagVO.class)
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommonDataApi.java
@@ -361,4 +361,14 @@
    public R specialInputUser(@RequestBody PageInputUserDTO pageInputUserDTO) {
        return comMngPopulationService.specialInputUser(pageInputUserDTO);
    }
    /**
     * 删除特殊群体人员
     * @param id    特殊群体id
     * @return  删除结果
     */
    @PostMapping("/special/delete")
    public R deleteSpecialInputUser(@RequestParam(value = "id") Long id){
        return comMngPopulationService.deleteSpecialInputUser(id);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -172,7 +172,7 @@
    @Select("<script> " +
            "select cmp.id,cmv.`alley` as areaName,cmp.`name`,cmp.phone,cmp.label as tags,cmp.create_at from com_mng_population as cmp " +
            "left join com_mng_village as cmv on cmv.village_id = cmp.village_id where cmp.act_id = #{pageInputUserDTO.communityId} " +
            "left join com_mng_village as cmv on cmv.village_id = cmp.village_id where cmp.act_id = #{pageInputUserDTO.communityId} and cmp.label is not null " +
            "<if test='pageInputUserDTO.name != null and pageInputUserDTO.name != &quot;&quot;'>" +
            " AND cmp.`name` LIKE concat(#{pageInputUserDTO.name},'%') " +
            " </if> " +
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopGoodsDAO.java
@@ -45,27 +45,29 @@
            " </where>" +
            " order by c.create_at desc" +
            "</script>")
    IPage<PageShopGoodsVO> pageShopGoods(Page page, @Param("pageComShopGoodsDTO")  PageComShopGoodsDTO pageComShopGoodsDTO);
    IPage<PageShopGoodsVO> pageShopGoods(Page page, @Param("pageComShopGoodsDTO") PageComShopGoodsDTO pageComShopGoodsDTO);
    /**
     * 根据店铺id查询商品列表
     * @param page  分页参数
     * @param pageComShopStoreDTO   请求参数
     * @return  分页商品列表
     *
     * @param page                分页参数
     * @param pageComShopStoreDTO 请求参数
     * @return 分页商品列表
     */
    @Select("<script> " +
            "select id,`name`,store_id,goods_pic,images,`status`,sale,original_price,price" +
            ",unit,`order`,stock,details,delivery_type from com_shop_goods" +
            " where store_id = #{pageComShopStoreDTO.storeId} and delete_status = 1 and status = 1" +
            " order by sale desc,create_at desc "+
            " order by sale desc,create_at desc " +
            "</script> ")
    IPage<ComShopGoodsVO> pageShopGoodsByStoreId(Page page, @Param("pageComShopStoreDTO") PageComShopStoreDTO pageComShopStoreDTO);
    /**
     * 分页查询商品列表
     * @param page  分页参数
     * @param comShopGoodsDTO   请求参数
     * @return  商品列表
     *
     * @param page            分页参数
     * @param comShopGoodsDTO 请求参数
     * @return 商品列表
     */
    @Select("<script> " +
            "select csg.id,csg.`name`,csg.store_id,csg.goods_pic,csg.images,csg.`status`,csg.sale,csg.original_price " +
@@ -91,5 +93,4 @@
            " order by sale desc,create_at desc " +
            " </script>")
    IPage<ComShopGoodsVO> pageShopGoodByApps(Page page, @Param("comShopGoodsDTO") ComShopGoodsDTO comShopGoodsDTO);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java
@@ -114,4 +114,11 @@
     * @return  特殊群体列表
     */
    R specialInputUser(PageInputUserDTO pageInputUserDTO);
    /**
     * 删除特殊群体人员
     * @param id    特殊群体id
     * @return  删除结果
     */
    R deleteSpecialInputUser(Long id);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -234,9 +234,6 @@
            comMngPopulationDO.setActId(comActDO.getCommunityId());
            comMngPopulationDO.setStreetId(comActDO.getStreetId());
            comMngPopulationDO.setLabel(Joiner.on(",").join(userTag));
            if(!userTag.isEmpty()){
                //特殊群体插入
            }
            comMngPopulationDO.setVillageName(comMngVillageDO.getGroupAt());
            populationDOList.add(comMngPopulationDO);
            index++;
@@ -436,4 +433,24 @@
                ,pageInputUserDTO.getPageSize()), pageInputUserDTO);
        return R.ok(iPage);
    }
    /**
     * 删除特殊群体人员
     * @param id    特殊群体id
     * @return  删除结果
     */
    @Override
    public R deleteSpecialInputUser(Long id){
        //查询特殊群体人员
        ComMngPopulationDO populationDO = this.baseMapper.selectById(id);
        if(populationDO == null){
            return R.fail("未查询到该记录");
        }
        populationDO.setLabel(null);
        if(this.baseMapper.updateById(populationDO) > 0){
            return R.ok();
        }else{
            return R.fail();
        }
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
@@ -139,7 +139,7 @@
        ComShopStoreDO oldComShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>()
                .eq(ComShopStoreDO::getStoreAccount, storeVO.getStoreAccount()).eq(ComShopStoreDO::getDeleteStatus,ComShopStoreDO.deleteStatus.no));
        if (oldComShopStoreDO != null) {
            return R.fail("商家已注册");
            return R.fail("商家账号已注册");
        }
        //新增店铺先判断是否拥有已删除的店铺
        ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>()
@@ -209,6 +209,8 @@
                });
                shopStoreDO.setDeleteStatus(2);
                this.baseMapper.updateById(shopStoreDO);
                //删除sys_user 物理删除
                this.baseMapper.deleteSysUserBySysUserId(shopStoreDO.getSysUserId());
            }
        }else {
            return R.fail("未查询到店铺");
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java
@@ -13,6 +13,7 @@
import com.panzhihua.service_user.service.SysUserInputService;
import com.panzhihua.service_user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/RoleDAO.java
@@ -5,6 +5,7 @@
import com.panzhihua.service_user.model.dos.SysRoleDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -18,10 +19,16 @@
public interface RoleDAO extends BaseMapper<SysRoleDO> {
    @Select("select r.* from sys_user_role u join sys_role r on u.role_id=r.role_id where u.user_id=#{userId}")
    List<SysRoleDO> selectByUserId(Long userId);
    @Select("select r.role_key role,m.component url from sys_role r join sys_role_menu rm on r.role_id=rm.role_id join sys_menu m on rm.menu_id=m.menu_id WHERE m.component is not null ")
    List<MenuVO> selectAllMenuUrl();
    @Select("select r.role_key from sys_user_role ur join sys_role r on ur.role_id = r.role_id where ur.user_id=#{username}")
    List<String> selectRoles(String username);
    @Select("")
    Long selectMaxRole(Long communityId);
    @Select("delete from sys_role where role_key =#{roleKey}")
    void deleteByRoleKey(@RequestParam("roleKey") String roleKey);
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/UserDao.java
@@ -22,6 +22,7 @@
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Date;
import java.util.List;
@@ -342,4 +343,7 @@
    @Select("update com_shop_store set sys_user_id = #{sysUserId} where phone = #{phone}")
    void updateStoreByPhone(@Param("phone")String phone, @Param("sysUserId")Long sysUserId);
    @Select("delete from com_shop_store where delete_status = 1 and phone = #{phone}")
    void deleteStoreByPhoneAndStatus(@RequestParam("phone") String phone);
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -775,11 +775,11 @@
            Long communityId = administratorsUserVO.getCommunityId();
            //新增社区高级管理员角色
            SysRoleDO sysRoleDO = new SysRoleDO();
            if(roleId.intValue() == 999999999){
            if (roleId.intValue() == 999999999) {
                sysRoleDO.setCommunityId(communityId);
                sysRoleDO.setRoleName("超级管理员");
                sysRoleDO.setRoleKey(Constants.ADMIN_SHOP_ROLE_KEY + communityId);
            }else{
            } else {
                sysRoleDO.setCommunityId(0L);
                sysRoleDO.setRoleName(administratorsUserVO.getShopStoreName());
                sysRoleDO.setRoleKey(Constants.SHOP_ROLE_KEY + administratorsUserVO.getShopStorePhone());
@@ -1603,46 +1603,34 @@
    /**
     * 新增SysUser
     * @param storeVO   请求参数
     * @return  新增结果
     *
     * @param storeVO 请求参数
     * @return 新增结果
     */
    @Override
    public R addSysUser(ShopStoreVO storeVO){
    public R addSysUser(ShopStoreVO storeVO) {
        SysUserDO sysUserDO = new SysUserDO();
        Long roleId = 888888888L;
        if (roleId.intValue() == 999999999 || roleId.intValue() == 888888888) {
            Long communityId = 0L;
            //新增社区高级管理员角色
            SysRoleDO sysRoleDO = new SysRoleDO();
            if(roleId.intValue() == 999999999){
                sysRoleDO.setCommunityId(communityId);
                sysRoleDO.setRoleName("超级管理员");
                sysRoleDO.setRoleKey(Constants.ADMIN_SHOP_ROLE_KEY + communityId);
            }else{
                sysRoleDO.setCommunityId(0L);
                sysRoleDO.setRoleName(storeVO.getName());
                sysRoleDO.setRoleKey(Constants.SHOP_ROLE_KEY + storeVO.getStoreAccount());
            }
            sysRoleDO.setRoleSort(0);
            sysRoleDO.setCreateBy(storeVO.getLoginUserId());
            int insert = roleDAO.insert(sysRoleDO);
            if (insert > 0) {
                SysRoleDO sysRoleDO1 = roleDAO.selectOne(new QueryWrapper<SysRoleDO>().lambda().eq(SysRoleDO::getRoleKey, sysRoleDO.getRoleKey()));
                roleId = sysRoleDO1.getRoleId();
                //新角色设置所有权限
                MenuRoleVO menuRoleVO = new MenuRoleVO();
                menuRoleVO.setIsAll(1);
                menuRoleVO.setCommunityId(communityId);
                menuRoleVO.setRoleId(roleId);
                this.putMenuRole(menuRoleVO);
            }
        Long communityId = 0L;
        //新增社区高级管理员角色
        SysRoleDO sysRoleDO = new SysRoleDO();
        sysRoleDO.setCommunityId(0L);
        sysRoleDO.setRoleName(storeVO.getName());
        sysRoleDO.setRoleKey(Constants.SHOP_ROLE_KEY + storeVO.getStoreAccount());
        sysRoleDO.setRoleSort(0);
        sysRoleDO.setCreateBy(storeVO.getLoginUserId());
        int insert = roleDAO.insert(sysRoleDO);
        if (insert < 0) {
            return R.fail();
        }
        //新角色设置所有权限
        MenuRoleVO menuRoleVO = new MenuRoleVO();
        menuRoleVO.setIsAll(1);
        menuRoleVO.setCommunityId(communityId);
        menuRoleVO.setRoleId(sysRoleDO.getRoleId());
        this.putMenuRole(menuRoleVO);
        SysRoleDO roleDO = roleDAO.selectById(roleId);
        if (ObjectUtils.isEmpty(roleDO)) {
            return R.fail("角色不存在");
        }
        //sys_user 表
        String encode = new BCryptPasswordEncoder().encode(storeVO.getStorePassword());
        BeanUtils.copyProperties(storeVO, sysUserDO);
        sysUserDO.setAccount(storeVO.getStoreAccount());
@@ -1652,32 +1640,21 @@
        sysUserDO.setPhone(storeVO.getPhone());
        sysUserDO.setName(storeVO.getContacts());
        sysUserDO.setPassword(encode);
        int insert = 0;
        try {
            insert = userDao.insert(sysUserDO);
            //把SysUserId赋值给店铺
            if(sysUserDO.getUserId() != null){
                userDao.updateStoreByPhone(storeVO.getPhone(),sysUserDO.getUserId());
            if (sysUserDO.getUserId() != null) {
                userDao.updateStoreByPhone(storeVO.getPhone(), sysUserDO.getUserId());
            }
        } catch (Exception e) {
            e.printStackTrace();
            log.error("新增后台用户报错【{}】", e.getMessage());
            if (e.getMessage().contains("union_phone_type")) {
                userDao.deleteStoreByPhoneAndStatus(storeVO.getPhone());
                roleDAO.deleteByRoleKey(Constants.SHOP_ROLE_KEY + storeVO.getStoreAccount());
                throw new ServiceException("手机号已经存在");
            } else if (e.getMessage().contains("union_account_type")) {
                throw new ServiceException("账户已经存在");
            }
        }
        if (insert > 0) {
            SysUserDO sysUserDO1 = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getType, 5).eq(SysUserDO::getAccount, storeVO.getStoreAccount()));
            Long userId = sysUserDO1.getUserId();
            SysUserRoleDO sysUserRoleDO = new SysUserRoleDO();
            sysUserRoleDO.setUserId(userId);
            sysUserRoleDO.setRoleId(roleDO.getRoleId());
            int insert1 = sysUserRoleDAO.insert(sysUserRoleDO);
            if (insert1 > 0) {
                return R.ok();
            }
        }
        return R.fail();
@@ -1685,14 +1662,15 @@
    /**
     * 修改SysUser用户信息
     * @param storeVO   请求参数
     * @return  修改结果
     *
     * @param storeVO 请求参数
     * @return 修改结果
     */
    @Override
    public R editSysUser(ShopStoreVO storeVO){
        SysUserDO sysUserDO1 = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getPhone,storeVO.getPhone())
                .eq(SysUserDO::getType,5));
        if(sysUserDO1 == null){
    public R editSysUser(ShopStoreVO storeVO) {
        SysUserDO sysUserDO1 = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getPhone, storeVO.getPhone())
                .eq(SysUserDO::getType, 5));
        if (sysUserDO1 == null) {
            return R.fail("未查询到后台管理用户!");
        }
        String encode = new BCryptPasswordEncoder().encode(storeVO.getStorePassword());
@@ -1705,21 +1683,22 @@
    /**
     * 修改用户小程序首页活动提示
     * @param userEditTipsDTO  请求参数
     * @return  修改结果
     *
     * @param userEditTipsDTO 请求参数
     * @return 修改结果
     */
    public R editUserTips(SysUserEditTipsDTO userEditTipsDTO){
    public R editUserTips(SysUserEditTipsDTO userEditTipsDTO) {
        //查询用户信息
        SysUserDO userDO = userDao.selectById(userEditTipsDTO.getUserId());
        if(userDO == null){
        if (userDO == null) {
            return R.fail("未查询到用户信息");
        }
        //修改用户信息
        userDO.setIsTips(userEditTipsDTO.getIsTips());
        userDao.updateById(userDO);
        if(userDao.updateById(userDO) > 0){
        if (userDao.updateById(userDO) > 0) {
            return R.ok();
        }else{
        } else {
            return R.fail();
        }
    }