100 lines
3.2 KiB
Plaintext
100 lines
3.2 KiB
Plaintext
package th.co.muangthai.endrprint.controller;
|
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import th.co.muangthai.endrprint.controller.service.ENDR500Service;
|
|
import th.co.muangthai.endrprint.model.bean.form.MsgErrorForm;
|
|
import th.co.muangthai.endrprint.model.bean.form.master.EndrOperidTabForm;
|
|
import th.co.muangthai.endrprint.model.bean.master.MstOperidTabBean;
|
|
import th.co.muangthai.endrprint.util.SessionUtil;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
@Controller
|
|
public class ENDR500Controller extends ENDR500Service {
|
|
|
|
static Logger log = Logger.getLogger(ENDR500Controller.class);
|
|
|
|
/**
|
|
* Load the information/data to start (Master ,ComboBox)
|
|
*
|
|
* @param request
|
|
* @return Object[] search results
|
|
*/
|
|
@RequestMapping(value = "/json/ENDR500LoadData", method = RequestMethod.POST)
|
|
public
|
|
@ResponseBody
|
|
Object[] loadData(HttpServletRequest request) {
|
|
Object[] obj = new Object[4];
|
|
MsgErrorForm errorForm = new MsgErrorForm();
|
|
errorForm.setDataDefaultOk();
|
|
|
|
try {
|
|
// String userId = SessionUtil.getUserLoginForm().getUserId();
|
|
obj[0] = errorForm;
|
|
|
|
|
|
} catch (Exception ex) {
|
|
errorForm.setDataErrorException(ex);
|
|
log.error(ex.toString(), ex);
|
|
obj[0] = errorForm;
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
@RequestMapping(value = "/json/ENDR500SchData", method = RequestMethod.POST)
|
|
public
|
|
@ResponseBody
|
|
Object[] schData(HttpServletRequest request) {
|
|
MsgErrorForm errorForm = new MsgErrorForm();
|
|
errorForm.setDataDefaultOk();
|
|
|
|
List<EndrOperidTabForm> endrOperidTabList = new ArrayList<EndrOperidTabForm>();
|
|
|
|
try {
|
|
|
|
String schFormParam = request.getParameter("schFormParam");
|
|
EndrOperidTabForm schForm = gsonData.fromJson(schFormParam, EndrOperidTabForm.class);
|
|
|
|
endrOperidTabList = commonService.searchMstOperidTabBeanByBean(schForm);
|
|
|
|
|
|
} catch (Exception ex) {
|
|
errorForm.setDataErrorException(ex);
|
|
log.error(ex.toString(), ex);
|
|
}
|
|
return new Object[]{errorForm, endrOperidTabList};
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/json/ENDR500SaveData", method = RequestMethod.POST)
|
|
public
|
|
@ResponseBody
|
|
Object[] saveData(HttpServletRequest request) {
|
|
MsgErrorForm msgErrorForm = new MsgErrorForm();
|
|
msgErrorForm.setDataDefaultOk();
|
|
|
|
List<EndrOperidTabForm> endrOperidTabList = new ArrayList<EndrOperidTabForm>();
|
|
|
|
try {
|
|
|
|
String saveFormParams = request.getParameter("saveFormParams");
|
|
String saveFlag = request.getParameter("saveFlag");
|
|
MstOperidTabBean saveForm = gsonData.fromJson(saveFormParams, MstOperidTabBean.class);
|
|
|
|
msgErrorForm = saveOperIdTab(saveForm, saveFlag);
|
|
} catch (Exception ex) {
|
|
msgErrorForm.setDataErrorException(ex);
|
|
log.error(ex.toString(), ex);
|
|
}
|
|
return new Object[]{msgErrorForm, endrOperidTabList};
|
|
}
|
|
|
|
}
|