package com.red.controller; //Create By MyBatisTools import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.sql.Timestamp; //Create Datetime:2017-11-27 17:11:41 //SpringMVC Controller // import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; import java.util.HashMap; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.stereotype.Controller; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.red.entity.XqYzqm; import com.red.service.XqYzqmService; import com.red.util.SysMsg; import com.red.util.SysUuid; @Controller @RequestMapping("/") // @RestController public class XqYzqmController { private static Logger log = LoggerFactory.getLogger(XqYzqmController.class); @Autowired public XqYzqmService xqYzqmService; @RequestMapping(value = "/xqYzqmInsert") @ResponseBody public SysMsg xqYzqmInsert(@RequestBody XqYzqm xqYzqm, HttpServletRequest request, HttpServletResponse response) { log.info(">>>>>>>>>"); SysMsg msg = new SysMsg(); try { log.info("xqYzqmInsert insert log "); request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); String result = ""; if (xqYzqm != null) { log.info(JSON.toJSONString(xqYzqm)); xqYzqm.setId(SysUuid.getId()); xqYzqm.setPxid(System.currentTimeMillis()); xqYzqm.setQt("未确认"); xqYzqm.setHdbz(false); xqYzqm.setXgsj(new Timestamp(System.currentTimeMillis()) ); xqYzqm.setTbsj(new Timestamp(System.currentTimeMillis()) ); xqYzqm.setYzxqldhfh(xqYzqm.getYzxqldh() + '-' + xqYzqm.getYzxqlfh()); int i1 = xqYzqmService.insertObj(xqYzqm); msg.setSuccess(true); msg.setCode(1); msg.setMsg("成功" + i1); log.info("insert line:" + i1); // msg.setMsg("OK"); // msg.setData(posBankBill); } else { log.info("error"); } } catch (Exception e) { msg.setCode(0); msg.setMsg("保存失败."); log.error("Insert保存错误", e); } log.info("-------------------"); JSONObject jsonObject = new JSONObject(); jsonObject.put("msg", msg); log.info(jsonObject.toString()); return msg; } @RequestMapping(value = "/xqYzqmUpdateHdbz") @ResponseBody public SysMsg xqYzqmUpdateHdbz(@RequestBody XqYzqm xqYzqm, HttpServletRequest request, HttpServletResponse response) { log.info(">>>>>>>>>"); SysMsg msg = new SysMsg(); try { log.info("xqYzqmInsert insert log "); request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); String result = ""; if (xqYzqm != null) { log.info(JSON.toJSONString(xqYzqm)); xqYzqm.setXgsj(new Timestamp(System.currentTimeMillis()) ); int i1 = xqYzqmService.updateObjHdbz(xqYzqm); msg.setSuccess(true); msg.setCode(1); msg.setMsg("成功" + i1); log.info("insert line:" + i1); // msg.setMsg("OK"); // msg.setData(posBankBill); } else { log.info("error"); } } catch (Exception e) { msg.setCode(0); msg.setMsg("保存失败."); log.error("Insert保存错误", e); } log.info("-------------------"); JSONObject jsonObject = new JSONObject(); jsonObject.put("msg", msg); log.info(jsonObject.toString()); return msg; } @RequestMapping("xqYzqmSelectPageData") @ResponseBody public JSONObject xqYzqmSelectPageData(@RequestBody JSONObject jsonObjectIn, HttpServletRequest request, HttpServletResponse response, HttpSession session) throws Exception { JSONObject jsonObject = new JSONObject(); String mc = session.getAttribute("loginmc").toString(); System.out.println("----" + mc); if (mc != null) { try { // Map<String, Object> map1, System.out.println(JSON.toJSONString(jsonObjectIn)); System.out.println(jsonObjectIn.get("yzxm")); System.out.println("----"); request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); // {"offset":0,"mcc2":"eee","limit":10} // Map<String, Object> map = new HashMap(); Map<String, Object> map = new HashMap<String, Object>(); map.put("yzxm", jsonObjectIn.get("yzxm")); map.put("yzxqldh", jsonObjectIn.get("yzxqldh")); map.put("yzxqldhfh", jsonObjectIn.get("yzxqldhfh")); map.put("tyclywhbz", jsonObjectIn.get("tyclywhbz")); map.put("hdbz", jsonObjectIn.get("hdbz")); map.put("limit", jsonObjectIn.get("limit")); map.put("offset", jsonObjectIn.get("offset")); // System.out.println(JSON.toJSONString(map)); Long total = xqYzqmService.selectPageDataCount(map); List<XqYzqm> list = xqYzqmService.selectPageData(map); // log.info(JSON.toJSONString(list)); jsonObject.put("total", total); jsonObject.put("rows", list); // System.out.println(JSON.toJSONString(jsonObject)); } catch (Exception e) { // TODO Auto-generated catch block log.error("Error", e); } } return jsonObject; } @RequestMapping("xqYzqmSelectPageDataQm") @ResponseBody public JSONObject xqYzqmSelectPageDataQm(@RequestBody JSONObject jsonObjectIn, HttpServletRequest request, HttpServletResponse response, HttpSession session) throws Exception { JSONObject jsonObject = new JSONObject(); String mc = session.getAttribute("loginmc").toString(); System.out.println("----" + mc); if (mc != null) { try { // Map<String, Object> map1, System.out.println(JSON.toJSONString(jsonObjectIn)); System.out.println(jsonObjectIn.get("yzxm")); System.out.println("----"); request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); // {"offset":0,"mcc2":"eee","limit":10} // Map<String, Object> map = new HashMap(); Map<String, Object> map = new HashMap<String, Object>(); map.put("yzxm", jsonObjectIn.get("yzxm")); map.put("yzxqldh", jsonObjectIn.get("yzxqldh")); map.put("yzxqldhfh", jsonObjectIn.get("yzxqldhfh")); map.put("tyclywhbz", jsonObjectIn.get("tyclywhbz")); map.put("hdbz", jsonObjectIn.get("hdbz")); map.put("limit", jsonObjectIn.get("limit")); map.put("offset", jsonObjectIn.get("offset")); // System.out.println(JSON.toJSONString(map)); Long total = xqYzqmService.selectPageDataCount(map); List<XqYzqm> list = xqYzqmService.selectPageDataQm(map); // log.info(JSON.toJSONString(list)); jsonObject.put("total", total); jsonObject.put("rows", list); // System.out.println(JSON.toJSONString(jsonObject)); } catch (Exception e) { // TODO Auto-generated catch block log.error("Error", e); } } return jsonObject; } }
最近下载更多
libo1212 LV8
2023年5月8日
开开 LV2
2023年4月19日
591231555 LV20
2022年4月18日
tangjj7260 LV18
2022年4月6日
1983448992 LV8
2022年2月2日
Luck_ZDM LV12
2022年1月25日
543666826 LV33
2021年11月18日
最代码-宋家辉 LV61
2021年10月29日
dxadsaf LV6
2021年10月19日
wanglinddad LV55
2021年8月19日