package com.uas.platform.b2b.mobile.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.uas.platform.b2b.mobile.model.ClockAddress;
import com.uas.platform.b2b.mobile.service.ClockAddressService;

/**
 * 打卡地址
 * 
 * @author hejq
 * @time 创建时间：2017年2月22日
 */
@Controller("mobile.ClockAddressController")
@RequestMapping("mobile/clockAddress")
public class ClockAddressController {

	@Autowired
	private ClockAddressService clockAddressService;

	/**
	 * 获取企业的打卡地点
	 * 
	 * @param enuu
	 * @return
	 */
	@RequestMapping(value = "/getSignCardAddress", method = RequestMethod.GET)
	@ResponseBody
	private ModelMap getSignCardAddress(Long enuu) {
		return clockAddressService.getSignCardAddress(enuu);
	};

	/**
	 * 保存打卡地址
	 * 
	 * @param fromStore
	 * @return
	 */
	@RequestMapping(value = "/saveSignCardAddress", method = RequestMethod.POST)
	@ResponseBody
	private ModelMap saveSignCardAddress(String formStore) {
		ClockAddress address = JSON.parseObject(formStore, ClockAddress.class);
		return clockAddressService.saveSignCardAddress(address);
	}
	
	/**
	 * 删除打卡地址
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "/deleteById", method = RequestMethod.POST)
	@ResponseBody
	private ModelMap deleteById(Long id) {
		return clockAddressService.deleteById(id);
	}
}
