审批流异常回滚
This commit is contained in:
parent
aa62bca380
commit
e7059dde1e
|
|
@ -56,13 +56,14 @@ public class EquipmentScrapCallback implements IApprovalCallback {
|
||||||
|
|
||||||
// 4. 调用原有的审批业务逻辑
|
// 4. 调用原有的审批业务逻辑
|
||||||
AjaxResult result = toBeScrapService.auditData(bean);
|
AjaxResult result = toBeScrapService.auditData(bean);
|
||||||
|
|
||||||
if (result.get("code").equals(200)) {
|
if (result.get("code").equals(200)) {
|
||||||
log.info("设备报废审批通过,业务逻辑执行成功,业务ID:{}", instance.getBusinessId());
|
log.info("设备报废审批通过,业务逻辑执行成功,业务ID:{}", instance.getBusinessId());
|
||||||
} else {
|
} else {
|
||||||
log.error("设备报废审批通过,但业务逻辑执行失败,业务ID:{},错误信息:{}", instance.getBusinessId(), result.get("msg"));
|
log.error("设备报废审批通过,但业务逻辑执行失败,业务ID:{},错误信息:{}", instance.getBusinessId(), result.get("msg"));
|
||||||
|
throw new RuntimeException("报废业务逻辑执行失败:" + result.get("msg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("设备报废审批通过回调执行失败,业务ID:{}", instance.getBusinessId(), e);
|
log.error("设备报废审批通过回调执行失败,业务ID:{}", instance.getBusinessId(), e);
|
||||||
throw new RuntimeException("审批通过回调执行失败:" + e.getMessage());
|
throw new RuntimeException("审批通过回调执行失败:" + e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ public class BackChangeServiceImpl implements BackChangeService {
|
||||||
}
|
}
|
||||||
// 判断在用数量是否有为0的,若有,不予审核通过
|
// 判断在用数量是否有为0的,若有,不予审核通过
|
||||||
if (csDeviceDetails.getUseNum().compareTo(BigDecimal.ZERO) == 0) {
|
if (csDeviceDetails.getUseNum().compareTo(BigDecimal.ZERO) == 0) {
|
||||||
return AjaxResult.warn("该条单据中存在在用数量为0的设备,无法审核通过,请驳回后进行修改");
|
throw new RuntimeException("该条单据中存在在用数量为0的设备,无法审核通过,请驳回后进行修改");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -518,10 +518,14 @@ public class DevChangeServiceImpl implements DevChangeService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult approve(CsDeviceInfo csDeviceInfo) {
|
public AjaxResult approve(CsDeviceInfo csDeviceInfo) {
|
||||||
csDeviceInfo.setUpdateBy(SecurityUtils.getLoginUser().getUserid().toString());
|
csDeviceInfo.setUpdateBy(SecurityUtils.getLoginUser().getUserid().toString());
|
||||||
int num = mapper.approve(csDeviceInfo);
|
int num = mapper.approve(csDeviceInfo);
|
||||||
return num > 0 ? AjaxResult.success("审核成功") : AjaxResult.error("审核失败");
|
if (num <= 0) {
|
||||||
|
throw new RuntimeException("审核失败,更新数据库失败");
|
||||||
|
}
|
||||||
|
return AjaxResult.success("审核成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
||||||
public AjaxResult auditData(ToBeScrap bean) {
|
public AjaxResult auditData(ToBeScrap bean) {
|
||||||
try {
|
try {
|
||||||
if (Objects.isNull(bean)) {
|
if (Objects.isNull(bean)) {
|
||||||
return AjaxResult.error("请求参数异常!");
|
throw new ServiceException("请求参数异常!");
|
||||||
}
|
}
|
||||||
if (Objects.isNull(bean.getId())) {
|
if (Objects.isNull(bean.getId())) {
|
||||||
throw new ServiceException("任务ID不能为空");
|
throw new ServiceException("任务ID不能为空");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue