package com.platform.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.base.BaseController;
import com.platform.entities.VolumeEntity;
import com.platform.entities.VolumeForm;
import com.platform.entities.VolumeInitEntity;
import com.platform.service.IVolumeService;
import com.platform.utils.Configs;
import com.platform.utils.ThreadVolume;
import com.platform.utils.ThreadVolumeImm;

@Controller
public class VolumeController extends BaseController{
	
	public static Logger log = Configs.DAILY_ROLLING_LOGGER;

	@Resource(name = "volumeService")
	private IVolumeService volumeService;
	
	
	@RequestMapping(value = "/volume/update", method = RequestMethod.POST)
	@ResponseBody
	public void volumeUpdate(HttpServletRequest res, HttpServletResponse req,
			@RequestBody VolumeEntity form) throws Exception {
		Configs.CONSOLE_LOGGER.error("/oracle/update");
		volumeService.save(form);
		req.setStatus(200);
		new ThreadVolumeImm("ThreadVolumeImm-in-VolumeController-update").start();
	}
	
	@RequestMapping(value = "/volume/delete", method = RequestMethod.POST)
	@ResponseBody
	public void volumeDelete(HttpServletRequest res, HttpServletResponse req,
			@RequestBody VolumeEntity entity) throws Exception {
		Configs.CONSOLE_LOGGER.error("/oracle/{name}/extract");
		volumeService.delete(entity);
		req.setStatus(200);
		new ThreadVolumeImm("ThreadVolumeImm-in-VolumeController-delete").start();
	}
	

}
