完成小红书登陆注册
This commit is contained in:
parent
5642cd9613
commit
cb7fde76d7
@ -10,6 +10,10 @@ import com.dd.admin.business.note.domain.NoteDto;
|
||||
import com.dd.admin.business.note.domain.NoteVo;
|
||||
import com.dd.admin.business.note.entity.Note;
|
||||
import com.dd.admin.business.note.service.NoteService;
|
||||
import com.dd.admin.business.noteImg.domain.NoteImgDto;
|
||||
import com.dd.admin.business.noteImg.domain.NoteImgVo;
|
||||
import com.dd.admin.business.noteImg.entity.NoteImg;
|
||||
import com.dd.admin.business.noteImg.service.NoteImgService;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperLog;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperType;
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
@ -31,6 +35,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
public class ApiController {
|
||||
@ -38,6 +43,8 @@ public class ApiController {
|
||||
NoteService noteService;
|
||||
@Autowired
|
||||
HttpServletRequest request;
|
||||
@Autowired
|
||||
NoteImgService noteImgService;
|
||||
|
||||
@ApiOperation(value = "获取所有笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@ -56,10 +63,11 @@ public class ApiController {
|
||||
Note note = noteService.getById(noteDto.getNoteId());
|
||||
NoteVo noteVo = BeanUtil.copyProperties(note, NoteVo.class);
|
||||
noteVo.setCreateTimeStr(noteVo.getCreateTime());
|
||||
List<String> imageList = new ArrayList<>();
|
||||
imageList.add(noteVo.getFirstPicture());
|
||||
imageList.add(noteVo.getAuthorAvatar());
|
||||
|
||||
NoteImgDto noteImgDto = new NoteImgDto();
|
||||
noteImgDto.setNoteId(note.getNoteId());
|
||||
List<NoteImgVo> noteImgVos = noteImgService.selectNoteImgList(noteImgDto);
|
||||
List<String> imageList = noteImgVos.stream().map(NoteImgVo::getImgUrl).collect(Collectors.toList());
|
||||
noteVo.setImgList(imageList);
|
||||
return ResultBean.success(noteVo);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import com.dd.admin.common.utils.IPUtils;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -40,6 +41,8 @@ public class AuthApi {
|
||||
FileService fileService;
|
||||
@Autowired
|
||||
NoteImgService noteImgService;
|
||||
@Value("${server.port}")
|
||||
String port;
|
||||
|
||||
@ApiOperation(value = "获取博主信息")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@ -76,13 +79,16 @@ public class AuthApi {
|
||||
noteImg.setNoteId(note.getNoteId());
|
||||
noteImg.setImgSort(i);
|
||||
File file = fileService.selectFileByFileId(imgs.get(i));
|
||||
noteImg.setImgUrl(file.getFilePath());
|
||||
String serverName = request.getServerName();
|
||||
System.out.println(serverName);
|
||||
noteImg.setImgUrl("http://" + serverName + ":" + port + file.getFilePath());
|
||||
noteImgList.add(noteImg);
|
||||
}
|
||||
noteImgService.saveBatch(noteImgList);
|
||||
|
||||
note.setFirstPicture(noteImgList.get(0).getImgUrl());
|
||||
noteService.updateById(note);
|
||||
Note updateNote = noteService.getById(note.getNoteId());
|
||||
updateNote.setFirstPicture(noteImgList.get(0).getImgUrl());
|
||||
noteService.updateById(updateNote);
|
||||
return ResultBean.success();
|
||||
}
|
||||
}
|
||||
|
@ -29,5 +29,9 @@
|
||||
select
|
||||
*
|
||||
from business_note_img where 1 = 1
|
||||
<if test="noteImgDto.noteId != null and noteImgDto.noteId != ''">
|
||||
and note_id = #{noteImgDto.noteId}
|
||||
</if>
|
||||
order by IMG_SORT asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -66,6 +66,7 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
JwtUser jwtUser = SecurityUtil.getLoginUser();
|
||||
|
||||
try {
|
||||
String updateId = String.valueOf(getFieldValByName("updateId",metaObject));
|
||||
if(StringUtil.isEmpty(updateId)){
|
||||
this.strictUpdateFill(metaObject, "updateId", String.class, jwtUser.getUserId()); // 起始版本 3.3.0(推荐使用)
|
||||
@ -75,5 +76,9 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
if(StringUtil.isEmpty(updateName)){
|
||||
this.strictUpdateFill(metaObject, "updateName", String.class, jwtUser.getUsername()); // 起始版本 3.3.0(推荐使用)
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,12 @@ spring:
|
||||
enabled: true #默认支持文件上传
|
||||
max-file-size: -1 #不做限制
|
||||
max-request-size: 1 #不做限制
|
||||
|
||||
redis:
|
||||
# Redis数据库索引(默认为0)
|
||||
database: 1
|
||||
# Redis服务器地址
|
||||
host: localhost
|
||||
password: wxlwxl12
|
||||
datasource:
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
url: jdbc:p6spy:mysql://127.0.0.1:3306/ddxhs?useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
|
Loading…
x
Reference in New Issue
Block a user