package com.shlanbao.tzsc.pms.sch.calendar.controller;
|
|
import com.shlanbao.tzsc.base.model.Json;
|
import com.shlanbao.tzsc.utils.tools.DateUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import com.shlanbao.tzsc.base.controller.BaseController;
|
import com.shlanbao.tzsc.pms.sch.calendar.service.CalendarServiceI;
|
|
import java.util.Date;
|
import java.util.Map;
|
|
/**
|
* 排班
|
* @author Leejean
|
* @create 2014年11月25日下午1:20:44
|
*/
|
@Controller
|
@RequestMapping("/pms/calendar")
|
public class CalendarController extends BaseController {
|
@Autowired
|
public CalendarServiceI calendarService;
|
/**
|
* 查询排班
|
*/
|
@ResponseBody
|
@RequestMapping("/getCurMonthCalendars")
|
public Object getCurMonthCalendars(String date,String workshop){
|
try {
|
return calendarService.getCurMonthCalendars(date, workshop);
|
} catch (Exception e) {
|
log.error("查询车间排班:"+date+" : "+workshop+"异常", e);
|
}
|
return null;
|
}
|
|
|
/**
|
* @param
|
* @return
|
* @desc 更新排班
|
*/
|
@ResponseBody
|
@RequestMapping("/updateSelectDate")
|
public Json updateSelectDate(@RequestParam Map<String,String> param ){
|
Json json = new Json();
|
try {
|
for(int i = 0 ; i< 3 ;i++){
|
//param.get("id1...") sch_calendar的id
|
if(param.containsKey("id"+i)){
|
Date sdate = DateUtil.formatStringToDate(param.get("stime" + i), "yyyy-MM-dd HH:mm:ss");
|
Date edate = DateUtil.formatStringToDate(param.get("etime" + i), "yyyy-MM-dd HH:mm:ss");
|
//开始时间小于结束时间
|
if(edate.compareTo(sdate)==-1){
|
json.setMsg("操作失败,结束时间不能小于开始时间!");
|
json.setSuccess(false);
|
return json;
|
}else{
|
/*String nowDateTime = DateUtil.getNowDateTime("yyyy-MM-dd HH:mm:ss");
|
Date nowDate = DateUtil.strToDate(nowDateTime, "yyyy-MM-dd HH:mm:ss");
|
//开始时间小于今天
|
if(sdate.compareTo(nowDate)==-1){
|
json.setMsg("操作失败,开始时间不能小于当前时间!");
|
json.setSuccess(false);
|
|
return json;
|
}*/
|
}
|
|
}
|
}
|
|
calendarService.updateSelectDate(param);
|
json.setMsg("操作成功");
|
json.setSuccess(true);
|
} catch (Exception e) {
|
json.setMsg("操作失败");
|
json.setSuccess(false);
|
e.printStackTrace();
|
|
}
|
return json;
|
}
|
}
|