75 lines
2.6 KiB
Plaintext
75 lines
2.6 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.ENDR900Service;
|
||
|
import th.co.muangthai.endrprint.model.bean.form.Endr900RequestForm;
|
||
|
import th.co.muangthai.endrprint.model.bean.form.MsgErrorForm;
|
||
|
import th.co.muangthai.endrprint.model.bean.form.master.EndrProvincialForm;
|
||
|
import th.co.muangthai.endrprint.model.bean.master.EndrProvincialBean;
|
||
|
import th.co.muangthai.endrprint.model.bean.master.WftaskBean;
|
||
|
|
||
|
import javax.servlet.http.HttpServletRequest;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
@Controller
|
||
|
public class ENDR900Controller extends ENDR900Service {
|
||
|
|
||
|
static Logger log = Logger.getLogger(ENDR900Controller.class);
|
||
|
|
||
|
|
||
|
@RequestMapping(value = "/json/ENDR900LoadData", method = RequestMethod.POST)
|
||
|
public
|
||
|
@ResponseBody
|
||
|
Object[] loadData(HttpServletRequest request) {
|
||
|
Object[] obj = new Object[2];
|
||
|
MsgErrorForm errorForm = new MsgErrorForm();
|
||
|
errorForm.setDataDefaultOk();
|
||
|
List<EndrProvincialBean> endrProvincialList = new ArrayList<EndrProvincialBean>();
|
||
|
try {
|
||
|
// String userId = SessionUtil.getUserLoginForm().getUserId();
|
||
|
|
||
|
//Load All Provincial
|
||
|
endrProvincialList = commonService.searchEndrProvincialByBean(new EndrProvincialForm());
|
||
|
|
||
|
obj[0] = errorForm;
|
||
|
obj[1] = endrProvincialList;
|
||
|
|
||
|
} catch (Exception ex) {
|
||
|
errorForm.setDataErrorException(ex);
|
||
|
log.error(ex.toString(), ex);
|
||
|
obj[0] = errorForm;
|
||
|
}
|
||
|
return obj;
|
||
|
}
|
||
|
|
||
|
|
||
|
@RequestMapping(value = "/json/ENDR900SchData", method = RequestMethod.POST)
|
||
|
public
|
||
|
@ResponseBody
|
||
|
Object[] schData(HttpServletRequest request) {
|
||
|
MsgErrorForm errorForm = new MsgErrorForm();
|
||
|
errorForm.setDataDefaultOk();
|
||
|
|
||
|
List<WftaskBean> endr900resultList = new ArrayList<WftaskBean>();
|
||
|
try {
|
||
|
|
||
|
String schFormParam = request.getParameter("schFormParam");
|
||
|
|
||
|
Endr900RequestForm schForm = gsonData.fromJson(schFormParam, Endr900RequestForm.class);
|
||
|
endr900resultList = commonService.searchEndr900Result(schForm);
|
||
|
|
||
|
} catch (Exception ex) {
|
||
|
errorForm.setDataErrorException(ex);
|
||
|
log.error(ex.toString(), ex);
|
||
|
}
|
||
|
return new Object[]{errorForm, endr900resultList};
|
||
|
}
|
||
|
|
||
|
}
|