| | |
| | | package com.ruoyi.admin.large.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.admin.large.model.AnalysisOrderData; |
| | | import com.ruoyi.admin.large.model.query.OrderDataQuery; |
| | | import com.ruoyi.admin.large.service.AnalysisOrderDataService; |
| | | import com.ruoyi.admin.service.SysUserService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/analysis-order-data") |
| | | public class AnalysisOrderDataController { |
| | | private final AnalysisOrderDataService analysisOrderDataService; |
| | | private final TokenService tokenService; |
| | | private final SysUserService sysUserService; |
| | | |
| | | @Autowired |
| | | public AnalysisOrderDataController(AnalysisOrderDataService analysisOrderDataService, TokenService tokenService, SysUserService sysUserService) { |
| | | this.analysisOrderDataService = analysisOrderDataService; |
| | | this.tokenService = tokenService; |
| | | this.sysUserService = sysUserService; |
| | | } |
| | | |
| | | /** |
| | | * 查询上门回收订单列表 |
| | | */ |
| | | @ApiOperation( value = "查询上门回收订单列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<Page<AnalysisOrderData>> pageList(@RequestBody OrderDataQuery orderDataQuery) { |
| | | Page<AnalysisOrderData> page = analysisOrderDataService.lambdaQuery() |
| | | .like(StringUtils.isNotBlank(orderDataQuery.getOrderChannel()), AnalysisOrderData::getOrderChannel, orderDataQuery.getOrderChannel()) |
| | | .like(StringUtils.isNotBlank(orderDataQuery.getOrderNum()), AnalysisOrderData::getOrderNum, orderDataQuery.getOrderNum()) |
| | | .like(StringUtils.isNotBlank(orderDataQuery.getCity()), AnalysisOrderData::getCity, orderDataQuery.getCity()) |
| | | .like(StringUtils.isNotBlank(orderDataQuery.getOrderCategory()), AnalysisOrderData::getOrderCategory, orderDataQuery.getOrderCategory()) |
| | | .like(StringUtils.isNotBlank(orderDataQuery.getUserName()), AnalysisOrderData::getUserName, orderDataQuery.getUserName()) |
| | | .like(StringUtils.isNotBlank(orderDataQuery.getRecyclePerson()), AnalysisOrderData::getRecyclePerson, orderDataQuery.getRecyclePerson()) |
| | | .eq(Objects.nonNull(orderDataQuery.getState()), AnalysisOrderData::getState, orderDataQuery.getState()) |
| | | .orderByDesc(AnalysisOrderData::getOrderDate) |
| | | .page(Page.of(orderDataQuery.getPageNum(), orderDataQuery.getPageSize())); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | /** |
| | | * 查询上门回收订单列表 |
| | | */ |
| | | @ApiOperation( value = "查询上门回收订单列表-大屏") |
| | | @GetMapping(value = "/list") |
| | | public R<List<AnalysisOrderData>> list() { |
| | | String startTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + " 00:00:00"; |
| | | String endTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + " 23:59:59"; |
| | | List<AnalysisOrderData> list = analysisOrderDataService.list(Wrappers.lambdaQuery(AnalysisOrderData.class) |
| | | .between(AnalysisOrderData::getOrderDate, startTime, endTime) |
| | | .orderByDesc(AnalysisOrderData::getOrderDate)); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改上门回收订单 |
| | | */ |
| | | @ApiOperation( value = "修改上门回收订单") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@RequestBody AnalysisOrderData dto) { |
| | | return R.ok(analysisOrderDataService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 删除上门回收订单 |
| | | */ |
| | | @ApiOperation( value = "删除上门回收订单") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | return R.ok(analysisOrderDataService.removeById(id)); |
| | | } |
| | | } |
| | | |