package com.stylefeng.guns.modular.system.controller;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.baomidou.mybatisplus.plugins.Page;
|
import com.stylefeng.guns.core.base.controller.BaseController;
|
import com.stylefeng.guns.core.util.ToolUtil;
|
import com.stylefeng.guns.modular.system.model.TClaim;
|
import com.stylefeng.guns.modular.system.model.TClaimList;
|
import com.stylefeng.guns.modular.system.model.TClaimVo;
|
import com.stylefeng.guns.modular.system.service.ITClaimService;
|
import com.stylefeng.guns.modular.system.utils.tips.ErrorTip;
|
import com.stylefeng.guns.modular.system.utils.tips.SuccessTip;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
/**
|
* 控制器
|
*
|
* @author fengshuonan
|
* @Date 2023-02-06 09:03:27
|
*/
|
@Controller
|
@Api(tags = "用户端--投诉信息")
|
@RequestMapping("/api/tClaim")
|
public class TClaimController extends BaseController {
|
|
|
@Autowired
|
private ITClaimService tClaimService;
|
|
|
|
|
|
/**
|
* 获取列表
|
*/
|
@ApiOperation(value = "用户端-投诉信息列表",notes="用户端-投诉信息列表")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"),
|
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"),
|
@ApiImplicitParam(name = "time", value = "时间 (时间 - 时间)", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "state", value = "处理状态 1 未处理 2已处理", required = false, dataType = "int"),
|
@ApiImplicitParam(name = "orderId", value = "订单id", required = false, dataType = "Long"),
|
@ApiImplicitParam(name = "id", value = "用户id", required = true, dataType = "int"),
|
})
|
@GetMapping(value = "/list")
|
@ResponseBody
|
public Object list(int pageNumber,int pageSize,String time,Integer state,Long orderId,int id) {
|
Page<TClaim> tClaimListPage = new Page<>(pageNumber, pageSize);
|
EntityWrapper<TClaim> tClaimEntityWrapper = new EntityWrapper<>();
|
tClaimEntityWrapper.eq("user_id",id);
|
if(ToolUtil.isNotEmpty(time)){
|
String sTime =time.split(" - ")[0]+" 00:00:01";
|
String eTime =time.split(" - ")[1]+" 23:59:59";
|
tClaimEntityWrapper.between("create_time",sTime,eTime);
|
}
|
if(ToolUtil.isNotEmpty(state)){
|
tClaimEntityWrapper.eq("status",state);
|
}
|
if(ToolUtil.isNotEmpty(orderId)){
|
tClaimEntityWrapper.like("order_id", String.valueOf(orderId));
|
}
|
Page<TClaim> tClaimPage = tClaimService.selectPage(tClaimListPage, tClaimEntityWrapper);
|
return new SuccessTip(tClaimPage);
|
}
|
|
|
@ApiOperation(value = "投诉信息详情",notes="投诉信息详情")
|
@PostMapping(value = "/getClaimInfo")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int"),
|
})
|
@ResponseBody
|
public Object getClaimInfo(Integer id) {
|
TClaimVo claimVo = tClaimService.getClaimInfo(id);
|
return new SuccessTip(claimVo);
|
}
|
|
|
@ApiOperation(value = "删除投诉信息",notes="删除投诉信息")
|
@PostMapping(value = "/deleteClaim")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int"),
|
})
|
@ResponseBody
|
public Object deleteClaim(Integer id) {
|
try {
|
tClaimService.deleteById(id);
|
tClaimService.deleteFile(id);
|
return new SuccessTip();
|
}catch (Exception e){
|
e.printStackTrace();
|
return new ErrorTip(500,"ERROR");
|
}
|
}
|
|
}
|