|
@@ -4,7 +4,6 @@ package com.qmth.sop.server.api;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.sop.business.bean.params.DeviceDeliveryParam;
|
|
import com.qmth.sop.business.bean.params.DeviceDeliveryParam;
|
|
-import com.qmth.sop.business.bean.params.TBDeviceDeliveryParam;
|
|
|
|
import com.qmth.sop.business.bean.result.ProjectExchangeResult;
|
|
import com.qmth.sop.business.bean.result.ProjectExchangeResult;
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
import com.qmth.sop.business.entity.TBDeviceDelivery;
|
|
import com.qmth.sop.business.entity.TBDeviceDelivery;
|
|
@@ -19,8 +18,8 @@ import com.qmth.sop.common.util.Result;
|
|
import com.qmth.sop.common.util.ResultUtil;
|
|
import com.qmth.sop.common.util.ResultUtil;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -31,6 +30,7 @@ import javax.validation.constraints.Max;
|
|
import javax.validation.constraints.Min;
|
|
import javax.validation.constraints.Min;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -51,20 +51,22 @@ public class TBDeviceDeliveryController {
|
|
@ApiOperation(value = "设备发货列表分页查询")
|
|
@ApiOperation(value = "设备发货列表分页查询")
|
|
@RequestMapping(value = "/page", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/page", method = RequestMethod.POST)
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = ProjectExchangeResult.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = ProjectExchangeResult.class)})
|
|
- public Result list(@ApiParam(value = "服务单元id") @RequestParam(required = false) Long serviceId,
|
|
|
|
|
|
+ public Result list(@ApiParam(value = "服务单元id") @RequestParam(required = false) String serviceId,
|
|
@ApiParam(value = "用途类型") @RequestParam(required = false) DeviceUsageTypeEnum usageType,
|
|
@ApiParam(value = "用途类型") @RequestParam(required = false) DeviceUsageTypeEnum usageType,
|
|
@ApiParam(value = "项目单号") @RequestParam(required = false) String crmNo,
|
|
@ApiParam(value = "项目单号") @RequestParam(required = false) String crmNo,
|
|
@ApiParam(value = "发货状态") @RequestParam(required = false) DeviceDeliveryStatusEnum status,
|
|
@ApiParam(value = "发货状态") @RequestParam(required = false) DeviceDeliveryStatusEnum status,
|
|
- @ApiParam(value = "发货人id") @RequestParam(required = false) Long deliverUserId,
|
|
|
|
|
|
+ @ApiParam(value = "发货人id") @RequestParam(required = false) String deliverUserId,
|
|
@ApiParam(value = "发货开始时间") @RequestParam(required = false) Long deliverStartTime,
|
|
@ApiParam(value = "发货开始时间") @RequestParam(required = false) Long deliverStartTime,
|
|
@ApiParam(value = "发货结束时间") @RequestParam(required = false) Long deliverEndTime,
|
|
@ApiParam(value = "发货结束时间") @RequestParam(required = false) Long deliverEndTime,
|
|
@ApiParam(value = "设备序列号") @RequestParam(required = false) String serialNo,
|
|
@ApiParam(value = "设备序列号") @RequestParam(required = false) String serialNo,
|
|
- @ApiParam(value = "供应商id") @RequestParam(required = false) Long supplierId,
|
|
|
|
|
|
+ @ApiParam(value = "供应商id") @RequestParam(required = false) String supplierId,
|
|
@ApiParam(value = "签收开始时间") @RequestParam(required = false) Long receiveStartTime,
|
|
@ApiParam(value = "签收开始时间") @RequestParam(required = false) Long receiveStartTime,
|
|
@ApiParam(value = "签收结束时间") @RequestParam(required = false) Long receiveEndTime,
|
|
@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_NUMBER_MIN) Integer pageNumber,
|
|
@ApiParam(value = "页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) throws Exception {
|
|
@ApiParam(value = "页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) throws Exception {
|
|
- return ResultUtil.ok(tbDeviceDeliveryService.page(new Page<>(pageNumber, pageSize), serviceId, usageType, crmNo, status, deliverUserId, deliverStartTime, deliverEndTime, serialNo, supplierId, receiveStartTime, receiveEndTime));
|
|
|
|
|
|
+ return ResultUtil.ok(tbDeviceDeliveryService.page(new Page<>(pageNumber, pageSize), SystemConstant.convertIdToLong(serviceId),
|
|
|
|
+ usageType, crmNo, status, SystemConstant.convertIdToLong(deliverUserId), deliverStartTime, deliverEndTime,
|
|
|
|
+ serialNo, SystemConstant.convertIdToLong(supplierId), receiveStartTime, receiveEndTime));
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "设备发货保存接口")
|
|
@ApiOperation(value = "设备发货保存接口")
|
|
@@ -80,12 +82,11 @@ public class TBDeviceDeliveryController {
|
|
return ResultUtil.ok();
|
|
return ResultUtil.ok();
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "设备发货编辑接口")
|
|
|
|
- @RequestMapping(value = "/edit", method = RequestMethod.POST)
|
|
|
|
|
|
+ @ApiOperation(value = "设备发货查询单个记录接口")
|
|
|
|
+ @RequestMapping(value = "/find/by/id", method = RequestMethod.POST)
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = TBDeviceDelivery.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = TBDeviceDelivery.class)})
|
|
- @Transactional
|
|
|
|
- public Result edit(@ApiParam(value = "设备发货id", required = true) @RequestParam Long id) throws Exception {
|
|
|
|
- TBDeviceDelivery tbDeviceDelivery = tbDeviceDeliveryService.getById(id);
|
|
|
|
|
|
+ public Result edit(@ApiParam(value = "设备发货id", required = true) @RequestParam String id) throws Exception {
|
|
|
|
+ TBDeviceDelivery tbDeviceDelivery = tbDeviceDeliveryService.getById(SystemConstant.convertIdToLong(id));
|
|
Optional.ofNullable(tbDeviceDelivery).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到设备发货信息"));
|
|
Optional.ofNullable(tbDeviceDelivery).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到设备发货信息"));
|
|
return ResultUtil.ok(tbDeviceDelivery);
|
|
return ResultUtil.ok(tbDeviceDelivery);
|
|
}
|
|
}
|
|
@@ -95,33 +96,13 @@ public class TBDeviceDeliveryController {
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
|
|
@OperationLog(logType = LogTypeEnum.UPDATE)
|
|
@OperationLog(logType = LogTypeEnum.UPDATE)
|
|
@Transactional
|
|
@Transactional
|
|
- public Result statusUpdate(@ApiParam(value = "设备发货id", required = true) @RequestParam Long id,
|
|
|
|
|
|
+ public Result statusUpdate(@ApiParam(value = "设备发货id", required = true) @RequestParam List<String> idList,
|
|
@ApiParam(value = "设备发货状态", required = true) @RequestParam DeviceDeliveryStatusEnum status) {
|
|
@ApiParam(value = "设备发货状态", required = true) @RequestParam DeviceDeliveryStatusEnum status) {
|
|
- TBDeviceDelivery tbDeviceDelivery = tbDeviceDeliveryService.getById(id);
|
|
|
|
- Optional.ofNullable(tbDeviceDelivery).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未找到设备发货信息"));
|
|
|
|
- tbDeviceDelivery.setStatus(status);
|
|
|
|
- return ResultUtil.ok(tbDeviceDeliveryService.updateById(tbDeviceDelivery));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ApiOperation(value = "设备发货状态批量修改接口")
|
|
|
|
- @RequestMapping(value = "/status/batch/update", method = RequestMethod.POST)
|
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
|
|
|
|
- @OperationLog(logType = LogTypeEnum.UPDATE)
|
|
|
|
- @Transactional
|
|
|
|
- public Result statusBatchUpdate(@Valid @ApiParam(value = "设备发货修改信息", required = true) @RequestBody TBDeviceDeliveryParam tbDeviceDeliveryParam, BindingResult bindingResult) {
|
|
|
|
- if (bindingResult.hasErrors()) {
|
|
|
|
- return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
|
|
|
+ SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(idList)) {
|
|
|
|
+ tbDeviceDeliveryService.updateStatus(idList.stream().map(SystemConstant::convertIdToLong).collect(Collectors.toList()), status, requestUser.getId());
|
|
}
|
|
}
|
|
- SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
- List<TBDeviceDelivery> tbDeviceDeliveryList = tbDeviceDeliveryService.listByIds(tbDeviceDeliveryParam.getIds());
|
|
|
|
- if (!CollectionUtils.isEmpty(tbDeviceDeliveryList)) {
|
|
|
|
- for (TBDeviceDelivery t : tbDeviceDeliveryList) {
|
|
|
|
- t.setStatus(tbDeviceDeliveryParam.getStatus());
|
|
|
|
- t.updateInfo(sysUser.getId());
|
|
|
|
- }
|
|
|
|
- tbDeviceDeliveryService.updateBatchById(tbDeviceDeliveryList);
|
|
|
|
- }
|
|
|
|
- return ResultUtil.ok(true);
|
|
|
|
|
|
+ return ResultUtil.ok();
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "设备发货导入")
|
|
@ApiOperation(value = "设备发货导入")
|