JavaWeb实战:报价计算系统(layui+tomcat+cookie实现)

系统概述:

该系统是文物物流公司的一个小功能模块,用于帮助用户计算运费。点击查看实际效果

系统文档:

添加展品:

在表单内添加展品信息,完毕后点击添加展品,即可在展品列表中显示相应的展品信息,也可以对已经添加的展品进行删除,完成之后点击下一步。

添加行程:

使用方法与添加行程类似,添加完毕之后点击先一步。



生成报价:

在下拉选项栏中选择服务公司,选择完毕点击立即查询即可生成报价。

开发中使用的技术:

layui

tomcat

json

cookie

实现思路:

我个人的想法是,先这个把这个系统划分生两大部分:第一部分:展品、行程列表的管理,第二部分:报价计算。

第一部分、展品、行程列表的管理:

展品和行程可以看作是两个类,那么展品和行程列表就可以看成是两个ArrayList,展品和行程列表的管理就可以看作是Array List的增加、删除和查询整个链表。

明白这个道理后,就是具体的操作实现了。所以我宏观的思路是前端进行信息的提交,后端进行详细的信息操作。

添加:前端发送添加展品/行程的信息,后端得到表单数据,生成cookie;

删除:前端发送删除展品的信息,后端接受信息并读取cookie生成链表删除删除相应对象,更新cookie。

显示列表:后端读取cookie,将cookie转换为json发送至客户端,前端根据后端json生成列表。

第二部分、报价计算:

该部分比较简单,得到展品和行程的ArrayList根据相应公式计算的到总价。

代码实现:

servlet类(实现行程和展品信息的处理和给前端发送数据)

  1. package com.bdzp.servlet;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONArray;
  4. import com.bdzp.Utils.GetWord;
  5. import com.bdzp.daomain.modelContractParams;
  6. import com.bdzp.daomain.modelTrip;
  7. import com.bdzp.daomain.modelVolume;
  8. import com.bdzp.service.PriceService;
  9. import com.bdzp.service.imp.PriceServiceTestImpI;
  10. import javax.servlet.ServletException;
  11. import javax.servlet.annotation.WebServlet;
  12. import javax.servlet.http.Cookie;
  13. import javax.servlet.http.HttpServlet;
  14. import javax.servlet.http.HttpServletRequest;
  15. import javax.servlet.http.HttpServletResponse;
  16. import java.io.*;
  17. import java.net.URLDecoder;
  18. import java.net.URLEncoder;
  19. import java.net.http.HttpResponse;
  20. import java.text.ParseException;
  21. import java.text.SimpleDateFormat;
  22. import java.util.*;
  23. @WebServlet(name = "ServletPriceTest")
  24. public class ServletPriceTest extends HttpServlet {
  25. private static final long serialVersionUID=1L;
  26. private PriceService ps=new PriceServiceTestImpI();
  27. modelContractParams params=new modelContractParams();
  28. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  29. request.setCharacterEncoding("UTF-8");//解决乱码
  30. response.setContentType("text/html;charset=UTF-8");
  31. String type =request.getParameter("command");
  32. if ("addDisplay".equals(type))
  33. {
  34. addDisplay(request,response);
  35. }else if("delDisplay".equals(type)){
  36. delDisplay(request,response);
  37. }else if("getDisplayList".equals(type)){
  38. getDisplayList(request,response);
  39. }else if("addTrip".equals(type)){
  40. addTrip(request,response);
  41. }else if("delTrip".equals(type)){
  42. delTrip(request,response);
  43. }else if("getTripList".equals(type)) {
  44. getTripList(request, response);
  45. } else if("getPrice".equals(type)){
  46. getPrice(request,response);
  47. }else if ("submitParams".equals(type)){
  48. try {
  49. params=submitParams(request, response);
  50. } catch (ParseException e) {
  51. e.printStackTrace();
  52. }
  53. }else if ("madeContract".equals(type)){
  54. downloadFileTest(request, response,params);
  55. }
  56. }
  57. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  58. doPost(request, response);
  59. }
  60. public void addDisplay(HttpServletRequest request,HttpServletResponse response){
  61. String name=request.getParameter("displayName");
  62. int amount=Integer.parseInt(request.getParameter("amount"));
  63. int height=Integer.parseInt(request.getParameter("height"));
  64. int width=Integer.parseInt(request.getParameter("width"));
  65. int length=Integer.parseInt(request.getParameter("length"));
  66. modelVolume volume=new modelVolume();
  67. volume.setName(name);
  68. volume.setAmount(amount);
  69. volume.setLength(length);
  70. volume.setWidth(width);
  71. volume.setHeight(height);
  72. if (addDisplay(volume,response,request)){
  73. System.out.println("添加展品成功");
  74. PrintWriter out= null;
  75. try {
  76. out = response.getWriter();
  77. out.print("Y");
  78. out.flush();
  79. out.close();
  80. } catch (IOException e) {
  81. e.printStackTrace();
  82. }
  83. }
  84. }
  85. public void delDisplay(HttpServletRequest request,HttpServletResponse response){
  86. String name=request.getParameter("displayName");
  87. if (delDisplay(name,response,request)){
  88. System.out.println("删除展品成功");
  89. PrintWriter out=null;
  90. try {
  91. out=response.getWriter();
  92. out.print("Y");
  93. out.flush();
  94. out.close();
  95. }catch (IOException e ){
  96. e.printStackTrace();
  97. }
  98. }
  99. }
  100. public void getDisplayList(HttpServletRequest request,HttpServletResponse response){
  101. String json = null;
  102. try {
  103. json = "{\"code\":0,\"msg\":\"\",\"count\":0,\"data\":" + JSON.toJSONString(getDisplayArrayList(request, response)) + "}";
  104. System.out.println(json);
  105. PrintWriter out=null;
  106. out = response.getWriter();
  107. out.print(json);
  108. out.flush();
  109. out.close();
  110. } catch (IOException e) {
  111. e.printStackTrace();
  112. }
  113. }
  114. public void addTrip(HttpServletRequest request,HttpServletResponse response){
  115. String name=request.getParameter("tripName");
  116. String start=request.getParameter("start");
  117. String end=request.getParameter("goal");
  118. int bigCarAmount=Integer.parseInt(request.getParameter("bigCarAmount"));
  119. int smallCarAmount=Integer.parseInt(request.getParameter("smallCarAmount"));
  120. int bigCarDistance=Integer.parseInt(request.getParameter("bigCarDistance"));
  121. int smallCarDistance=Integer.parseInt(request.getParameter("smallCarDistance"));
  122. int workerAmount=Integer.parseInt(request.getParameter("workerAmount"));
  123. int workerDays=Integer.parseInt(request.getParameter("workerDays"));
  124. modelTrip trip=new modelTrip();
  125. trip.setName(name);
  126. trip.setStart(start);
  127. trip.setEnd(end);
  128. trip.setBigCarAmount(bigCarAmount);
  129. trip.setBigCarDistance(bigCarDistance);
  130. trip.setSmallCarAmount(smallCarAmount);
  131. trip.setSmallCarDistance(smallCarDistance);
  132. trip.setWorkerAmount(workerAmount);
  133. trip.setWorkerDays(workerDays);
  134. if (addTrip(trip,response,request)){
  135. System.out.println("添加行程成功");
  136. PrintWriter out= null;
  137. try {
  138. out = response.getWriter();
  139. out.print("Y");
  140. out.flush();
  141. out.close();
  142. } catch (IOException e) {
  143. e.printStackTrace();
  144. }
  145. }
  146. }
  147. public void delTrip(HttpServletRequest request,HttpServletResponse response){
  148. String name=request.getParameter("tripName");
  149. if (delTrip(name,response,request)){
  150. System.out.println("删除行程成功");
  151. PrintWriter out=null;
  152. try {
  153. out=response.getWriter();
  154. out.print("Y");
  155. out.flush();
  156. out.close();
  157. }catch (IOException e ){
  158. e.printStackTrace();
  159. }
  160. }
  161. }
  162. public void getTripList(HttpServletRequest request,HttpServletResponse response){
  163. try {
  164. String json = "{\"code\":0,\"msg\":\"\",\"count\":0,\"data\":" + JSON.toJSONString(getTripArrayList(request, response)) + "}";
  165. System.out.println(json);
  166. PrintWriter out=null;
  167. out = response.getWriter();
  168. out.print(json);
  169. out.flush();
  170. out.close();
  171. } catch (IOException e) {
  172. e.printStackTrace();
  173. }
  174. }
  175. public boolean addDisplay(modelVolume model,HttpServletResponse response,HttpServletRequest request) {
  176. boolean flag=false;
  177. try {
  178. //value中储存的使json字符转,将json字符串转换为对象数组
  179. Cookie cookie=getCookie("displayList",response, request);
  180. //将json字符串转换为对象数组
  181. ArrayList<modelVolume> displayList=new ArrayList<modelVolume>();
  182. String cookieValue=URLDecoder.decode(cookie.getValue(), "utf-8");
  183. displayList= (ArrayList<modelVolume>) JSON.parseArray(cookieValue,modelVolume.class);
  184. displayList.add(model);
  185. JSONArray array=JSONArray.parseArray(JSON.toJSONString(displayList));
  186. System.out.println(array);
  187. String encodeCookie = null;
  188. encodeCookie = URLEncoder.encode(array.toJSONString(),"utf-8");
  189. response.addCookie(new Cookie("displayList",encodeCookie));
  190. flag=true;
  191. } catch (UnsupportedEncodingException e) {
  192. e.printStackTrace();
  193. }
  194. return flag;
  195. }
  196. public boolean delDisplay(String name,HttpServletResponse response,HttpServletRequest request){
  197. Cookie cookie=getCookie("displayList",response, request);
  198. try {
  199. String cookieValue=URLDecoder.decode(cookie.getValue(), "utf-8");
  200. ArrayList<modelVolume> displayList= (ArrayList<modelVolume>) JSON.parseArray(cookieValue,modelVolume.class);
  201. for (modelVolume display:displayList){
  202. if (display.getName().equals(name)){
  203. displayList.remove(display);
  204. JSONArray array=JSONArray.parseArray(JSON.toJSONString(displayList));
  205. try {
  206. String encodeCookie = URLEncoder.encode(array.toJSONString(),"utf-8");
  207. response.addCookie(new Cookie("displayList",encodeCookie));
  208. } catch (UnsupportedEncodingException e) {
  209. e.printStackTrace();
  210. }
  211. return true;
  212. }
  213. }
  214. } catch (UnsupportedEncodingException e) {
  215. e.printStackTrace();
  216. }
  217. return false;
  218. }
  219. public ArrayList<modelVolume>getDisplayArrayList(HttpServletRequest request,HttpServletResponse response) throws UnsupportedEncodingException {
  220. Cookie cookie=getCookie("displayList",response, request);
  221. String cookieValue=URLDecoder.decode(cookie.getValue(), "utf-8");
  222. ArrayList<modelVolume> displayList= (ArrayList<modelVolume>) JSON.parseArray(cookieValue,modelVolume.class);
  223. return displayList;
  224. }
  225. public boolean addTrip(modelTrip model,HttpServletResponse response,HttpServletRequest request){
  226. boolean flag=false;
  227. //value中储存的使json字符转,将json字符串转换为对象数组
  228. try {
  229. Cookie cookie=getCookie("tripList",response, request);
  230. //将json字符串转换为对象数组
  231. ArrayList<modelTrip> tripList=new ArrayList<modelTrip>();
  232. String cookieValue=URLDecoder.decode(cookie.getValue(), "utf-8");
  233. tripList= (ArrayList<modelTrip>) JSON.parseArray(cookieValue,modelTrip.class);
  234. tripList.add(model);
  235. JSONArray array=JSONArray.parseArray(JSON.toJSONString(tripList));
  236. System.out.println(array);
  237. String encodeCookie = null;
  238. encodeCookie = URLEncoder.encode(array.toJSONString(),"utf-8");
  239. response.addCookie(new Cookie("tripList",encodeCookie));
  240. flag=true;
  241. } catch (UnsupportedEncodingException e) {
  242. e.printStackTrace();
  243. }
  244. return flag;
  245. }
  246. public boolean delTrip(String name,HttpServletResponse response,HttpServletRequest request){
  247. Cookie cookie=getCookie("tripList",response, request);
  248. try {
  249. String cookieValue=URLDecoder.decode(cookie.getValue(), "utf-8");
  250. ArrayList<modelTrip> tripList= (ArrayList<modelTrip>) JSON.parseArray(cookieValue,modelTrip.class);
  251. for (modelTrip trip:tripList){
  252. if (trip.getName().equals(name)){
  253. tripList.remove(trip);
  254. JSONArray array=JSONArray.parseArray(JSON.toJSONString(tripList));
  255. try {
  256. String encodeCookie = URLEncoder.encode(array.toJSONString(),"utf-8");
  257. response.addCookie(new Cookie("tripList",encodeCookie));
  258. } catch (UnsupportedEncodingException e) {
  259. e.printStackTrace();
  260. }
  261. return true;
  262. }
  263. }
  264. } catch (UnsupportedEncodingException e) {
  265. e.printStackTrace();
  266. }
  267. return false;
  268. }
  269. public ArrayList<modelTrip>getTripArrayList(HttpServletRequest request,HttpServletResponse response) throws UnsupportedEncodingException {
  270. Cookie cookie=getCookie("tripList",response, request);
  271. String cookieValue=URLDecoder.decode(cookie.getValue(), "utf-8");
  272. ArrayList<modelTrip> tripList= (ArrayList<modelTrip>) JSON.parseArray(cookieValue,modelTrip.class);
  273. return tripList;
  274. }
  275. public Cookie getCookie(String name,HttpServletResponse response,HttpServletRequest request){
  276. Cookie result=null;
  277. boolean flag=false;
  278. if (request.getCookies()!=null){
  279. for (Cookie cookie:request.getCookies()){
  280. if (cookie.getName().equals(name)){
  281. result=cookie;
  282. flag=true;
  283. }
  284. }
  285. }
  286. if (!flag){
  287. try {
  288. String encodeCookie = URLEncoder.encode("[]","utf-8");
  289. Cookie cookie=new Cookie(name,encodeCookie);
  290. cookie.setMaxAge(1);
  291. response.addCookie(cookie);
  292. result=cookie;
  293. } catch (UnsupportedEncodingException e) {
  294. e.printStackTrace();
  295. }
  296. }
  297. return result;
  298. }
  299. public void getPrice(HttpServletRequest request,HttpServletResponse response){
  300. try {
  301. String company=request.getParameter("company");
  302. int price =ps.getPrice(company,getDisplayArrayList(request, response),getTripArrayList(request, response)).get(7);
  303. PrintWriter out = null;
  304. out = response.getWriter();
  305. out.print(price);
  306. out.flush();
  307. out.close();
  308. } catch (IOException e) {
  309. e.printStackTrace();
  310. }
  311. }
  312. public modelContractParams submitParams(HttpServletRequest request,HttpServletResponse response) throws ParseException {
  313. String company =request.getParameter("company");
  314. String activity=request.getParameter("activity");
  315. String partyA=request.getParameter("partyA");
  316. String address=request.getParameter("address");
  317. String name=request.getParameter("name");
  318. String phone=request.getParameter("phone");
  319. String startString=request.getParameter("startDate");
  320. String endString=request.getParameter("end");
  321. String start= new String(new SimpleDateFormat("yyyy年MM月dd日").format(new SimpleDateFormat("yyyy-MM-dd").parse(startString)));
  322. String end= new String(new SimpleDateFormat("yyyy年MM月dd日").format(new SimpleDateFormat("yyyy-MM-dd").parse(endString)));
  323. modelContractParams params=new modelContractParams();
  324. params.setCompany(company);
  325. params.setActivity(activity);
  326. params.setAddress(address);
  327. params.setName(name);
  328. params.setPartyA(partyA);
  329. params.setPhone(phone);
  330. params.setStart(start);
  331. params.setEnd(end);
  332. try {
  333. PrintWriter out=null;
  334. out=response.getWriter();
  335. out.print("Y");
  336. out.flush();
  337. out.close();
  338. }catch (IOException e ){
  339. e.printStackTrace();
  340. }
  341. return params;
  342. }
  343. public void downloadFileTest(HttpServletRequest request,HttpServletResponse response,modelContractParams params){
  344. try {
  345. // 处理中文文件名下载乱码
  346. request.setCharacterEncoding("UTF-8");
  347. String path = "";
  348. String fileName = "";
  349. String activity=params.getActivity();
  350. String name ="“"+ activity+"”展品包装运输服务协议书.doc";
  351. // 投保书
  352. fileName = new String(name.getBytes("UTF-8"), "iso-8859-1");
  353. GetWord gw = new GetWord();
  354. //价格明细表格
  355. List<Map<String,String>> priceTableList=new ArrayList<Map<String,String>>();
  356. Map<String,String> tempValue=new HashMap<>();
  357. List<Integer> priceList=ps.getPrice(request.getParameter("company"),getDisplayArrayList(request, response),getTripArrayList(request, response));
  358. tempValue.put("inProductionCost",String.valueOf(priceList.get(0)));
  359. tempValue.put("packingMaterialCost",String.valueOf(priceList.get(1)));
  360. tempValue.put("outProductionCost",String.valueOf(priceList.get(2)));
  361. tempValue.put("bigCarCost",String.valueOf(priceList.get(3)));
  362. tempValue.put("smallCarCost",String.valueOf(priceList.get(4)));
  363. tempValue.put("workerCost",String.valueOf(priceList.get(5)));
  364. tempValue.put("taxes",String.valueOf(priceList.get(6)));
  365. tempValue.put("sumCost",String.valueOf(priceList.get(7)));
  366. priceTableList.add(tempValue);
  367. path = gw.getWordTest(request, response,
  368. priceTableList,
  369. ps.getParams(params,getDisplayArrayList(request, response),getTripArrayList(request, response),priceList));
  370. response.setCharacterEncoding("utf-8");
  371. response.setContentType("application/msword"); // word格式
  372. response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
  373. File file = new File(path);
  374. InputStream inputStream = new FileInputStream(file);
  375. OutputStream os = response.getOutputStream();
  376. byte[] b = new byte[10240];
  377. int length;
  378. while ((length = inputStream.read(b)) > 0) {
  379. os.write(b, 0, length);
  380. }
  381. inputStream.close();
  382. os.flush();
  383. os.close();
  384. file.delete();
  385. } catch (FileNotFoundException e) {
  386. e.printStackTrace();
  387. } catch (IOException e) {
  388. e.printStackTrace();
  389. }
  390. }
  391. }

PriceServicempl类,用于价格计算

  1. public List<Integer> getPrice(String company, ArrayList<modelVolume> displayList, ArrayList<modelTrip> tripList) {
  2. int price=0;
  3. //得到总体积 保留三位小数
  4. double sumVolume=0; //总体积
  5. int sumDisplayAmount=0;//得到展品总量
  6. for (modelVolume volume:displayList){
  7. sumVolume+=volume.getVolume();
  8. sumDisplayAmount+=volume.getAmount();
  9. }
  10. sumVolume=Math.ceil(sumVolume*0.001)*0.001;
  11. /*报价计算*/
  12. //包装费用
  13. int inProductionCost=(int)Math.ceil(sumVolume*2800*0.1)*10; //inProductionCost 内箱制作费
  14. int packingMaterialCost=0; //PackingMaterialCost 包装材料费
  15. if (sumDisplayAmount<=70){
  16. packingMaterialCost=3000;
  17. }else {
  18. packingMaterialCost=5000;
  19. }
  20. //((int)(sumVolume/0.5)==sumVolume/0.5?sumVolume/0.5*1800:(sumVolume/0.5+1)*1800);
  21. int outProductionCost=(int)Math.ceil(sumVolume/0.5)*1800; //outProductionCost 外箱制作费
  22. int finallyPackingCost=inProductionCost+outProductionCost+packingMaterialCost;//finallyPackingCost 总包装费
  23. int bigCarCost=0;//大车总费用
  24. int smallCarCost=0;//小车总费用
  25. int workerCost=0;//总人工费
  26. for (modelTrip trip:tripList){
  27. bigCarCost+=trip.getBigCarAmount()*trip.getBigCarDistance()*18;
  28. smallCarCost+=trip.getSmallCarAmount()*trip.getSmallCarDistance()*10;
  29. workerCost+=trip.getWorkerAmount()*trip.getWorkerDays()*800;
  30. }
  31. double x=Math.ceil((finallyPackingCost+bigCarCost+smallCarCost+workerCost)*0.1)*10;
  32. price=(int)x;
  33. int taxation=0;//税费
  34. if (price==3000) {
  35. price=0;
  36. } else if ("BeiJing".equals(company)) {
  37. taxation=(int)Math.ceil(price * 0.06 / 10) * 10;
  38. price=taxation + price;
  39. } else if ("HeNan".equals(company)) {
  40. taxation=(int)Math.ceil(price * 0.03 / 10) * 10;
  41. price=taxation + price;
  42. }
  43. List<Integer> priceList=new ArrayList<Integer>();
  44. priceList.add(inProductionCost);
  45. priceList.add(packingMaterialCost);
  46. priceList.add(outProductionCost);
  47. priceList.add(bigCarCost);
  48. priceList.add(smallCarCost);
  49. priceList.add(workerCost);
  50. priceList.add(taxation);
  51. priceList.add(price);
  52. return priceList;
  53. }

前端代码:

``

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>价格计算</title>
  6. <link rel="stylesheet" href="layui/css/layui.css" />
  7. </head>
  8. <style type="text/css">
  9. .main {
  10. margin: 50px auto;
  11. width: 80%;
  12. border: 1px solid #d9d9d9;
  13. }
  14. fieldset{
  15. color: #4E5465;
  16. border:0.0625rem #e6e6e6 solid;
  17. }
  18. </style>
  19. <body>
  20. <!-- 导航部分 -->
  21. <div class="header">
  22. <ul class="layui-nav" lay-filter="">
  23. <li class="layui-nav-item"><a href="">最新活动</a></li>
  24. <li class="layui-nav-item layui-this"><a href="">产品</a></li>
  25. <li class="layui-nav-item"><a href="">大数据</a></li>
  26. <li class="layui-nav-item">
  27. <a href="javascript:;">解决方案</a>
  28. <dl class="layui-nav-child">
  29. <!-- 二级菜单 -->
  30. <dd><a href="">移动模块</a></dd>
  31. <dd><a href="">后台模版</a></dd>
  32. <dd><a href="">电商平台</a></dd>
  33. </dl>
  34. </li>
  35. <li class="layui-nav-item"><a href="">社区</a></li>
  36. </ul>
  37. </div>
  38. <!-- 主体部分 -->
  39. <div class="main">
  40. <div class="layui-tab layui-tab-brief" lay-filter="tabDemo">
  41. <ul class="layui-tab-title">
  42. <li id="li1" class="layui-this">添加展品</li>
  43. <li id="li2">添加行程</li>
  44. <li id="li3">生成报价</li>
  45. <li id="li4">生成合同</li>
  46. </ul>
  47. <div class="layui-tab-content">
  48. <!-- 展品 -->
  49. <div class="layui-tab-item layui-show" id="table1" lay-id="table1">
  50. <!-- 表单 -->
  51. <!-- action="ServletPrice?command=addDisplay" method="post"-->
  52. <form class="layui-form layui-form-pane" action="" >
  53. <div class="layui-form-item">
  54. <div class="layui-inline">
  55. <label class="layui-form-label">展品名称</label>
  56. <div class="layui-input-inline">
  57. <input type="text" id="displayName" lay-verify="required" placeholder="请输入展品名称" autocomplete="off" class="layui-input">
  58. </div>
  59. </div>
  60. <div class="layui-inline">
  61. <label class="layui-form-label">数量</label>
  62. <div class="layui-input-inline">
  63. <input type="text" id="amount" lay-verify="required|number" placeholder="单位:件" autocomplete="off" class="layui-input">
  64. </div>
  65. </div>
  66. </div>
  67. <div class="layui-form-item">
  68. <div class="layui-inline">
  69. <label class="layui-form-label">展品长度:</label>
  70. <div class="layui-input-inline">
  71. <input type="text" id="length" lay-verify="required|number" placeholder="单位:cm" autocomplete="off" class="layui-input">
  72. </div>
  73. </div>
  74. <div class="layui-inline">
  75. <label class="layui-form-label">展品宽度:</label>
  76. <div class="layui-input-inline">
  77. <input type="text" id="width" lay-verify="required|number" placeholder="单位:cm" autocomplete="off" class="layui-input">
  78. </div>
  79. </div>
  80. <div class="layui-inline">
  81. <label class="layui-form-label">展品高度:</label>
  82. <div class="layui-input-inline">
  83. <input type="text" id="height" lay-verify="required|number" placeholder="单位:cm" autocomplete="off" class="layui-input">
  84. </div>
  85. </div>
  86. <div class="layui-inline">
  87. <button class="layui-btn" lay-submit="addDisplay" lay-filter="addDisplay">添加展品</button>
  88. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  89. </div>
  90. </div>
  91. </form>
  92. <!-- 表格 -->
  93. <table id="displayTable" lay-filter="displayTable"></table>
  94. <button class="layui-btn layui-btn-lg" onclick="toTable2()">下一步</button>
  95. </div>
  96. <!-- 行程 -->
  97. <div class="layui-tab-item" id="table2" lay-id="table2">
  98. <!-- 表单 -->
  99. <form class="layui-form layui-form-pane" action="">
  100. <fieldset>
  101. <legend>行程信息</legend>
  102. <div class="layui-form-item">
  103. <div class="layui-inline">
  104. <label class="layui-form-label">行程名称:</label>
  105. <div class="layui-input-inline">
  106. <input type="text" id="tripName" lay-verify="required" placeholder="请输入行程名称" autocomplete="off" class="layui-input">
  107. </div>
  108. </div>
  109. <div class="layui-inline">
  110. <label class="layui-form-label">起始地:</label>
  111. <div class="layui-input-inline">
  112. <input type="text" id="start" lay-verify="required" placeholder="请输入起始地" autocomplete="off" class="layui-input">
  113. </div>
  114. </div>
  115. <div class="layui-inline">
  116. <label class="layui-form-label">目的地:</label>
  117. <div class="layui-input-inline">
  118. <input type="text" id="goal" lay-verify="required" placeholder="请输入目的地" autocomplete="off" class="layui-input">
  119. </div>
  120. </div>
  121. </div>
  122. </fieldset>
  123. <fieldset>
  124. <legend>大车运输</legend>
  125. <div class="layui-form-item">
  126. <div class="layui-inline">
  127. <label class="layui-form-label">车辆数目:</label>
  128. <div class="layui-input-inline">
  129. <input type="text" id="bigCarAmount" lay-verify="required|number" placeholder="单位:辆" autocomplete="off" class="layui-input">
  130. </div>
  131. </div>
  132. <div class="layui-inline">
  133. <label class="layui-form-label">行驶距离:</label>
  134. <div class="layui-input-inline">
  135. <input type="text" id="bigCarDistance" lay-verify="required|number" placeholder="单位:公里" autocomplete="off" class="layui-input">
  136. </div>
  137. </div>
  138. </div>
  139. </fieldset>
  140. <fieldset>
  141. <legend>小车运输</legend>
  142. <div class="layui-form-item">
  143. <div class="layui-inline">
  144. <label class="layui-form-label">车辆数目</label>
  145. <div class="layui-input-inline">
  146. <input type="text" id="smallCarAmount" lay-verify="required|number" placeholder="单位:辆" autocomplete="off" class="layui-input">
  147. </div>
  148. </div>
  149. <div class="layui-inline">
  150. <label class="layui-form-label">行驶距离</label>
  151. <div class="layui-input-inline">
  152. <input type="text" id="smallCarDistance" lay-verify="required|number" placeholder="单位:公里" autocomplete="off" class="layui-input">
  153. </div>
  154. </div>
  155. </div>
  156. </fieldset>
  157. <fieldset>
  158. <legend>人工服务</legend>
  159. <div class="layui-form-item">
  160. <div class="layui-inline">
  161. <label class="layui-form-label">人工数量</label>
  162. <div class="layui-input-inline">
  163. <input type="text" id="workerAmount" lay-verify="required|number" placeholder="单位:人" autocomplete="off" class="layui-input">
  164. </div>
  165. </div>
  166. <div class="layui-inline">
  167. <label class="layui-form-label">服务天数</label>
  168. <div class="layui-input-inline">
  169. <input type="text" id="workerDays" lay-verify="required|number" placeholder="单位:天" autocomplete="off" class="layui-input">
  170. </div>
  171. </div>
  172. <div class="layui-inline">
  173. <button class="layui-btn" lay-submit lay-filter="addTrip">添加行程</button>
  174. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  175. </div>
  176. </div>
  177. </fieldset>
  178. </form>
  179. <!-- 表格 -->
  180. <table id="tripTable" lay-filter="tripTable"></table>
  181. <button class="layui-btn layui-btn-lg" onclick="toTable3()">下一步</button>
  182. </div>
  183. <!-- 生成报价 -->
  184. <div class="layui-tab-item" id="table3" lay-id="table3">
  185. <div class="layui-card">
  186. <div class="layui-card-header">合计费用</div>
  187. <form class="layui-form layui-form-pane" action="">
  188. <div class="layui-inline">
  189. <label class="layui-form-label" style="width: 180px;">您选择的服务公司是</label>
  190. <div class="layui-input-inline">
  191. <select id="company">
  192. <option value="BeiJing">北京总公司</option>
  193. <option value="HeNan">河南分公司</option>
  194. </select>
  195. </div>
  196. </div>
  197. <div class="layui-inline">
  198. <button class="layui-btn" lay-submit lay-filter="getPrice">立即查询</button>
  199. </div>
  200. <div class="layui-inline">
  201. <div class="layui-card-body">
  202. <p id="price" style="color: #FF5722; font-size: 20px; margin-left: 10%; width: 250px;">
  203. </p>
  204. <div id="price2"style="color: #FF5722; font-size: 20px; margin-left: 10%; width: 250px;"></div>
  205. </div>
  206. </div>
  207. </form>
  208. </div>
  209. <button class="layui-btn layui-btn-lg" onclick="toTable4()">下一步</button>
  210. </div>
  211. <!-- 生成合同 -->
  212. <div class="layui-tab-item" id="table4" lay-id="table4">
  213. <!-- 表单 -->
  214. <form class="layui-form layui-form-pane" action="">
  215. <fieldset>
  216. <legend>信息录入</legend>
  217. <div class="layui-form-item">
  218. <div class="layui-inline">
  219. <label class="layui-form-label">活动名称</label>
  220. <div class="layui-input-inline">
  221. <input type="text" id="activity" lay-verify="required" placeholder="请输入活动名称" autocomplete="off" class="layui-input" />
  222. </div>
  223. </div>
  224. <div class="layui-inline">
  225. <label class="layui-form-label">甲方名称</label>
  226. <div class="layui-input-inline">
  227. <input type="text" id="partyA" lay-verify="required" placeholder="请输入甲方名称" autocomplete="off" class="layui-input" />
  228. </div>
  229. </div>
  230. <div class="layui-inline">
  231. <label class="layui-form-label">甲方地址</label>
  232. <div class="layui-input-inline">
  233. <input type="text" id="address" lay-verify="required" placeholder="请输入甲方地址" autocomplete="off" class="layui-input" />
  234. </div>
  235. </div>
  236. </div>
  237. <div class="layui-form-item">
  238. <div class="layui-inline">
  239. <label class="layui-form-label">联系人</label>
  240. <div class="layui-input-inline">
  241. <input type="text" id="name" lay-verify="required" placeholder="请输入联系人姓名" autocomplete="off" class="layui-input" />
  242. </div>
  243. </div>
  244. <div class="layui-inline">
  245. <label class="layui-form-label">电话</label>
  246. <div class="layui-input-inline">
  247. <input type="text" id="phone" lay-verify="required|number|phone" placeholder="请输入电话" autocomplete="off" class="layui-input" />
  248. </div>
  249. </div>
  250. <div class="layui-inline">
  251. <label class="layui-form-label">活动时间</label>
  252. <div class="layui-input-inline" style="width: 100px;">
  253. <input type="text" name="startDate" id="startDate" lay-verify="date" placeholder="开始时间" autocomplete="off" class="layui-input">
  254. </div>
  255. <div class="layui-form-mid">-</div>
  256. <div class="layui-input-inline" style="width: 100px;">
  257. <input type="text" name="endDate" id="endDate" lay-verify="date" placeholder="结束时间" autocomplete="off" class="layui-input">
  258. </div>
  259. </div>
  260. </div>
  261. <div class="layui-form-item">
  262. <div class="layui-inline">
  263. <button class="layui-btn" lay-submit lay-filter="madeContract">生成合同</button>
  264. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  265. </div>
  266. </div>
  267. </fieldset>
  268. </form>
  269. </div>
  270. </div>
  271. </div>
  272. </div>
  273. <script>
  274. function toTable2() { //display: block!important;
  275. document.getElementById("li1").className = "layui-this";
  276. document.getElementById("li2").className = "layui-this";
  277. document.getElementById("li3").className = "li3";
  278. document.getElementsByClassName("li1").className = "li1 layui-this";
  279. document.getElementById("table1").className = "layui-tab-item";
  280. document.getElementById("table2").className = "layui-tab-item layui-show";
  281. document.getElementById("table3").className = "layui-tab-item";
  282. }
  283. function toTable3() { //display: block!important;
  284. document.getElementById("li1").className = "layui-this";
  285. document.getElementById("li2").className = "layui-this";
  286. document.getElementById("li3").className = "layui-this";
  287. document.getElementById("table1").className = "layui-tab-item";
  288. document.getElementById("table2").className = "layui-tab-item";
  289. document.getElementById("table3").className = "layui-tab-item layui-show";
  290. }
  291. function toTable4() { //display: block!important;
  292. document.getElementById("li1").className = "layui-this";
  293. document.getElementById("li2").className = "layui-this";
  294. document.getElementById("li3").className = "layui-this";
  295. document.getElementById("li4").className = "layui-this";
  296. document.getElementById("table1").className = "layui-tab-item";
  297. document.getElementById("table2").className = "layui-tab-item";
  298. document.getElementById("table3").className = "layui-tab-item";
  299. document.getElementById("table4").className = "layui-tab-item layui-show";
  300. }
  301. </script>
  302. <!-- 页脚部分 -->
  303. <div class="footer">
  304. </div>
  305. <script src="layui/layui.js"></script>
  306. <script>
  307. //日期
  308. layui.use('laydate', function(){
  309. var laydate = layui.laydate;
  310. //执行一个laydate实例
  311. laydate.render({
  312. elem: '#startDate',//指定元素
  313. });
  314. laydate.render({
  315. elem: '#endDate',//指定元素
  316. });
  317. });
  318. //选项卡
  319. layui.use('element', function() {
  320. var element = layui.element;
  321. //事件监听
  322. element.on('tab(tabDemo)', function(data) {
  323. console.log(data);
  324. });
  325. });
  326. //表单
  327. layui.use('form', function () {
  328. var form = layui.form;
  329. var $ = layui.$;
  330. /* 监听提交 */
  331. form.on('submit(addDisplay)', function (data) {
  332. var table=layui.table;
  333. var jsondata = JSON.stringify(data.field);
  334. $.ajax({
  335. type: 'POST',
  336. url: 'ServletPriceTest?command=addDisplay&Date=' + new Date(),
  337. data: {
  338. //jsondata: jsondata
  339. displayName: $("#displayName").val(),
  340. amount: $("#amount").val(),
  341. width: $("#width").val(),
  342. height: $("#height").val(),
  343. length: $("#length").val()
  344. },
  345. dataType: "text",
  346. async: false,
  347. success: function (text) {
  348. if (text == "Y") {
  349. layui.use('layer', function () {
  350. var layer = layui.layer;
  351. layer.msg('提交成功!');
  352. });
  353. table.reload('displayTable', {
  354. where: {
  355. tripName: $("#tripName").val()
  356. }
  357. , page: {
  358. curr: $(".layui-laypage-skip").find("input").val() //重新从第 1 页开始
  359. }
  360. });
  361. } else {
  362. layui.use('layer', function () {
  363. var layer = layui.layer;
  364. layer.msg('提交失败!');
  365. });
  366. }
  367. }
  368. });
  369. return false;
  370. });
  371. form.on('submit(addTrip)', function (data) {
  372. var jsondata = JSON.stringify(data.field);
  373. var table=layui.table;
  374. $.ajax({
  375. type: 'POST',
  376. url: 'ServletPriceTest?command=addTrip&Date=' + new Date(),
  377. data: {
  378. //jsondata: jsondata
  379. start: $("#start").val(),
  380. goal: $("#goal").val(),
  381. tripName: $("#tripName").val(),
  382. bigCarAmount: $("#bigCarAmount").val(),
  383. smallCarAmount: $("#smallCarAmount").val(),
  384. bigCarDistance: $("#bigCarDistance").val(),
  385. smallCarDistance: $("#smallCarDistance").val(),
  386. workerAmount: $("#workerAmount").val(),
  387. workerDays: $("#workerDays").val()
  388. },
  389. dataType: "text",
  390. async: false,
  391. success: function (text) {
  392. if (text == "Y") {
  393. layui.use('layer', function () {
  394. var layer = layui.layer;
  395. layer.msg('提交成功!');
  396. });
  397. table.reload('tripTable', {
  398. where: {
  399. tripName: $("#tripName").val()
  400. }
  401. , page: {
  402. curr: $(".layui-laypage-skip").find("input").val() //重新从第 1 页开始
  403. }
  404. });
  405. } else {
  406. layui.use('layer', function () {
  407. var layer = layui.layer;
  408. layer.msg('提交失败!');
  409. });
  410. }
  411. }
  412. });
  413. return false;
  414. });
  415. form.on('submit(madeContract)', function (data) {
  416. var jsondata = JSON.stringify(data.field);
  417. var table=layui.table;
  418. $.ajax({
  419. type: 'POST',
  420. url: 'ServletPriceTest?command=submitParams&Date=' + new Date(),
  421. data: {
  422. //jsondata: jsondata
  423. activity: $("#activity").val(),
  424. partyA: $("#partyA").val(),
  425. address: $("#address").val(),
  426. name: $("#name").val(),
  427. phone: $("#phone").val(),
  428. startDate: $("#startDate").val(),
  429. end: $("#endDate").val(),
  430. company: $("#company").val()
  431. },
  432. dataType: "text",
  433. async: false,
  434. success: function (text) {
  435. if (text === "Y") {
  436. layui.use('layer', function () {
  437. var layer = layui.layer;
  438. layer.msg('提交成功,正在生成合同!');
  439. //(function () {
  440. window.location.href='ServletPriceTest?command=madeContract'
  441. //}, 1000);
  442. });
  443. } else {
  444. layui.use('layer', function () {
  445. var layer = layui.layer;
  446. layer.msg('提交失败!');
  447. });
  448. }
  449. }
  450. });
  451. return false;
  452. });
  453. form.on('submit(getPrice)', function (data) {
  454. var jsondata = JSON.stringify(data.field);
  455. $.ajax({
  456. type: 'POST',
  457. url: "ServletPriceTest?command=getPrice&Date=" + new Date(),
  458. data: {
  459. //jsondata: jsondata
  460. company: $("#company").val(),
  461. },
  462. dataType: "text",
  463. async: false,
  464. success: function (text) {
  465. layui.use('layer', function () {
  466. var layer = layui.layer;
  467. if (text==0){
  468. layer.msg('查询失败!您未填写订单信息!')
  469. }else {
  470. layer.msg('查询成功!\n总价格:'+text+'元');
  471. }
  472. });
  473. $("#price2").val(text);
  474. }
  475. });
  476. return false;
  477. });
  478. });
  479. //表格
  480. layui.use('table', function(){
  481. var table = layui.table;
  482. //展品列表
  483. table.render({
  484. elem: '#displayTable'
  485. ,height: 312
  486. ,url: 'ServletPriceTest?command=getDisplayList'//数据接口
  487. ,page: false //开启分页
  488. ,cols: [
  489. [ //表头
  490. {
  491. field: 'name',
  492. title: '展品名称',
  493. width: '20%',
  494. sort: true,
  495. fixed: 'left'
  496. }, {
  497. field: 'amount',
  498. title: '数量',
  499. width: '16%'
  500. }, {
  501. field: 'length',
  502. title: '长度',
  503. width: '16%'
  504. }, {
  505. field: 'width',
  506. title: '宽度',
  507. width: '16%'
  508. }, {
  509. field: 'height',
  510. title: '高度',
  511. width: '16%'
  512. }, {
  513. fixed: 'right',
  514. width: '16%',
  515. title: '操作',
  516. align: 'center',
  517. toolbar: '#toolbar'
  518. }
  519. ]
  520. ]
  521. });
  522. //监听工具条
  523. table.on('tool(displayTable)', function (obj) {
  524. var jsondata = JSON.stringify(obj.data),
  525. $=layui.$;
  526. jsondata = JSON.parse(jsondata);
  527. if (obj.event === 'del') {//删除
  528. layer.confirm('警告:确定要删除么?', {
  529. yes: function () {
  530. $.ajax({
  531. type: 'POST',
  532. url: "ServletPriceTest?command=delDisplay&displayName=" + jsondata.name+ "&Date=" + new Date(),
  533. dataType: "text",
  534. success: function (text) {
  535. if (text == "Y") {
  536. layui.use('layer', function () {
  537. var layer = layui.layer;
  538. layer.msg('删除成功!');
  539. });
  540. table.reload('displayTable', {
  541. where: {
  542. displayName: $("#displayName").val()
  543. }
  544. , page: {
  545. curr: $(".layui-laypage-skip").find("input").val() //重新从第 1 页开始
  546. }
  547. });
  548. } else {
  549. layui.use('layer', function () {
  550. var layer = layui.layer;
  551. layer.msg('操作异常,请联系管理员!');
  552. });
  553. }
  554. }
  555. });
  556. }
  557. });
  558. }
  559. });
  560. table.render({
  561. elem: '#tripTable'
  562. ,height: 312
  563. ,url: 'ServletPriceTest?command=getTripList' //数据接口
  564. ,page: false //开启分页
  565. ,cols: [
  566. [ //表头
  567. {
  568. field: 'name',
  569. title: '行程名称',
  570. width: '10%',
  571. sort: true,
  572. fixed: 'left'
  573. }, {
  574. field: 'start',
  575. title: '起始地',
  576. width: '10%'
  577. },{
  578. field: 'end',
  579. title: '目的地',
  580. width: '10%'
  581. },{
  582. field: 'bigCarAmount',
  583. title: '大车数量',
  584. width: '10%'
  585. }, {
  586. field: 'bigCarDistance',
  587. title: '大车运输距离',
  588. width: '10%'
  589. }, {
  590. field: 'smallCarAmount',
  591. title: '小车数量',
  592. width: '10%'
  593. }, {
  594. field: 'smallCarDistance',
  595. title: '小车运输距离',
  596. width: '10%'
  597. }, {
  598. field: 'workerAmount',
  599. title: '人工数量',
  600. width: '10%'
  601. }, {
  602. field: 'workerDays',
  603. title: '人工服务天数',
  604. width: '10%'
  605. }, {
  606. fixed: 'right',
  607. width: '10%',
  608. title: '操作',
  609. align: 'center',
  610. toolbar: '#toolbar'
  611. }
  612. ]
  613. ]
  614. });
  615. table.on('tool(tripTable)', function (obj) {
  616. var jsondata = JSON.stringify(obj.data);
  617. var $=layui.$;
  618. jsondata = JSON.parse(jsondata);
  619. if (obj.event === 'del') {
  620. //删除
  621. layer.confirm('警告:确定要删除么?', {
  622. yes: function () {
  623. $.ajax({
  624. type: 'POST',
  625. url: "ServletPriceTest?command=delTrip&tripName=" + jsondata.name+ "&Date=" + new Date(),
  626. dataType: "text",
  627. success: function (text) {
  628. if (text == "Y") {
  629. layui.use('layer', function () {
  630. var layer = layui.layer;
  631. layer.msg('删除成功!');
  632. });
  633. table.reload('tripTable', {
  634. where: {
  635. tripName: $("#tripName").val()
  636. }
  637. , page: {
  638. curr: $(".layui-laypage-skip").find("input").val() //重新从第 1 页开始
  639. }
  640. });
  641. } else {
  642. layui.use('layer', function () {
  643. var layer = layui.layer;
  644. layer.msg('操作异常,请联系管理员!');
  645. });
  646. }
  647. }
  648. });
  649. }
  650. });
  651. //--------------
  652. }
  653. });
  654. });
  655. </script>
  656. <script type="text/html" id="toolbar">
  657. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon"></i></a>
  658. </script>
  659. </body>
  660. </html>

JavaWeb实战:报价计算系统(layui+tomcat+cookie实现)的更多相关文章

  1. JavaWeb开发学习(二)-配置Tomcat服务器

    1. 下载Tomcat服务器 Tomcat是一个免费.开源的JavaWeb服务器. Tomcat官网是http://tomcat.apache.org/ 我使用的是版本是Tomcat7.0,下载Zip ...

  2. Asp.Net Core 2.0 项目实战(10) 基于cookie登录授权认证并实现前台会员、后台管理员同时登录

    1.登录的实现 登录功能实现起来有哪些常用的方式,大家首先想到的肯定是cookie或session或cookie+session,当然还有其他模式,今天主要探讨一下在Asp.net core 2.0下 ...

  3. JavaWeb学习(二)———Tomcat服务器学习和使用(一)

    一.Tomcat服务器端口的配置 Tomcat的所有配置都放在conf文件夹之中,里面的server.xml文件是配置的核心文件. 如果想修改Tomcat服务器的启动端口,则可以在server.xml ...

  4. Puppet单机实战之Nginx代理Tomcat

    author:JevonWei 版权声明:原创作品 blog:http://119.23.52.191/ --- 构建实战之Nginx代理Tomcat [root@node1 modules]# mk ...

  5. Ansible实战之Nginx代理Tomcat主机架构

    author:JevonWei 版权声明:原创作品 实验架构:一台nginx主机为后端两台tomcat主机的代理,并使用Ansible主机配置 实验环境 Nginx 172.16.252.82 Tom ...

  6. Docker系列(24)- 实战:DockerFile制作tomcat镜像

    实战:DockerFile制作tomcat镜像 step-1 准备镜像文件 tomcat压缩包,jdk压缩包! step-2 编写dockerfile文件,官方命名Dockerfile,build会自 ...

  7. 【JAVAWEB学习笔记】12_Http&Tomcat

    一.Http协议 1.什么是Http协议 HTTP,超文本传输协议(HyperText Transfer Protocol)是互联网上应用最为广泛的     一种网络协议.所有的WWW文件都必须遵守这 ...

  8. 走进JavaWeb技术世界7:Tomcat和其他WEB容器的区别

    本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.com/h2pl/Java-Tutorial 喜欢的话麻烦点下 ...

  9. Eclipse下配置javaweb项目快速部署到tomcat

    用惯了VS,再用Eclipse,完全有一种从自动挡到手动挡的感觉啊. 很多同学在Eclipse下开发web项目,每一次修改代码,看效果的时候都有右键项目->Run as -> Run on ...

随机推荐

  1. 微信小程序之base64图片如何预览与一键保存到本地相册?

    需求:由于后台服务器各方面的限制,现在服务器返回的图片是base64格式的,小程序端需要支持预览图片和多个图片一键下载功能 一.如何预览base64位图片? WXML页面:item.src的值是bas ...

  2. 测试需要用到的chrome调试

    模拟慢网速 断开网络 F12后勾选上offline 请求304 后来发现是选中了该浏览其的Disable cache,去掉就好了.

  3. jmeter 聚合报告参数解释

    label:每个请求的名称 样本:发送给服务器的请求数量 平均值:平均响应时间,默认情况下是单个 Request 的平均响应时间,当使用了 Transaction Controller 时,也可以以T ...

  4. MVC-过滤器-异常处理

    通常异常处理是用try{ }catch{ },导致代码重复冗余. 利用特性处理demo 若action中已经包含try catch 则是被异常处理过,则不会被上面异常捕获到. 不管是视图,还是调用的d ...

  5. Java集合案例(产生不重复随机数)

    获取10个1-20之间的随机数,要求不能重复 用数组实现,但是数组的长度是固定的,长度不好确定.所以我们使用集合实现. 分析:A:创建产生随机数的对象B:创建一个存储随机数的集合C:定义一个统计变量. ...

  6. pytorch Dataset数据集和Dataloader迭代数据集

    import torch from torch.utils.data import Dataset,DataLoader class SmsDataset(Dataset): def __init__ ...

  7. MySQL中出现Unknow column 'xx' in field list的解决办法

    首先创建一个表,然后插入数据发现出错误 经过多次尝试发现title前面多了一个空格 我们把空格去掉,然后在插入数据,发现数据创建成功

  8. 一个老牌程序员推荐的JavaScript的书籍,看了真的不后悔!

    很多人问我怎么学前端?我的回答是:读书吧!相对于在网上学习,在项目中学习和跟着有经验的同事学习,书中有着相对完整的知识体系,每读一本好书都会带来一次全面的提高.而如果深一脚浅一脚的学习,写出代码的质量 ...

  9. Centos 7服务器搭建MySQL(mariadb)服务

    1.下载并安装MySQL yum install mariadb mariadb-server -y 2.启动MySQL systemctl start mariadb 3.对mariadb进行初始化 ...

  10. 8、Flink Table API & Flink Sql API

    一.概述 上图是flink的分层模型,Table API 和 SQL 处于最顶端,是 Flink 提供的高级 API 操作.Flink SQL 是 Flink 实时计算为简化计算模型,降低用户使用实时 ...