2021与蓝度共同重构项目,服务端
liuhaonan
2022-05-27 c0359a005dab3c7b168ed25db2fa4dfc67c7546a
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightTaskService.java
@@ -35,6 +35,7 @@
import com.sandu.ximon.dao.domain.LightTaskPoleRelation;
import com.sandu.ximon.dao.domain.Pole;
import com.sandu.ximon.dao.enums.DeviceRespStatusEnums;
import com.sandu.ximon.dao.enums.OrderByEnums;
import com.sandu.ximon.dao.mapper.LightTaskMapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -332,12 +333,12 @@
        if (newPoleFail.isEmpty() && oldPoleFail.isEmpty() && closePoleFail.isEmpty()) {
            return "编辑成功";
        } else if (newPoleSuccess.isEmpty() && oldPoleSuccess.isEmpty() && closePoleSuccess.isEmpty()) {
            throw new BusinessException("编辑失败");
        } else if (!closePoleFail.isEmpty() || !oldPoleFail.isEmpty()) {
            return "原任务中存在下发异常,原任务保留,创建新任务进行保存";
        } else if (!newPoleFail.isEmpty()) {
            return "新任务中存在下发异常,忽略异常操作的灯杆";
        } else if (newPoleSuccess.isEmpty() && oldPoleSuccess.isEmpty() && closePoleSuccess.isEmpty()) {
            throw new BusinessException("编辑失败");
        } else {
            return "操作异常";
        }
@@ -360,7 +361,7 @@
        return Optional.ofNullable(responseCommonFrame).map(WrapResponseCommonFrame::getResponseInnerFrame).orElse(null);
    }
    public List<LightTaskDto> listLightTask(BaseConditionVO conditionVO, String keyword) {
    public List<LightTaskDto> listLightTask(BaseConditionVO conditionVO, String keyword, Integer order, Integer seq) {
        LambdaQueryWrapper<LightTask> wrapper = Wrappers.lambdaQuery(LightTask.class);
        if (StrUtil.isNotBlank(keyword)) {
            wrapper.like(LightTask::getTaskName, keyword);
@@ -372,9 +373,34 @@
            });
        }
        if (conditionVO != null) {
            PageHelper.startPage(conditionVO.getPageNo(), conditionVO.getPageSize());
        //排序字段
        String orderByResult = "task_id";
        //正序、倒叙
        String orderBySeq = OrderByEnums.ASC.getCode();
        if (order != null) {
            switch (order) {
                case 1:
                    orderByResult = OrderByEnums.LIGHT_TASK_UPDATE_TIME.getCode();
                    break;
                default:
            }
        }
        if (seq != null) {
            switch (seq) {
                case 1:
                    orderBySeq = OrderByEnums.ASC.getCode();
                    break;
                case 2:
                    orderBySeq = OrderByEnums.DESC.getCode();
                    break;
                default:
                    break;
            }
        }
        //排序方式
        String orderBy = orderByResult + " " + orderBySeq;
        PageHelper.startPage(conditionVO.getPageNo(), conditionVO.getPageSize(), orderBy);
        List<LightTask> list = list(wrapper);
        Page<LightTaskDto> page = new Page<>();