Browse Source

居民端-我的建议列表

dev_shibei_match
liushaowen 5 years ago
parent
commit
079d9f2a26
  1. 30
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyAdviceListResultDTO.java
  2. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java

30
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MyAdviceListResultDTO.java

@ -0,0 +1,30 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: liushaowen
* @date: 2020/11/9 17:21
*/
@Data
public class MyAdviceListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String adviceContent;
private List<String> imgList;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date adviceTime;
private String replyContent;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date replyTime;
}

30
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java

@ -32,6 +32,7 @@ import com.epmet.dto.form.AdviceListFormDTO;
import com.epmet.dto.form.ReplyAdviceFormDTO;
import com.epmet.dto.result.AdviceDetailResultDTO;
import com.epmet.dto.result.AdviceListResultDTO;
import com.epmet.dto.result.MyAdviceListResultDTO;
import com.epmet.excel.UserAdviceExcel;
import com.epmet.service.UserAdviceService;
import org.apache.commons.lang3.StringUtils;
@ -60,19 +61,19 @@ public class UserAdviceController {
private LoginUserUtil loginUserUtil;
@GetMapping("page")
public Result<PageData<UserAdviceDTO>> page(@RequestParam Map<String, Object> params){
public Result<PageData<UserAdviceDTO>> page(@RequestParam Map<String, Object> params) {
PageData<UserAdviceDTO> page = userAdviceService.page(params);
return new Result<PageData<UserAdviceDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<UserAdviceDTO> get(@PathVariable("id") String id){
public Result<UserAdviceDTO> get(@PathVariable("id") String id) {
UserAdviceDTO data = userAdviceService.get(id);
return new Result<UserAdviceDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody UserAdviceDTO dto){
public Result save(@RequestBody UserAdviceDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
userAdviceService.save(dto);
@ -80,7 +81,7 @@ public class UserAdviceController {
}
@PutMapping
public Result update(@RequestBody UserAdviceDTO dto){
public Result update(@RequestBody UserAdviceDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
userAdviceService.update(dto);
@ -88,7 +89,7 @@ public class UserAdviceController {
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
userAdviceService.delete(ids);
@ -102,29 +103,34 @@ public class UserAdviceController {
}
@PostMapping("replyadvice")
public Result replyAdvice(@RequestBody ReplyAdviceFormDTO dto){
public Result replyAdvice(@RequestBody ReplyAdviceFormDTO dto) {
ValidatorUtils.validateEntity(dto);
userAdviceService.replyAdvice(dto,loginUserUtil.getLoginUserId());
userAdviceService.replyAdvice(dto, loginUserUtil.getLoginUserId());
return new Result();
}
@PostMapping("advicedetail")
public Result adviceDetail(String adviceId){
if (StringUtils.isBlank(adviceId)){
public Result adviceDetail(String adviceId) {
if (StringUtils.isBlank(adviceId)) {
throw new RenException("adviceId不能为空");
}
return new Result<AdviceDetailResultDTO>().ok(userAdviceService.adviceDetail(adviceId));
}
@PostMapping("advicelist")
public Result<PageData<AdviceListResultDTO>> adviceList(@RequestBody AdviceListFormDTO dto){
public Result<PageData<AdviceListResultDTO>> adviceList(@RequestBody AdviceListFormDTO dto) {
ValidatorUtils.validateEntity(dto);
if (dto.getStartTime()!=null && dto.getEndTime()!=null){
if (dto.getStartTime().after(dto.getEndTime())){
if (dto.getStartTime() != null && dto.getEndTime() != null) {
if (dto.getStartTime().after(dto.getEndTime())) {
throw new RenException("开始时间不能大于结束时间");
}
}
PageData<AdviceListResultDTO> page = userAdviceService.adviceList(dto);
return new Result<PageData<AdviceListResultDTO>>().ok(page);
}
@PostMapping("myadvicelist")
public Result<List<MyAdviceListResultDTO>> myAdviceList(String pageSize, String pageNo) {
return null;
}
}

Loading…
Cancel
Save