ZnddLbServiceImpl.java 2.07 KB
package com.bsth.service.zndd.impl;

import com.bsth.common.ResponseCode;
import com.bsth.data.schedule.DayOfSchedule;
import com.bsth.entity.realcontrol.ScheduleRealInfo;
import com.bsth.entity.zndd.ZnddLb;
import com.bsth.service.impl.BaseServiceImpl;
import com.bsth.service.realcontrol.ScheduleRealInfoService;
import com.bsth.service.zndd.ZnddLbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ZnddLbServiceImpl extends BaseServiceImpl<ZnddLb, Integer> implements ZnddLbService {

    @Autowired
    DayOfSchedule dayOfSchedule;

    @Autowired
    ScheduleRealInfoService scheduleRealInfoService;
    public ScheduleRealInfo queryLineCar(Map m){
        String lineCode = m.get("lineCode").toString().trim();
        String clZbh = m.get("clZbh").toString().trim();
        List<ScheduleRealInfo> srList = dayOfSchedule.findByLineCode(lineCode);
        for (ScheduleRealInfo st : srList){

            if(st.getClZbh().equals(clZbh) && st.getBcType().equals("normal")){
                return st;
            }
        }
        return null;
    }


    public Map cxlb(Map m){
        Map<String, Object> rs = new HashMap<>();
        String lineCode = m.get("lineCode").toString().trim();
        String clZbh = m.get("clZbh").toString().trim();
        List<ScheduleRealInfo> list = new ArrayList();
        List<ScheduleRealInfo> srList = dayOfSchedule.findByLineCode(lineCode);
        for (ScheduleRealInfo st : srList){

            if(st.getClZbh().equals(clZbh)){
                Map<String, Object> remap = scheduleRealInfoService.revokeDestroy(st.getId());
                //修改成功
                if (remap.get("status").toString().equals("200")){
                    list.add(st);
                }
            }
        }

        if (list.size() >  0){
            rs.put("status", ResponseCode.SUCCESS);
            rs.put("list", list);
            return rs;
        }

        return rs;
    }
}