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

/**
 * 工作日程
 * 
 * @author hejq
 * @time 创建时间：2017年2月23日
 */
@Controller("mobile$WorkScheduleController")
@RequestMapping("/mobile/workSchedule")
public class WorkScheduleController {

	@Autowired
	private WorkScheduleService WorkScheduleService;
	
	/**
	 * 获取工作日程
	 * 
	 * @param emcode
	 * @param enuu
	 * @return
	 */
	@RequestMapping(value = "/getWorkSchedule", method = RequestMethod.GET)
	@ResponseBody
	private ModelMap getWorkSchedule(Long emcode, Long enuu, String date) {
		return WorkScheduleService.getWorkSchedule(emcode, enuu, date);
	}

	/**
	 * 保存拜访记录
	 * 
	 * @param formStore
	 * @return
	 */
	@RequestMapping(value = "/saveVisitRecord", method = RequestMethod.POST)
	@ResponseBody
	private ModelMap saveVisitRecord(String formStore) {
		VisitRecord visitRecord = JSON.parseObject(formStore, VisitRecord.class);
		return WorkScheduleService.saveVisitRecord(visitRecord);
	}
}
