| | |
| | | |
| | | 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; |
| | |
| | | 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 实现 |
| | |
| | | |
| | | @Autowired |
| | | private YwElectricalActionsMapper ywElectricalActionsMapper; |
| | | @Autowired |
| | | private YwElectricalBizService ywElectricalBizService; |
| | | |
| | | @Override |
| | | public PageData<YwElectricalActions> findPage(PageWrap<YwElectricalActions> pageWrap) { |
| | |
| | | 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())); |
| | | } |
| | |
| | | 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()); |
| | | } |
| | | } |