|
|
@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|