yangkang
2023-09-13 51ebb09a85d622cae75dc169b4c86723977d3756
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java
@@ -1,23 +1,18 @@
package org.jeecg.modules.eam.service.impl;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.annotations.ApiModelProperty;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.eam.entity.PredictiveWorkOrder;
import org.jeecg.modules.eam.entity.PredictiveWorkPlan;
import org.jeecg.modules.eam.entity.PredictiveWorkPlanWarn;
import org.jeecg.modules.eam.entity.PredictiveWorkPlanWarnHistory;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.eam.entity.*;
import org.jeecg.modules.eam.mapper.PredictiveWorkPlanWarnMapper;
import org.jeecg.modules.eam.model.MdcEquipmentAlarmVo;
import org.jeecg.modules.eam.service.IPredictiveWorkOrderService;
import org.jeecg.modules.eam.service.IPredictiveWorkPlanService;
import org.jeecg.modules.eam.service.IPredictiveWorkPlanWarnHistoryService;
import org.jeecg.modules.eam.service.IPredictiveWorkPlanWarnService;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -87,6 +82,25 @@
        }
    }
    @Override
    public void removeByWorkPlanId(String predictiveWorkPlanId) {
        LambdaUpdateChainWrapper<PredictiveWorkPlanWarn> lambdaUpdate = this.lambdaUpdate();
        lambdaUpdate.eq(PredictiveWorkPlanWarn::getWorkPlanId, predictiveWorkPlanId);
        lambdaUpdate.remove();
    }
    @Override
    public void revise(String oldWorkPlanId, String workPlanId) {
        LambdaQueryChainWrapper<PredictiveWorkPlanWarn> lambdaQuery = this.lambdaQuery();
        lambdaQuery.eq(PredictiveWorkPlanWarn::getWorkPlanId,oldWorkPlanId).eq(PredictiveWorkPlanWarn::getDelFlag,0);
        List<PredictiveWorkPlanWarn> insertList = lambdaQuery.list();
        for(PredictiveWorkPlanWarn predictiveWorkPlanWarn:insertList){
            predictiveWorkPlanWarn.setWorkPlanId(workPlanId);
            predictiveWorkPlanWarn.setId(UUIDGenerator.generate());
        }
        this.saveBatch(insertList);
    }
    private void backInfo(String workPlanId, List<MdcEquipmentAlarmVo> predictiveWorkPlanWarnList) {
        List<PredictiveWorkPlanWarnHistory> list = new ArrayList<>();
        for (MdcEquipmentAlarmVo mdcEquipmentAlarmVo : predictiveWorkPlanWarnList) {