101captain
2022-06-06 560db6a1036201e7e2ac50f34ad4a418f17eaba6
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java
@@ -53,9 +53,6 @@
    @Override
    @Transactional
    public R<ComStreetVO> addStreet(ComStreetVO comStreetVO) {
        String password = comStreetVO.getPassword();
        String encode = new BCryptPasswordEncoder().encode(password);
        comStreetVO.setPassword(encode);
        ComStreetDO comStreetDO = new ComStreetDO();
        LambdaQueryWrapper<ComStreetDO> param = new QueryWrapper<ComStreetDO>().lambda();
        param.eq(ComStreetDO::getName, comStreetVO.getName());
@@ -66,14 +63,30 @@
        if (integer > 0) {
            return R.fail(500, "街道已经存在");
        }
        BeanUtils.copyProperties(comStreetVO, comStreetDO);
        int insert = comStreetDAO.insert(comStreetDO);
        if (insert > 0) {
            ComStreetDO comStreetDO1 = comStreetDAO.selectOne(param);
            BeanUtils.copyProperties(comStreetDO1, comStreetVO);
            return R.ok(comStreetVO);
        AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO();
        administratorsUserVO.setType(3);
        administratorsUserVO.setAccount(comStreetVO.getAccount());
        administratorsUserVO.setPassword(comStreetVO.getPassword());
        administratorsUserVO.setSocialType(1);
        administratorsUserVO.setRoleId(777777777L);
        administratorsUserVO.setStreetId(0L);
        administratorsUserVO.setName(comStreetVO.getName());
        R r=userService.addUserBackstageProperty(administratorsUserVO);
        if(R.isOk(r)){
            BeanUtils.copyProperties(comStreetVO, comStreetDO);
            int insert = comStreetDAO.insert(comStreetDO);
            if (insert > 0) {
                AdministratorsUserVO administratorsUserVO1=new AdministratorsUserVO();
                administratorsUserVO1.setUserId(Long.parseLong(r.getData().toString()));
                administratorsUserVO1.setStreetId(comStreetDO.getStreetId());
                userService.updateStreet(administratorsUserVO1);
                ComStreetDO comStreetDO1 = comStreetDAO.selectOne(param);
                BeanUtils.copyProperties(comStreetDO1, comStreetVO);
                return R.ok(comStreetVO);
            }
            return R.fail(500, "");
        }
        return R.fail(500, "");
        return R.fail("账号已存在");
    }
    /**