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.SignCard;
import com.uas.platform.b2b.mobile.service.SignCardLogService;

/**
 * 员工打卡记录
 * 
 * @author hejq
 * @time 创建时间：2017年2月22日
 */
@Controller("mobile.SignCardLogController")
@RequestMapping("/mobile/signCardLog")
public class SignCardLogController {
	
	@Autowired
	private SignCardLogService signCardLogService;

	/**
	 * 获取员工的打卡记录
	 * 
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getListdata", method = RequestMethod.GET)
	@ResponseBody
	private ModelMap getListData(Long emcode, Long enuu, Integer pageNumber, Integer pageSize, String date)
			throws Exception {
		return signCardLogService.getListData(emcode, enuu, pageNumber, pageSize, date);
	};

	/**
	 * 保存打卡记录
	 * 
	 * @param formStore
	 * @return
	 */
	@RequestMapping(value = "/saveSignCard", method = RequestMethod.POST)
	@ResponseBody
	private ModelMap saveSignCard(String formStore) {
		SignCard signCard = JSON.parseObject(formStore, SignCard.class);
		return signCardLogService.saveSignCard(signCard);
	}
}
