Browse Source

融云基础

suochencheng 7 years ago
parent
commit
c17a2d2f4a

+ 1 - 1
src/main/java/com/izouma/awesomeadmin/dao/ChatInfoMapper.java

@@ -38,7 +38,7 @@ public interface ChatInfoMapper {
 
     ChatInfo queryChatInfo(ChatInfo chatInfo);
 
-    int readAll(int userId, int toUserId);
+    int readAll(ChatInfo chatInfo);
     
     ChatInfo queryLastChatInfo(ChatInfo chatInfo);
 }

+ 68 - 16
src/main/java/com/izouma/awesomeadmin/dao/ChatInfoMapper.xml

@@ -10,9 +10,12 @@
         <result column="content_type" property="contentType" jdbcType="INTEGER"/>
         <result column="state" property="state" jdbcType="INTEGER"/>
         <result column="project_id" property="projectId" jdbcType="INTEGER"/>
+        <result column="store_id" property="storeId" jdbcType="INTEGER"/>
+        <result column="type_flag" property="typeFlag" jdbcType="INTEGER"/>
+        <result column="service_name" property="serviceName" jdbcType="VARCHAR"/>
     </resultMap>
     <sql id="Base_Column_List">
-        id, user_id, to_user_id, content, time, content_type, state, project_id
+        id, user_id, to_user_id, content, time, content_type, state, project_id, store_id, type_flag, service_name
     </sql>
     <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
         select
@@ -27,10 +30,10 @@
     <insert id="insert" parameterType="com.izouma.awesomeadmin.model.ChatInfo" useGeneratedKeys="true" keyProperty="id">
         INSERT INTO chat_info (id, user_id, to_user_id,
                                content, time, content_type,
-                               state,project_id)
+                               state,project_id, store_id,type_flag)
         VALUES (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{toUserId,jdbcType=INTEGER},
                 #{content,jdbcType=VARCHAR}, #{time,jdbcType=TIMESTAMP}, #{contentType,jdbcType=INTEGER},
-                #{state,jdbcType=INTEGER},#{projectId,jdbcType=INTEGER})
+                #{state,jdbcType=INTEGER},#{projectId,jdbcType=INTEGER},#{storeId,jdbcType=INTEGER},#{typeFlag,jdbcType=INTEGER})
     </insert>
     <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.ChatInfo" useGeneratedKeys="true"
             keyProperty="id">
@@ -60,6 +63,15 @@
             <if test="projectId != null">
                 project_id,
             </if>
+            <if test="storeId != null">
+                store_id,
+            </if>
+            <if test="typeFlag != null">
+                type_flag,
+            </if>
+            <if test="serviceName != null">
+                service_name,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">
@@ -86,6 +98,15 @@
             <if test="projectId != null">
                 #{projectId,jdbcType=INTEGER},
             </if>
+            <if test="storeId != null">
+                #{storeId,jdbcType=INTEGER},
+            </if>
+            <if test="typeFlag != null">
+                #{typeFlag,jdbcType=INTEGER},
+            </if>
+            <if test="serviceName != null">
+                #{serviceName,jdbcType=VARCHAR},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.ChatInfo">
@@ -112,6 +133,15 @@
             <if test="projectId != null">
                 project_id = #{projectId,jdbcType=INTEGER},
             </if>
+            <if test="storeId != null">
+                store_id = #{storeId,jdbcType=INTEGER},
+            </if>
+            <if test="typeFlag != null">
+                type_flag = #{typeFlag,jdbcType=INTEGER},
+            </if>
+            <if test="serviceName != null">
+                service_name = #{serviceName,jdbcType=VARCHAR},
+            </if>
         </set>
         where id = #{id,jdbcType=INTEGER}
     </update>
@@ -124,26 +154,30 @@
             content_type = #{contentType,jdbcType=INTEGER},
             state        = #{state,jdbcType=INTEGER},
             project_id        = #{projectId,jdbcType=INTEGER}
+            store_id        = #{storeId,jdbcType=INTEGER}
         WHERE id = #{id,jdbcType=INTEGER}
     </update>
 
 
     <select id="queryChatInfosByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ChatInfo">
         SELECT
-			chat_info.*, uInfo.nick_name,
-			uInfo.icon
-		FROM
-			chat_info
-		LEFT JOIN user_info uInfo ON chat_info.user_id = uInfo.id
+        chat_info.*, uInfo.nickname as nick_name,
+        uInfo.icon,
+        serviceInfo.icon as service_icon,
+        serviceInfo.service_name as  service_nick
+        FROM
+        chat_info
+        LEFT JOIN sys_user uInfo ON chat_info.user_id = uInfo.id
+        LEFT JOIN customer_service serviceInfo ON chat_info.service_name = serviceInfo.username
         <where>
             and state != 2
 
             <if test="chatInfo.id != null and !&quot;&quot;.equals(chatInfo.id)">
                 and chat_info.id=#{chatInfo.id}
             </if>
-            <if test="chatInfo.userId != null and !&quot;&quot;.equals(chatInfo.userId) and chatInfo.toUserId != null and !&quot;&quot;.equals(chatInfo.toUserId)">
-                and ((user_id=#{chatInfo.userId} and to_user_id=#{chatInfo.toUserId}) or (user_id=#{chatInfo.toUserId}
-                and to_user_id=#{chatInfo.userId}))
+            <if test="chatInfo.userId != null and !&quot;&quot;.equals(chatInfo.userId)">
+                and chat_info.user_id=#{chatInfo.userId}
+
             </if>
             <if test="chatInfo.contentType != null and !&quot;&quot;.equals(chatInfo.contentType)">
                 and content_type=#{chatInfo.contentType}
@@ -151,21 +185,31 @@
             <if test="chatInfo.projectId != null and !&quot;&quot;.equals(chatInfo.projectId)">
                 and chat_info.project_id=#{chatInfo.projectId}
             </if>
+            <if test="chatInfo.storeId != null and !&quot;&quot;.equals(chatInfo.storeId)">
+                and chat_info.store_id=#{chatInfo.storeId}
+            </if>
+            <if test="chatInfo.typeFlag != null and !&quot;&quot;.equals(chatInfo.typeFlag)">
+                and chat_info.type_flag=#{chatInfo.typeFlag}
+            </if>
+            <if test="chatInfo.serviceName != null and !&quot;&quot;.equals(chatInfo.serviceName)">
+                and chat_info.service_name=#{chatInfo.serviceName}
+            </if>
         </where>
         order by time desc
     </select>
-	
-	<select id="queryLastChatInfo" parameterType="com.izouma.awesomeadmin.model.ChatInfo" resultType="com.izouma.awesomeadmin.model.ChatInfo">
+
+    <select id="queryLastChatInfo" parameterType="com.izouma.awesomeadmin.model.ChatInfo"
+            resultType="com.izouma.awesomeadmin.model.ChatInfo">
         select
         <include refid="Base_Column_List"/>
         from chat_info
         <where>
-            user_id = #{userId} and to_user_id = #{toUserId} and project_id=#{projectId}
+            user_id = #{userId} and service_name = #{serviceName} and store_id=#{storeId}
         </where>
         order by time desc
         limit 1
     </select>
-	
+
     <select id="queryAllChatInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ChatInfo">
         select
         <include refid="Base_Column_List"/>
@@ -209,7 +253,15 @@
     <update id="readAll">
         UPDATE chat_info
         SET state = 1
-        WHERE user_id = #{param2} AND to_user_id = #{param1}
+        WHERE
+        user_id = #{userId}
+        AND store_id = #{storeId}
+        <if test="serviceName != null and !&quot;&quot;.equals(serviceName)">
+            AND service_name = #{serviceName}
+        </if>
+        <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
+            AND type_flag = #{typeFlag}
+        </if>
     </update>
 
 </mapper>

+ 70 - 5
src/main/java/com/izouma/awesomeadmin/dao/CustomerServiceMapper.xml

@@ -14,6 +14,8 @@
                                 <result column="username" property="username" jdbcType="VARCHAR" />
                                 <result column="icon" property="icon" jdbcType="VARCHAR" />
                                 <result column="use_flag" property="useFlag" jdbcType="CHAR" />
+                                <result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
+                                <result column="login_time" property="loginTime" jdbcType="TIMESTAMP" />
             </resultMap>
     <sql id="Base_Column_List" >
         <trim  suffixOverrides="," >
@@ -41,6 +43,10 @@
 
             use_flag,
 
+            status_flag,
+
+            login_time,
+
             </trim>
     </sql>
     <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
@@ -91,6 +97,12 @@
             </if>
                 <if test="useFlag!= null" >
                 use_flag,
+            </if>
+                <if test="statusFlag!= null" >
+                status_flag,
+            </if>
+                <if test="loginTime!= null" >
+                login_time,
             </if>
             </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -129,6 +141,12 @@
             </if>
                     <if test="useFlag != null" >
                 #{useFlag,jdbcType=CHAR},
+            </if>
+                    <if test="statusFlag != null" >
+                #{statusFlag,jdbcType=INTEGER},
+            </if>
+                    <if test="loginTime != null" >
+                #{loginTime,jdbcType=TIMESTAMP},
             </if>
                 </trim>
     </insert>
@@ -170,14 +188,31 @@
             </if>
                      <if test="useFlag != null" >
                use_flag= #{useFlag,jdbcType=CHAR},
+            </if>
+                     <if test="statusFlag != null" >
+               status_flag= #{statusFlag,jdbcType=INTEGER},
+            </if>
+                     <if test="loginTime != null" >
+               login_time= #{loginTime,jdbcType=TIMESTAMP},
             </if>
                  </set>
-        where id = #{id,jdbcType=INTEGER}
+        where
+        <if test="id != null and !&quot;&quot;.equals(id)">
+            id = #{id,jdbcType=INTEGER}
+        </if>
+
+        <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+            id in (${idStr})
+        </if>
+
     </update>
     <select id="queryCustomerServiceByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CustomerService">
         select <include refid="Base_Column_List"/> from customer_service
         <where>
             and del_flag = 'N'
+            <if test="record.idStr != null and !&quot;&quot;.equals(record.idStr)">
+                and id in (${record.idStr})
+            </if>
                     <if test="record.id != null and !&quot;&quot;.equals(record.id)">
                 and  id = #{record.id}
             </if>
@@ -213,6 +248,12 @@
             </if>
                      <if test="record.useFlag != null and !&quot;&quot;.equals(record.useFlag)">
                 and  use_flag = #{record.useFlag}
+            </if>
+                     <if test="record.statusFlag != null and !&quot;&quot;.equals(record.statusFlag)">
+                and  status_flag = #{record.statusFlag}
+            </if>
+                     <if test="record.loginTime != null and !&quot;&quot;.equals(record.loginTime)">
+                and  login_time = #{record.loginTime}
             </if>
                   <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
              <trim prefix="and (" suffix=")" prefixOverrides="OR" >
@@ -222,6 +263,8 @@
                                                                                                     OR  username LIKE concat('%',#{record.searchKey},'%')
                                                                                                     OR  icon LIKE concat('%',#{record.searchKey},'%')
                                                                                                     OR  use_flag LIKE concat('%',#{record.searchKey},'%')
+                                                                                                    OR  status_flag LIKE concat('%',#{record.searchKey},'%')
+                                                                                                    OR  login_time LIKE concat('%',#{record.searchKey},'%')
                                                              </trim>
          </if>
 
@@ -281,6 +324,9 @@
         select <include refid="Base_Column_List"/> from customer_service
         <where>
             and del_flag = 'N'
+            <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+                and id in (${idStr})
+            </if>
                     <if test="id != null and !&quot;&quot;.equals(id)">
                 and  id = #{id}
             </if>
@@ -316,6 +362,12 @@
             </if>
                     <if test="useFlag != null and !&quot;&quot;.equals(useFlag)">
                 and  use_flag = #{useFlag}
+            </if>
+                    <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
+                and  status_flag = #{statusFlag}
+            </if>
+                    <if test="loginTime != null and !&quot;&quot;.equals(loginTime)">
+                and  login_time = #{loginTime}
             </if>
                     <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
                 <trim prefix="and (" suffix=")" prefixOverrides="OR" >
@@ -325,6 +377,8 @@
                                                                                                                                                         OR  username LIKE concat('%',#{searchKey},'%')
                                                                                                                                                         OR  icon LIKE concat('%',#{searchKey},'%')
                                                                                                                                                         OR  use_flag LIKE concat('%',#{searchKey},'%')
+                                                                                                                                                        OR  status_flag LIKE concat('%',#{searchKey},'%')
+                                                                                                                                                        OR  login_time LIKE concat('%',#{searchKey},'%')
                                                                                         </trim>
             </if>
 <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
@@ -418,6 +472,12 @@
             </if>
                      <if test="useFlag != null and !&quot;&quot;.equals(useFlag)">
                 and use_flag = #{useFlag}
+            </if>
+                     <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
+                and status_flag = #{statusFlag}
+            </if>
+                     <if test="loginTime != null and !&quot;&quot;.equals(loginTime)">
+                and login_time = #{loginTime}
             </if>
          
         </where>
@@ -425,15 +485,20 @@
     </select>
     <update id="delete">
         UPDATE customer_service SET del_flag = 'Y'
-        <where>
-            AND id = #{id}
-        </where>
+        where
+        <if test="id != null and !&quot;&quot;.equals(id)">
+            id = #{id,jdbcType=INTEGER}
+        </if>
+
+        <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+            id in (${idStr})
+        </if>
     </update>
     <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CustomerService">
         select <include refid="Base_Column_List"/> from customer_service
         <where>
             and del_flag = 'N'
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </where>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </where>
         order by id desc
     </select>
 </mapper>

+ 9 - 2
src/main/java/com/izouma/awesomeadmin/dao/RongYunTokenMapper.xml

@@ -3,12 +3,13 @@
 <mapper namespace="com.izouma.awesomeadmin.dao.RongYunTokenMapper">
     <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.RongYunToken">
         <id column="id" property="id" jdbcType="BIGINT"/>
-        <result column="user_id" property="userId" jdbcType="BIGINT"/>
+        <result column="user_id" property="userId" jdbcType="VARCHAR"/>
         <result column="token" property="token" jdbcType="VARCHAR"/>
+        <result column="type_flag" property="typeFlag" jdbcType="INTEGER"/>
     </resultMap>
 
     <sql id="Base_Column_List">
-      id, user_id, token
+      id, user_id, token, type_flag
     </sql>
 
     <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
@@ -42,6 +43,9 @@
             <if test="token != null">
                 token,
             </if>
+            <if test="typeFlag != null">
+                type_flag,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">
@@ -53,6 +57,9 @@
             <if test="token != null">
                 #{token,jdbcType=VARCHAR},
             </if>
+            <if test="typeFlag != null">
+                #{typeFlag,jdbcType=INTEGER},
+            </if>
         </trim>
     </insert>
 

+ 99 - 117
src/main/java/com/izouma/awesomeadmin/dao/UsersSessionMapper.xml

@@ -11,9 +11,10 @@
         <result column="project_id" property="projectId" jdbcType="INTEGER"/>
         <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
         <result column="contact_id" property="contactId" jdbcType="INTEGER"/>
+        <result column="store_id" property="storeId" jdbcType="INTEGER"/>
     </resultMap>
     <sql id="Base_Column_List">
-        id, user_id, to_user_id, create_time, update_time, type, project_id, del_flag, contact_id
+        id, user_id, to_user_id, create_time, update_time, type, project_id, del_flag, contact_id, store_id
     </sql>
     <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
         select
@@ -25,13 +26,14 @@
         DELETE FROM users_session
         WHERE id = #{id,jdbcType=INTEGER}
     </delete>
-    <insert id="insert" parameterType="com.izouma.awesomeadmin.model.UsersSession" useGeneratedKeys="true" keyProperty="id">
+    <insert id="insert" parameterType="com.izouma.awesomeadmin.model.UsersSession" useGeneratedKeys="true"
+            keyProperty="id">
         INSERT INTO users_session (id, user_id, to_user_id,
                                    create_time, update_time, type,
-                                   project_id, del_flag, contact_id)
+                                   project_id, del_flag, contact_id, store_id)
         VALUES (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{toUserId,jdbcType=INTEGER},
                 #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{type,jdbcType=INTEGER},
-                #{projectId,jdbcType=INTEGER}, #{delFlag,jdbcType=CHAR}, #{contactId,jdbcType=INTEGER})
+                #{projectId,jdbcType=INTEGER}, #{delFlag,jdbcType=CHAR}, #{contactId,jdbcType=INTEGER}, #{storeId,jdbcType=INTEGER})
     </insert>
     <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.UsersSession" useGeneratedKeys="true"
             keyProperty="id">
@@ -64,6 +66,9 @@
             <if test="contactId != null">
                 contact_id,
             </if>
+            <if test="storeId != null">
+                store_id,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">
@@ -93,6 +98,9 @@
             <if test="contactId != null">
                 #{contactId,jdbcType=INTEGER},
             </if>
+            <if test="storeId != null">
+                #{storeId,jdbcType=INTEGER},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.UsersSession">
@@ -119,6 +127,9 @@
             <if test="delFlag != null">
                 del_flag = #{delFlag,jdbcType=CHAR},
             </if>
+            <if test="storeId != null">
+                store_id = #{storeId,jdbcType=INTEGER},
+            </if>
         </set>
         where id = #{id,jdbcType=INTEGER}
     </update>
@@ -139,15 +150,13 @@
         SET update_time = NOW()
         WHERE
             del_flag = 'N'
-        AND (
-            (user_id = #{userId} AND to_user_id = #{toUserId})
-            OR (to_user_id = #{userId} AND user_id = #{toUserId})
-        )
-        AND project_id = #{projectId}
+        AND user_id = #{userId}
+        AND store_id = #{storeId}
     </update>
 
 
-    <select id="queryUsersSessionsByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.UsersSession">
+    <select id="queryUsersSessionsByPage" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.UsersSession">
         select
         <include refid="Base_Column_List"/>
         from users_session
@@ -169,74 +178,62 @@
             <if test="usersSession.projectId != null and !&quot;&quot;.equals(usersSession.projectId)">
                 and project_id=#{usersSession.projectId}
             </if>
+            <if test="usersSession.storeId != null and !&quot;&quot;.equals(usersSession.storeId)">
+                and store_id=#{usersSession.storeId}
+            </if>
         </where>
         order by update_time desc
     </select>
 
     <select id="queryAllUsersSession" parameterType="java.util.Map" resultMap="UsersSessionResultMap">
+        SELECT DISTINCT
+        us.user_id,
+        us.type,
+        us.store_id,
+        MAX(us.update_time) update_time,
+        COUNT(chat.id) AS amount
+        FROM
+        users_session us
+        LEFT JOIN chat_info chat ON chat.user_id = us.user_id
+        AND chat.store_id = us.store_id
+        AND chat.type_flag = us.type
+        AND chat.state = 0
+        WHERE
+        us.user_id != 1
+
+        AND us.store_id IN (
         SELECT
-            tmp.id,
-            tmp.user_id,
-            tmp.to_user_id,
-            tmp.create_time,
-            tmp.update_time,
-            tmp.type,
-            tmp.project_id,
-            tmp.nick_name,
-            tmp.icon,
-            tmp.amount,
-            CASE WHEN ctime.time IS NULL THEN tmp.create_time ELSE MAX(ctime.time) END AS chattime
+        id
         FROM
-            (
-                SELECT
-                    us.id,
-                    us.user_id,
-                    us.to_user_id,
-                    us.create_time,
-                    us.update_time,
-                    us.type,
-                    us.project_id,
-                    tu.nick_name,
-                    tu.icon,
-                    COUNT(chat.id) AS amount
-                FROM
-                    users_session us
-                    LEFT JOIN user_info tu ON us.to_user_id = tu.id
-                    LEFT JOIN chat_info chat ON chat.user_id = us.to_user_id
-                                                AND chat.to_user_id = us.user_id
-                                                AND chat.state = 0
-                                                AND CASE WHEN chat.project_id IS NULL THEN 1 ELSE chat.project_id = us.project_id END
-                WHERE
-                    us.user_id = #{userId}
-                    AND us.type = 0
-                    AND us.del_flag = 'N'
-                GROUP BY
-                    us.project_id,
-                    us.user_id,
-                    us.to_user_id
-            ) tmp
-            LEFT JOIN chat_info ctime ON (
-                                             ctime.user_id = tmp.to_user_id
-                                             AND ctime.to_user_id = tmp.user_id
-                                         )
-                                         OR (
-                                             ctime.user_id = tmp.user_id
-                                             AND ctime.to_user_id = tmp.to_user_id
-                                         )
-                                         and ctime.project_id = tmp.project_id
+        store_info
+        WHERE
+        del_flag = 'N'
+        )
+        AND us.del_flag = 'N'
+
+        <if test="userId != null and !&quot;&quot;.equals(userId)">
+            AND us.user_id = #{userId}
+        </if>
+        <if test="storeId != null and !&quot;&quot;.equals(storeId)">
+            AND us.store_id = #{storeId}
+        </if>
+        <if test="type != null and !&quot;&quot;.equals(type)">
+            AND us.type = #{type}
+        </if>
+        <if test="beginTime != null and !&quot;&quot;.equals(beginTime)">
+            <![CDATA[ and  us.update_time >= #{beginTime}]]>
+        </if>
+
+        <if test="endTime != null and !&quot;&quot;.equals(endTime)">
+            <![CDATA[ and   us.update_time <= #{endTime}]]>
+        </if>
+
         GROUP BY
-            tmp.id,
-            tmp.user_id,
-            tmp.to_user_id,
-            tmp.create_time,
-            tmp.update_time,
-            tmp.type,
-            tmp.project_id,
-            tmp.nick_name,
-            tmp.icon,
-            tmp.amount
+        us.user_id,
+        us.type,
+        us.store_id
         ORDER BY
-            chattime DESC
+        update_time DESC
     </select>
 
 
@@ -244,45 +241,38 @@
 
         SELECT DISTINCT
         us.user_id,
-        us.to_user_id,
-        us.contact_id,
         us.type,
-        us.project_id,
-        tu.nick_name,
-        tu.icon,
-        myInfo.nick_name AS my_nick_name,
-        myInfo.icon AS my_icon,
-        MAX(us.update_time) update_time
+        us.store_id,
+        MAX(us.update_time) update_time,
+        COUNT(chat.id) AS amount
         FROM
         users_session us
-        LEFT JOIN user_info tu ON us.to_user_id = tu.id
-        LEFT JOIN user_info myInfo ON us.user_id = myInfo.id
+        LEFT JOIN chat_info chat ON chat.user_id = us.user_id
+        AND chat.store_id = us.store_id
+        AND chat.type_flag = us.type
+        AND chat.state = 0
         WHERE
         us.user_id != 1
-        AND us.to_user_id != 1
-        AND us.type = 0
-        AND us.project_id IN (
+
+        AND us.store_id IN (
         SELECT
         id
         FROM
-        project_info
+        store_info
         WHERE
         del_flag = 'N'
         )
-        AND us.to_user_id = us.contact_id
         AND us.del_flag = 'N'
 
         <if test="userId != null and !&quot;&quot;.equals(userId)">
-            AND (us.user_id = #{userId} or us.to_user_id = #{userId})
+            AND us.user_id = #{userId}
         </if>
-        <if test="projectId != null and !&quot;&quot;.equals(projectId)">
-            AND us.project_id = #{projectId}
+        <if test="storeId != null and !&quot;&quot;.equals(storeId)">
+            AND us.store_id = #{storeId}
         </if>
-        <if test="companyId != null and !&quot;&quot;.equals(companyId)">
-            AND us.project_id in (select id from project_info where company_id = #{companyId})
+        <if test="type != null and !&quot;&quot;.equals(type)">
+            AND us.type = #{type}
         </if>
-
-
         <if test="beginTime != null and !&quot;&quot;.equals(beginTime)">
             <![CDATA[ and  us.update_time >= #{beginTime}]]>
         </if>
@@ -293,21 +283,15 @@
 
         GROUP BY
         us.user_id,
-        us.to_user_id,
-        us.contact_id,
         us.type,
-        us.project_id,
-        tu.nick_name,
-        tu.icon,
-        my_nick_name,
-        my_icon
+        us.store_id
         ORDER BY
         update_time DESC
 
-
     </select>
 
-    <select id="queryUsersSession" parameterType="com.izouma.awesomeadmin.model.UsersSession" resultType="com.izouma.awesomeadmin.model.UsersSession">
+    <select id="queryUsersSession" parameterType="com.izouma.awesomeadmin.model.UsersSession"
+            resultType="com.izouma.awesomeadmin.model.UsersSession">
         select
         <include refid="Base_Column_List"/>
         from users_session
@@ -332,6 +316,9 @@
             <if test="contactId != null and !&quot;&quot;.equals(contactId)">
                 and contact_id=#{contactId}
             </if>
+            <if test="storeId != null and !&quot;&quot;.equals(storeId)">
+                and store_id=#{storeId}
+            </if>
         </where>
         LIMIT 1
     </select>
@@ -350,19 +337,10 @@
         FROM
         chat_info
         WHERE
-        (
-        (
         user_id = #{userId}
-        AND to_user_id = #{toUserId}
-        )
-        OR (
-        user_id = #{toUserId}
-        AND to_user_id = #{userId}
-        )
-        )
         AND state != 2
-        <if test="projectId != null and !&quot;&quot;.equals(projectId)">
-            AND project_id = #{projectId}
+        <if test="storeId != null and !&quot;&quot;.equals(storeId)">
+            AND store_id = #{storeId}
         </if>
         ORDER BY
         time DESC
@@ -378,16 +356,20 @@
         <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
         <result column="type" property="type" jdbcType="INTEGER"/>
         <result column="project_id" property="projectId" jdbcType="INTEGER"/>
-        <result column="nick_name" property="nickName"/>
-        <result column="icon" property="icon"/>
-        <result column="my_nick_name" property="myNickName"/>
-        <result column="my_icon" property="myIcon"/>
-        <result column="project_name" property="projectName"/>
+        <result column="store_id" property="storeId" jdbcType="INTEGER"/>
         <result column="chattime" property="chattime"/>
         <association
                 property="chatInfo" javaType="com.izouma.awesomeadmin.model.ChatInfo"
                 select="getChat"
-                column="{ userId = user_id , toUserId = to_user_id , projectId = project_id }"/>
+                column="{ userId = user_id , storeId = store_id}"/>
+        <association property="storeInfo"
+                     javaType="com.izouma.awesomeadmin.model.StoreInfo"
+                     select="com.izouma.awesomeadmin.dao.StoreInfoMapper.queryStoreInfo"
+                     column="{ id = store_id }"/>
+        <association property="userInfo"
+                     javaType="com.izouma.awesomeadmin.model.UserInfo"
+                     select="com.izouma.awesomeadmin.dao.UserInfoMapper.queryUserInfo"
+                     column="{ id = user_id }"/>
 
     </resultMap>
 

+ 50 - 0
src/main/java/com/izouma/awesomeadmin/model/ChatInfo.java

@@ -32,6 +32,17 @@ public class ChatInfo {
 
     private String formId;
 
+    private Integer storeId;
+
+    private Integer typeFlag;
+
+    private String serviceName;
+
+    private String serviceNick;
+
+    private String serviceIcon;
+
+
     public String getFormId() {
         return formId;
     }
@@ -159,6 +170,45 @@ public class ChatInfo {
         this.projectId = projectId;
     }
 
+    public Integer getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(Integer storeId) {
+        this.storeId = storeId;
+    }
+
+    public Integer getTypeFlag() {
+        return typeFlag;
+    }
+
+    public void setTypeFlag(Integer typeFlag) {
+        this.typeFlag = typeFlag;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public String getServiceNick() {
+        return serviceNick;
+    }
+
+    public void setServiceNick(String serviceNick) {
+        this.serviceNick = serviceNick;
+    }
+
+    public String getServiceIcon() {
+        return serviceIcon;
+    }
+
+    public void setServiceIcon(String serviceIcon) {
+        this.serviceIcon = serviceIcon;
+    }
 
     @Override
     public String toString() {

+ 26 - 0
src/main/java/com/izouma/awesomeadmin/model/CustomerService.java

@@ -20,6 +20,10 @@ public class CustomerService{
     private String username;
     private String icon;
     private String useFlag;
+    private Integer statusFlag;
+    private Date loginTime;
+
+private String idStr;
 
 private String searchKey;
 
@@ -117,6 +121,20 @@ private String orderByStr;
     public void setUseFlag(String useFlag){
         this.useFlag = useFlag;
     }
+    public Integer getStatusFlag(){
+        return this.statusFlag;
+    }
+
+    public void setStatusFlag(Integer statusFlag){
+        this.statusFlag = statusFlag;
+    }
+    public Date getLoginTime(){
+        return this.loginTime;
+    }
+
+    public void setLoginTime(Date loginTime){
+        this.loginTime = loginTime;
+    }
 
 public String getSearchKey() {
     return searchKey;
@@ -142,5 +160,13 @@ public void setOrderByStr(String orderByStr) {
     this.orderByStr = orderByStr;
 }
 
+public String getIdStr() {
+    return idStr;
+}
+
+public void setIdStr(String idStr) {
+    this.idStr = idStr;
+}
+
 }
 

+ 13 - 8
src/main/java/com/izouma/awesomeadmin/model/RongYunToken.java

@@ -7,12 +7,14 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class RongYunToken {
 
-    private Long   id;
+    private Long id;
 
-    private Long   userId;
+    private String userId;
 
     private String token;
 
+    private Integer typeFlag;
+
 
     public Long getId() {
 
@@ -26,18 +28,14 @@ public class RongYunToken {
     }
 
 
-    public Long getUserId() {
-
+    public String getUserId() {
         return userId;
     }
 
-
-    public void setUserId(Long userId) {
-
+    public void setUserId(String userId) {
         this.userId = userId;
     }
 
-
     public String getToken() {
 
         return token;
@@ -49,6 +47,13 @@ public class RongYunToken {
         this.token = token;
     }
 
+    public Integer getTypeFlag() {
+        return typeFlag;
+    }
+
+    public void setTypeFlag(Integer typeFlag) {
+        this.typeFlag = typeFlag;
+    }
 
     @Override
     public String toString() {

+ 25 - 79
src/main/java/com/izouma/awesomeadmin/model/UsersSession.java

@@ -25,9 +25,10 @@ public class UsersSession {
 
     private String delFlag;
 
-    private String nickName;
+    private UserInfo userInfo;
+
+    private StoreInfo storeInfo;
 
-    private String icon;
 
     private Integer amount;
 
@@ -35,11 +36,6 @@ public class UsersSession {
 
     private ChatInfo chatInfo;
 
-    private String myNickName;
-
-    private String myIcon;
-
-    private String projectName;
 
     private Date beginTime;
 
@@ -47,6 +43,8 @@ public class UsersSession {
 
     private Integer contactId;
 
+    private Integer storeId;
+
     public Integer getContactId() {
         return contactId;
     }
@@ -151,33 +149,6 @@ public class UsersSession {
     }
 
 
-    public String getNickName() {
-
-        return nickName;
-    }
-
-
-    public void setNickName(String nickName) {
-
-        this.nickName = nickName;
-    }
-
-
-    public String getIcon() {
-        if (icon != null) {
-            return icon + "?x-oss-process=image/resize,m_lfit,w_128,h_128,limit_0/auto-orient,1/quality,q_60";
-        } else {
-            return null;
-        }
-    }
-
-
-    public void setIcon(String icon) {
-
-        this.icon = icon;
-    }
-
-
     public Integer getAmount() {
 
         return amount;
@@ -213,77 +184,52 @@ public class UsersSession {
         this.chatInfo = chatInfo;
     }
 
+    public Date getBeginTime() {
 
-    public String getMyNickName() {
-
-        return myNickName;
+        return beginTime;
     }
 
 
-    public void setMyNickName(String myNickName) {
-
-        this.myNickName = myNickName;
-    }
-
+    public void setBeginTime(Date beginTime) {
 
-    public String getMyIcon() {
-        if (myIcon != null) {
-            return myIcon + "?x-oss-process=image/resize,m_lfit,w_128,h_128,limit_0/auto-orient,1/quality,q_60";
-        } else {
-            return null;
-        }
+        this.beginTime = beginTime;
     }
 
 
-    public void setMyIcon(String myIcon) {
+    public Date getEndTime() {
 
-        this.myIcon = myIcon;
+        return endTime;
     }
 
 
-    public String getProjectName() {
+    public void setEndTime(Date endTime) {
 
-        return projectName;
+        this.endTime = endTime;
     }
 
 
-    public void setProjectName(String projectName) {
-
-        this.projectName = projectName;
+    public Integer getStoreId() {
+        return storeId;
     }
 
-
-    public Date getBeginTime() {
-
-        return beginTime;
+    public void setStoreId(Integer storeId) {
+        this.storeId = storeId;
     }
 
 
-    public void setBeginTime(Date beginTime) {
-
-        this.beginTime = beginTime;
+    public UserInfo getUserInfo() {
+        return userInfo;
     }
 
-
-    public Date getEndTime() {
-
-        return endTime;
+    public void setUserInfo(UserInfo userInfo) {
+        this.userInfo = userInfo;
     }
 
-
-    public void setEndTime(Date endTime) {
-
-        this.endTime = endTime;
+    public StoreInfo getStoreInfo() {
+        return storeInfo;
     }
 
-
-    @Override
-    public String toString() {
-
-        return "UsersSession [id=" + id + ", userId=" + userId + ", toUserId=" + toUserId + ", createTime=" + createTime + ", updateTime="
-                + updateTime + ", type=" + type + ", projectId=" + projectId + ", delFlag=" + delFlag + ", nickName=" + nickName + ", icon=" + icon
-                + ", amount=" + amount + ", chattime=" + chattime + ", chatInfo=" + chatInfo + ", myNickName=" + myNickName + ", myIcon=" + myIcon
-                + ", projectName=" + projectName + ", beginTime=" + beginTime + ", endTime=" + endTime + "]";
+    public void setStoreInfo(StoreInfo storeInfo) {
+        this.storeInfo = storeInfo;
     }
-
 }

+ 1 - 1
src/main/java/com/izouma/awesomeadmin/service/ChatInfoService.java

@@ -28,7 +28,7 @@ public interface ChatInfoService {
 
     boolean updateChatInfo(ChatInfo chatInfo);
 
-    boolean readAll(int userId, int toUserId);
+    boolean readAll(ChatInfo chatInfo);
 
 
 }

+ 2 - 2
src/main/java/com/izouma/awesomeadmin/service/UsersSessionService.java

@@ -8,10 +8,10 @@ import java.util.List;
 
 public interface UsersSessionService {
 
-    List<UsersSession> getUsersSessionList(String userId);
+    List<UsersSession> getUsersSessionList(UsersSession usersSession);
 
 
-    List<UsersSession> queryAllUsersSessionByPage(Page page, UsersSession usersSession, String companyId);
+    List<UsersSession> queryAllUsersSessionByPage(Page page, UsersSession usersSession);
 
 
     List<UsersSession> getUsersSessionByPage(Page page, UsersSession usersSession);

+ 2 - 6
src/main/java/com/izouma/awesomeadmin/service/impl/ChatInfoServiceImpl.java

@@ -91,10 +91,6 @@ public class ChatInfoServiceImpl implements ChatInfoService {
         logger.info("createChatInfo");
         try {
 
-            ChatInfo c = new ChatInfo();
-            c.setUserId(chatInfo.getUserId());
-            c.setToUserId(chatInfo.getToUserId());
-            c.setProjectId(chatInfo.getProjectId());
             int updates = chatInfoMapper.insertSelective(chatInfo);
 
             usersSessionMapper.updateByChatInfo(chatInfo);
@@ -140,9 +136,9 @@ public class ChatInfoServiceImpl implements ChatInfoService {
 
 
     @Override
-    public boolean readAll(int userId, int toUserId) {
+    public boolean readAll(ChatInfo chatInfo) {
 
-        return chatInfoMapper.readAll(userId, toUserId) > 0;
+        return chatInfoMapper.readAll(chatInfo) > 0;
     }
 
 

+ 9 - 5
src/main/java/com/izouma/awesomeadmin/service/impl/UsersSessionServiceImpl.java

@@ -24,12 +24,16 @@ public class UsersSessionServiceImpl implements UsersSessionService {
 
 
     @Override
-    public List<UsersSession> getUsersSessionList(String userId) {
+    public List<UsersSession> getUsersSessionList(UsersSession usersSession) {
 
         logger.info("getUsersSessionList");
         try {
             Map<String, Object> parameter = new HashMap<String, Object>();
-            parameter.put("userId", userId);
+            parameter.put("userId", usersSession.getUserId());
+            parameter.put("storeId", usersSession.getStoreId());
+            parameter.put("type", usersSession.getType());
+            parameter.put("beginTime", usersSession.getBeginTime());
+            parameter.put("endTime", usersSession.getEndTime());
             return usersSessionMapper.queryAllUsersSession(parameter);
         } catch (Exception e) {
             logger.error("getUsersSessionList", e);
@@ -39,17 +43,17 @@ public class UsersSessionServiceImpl implements UsersSessionService {
 
 
     @Override
-    public List<UsersSession> queryAllUsersSessionByPage(Page page, UsersSession usersSession, String companyId) {
+    public List<UsersSession> queryAllUsersSessionByPage(Page page, UsersSession usersSession) {
 
         logger.info("queryAllUsersSessionByPage");
         try {
             Map<String, Object> parameter = new HashMap<String, Object>();
             parameter.put(AppConstant.PAGE, page);
             parameter.put("userId", usersSession.getUserId());
-            parameter.put("projectId", usersSession.getProjectId());
+            parameter.put("storeId", usersSession.getStoreId());
+            parameter.put("type", usersSession.getType());
             parameter.put("beginTime", usersSession.getBeginTime());
             parameter.put("endTime", usersSession.getEndTime());
-            parameter.put("companyId", companyId);
             return usersSessionMapper.queryAllUsersSessionByPage(parameter);
         } catch (Exception e) {
             logger.error("queryAllUsersSessionByPage", e);

+ 2 - 2
src/main/java/com/izouma/awesomeadmin/web/ChatInfoController.java

@@ -98,8 +98,8 @@ public class ChatInfoController {
 
     @RequestMapping(value = "/readAll", method = RequestMethod.GET)
     @ResponseBody
-    public Result readAll(@RequestParam("userId") String userId, @RequestParam("toUserId") String toUserId) {
-        return new Result(chatInfoService.readAll(Integer.valueOf(userId), Integer.valueOf(toUserId)), "");
+    public Result readAll(ChatInfo chatInfo) {
+        return new Result(chatInfoService.readAll(chatInfo), "");
     }
 
 }

+ 6 - 4
src/main/java/com/izouma/awesomeadmin/web/CustomerServiceController.java

@@ -132,10 +132,10 @@ public class CustomerServiceController {
         String sheetName = "customer_service";
         String titleName = "店铺客服数据表";
         String fileName = "店铺客服表";
-        int columnNumber = 12;
-        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20 };
-        String[] columnName = {  "" ,   "删除标识" ,   "更新时间" ,   "更新人" ,   "创建时间" ,   "创建人" ,   "店铺" ,   "客服名" ,   "密码" ,   "登录名" ,   "头像" ,   "可用标识"  };
-        String[][] dataList = new String[customerServices.size()][12];
+        int columnNumber = 14;
+        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20 };
+        String[] columnName = {  "" ,   "删除标识" ,   "更新时间" ,   "更新人" ,   "创建时间" ,   "创建人" ,   "店铺" ,   "客服名" ,   "密码" ,   "登录名" ,   "头像" ,   "可用标识" ,   "状态" ,   "登录时间"  };
+        String[][] dataList = new String[customerServices.size()][14];
 
         for (int i = 0; i < customerServices.size(); i++) {
 
@@ -151,6 +151,8 @@ public class CustomerServiceController {
                         dataList[i][9] = String.valueOf(customerServices.get(i).getUsername());
                         dataList[i][10] = String.valueOf(customerServices.get(i).getIcon());
                         dataList[i][11] = String.valueOf(customerServices.get(i).getUseFlag());
+                        dataList[i][12] = String.valueOf(customerServices.get(i).getStatusFlag());
+                        dataList[i][13] = String.valueOf(customerServices.get(i).getLoginTime());
                     }
 
 

+ 23 - 1
src/main/java/com/izouma/awesomeadmin/web/RongCloudController.java

@@ -8,9 +8,11 @@ import com.izouma.awesomeadmin.service.RongYunTokenService;
 import com.izouma.awesomeadmin.service.UserInfoService;
 import com.izouma.awesomeadmin.util.PropertiesFileLoader;
 import io.rong.RongCloud;
+import io.rong.models.CheckOnlineResult;
 import io.rong.models.SMSSendCodeResult;
 import io.rong.models.SMSVerifyCodeResult;
 import io.rong.models.TokenResult;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -116,7 +118,7 @@ public class RongCloudController {
 
                 RongYunToken rong = new RongYunToken();
 
-                rong.setUserId(Long.valueOf(rongKey));
+                rong.setUserId(rongKey);
                 rong.setToken(userToken);
                 rongYunTokenService.saveRongToken(rong);
             } catch (Exception e) {
@@ -141,4 +143,24 @@ public class RongCloudController {
         token.put("portraitUri", uinfo.getIcon());
         return token;
     }
+
+    /**
+     * 检查是否在线
+     *
+     * @param userId
+     * @return
+     */
+    @RequestMapping(value = "/checkOnline", method = RequestMethod.GET)
+    @ResponseBody
+    public CheckOnlineResult checkOnline(@RequestParam(required = true, value = "userId") String userId) {
+
+        try {
+            CheckOnlineResult checkOnlineResult = rongCloud.user.checkOnline(userId);
+
+            return checkOnlineResult;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 }

+ 4 - 6
src/main/java/com/izouma/awesomeadmin/web/UsersSessionController.java

@@ -31,14 +31,13 @@ public class UsersSessionController {
     /**
      * <p>获取全部记录。</p>
      *
-     * @param userId the user id
      * @return result
      */
     @RequestMapping(value = "/all", method = RequestMethod.GET)
     @ResponseBody
-    public Result all(@RequestParam(required = false, value = "userId") String userId) {
+    public Result all(UsersSession usersSession) {
 
-        List<UsersSession> pp = usersSessionService.getUsersSessionList(userId);
+        List<UsersSession> pp = usersSessionService.getUsersSessionList(usersSession);
         return new Result(true, pp);
     }
 
@@ -99,16 +98,15 @@ public class UsersSessionController {
      *
      * @param page         the page
      * @param usersSession the users session
-     * @param companyId    the company id
      * @return result
      */
     @RequestMapping(value = "/pageAll", method = RequestMethod.GET)
     @ResponseBody
-    public Result pageAll(Page page, UsersSession usersSession, String companyId) {
+    public Result pageAll(Page page, UsersSession usersSession) {
 
         Map<String, Object> result = new HashMap<>();
 
-        List<UsersSession> pp = usersSessionService.queryAllUsersSessionByPage(page, usersSession, companyId);
+        List<UsersSession> pp = usersSessionService.queryAllUsersSessionByPage(page, usersSession);
         result.put(AppConstant.PAGE, page);
         result.put("pp", pp);
         return new Result(true, result);

+ 94 - 85
src/main/vue/src/pages/CustomerService.vue

@@ -1,31 +1,32 @@
 <template>
     <div>
-        <el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small"
-                 style="max-width: 500px;">
-                                                                                                                                                                                                                                    <el-form-item prop="storeId" label="店铺">
+        <el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small" style="max-width: 500px;">
+            <el-form-item prop="storeId" label="店铺">
                 <el-input v-model="formData.storeId" :disabled="'storeId'==subColumn"></el-input>
             </el-form-item>
-                                                                                                                                                                                                                                                                                                                            <el-form-item prop="serviceName" label="客服名">
+            <el-form-item prop="serviceName" label="客服名">
                 <el-input v-model="formData.serviceName" :disabled="'serviceName'==subColumn"></el-input>
             </el-form-item>
-                                                                                                                                                                                                                                                                                                                            <el-form-item prop="password" label="密码">
+            <el-form-item prop="password" label="密码">
                 <el-input v-model="formData.password" :disabled="'password'==subColumn"></el-input>
             </el-form-item>
-                                                                                                                                                                                                                                                                                                                            <el-form-item prop="username" label="登录名">
+            <el-form-item prop="username" label="登录名">
                 <el-input v-model="formData.username" :disabled="'username'==subColumn"></el-input>
             </el-form-item>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                         <el-form-item prop="icon" label="头像">
-                 <single-upload v-model="formData.icon" :disabled="'icon'==subColumn"></single-upload>
-             </el-form-item>
-                                                                                                                                                                                                                                                                                                                                                                                                            <el-form-item prop="useFlag" label="可用标识">
-                <el-switch
-                        v-model="formData.useFlag"
-                        active-color="#13ce66"
-                        inactive-color="#ff4949"
-                        :disabled="'useFlag'==subColumn">
+            <el-form-item prop="icon" label="头像">
+                <single-upload v-model="formData.icon" :disabled="'icon'==subColumn"></single-upload>
+            </el-form-item>
+            <el-form-item prop="useFlag" label="可用标识">
+                <el-switch v-model="formData.useFlag" active-color="#13ce66" inactive-color="#ff4949" :disabled="'useFlag'==subColumn">
                 </el-switch>
             </el-form-item>
-                                                            <el-form-item>
+            <el-form-item prop="statusFlag" label="状态">
+                <el-input v-model="formData.statusFlag" :disabled="'statusFlag'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item prop="loginTime" label="登录时间">
+                <el-input v-model="formData.loginTime" :disabled="'loginTime'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item>
                 <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
                 <el-button @click="onDelete" v-if="formData.id" type="danger">删除</el-button>
                 <el-button @click="$router.go(-1)">取消</el-button>
@@ -34,92 +35,100 @@
     </div>
 </template>
 <script>
-    import formValidator from '../formValidator'
+import formValidator from '../formValidator'
 
-    export default {
-        created() {
-            if (this.$route.query.column) {
-                this.subColumn = this.$route.query.column.split(',')[1];
-                this.subValue = this.$route.query.column.split(',')[0];
-            }
+export default {
+    created() {
+        if (this.$route.query.column) {
+            this.subColumn = this.$route.query.column.split(',')[1];
+            this.subValue = this.$route.query.column.split(',')[0];
+        }
 
-            if (this.$route.query.id) {
-                this.$http.get({
-                    url: '/customerService/getOne',
-                    data: {
-                        id: this.$route.query.id
-                    }
-                }).then(res => {
-                    if (res.success) {
+        if (this.$route.query.id) {
+            this.$http.get({
+                url: '/customerService/getOne',
+                data: {
+                    id: this.$route.query.id
+                }
+            }).then(res => {
+                if (res.success) {
 
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
-                        this.formData = res.data;
+
+                    this.formData = res.data;
 
                     if (this.$route.query.column) {
                         this.formData[this.subColumn] = this.subValue;
                     }
-                    }
-                })
-            }else {
-                if (this.$route.query.column) {
-                    this.formData[this.subColumn] = this.subValue;
+
+                    this.formData.useFlag = this.formData.useFlag == 'Y' ? true : false;
+                    
                 }
+            })
+        } else {
+            if (this.$route.query.column) {
+                this.formData[this.subColumn] = this.subValue;
             }
+        }
 
-                                                                                                                                                                                                                                                                                                                                                                    },
-        data() {
-            return {
-                saving: false,
-                formData: {},
-                rules: {
-                                                                                                                                                                                                                                                                                                                                                                    },
-                                                                                                            subColumn: '',
+    },
+    data() {
+        return {
+            saving: false,
+            formData: {
+                useFlag: true,
+            },
+            rules: {
+            },
+            subColumn: '',
             subValue: '',
         }
+    },
+    methods: {
+        onSave() {
+            this.$refs.form.validate((valid) => {
+                if (valid) {
+                    this.submit();
+                } else {
+                    return false;
+                }
+            });
         },
-        methods: {
-            onSave() {
-                this.$refs.form.validate((valid) => {
-                    if (valid) {
-                        this.submit();
-                    } else {
-                        return false;
-                    }
-                });
-            },
-            submit() {
-                var data = JSON.parse(JSON.stringify(this.formData));
-                this.$http.post({
-                    url: this.formData.id ? '/customerService/update' : '/customerService/save',
-                    data: data
-                }).then(res => {
-                    if (res.success) {
-                        this.$message.success('成功');
-                        this.$router.go(-1);
-                    } else {
-                        this.$message.warning('失败')
-                    }
-                });
-            },
-            onDelete() {
-                this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' }).then(() => {
-                    return this.$http.post({
+        submit() {
+            var data = JSON.parse(JSON.stringify(this.formData));
+
+            data.useFlag = this.formData.useFlag ? 'Y' : 'N';
+
+            this.$http.post({
+                url: this.formData.id ? '/customerService/update' : '/customerService/save',
+                data: data
+            }).then(res => {
+                if (res.success) {
+                    this.$message.success('成功');
+                    this.$router.go(-1);
+                } else {
+                    this.$message.warning('失败')
+                }
+            });
+        },
+        onDelete() {
+            this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' }).then(() => {
+                return this.$http.post({
                     url: '/customerService/del',
                     data: { id: this.formData.id }
-                    })
-                }).then(() => {
-                    this.$message.success('删除成功');
-                    this.$router.go(-1);
-                }).catch(action => {
-                    if (action === 'cancel') {
-                        this.$message.info('删除取消');
-                    } else {
-                        this.$message.error('删除失败');
-                    }
                 })
-            },
-        }
+            }).then(() => {
+                this.$message.success('删除成功');
+                this.$router.go(-1);
+            }).catch(action => {
+                if (action === 'cancel') {
+                    this.$message.info('删除取消');
+                } else {
+                    this.$message.error('删除失败');
+                }
+            })
+        },
     }
+}
 </script>
 <style lang="less" scoped>
 </style>

+ 32 - 0
src/main/vue/src/pages/CustomerServices.vue

@@ -89,6 +89,20 @@
                                 label="可用标识"
                                 min-width="100">
                         </el-table-column>
+                                                                
+                                            <el-table-column
+                                v-if="isColumnShow('statusFlag')"
+                                prop="statusFlag"
+                                label="状态"
+                                min-width="100">
+                        </el-table-column>
+                                                                
+                                            <el-table-column
+                                v-if="isColumnShow('loginTime')"
+                                prop="loginTime"
+                                label="登录时间"
+                                min-width="100">
+                        </el-table-column>
                                                             <el-table-column
                     label="操作"
                     align="center"
@@ -260,6 +274,16 @@
                                 label: '可用标识',
                                 value: 'useFlag',
                                 show: true
+                            },
+                                                                                                {
+                                label: '状态',
+                                value: 'statusFlag',
+                                show: true
+                            },
+                                                                                                {
+                                label: '登录时间',
+                                value: 'loginTime',
+                                show: true
                             },
                                                             ],
                 multipleMode: false,
@@ -292,6 +316,14 @@
                                                                                                 {
                                 label: '可用标识',
                                 value: 'use_flag'
+                            },
+                                                                                                {
+                                label: '状态',
+                                value: 'status_flag'
+                            },
+                                                                                                {
+                                label: '登录时间',
+                                value: 'login_time'
                             },
                                                             ],
                 advancedQuerySearchKey: '',