Upoutline_yld.java 4.4 KB
package com.servlet.bkyld;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.service.bkyld.YLDExecuteService;
import com.vo.YLD_outline_DataManage;

public class Upoutline_yld extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html");

		YLD_outline_DataManage sh = new YLD_outline_DataManage();
		YLDExecuteService serve = new YLDExecuteService();
		boolean re = true;
		String datetime = request.getParameter("a_datetime");
		String ss = request.getParameter("a_ss");
		String tn = request.getParameter("a_tn");
		String tp = request.getParameter("a_tp");
		String shxyl = request.getParameter("a_shxyl");
		String dzwy = request.getParameter("a_dzwy");
		String syl = request.getParameter("a_syl");
		String ylzbmhxj = request.getParameter("a_ylzbmhxj");
		String sd = request.getParameter("a_sd");
		String fdcjq = request.getParameter("a_fdcjq");
		String tcd = request.getParameter("a_tcd");
		String tcr = request.getParameter("a_tcr");
		String ljg = request.getParameter("a_ljg");
		String tas = request.getParameter("a_tas");
		String tpb = request.getParameter("a_tpb");
		String jjg = request.getParameter("a_jjg");
		String yjg = request.getParameter("a_yjg");
//		sh.setA_id(request.getParameter("a_id"));
		if(tn==null||tp==null||shxyl==null||dzwy==null||syl==null||ylzbmhxj==null||jjg==null||
				sd==null||fdcjq==null||tcd==null||tcr==null||ljg==null||tas==null||tpb==null||yjg==null||
				tn==""||tp==""||shxyl==""||dzwy==""||syl==""||ylzbmhxj==""||jjg==""||
				sd==""||fdcjq==""||tcd==""||tcr==""||ljg==""||tas==""||tpb==""||yjg==""){
			response.getWriter().print("{success:true,msg:' 您所填数据不能为空!'}");
			response.getWriter().close();
			return;
		}
		sh.setA_ss(Double.valueOf(ss));
		sh.setA_ss_note(request.getParameter("a_ss_note"));
		//System.out.println(request.getParameter("a_ss_note"));

		sh.setA_tn(Double.valueOf(tn));
		sh.setA_tn_note(request.getParameter("a_tn_note"));

		sh.setA_tp(Double.valueOf(tp));
		sh.setA_tp_note(request.getParameter("a_tp_note"));

		sh.setA_shxyl(Double.valueOf(shxyl));
		sh.setA_shxyl_note(request.getParameter("a_shxyl_note"));
		
		sh.setA_dzwy(Double.valueOf(dzwy));
		sh.setA_dzwy_note(request.getParameter("a_dzwy_note"));
		
		sh.setA_syl(Double.valueOf(syl));
		sh.setA_syl_note(request.getParameter("a_syl_note"));
		
		sh.setA_ylzbmhxj(Double.valueOf(ylzbmhxj));
		sh.setA_ylzbmhxj_note(request.getParameter("a_ylzbmhxj_note"));
		
		sh.setA_sd(Double.valueOf(sd));
		sh.setA_sd_note(request.getParameter("a_sd_note"));
		
		sh.setA_fdcjq(Double.valueOf(fdcjq));
		sh.setA_fdcjq_note(request.getParameter("a_fdcjq_note"));
		
		sh.setA_tcd(Double.valueOf(tcd));
		sh.setA_tcd_note(request.getParameter("a_tcd_note"));
		
		sh.setA_tcr(Double.valueOf(tcr));
		sh.setA_tcr_note(request.getParameter("a_tcr_note"));
		
		sh.setA_ljg(Double.valueOf(ljg));
		sh.setA_ljg_note(request.getParameter("a_ljg_note"));
		
		sh.setA_tas(Double.valueOf(tas));
		sh.setA_tas_note(request.getParameter("a_tas_note"));
		
		sh.setA_tpb(Double.valueOf(tpb));
		sh.setA_tpb_note(request.getParameter("a_tpb_note"));
		
		sh.setA_jjg(Double.valueOf(jjg));
		sh.setA_jjg_note(request.getParameter("a_jjg_note"));
		
		sh.setA_yjg(Double.valueOf(yjg));
		sh.setA_yjg_note(request.getParameter("a_yjg_note"));

		String id = request.getParameter("a_id");
		if (id == null) {
			sh.setDate(datetime);
			re=serve.insertoutlinedata(sh);
		} else {
			sh.setA_id(Integer.valueOf(id));
			re=serve.getDataManageUpdate(sh);
		}
		if (!re) {
			response.getWriter().print("{success:true,msg:'数据操作成功'}");
			response.getWriter().close();
		} else {
			response.getWriter().print("{success:true,msg:'数据操作失败,请检查时间是否正确'}");
			response.getWriter().close();
		}
	}

}