|
@@ -66,7 +66,25 @@ public class TBCrmDetailController {
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
}
|
|
}
|
|
- return ResultUtil.ok(tbCrmDetailService.sopVarSave(crmDetailSopParam));
|
|
|
|
|
|
+ boolean lock = memoryLock.lock(SystemConstant.LOCK_CRM_DETAIL_SOP_VAR_PREFIX + crmDetailSopParam.getCrmNo(),
|
|
|
|
+ crmDetailSopParam.getCrmNo(), SystemConstant.LOCK_CRM_DETAIL_SOP_TIME_OUT);
|
|
|
|
+ if (!lock) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("正在保存数据,请稍候再试!");
|
|
|
|
+ }
|
|
|
|
+ boolean result = false;
|
|
|
|
+ try {
|
|
|
|
+ result = tbCrmDetailService.sopVarSave(crmDetailSopParam);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error(SystemConstant.LOG_ERROR, e);
|
|
|
|
+ if (e instanceof ApiException) {
|
|
|
|
+ ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
|
|
|
|
+ } else {
|
|
|
|
+ ResultUtil.error(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ } finally {
|
|
|
|
+ memoryLock.unlock(SystemConstant.LOCK_CRM_DETAIL_SOP_VAR_PREFIX + crmDetailSopParam.getCrmNo());
|
|
|
|
+ }
|
|
|
|
+ return ResultUtil.ok(result);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取派单明细sop信息")
|
|
@ApiOperation(value = "获取派单明细sop信息")
|
|
@@ -88,7 +106,27 @@ public class TBCrmDetailController {
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
}
|
|
}
|
|
- return ResultUtil.ok(tbCrmDetailService.sopSave(tbCrmDetail));
|
|
|
|
|
|
+ boolean lock = memoryLock.lock(SystemConstant.LOCK_CRM_DETAIL_SOP_CREATE_PREFIX + tbCrmDetail.getCrmNo() + "_"
|
|
|
|
+ + tbCrmDetail.getCourseName(), tbCrmDetail.getCrmNo() + "_" + tbCrmDetail.getCourseName(),
|
|
|
|
+ SystemConstant.LOCK_CRM_DETAIL_SOP_TIME_OUT);
|
|
|
|
+ if (!lock) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("正在保存数据,请稍候再试!");
|
|
|
|
+ }
|
|
|
|
+ boolean result = false;
|
|
|
|
+ try {
|
|
|
|
+ result = tbCrmDetailService.sopSave(tbCrmDetail);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error(SystemConstant.LOG_ERROR, e);
|
|
|
|
+ if (e instanceof ApiException) {
|
|
|
|
+ ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
|
|
|
|
+ } else {
|
|
|
|
+ ResultUtil.error(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ } finally {
|
|
|
|
+ memoryLock.unlock(SystemConstant.LOCK_CRM_DETAIL_SOP_CREATE_PREFIX + tbCrmDetail.getCrmNo() + "_"
|
|
|
|
+ + tbCrmDetail.getCourseName());
|
|
|
|
+ }
|
|
|
|
+ return ResultUtil.ok(result);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "编辑派单明细sop")
|
|
@ApiOperation(value = "编辑派单明细sop")
|
|
@@ -105,9 +143,26 @@ public class TBCrmDetailController {
|
|
@RequestMapping(value = "/sop/publish", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/sop/publish", method = RequestMethod.POST)
|
|
@OperationLog(logType = LogTypeEnum.EDIT)
|
|
@OperationLog(logType = LogTypeEnum.EDIT)
|
|
@ApiResponses({ @ApiResponse(code = 200, message = "派单明细sop发布", response = EditResult.class) })
|
|
@ApiResponses({ @ApiResponse(code = 200, message = "派单明细sop发布", response = EditResult.class) })
|
|
- public Result sopPublish(@ApiParam(value = "派单明细sopId", required = true) @RequestParam Long id)
|
|
|
|
- throws InterruptedException {
|
|
|
|
- return ResultUtil.ok(tbCrmDetailService.sopPublish(id));
|
|
|
|
|
|
+ public Result sopPublish(@ApiParam(value = "派单明细sopId", required = true) @RequestParam Long id) {
|
|
|
|
+ boolean lock = memoryLock.lock(SystemConstant.LOCK_CRM_DETAIL_SOP_PUBLISH_PREFIX + id, id,
|
|
|
|
+ SystemConstant.LOCK_CRM_DETAIL_SOP_TIME_OUT);
|
|
|
|
+ if (!lock) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("正在保存数据,请稍候再试!");
|
|
|
|
+ }
|
|
|
|
+ boolean result = false;
|
|
|
|
+ try {
|
|
|
|
+ result = tbCrmDetailService.sopPublish(id);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error(SystemConstant.LOG_ERROR, e);
|
|
|
|
+ if (e instanceof ApiException) {
|
|
|
|
+ ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
|
|
|
|
+ } else {
|
|
|
|
+ ResultUtil.error(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ } finally {
|
|
|
|
+ memoryLock.unlock(SystemConstant.LOCK_CRM_DETAIL_SOP_PUBLISH_PREFIX + id);
|
|
|
|
+ }
|
|
|
|
+ return ResultUtil.ok();
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "派单明细sop删除")
|
|
@ApiOperation(value = "派单明细sop删除")
|