|
@@ -2,21 +2,22 @@ package com.qmth.sop.server.api;
|
|
|
|
|
|
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
+import com.qmth.sop.business.bean.params.ServiceUnitParam;
|
|
|
import com.qmth.sop.business.bean.result.SysLogResult;
|
|
|
+import com.qmth.sop.business.entity.SysUser;
|
|
|
import com.qmth.sop.business.service.TBServiceService;
|
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
|
import com.qmth.sop.common.enums.ProductTypeEnum;
|
|
|
import com.qmth.sop.common.enums.ServiceStatusEnum;
|
|
|
import com.qmth.sop.common.util.Result;
|
|
|
import com.qmth.sop.common.util.ResultUtil;
|
|
|
+import com.qmth.sop.common.util.ServletUtil;
|
|
|
import io.swagger.annotations.*;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.validation.Valid;
|
|
|
import javax.validation.constraints.Max;
|
|
|
import javax.validation.constraints.Min;
|
|
|
|
|
@@ -50,5 +51,46 @@ public class TBServiceController {
|
|
|
return ResultUtil.ok(tbServiceService.page(type, SystemConstant.convertIdToLong(serviceLeadId), status, createStartTime, createEndTime, serviceUnitName, pageNumber, pageSize));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "服务单元管理-编辑")
|
|
|
+ @RequestMapping(value = "/edit", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "更新成功", response = Result.class)})
|
|
|
+ public Result editServiceUnit(@Valid @RequestBody ServiceUnitParam serviceUnitParam, BindingResult bindingResult) {
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
+ }
|
|
|
+ SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ return ResultUtil.ok(tbServiceService.edit(serviceUnitParam, requestUser));
|
|
|
+ }
|
|
|
|
|
|
+ @ApiOperation(value = "服务单元管理-作废")
|
|
|
+ @RequestMapping(value = "/cancel", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "作废成功", response = Result.class)})
|
|
|
+ public Result cancelServiceUnit(@ApiParam(value = "服务单元id", required = true) @RequestParam String id) {
|
|
|
+ tbServiceService.cancelServiceUnit(SystemConstant.convertIdToLong(id));
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "服务单元管理-发布")
|
|
|
+ @RequestMapping(value = "/publish", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "发布成功", response = Result.class)})
|
|
|
+ public Result publishServiceUnit(@ApiParam(value = "服务单元id", required = true) @RequestParam String id) {
|
|
|
+ tbServiceService.publishServiceUnit(SystemConstant.convertIdToLong(id));
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "服务单元管理-关闭")
|
|
|
+ @RequestMapping(value = "/cloze", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "作废成功", response = Result.class)})
|
|
|
+ public Result clozeServiceUnit(@ApiParam(value = "服务单元id", required = true) @RequestParam String id) {
|
|
|
+ tbServiceService.clozeServiceUnit(SystemConstant.convertIdToLong(id));
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "服务单元管理-重启")
|
|
|
+ @RequestMapping(value = "/restart", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "重启成功", response = Result.class)})
|
|
|
+ public Result restartServiceUnit(@ApiParam(value = "服务单元id", required = true) @RequestParam String id) {
|
|
|
+ tbServiceService.restartServiceUnit(SystemConstant.convertIdToLong(id));
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
}
|