gongdecai 1 vuosi sitten
vanhempi
commit
2c265e45ac
12 muutettua tiedostoa jossa 462 lisäystä ja 1 poistoa
  1. 1 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/GeneratorCodeByTables.java
  2. 54 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/CommonReviewCommentsController.java
  3. 164 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/HttpServletlx.java
  4. 36 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/m_savetxt.java
  5. 60 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/CommonReviewComments.java
  6. 10 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/NewWorkflowStep.java
  7. 33 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/view/WebSocketMessageQueue.java
  8. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/CommonReviewCommentsMapper.java
  9. 21 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ICommonReviewCommentsService.java
  10. 43 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CommonReviewCommentsServiceImpl.java
  11. 19 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/HttpSessionWSHelper.java
  12. 5 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/CommonReviewCommentsMapper.xml

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/GeneratorCodeByTables.java

@@ -53,7 +53,7 @@ public class GeneratorCodeByTables {
     }
 
     public static void main(String[] args) throws IOException {
-        generateByTables("Gdc", "com.yh.saas.plugin.yiliangyiyun","car_info");
+        generateByTables("Gdc", "com.yh.saas.plugin.yiliangyiyun","common_review_comments");
     }
 
     /**

+ 54 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/CommonReviewCommentsController.java

@@ -0,0 +1,54 @@
+package com.yh.saas.plugin.yiliangyiyun.controller;
+
+
+import com.yh.saas.plugin.yiliangyiyun.entity.CommonReviewComments;
+import com.yh.saas.plugin.yiliangyiyun.entity.FollowInformation;
+import com.yh.saas.plugin.yiliangyiyun.service.ICommonReviewCommentsService;
+import com.yh.saas.plugin.yiliangyiyun.service.IFollowInformationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  审核历史评论 前端控制器
+ * </p>
+ *
+ * @author Gdc
+ * @since 2023-03-16
+ */
+@RestController
+@RequestMapping("/commonReviewComments")
+public class CommonReviewCommentsController {
+    @Autowired
+    private ICommonReviewCommentsService commonReviewCommentsService;
+
+
+    /**
+     * 添加
+     *
+     * @param commonReviewComments
+     * @return
+     */
+    @PostMapping("/api/addInfo")
+    public String addInfo(@RequestBody CommonReviewComments commonReviewComments) {
+        return commonReviewCommentsService.addInfo(commonReviewComments);
+    }
+
+
+    /**
+     * 删除
+     *
+     * @param commonReviewComments
+     * @return
+     */
+    @PostMapping("/api/deleteInfo")
+    public void deleteInfo(@RequestBody CommonReviewComments commonReviewComments) {
+        commonReviewCommentsService.deleteInfo(commonReviewComments.getId());
+    }
+
+}
+

+ 164 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/HttpServletlx.java

@@ -0,0 +1,164 @@
+package com.yh.saas.plugin.yiliangyiyun.controller;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+import org.apache.commons.codec.binary.Base64;
+
+//import net.sf.json.JSONObject;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@RequestMapping("/httpServletlx")
+public class HttpServletlx extends HttpServlet {
+	static int a=0;
+	/**
+	 * The doGet method of the servlet. <br>
+	 *
+	 * This method is called when a form has its tag value method equals to get.
+	 * 
+	 * @param request the request send by the client to the server
+	 * @param response the response send by the server to the client
+	 * @throws ServletException if an error occurred
+	 * @throws IOException if an error occurred
+	 */
+	public void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+
+		doPost(request,response);
+
+	}
+
+	/**
+	 * The doPost method of the servlet. <br>
+	 *
+	 * This method is called when a form has its tag value method equals to post.
+	 * 
+	 * @param request the request send by the client to the server
+	 * @param response the response send by the server to the client
+	 * @throws ServletException if an error occurred
+	 * @throws IOException if an error occurred
+	 */
+	@PostMapping("/api/doPost")
+	public void doPost(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+		InputStream in=request.getInputStream();
+		int size=request.getContentLength();
+		String charset=null;
+		getPostData(in,size,charset);
+		
+		response.setCharacterEncoding("gb2312");
+		
+		//返回相机抬杆 及 相机透传 “一体箱语音”
+		String jsonStr ="{\"Response\": {\"barrier_control\": {\"action\": \"open\"},"
+				+ "\"trigger_data\": {\"action\": \"\"},"
+				+ "\"rs485_data\": [{\"delay_time\": 100,\"data\": \"/gAAF5lz/QAPAQBbbjJdufNKUjg0RzExTQ==\"},"
+				+ "{\"delay_time\": 400,\"data\": \"/pgAbJdUAAAAAAAAAAAAAQEB/lxLiVkAAAAxAABsuUYAAAAwMDAwMDAwMDIsCQQAMDEwMTAxOTkxMjMxEwAAAFWqAAA3MjIxMTEAAAgAEAABEQASAAAA0rvN+87evMr/AAEAAQABAGd8///Wi88=\"}],"
+				+ "\"whitelist_data\": [{\"action\": \"add\",\"plate_number\": \"粤B12345F\",\"create_time\": \"2019-01-01 12:12:21\","
+				+ "\"start_time\": \"2019-01-01 12:12:21\",\"end_time\": \"2023-01-01 12:12:21\",\"is_black_list\": \"no\",\"time_match\": \"enable\"},"
+				+ "{\"action\":\"delete\",\"plate_number\":\"京A12345\"}]}}";
+	
+		System.out.println(jsonStr);
+
+ 
+		PrintWriter out = response.getWriter();
+	      
+	    out.print(jsonStr);
+	    out.close();
+		
+		
+
+	}
+	
+	
+	
+	/*************************************************base64解码数据*******************************************************************/	
+	public static byte[] m_decode(String bytes) {  
+		   return Base64.decodeBase64(bytes);
+	    } 
+	
+/*************************************************JSON解析数据*******************************************************************/	
+	
+	   public static void show_json(String m_str)
+	   {
+//		 //获取设备名称
+//		  JSONObject Json = JSONObject.fromObject(m_str);
+//		  String deviceName= Json.getJSONObject("AlarmInfoPlate").getString("deviceName");
+//		  System.out.println(deviceName);
+//
+//		 //设备IP地址
+//		  String ipaddr= Json.getJSONObject("AlarmInfoPlate").getString("ipaddr");
+//		  System.out.println(ipaddr);
+//		 //获取识别车牌号
+//		  String license= Json.getJSONObject("AlarmInfoPlate").getJSONObject("result").getJSONObject("PlateResult").getString("license");
+//		  System.out.println(license);
+//
+//		  //获取并保存识别结果大图
+//		  String imageFile=Json.getJSONObject("AlarmInfoPlate").getJSONObject("result").getJSONObject("PlateResult").getString("imageFile");
+//		  int imageFileLen=Json.getJSONObject("AlarmInfoPlate").getJSONObject("result").getJSONObject("PlateResult").getInt("imageFileLen");
+//		  if(imageFileLen!=0)
+//			  m_savetxt.m_fwrite(m_decode(imageFile),"D:/imageFile.gif");
+//
+//		  //获取并保存识别结果小图
+//		  String imageFragmentFile=Json.getJSONObject("AlarmInfoPlate").getJSONObject("result").getJSONObject("PlateResult").getString("imageFragmentFile");
+//		  int imageFragmentFileLen=Json.getJSONObject("AlarmInfoPlate").getJSONObject("result").getJSONObject("PlateResult").getInt("imageFragmentFileLen");
+//		  if(imageFragmentFileLen!=0)
+//			  m_savetxt.m_fwrite(m_decode(imageFragmentFile),"D:/imageFragmentFile.gif");
+//
+	   }
+	
+	
+/*************************************************获取数据*******************************************************************/
+	public static String getPostData(InputStream in, int size, String charset) {
+		if (in != null && size > 0) {
+			int readCount = 0; // 已经成功读取的字节的个数
+			int nRead = 0;
+			byte[] buf = new byte[size];
+			try {
+				while (readCount < size) {
+					nRead = in.read(buf, readCount, size - readCount);
+					if( nRead == -1) // 到末尾
+					{
+						break;
+					}
+					readCount += nRead;
+					 //readCount += in.read(buf, readCount, size - readCount);
+					}	
+					
+				if ((charset == null || charset.length() == 0) && (size ==readCount))
+					{						
+						//m_savetxt.m_fwrite(buf,"D:/newfile.txt");
+						//选择utf-8乱码时
+						String tmp = new String(buf, "UTF-8");
+						//选择gb2312乱码是
+						//String tmp = new String(buf, "gb2312");
+						
+						System.out.println(tmp);
+						if (a==0){
+	                        m_savetxt.m_fwrite(buf,"E:/newfile.txt");
+	                        show_json(new String(buf));  //对接口接收数据做处理
+	                        a+=1;
+	                    }
+	                    else{
+	                        m_savetxt.m_fwrite(buf,"E:/newfile1.txt");
+	                        a=0;
+	                    }
+					}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return null;
+	}
+
+}

+ 36 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/m_savetxt.java

@@ -0,0 +1,36 @@
+package com.yh.saas.plugin.yiliangyiyun.controller;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+public class m_savetxt {
+	
+	public static void m_fwrite(byte[] b,String path)
+	{
+		FileOutputStream fop = null;
+		File file;
+		try {
+			System.out.println("OK");
+			file = new File(path);
+			fop = new FileOutputStream(file);
+			if (!file.exists()) {
+				file.createNewFile();
+				}
+			   fop.write(b);
+			   fop.flush();
+			   fop.close();
+			   System.out.println("Done");	
+		  } catch (IOException e) {
+			   e.printStackTrace();
+			  } finally {
+			   try {
+			    if (fop != null) {
+			     fop.close();
+			    }
+			   } catch (IOException e) {
+			    e.printStackTrace();
+			   }
+			  }
+			 }
+}

+ 60 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/CommonReviewComments.java

@@ -0,0 +1,60 @@
+package com.yh.saas.plugin.yiliangyiyun.entity;
+
+import com.baomidou.mybatisplus.activerecord.Model;
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.annotations.Version;
+
+import com.baomidou.mybatisplus.enums.IdType;
+import com.yh.saas.common.support.entity.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ *  审核历史评论
+ * </p>
+ *
+ * @author Gdc
+ * @since 2023-03-16
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("common_review_comments")
+public class CommonReviewComments extends BaseModel<CommonReviewComments> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    private String id;
+    /**
+     * 历史id
+     */
+    private String hisId;
+    /**
+     * 评论
+     */
+    private String test;
+    /**
+     * 评论1
+     */
+    private String test1;
+    /**
+     * 评论2
+     */
+    private String test2;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 10 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/NewWorkflowStep.java

@@ -74,6 +74,10 @@ public class NewWorkflowStep extends BaseModel<NewWorkflowStep> {
     @TableField(
             exist = false
     )
+    private List<CommonReviewComments> commonReviewComments;
+    @TableField(
+            exist = false
+    )
     private NewWorkflowStep.ApprovalStatus approvalStatus;
 
     public NewWorkflowStep() {
@@ -198,6 +202,9 @@ public class NewWorkflowStep extends BaseModel<NewWorkflowStep> {
     public List<WorkflowListener> getListeners() {
         return this.listeners;
     }
+    public List<CommonReviewComments> getCommonReviewComments() {
+        return this.commonReviewComments;
+    }
 
     public NewWorkflowStep.ApprovalStatus getApprovalStatus() {
         return this.approvalStatus;
@@ -290,6 +297,9 @@ public class NewWorkflowStep extends BaseModel<NewWorkflowStep> {
     public void setListeners(final List<WorkflowListener> listeners) {
         this.listeners = listeners;
     }
+    public void setCommonReviewComments(final List<CommonReviewComments> commonReviewComments) {
+        this.commonReviewComments = commonReviewComments;
+    }
 
     public void setApprovalStatus(final NewWorkflowStep.ApprovalStatus approvalStatus) {
         this.approvalStatus = approvalStatus;

+ 33 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/view/WebSocketMessageQueue.java

@@ -0,0 +1,33 @@
+package com.yh.saas.plugin.yiliangyiyun.entity.view;
+
+import org.springframework.web.socket.WebSocketMessage;
+import org.springframework.web.socket.WebSocketSession;
+
+import java.io.IOException;
+
+public class WebSocketMessageQueue {
+    private WebSocketSession session;   //socket会话信息
+    private WebSocketMessage message;   //消息
+
+    public void send() throws IOException {     //统一的发送消息方法
+        if(session != null && session.isOpen()){
+            session.sendMessage(message);
+        }
+    }
+
+    public WebSocketSession getSession() {
+        return session;
+    }
+
+    public void setSession(WebSocketSession session) {
+        this.session = session;
+    }
+
+    public WebSocketMessage getMessage() {
+        return message;
+    }
+
+    public void setMessage(WebSocketMessage message) {
+        this.message = message;
+    }
+}

+ 16 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/CommonReviewCommentsMapper.java

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.mapper;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.CommonReviewComments;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  审核历史评论 Mapper 接口
+ * </p>
+ *
+ * @author Gdc
+ * @since 2023-03-16
+ */
+public interface CommonReviewCommentsMapper extends BaseMapper<CommonReviewComments> {
+
+}

+ 21 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ICommonReviewCommentsService.java

@@ -0,0 +1,21 @@
+package com.yh.saas.plugin.yiliangyiyun.service;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.CommonReviewComments;
+import com.baomidou.mybatisplus.service.IService;
+
+/**
+ * <p>
+ *  审核历史评论 服务类
+ * </p>
+ *
+ * @author Gdc
+ * @since 2023-03-16
+ */
+public interface ICommonReviewCommentsService extends IService<CommonReviewComments> {
+
+
+    String addInfo(CommonReviewComments commonReviewComments);
+
+
+    void deleteInfo(String id);
+}

+ 43 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CommonReviewCommentsServiceImpl.java

@@ -0,0 +1,43 @@
+package com.yh.saas.plugin.yiliangyiyun.service.impl;
+
+import com.yh.saas.common.support.util.IdGenerator;
+import com.yh.saas.plugin.yiliangyiyun.entity.CommonReviewComments;
+import com.yh.saas.plugin.yiliangyiyun.entity.FollowInformation;
+import com.yh.saas.plugin.yiliangyiyun.mapper.CommonReviewCommentsMapper;
+import com.yh.saas.plugin.yiliangyiyun.service.ICommonReviewCommentsService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  审核历史评论 服务实现类
+ * </p>
+ *
+ * @author Gdc
+ * @since 2023-03-16
+ */
+@Service
+public class CommonReviewCommentsServiceImpl extends ServiceImpl<CommonReviewCommentsMapper, CommonReviewComments> implements ICommonReviewCommentsService {
+
+
+    @Override
+    public String addInfo(CommonReviewComments commonReviewComments) {
+        commonReviewComments.setId(IdGenerator.generateUUID());
+        this.insert(commonReviewComments);
+        return "ok";
+    }
+
+
+    /**
+     * 删除
+     *
+     * @param id
+     */
+    @Override
+    public void deleteInfo(String id) {
+        CommonReviewComments commonReviewComments = this.selectById(id);
+        if (commonReviewComments != null) {
+            this.deleteById(commonReviewComments.getId());
+        }
+    }
+}

+ 19 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/HttpSessionWSHelper.java

@@ -0,0 +1,19 @@
+package com.yh.saas.plugin.yiliangyiyun.util;
+import javax.servlet.http.HttpSession;
+import javax.websocket.HandshakeResponse;
+import javax.websocket.server.HandshakeRequest;
+import javax.websocket.server.ServerEndpointConfig;
+
+public class HttpSessionWSHelper extends ServerEndpointConfig.Configurator {
+    @Override
+    public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
+        System.out.println("调用modifyHandshake方法...");
+        HttpSession session = (HttpSession) request.getHttpSession();//session有可能为空
+        if (session!=null){
+            System.out.println("获取到session id:"+session.getId());
+            sec.getUserProperties().put(HttpSession.class.getName(),session);
+        }else{
+            System.out.println("modifyHandshake 获取到null session");
+        }
+    }
+}

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/CommonReviewCommentsMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.CommonReviewCommentsMapper">
+
+</mapper>