|
|
|
@ -68,6 +68,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.security.acl.Group; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
@ -179,8 +180,13 @@ public class TopicServiceImpl extends BaseServiceImpl<TopicDao, TopicEntity> imp |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result saveTopic(TopicSubmitFormDTO formDto) { |
|
|
|
GroupDTO groupDTO = groupService.get(formDto.getGroupId()); |
|
|
|
|
|
|
|
if (!GroupStateEnum.GROUP_STATE_EXAMINATION_PASSED.getValue().equals(groupDTO.getState())) { |
|
|
|
return new Result().error("社群状态异常,无法发布话题"); |
|
|
|
} |
|
|
|
TopicEntity entity = ConvertUtils.sourceToTarget(formDto, TopicEntity.class); |
|
|
|
entity.setGroupCategory(GroupConstant.PROPERTY_GROUP_CATEGORY); |
|
|
|
entity.setGroupCategory(groupDTO.getGroupCategory()); |
|
|
|
if (insert(entity)) { |
|
|
|
// 保存图片
|
|
|
|
topicImgService.saveImages(formDto.getImages(), entity.getId(), TopicImageConstant.TYPE_IMAGE_BIZ_TOPIC); |
|
|
|
|