完成小红书登陆注册
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.domain.NoteVo;
|
||||||
import com.dd.admin.business.note.entity.Note;
|
import com.dd.admin.business.note.entity.Note;
|
||||||
import com.dd.admin.business.note.service.NoteService;
|
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.OperLog;
|
||||||
import com.dd.admin.common.aop.operationLog.aop.OperType;
|
import com.dd.admin.common.aop.operationLog.aop.OperType;
|
||||||
import com.dd.admin.common.model.result.ResultBean;
|
import com.dd.admin.common.model.result.ResultBean;
|
||||||
@ -31,6 +35,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class ApiController {
|
public class ApiController {
|
||||||
@ -38,6 +43,8 @@ public class ApiController {
|
|||||||
NoteService noteService;
|
NoteService noteService;
|
||||||
@Autowired
|
@Autowired
|
||||||
HttpServletRequest request;
|
HttpServletRequest request;
|
||||||
|
@Autowired
|
||||||
|
NoteImgService noteImgService;
|
||||||
|
|
||||||
@ApiOperation(value = "获取所有笔记")
|
@ApiOperation(value = "获取所有笔记")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@ -56,10 +63,11 @@ public class ApiController {
|
|||||||
Note note = noteService.getById(noteDto.getNoteId());
|
Note note = noteService.getById(noteDto.getNoteId());
|
||||||
NoteVo noteVo = BeanUtil.copyProperties(note, NoteVo.class);
|
NoteVo noteVo = BeanUtil.copyProperties(note, NoteVo.class);
|
||||||
noteVo.setCreateTimeStr(noteVo.getCreateTime());
|
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);
|
noteVo.setImgList(imageList);
|
||||||
return ResultBean.success(noteVo);
|
return ResultBean.success(noteVo);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import com.dd.admin.common.utils.IPUtils;
|
|||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -40,6 +41,8 @@ public class AuthApi {
|
|||||||
FileService fileService;
|
FileService fileService;
|
||||||
@Autowired
|
@Autowired
|
||||||
NoteImgService noteImgService;
|
NoteImgService noteImgService;
|
||||||
|
@Value("${server.port}")
|
||||||
|
String port;
|
||||||
|
|
||||||
@ApiOperation(value = "获取博主信息")
|
@ApiOperation(value = "获取博主信息")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@ -76,13 +79,16 @@ public class AuthApi {
|
|||||||
noteImg.setNoteId(note.getNoteId());
|
noteImg.setNoteId(note.getNoteId());
|
||||||
noteImg.setImgSort(i);
|
noteImg.setImgSort(i);
|
||||||
File file = fileService.selectFileByFileId(imgs.get(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);
|
noteImgList.add(noteImg);
|
||||||
}
|
}
|
||||||
noteImgService.saveBatch(noteImgList);
|
noteImgService.saveBatch(noteImgList);
|
||||||
|
|
||||||
note.setFirstPicture(noteImgList.get(0).getImgUrl());
|
Note updateNote = noteService.getById(note.getNoteId());
|
||||||
noteService.updateById(note);
|
updateNote.setFirstPicture(noteImgList.get(0).getImgUrl());
|
||||||
|
noteService.updateById(updateNote);
|
||||||
return ResultBean.success();
|
return ResultBean.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,5 +29,9 @@
|
|||||||
select
|
select
|
||||||
*
|
*
|
||||||
from business_note_img where 1 = 1
|
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>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -66,14 +66,19 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
|||||||
|
|
||||||
JwtUser jwtUser = SecurityUtil.getLoginUser();
|
JwtUser jwtUser = SecurityUtil.getLoginUser();
|
||||||
|
|
||||||
String updateId = String.valueOf(getFieldValByName("updateId",metaObject));
|
try {
|
||||||
if(StringUtil.isEmpty(updateId)){
|
String updateId = String.valueOf(getFieldValByName("updateId",metaObject));
|
||||||
this.strictUpdateFill(metaObject, "updateId", String.class, jwtUser.getUserId()); // 起始版本 3.3.0(推荐使用)
|
if(StringUtil.isEmpty(updateId)){
|
||||||
|
this.strictUpdateFill(metaObject, "updateId", String.class, jwtUser.getUserId()); // 起始版本 3.3.0(推荐使用)
|
||||||
|
}
|
||||||
|
|
||||||
|
String updateName = String.valueOf(getFieldValByName("updateName",metaObject));
|
||||||
|
if(StringUtil.isEmpty(updateName)){
|
||||||
|
this.strictUpdateFill(metaObject, "updateName", String.class, jwtUser.getUsername()); // 起始版本 3.3.0(推荐使用)
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String updateName = String.valueOf(getFieldValByName("updateName",metaObject));
|
|
||||||
if(StringUtil.isEmpty(updateName)){
|
|
||||||
this.strictUpdateFill(metaObject, "updateName", String.class, jwtUser.getUsername()); // 起始版本 3.3.0(推荐使用)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,12 @@ spring:
|
|||||||
enabled: true #默认支持文件上传
|
enabled: true #默认支持文件上传
|
||||||
max-file-size: -1 #不做限制
|
max-file-size: -1 #不做限制
|
||||||
max-request-size: 1 #不做限制
|
max-request-size: 1 #不做限制
|
||||||
|
redis:
|
||||||
|
# Redis数据库索引(默认为0)
|
||||||
|
database: 1
|
||||||
|
# Redis服务器地址
|
||||||
|
host: localhost
|
||||||
|
password: wxlwxl12
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
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
|
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