renkang
2 天以前 4a99240038013c7d962040e6f8eabd2d72095fd7
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwElectricalActionsServiceImpl.java
@@ -2,6 +2,8 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
@@ -10,9 +12,13 @@
import com.doumee.dao.business.model.YwElectrical;
import com.doumee.dao.business.model.YwElectricalActions;
import com.doumee.service.business.YwElectricalActionsService;
import com.doumee.service.business.YwElectricalBizService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
 * 电表远程操作记录 Service 实现
@@ -22,6 +28,8 @@
    @Autowired
    private YwElectricalActionsMapper ywElectricalActionsMapper;
    @Autowired
    private YwElectricalBizService ywElectricalBizService;
    @Override
    public PageData<YwElectricalActions> findPage(PageWrap<YwElectricalActions> pageWrap) {
@@ -39,6 +47,9 @@
        if (model.getActionType() != null) {
            queryWrapper.eq(YwElectricalActions::getActionType, model.getActionType());
        }
        if (model.getElectricalId() != null) {
            queryWrapper.eq(YwElectricalActions::getElectricalId, model.getElectricalId());
        }
        if (model.getOperateTimeBegin() != null) {
            queryWrapper.ge(YwElectricalActions::getCreateDate, Utils.Date.getStart(model.getOperateTimeBegin()));
        }
@@ -50,4 +61,22 @@
        IPage<YwElectricalActions> result = ywElectricalActionsMapper.selectJoinPage(page, YwElectricalActions.class, queryWrapper);
        return PageData.from(result);
    }
    @Override
    public String queryAsyncResult(Integer id) {
        if (id == null) {
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        YwElectricalActions act = ywElectricalActionsMapper.selectById(id);
        if (act == null || Objects.equals(act.getIsdeleted(), Constants.ONE)) {
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "操作记录不存在");
        }
        if (!Objects.equals(act.getStatus(), Constants.ZERO)) {
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "仅处理中记录可查询");
        }
        if (StringUtils.isBlank(act.getOprId())) {
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "缺少任务 ID");
        }
        return ywElectricalBizService.syncAsyncActionStatus(act.getOprId().trim());
    }
}