Commit d35de3f9 by Java-李昕颖

工作转交 及 导出Excel修改

parent 9f1cd6bc
......@@ -89,10 +89,10 @@ public interface ReportDao extends CrudDao<ReportEntity> {
/**
* 根据reportId查询消息表中是否已存在该条记录
* @param reportId
* @param reportEntity
* @return
*/
public ReportNotice findReportNotice(String reportId,String userId);
public ReportNotice findReportNotice(ReportEntity reportEntity);
/**
* 新增消息
......@@ -145,4 +145,18 @@ public interface ReportDao extends CrudDao<ReportEntity> {
* 举报列表
*/
public List<ReportEntity> getRepList(WorkbenchBean benchBean) throws Exception;
/**
* 工作转交 查询举报记录
* @param reportEntity
* @return
*/
public List<ReportEntity> getChooseReportList(ReportEntity reportEntity);
/**
* 工作转交 更改转交人
* @param reportEntity
* @return
*/
public int updateExchangeUser(ReportEntity reportEntity);
}
......@@ -35,7 +35,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
private String dealResult; //处理结论 1 投诉 2 举报无效 3 举报属实
private String exchangeBeforeUser; //移交/转交前用户
private String exchangeAfterUser; //移交/转交后用户(只记录最新的移交用户,此处不记录历史)
private String exchangeType; //举报改变类型 1移交 2转交
private String reportTimeFrom; //举报时间起
private String reportTimeTo; //举报时间止
......@@ -222,6 +222,14 @@ public class ReportEntity extends DataEntity<ReportEntity> {
this.exchangeAfterUser = exchangeAfterUser;
}
public String getExchangeType() {
return exchangeType;
}
public void setExchangeType(String exchangeType) {
this.exchangeType = exchangeType;
}
public String getReportTimeFrom() {
return reportTimeFrom;
}
......
......@@ -2,6 +2,7 @@ package com.ejweb.modules.report.entity;
public class ReportExchangeHistory {
private String id;
private String reportId;
private String oldUserId;
private String newUserId;
private String exchangeType;
......@@ -15,6 +16,14 @@ public class ReportExchangeHistory {
this.id = id;
}
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId;
}
public String getOldUserId() {
return oldUserId;
}
......
......@@ -107,6 +107,9 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
reportEntity.preUpdate();
User user = UserUtils.getUser();
reportEntity.setDealPersonName(user.getName());
if (StringUtils.isNotBlank(reportEntity.getExchangeAfterUser())){
reportEntity.setExchangeType("1");
}
dao.addTrack(reportEntity);
if (StringUtils.isNotBlank(reportEntity.getSupplementAttachment())) {
......@@ -226,9 +229,9 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
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());
ReportNotice reportNotice = reportDao.findReportNotice(reportEntity);
if (reportNotice != null){
//消息表中已存在该条举报的移交信息
//消息表中已存在该条举报的移交信息,更新该记录
if (StringUtils.isNotBlank(user.getId())){
reportNotice.setUpdateBy(user.getId());
}
......@@ -240,14 +243,18 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
reportNotice.setStatus("0");
reportDao.updateReportNotice(reportNotice);
}else{
//消息表中不存在该条举报的信息,新增记录
reportNotice = new ReportNotice();
reportNotice.setId(IdGen.uuid());
reportNotice.setReportId(reportEntity.getId());
if (flag.equals("answer")){
//一般用户处理完成,消息标题为“已由xxx完成”
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");
String dateStr = sdf1.format(date);
reportNotice.setTitle("“"+reportEntity.getSupplementTitle()+"”已由"+user.getName()+"于"+dateStr+"处理完成");
reportNotice.setSendToId(reportDao.findAdmin());
}else{
//管理员转交或移交,消息标题为“请处理xxx”
reportNotice.setTitle("请处理-“"+reportEntity.getSupplementTitle()+"”");
reportNotice.setSendToId(reportEntity.getExchangeAfterUser());
}
......@@ -264,7 +271,7 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
}
/**
* 新增移交记录
* 新增移交/转交记录
* @param reportEntity
* @return
*/
......@@ -272,6 +279,7 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
public void addRecord(ReportEntity reportEntity,String exchangeType){
ReportExchangeHistory reportExchangeHistory = new ReportExchangeHistory();
reportExchangeHistory.setId(IdGen.uuid());
reportExchangeHistory.setReportId(reportEntity.getId());
reportExchangeHistory.setOldUserId(reportEntity.getExchangeBeforeUser());
reportExchangeHistory.setNewUserId(reportEntity.getExchangeAfterUser());
reportExchangeHistory.setExchangeType(exchangeType);
......@@ -290,38 +298,48 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
List<ReportEntity> reportList = dao.findList(reportEntity);
for (ReportEntity report : reportList) {
String supplementType = report.getSupplementType();
if (supplementType.equals("1")){
if (StringUtils.isNotBlank(supplementType)) {
if (supplementType.equals("1")) {
supplementType = "营销";
}else if (supplementType.equals("2")){
} else if (supplementType.equals("2")) {
supplementType = "工程";
}else if (supplementType.equals("3")){
} else if (supplementType.equals("3")) {
supplementType = "成本";
}else if (supplementType.equals("4")){
} else if (supplementType.equals("4")) {
supplementType = "招采";
}else if (supplementType.equals("5")){
} else if (supplementType.equals("5")) {
supplementType = "人力";
}else if (supplementType.equals("6")){
} else if (supplementType.equals("6")) {
supplementType = "物业";
}else if (supplementType.equals("7")){
} else if (supplementType.equals("7")) {
supplementType = "投诉";
}
}else{
supplementType = "";
}
report.setSupplementType(supplementType);
String reportStatus = report.getReportStatus();
if (reportStatus.equals("0")){
if (StringUtils.isNotBlank(reportStatus)) {
if (reportStatus.equals("0")) {
reportStatus = "未处理";
}else if (reportStatus.equals("1")){
} else if (reportStatus.equals("1")) {
reportStatus = "处理中";
}else if (reportStatus.equals("2")){
} else if (reportStatus.equals("2")) {
reportStatus = "已处理";
}
}else{
reportStatus = "";
}
report.setReportStatus(reportStatus);
String dealResult = report.getDealResult();
if (dealResult.equals("1")){
if (StringUtils.isNotBlank(dealResult)) {
if (dealResult.equals("1")) {
dealResult = "投诉";
}else if (dealResult.equals("2")){
} else if (dealResult.equals("2")) {
dealResult = "举报无效";
}else if (dealResult.equals("3")){
} else if (dealResult.equals("3")) {
dealResult = "举报属实";
}
}else{
dealResult = "--";
}
......@@ -330,4 +348,36 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
}
return reportList;
}
/**
* 查询举报列表
* @param reportEntity
* @return
*/
public Page<ReportEntity> getChooseReportPage(Page<ReportEntity> page,ReportEntity reportEntity){
reportEntity.setPage(page);
page.setList(reportDao.getChooseReportList(reportEntity));
return page;
}
/**
* 查询举报列表
* @param reportIds
* @param userId
* @return
*/
@Transactional(readOnly = false)
public void deliverReport(String[] reportIds, String userId) {
User user = UserUtils.getUser();
for (String reportId : reportIds){
ReportEntity reportEntity = dao.get(reportId);
reportEntity.setExchangeAfterUser(userId);
reportEntity.setExchangeType("2");
reportEntity.setUpdateBy(user);
reportEntity.setUpdateDate(new Date());
reportDao.updateExchangeUser(reportEntity);
this.addNotice(reportEntity,"deliver");
this.addRecord(reportEntity,"2");
}
}
}
......@@ -208,12 +208,13 @@ public class ReportController extends BaseController {
* @return
*/
@RequestMapping(value = "viewTransfer")
public void viewTransfer(User user,HttpServletRequest request, HttpServletResponse response, Model model) throws IOException {
public void viewTransfer(User user,String flag,HttpServletRequest request, HttpServletResponse response, Model model) throws IOException {
Page<User> page = reportService.findUserPage(new Page<User>(request, response), user);
StringBuffer html = new StringBuffer();
html.append("<table id='contentTable' class='table table-striped table-bordered table-condensed'>");
html.append(" <thead>");
html.append(" <tr>");
if (flag.equals("1")) {//移交
html.append(" <th>选择</th>");
html.append(" <th>ID</th>");
html.append(" <th>员工号</th>");
......@@ -222,6 +223,15 @@ public class ReportController extends BaseController {
html.append(" <th>所属公司</th>");
html.append(" <th>所属部门</th>");
html.append(" <th>职位</th>");
}else if (flag.equals("2")){//转交
html.append(" <th>选择</th>");
html.append(" <th>ID</th>");
html.append(" <th>用户名</th>");
html.append(" <th>姓名</th>");
html.append(" <th>组织</th>");
html.append(" <th>手机号码</th>");
html.append(" <th>角色</th>");
}
html.append(" </tr>");
html.append(" </thead>");
html.append(" <tbody>");
......@@ -229,14 +239,24 @@ public class ReportController extends BaseController {
int i = 1;
for (User userEntity : page.getList()){
html.append(" <tr>");
html.append(" <td><input type='radio' value='"+userEntity.getId()+"' onclick='chooseRen(this);'></td>");
html.append(" <td>"+i+"</td>");
html.append(" <td>"+(userEntity.getNo()==null?"":userEntity.getNo())+"</td>");
html.append(" <td>"+(userEntity.getName()==null?"":userEntity.getName())+"</td>");
html.append(" <td>"+(userEntity.getMobile()==null?"":userEntity.getMobile())+"</td>");
html.append(" <td>"+(userEntity.getCompany()==null?"":userEntity.getCompany().getName())+ "</td>");
html.append(" <td>"+(userEntity.getOffice()==null?"":userEntity.getOffice().getName())+ "</td>");
html.append(" <td>"+(userEntity.getPositionName()==null?"":userEntity.getPositionName())+"</td>");
if (flag.equals("1")) {
html.append(" <td><input type='radio' value='" + userEntity.getId() + "' onclick='chooseRen(this);'></td>");
html.append(" <td>" + i + "</td>");
html.append(" <td>" + (userEntity.getNo() == null ? "" : userEntity.getNo()) + "</td>");
html.append(" <td>" + (userEntity.getName() == null ? "" : userEntity.getName()) + "</td>");
html.append(" <td>" + (userEntity.getMobile() == null ? "" : userEntity.getMobile()) + "</td>");
html.append(" <td>" + (userEntity.getCompany() == null ? "" : userEntity.getCompany().getName()) + "</td>");
html.append(" <td>" + (userEntity.getOffice() == null ? "" : userEntity.getOffice().getName()) + "</td>");
html.append(" <td>" + (userEntity.getPositionName() == null ? "" : userEntity.getPositionName()) + "</td>");
}else if (flag.equals("2")){
html.append(" <td><input type='radio' value='" + userEntity.getId() + "' onclick='chooseRen(this);'></td>");
html.append(" <td>" + i + "</td>");
html.append(" <td>" + (userEntity.getLoginName() == null ? "" : userEntity.getLoginName()) + "</td>");
html.append(" <td>" + (userEntity.getName() == null ? "" : userEntity.getName()) + "</td>");
html.append(" <td></td>");
html.append(" <td>" + (userEntity.getMobile() == null ? "" : userEntity.getMobile()) + "</td>");
html.append(" <td>" + (userEntity.getRole().getName() == null ? "" : userEntity.getRole().getName()) + "</td>");
}
html.append(" </tr>");
i++;
}
......@@ -257,7 +277,7 @@ public class ReportController extends BaseController {
}
@RequestMapping(value = "export", method = RequestMethod.POST)
public String exportParticipantList(ReportEntity reportEntity,String flag, HttpServletRequest request,HttpServletResponse response, RedirectAttributes redirectAttributes) {
public String export(ReportEntity reportEntity,String flag, HttpServletRequest request,HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
String fileName = "举报列表" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
List<ReportEntity> reportList = reportService.getReportList(reportEntity);
......@@ -268,4 +288,52 @@ public class ReportController extends BaseController {
}
return "redirect:" + adminPath + "/report/list/?repage&flag="+flag;
}
/**
* 转交列表
*
* @param reportEntity
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "deliverList")
public String deliverList(ReportEntity reportEntity, HttpServletRequest request, HttpServletResponse response, Model model) {
//判断登录人的角色
User user = UserUtils.getUser();
String roleName = reportService.findRole(user);
if (StringUtils.isNotBlank(roleName)){
if (!roleName.equals("系统管理员")){
reportEntity.setExchangeAfterUser(user.getId());
}
}
Page<ReportEntity> page = reportService.getChooseReportPage(new Page<ReportEntity>(request, response), reportEntity);
User userEntity = new User();
Page<User> userPage = reportService.findUserPage(new Page<User>(request, response), userEntity);
model.addAttribute("page", page);
model.addAttribute("userPage", userPage);
model.addAttribute("user", userEntity);
model.addAttribute("report", reportEntity);
return "modules/report/reportDeliver";
}
/**
* 转交操作
*
* @param reportIds
* @param userId
* @param request
* @param response
* @return
*/
@RequestMapping(value = "deliver")
public void deliver(String[] reportIds,String userId, HttpServletRequest request, HttpServletResponse response) throws IOException {
reportService.deliverReport(reportIds,userId);
String result = "1";
PrintWriter out = response.getWriter();
response.setContentType("application/json;charset=utf-8");
out.write(result);
out.close();
}
}
......@@ -25,6 +25,7 @@
r.deal_result AS "dealResult",
r.exchange_before_user AS "exchangeBeforeUser",
r.exchange_after_user AS "exchangeAfterUser",
r.exchange_type AS "exchangeType",
r.create_by AS "createBy",
r.create_date AS "createDate",
r.update_by AS "updateBy",
......@@ -141,6 +142,7 @@
report_status,
exchange_before_user,
exchange_after_user,
exchange_type,
create_by,
create_date,
update_by,
......@@ -158,6 +160,7 @@
#{reportStatus},
#{exchangeBeforeUser},
#{exchangeAfterUser},
#{exchangeType},
#{createBy.id},
#{createDate},
#{updateBy.id},
......@@ -195,6 +198,7 @@
supplement_content = #{supplementContent},
deal_person_name = #{dealPersonName},
exchange_after_user = #{exchangeAfterUser},
exchange_type = #{exchangeType},
deal_result = #{dealResult},
update_by = #{updateBy.id},
update_date = #{updateDate}
......@@ -213,15 +217,20 @@
su.id AS "id",
su.`no` AS "no",
su.`name` AS "name",
su.login_name AS "loginName",
su.mobile AS "mobile",
so1.`name` AS "company.name",
so2.`name` AS "office.name",
sp.position_name AS "positionName"
FROM sys_user su
sp.position_name AS "positionName",
sr.`name` AS "role.name"
FROM
sys_user su
LEFT JOIN sys_office so1 ON so1.id = su.company_id
LEFT JOIN sys_office so2 ON so2.id = su.office_id
LEFT JOIN sys_user2position sup ON sup.user_id = su.id
LEFT JOIN sys_position sp ON sp.id = sup.position_id
LEFT JOIN sys_user2role sur ON su.id = sur.user_id
LEFT JOIN sys_role sr ON sr.id = sur.role_id
<where>
1 = 1
<if test="no != null and no != ''">
......@@ -251,6 +260,12 @@
<if test="positionName != null and positionName != ''">
AND sp.position_name = #{positionName}
</if>
<if test="loginName != null and loginName != ''">
AND su.login_name LIKE
<if test="dbName == 'oracle'">'%'||#{loginName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{loginName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{loginName}, '%')</if>
</if>
</where>
ORDER BY su.update_date DESC
</select>
......@@ -321,12 +336,11 @@
WHERE report_id = #{reportId}
</update>
<select id="findReportNotice" resultType="ReportNotice">
SELECT
*
FROM report_notice
WHERE report_id = #{reportId}
AND send_from_id = #{userId}
<select id="findReportNotice" resultType="com.ejweb.modules.workbench.entity.ReportNotice">
SELECT * FROM report_notice rn
LEFT JOIN report r ON rn.report_id = r.id
WHERE rn.report_id = #{id}
AND r.exchange_type = #{exchangeType}
</select>
<select id="findAdmin" resultType="String">
......@@ -343,12 +357,14 @@
<insert id="addRecord">
INSERT INTO report_exchange_history(
id,
report_id,
old_user_id,
new_user_id,
exchange_type,
exchange_time
) VALUES (
#{id},
#{reportId},
#{oldUserId},
#{newUserId},
#{exchangeType},
......@@ -444,6 +460,7 @@
r.deal_result AS "dealResult",
r.exchange_before_user AS "exchangeBeforeUser",
r.exchange_after_user AS "exchangeAfterUser",
r.exchange_type AS "exchangeType",
r.create_by AS "createBy",
r.create_date AS "createDate",
r.update_by AS "updateBy",
......@@ -460,4 +477,44 @@
limit 0,10
</select>
<select id="getChooseReportList" parameterType="ReportEntity" resultType="ReportEntity">
SELECT
r.id AS "id",
r.report_project AS "reportProject",
r.report_time AS "reportTime",
r.report_person_name AS "reportPersonName",
r.report_person_tel AS "reportPersonTel",
r.report_status AS "reportStatus",
r.supplement_title AS "supplementTitle",
r.supplement_type AS "supplementType",
r.deal_person_name AS "dealPersonName",
r.deal_result AS "dealResult",
(CASE WHEN r.exchange_type='2' THEN (SELECT `name` FROM sys_user WHERE id=r.exchange_after_user) ELSE '--' END) AS "exchangeAfterUser",
r.exchange_type AS "exchangeType"
FROM report r
<where>
1 = 1
<if test="exchangeAfterUser != null and exchangeAfterUser != ''">
AND r.exchange_after_user = #{exchangeAfterUser}
</if>
<if test="dealPersonName != null and dealPersonName != ''">
AND r.deal_person_name LIKE
<if test="dbName == 'oracle'">'%'||#{dealPersonName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{dealPersonName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{dealPersonName}, '%')</if>
</if>
</where>
ORDER BY r.update_date DESC
</select>
<update id="updateExchangeUser">
UPDATE report SET
exchange_after_user = #{exchangeAfterUser},
exchange_type = #{exchangeType},
update_by = #{updateBy.id},
update_date = #{updateDate}
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
......@@ -9,8 +9,7 @@
$("#btnExport").click(function(){
top.$.jBox.confirm("确认要导出数据吗?","系统提示",function(v,h,f){
if(v=="ok"){
var flag = $("#flag").val();
$("#searchForm").attr("action","${ctx}/report/export?flag="+flag);
$("#searchForm").attr("action","${ctx}/report/export?");
$("#searchForm").submit();
}
},{buttonsFocus:1});
......
......@@ -42,14 +42,14 @@
//关闭隐藏层
$("#btnClose").click(function () {
$("#chooseDiv").hide();
$("#fade").show();
$("#fade").hide();
});
//选中用户并关闭
$("#btnConfirm").click(function () {
$("#chooseUser").val($("input:radio:checked").parent().next().next().next().html());
$("#userId").val($("input:radio:checked").val());
$("#chooseDiv").hide();
$("#fade").show();
$("#fade").hide();
});
});
......@@ -216,7 +216,7 @@
$(document).ready(function() {
$("#btnSearch").click(function () {
$.ajax({
url: "${ctx}/report/viewTransfer",
url: "${ctx}/report/viewTransfer?flag=1",
dataType: "html",
data: $('#searchForm').serialize(),
cache: false,
......@@ -251,7 +251,7 @@
function page(n,s){
$("#pageNo").val(n);
$("#pageSize").val(s);
$("#searchForm").attr("action", "${ctx}/report/viewTransfer");
$("#searchForm").attr("action", "${ctx}/report/viewTransfer?flag=1");
$("#searchForm").submit();
return false;
}
......
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