|
|
@ -28,10 +28,11 @@ import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.dto.UserDTO; |
|
|
|
import com.elink.esua.epdc.modules.feign.UserInfoFeignClient; |
|
|
|
import com.elink.esua.epdc.modules.volunteer.dao.VolunteerDao; |
|
|
|
import com.elink.esua.epdc.modules.volunteer.dao.VolunteerOrgDao; |
|
|
|
import com.elink.esua.epdc.modules.volunteer.dao.VolunteerOrgRelationDao; |
|
|
|
import com.elink.esua.epdc.modules.volunteer.entity.VolunteerEntity; |
|
|
|
import com.elink.esua.epdc.modules.volunteer.entity.VolunteerOrgEntity; |
|
|
|
import com.elink.esua.epdc.modules.volunteer.entity.VolunteerOrgRelationEntity; |
|
|
|
import com.elink.esua.epdc.modules.volunteer.redis.VolunteerOrgRedis; |
|
|
|
import com.elink.esua.epdc.modules.volunteer.service.VolunteerOrgService; |
|
|
|
import com.elink.esua.epdc.volunteer.VolunteerOrgDTO; |
|
|
@ -62,6 +63,9 @@ public class VolunteerOrgServiceImpl extends BaseServiceImpl<VolunteerOrgDao, Vo |
|
|
|
@Autowired |
|
|
|
private VolunteerOrgRelationDao volunteerOrgRelationDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private VolunteerDao volunteerDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<VolunteerOrgDTO> page(Map<String, Object> params) { |
|
|
|
// IPage<VolunteerOrgEntity> page = baseDao.selectPage(
|
|
|
@ -116,12 +120,36 @@ public class VolunteerOrgServiceImpl extends BaseServiceImpl<VolunteerOrgDao, Vo |
|
|
|
} else if (userResult.getData() == null){ |
|
|
|
return new Result().ok("管理员手机号未关联到居民端用户,请检查管理员手机号或提醒该手机号用户在居民端注册。"); |
|
|
|
}else{ |
|
|
|
VolunteerOrgRelationEntity relationEntity = new VolunteerOrgRelationEntity(); |
|
|
|
UserDTO userInfo = JSONObject.parseObject(userResult.getData().toString(), UserDTO.class); |
|
|
|
relationEntity.setVolunteerId(userInfo.getId()); |
|
|
|
relationEntity.setVolunteerOrgId(orgId); |
|
|
|
relationEntity.setAdminFlag(1); |
|
|
|
volunteerOrgRelationDao.insert(relationEntity); |
|
|
|
//先检查此用户有没有在群里
|
|
|
|
VolunteerEntity entity = volunteerDao.getByUserIdAndOrgId(userInfo.getId(),orgId); |
|
|
|
//不在,新增用户,并设置成群主
|
|
|
|
if(entity == null){ |
|
|
|
VolunteerEntity newEntity = new VolunteerEntity(); |
|
|
|
newEntity.setVolunteerOrgId(orgId); |
|
|
|
newEntity.setAdminFlag("1"); |
|
|
|
newEntity.setRealName(dto.getHeadName()); |
|
|
|
newEntity.setIdCard(userInfo.getIdentityNo()); |
|
|
|
newEntity.setMobile(dto.getMobile()); |
|
|
|
// newEntity.setIntroduceInfo();
|
|
|
|
newEntity.setState("10"); |
|
|
|
newEntity.setUserId(userInfo.getId()); |
|
|
|
newEntity.setFaceImg(userInfo.getFaceImg()); |
|
|
|
newEntity.setPartyFlag(userInfo.getPartyFlag()); |
|
|
|
newEntity.setDeptId(userInfo.getDeptId().toString()); |
|
|
|
if(StringUtils.isNotBlank(userInfo.getAllDeptNames())){ |
|
|
|
newEntity.setDeptName(userInfo.getAllDeptNames().substring(userInfo.getAllDeptNames().lastIndexOf("-")+1,userInfo.getAllDeptNames().length())); |
|
|
|
} |
|
|
|
newEntity.setParentDeptIds(userInfo.getParentDeptIds()); |
|
|
|
newEntity.setParentDeptNames(userInfo.getParentDeptNames()); |
|
|
|
newEntity.setAllDeptIds(userInfo.getAllDeptIds()); |
|
|
|
newEntity.setAllDeptNames(userInfo.getAllDeptNames()); |
|
|
|
volunteerDao.insert(newEntity); |
|
|
|
}else {//在,不是群主,修改状态设置为群主
|
|
|
|
entity.setAdminFlag("1"); |
|
|
|
entity.setState("10");//审核通过
|
|
|
|
volunteerDao.updateById(entity); |
|
|
|
} |
|
|
|
return new Result().ok("管理员手机号已成功关联居民端用户,该手机号居民端用户已被设置为该组织管理员。"); |
|
|
|
} |
|
|
|
} |
|
|
@ -135,8 +163,8 @@ public class VolunteerOrgServiceImpl extends BaseServiceImpl<VolunteerOrgDao, Vo |
|
|
|
} |
|
|
|
VolunteerOrgEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerOrgEntity.class); |
|
|
|
updateById(entity); |
|
|
|
//删除原先的管理员,重新设置
|
|
|
|
volunteerOrgRelationDao.deleteAdminUserForOrg(entity.getId()); |
|
|
|
//先设置旧管理员为普通成员
|
|
|
|
volunteerDao.updateAdminUser(entity.getId()); |
|
|
|
return setAdminUserForOrg(dto,entity.getId()); |
|
|
|
} |
|
|
|
|
|
|
|