You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-spms-java/src/main/java/com/glxp/api/controller/dev/DeviceRepairController.java

82 lines
2.5 KiB
Java

package com.glxp.api.controller.dev;
import cn.hutool.core.bean.BeanUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.dev.DeviceRepairApplyEntity;
import com.glxp.api.entity.dev.DeviceRepairEntity;
import com.glxp.api.enums.dev.DeviceRepairApplyStatusEnum;
import com.glxp.api.req.dev.*;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.dev.DeviceRepairApplyService;
import com.glxp.api.service.dev.DeviceRepairService;
import com.glxp.api.vo.dev.DeviceRepairApplyVo;
import groovy.util.logging.Slf4j;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@Slf4j
@RestController
@RequestMapping
@RequiredArgsConstructor
public class DeviceRepairController extends BaseController {
private final DeviceRepairService deviceRepairService;
/**
* 我的维修单
*
* @param query
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/udi/device/repair/byUser/page")
public BaseResponse pageByUser(@RequestBody DeviceRepairQuery query) {
AuthAdmin user = super.getUser();
query.setCreateUserId(user.getId());
List<DeviceRepairEntity> list = deviceRepairService.pageList(query);
PageInfo pageInfo = new PageInfo<>(list);
PageSimpleResponse page = new PageSimpleResponse();
page.setTotal(pageInfo.getTotal());
page.setList(pageInfo.getList());
return ResultVOUtils.success(page);
}
/**
* 完成我的维修单
*
* @param deviceRepairEntity
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/udi/device/repair/finishByUser/repairId")
public BaseResponse finishByUser(@RequestBody DeviceRepairEntity deviceRepairEntity) {
AuthAdmin user = super.getUser();
deviceRepairService.finishByUser(deviceRepairEntity, user);
return ResultVOUtils.successMsg("操作成功");
}
/**
* 维修单信息
*
* @param repairId 维修单号
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("/udi/device/repair/info/{repairId}")
public BaseResponse repairInfo(@PathVariable Long repairId) {
DeviceRepairEntity entity = deviceRepairService.getById(repairId);
return ResultVOUtils.success(entity);
}
}