|
|
@ -22,7 +22,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.UserResiInfoDTO; |
|
|
@ -218,11 +220,37 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
if (null != groupSummarizeResultDTO) { |
|
|
|
return new Result<GroupSummarizeResultDTO>().error(ModuleConstant.GETGROUPSUMMARIZE_FAILED); |
|
|
|
} |
|
|
|
//群主名称需要调用feign查询
|
|
|
|
groupSummarizeResultDTO.setLeaderName("测试"); |
|
|
|
//获取组长信息
|
|
|
|
Result<UserResiInfoDTO> groupLeaderUserInfo=this.getGroupLeaderUserInfo(groupSummarizeFormDTO.getGroupId()); |
|
|
|
if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) { |
|
|
|
groupSummarizeResultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName()); |
|
|
|
} |
|
|
|
return new Result<GroupSummarizeResultDTO>().ok(groupSummarizeResultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param groupId |
|
|
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserResiInfoDTO> |
|
|
|
* @Author yinzuomei |
|
|
|
* @Description 根据组id查询组长信息 |
|
|
|
* @Date 2020/3/30 15:07 |
|
|
|
**/ |
|
|
|
private Result<UserResiInfoDTO> getGroupLeaderUserInfo(String groupId) { |
|
|
|
//群主名称需要调用feign查询
|
|
|
|
ResiGroupEntity resiGroupEntity = baseDao.selectById(groupId); |
|
|
|
if (null == resiGroupEntity) { |
|
|
|
return new Result<>(); |
|
|
|
} |
|
|
|
ResiGroupMemberDTO groupMemberDTO = baseDao.selectGroupLeader(groupId); |
|
|
|
if (null == groupMemberDTO) { |
|
|
|
return new Result<>(); |
|
|
|
} |
|
|
|
UserResiInfoFormDTO resiUserInfoFormDTO = new UserResiInfoFormDTO(); |
|
|
|
resiUserInfoFormDTO.setCustomerId(resiGroupEntity.getCustomerId()); |
|
|
|
resiUserInfoFormDTO.setUserId(groupMemberDTO.getCustomerUserId()); |
|
|
|
return epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param applyCreateGroupFormDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result |
|
|
@ -232,10 +260,18 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result applyCreateGroup(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { |
|
|
|
//1、插入一条待审核的组信息
|
|
|
|
//1、校验是否同名
|
|
|
|
List<ResiGroupEntity> resiGroupEntityList=this.getResiGroupEntityList(applyCreateGroupFormDTO); |
|
|
|
if(null!=resiGroupEntityList&&resiGroupEntityList.size()>0){ |
|
|
|
Result result=new Result(); |
|
|
|
result.setCode(EpmetErrorCode.GROUP_ALREADY_EXISTED.getValue()); |
|
|
|
result.setMsg(EpmetErrorCode.GROUP_ALREADY_EXISTED.getName()); |
|
|
|
return result; |
|
|
|
} |
|
|
|
//2、插入一条待审核的组信息
|
|
|
|
ResiGroupEntity resiGroupEntity = this.structureResiGroupEntity(applyCreateGroupFormDTO); |
|
|
|
insert(resiGroupEntity); |
|
|
|
//2、插入一条待审核的操作记录
|
|
|
|
//3、插入一条待审核的操作记录
|
|
|
|
ResiGroupOperationDTO resiGroupOperation = new ResiGroupOperationDTO(); |
|
|
|
resiGroupOperation.setResiGroupId(resiGroupEntity.getId()); |
|
|
|
resiGroupOperation.setState(GroupStateConstant.GROUP_UNDER_AUDITTING); |
|
|
@ -244,6 +280,18 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param applyCreateGroupFormDTO |
|
|
|
* @return java.util.List<com.epmet.modules.group.entity.ResiGroupEntity> |
|
|
|
* @Author yinzuomei |
|
|
|
* @Description 查询是否存在相同名字的群 |
|
|
|
* @Date 2020/3/30 16:01 |
|
|
|
**/ |
|
|
|
private List<ResiGroupEntity> getResiGroupEntityList(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { |
|
|
|
List<ResiGroupEntity> list = baseDao.checkResiGroupName(applyCreateGroupFormDTO); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param applyJoinGroupFormDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result |
|
|
@ -253,14 +301,10 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result applyJoinGroup(ApplyJoinGroupFormDTO applyJoinGroupFormDTO) { |
|
|
|
ResiGroupDTO resiGroupDTO = this.get(applyJoinGroupFormDTO.getGroupId()); |
|
|
|
if (null == resiGroupDTO) { |
|
|
|
return new Result().error(ModuleConstant.QUERY_GROUPINFO_FAILED); |
|
|
|
} |
|
|
|
//插入一条待审核的记录
|
|
|
|
GroupMemeberOperationDTO groupMemeberOperation = new GroupMemeberOperationDTO(); |
|
|
|
groupMemeberOperation.setGroupId(resiGroupDTO.getId()); |
|
|
|
groupMemeberOperation.setCustomerUserId(resiGroupDTO.getCustomerId()); |
|
|
|
groupMemeberOperation.setGroupId(applyJoinGroupFormDTO.getGroupId()); |
|
|
|
groupMemeberOperation.setCustomerUserId(applyJoinGroupFormDTO.getUserId()); |
|
|
|
groupMemeberOperation.setGroupId(applyJoinGroupFormDTO.getGroupId()); |
|
|
|
groupMemeberOperation.setOperateDes(applyJoinGroupFormDTO.getOperateDes()); |
|
|
|
groupMemeberOperation.setOperateStatus(MemberStateConstant.UNDER_AUDITTING); |
|
|
@ -270,16 +314,29 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param resiUserInfoFormDTO |
|
|
|
* @return com.epmet.commons.tools.utils.Result |
|
|
|
* @Author yinzuomei |
|
|
|
* @Description 加入小组界面初始化 |
|
|
|
* @Date 2020/3/30 10:17 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result initApplyGroup(UserResiInfoFormDTO resiUserInfoFormDTO) { |
|
|
|
if (StringUtils.isNotBlank(resiUserInfoFormDTO.getUserId()) && StringUtils.isNotBlank(resiUserInfoFormDTO.getCustomerId())) { |
|
|
|
Result<UserResiInfoDTO> result = epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO); |
|
|
|
if (!result.success() || null == result.getData()) { |
|
|
|
return new Result().error(ModuleConstant.NOT_REGISTERED); |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
if (StringUtils.isBlank(resiUserInfoFormDTO.getCustomerId())) { |
|
|
|
return new Result().error(ModuleConstant.CUSTOMERID_NOT_NULL); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(resiUserInfoFormDTO.getUserId())) { |
|
|
|
return new Result().error(ModuleConstant.USER_NOT_NULL); |
|
|
|
} |
|
|
|
return new Result().error(ModuleConstant.USER_NOT_NULL); |
|
|
|
Result<UserResiInfoDTO> result = epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO); |
|
|
|
if (!result.success() || null == result.getData() || StringUtils.isBlank(result.getData().getRegMobile())) { |
|
|
|
Result errorResult=new Result(); |
|
|
|
result.setCode(EpmetErrorCode.CANNOT_JOIN_GROUP.getValue()); |
|
|
|
result.setMsg(EpmetErrorCode.CANNOT_JOIN_GROUP.getName()); |
|
|
|
return errorResult; |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
private ResiGroupEntity structureResiGroupEntity(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { |
|
|
@ -294,4 +351,23 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
return resiGroupEntity; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDto |
|
|
|
* @param customerId |
|
|
|
* @return com.epmet.commons.tools.utils.Result |
|
|
|
* @Author yinzuomei |
|
|
|
* @Description 校验用户是否是热心居民或者党员 |
|
|
|
* @Date 2020/3/30 15:50 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result initApplyCreatedGroup(TokenDto tokenDto, String customerId) { |
|
|
|
if (StringUtils.isBlank(customerId)) { |
|
|
|
return new Result().error(ModuleConstant.CUSTOMERID_NOT_NULL); |
|
|
|
} |
|
|
|
if (null == tokenDto || StringUtils.isBlank(tokenDto.getUserId())) { |
|
|
|
return new Result().error(ModuleConstant.USER_NOT_NULL); |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|