Browse Source

阿米巴开发

anderx 3 years ago
parent
commit
ed1e2c1930

+ 13 - 1
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -46,7 +46,7 @@ public class WebpageController extends BaseController {
 
 
 	@RequestMapping(value = "/user/account/index", method = RequestMethod.GET)
-	public ModelAndView index(HttpServletRequest request, ModelAndView modelview) {
+	public ModelAndView UserIndex(HttpServletRequest request, ModelAndView modelview) {
 		modelview.setViewName("/user/account/index");
 		return modelview;
 	}
@@ -475,4 +475,16 @@ public class WebpageController extends BaseController {
 		return modelview;
 	}
 
+	@RequestMapping(value = "/portal/webSocket", method = RequestMethod.GET)
+	public ModelAndView webSocket(HttpServletRequest request, ModelAndView modelview) {
+		modelview.setViewName("/portal/webSocket");
+		return modelview;
+	}
+
+	@RequestMapping(value = "/open/index", method = RequestMethod.GET)
+	public ModelAndView index(HttpServletRequest request, ModelAndView modelview) {
+		modelview.setViewName("/portal/index");
+		return modelview;
+	}
+
 }

+ 9 - 9
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -302,7 +302,7 @@
     select
     <include refid="Base_Column_List" />
     from admin
-    where status !='锁定'
+    where status ='0'
     <if test="depId != null">
       and department_id = #{depId,jdbcType=VARCHAR}
     </if>
@@ -517,7 +517,7 @@
       and status= '正常'
     </if>
     <if test="status==1">
-      and status= '锁定'
+      and status= '1'
     </if>
   </select>
 
@@ -764,7 +764,7 @@
     where c.role_name  = #{name,jdbcType=VARCHAR}
   </select>
   <update id="updateLockIds" parameterType="java.lang.String">
-    update admin set status = '锁定' where id in (${lockIds})
+    update admin set status = '1' where id in (${lockIds})
   </update>
 
   <!--  用户是为正常的 -->
@@ -776,13 +776,13 @@
   <select id="getAdminRoleNameList" parameterType="java.lang.String" resultMap="BaseResultMap">
     select a.id, a.name from admin a left join user_role b on a.id=b.uid
                                      left join `role` c on b.rid=c.id
-    where c.role_name  = #{name,jdbcType=VARCHAR} and a.status='正常'
+    where c.role_name  = #{name,jdbcType=VARCHAR} and a.status= 0
   </select>
 
   <select id="getAdminRoleNamesList" parameterType="java.lang.String" resultMap="BaseResultMap">
     select a.id, a.name from admin a left join user_role b on a.id=b.uid
     left join `role` c on b.rid=c.id
-    where a.status='正常'
+    where a.status= 0
     and  c.role_name  in
     <foreach close=")" collection="list" item="name" open="(" separator=",">
       #{name}
@@ -792,13 +792,13 @@
   <select id="getAdminRoleTypeList" parameterType="java.lang.String" resultMap="BaseResultMap">
     select a.id, a.name from admin a left join user_role b on a.id=b.uid
                                      left join `role` c on b.rid=c.id
-    where c.role_type  = #{roleType} and a.status='正常'
+    where c.role_type  = #{roleType} and a.status= 0
   </select>
 
   <select id="getAdminRoleTypesList" parameterType="java.lang.String" resultMap="BaseResultMap">
     select a.id, a.name from admin a left join user_role b on a.id=b.uid
     left join `role` c on b.rid=c.id
-    where a.status='正常'
+    where a.status= 0
     and  c.role_type  in
     <foreach close=")" collection="list" item="type" open="(" separator=",">
       #{type}
@@ -907,7 +907,7 @@
     left join user_role e on a.id=e.uid
     left join `role` f on e.rid=f.id
     where f.role_name in ('营销员','营销经理')
-    and	 a.status='正常'
+    and	 a.status= 0
     <if test="depId != null">
       and a.department_id =  #{depId,jdbcType=VARCHAR}
     </if>
@@ -922,7 +922,7 @@
     left join user_role e on a.id=e.uid
     left join `role` f on e.rid=f.id
     where f.role_name in ('营销员','营销经理')
-    and	 a.status='正常'
+    and	 a.status= 0
     <if test="depId != null">
       and a.department_id =  #{depId,jdbcType=VARCHAR}
     </if>

+ 3 - 3
src/main/java/com/goafanti/common/mapper/DepartmentMapper.xml

@@ -355,7 +355,7 @@
     select
       name,id
     from admin
-    where status='正常'
+    where status= 0
       and name  like concat('%',#{name,jdbcType=VARCHAR},'%')
   </select>
   <select id="selectAllById" resultType="com.goafanti.organization.bo.OrganizationListOut">
@@ -502,7 +502,7 @@
     </if>
     group by a.aid ) y on x.aid=y.aid)b on a.id=b.aid
     left join department d on a.department_id=d.id
-    where  a.status='正常'  and a.type=1
+    where  a.status= 0  and a.type=1
     <if test="adminName !=null">
       and a.name  like concat('%',#{adminName},'%')
     </if>
@@ -534,7 +534,7 @@
     </if>
     group by a.aid ) y on a.id=y.aid
     left join department c on a.department_id =c.id
-    where  a.status='正常'  and a.type=1
+    where  a.status= 0  and a.type=1
     <if test="depIds!= null">
       and a.department_id in
       <foreach close=")" collection="depIds" item="deps" open="(" separator=",">

+ 2 - 2
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -1855,7 +1855,7 @@ inner join(
 	left join (select x.aid,count(1)as count from (select x1.aid,x1.uid from user_lock_release x1
 				left join user y on x1.uid=y.id where x1.type=1
 				and x1.status=0 and y.integrity=1 group by aid,uid)x group by aid) i on a.id=i.aid
-	where a.status='正常'
+	where a.status= 0
 	<if test="deps!=null  and deps.size()>0">
 	and a.department_id in
 		<foreach close=")" collection="deps" item="depId" open="(" separator=",">
@@ -1883,7 +1883,7 @@ inner join(
 	left join (select x.aid,count(1)as count from (select x1.aid,x1.uid from user_lock_release x1
 				left join user y on x1.uid=y.id where x1.type=1
 				and x1.status=0 and y.integrity=1 group by aid,uid)x group by aid) i on a.id=i.aid
-	where a.status='正常'
+	where a.status= 0
 	<if test="deps!=null and deps.size()>0">
 	and a.department_id in
 		<foreach close=")" collection="deps" item="depId" open="(" separator=",">

+ 2 - 2
src/main/java/com/goafanti/common/mapper/UserMidMapper.xml

@@ -570,7 +570,7 @@
       and a.sign_time BETWEEN #{signTimeStart} and #{signTimeEnd}
     </if>
     group by b.aid,b.id)x group by x.aid)y on y.aid=a.id
-    where a.status='正常' and r.role_type in (96,996)
+    where a.status= 0 and r.role_type in (96,996)
     <if test="aid != null">
       and a.id= #{aid}
     </if>
@@ -606,7 +606,7 @@
     from t_order_new a left join user b on b.id=a.buyer_id
     where a.process_status >4 and b.share_type =2 and a.delete_sign in(0,2)
     group by b.aid)x on a.id=x.aid
-    where a.status='正常' and r.role_type in (96,996)
+    where a.status= 0 and r.role_type in (96,996)
     <if test="aid != null">
       and a.id= #{aid}
     </if>

+ 36 - 59
src/main/webapp/WEB-INF/views/portal/websocket.html

@@ -1,65 +1,42 @@
 <!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
-
-
+<html>
 <head>
-	<style type="text/css">
-		div
-			{
-				border:2px dashed #000000
-			}
-	</style>
-
-	<script type="text/javascript">
-
-	</script>
+	<meta charset="utf-8">
+	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes" />
+	<title>聊天室示例</title>
 </head>
-
 <body>
-	<h1>Rumia chat room</h1>
-	
-	<div>
-		<p id="talked"></p>
-	</div>
-	<br>
-	<div>
-		<input type="text" id="say">
-		<button onclick="sendData()">SAY</button>
-	</div>
-	
-	
-
-	<script type="text/javascript">
-
-		var ws = new WebSocket("ws://" + window.location.host + "/webSocketServer");
-
-		function sendData()
-		{
-			var msg = document.getElementById("say").value;
-			ws.send(msg);
+<textarea id="sendText"></textarea>
+<button onclick="sendMessage()">发送</button>
+<script>
+	var connect;
+	window.onload=function unit(){
+		if ("WebSocket" in window){
+			// 打开一个 web socket
+			connect = new WebSocket("ws://localhost:8080/webSocketServer");
+			connect.onopen = function(){
+				// Web Socket 已连接上
+				alert("已连接");
+			};
+			connect.onmessage = function (evt){
+				var r_msg = evt.data;
+				document.body.innerHTML+="<br/>接收的信息为:"+r_msg;
+			};//接收时自己也会接收,可以自己设置过滤的if语句
+
+			connect.onclose = function(){
+				// 关闭 websocket
+				alert("连接关闭");
+			};
 		}
-
-		ws.onopen = function(evt)
-		{ 
-			console.log("Connection open ..."); 
-		};
-
-		ws.onmessage = function(evt)
-		{
-			console.log("Received Message: " + evt.data);
-			document.getElementById("talked").innerHTML = document.getElementById("talked").innerHTML + "<br>" + evt.data;
-		};
-
-		ws.onclose = function(evt)
-		{
-			console.log("Connection closed.");
-		};
-
-		ws.onerror = function(evt)
-		{
-			console.log("error!!!"); 
-		};
-
-	</script>
-
+		else{
+			// 浏览器不支持 WebSocket
+			alert("您的浏览器不支持 WebSocket!");
+		}
+	};
+	function sendMessage(){
+		connect.send(document.getElementById("sendText").value);
+		document.getElementById("sendText").innerHTML="";
+	}
+</script>
 </body>
+</html>