ChildTaskPlanServiceImpl.java 1.23 KB
package com.bsth.service.realcontrol.impl;

import java.util.Map;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bsth.entity.realcontrol.ChildTaskPlan;
import com.bsth.entity.realcontrol.ScheduleRealInfo;
import com.bsth.service.impl.BaseServiceImpl;
import com.bsth.service.realcontrol.ChildTaskPlanService;
import com.bsth.service.realcontrol.buffer.ScheduleBuffer;
import com.bsth.vehicle.common.CommonMapped;

@Service
public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Long> implements ChildTaskPlanService{

	@Autowired
	ScheduleRealInfoServiceImpl scheduleRealInfoService;
	
	@Transactional
	@Override
	public Map<String, Object> save(ChildTaskPlan t) {
		Map<String, Object> rs;
		//保存起终点名称
		Map<String, String> map = CommonMapped.stationCodeMap;
		
		t.setStartStationName(map.get(t.getStartStation()));
		t.setEndStationName(map.get(t.getEndStation()));
		
		//rs = super.save(t);
		
		ScheduleRealInfo sch = ScheduleBuffer.findOne(t.getSchedule().getId());
		sch.getcTasks().add(t);
		rs = scheduleRealInfoService.save(sch);
		
		return rs;
	}
	
}