|
@@ -2,6 +2,8 @@ package com.energy.manage.service.controller.units;
|
|
|
|
|
|
|
|
|
import com.dtflys.forest.annotation.Get;
|
|
|
+import com.energy.manage.common.po.units.UnitBearingsPO;
|
|
|
+import com.energy.manage.common.po.units.UnitDynamoPO;
|
|
|
import com.energy.manage.common.reponse.ResultResp;
|
|
|
import com.energy.manage.service.config.annotations.UserLoginToken;
|
|
|
import com.energy.manage.service.controller.base.BaseServiceController;
|
|
@@ -61,7 +63,7 @@ public class UnitController extends BaseServiceController {
|
|
|
@ApiOperation(value = "更新部件相关信息")
|
|
|
public ResultResp modificationUnit(@RequestBody @Valid UnitDto unitDto) {
|
|
|
|
|
|
- if(StringUtils.isEmpty(unitDto.getMillTypeCode())){
|
|
|
+ if (StringUtils.isEmpty(unitDto.getMillTypeCode())) {
|
|
|
return ResultResp.NOTNULLPARAM();
|
|
|
}
|
|
|
// 验证主轴数据
|
|
@@ -93,17 +95,17 @@ public class UnitController extends BaseServiceController {
|
|
|
return ResultResp.FAIL("所有数据均为空,不进行部件数据维护!");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if(!unitService.verifyUnitBearingByMillTypeCode(unitDto.getMillTypeCode())){
|
|
|
+ UnitBearingsPO unitBearingsPO = unitService.verifyUnitBearingByMillTypeCode(unitDto.getMillTypeCode());
|
|
|
+ if (unitBearingsPO != null && unitBearingsPO.getId().intValue() != unitDto.getUnitBearingsDto().getId().intValue()) {
|
|
|
return ResultResp.FAIL("此机型编号已经绑定部件信息,不可重复绑定");
|
|
|
}
|
|
|
|
|
|
- if(!unitService.verifyUnitDynamoByMillTypeCode(unitDto.getMillTypeCode())){
|
|
|
+ UnitDynamoPO unitDynamoPO = unitService.verifyUnitDynamoByMillTypeCode(unitDto.getMillTypeCode());
|
|
|
+ if (unitDynamoPO != null && unitDynamoPO.getId().intValue() != unitDto.getUnitDynamoDto().getId().intValue()) {
|
|
|
return ResultResp.FAIL("此机型编号已经绑定部件信息,不可重复绑定");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- boolean flg = unitService.modificationUnit(unitDto,getUserId());
|
|
|
+ boolean flg = unitService.modificationUnit(unitDto, getUserId());
|
|
|
return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
|
|
|
}
|
|
|
|