首页>代码>SSM实现小区业主管理系统,支持在线js电子签名>/ssmqmdj/src/main/java/com/red/controller/XqYzmdController.java
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.apache.commons.lang3.StringUtils;
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.XqYzmd;
import com.red.service.XqYzmdService;
import com.red.util.SysMsg;
import com.red.util.SysUuid;

@Controller
@RequestMapping("/")
// @RestController
public class XqYzmdController {
	private static Logger log = LoggerFactory.getLogger(XqYzmdController.class);

	@Autowired
	public XqYzmdService xqYzmdService;

	
	@RequestMapping(value = "/xqYzmdInsert")
	@ResponseBody
	public SysMsg xqYzmdInsert(@RequestBody XqYzmd xqYzmd, HttpServletRequest request,
			HttpServletResponse response) {
		log.info(">>>>>>>>>");
		SysMsg msg = new SysMsg();
		try {
			log.info("xqYzmdInsert insert log ");
			request.setCharacterEncoding("UTF-8");
			response.setCharacterEncoding("UTF-8");
			String result = "";

			if (xqYzmd != null) {
				log.info(JSON.toJSONString(xqYzmd));
				//xqYzmd.setId(SysUuid.getId());
				xqYzmd.setPxid(System.currentTimeMillis());
				

				xqYzmd.setYzxqldhfh(xqYzmd.getYzxqldh() + '-' + xqYzmd.getYzxqlfh());
				
				xqYzmd.setXgsj(new Timestamp(System.currentTimeMillis())  );
				xqYzmd.setTbsj(new Timestamp(System.currentTimeMillis())  );
				int i1 = xqYzmdService.insert(xqYzmd);
				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 = "/xqYzmdInsertObj")
	@ResponseBody
	public SysMsg xqYzmdInsertObj(@RequestBody XqYzmd xqYzmd, HttpServletRequest request,
			HttpServletResponse response) {
		log.info(">>>>>>>>>");
		SysMsg msg = new SysMsg();
		try {
			log.info("xqYzmdInsert insert log ");
			request.setCharacterEncoding("UTF-8");
			response.setCharacterEncoding("UTF-8");
			String result = "";

			if (xqYzmd != null) {
				log.info(JSON.toJSONString(xqYzmd));
				//xqYzmd.setId(SysUuid.getId());
				xqYzmd.setPxid(System.currentTimeMillis());
				xqYzmd.setQt("未确认");
				xqYzmd.setHdbz(false);

				xqYzmd.setYzxqldhfh(xqYzmd.getYzxqldh() + '-' + xqYzmd.getYzxqlfh());

				xqYzmd.setXgsj(new Timestamp(System.currentTimeMillis())  );
				xqYzmd.setTbsj(new Timestamp(System.currentTimeMillis())  );
				int i1 = xqYzmdService.insertObj(xqYzmd);
				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 = "/xqYzmdUpdate")
	@ResponseBody
	public SysMsg xqYzmdUpdate(@RequestBody XqYzmd xqYzmd, HttpServletRequest request,
			HttpServletResponse response) {
		log.info(">>>>>>>>>");
		SysMsg msg = new SysMsg();
		try {
			log.info("xqYzmd修改 log ");
			request.setCharacterEncoding("UTF-8");
			response.setCharacterEncoding("UTF-8");
			String result = "";
 
			if (xqYzmd != null) {
				log.info(JSON.toJSONString(xqYzmd));
				xqYzmd.setYzxqldhfh(xqYzmd.getYzxqldh() + '-' + xqYzmd.getYzxqlfh()); 
 
				xqYzmd.setXgsj(new Timestamp(System.currentTimeMillis())  );
				 
				int i1 = xqYzmdService.update(xqYzmd);
				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 = "/xqYzmdUpdateHdbz")
	@ResponseBody
	public SysMsg xqYzmdUpdateHdbz(@RequestBody XqYzmd xqYzmd, HttpServletRequest request,
			HttpServletResponse response) {
		log.info(">>>>>>>>>");
		SysMsg msg = new SysMsg();
		try {
			log.info("xqYzmdInsert insert log ");
			request.setCharacterEncoding("UTF-8");
			response.setCharacterEncoding("UTF-8");
			String result = "";
 
			if (xqYzmd != null) {
				log.info(JSON.toJSONString(xqYzmd));
				 
				xqYzmd.setXgsj(new Timestamp(System.currentTimeMillis())  );
				 
				int i1 = xqYzmdService.updateObjHdbz(xqYzmd);
				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("xqYzmdSelectPageData")
	@ResponseBody
	public JSONObject xqYzmdSelectPageData(@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("hdbz", jsonObjectIn.get("hdbz"));
			
			map.put("limit", jsonObjectIn.get("limit"));
			map.put("offset", jsonObjectIn.get("offset"));

			//System.out.println(JSON.toJSONString(map));
			
			Long total = xqYzmdService.selectPageDataCount(map);
			List<XqYzmd> list = xqYzmdService.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;
	}

	 
	
}
最近下载更多
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  LV11 2022年1月25日
543666826  LV33 2021年11月18日
最代码-宋家辉  LV61 2021年10月29日
dxadsaf  LV6 2021年10月19日
wanglinddad  LV54 2021年8月19日
最近浏览更多
xiaozhi丶  LV13 4月15日
laishaofe  LV7 1月16日
lilong007  LV20 2023年12月30日
shuangfu  LV24 2023年12月2日
skook7  LV2 2023年11月21日
拜托你仔细听  LV3 2023年9月21日
阳光男孩阿葵 2023年7月14日
暂无贡献等级
29693748  LV1 2023年7月6日
591231555  LV20 2023年6月15日
微信网友_6469820124057600  LV6 2023年5月30日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友