Commit 2ad2f8c6 by Java-李昕颖

添加消息

parent af728ff7
...@@ -4,9 +4,11 @@ import com.ejweb.core.persistence.CrudDao; ...@@ -4,9 +4,11 @@ import com.ejweb.core.persistence.CrudDao;
import com.ejweb.core.persistence.annotation.MyBatisDao; import com.ejweb.core.persistence.annotation.MyBatisDao;
import com.ejweb.modules.report.entity.ReportAttachmentEntity; import com.ejweb.modules.report.entity.ReportAttachmentEntity;
import com.ejweb.modules.report.entity.ReportEntity; import com.ejweb.modules.report.entity.ReportEntity;
import com.ejweb.modules.report.entity.ReportExchangeHistory;
import com.ejweb.modules.sys.entity.Office; import com.ejweb.modules.sys.entity.Office;
import com.ejweb.modules.sys.entity.User; import com.ejweb.modules.sys.entity.User;
import com.ejweb.modules.workbench.Bean.WorkbenchBean; import com.ejweb.modules.workbench.Bean.WorkbenchBean;
import com.ejweb.modules.workbench.entity.ReportNotice;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -86,12 +88,38 @@ public interface ReportDao extends CrudDao<ReportEntity> { ...@@ -86,12 +88,38 @@ public interface ReportDao extends CrudDao<ReportEntity> {
public List<User> getPositionList(); public List<User> getPositionList();
/** /**
* 移交举报 * 根据reportId查询消息表中是否已存在该条记录
* @param userId * @param reportId
* @param id
* @return * @return
*/ */
public int modifyExchangeAfterUser(String userId,String id); public ReportNotice findReportNotice(String reportId,String userId);
/**
* 新增消息
* @param reportNotice
* @return
*/
public int addReportNotice(ReportNotice reportNotice);
/**
* 更新消息表
* @param reportNotice
* @return
*/
public int updateReportNotice(ReportNotice reportNotice);
/**
* 新增消息
* @param reportExchangeHistory
* @return
*/
public int addRecord(ReportExchangeHistory reportExchangeHistory);
/**
* 查询管理员ID
* @return
*/
public String findAdmin();
/** /**
* 举报状态数据 * 举报状态数据
......
package com.ejweb.modules.report.entity;
public class ReportExchangeHistory {
private String id;
private String oldUserId;
private String newUserId;
private String exchangeType;
private String exchangeTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOldUserId() {
return oldUserId;
}
public void setOldUserId(String oldUserId) {
this.oldUserId = oldUserId;
}
public String getNewUserId() {
return newUserId;
}
public void setNewUserId(String newUserId) {
this.newUserId = newUserId;
}
public String getExchangeType() {
return exchangeType;
}
public void setExchangeType(String exchangeType) {
this.exchangeType = exchangeType;
}
public String getExchangeTime() {
return exchangeTime;
}
public void setExchangeTime(String exchangeTime) {
this.exchangeTime = exchangeTime;
}
}
...@@ -7,9 +7,11 @@ import com.ejweb.core.utils.StringUtils; ...@@ -7,9 +7,11 @@ import com.ejweb.core.utils.StringUtils;
import com.ejweb.modules.report.dao.ReportDao; import com.ejweb.modules.report.dao.ReportDao;
import com.ejweb.modules.report.entity.ReportAttachmentEntity; import com.ejweb.modules.report.entity.ReportAttachmentEntity;
import com.ejweb.modules.report.entity.ReportEntity; import com.ejweb.modules.report.entity.ReportEntity;
import com.ejweb.modules.report.entity.ReportExchangeHistory;
import com.ejweb.modules.sys.entity.Office; import com.ejweb.modules.sys.entity.Office;
import com.ejweb.modules.sys.entity.User; import com.ejweb.modules.sys.entity.User;
import com.ejweb.modules.sys.utils.UserUtils; import com.ejweb.modules.sys.utils.UserUtils;
import com.ejweb.modules.workbench.entity.ReportNotice;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -18,6 +20,7 @@ import java.io.File; ...@@ -18,6 +20,7 @@ import java.io.File;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -214,15 +217,67 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> { ...@@ -214,15 +217,67 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
} }
/** /**
* 移交后发送消息 * 管理员移交后发送消息
* @param reportId * @param reportEntity
* @param supplementTitle * @return
*/
@Transactional(readOnly = false)
public void addNotice(ReportEntity reportEntity,String flag){
User user = UserUtils.getUser();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ReportNotice reportNotice = reportDao.findReportNotice(reportEntity.getId(),user.getId());
if (reportNotice != null){
//消息表中已存在该条举报的移交信息
if (StringUtils.isNotBlank(user.getId())){
reportNotice.setUpdateBy(user.getId());
}
reportNotice.setUpdateDate(date);
String sendTime = sdf.format(date);
reportNotice.setSendTime(sendTime);
reportNotice.setSendFromId(user.getId());
reportNotice.setSendToId(reportEntity.getExchangeAfterUser());
reportNotice.setStatus("0");
reportDao.updateReportNotice(reportNotice);
}else{
reportNotice.setId(IdGen.uuid());
reportNotice.setReportId(reportEntity.getId());
if (flag.equals("answer")){
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");
String dateStr = sdf1.format(date);
reportNotice.setTitle("“"+reportEntity.getSupplementTitle()+"”已由"+user.getName()+"于"+dateStr+"处理完成");
reportNotice.setSendToId(reportDao.findAdmin());
}else{
reportNotice.setTitle("请处理-“"+reportEntity.getSupplementTitle()+"”");
reportNotice.setSendToId(reportEntity.getExchangeAfterUser());
}
reportNotice.setCreateDate(date);
reportNotice.setUpdateDate(date);
String sendTime = sdf.format(date);
reportNotice.setSendTime(sendTime);
reportNotice.setSendFromId(user.getId());
reportNotice.setStatus("0");
reportNotice.setCreateBy(user.getId());
reportNotice.setUpdateBy(user.getId());
reportDao.addReportNotice(reportNotice);
}
}
/**
* 新增移交记录
* @param reportEntity
* @return * @return
*/ */
// @Transactional(readOnly = false) @Transactional(readOnly = false)
// public int addNotice(String reportId,String supplementTitle){ public void addRecord(ReportEntity reportEntity,String exchangeType){
// ReportExchangeHistory reportExchangeHistory = new ReportExchangeHistory();
// if () reportExchangeHistory.setId(IdGen.uuid());
// return reportDao.modifyExchangeAfterUser(userId,id); reportExchangeHistory.setOldUserId(reportEntity.getExchangeBeforeUser());
// } reportExchangeHistory.setNewUserId(reportEntity.getExchangeAfterUser());
reportExchangeHistory.setExchangeType(exchangeType);
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
reportExchangeHistory.setExchangeTime(sdf.format(date));
reportDao.addRecord(reportExchangeHistory);
}
} }
...@@ -185,6 +185,13 @@ public class ReportController extends BaseController { ...@@ -185,6 +185,13 @@ public class ReportController extends BaseController {
return form(reportEntity, model); return form(reportEntity, model);
} }
reportService.saveTrack(reportEntity); reportService.saveTrack(reportEntity);
if (StringUtils.isNotBlank(reportEntity.getExchangeAfterUser())){
reportService.addNotice(reportEntity,"transger");
reportService.addRecord(reportEntity,"1");
}
if (StringUtils.isNotBlank(reportEntity.getDealResult())){
reportService.addNotice(reportEntity,"answer");
}
addMessage(redirectAttributes, "补充举报"+ reportEntity.getSupplementTitle() + "'成功"); addMessage(redirectAttributes, "补充举报"+ reportEntity.getSupplementTitle() + "'成功");
return "redirect:" + adminPath + "/report/list/?repage&flag=0"; return "redirect:" + adminPath + "/report/list/?repage&flag=0";
} }
...@@ -244,7 +251,6 @@ public class ReportController extends BaseController { ...@@ -244,7 +251,6 @@ public class ReportController extends BaseController {
response.setContentType("application/json;charset=utf-8"); response.setContentType("application/json;charset=utf-8");
out.write(html.toString()); out.write(html.toString());
out.close(); out.close();
} }
} }
...@@ -277,6 +277,85 @@ ...@@ -277,6 +277,85 @@
FROM sys_position FROM sys_position
</select> </select>
<insert id="addReportNotice">
INSERT INTO report_notice(
id,
report_id,
title,
send_time,
send_from_id,
send_to_id,
status,
create_by,
create_date,
update_by,
update_date
) VALUES (
#{id},
#{reportId},
#{title},
#{sendTime},
#{sendFromId},
#{sendToId},
#{status},
#{createBy},
#{createDate},
#{updateBy},
#{updateDate}
)
</insert>
<update id="updateReportNotice">
UPDATE report_notice SET
id = #{id},
report_id = #{reportId},
title = #{title},
send_time = #{sendTime},
send_from_id = #{sendFromId},
send_to_id = #{sendToId},
status = #{status},
create_by = #{createBy},
create_date = #{createDate},
update_by = #{updateBy},
update_date = #{updateDate}
WHERE report_id = #{reportId}
</update>
<select id="findReportNotice" resultType="ReportNotice">
SELECT
*
FROM report_notice
WHERE report_id = #{reportId}
AND send_from_id = #{userId}
</select>
<select id="findAdmin" resultType="String">
SELECT
su.id
FROM
sys_user su
LEFT JOIN sys_user2role sur ON su.id = sur.user_id
LEFT JOIN sys_role sr ON sr.id = sur.role_id
WHERE
sr.`name` = '系统管理员'
</select>
<insert id="addRecord">
INSERT INTO report_exchange_history(
id,
old_user_id,
new_user_id,
exchange_type,
exchange_time
) VALUES (
#{id},
#{oldUserId},
#{newUserId},
#{exchangeType},
#{exchangeTime}
)
</insert>
<select id="getReportStatus" parameterType="com.ejweb.modules.workbench.Bean.WorkbenchBean" resultType="java.util.HashMap"> <select id="getReportStatus" parameterType="com.ejweb.modules.workbench.Bean.WorkbenchBean" resultType="java.util.HashMap">
select report_status,COUNT(report_status) select report_status,COUNT(report_status)
FROM report FROM report
......
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
<div class="control-group"> <div class="control-group">
<label class="control-label">移交:</label> <label class="control-label">移交:</label>
<div class="controls"> <div class="controls">
<form:hidden id="userId" path="exchangeAfterUser"/> <form:hidden id="userId" path="exchangeAfterUser" value=""/>
<input id="chooseUser" type="text" value="选择移交人员" htmlEscape="false" maxlength="200" class="input-xlarge"/> <input id="chooseUser" type="text" value="选择移交人员" htmlEscape="false" maxlength="200" class="input-xlarge"/>
</div> </div>
</div> </div>
......
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