Commit f0ada315 authored by shiyu's avatar shiyu

修改、删除笔记

parent 4eb8fd56
...@@ -82,8 +82,6 @@ public class QdUserServiceImpl implements QdUserService { ...@@ -82,8 +82,6 @@ public class QdUserServiceImpl implements QdUserService {
@Autowired @Autowired
StorageService storageService; StorageService storageService;
@Override @Override
public Result regCaptcha(QdUserRequestDto dto) { public Result regCaptcha(QdUserRequestDto dto) {
try { try {
......
...@@ -8,6 +8,7 @@ import com.wwdz.ch.db.domain.qiandao.QdUser; ...@@ -8,6 +8,7 @@ import com.wwdz.ch.db.domain.qiandao.QdUser;
import com.wwdz.ch.db.domain.qiandao.QdUserSignInNote; import com.wwdz.ch.db.domain.qiandao.QdUserSignInNote;
import com.wwdz.ch.db.domain.qiandao.SignInTask; import com.wwdz.ch.db.domain.qiandao.SignInTask;
import com.wwdz.ch.db.dto.request.qiandao.QdUserSignInNoteRequestDto; import com.wwdz.ch.db.dto.request.qiandao.QdUserSignInNoteRequestDto;
import com.wwdz.ch.db.dto.request.qiandao.QdUserSignInRequestDto;
import com.wwdz.ch.wx.entity.vo.qiandao.QdSignInNoteVo; import com.wwdz.ch.wx.entity.vo.qiandao.QdSignInNoteVo;
import com.wwdz.ch.wx.service.qiandao.QdUserSignInNoteService; import com.wwdz.ch.wx.service.qiandao.QdUserSignInNoteService;
import com.xxdxxs.utils.EntityMapper; import com.xxdxxs.utils.EntityMapper;
...@@ -137,4 +138,40 @@ public class QdUserSignInNoteServiceImpl implements QdUserSignInNoteService { ...@@ -137,4 +138,40 @@ public class QdUserSignInNoteServiceImpl implements QdUserSignInNoteService {
} }
return Result.failed(); return Result.failed();
} }
@Override
public Result delete(QdUserSignInNoteRequestDto dto) {
try {
QdUserSignInNote qdUserSignInNote = new QdUserSignInNote();
qdUserSignInNote.setId(dto.getId());
qdUserSignInNote.setUpdateTime(new Date());
qdUserSignInNote.setIsDeleted(true);
qdUserSignInNoteDao.updateByPrimaryKey(qdUserSignInNote);
return Result.success();
} catch (Exception e) {
logger.error("删除笔记 error:{}", e);
}
return Result.failed();
}
@Override
public Result update(QdUserSignInRequestDto dto) {
try {
//保存签到笔记
QdUserSignInNote qdUserSignInNote = new QdUserSignInNote();
qdUserSignInNote.setTitle(dto.getTitle());
qdUserSignInNote.setContent(dto.getContent());
qdUserSignInNote.setImage(String.join(";", dto.getImages()));
qdUserSignInNote.setAudio(dto.getAudio());
qdUserSignInNote.setUpdateTime(new Date());
qdUserSignInNote.setIsPrivate(dto.getIsPrivate());
qdUserSignInNoteDao.updateByPrimaryKey(qdUserSignInNote);
return Result.success();
} catch (Exception e) {
logger.error("修改笔记 error:{}", e);
}
return Result.failed();
}
} }
...@@ -2,6 +2,7 @@ package com.wwdz.ch.wx.service.qiandao; ...@@ -2,6 +2,7 @@ package com.wwdz.ch.wx.service.qiandao;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.qiandao.QdUserSignInNoteRequestDto; import com.wwdz.ch.db.dto.request.qiandao.QdUserSignInNoteRequestDto;
import com.wwdz.ch.db.dto.request.qiandao.QdUserSignInRequestDto;
/** /**
* 用户签到笔记 * 用户签到笔记
...@@ -21,4 +22,20 @@ public interface QdUserSignInNoteService { ...@@ -21,4 +22,20 @@ public interface QdUserSignInNoteService {
* @return * @return
*/ */
Result findDetail(QdUserSignInNoteRequestDto dto); Result findDetail(QdUserSignInNoteRequestDto dto);
/**
* 删除笔记
* @param dto
* @return
*/
Result delete(QdUserSignInNoteRequestDto dto);
/**
* 修改笔记
* @param dto
* @return
*/
Result update(QdUserSignInRequestDto dto);
} }
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.consts.ResultCode; import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.qiandao.QdUserSignInNoteRequestDto; import com.wwdz.ch.db.dto.request.qiandao.QdUserSignInNoteRequestDto;
import com.wwdz.ch.db.dto.request.qiandao.QdUserSignInRequestDto;
import com.wwdz.ch.wx.entity.request.QdHomePageRequestDto; import com.wwdz.ch.wx.entity.request.QdHomePageRequestDto;
import com.wwdz.ch.wx.service.qiandao.QdHomePageService; import com.wwdz.ch.wx.service.qiandao.QdHomePageService;
import com.wwdz.ch.wx.service.qiandao.QdUserSignInNoteService; import com.wwdz.ch.wx.service.qiandao.QdUserSignInNoteService;
...@@ -44,4 +45,26 @@ public class QdUserSignInNoteController { ...@@ -44,4 +45,26 @@ public class QdUserSignInNoteController {
return qdUserSignInNoteService.findDetail(dto); return qdUserSignInNoteService.findDetail(dto);
} }
@ApiOperation(value = "删除笔记")
@PostMapping("/delete")
public Result delete(@RequestBody QdUserSignInNoteRequestDto dto) {
logger.info("【请求开始】删除笔记,请求参数:{}", JSON.toJSONString(dto));
if (dto.getId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return qdUserSignInNoteService.delete(dto);
}
@ApiOperation(value = "修改笔记")
@PostMapping("/update")
public Result update(@RequestBody QdUserSignInRequestDto dto) {
logger.info("【请求开始】修改笔记,请求参数:{}", JSON.toJSONString(dto));
if (dto.getId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return qdUserSignInNoteService.update(dto);
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment