BerthController.java 2.39 KB
package com.bsth.controller.berth;

import com.bsth.controller.BaseController;
import com.bsth.controller.berth.dto.Car2Berth;
import com.bsth.data.in_out.RealInoutHandler;
import com.bsth.data.in_out.buffer.BerthDataBuffer;
import com.bsth.data.in_out.buffer.ElectricDataBuffer;
import com.bsth.entity.berth.RegionBerth;
import com.bsth.service.berth.BerthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created by panzhao on 2017/8/22.
 */
@RestController
@RequestMapping("/berth")
public class BerthController extends BaseController<RegionBerth, Integer> {

/*    @Autowired
    BerthService berthService;

    @RequestMapping("max_order_no")
    public String maxOrderNo() {
        String rs = berthService.maxOrderNo();
        return rs==null?"0":rs;
    }*/

    @Autowired
    BerthService berthService;

    @Autowired
    RealInoutHandler realInoutHandler;

    @Autowired
    BerthDataBuffer berthDataBuffer;

    @RequestMapping("findCar2Berths")
    public List<Car2Berth> findCar2Berths(){
        return berthService.car2Berths();
    }

    @RequestMapping("all_list")
    public List<RegionBerth> all(){
        return BerthDataBuffer.all();
    }

    @RequestMapping("addCar")
    public Map<String, Object> addCar(@RequestParam String berthName,@RequestParam String nbbm){
        return realInoutHandler.addCar2Berth(nbbm, berthName);
    }

    @RequestMapping("removeCar")
    public Map<String, Object> removeCar(@RequestParam String b){
        return realInoutHandler.removeCar2Berth(b);
    }

    @RequestMapping("changeCar2Berth")
    public Map<String, Object> changeCar2Berth(@RequestParam String s,@RequestParam String d){
        return RealInoutHandler.changeCar2Berth(s, d);
    }

    @RequestMapping("lockBerth")
    public Map<String, Object> lockBerth(@RequestParam String berthName){
        return berthDataBuffer.lockBerth(berthName);
    }

    @RequestMapping("unlockBerth")
    public Map<String, Object> unlockBerth(@RequestParam String berthName){
        return berthDataBuffer.unlockBerth(berthName);
    }

    @RequestMapping("elecs")
    public Map<String, Double> elecs(){
        return ElectricDataBuffer.elecs();
    }
}