| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | |
| | | @RequestParam(required = false) Integer pageSize, |
| | | @RequestParam(required = false) String clientName, |
| | | @RequestParam(required = false) Integer status, |
| | | @RequestParam(required = false) String createTime) { |
| | | @RequestParam(required = false) String timeRange) { |
| | | |
| | | LambdaQueryWrapper<Orders> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Orders::getDel_flag, 0); |
| | |
| | | if (status != null) { |
| | | queryWrapper.eq(Orders::getStatus, status); |
| | | } |
| | | if (createTime != null) { |
| | | queryWrapper.like(Orders::getCreate_time, createTime); |
| | | } |
| | | // 改造时间筛选逻辑 |
| | | if (timeRange != null && !timeRange.trim().isEmpty()) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime startTime = null; |
| | | |
| | | switch (timeRange.trim()) { |
| | | case "week": |
| | | startTime = now.minusWeeks(1); |
| | | break; |
| | | case "month": |
| | | startTime = now.minusMonths(1); |
| | | break; |
| | | case "threeMonths": |
| | | startTime = now.minusMonths(3); |
| | | break; |
| | | case "year": |
| | | startTime = now.minusYears(1); |
| | | break; |
| | | default: |
| | | // 可添加日志记录无效参数 |
| | | break; |
| | | } |
| | | if (startTime != null) { |
| | | queryWrapper.ge(Orders::getCreate_time, startTime); |
| | | } |
| | | } |
| | | // 排序 |
| | | queryWrapper.orderByDesc(Orders::getCreate_time); |
| | | // 分页查询 |
| | | if (pageNum != null && pageSize != null) { |
| | | Page<Orders> pageInfo = new Page<>(pageNum, pageSize); |
| | |
| | | return ResponseResult.success(page); |
| | | } |
| | | |
| | | /** |
| | | * 获取客户列表 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @GetMapping("/clientList") |
| | | @ApiOperation("获取客户列表") |
| | | public ResponseResult<CustomPage<String>> getClientList(@RequestParam(required = false) String clientName, |
| | | @RequestParam(required = false,defaultValue = "1") Integer pageNum, |
| | | @RequestParam(required = false, defaultValue = "10") Integer pageSize) { |
| | | |
| | | Page<String> result = orderService.getClientList(clientName,pageNum, pageSize); |
| | | |
| | | |
| | | return ResponseResult.success(new CustomPage<>( result)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/{orderId}/keywordList") |
| | | @ApiOperation("获取订单关联的关键词及提问词") |
| | | public ResponseResult<List<KeywordDto>> getKeywordList(@PathVariable String orderId) { |
| | | public ResponseResult<List<KeywordDto>> getKeywordList(@PathVariable String orderId){ |
| | | List<KeywordDto> result = orderService.getKeywordListByOrderId(orderId); |
| | | return ResponseResult.success(result); |
| | | } |