Browse Source

修改群介绍接口 init

dev
liuchuang 6 years ago
parent
commit
45ce75e63b
  1. 15
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiGroupController.java
  2. 13
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/GroupFeignClient.java
  3. 6
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/GroupFeignClientFallback.java
  4. 13
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/GroupService.java
  5. 14
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/GroupServiceImpl.java
  6. 38
      esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/group/form/GroupIntroductionFormDTO.java
  7. 16
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/controller/AppGroupController.java
  8. 11
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/UserGroupDao.java
  9. 12
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/GroupService.java
  10. 11
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/UserGroupService.java
  11. 17
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.java
  12. 5
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/UserGroupServiceImpl.java
  13. 19
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/UserGroupDao.xml

15
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiGroupController.java

@ -5,6 +5,7 @@ import com.elink.esua.epdc.commons.tools.annotation.LoginUser;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.group.GroupSettingStateDTO;
import com.elink.esua.epdc.dto.group.form.GroupCreateFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupIntroductionFormDTO;
import com.elink.esua.epdc.dto.group.result.GroupDetailForMobileEndResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupsOfMineResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupsOfRecommendResultDTO;
@ -98,4 +99,18 @@ public class ApiGroupController {
return groupService.getGroupDetail(userDetail, id);
}
/**
*
* 修改群介绍
*
* @params [userDetail, formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author liuchuang
* @since 2019/10/22 15:33
*/
@PostMapping("modifyIntroduction")
public Result modifyIntroduction(@LoginUser TokenDto userDetail, @RequestBody GroupIntroductionFormDTO formDto) {
return groupService.modifyIntroduction(userDetail, formDto);
}
}

13
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/GroupFeignClient.java

@ -5,6 +5,7 @@ import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.group.GroupSettingStateDTO;
import com.elink.esua.epdc.dto.group.form.GroupCreateFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupDetailForMobileEndFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupIntroductionFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupsOfMineFormDTO;
import com.elink.esua.epdc.dto.group.result.GroupDetailForMobileEndResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupsOfMineResultDTO;
@ -86,4 +87,16 @@ public interface GroupFeignClient {
*/
@GetMapping(value = "group/epdc-app/group/detail", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<GroupDetailForMobileEndResultDTO> detail(GroupDetailForMobileEndFormDTO formDto);
/**
*
* 修改群介绍
*
* @params [formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author liuchuang
* @since 2019/10/22 15:36
*/
@PostMapping(value = "group/epdc-app/group/modifyIntroduction", consumes = MediaType.APPLICATION_JSON_VALUE)
Result modifyIntroduction(GroupIntroductionFormDTO formDto);
}

6
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/GroupFeignClientFallback.java

@ -6,6 +6,7 @@ import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.group.GroupSettingStateDTO;
import com.elink.esua.epdc.dto.group.form.GroupCreateFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupDetailForMobileEndFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupIntroductionFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupsOfMineFormDTO;
import com.elink.esua.epdc.dto.group.result.GroupDetailForMobileEndResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupsOfMineResultDTO;
@ -46,4 +47,9 @@ public class GroupFeignClientFallback implements GroupFeignClient {
public Result<GroupDetailForMobileEndResultDTO> detail(GroupDetailForMobileEndFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_GROUP_SERVER, "detail", formDto);
}
@Override
public Result modifyIntroduction(GroupIntroductionFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_GROUP_SERVER, "modifyIntroduction", formDto);
}
}

13
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/GroupService.java

@ -4,6 +4,7 @@ import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.group.GroupSettingStateDTO;
import com.elink.esua.epdc.dto.group.form.GroupCreateFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupIntroductionFormDTO;
import com.elink.esua.epdc.dto.group.result.GroupDetailForMobileEndResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupsOfMineResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupsOfRecommendResultDTO;
@ -73,4 +74,16 @@ public interface GroupService {
* @since 2019/10/22 15:15
*/
Result<GroupDetailForMobileEndResultDTO> getGroupDetail(TokenDto userDetail, String id);
/**
*
* 修改群介绍
*
* @params [userDetail, formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author liuchuang
* @since 2019/10/22 15:34
*/
Result modifyIntroduction(TokenDto userDetail, GroupIntroductionFormDTO formDto);
}

14
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/GroupServiceImpl.java

@ -7,10 +7,7 @@ import com.elink.esua.epdc.dto.CompleteDeptDTO;
import com.elink.esua.epdc.dto.group.GroupSettingStateDTO;
import com.elink.esua.epdc.dto.enums.GroupStateEnum;
import com.elink.esua.epdc.dto.enums.GroupUserStateEnum;
import com.elink.esua.epdc.dto.group.form.GroupCreateFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupDetailForMobileEndFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupUserFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupsOfMineFormDTO;
import com.elink.esua.epdc.dto.group.form.*;
import com.elink.esua.epdc.dto.group.result.GroupDetailForMobileEndResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupsOfMineResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupsOfRecommendResultDTO;
@ -111,4 +108,13 @@ public class GroupServiceImpl implements GroupService {
formDto.setUserId(userDetail.getUserId());
return groupFeignClient.detail(formDto);
}
@Override
public Result modifyIntroduction(TokenDto userDetail, GroupIntroductionFormDTO formDto) {
if (null == userDetail) {
return new Result().error("获取用户信息失败");
}
formDto.setUserId(userDetail.getUserId());
return groupFeignClient.modifyIntroduction(formDto);
}
}

38
esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/group/form/GroupIntroductionFormDTO.java

@ -0,0 +1,38 @@
package com.elink.esua.epdc.dto.group.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
*
* 修改群介绍Form DTO
*
* @Authorliuchuang
* @Date2019/10/22 15:28
*/
@Data
public class GroupIntroductionFormDTO implements Serializable {
private static final long serialVersionUID = -9116266878310792465L;
/**
* 社群ID
*/
@NotBlank(message = "社群ID不能为空")
private String id;
/**
* 社群介绍
*/
@NotBlank(message = "社群介绍不能为空且在500个字以内")
@Size(min = 1, max = 500, message = "社群介绍不能为空且在500个字以内")
private String groupIntroduction;
/**
* 用户ID
*/
@NotBlank(message = "用户ID不能为空")
private String userId;
}

16
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/controller/AppGroupController.java

@ -6,6 +6,7 @@ import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.dto.group.GroupSettingStateDTO;
import com.elink.esua.epdc.dto.group.form.GroupCreateFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupDetailForMobileEndFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupIntroductionFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupsOfMineFormDTO;
import com.elink.esua.epdc.dto.group.result.GroupDetailForMobileEndResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupsOfMineResultDTO;
@ -113,4 +114,19 @@ public class AppGroupController {
return new Result<GroupDetailForMobileEndResultDTO>().ok(resultDto);
}
/**
*
* 修改群介绍
*
* @params [formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author liuchuang
* @since 2019/10/22 15:39
*/
@PostMapping("modifyIntroduction")
public Result modifyIntroduction(@RequestBody GroupIntroductionFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return groupService.modifyIntroduction(formDto);
}
}

11
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/UserGroupDao.java

@ -56,5 +56,16 @@ public interface UserGroupDao extends BaseDao<UserGroupEntity> {
* @since 2019/10/21 11:14
*/
List<GroupUserListResultDTO> selectListOfGroupUsersByState(String groupId, Integer state);
/**
*
* 群主信息
*
* @params [groupId]
* @return com.elink.esua.epdc.dto.group.UserGroupDTO
* @author liuchuang
* @since 2019/10/22 15:57
*/
UserGroupDTO selectOneOfLordInfoByGroupId(String groupId);
}

12
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/GroupService.java

@ -26,6 +26,7 @@ import com.elink.esua.epdc.dto.group.GroupManagementDTO;
import com.elink.esua.epdc.dto.group.GroupSettingStateDTO;
import com.elink.esua.epdc.dto.group.form.GroupCreateFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupDetailForMobileEndFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupIntroductionFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupsOfMineFormDTO;
import com.elink.esua.epdc.dto.group.result.GroupDetailForMobileEndResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupsOfMineResultDTO;
@ -168,4 +169,15 @@ public interface GroupService extends BaseService<GroupEntity> {
* @since 2019/10/22 15:04
*/
GroupDetailForMobileEndResultDTO getGroupDetailForMobileEnd(GroupDetailForMobileEndFormDTO formDto);
/**
*
* 移动端-修改群介绍
*
* @params [userDetail, formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author liuchuang
* @since 2019/10/22 15:34
*/
Result modifyIntroduction(GroupIntroductionFormDTO formDto);
}

11
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/UserGroupService.java

@ -104,4 +104,15 @@ public interface UserGroupService extends BaseService<UserGroupEntity> {
* @since 2019/10/21 11:20
*/
List<GroupUserListResultDTO> listOfUserGroup(String groupId, Integer state);
/**
*
* 群主信息
*
* @params [groupId]
* @return com.elink.esua.epdc.dto.group.UserGroupDTO
* @author liuchuang
* @since 2019/10/22 15:58
*/
UserGroupDTO getLordInfoByGroupId(String groupId);
}

17
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/GroupServiceImpl.java

@ -31,6 +31,7 @@ import com.elink.esua.epdc.dto.enums.GroupStateEnum;
import com.elink.esua.epdc.dto.enums.GroupUserStateEnum;
import com.elink.esua.epdc.dto.group.form.GroupCreateFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupDetailForMobileEndFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupIntroductionFormDTO;
import com.elink.esua.epdc.dto.group.form.GroupsOfMineFormDTO;
import com.elink.esua.epdc.dto.group.result.GroupDetailForMobileEndResultDTO;
import com.elink.esua.epdc.dto.group.result.GroupUserListResultDTO;
@ -218,4 +219,20 @@ public class GroupServiceImpl extends BaseServiceImpl<GroupDao, GroupEntity> imp
return baseDao.selectOneOfGroupDetailForMobileEnd(formDto);
}
@Override
public Result modifyIntroduction(GroupIntroductionFormDTO formDto) {
// 获取群主信息
UserGroupDTO userGroupDTO = userGroupService.getLordInfoByGroupId(formDto.getId());
// 判断当前用户是否为群主
if (!formDto.getUserId().equals(userGroupDTO.getUserId())) {
return new Result().error("操作失败,只有群主可以修改群介绍");
}
GroupEntity entity = new GroupEntity();
entity.setId(formDto.getId());
entity.setGroupIntroduction(formDto.getGroupIntroduction());
baseDao.updateById(entity);
return new Result();
}
}

5
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/service/impl/UserGroupServiceImpl.java

@ -100,4 +100,9 @@ public class UserGroupServiceImpl extends BaseServiceImpl<UserGroupDao, UserGrou
return baseDao.selectListOfGroupUsersByState(groupId, state);
}
@Override
public UserGroupDTO getLordInfoByGroupId(String groupId) {
return baseDao.selectOneOfLordInfoByGroupId(groupId);
}
}

19
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/UserGroupDao.xml

@ -30,4 +30,23 @@
SELECT ID, USER_ID, NICKNAME, USER_AVATAR, LORD_FLAG FROM epdc_user_group WHERE DEL_FLAG = '0' AND STATE = #{state} AND GROUP_ID = #{groupId}
</select>
<select id="selectOneOfLordByGroupId" resultType="com.elink.esua.epdc.dto.group.UserGroupDTO">
SELECT
ID,
GROUP_ID,
USER_ID,
NICKNAME,
USER_AVATAR,
MOBILE,
LORD_FLAG,
PARTY_MEMBER
FROM
epdc_user_group
WHERE
DEL_FLAG = '0'
AND STATE = 10
AND LORD_FLAG = '1'
AND GROUP_ID = #{groupId}
</select>
</mapper>
Loading…
Cancel
Save