Commit d7ae9433 by sunxin

2019-10-24

parent 0a414719
...@@ -166,6 +166,18 @@ public class ReportController extends BaseController { ...@@ -166,6 +166,18 @@ public class ReportController extends BaseController {
String exchangeAfterUser = reportdao.selectExchangeAfterUser(report.getExchangeAfterUser()); String exchangeAfterUser = reportdao.selectExchangeAfterUser(report.getExchangeAfterUser());
report.setTransferName(exchangeAfterUser); report.setTransferName(exchangeAfterUser);
if(report.getExchangeAfterUser()!= null){
/*如果设置了不显示 */
if(user.getId().equals(report.getExchangeAfterUser()) && "2".equals(report.getIfClue())){
System.out.printf("隐藏信息=============");
report.setReportPersonName(null);
report.setReportPersonTel(null);
report.setReportPersonEmail(null);
report.setQq(null);
report.setWeixin(null);
}
}
} }
...@@ -346,7 +358,17 @@ public class ReportController extends BaseController { ...@@ -346,7 +358,17 @@ public class ReportController extends BaseController {
} }
report.setSupplementCategory(SupplementCategoryStr.substring(0,SupplementCategoryStr.length()-1)); report.setSupplementCategory(SupplementCategoryStr.substring(0,SupplementCategoryStr.length()-1));
} }
if(report.getExchangeAfterUser()!= null){
/*如果设置了不显示 */
if(user.getId().equals(report.getExchangeAfterUser()) && "2".equals(report.getIfClue())){
System.out.printf("隐藏信息=============");
report.setReportPersonName(null);
report.setReportPersonTel(null);
report.setReportPersonEmail(null);
report.setQq(null);
report.setWeixin(null);
}
}
} }
...@@ -724,6 +746,14 @@ public class ReportController extends BaseController { ...@@ -724,6 +746,14 @@ public class ReportController extends BaseController {
reportEntity.setSupplementCategory(""); reportEntity.setSupplementCategory("");
} }
/*如果处理结果不是移交其他部门,清除原来数据*/
System.out.println(reportEntity.getDealResult());
if(Integer.parseInt(reportEntity.getDealResult())!= 6){
reportEntity.setTransferGroup(null);
reportEntity.setTransferArea(null);
reportEntity.setTransferDepartment(null);
}
//判断登录人的角色 //判断登录人的角色
User user = UserUtils.getUser(); User user = UserUtils.getUser();
String isAdmin = reportService.checkRole(user); String isAdmin = reportService.checkRole(user);
...@@ -911,6 +941,21 @@ public class ReportController extends BaseController { ...@@ -911,6 +941,21 @@ public class ReportController extends BaseController {
reportList = reportService.getReportList(reportEntity); reportList = reportService.getReportList(reportEntity);
} }
for (ReportEntity report002:reportList) {
if(report002.getExchangeAfterUser()!= null){
/*如果设置了不显示 */
if(user.getId().equals(report002.getExchangeAfterUser()) && "2".equals(report002.getIfClue())){
System.out.printf("隐藏信息=============");
report002.setReportPersonName(null);
report002.setReportPersonTel(null);
report002.setReportPersonEmail(null);
report002.setQq(null);
report002.setWeixin(null);
}
}
}
new ExportExcel("举报列表", ReportEntity.class, isAdmin).setDataList(reportList).write(request, response, fileName).dispose(); new ExportExcel("举报列表", ReportEntity.class, isAdmin).setDataList(reportList).write(request, response, fileName).dispose();
return null; return null;
} catch (Exception e) { } catch (Exception e) {
......
...@@ -7,8 +7,10 @@ import com.ejweb.modules.report.entity.ReportAttachmentEntity; ...@@ -7,8 +7,10 @@ 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.CtBbtcBusTypeService; import com.ejweb.modules.report.service.CtBbtcBusTypeService;
import com.ejweb.modules.report.service.ReportService; import com.ejweb.modules.report.service.ReportService;
import org.apache.poi.xwpf.usermodel.*; import com.ejweb.modules.sys.entity.User;
import com.ejweb.modules.sys.utils.UserUtils;
import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy; import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
import org.apache.poi.xwpf.usermodel.*;
import org.apache.xmlbeans.XmlException; import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,7 +22,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes; ...@@ -20,7 +22,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
...@@ -52,7 +53,7 @@ public class ReportToWordController { ...@@ -52,7 +53,7 @@ public class ReportToWordController {
} }
@RequestMapping(value = "toWord") @RequestMapping(value = "toWord")
public void toWord(ReportEntity reportEntity, String flag, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) throws IOException, XmlException { public void toWord(ReportEntity reportEntity, String flag, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
//Blank Document //Blank Document
XWPFDocument document = new XWPFDocument(); XWPFDocument document = new XWPFDocument();
//Write the Document in file system //Write the Document in file system
...@@ -63,6 +64,7 @@ public class ReportToWordController { ...@@ -63,6 +64,7 @@ public class ReportToWordController {
// if (reportProjectTitle.contains("\\")){ // if (reportProjectTitle.contains("\\")){
// reportProjectTitle = reportProjectTitle.replace("\\","|"); // reportProjectTitle = reportProjectTitle.replace("\\","|");
// } // }
try {
FileOutputStream out = new FileOutputStream(GConstants.FILE_UPLOAD_DIR + "pdf/" + reportEntity.getId() + ".docx"); FileOutputStream out = new FileOutputStream(GConstants.FILE_UPLOAD_DIR + "pdf/" + reportEntity.getId() + ".docx");
// FileOutputStream out = new FileOutputStream("D:/1.docx"); // FileOutputStream out = new FileOutputStream("D:/1.docx");
// FileOutputStream out = new FileOutputStream("C:/1.docx"); // FileOutputStream out = new FileOutputStream("C:/1.docx");
...@@ -191,15 +193,32 @@ public class ReportToWordController { ...@@ -191,15 +193,32 @@ public class ReportToWordController {
//表格第一行 //表格第一行
XWPFTableRow reportPersonName = peopleInfoTable.getRow(0); XWPFTableRow reportPersonName = peopleInfoTable.getRow(0);
reportPersonName.getCell(0).setText("姓名:"); reportPersonName.getCell(0).setText("姓名:");
reportPersonName.addNewTableCell().setText(reportEntity.getReportPersonName() == null ? "" : reportEntity.getReportPersonName()); User user = UserUtils.getUser();
/*如果移交后是本人 且不显示数据 则设置“”*/
if(user.getId().equals(reportEntity.getExchangeAfterUser()) && "2".equals(reportEntity.getIfClue())){
reportPersonName.addNewTableCell().setText( "");
}else{
reportPersonName.addNewTableCell().setText(reportEntity.getReportPersonName() == null ? "" : reportEntity.getReportPersonName());
}
//表格第二行 //表格第二行
XWPFTableRow reportPersonTel = peopleInfoTable.createRow(); XWPFTableRow reportPersonTel = peopleInfoTable.createRow();
reportPersonTel.getCell(0).setText("手机号:"); reportPersonTel.getCell(0).setText("手机号:");
reportPersonTel.getCell(1).setText(reportEntity.getReportPersonTel() == null ? "" : reportEntity.getReportPersonTel()); if(user.getId().equals(reportEntity.getExchangeAfterUser()) && "2".equals(reportEntity.getIfClue())){
reportPersonTel.getCell(1).setText("");
}else{
reportPersonTel.getCell(1).setText(reportEntity.getReportPersonTel() == null ? "" : reportEntity.getReportPersonTel());
}
//表格第三行 //表格第三行
XWPFTableRow reportPersonEmail = peopleInfoTable.createRow(); XWPFTableRow reportPersonEmail = peopleInfoTable.createRow();
reportPersonEmail.getCell(0).setText("Email:"); reportPersonEmail.getCell(0).setText("Email:");
reportPersonEmail.getCell(1).setText(reportEntity.getReportPersonEmail() == null ? "" : reportEntity.getReportPersonEmail()); if(user.getId().equals(reportEntity.getExchangeAfterUser()) && "2".equals(reportEntity.getIfClue())){
reportPersonEmail.getCell(1).setText("");
}else{
reportPersonEmail.getCell(1).setText(reportEntity.getReportPersonEmail() == null ? "" : reportEntity.getReportPersonEmail());
}
//表格第四行 //表格第四行
XWPFTableRow reportSource = peopleInfoTable.createRow(); XWPFTableRow reportSource = peopleInfoTable.createRow();
reportSource.getCell(0).setText("举报途径:"); reportSource.getCell(0).setText("举报途径:");
...@@ -461,6 +480,9 @@ public class ReportToWordController { ...@@ -461,6 +480,9 @@ public class ReportToWordController {
response.setContentType("application/json;charset=utf-8"); response.setContentType("application/json;charset=utf-8");
printWriter.write(GConstants.FILE_PREFIX_URL + "pdf/" + reportEntity.getId() + ".docx"); printWriter.write(GConstants.FILE_PREFIX_URL + "pdf/" + reportEntity.getId() + ".docx");
printWriter.close(); printWriter.close();
} catch (Exception e) {
e.printStackTrace();
}
} }
......
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