|
@@ -1,14 +1,17 @@
|
|
|
package com.qmth.sop.server.api;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.sop.business.bean.params.TBDeviceDeliveryParam;
|
|
|
+import com.qmth.sop.business.bean.result.ProjectExchangeResult;
|
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
|
import com.qmth.sop.business.entity.TBDeviceDelivery;
|
|
|
import com.qmth.sop.business.service.TBDeviceDeliveryService;
|
|
|
import com.qmth.sop.common.annotation.OperationLog;
|
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
|
import com.qmth.sop.common.enums.DeviceDeliveryStatusEnum;
|
|
|
+import com.qmth.sop.common.enums.DeviceUsageTypeEnum;
|
|
|
import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.sop.common.enums.LogTypeEnum;
|
|
|
import com.qmth.sop.common.util.Result;
|
|
@@ -22,6 +25,8 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.Max;
|
|
|
+import javax.validation.constraints.Min;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
|
|
@@ -41,16 +46,46 @@ public class TBDeviceDeliveryController {
|
|
|
@Resource
|
|
|
TBDeviceDeliveryService tbDeviceDeliveryService;
|
|
|
|
|
|
- @ApiOperation(value = "设备发货修改接口")
|
|
|
+ @ApiOperation(value = "项目变更计划列表接口")
|
|
|
+ @RequestMapping(value = "/list", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = ProjectExchangeResult.class)})
|
|
|
+ public Result list(@ApiParam(value = "服务单元id") @RequestParam(required = false) Long serviceId,
|
|
|
+ @ApiParam(value = "用途类型") @RequestParam(required = false) DeviceUsageTypeEnum usageType,
|
|
|
+ @ApiParam(value = "项目单号") @RequestParam(required = false) String crmNo,
|
|
|
+ @ApiParam(value = "发货状态") @RequestParam(required = false) DeviceDeliveryStatusEnum status,
|
|
|
+ @ApiParam(value = "发货人id") @RequestParam(required = false) Long deliverUserId,
|
|
|
+ @ApiParam(value = "派单开始时间") @RequestParam(required = false) Long crmStartTime,
|
|
|
+ @ApiParam(value = "派单结束时间") @RequestParam(required = false) Long crmEndTime,
|
|
|
+ @ApiParam(value = "设备序列号") @RequestParam(required = false) String serialNo,
|
|
|
+ @ApiParam(value = "供应商id") @RequestParam(required = false) Long supplierId,
|
|
|
+ @ApiParam(value = "签收开始时间") @RequestParam(required = false) Long receiveStartTime,
|
|
|
+ @ApiParam(value = "签收结束时间") @RequestParam(required = false) Long receiveEndTime,
|
|
|
+ @ApiParam(value = "页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
|
|
|
+ @ApiParam(value = "页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
|
|
|
+ return ResultUtil.ok(tbDeviceDeliveryService.list(new Page<>(pageNumber, pageSize), serviceId, usageType, crmNo, status, deliverUserId, crmStartTime, crmEndTime, serialNo, supplierId, receiveStartTime, receiveEndTime));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "设备发货保存接口")
|
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
|
|
|
- @OperationLog(logType = LogTypeEnum.EDIT)
|
|
|
+ @OperationLog(logType = LogTypeEnum.UPDATE)
|
|
|
@Transactional
|
|
|
public Result save(@Valid @ApiParam(value = "设备发货修改信息", required = true) @RequestBody TBDeviceDelivery tbDeviceDelivery, BindingResult bindingResult) throws Exception {
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
}
|
|
|
- return ResultUtil.ok();
|
|
|
+ return ResultUtil.ok(tbDeviceDeliveryService.saveOrUpdate(tbDeviceDelivery));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "设备发货修改接口")
|
|
|
+ @RequestMapping(value = "/edit", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = TBDeviceDelivery.class)})
|
|
|
+ @OperationLog(logType = LogTypeEnum.EDIT)
|
|
|
+ @Transactional
|
|
|
+ public Result edit(@ApiParam(value = "设备发货id", required = true) @RequestParam Long id) throws Exception {
|
|
|
+ TBDeviceDelivery tbDeviceDelivery = tbDeviceDeliveryService.getById(id);
|
|
|
+ Optional.ofNullable(tbDeviceDelivery).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到设备发货信息"));
|
|
|
+ return ResultUtil.ok(tbDeviceDelivery);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "设备发货状态修改接口")
|