101captain
2022-07-20 c40f8e3d2e08e108780091776437242528bf61d6
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialOrgServiceImpl.java
@@ -8,9 +8,11 @@
import com.panzhihua.common.model.vos.community.ComActSocialOrgVO;
import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.service_community.dao.ComActDAO;
import com.panzhihua.service_community.entity.ComActCommittee;
import com.panzhihua.service_community.entity.ComActSocialOrg;
import com.panzhihua.service_community.dao.ComActSocialOrgDao;
import com.panzhihua.service_community.model.dos.ComActDO;
import com.panzhihua.service_community.service.ComActSocialOrgService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -32,6 +34,8 @@
private ComActSocialOrgDao comActSocialOrgDao;
@Resource
private UserService userService;
@Resource
private ComActDAO comActDAO;
    @Override
    public R pageList(CommonPage commonPage) {
        return R.ok(comActSocialOrgDao.pageList(new Page(commonPage.getPage(),commonPage.getSize()),commonPage));
@@ -57,17 +61,23 @@
                administratorsUserVO.setSocialType(2);
                administratorsUserVO.setRoleId(777777777L);
                comActSocialOrg.setIsSociety(1);
            }
            else {
                Long affiliatedUnit = comActSocialOrg.getAffiliatedUnit();
                Integer affiliatedUnitType = comActSocialOrg.getAffiliatedUnitType();
                if (affiliatedUnitType.equals(2)) {
                    administratorsUserVO.setCommunityId(affiliatedUnit);
                    ComActDO comActDO = comActDAO.selectById(affiliatedUnit);
                    comActSocialOrg.setStreetId(comActDO.getStreetId());
                }
                administratorsUserVO.setName(comActSocialOrgVO.getCorporationName());
            } else {
                administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId());
                if(comActSocialOrg.getCommunityId()!=null){
                    administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId());
                    ComActDO comActDO = comActDAO.selectById(comActSocialOrg.getCommunityId());
                    comActSocialOrg.setStreetId(comActDO.getStreetId());
                }
                administratorsUserVO.setName(comActSocialOrgVO.getContactName());
            }
            if(comActSocialOrg.getCommunityId()!=null){
                administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId());
            }
            if(comActSocialOrg.getStreetId()!=null){
                administratorsUserVO.setStreetId(comActSocialOrg.getStreetId());
            }
            administratorsUserVO.setName(comActSocialOrgVO.getContactName());
            administratorsUserVO.setPhone(comActSocialOrgVO.getContactPhone());
            R r=userService.addUserBackstageProperty(administratorsUserVO);
            if(R.isOk(r)){
@@ -84,18 +94,24 @@
    @Override
    public R update(ComActSocialOrgVO comActSocialOrgVO) {
        if(comActSocialOrgVO!=null){
               ComActSocialOrg comActSocialOrg=new ComActSocialOrg();
               BeanUtils.copyProperties(comActSocialOrgVO,comActSocialOrg);
                if(comActSocialOrgVO.getRoleId()!=null){
                    ComActSocialOrg comPropertyBase=this.comActSocialOrgDao.selectById(comActSocialOrgVO.getId());
                    AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO();
                    administratorsUserVO.setUserId(comPropertyBase.getUserId());
                    administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId());
                    administratorsUserVO.setLastLoginTime(DateUtil.date());
                    this.userService.putUserBackstage(administratorsUserVO);
                }
               this.comActSocialOrgDao.updateById(comActSocialOrg);
               return R.ok();
            ComActSocialOrg comActSocialOrg=new ComActSocialOrg();
            BeanUtils.copyProperties(comActSocialOrgVO,comActSocialOrg);
            AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO();
            if(comActSocialOrgVO.getRoleId() == null) {
                administratorsUserVO.setRoleId(777777777L);
            } else {
                administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId());
            }
            ComActSocialOrg comPropertyBase=this.comActSocialOrgDao.selectById(comActSocialOrgVO.getId());
            administratorsUserVO.setUserId(comPropertyBase.getUserId());
            administratorsUserVO.setLastLoginTime(DateUtil.date());
            administratorsUserVO.setAccount(comActSocialOrgVO.getAccount());
            administratorsUserVO.setPassword(comActSocialOrgVO.getPassword());
            Integer status = comActSocialOrgVO.getStatus();
            administratorsUserVO.setStatus(status.equals(0) ? 2 : 1);
            this.userService.putUserBackstage(administratorsUserVO);
            this.comActSocialOrgDao.updateById(comActSocialOrg);
            return R.ok();
        }
        return R.fail();
    }