Browse Source

【修改】点赞弹框页面调整修改

lichen 11 tháng trước cách đây
mục cha
commit
326cfc9f40

+ 94 - 20
suishenbang-admin/src/main/resources/templates/system/upvoteLog/upvoteLog.html

@@ -11,19 +11,36 @@
                     <div class="select-list">
                         <ul>
                             <li>
-                                <p>弹框配置id:</p>
-                                <input type="text" name="alertId"/>
+                                <p>弹框内容:</p>
+                                <input type="text" name="alertContent"/>
                             </li>
                             <li>
-                                <p>用户id:</p>
-                                <input type="text" name="userId"/>
+                                <p>用户姓名:</p>
+                                <input type="text" name="userName"/>
                             </li>
                             <li>
-                                <p>点赞状态。0: 无;1:赞;2:踩:</p>
+                                <p>用户账号:</p>
+                                <input type="text" name="loginName"/>
+                            </li>
+                            <li>
+                                <p>点赞状态:</p>
                                 <select name="status">
                                     <option value="">所有</option>
+                                    <option value="0">无</option>
+                                    <option value="1">赞</option>
+                                    <option value="2">踩</option>
                                 </select>
                             </li>
+                            <li class="select-time">
+                                <p>操作时间:</p>
+                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="startTime"/>
+                                <span>——</span>
+                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTime"/>
+                            </li>
+<!--                            <li class="select-time">-->
+<!--                                <p>结束时间:</p>-->
+<!--                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTime"/>-->
+<!--                            </li>-->
                             <li>
                                 <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                 <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
@@ -34,12 +51,12 @@
             </div>
 
             <div class="btn-group-sm" id="toolbar" role="group">
-                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:log:add">
-                    <i class="fa fa-plus"></i> 添加
-                </a>
-                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:log:edit">
-                    <i class="fa fa-edit"></i> 修改
-                </a>
+<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:log:add">-->
+<!--                    <i class="fa fa-plus"></i> 添加-->
+<!--                </a>-->
+<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:log:edit">-->
+<!--                    <i class="fa fa-edit"></i> 修改-->
+<!--                </a>-->
                 <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:log:remove">
                     <i class="fa fa-remove"></i> 删除
                 </a>
@@ -71,24 +88,68 @@
                 },
                 {
                     field : 'alertUpvoteId', 
-                    title : 'id',
+                    title : '日志编号',
+                    visible: false
+                },
+                {
+                    field : 'userId',
+                    title : '用户id',
                     visible: false
                 },
+                {
+                    field : 'userName',
+                    title : '用户姓名',
+                },
+                {
+                    field : 'loginName',
+                    title : '用户账号',
+                },
+                {
+                    field : 'status',
+                    title : '点赞状态',
+                    formatter: function(value, row, index) {
+                        if (value == 0){
+                            return '无';
+                        }
+                        if (value == 1){
+                            return '赞';
+                        }
+                        if (value == 2){
+                            return '踩';
+                        }
+                    }
+                },
                 {
                     field : 'alertId', 
-                    title : '弹框配置id'
+                    title : '弹框配置id',
+                    visible: false
                 },
                 {
-                    field : 'isDelete', 
-                    title : '是否删除'
+                    field : 'alertContent',
+                    title : '弹框内容'
+                },
+                {
+                    field : 'photoUrl',
+                    title : '弹框图片',
+                    width : '100px',
+                    formatter: function(value, row, index) {
+                        if (value != null){
+                            // return $.table.imageView(value,600,300,"tableImage_s img-view");
+                            var valueStr = value + '';
+                            console.log('url1',value);
+                            console.log('url2',valueStr);
+                            return '<img width="24" height="22" src="' + value + '" onclick="imgPreview(\'' + valueStr + '\')"/>'
+                        }
+                    }
                 },
                 {
-                    field : 'userId', 
-                    title : '用户id'
+                    field : 'isDelete', 
+                    title : '是否删除',
+                    visible: false
                 },
                 {
-                    field : 'status', 
-                    title : '点赞状态。0: 无;1:赞;2:踩'
+                    field : 'createTime',
+                    title : '操作时间'
                 },
                 {
                     title: '操作',
@@ -98,11 +159,24 @@
                         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.alertUpvoteId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.alertUpvoteId + '\')"><i class="fa fa-remove"></i>删除</a>');
                         return actions.join('');
-                    }
+                    },
+                    visible: false
                 }]
             };
             $.table.init(options);
         });
+        $("#previewImage").on('click',function (event) {
+            event.stopPropagation();
+        })
+
+        function closePreview() {
+            $("#previewImg").hide();
+        }
+
+        function imgPreview(url) {
+            $("#previewImage").attr('src',url);
+            $("#previewImg").show();
+        }
     </script>
 </body>
 </html>

+ 73 - 0
suishenbang-system/src/main/java/com/dgtly/system/domain/AlertUpvoteLog.java

@@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 import com.dgtly.common.annotation.Excel;
 import com.dgtly.common.core.domain.BaseEntity;
 
+import java.util.Date;
+
 /**
  * 弹框点赞日志对象 alert_upvote_log
  * 
@@ -34,6 +36,25 @@ public class AlertUpvoteLog extends BaseEntity
     @Excel(name = "点赞状态。0: 无;1:赞;2:踩")
     private Integer status;
 
+    /** 登录名称 */
+    @Excel(name = "登录名称")
+    private String loginName;
+
+    /** 用户名称 */
+    @Excel(name = "用户名称")
+    private String userName;
+
+    /** 弹框内容 */
+    @Excel(name = "弹框内容")
+    private String alertContent;
+
+    /** 弹框图片地址 */
+    private String photoUrl;
+
+    //用于查询
+    private Date startTime;
+    private Date endTime;
+
     public void setAlertUpvoteId(Long alertUpvoteId) 
     {
         this.alertUpvoteId = alertUpvoteId;
@@ -78,6 +99,54 @@ public class AlertUpvoteLog extends BaseEntity
         return status;
     }
 
+    public String getLoginName() {
+        return loginName;
+    }
+
+    public void setLoginName(String loginName) {
+        this.loginName = loginName;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getAlertContent() {
+        return alertContent;
+    }
+
+    public void setAlertContent(String alertContent) {
+        this.alertContent = alertContent;
+    }
+
+    public String getPhotoUrl() {
+        return photoUrl;
+    }
+
+    public void setPhotoUrl(String photoUrl) {
+        this.photoUrl = photoUrl;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -90,6 +159,10 @@ public class AlertUpvoteLog extends BaseEntity
             .append("isDelete", getIsDelete())
             .append("userId", getUserId())
             .append("status", getStatus())
+            .append("loginName", getLoginName())
+            .append("userName", getUserName())
+            .append("alertContent", getAlertContent())
+            .append("photoUrl", getPhotoUrl())
             .toString();
     }
 }

+ 24 - 5
suishenbang-system/src/main/resources/mapper/system/AlertUpvoteLogMapper.xml

@@ -14,19 +14,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="isDelete"    column="is_delete"    />
         <result property="userId"    column="user_id"    />
         <result property="status"    column="status"    />
+        <result property="loginName"    column="login_name"    />
+        <result property="userName"    column="user_name"    />
+        <result property="alertContent"    column="alert_content"    />
+        <result property="photoUrl"    column="photo_url"    />
+
     </resultMap>
 
     <sql id="selectAlertUpvoteLogVo">
-        select alert_upvote_id, alert_id, create_by, create_time, update_by, update_time, is_delete, user_id, status from alert_upvote_log
+        select alert_upvote_id, alert_id, create_by, create_time, update_by, update_time, is_delete, user_id, status,login_name,user_name,alert_content,photo_url from alert_upvote_log
     </sql>
 
     <select id="selectAlertUpvoteLogList" parameterType="AlertUpvoteLog" resultMap="AlertUpvoteLogResult">
         <include refid="selectAlertUpvoteLogVo"/>
-        <where>  
-            <if test="alertId != null "> and alert_id = #{alertId}</if>
-            <if test="isDelete != null "> and is_delete = #{isDelete}</if>
-            <if test="userId != null "> and user_id = #{userId}</if>
+        <where>
+            <if test="userName != null "> and user_name like concat('%', #{userName}, '%')</if>
+            <if test="loginName != null "> and login_name like concat('%', #{loginName}, '%')</if>
+            <if test="alertContent != null "> and alert_content like concat('%', #{alertContent}, '%')</if>
             <if test="status != null "> and status = #{status}</if>
+            <if test="startTime != null "> and create_time &gt;= #{startTime}</if>
+            <if test="endTime != null "> and create_time &lt; #{endTime}</if>
         </where>
     </select>
     
@@ -46,6 +53,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isDelete != null ">is_delete,</if>
             <if test="userId != null ">user_id,</if>
             <if test="status != null ">status,</if>
+            <if test="loginName != null ">login_name,</if>
+            <if test="userName != null ">user_name,</if>
+            <if test="alertContent != null ">alert_content,</if>
+            <if test="photoUrl != null ">photo_url,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="alertId != null ">#{alertId},</if>
@@ -56,6 +67,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isDelete != null ">#{isDelete},</if>
             <if test="userId != null ">#{userId},</if>
             <if test="status != null ">#{status},</if>
+            <if test="loginName != null ">#{loginName},</if>
+            <if test="userName != null ">#{userName},</if>
+            <if test="alertContent != null ">#{alertContent},</if>
+            <if test="photoUrl != null ">#{photoUrl},</if>
          </trim>
     </insert>
 
@@ -70,6 +85,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isDelete != null ">is_delete = #{isDelete},</if>
             <if test="userId != null ">user_id = #{userId},</if>
             <if test="status != null ">status = #{status},</if>
+            <if test="loginName != null ">login_name = #{loginName},</if>
+            <if test="userName != null ">user_name = #{userName},</if>
+            <if test="alertContent != null ">alert_content = #{alertContent},</if>
+            <if test="photoUrl != null ">photo_url = #{photoUrl},</if>
         </trim>
         where alert_upvote_id = #{alertUpvoteId}
     </update>

+ 14 - 5
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxAlertLogController.java

@@ -5,10 +5,7 @@ import com.dgtly.common.annotation.ApiPassToken;
 import com.dgtly.common.core.controller.ApiBaseController;
 import com.dgtly.common.core.domain.AjaxResult;
 import com.dgtly.common.core.domain.ParameterObject;
-import com.dgtly.system.domain.AlertConfiguration;
-import com.dgtly.system.domain.AlertLog;
-import com.dgtly.system.domain.AlertUpvoteLog;
-import com.dgtly.system.domain.SysUserExt;
+import com.dgtly.system.domain.*;
 import com.dgtly.system.service.*;
 import io.swagger.annotations.*;
 import net.sf.jsqlparser.statement.select.Select;
@@ -248,20 +245,32 @@ public class WxAlertLogController  extends ApiBaseController {
     public Object getUpvoteStatus() throws ParseException {
         ParameterObject obj = getParameterObject();
         Long userId = Long.valueOf(obj.getString("userId"));//用户ID
+        String loginName = String.valueOf(obj.getString("loginName"));//用户账号
+        String userName = String.valueOf(obj.getString("userName"));//用户姓名
         Long alertId = Long.valueOf(obj.getString("alertId"));//弹框ID
-        Integer status = Integer.valueOf(obj.getString("status"));//弹框ID
+        String alertContent = String.valueOf(obj.getString("alertContent"));//弹框内容
+        String photoUrl = String.valueOf(obj.getString("photoUrl"));//弹框图片
+        Integer status = Integer.valueOf(obj.getString("status"));//状态
         //根据用户ID、弹框ID查询是否有记录,,没有新增记录
         AlertUpvoteLog alertUpvoteLog = alertUpvoteLogService.selectUpvoteByUidAndAid(userId, alertId);
         if (alertUpvoteLog!=null){
             //如果有 修改记录
             alertUpvoteLog.setStatus(status);
+            alertUpvoteLog.setLoginName(loginName);
+            alertUpvoteLog.setUserName(userName);
+            alertUpvoteLog.setAlertContent(alertContent);
+            alertUpvoteLog.setPhotoUrl(photoUrl);
             int i = alertUpvoteLogService.updateAlertUpvoteLog(alertUpvoteLog);
             return AjaxResult.success(alertUpvoteLog);
         }else {
             //没有新增记录
             AlertUpvoteLog upvoteLog = new AlertUpvoteLog();
             upvoteLog.setUserId(userId);
+            upvoteLog.setLoginName(loginName);
+            upvoteLog.setUserName(userName);
             upvoteLog.setAlertId(alertId);
+            upvoteLog.setAlertContent(alertContent);
+            upvoteLog.setPhotoUrl(photoUrl);
             upvoteLog.setStatus(status);
             int i = alertUpvoteLogService.insertAlertUpvoteLog(upvoteLog);
             return AjaxResult.success(upvoteLog);