Commit 9f1cd6bc by Java-李昕颖

Excel导出

parent 2ad2f8c6
...@@ -2,6 +2,7 @@ package com.ejweb.modules.report.entity; ...@@ -2,6 +2,7 @@ package com.ejweb.modules.report.entity;
import com.ejweb.core.persistence.DataEntity; import com.ejweb.core.persistence.DataEntity;
import com.ejweb.core.utils.excel.annotation.ExcelField;
import java.util.List; import java.util.List;
...@@ -44,7 +45,7 @@ public class ReportEntity extends DataEntity<ReportEntity> { ...@@ -44,7 +45,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
private String supplementAttachment; //补充提交文件 private String supplementAttachment; //补充提交文件
private String dealAttachment; //处理成果文件 private String dealAttachment; //处理成果文件
@ExcelField(title="被举报项目", align=2, sort=24)
public String getReportProject() { public String getReportProject() {
return reportProject; return reportProject;
} }
...@@ -61,6 +62,7 @@ public class ReportEntity extends DataEntity<ReportEntity> { ...@@ -61,6 +62,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
this.reportCity = reportCity; this.reportCity = reportCity;
} }
@ExcelField(title="举报时间", align=2, sort=30)
public String getReportTime() { public String getReportTime() {
return reportTime; return reportTime;
} }
...@@ -77,6 +79,7 @@ public class ReportEntity extends DataEntity<ReportEntity> { ...@@ -77,6 +79,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
this.reportContent = reportContent; this.reportContent = reportContent;
} }
@ExcelField(title="举报人", align=2, sort=26)
public String getReportPersonName() { public String getReportPersonName() {
return reportPersonName; return reportPersonName;
} }
...@@ -85,6 +88,7 @@ public class ReportEntity extends DataEntity<ReportEntity> { ...@@ -85,6 +88,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
this.reportPersonName = reportPersonName; this.reportPersonName = reportPersonName;
} }
@ExcelField(title="举报人电话", align=2, sort=28)
public String getReportPersonTel() { public String getReportPersonTel() {
return reportPersonTel; return reportPersonTel;
} }
...@@ -109,6 +113,7 @@ public class ReportEntity extends DataEntity<ReportEntity> { ...@@ -109,6 +113,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
this.reportSource = reportSource; this.reportSource = reportSource;
} }
@ExcelField(title="状态", align=2, sort=32)
public String getReportStatus() { public String getReportStatus() {
return reportStatus; return reportStatus;
} }
...@@ -141,6 +146,7 @@ public class ReportEntity extends DataEntity<ReportEntity> { ...@@ -141,6 +146,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
this.supplementInformant = supplementInformant; this.supplementInformant = supplementInformant;
} }
@ExcelField(title="标题", align=2, sort=20)
public String getSupplementTitle() { public String getSupplementTitle() {
return supplementTitle; return supplementTitle;
} }
...@@ -149,6 +155,7 @@ public class ReportEntity extends DataEntity<ReportEntity> { ...@@ -149,6 +155,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
this.supplementTitle = supplementTitle; this.supplementTitle = supplementTitle;
} }
@ExcelField(title="业务类型", align=2, sort=22)
public String getSupplementType() { public String getSupplementType() {
return supplementType; return supplementType;
} }
...@@ -181,6 +188,7 @@ public class ReportEntity extends DataEntity<ReportEntity> { ...@@ -181,6 +188,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
this.supplementContent = supplementContent; this.supplementContent = supplementContent;
} }
@ExcelField(title="处理人", align=2, sort=36)
public String getDealPersonName() { public String getDealPersonName() {
return dealPersonName; return dealPersonName;
} }
...@@ -189,6 +197,7 @@ public class ReportEntity extends DataEntity<ReportEntity> { ...@@ -189,6 +197,7 @@ public class ReportEntity extends DataEntity<ReportEntity> {
this.dealPersonName = dealPersonName; this.dealPersonName = dealPersonName;
} }
@ExcelField(title="处理结论", align=2, sort=34)
public String getDealResult() { public String getDealResult() {
return dealResult; return dealResult;
} }
......
...@@ -280,4 +280,54 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> { ...@@ -280,4 +280,54 @@ public class ReportService extends CrudService<ReportDao, ReportEntity> {
reportExchangeHistory.setExchangeTime(sdf.format(date)); reportExchangeHistory.setExchangeTime(sdf.format(date));
reportDao.addRecord(reportExchangeHistory); reportDao.addRecord(reportExchangeHistory);
} }
/**
* 查询举报列表
* @param reportEntity
* @return
*/
public List<ReportEntity> getReportList(ReportEntity reportEntity){
List<ReportEntity> reportList = dao.findList(reportEntity);
for (ReportEntity report : reportList) {
String supplementType = report.getSupplementType();
if (supplementType.equals("1")){
supplementType = "营销";
}else if (supplementType.equals("2")){
supplementType = "工程";
}else if (supplementType.equals("3")){
supplementType = "成本";
}else if (supplementType.equals("4")){
supplementType = "招采";
}else if (supplementType.equals("5")){
supplementType = "人力";
}else if (supplementType.equals("6")){
supplementType = "物业";
}else if (supplementType.equals("7")){
supplementType = "投诉";
}
report.setSupplementType(supplementType);
String reportStatus = report.getReportStatus();
if (reportStatus.equals("0")){
reportStatus = "未处理";
}else if (reportStatus.equals("1")){
reportStatus = "处理中";
}else if (reportStatus.equals("2")){
reportStatus = "已处理";
}
report.setReportStatus(reportStatus);
String dealResult = report.getDealResult();
if (dealResult.equals("1")){
dealResult = "投诉";
}else if (dealResult.equals("2")){
dealResult = "举报无效";
}else if (dealResult.equals("3")){
dealResult = "举报属实";
}else{
dealResult = "--";
}
report.setDealResult(dealResult);
report.setDealPersonName(report.getDealPersonName() == null?"--":report.getDealPersonName());
}
return reportList;
}
} }
...@@ -3,7 +3,9 @@ package com.ejweb.modules.report.web; ...@@ -3,7 +3,9 @@ package com.ejweb.modules.report.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ejweb.core.base.BaseController; import com.ejweb.core.base.BaseController;
import com.ejweb.core.persistence.Page; import com.ejweb.core.persistence.Page;
import com.ejweb.core.utils.DateUtils;
import com.ejweb.core.utils.StringUtils; import com.ejweb.core.utils.StringUtils;
import com.ejweb.core.utils.excel.ExportExcel;
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.service.ReportService; import com.ejweb.modules.report.service.ReportService;
...@@ -16,6 +18,7 @@ import org.springframework.stereotype.Controller; ...@@ -16,6 +18,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
...@@ -253,4 +256,16 @@ public class ReportController extends BaseController { ...@@ -253,4 +256,16 @@ public class ReportController extends BaseController {
out.close(); out.close();
} }
@RequestMapping(value = "export", method = RequestMethod.POST)
public String exportParticipantList(ReportEntity reportEntity,String flag, HttpServletRequest request,HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
String fileName = "举报列表" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
List<ReportEntity> reportList = reportService.getReportList(reportEntity);
new ExportExcel("举报列表", ReportEntity.class).setDataList(reportList).write(request,response, fileName).dispose();
return null;
} catch (Exception e) {
addMessage(redirectAttributes, "导出用户失败!失败信息:" + e.getMessage());
}
return "redirect:" + adminPath + "/report/list/?repage&flag="+flag;
}
} }
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
$("#btnExport").click(function(){ $("#btnExport").click(function(){
top.$.jBox.confirm("确认要导出数据吗?","系统提示",function(v,h,f){ top.$.jBox.confirm("确认要导出数据吗?","系统提示",function(v,h,f){
if(v=="ok"){ if(v=="ok"){
$("#searchForm").attr("action","${ctx}/cms/report/export"); var flag = $("#flag").val();
$("#searchForm").attr("action","${ctx}/report/export?flag="+flag);
$("#searchForm").submit(); $("#searchForm").submit();
} }
},{buttonsFocus:1}); },{buttonsFocus:1});
......
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