Commit e202df87 authored by 李博今's avatar 李博今

将错误日志导入数据库。为客服新增发送信息的手机号字段。等待发送短信接口

parent 226315e1
/**
* createby : JinxLbj
* date : 2018/8/27
* desc : 错误控制器
**/
package com.qiqiim.webserver.user.controller;
import com.qiqiim.webserver.user.service.ErrorLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@Controller
public class ErrorController {
@Autowired
private ErrorLogService errorLogServiceImpl;
/**
* 列表
*/
@RequestMapping("/errorList")
public String errorLoglist(@RequestParam Map<String, Object> params, HttpServletRequest request) {
request.setAttribute("allsession", errorLogServiceImpl.getLogs());
// String message = (String) getSession().getAttribute("message");
// if (message == null || "".equals(message)) {
// getSession().setAttribute("message", "");
// }
return "user/errorloglist";
}
@RequestMapping("/delError")
public String delError(@RequestParam Map<String, Object> params, HttpServletRequest request){
Integer id = new Integer((String)params.get("id"));
String solution = (String)params.get("solution");
errorLogServiceImpl.delLog(id, solution);
request.setAttribute("allsession", errorLogServiceImpl.getLogs());
return "user/errorloglist";
}
}
...@@ -703,6 +703,15 @@ public class ImController extends BaseController { ...@@ -703,6 +703,15 @@ public class ImController extends BaseController {
return new ModelAndView("redirect:/consultantlist"); return new ModelAndView("redirect:/consultantlist");
} }
} }
@RequestMapping(value = "/receivePhone")
@ResponseBody
public Map<String,Object> receivePhone(@Param(value = "id") long id){
String phone = userInfoServiceImpl.getPhone(id);
Map<String,Object> map = new HashMap<>();
map.put("phone", phone);
return map;
}
} }
......
/**
* createby : JinxLbj
* date : 2018/8/27
* desc : 错误信息持久化层
**/
package com.qiqiim.webserver.user.dao;
import com.qiqiim.webserver.user.model.ErrorLog;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ErrorLogDao {
List<ErrorLog> getLogs(String state);
int saveErrorLog(ErrorLog errorLog);
int delErrorLog(@Param("id") int id, @Param("solution") String solution);
}
<?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.qiqiim.webserver.user.dao.ErrorLogDao">
<resultMap type="com.qiqiim.webserver.user.model.ErrorLog" id="BaseResultMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="consultantId" column="consultant_id"/>
<result property="phone" column="phone"/>
<result property="message" column="message"/>
<result property="errorCode" column="error_code"/>
<result property="errorMessage" column="errorMessage"/>
<result property="sendTime" column="send_time"/>
<result property="state" column="state"/>
<result property="solution" column="solution"/>
</resultMap>
<select id="getLogs" resultMap="BaseResultMap">
select * from error_log where state = #{state};
</select>
<insert id="saveErrorLog">
INSERT INTO error_log (user_id,consultant_id,phone,message,error_code,error_message,send_time,state)
VALUE (#{userId},#{consultantId},#{phone},#{message},#{errorCode},#{errorMessage},#{sendTime},#{state});
</insert>
<delete id="delErrorLog">
update error_log set state = 1 , solution = #{solution} where id = #{id};
</delete>
</mapper>
\ No newline at end of file
...@@ -28,4 +28,6 @@ public interface UserAccountDao extends BaseDao<UserAccountEntity> { ...@@ -28,4 +28,6 @@ public interface UserAccountDao extends BaseDao<UserAccountEntity> {
public int updateConsultantPhone(@Param(value = "phone") String phone, @Param(value = "id") long id); public int updateConsultantPhone(@Param(value = "phone") String phone, @Param(value = "id") long id);
public int updateConsultantName(@Param(value = "name") String name, @Param(value = "id") long id); public int updateConsultantName(@Param(value = "name") String name, @Param(value = "id") long id);
public int updateConsultantMessagePhone(@Param(value = "messagePhone") String messagePhone, @Param(value = "id") long id);
} }
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
<select id="getAllConsultant" resultMap="consultantMap"> <select id="getAllConsultant" resultMap="consultantMap">
select ua.id, ua.account, ud.name as deptName, ui.name as name, ui.phone as phone, ui.profilephoto as headPic, select ua.id, ua.account, ud.name as deptName, ui.name as name, ui.phone as phone, ui.profilephoto as headPic,
ui.remark as remark ui.remark as remark, ui.message_phone as messagePhone
from user_account ua from user_account ua
left join user_info ui on ua.id = ui.uid left join user_info ui on ua.id = ui.uid
left join user_department ud on ui.deptid = ud.id left join user_department ud on ui.deptid = ud.id
...@@ -166,4 +166,7 @@ ...@@ -166,4 +166,7 @@
<update id="updateConsultantRemark"> <update id="updateConsultantRemark">
update user_info set remark = #{remark} where uid = #{id} update user_info set remark = #{remark} where uid = #{id}
</update> </update>
<update id="updateConsultantMessagePhone">
update user_info set message_phone = #{messagePhone} where uid = #{id}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -14,4 +14,6 @@ public interface UserInfoDao extends BaseDao<UserInfoEntity> { ...@@ -14,4 +14,6 @@ public interface UserInfoDao extends BaseDao<UserInfoEntity> {
int updateHeadPic(@Param(value = "path") String path, @Param(value = "id") long id); int updateHeadPic(@Param(value = "path") String path, @Param(value = "id") long id);
int delByUid(@Param(value = "id") long id); int delByUid(@Param(value = "id") long id);
String getPhone(@Param(value = "id") long id);
} }
...@@ -181,4 +181,8 @@ ...@@ -181,4 +181,8 @@
</foreach> </foreach>
</delete> </delete>
<select id="getPhone" resultType="string">
select phone from user_info where uid = #{id};
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -14,6 +14,8 @@ public class ConsultantManagerEntity { ...@@ -14,6 +14,8 @@ public class ConsultantManagerEntity {
private String password; private String password;
private String remark; private String remark;
private String messagePhone;
public String getPassword() { public String getPassword() {
return password; return password;
} }
...@@ -85,4 +87,12 @@ public class ConsultantManagerEntity { ...@@ -85,4 +87,12 @@ public class ConsultantManagerEntity {
public void setRemark(String remark) { public void setRemark(String remark) {
this.remark = remark; this.remark = remark;
} }
public String getMessagePhone() {
return messagePhone;
}
public void setMessagePhone(String meesagePhone) {
this.messagePhone = meesagePhone;
}
} }
/**
* createby : JinxLbj
* date : 2018/8/27
* desc : 错误信息类
**/
package com.qiqiim.webserver.user.model;
import java.util.Date;
public class ErrorLog {
private int id;
private int userId;
private int consultantId;
private String phone;
private String message;
private String errorCode;
private String errorMessage;
private Date sendTime;
private String state = "0";
private String solution;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getConsultantId() {
return consultantId;
}
public void setConsultantId(int consultantId) {
this.consultantId = consultantId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public Date getSendTime() {
return sendTime;
}
public void setSendTime(Date sendTime) {
this.sendTime = sendTime;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getSolution() {
return solution;
}
public void setSolution(String solution) {
this.solution = solution;
}
}
\ No newline at end of file
/**
* createby : JinxLbj
* date : 2018/8/27
* desc : 错误记录接口
**/
package com.qiqiim.webserver.user.service;
import com.qiqiim.webserver.user.model.ErrorLog;
import java.util.List;
public interface ErrorLogService {
/**
* 错误信息录入数据库
* @return 插入是否成功(0失败 1成功)
*/
int saveErrorLog();
/**
* 获取所有错误信息
* @return 错误信息集合
*/
List<ErrorLog> getLogs();
/**
* 删除错误信息
* @param id 主键
* @param solution 解决方案
* @return 删除数量
*/
int delLog(Integer id, String solution);
}
...@@ -27,4 +27,6 @@ public interface UserInfoService { ...@@ -27,4 +27,6 @@ public interface UserInfoService {
int updateHeadPic(String path, long id); int updateHeadPic(String path, long id);
int delByUid(long uid); int delByUid(long uid);
String getPhone(long uid);
} }
/**
* createby : JinxLbj
* date : 2018/8/27
* desc : 实现类
**/
package com.qiqiim.webserver.user.service.impl;
import com.qiqiim.webserver.user.dao.ErrorLogDao;
import com.qiqiim.webserver.user.model.ErrorLog;
import com.qiqiim.webserver.user.service.ErrorLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ErrorLogServiceImpl implements ErrorLogService {
@Autowired
private ErrorLogDao errorLogDao;
@Override
public int saveErrorLog() {
return errorLogDao.saveErrorLog(new ErrorLog());
}
@Override
public List<ErrorLog> getLogs() {
return errorLogDao.getLogs("0");
}
@Override
public int delLog(Integer id, String solution) {
return errorLogDao.delErrorLog(id, solution);
}
}
...@@ -116,6 +116,9 @@ public class UserAccountServiceImpl implements UserAccountService { ...@@ -116,6 +116,9 @@ public class UserAccountServiceImpl implements UserAccountService {
if(consultantManagerEntity.getRemark() != null){ if(consultantManagerEntity.getRemark() != null){
i += userAccountDao.updateConsultantRemark( new String (consultantManagerEntity.getRemark().getBytes("iso8859-1"),"UTF-8"), Long.parseLong(consultantManagerEntity.getId())); i += userAccountDao.updateConsultantRemark( new String (consultantManagerEntity.getRemark().getBytes("iso8859-1"),"UTF-8"), Long.parseLong(consultantManagerEntity.getId()));
} }
if(consultantManagerEntity.getMessagePhone() != null){
i += userAccountDao.updateConsultantMessagePhone( new String (consultantManagerEntity.getMessagePhone().getBytes("iso8859-1"),"UTF-8"), Long.parseLong(consultantManagerEntity.getId()));
}
return i; return i;
} }
......
...@@ -67,4 +67,9 @@ public class UserInfoServiceImpl implements UserInfoService { ...@@ -67,4 +67,9 @@ public class UserInfoServiceImpl implements UserInfoService {
return userInfoDao.delByUid(uid); return userInfoDao.delByUid(uid);
} }
@Override
public String getPhone(long uid) {
return userInfoDao.getPhone(uid);
}
} }
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<th>顾问姓名</th> <th>顾问姓名</th>
<th>所属部门</th> <th>所属部门</th>
<th>联系电话</th> <th>联系电话</th>
<th>信息电话</th>
<th>顾问描述</th> <th>顾问描述</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
<td>${user.name}</td> <td>${user.name}</td>
<td>${user.deptName}</td> <td>${user.deptName}</td>
<td>${user.phone}</td> <td>${user.phone}</td>
<td>${user.messagePhone}</td>
<td>${user.remark}</td> <td>${user.remark}</td>
<td> <td>
<a class="layui-btn layui-btn-primary layui-btn-xs sendUserMsg" <a class="layui-btn layui-btn-primary layui-btn-xs sendUserMsg"
...@@ -108,6 +110,13 @@ ...@@ -108,6 +110,13 @@
placeholder="请输入联系电话" class="layui-input"> placeholder="请输入联系电话" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">信息电话</label>
<div class="layui-input-block">
<input type="text" name="messagePhone" id="messagePhone1" autocomplete="off"
placeholder="请输入联系电话" class="layui-input">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">描述</label> <label class="layui-form-label">描述</label>
<div class="layui-input-block"> <div class="layui-input-block">
...@@ -175,6 +184,13 @@ ...@@ -175,6 +184,13 @@
autocomplete="off" class="layui-input"> autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">信息电话</label>
<div class="layui-input-block">
<input type="text" name="messagePhone" id="messagePhone2" autocomplete="off"
placeholder="请输入联系电话" class="layui-input">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">描述</label> <label class="layui-form-label">描述</label>
<div class="layui-input-block"> <div class="layui-input-block">
...@@ -255,6 +271,7 @@ ...@@ -255,6 +271,7 @@
} }
form.render('select'); form.render('select');
document.getElementById("phone1").value = tr.children[5].innerHTML; document.getElementById("phone1").value = tr.children[5].innerHTML;
document.getElementById("messagePhone1").value = tr.children[6].innerHTML;
list.style.display = 'none'; list.style.display = 'none';
updateDetailForm.style.display = 'block'; updateDetailForm.style.display = 'block';
} }
......
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/page/public/taglib.jsp" %>
<!doctype html>
<html>
<head>
<title>错误查看</title>
<link href="img/icon.ico" rel="SHORTCUT ICON"/>
<%@ include file="/WEB-INF/page/public/meta.jsp" %>
<link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<div style="margin: 20px;">
<div id="list">
<table class="layui-table" lay-size="lg">
<colgroup>
<col width="150">
<col width="200">
<col>
</colgroup>
<thead>
<tr>
<th>错误ID</th>
<th>用户ID</th>
<th>顾问ID</th>
<th>接受者电话</th>
<th>发送信息</th>
<th>错误代码</th>
<th>错误信息</th>
<th>发送时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${allsession}" var="user">
<tr>
<td>${user.id}</td>
<td>${user.userId}</td>
<td>${user.consultantId}</td>
<td>${user.phone}</td>
<td>${user.message}</td>
<td>${user.errorCode}</td>
<td>${user.errorMessage}</td>
<td>${user.sendTime}</td>
<td>
<a class="layui-btn layui-btn-primary layui-btn-xs sendUserMsg" onclick="del(this)">删除</a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<div id="delDiv" style="display: none">
<fieldset class="layui-elem-field index-button" style="margin-top: 30px">
<legend>添加</legend>
<div>
<form class="layui-form" action="delError" method="post" id="delForm">
<input name="id" id="id3" type="text" style="display: none"/>
<div class="layui-form-item">
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<input type="text" name="solution" placeholder="输入解决方案"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button id="regBut" class="layui-btn" onclick="subdel()">添加</button>
<a class="layui-btn layui-btn-primary" onclick="cancel()" target="_blank">返回
</a>
</div>
</div>
</form>
</div>
</fieldset>
</div>
<script src="layui/layui.js"></script>
</div>
<script>
var form;
layui.use('form', function () {
form = layui.form;
});
function del(e) {
document.getElementById("id3").value = e.parentElement.parentElement.children[0].innerHTML;
document.getElementById("list").style.display = 'none';
document.getElementById("delDiv").style.display = 'block';
}
function subdel(){
document.getElementById("delForm").submit();
}
window.onload = function(){
var message = "";
message = "${sessionScope.message}";
if(message == null || message === ""){
return;
}
alert(message);
${sessionScope.remove("message")}
}
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment