ソースを参照

部件字典管理接口和部件po

shiyue 6 ヶ月 前
コミット
633a37c9bb

+ 1 - 1
energy-manage-service/src/main/java/com/energy/manage/service/controller/units/UnitController.java

@@ -88,7 +88,7 @@ public class UnitController extends BaseServiceController {
                 unitDto.getUnitGearDto() == null) {
             return ResultResp.FAIL("所有数据均为空,不进行部件数据维护!");
         }
-        boolean flg = unitService.modificationUnit(unitDto);
+        boolean flg = unitService.modificationUnit(unitDto,getUserId());
         return flg ? ResultResp.SUCCESS() : ResultResp.FAIL();
     }
 

+ 1 - 1
energy-manage-service/src/main/java/com/energy/manage/service/service/units/UnitService.java

@@ -33,7 +33,7 @@ public interface UnitService {
      * @param unitDto
      * @return
      */
-    boolean modificationUnit(UnitDto unitDto);
+    boolean modificationUnit(UnitDto unitDto,Integer userId);
 
     /**
      * 通过机型编号查询部件信息

+ 16 - 2
energy-manage-service/src/main/java/com/energy/manage/service/service/units/impl/UnitServiceImpl.java

@@ -86,7 +86,7 @@ public class UnitServiceImpl implements UnitService {
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public boolean modificationUnit(UnitDto unitDto) {
+    public boolean modificationUnit(UnitDto unitDto,Integer userId) {
 
         boolean flg = false;
         // 处理主轴
@@ -97,6 +97,7 @@ public class UnitServiceImpl implements UnitService {
 
             //更新
             if (unitBearingsPO.getId() != null && unitBearingsPO.getId() > 0) {
+                unitBearingsPO.setUpdateBy(userId);
                 Example queryExample = new Example(UnitBearingsPO.class);
                 Example.Criteria criteria = queryExample.createCriteria();
                 criteria.andEqualTo("id", unitBearingsPO.getId());
@@ -107,8 +108,11 @@ public class UnitServiceImpl implements UnitService {
             String unitBearingsCode = IdPrefixEnum.UNIT_BEARINGS_CODE.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, IdPrefixEnum.UNIT_BEARINGS_CODE.getCode()))));
             unitBearingsPO.setMillTypeCode(unitDto.getMillTypeCode());
             unitBearingsPO.setCode(unitBearingsCode);
+            unitBearingsPO.setCreateBy(userId);
+            unitBearingsPO.setUpdateBy(userId);
             unitBearingsPO.setCreateTime(new Date());
             unitBearingsPO.setUpdateTime(new Date());
+            unitBearingsPO.setDelState(DeleteStatusEnum.NODELETE.getCode());
             flg = unitBearingsMapper.insertUseGeneratedKeys(unitBearingsPO) > 0;
         }
 
@@ -120,6 +124,7 @@ public class UnitServiceImpl implements UnitService {
 
             //更新
             if (unitDynamoPO.getId() != null && unitDynamoPO.getId() > 0) {
+                unitDynamoPO.setUpdateBy(userId);
                 Example queryExample = new Example(UnitDynamoPO.class);
                 Example.Criteria criteria = queryExample.createCriteria();
                 criteria.andEqualTo("id", unitDynamoPO.getId());
@@ -127,11 +132,14 @@ public class UnitServiceImpl implements UnitService {
                 break outDynamo;
             }
             // 创建
-            String unitDynamoCode = IdPrefixEnum.UNIT_GEAR_CODE.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, IdPrefixEnum.UNIT_DYNAMO_CODE.getCode()))));
+            String unitDynamoCode = IdPrefixEnum.UNIT_DYNAMO_CODE.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, IdPrefixEnum.UNIT_DYNAMO_CODE.getCode()))));
             unitDynamoPO.setMillTypeCode(unitDto.getMillTypeCode());
             unitDynamoPO.setCode(unitDynamoCode);
             unitDynamoPO.setCreateTime(new Date());
             unitDynamoPO.setUpdateTime(new Date());
+            unitDynamoPO.setCreateBy(userId);
+            unitDynamoPO.setUpdateBy(userId);
+            unitDynamoPO.setDelState(DeleteStatusEnum.NODELETE.getCode());
             flg = unitDynamoMapper.insertUseGeneratedKeys(unitDynamoPO) > 0;
         }
 
@@ -143,6 +151,7 @@ public class UnitServiceImpl implements UnitService {
             unitGearboxPO.setLubricantBrand(unitDto.getUnitGearDto().getLubricantBrand());
             unitGearboxPO.setLubricantModel(unitDto.getUnitGearDto().getLubricantModel());
             unitGearboxPO.setUpdateTime(new Date());
+            unitGearboxPO.setUpdateBy(userId);
             //更新齿轮箱总表
             if (unitDto.getUnitGearDto().getId() != null && unitDto.getUnitGearDto().getId() > 0) {
                 unitGearboxPO.setId(unitDto.getUnitGearDto().getId());
@@ -156,6 +165,7 @@ public class UnitServiceImpl implements UnitService {
             String unitGearboxCode = IdPrefixEnum.UNIT_GEAR_CODE.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, IdPrefixEnum.UNIT_GEAR_CODE.getCode()))));
             unitGearboxPO.setCode(unitGearboxCode);
             unitGearboxPO.setCreateTime(new Date());
+            unitGearboxPO.setCreateBy(userId);
             unitGearboxPO.setDelState(DeleteStatusEnum.NODELETE.getCode());
             flg = unitGearboxMapper.insertUseGeneratedKeys(unitGearboxPO) > 0;
 
@@ -170,6 +180,8 @@ public class UnitServiceImpl implements UnitService {
                     unitGearboxBearingsPO = new UnitGearboxBearingsPO();
                     BeanUtil.copyProperties(dto, unitGearboxBearingsPO);
                     unitGearboxBearingsPO.setGearboxCode(unitGearboxPO.getCode());
+                    unitGearboxBearingsPO.setCreateBy(userId);
+                    unitGearboxBearingsPO.setUpdateBy(userId);
                     unitGearboxBearingsPO.setCreateTime(new Date());
                     unitGearboxBearingsPO.setUpdateTime(new Date());
                     unitGearboxBearingsPOList.add(unitGearboxBearingsPO);
@@ -191,6 +203,8 @@ public class UnitServiceImpl implements UnitService {
                     unitGearboxStructurePO.setGearboxCode(unitGearboxPO.getCode());
                     unitGearboxStructurePO.setCreateTime(new Date());
                     unitGearboxStructurePO.setUpdateTime(new Date());
+                    unitGearboxStructurePO.setCreateBy(userId);
+                    unitGearboxStructurePO.setUpdateBy(userId);
                     unitGearboxStructurePOList.add(unitGearboxStructurePO);
                 }
                 UnitGearboxStructurePO po = new UnitGearboxStructurePO();