20191203

parent 4ffe7d12
......@@ -2,12 +2,16 @@ package com.ejweb.modules.report.web;
import com.ejweb.conf.GConstants;
import com.ejweb.core.utils.StringUtils;
import com.ejweb.modules.report.entity.CtBbtcBusCategory;
import com.ejweb.modules.report.entity.CtBbtcBusType;
import com.ejweb.modules.report.entity.ReportAttachmentEntity;
import com.ejweb.modules.report.entity.ReportEntity;
import com.ejweb.modules.report.service.CtBbtcBusCategoryService;
import com.ejweb.modules.report.service.CtBbtcBusTypeService;
import com.ejweb.modules.report.service.ReportService;
import com.ejweb.modules.sys.entity.Dict;
import com.ejweb.modules.sys.entity.User;
import com.ejweb.modules.sys.service.DictService;
import com.ejweb.modules.sys.utils.UserUtils;
import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
import org.apache.poi.xwpf.usermodel.*;
......@@ -43,6 +47,9 @@ public class ReportToWordController {
@Autowired
protected CtBbtcBusTypeService CtBbtcBusTypeService;
@Autowired
protected CtBbtcBusCategoryService ctBbtcBusCategoryService;
@ModelAttribute
public ReportEntity get(@RequestParam(required = false) String id) {
if (StringUtils.isNotBlank(id)) {
......@@ -112,21 +119,39 @@ public class ReportToWordController {
XWPFTableRow supplementInformant = basicInfoTable.createRow();
supplementInformant.getCell(0).setText("被举报人:");
supplementInformant.getCell(1).setText(reportEntity.getSupplementInformant() == null ? "" : reportEntity.getSupplementInformant());
//表格第三行
XWPFTableRow reportCity = basicInfoTable.createRow();
reportCity.getCell(0).setText("所在城市:");
reportCity.getCell(1).setText(reportEntity.getReportCity() == null ? "" : reportEntity.getReportCity());
//表格第四行
//表格第三行 参与人
XWPFTableRow participant = basicInfoTable.createRow();
participant.getCell(0).setText("参与人:");
participant.getCell(1).setText(reportEntity.getParticipants() == null ? "" : reportEntity.getParticipants());
//表格第四行 知情人
XWPFTableRow insider = basicInfoTable.createRow();
insider.getCell(0).setText("知情人:");
insider.getCell(1).setText(reportEntity.getInsider() == null ? "" : reportEntity.getInsider());
//表格第五行 发生时间
XWPFTableRow reportDate = basicInfoTable.createRow();
reportDate.getCell(0).setText("发生时间:");
reportDate.getCell(1).setText(reportEntity.getReportDate() == null ? "" : reportEntity.getReportDate());
//表格第六行 地点
XWPFTableRow site = basicInfoTable.createRow();
site.getCell(0).setText("地点:");
site.getCell(1).setText(reportEntity.getSite() == null ? "" : reportEntity.getSite());
//表格第七行 举报时间
XWPFTableRow reportTime = basicInfoTable.createRow();
reportTime.getCell(0).setText("举报时间:");
reportTime.getCell(1).setText(reportEntity.getReportTime() == null ? "" : reportEntity.getReportTime());
//表格第八行 所在城市
XWPFTableRow reportCity = basicInfoTable.createRow();
reportCity.getCell(0).setText("所在城市:");
reportCity.getCell(1).setText(reportEntity.getReportCity() == null ? "" : reportEntity.getReportCity());
//表格第九行 IP来源
XWPFTableRow reportIp = basicInfoTable.createRow();
reportIp.getCell(0).setText("IP来源:");
reportIp.getCell(1).setText(reportEntity.getReportIp() == null ? "" : reportEntity.getReportIp());
//表格第十行 IP所属城市
XWPFTableRow ipCity = basicInfoTable.createRow();
ipCity.getCell(0).setText("IP所属城市:");
ipCity.getCell(1).setText(reportEntity.getIpCity() == null ? "" : reportEntity.getIpCity());
//是否已发送邮件
String is_send_email = reportEntity.getIsSendEmail();
if (StringUtils.isNotBlank(is_send_email)) {
if (is_send_email.equals("1")) {
......@@ -138,11 +163,14 @@ public class ReportToWordController {
XWPFTableRow isSendEmail = basicInfoTable.createRow();
isSendEmail.getCell(0).setText("是否已发送邮件:");
isSendEmail.getCell(1).setText(is_send_email);
//表格第五行
//内容
XWPFTableRow reportContent = basicInfoTable.createRow();
reportContent.getCell(0).setText("内容:");
reportContent.getCell(1).setText(reportEntity.getReportContent() == null ? "" : reportEntity.getReportContent());
//调查建议
XWPFTableRow suggestion = basicInfoTable.createRow();
suggestion.getCell(0).setText("调查建议:");
suggestion.getCell(1).setText(reportEntity.getSuggestion() == null ? "" : reportEntity.getSuggestion());
//表格 附件
//获取附件列表
......@@ -193,49 +221,45 @@ public class ReportToWordController {
//表格第一行
XWPFTableRow reportPersonName = peopleInfoTable.getRow(0);
reportPersonName.getCell(0).setText("姓名:");
User user = UserUtils.getUser();
String isAdmin = reportService.checkRole(user);
/*如果移交后是本人 且不显示数据 则设置“”*/
if(! isAdmin.equals("1") && ! isAdmin.equals("2")){
if(user.getId().equals(reportEntity.getExchangeAfterUser()) && "2".equals(reportEntity.getIfClue())){
reportPersonName.addNewTableCell().setText( "");
}else{
reportPersonName.addNewTableCell().setText(reportEntity.getReportPersonName() == null ? "" : reportEntity.getReportPersonName());
}
}else{
//系统 辅助 管理都能看见
reportPersonName.addNewTableCell().setText(reportEntity.getReportPersonName() == null ? "" : reportEntity.getReportPersonName());
}
//表格第二行
XWPFTableRow reportPersonTel = peopleInfoTable.createRow();
reportPersonTel.getCell(0).setText("手机号:");
if(! isAdmin.equals("1") && ! isAdmin.equals("2")){
if(user.getId().equals(reportEntity.getExchangeAfterUser()) && "2".equals(reportEntity.getIfClue())){
reportPersonTel.getCell(1).setText("");
}else{
reportPersonTel.getCell(1).setText(reportEntity.getReportPersonTel() == null ? "" : reportEntity.getReportPersonTel());
}
}else {
//系统 辅助管理
reportPersonTel.getCell(1).setText(reportEntity.getReportPersonTel() == null ? "" : reportEntity.getReportPersonTel());
}
//表格第三行
XWPFTableRow reportPersonEmail = peopleInfoTable.createRow();
reportPersonEmail.getCell(0).setText("Email:");
if(! isAdmin.equals("1") && ! isAdmin.equals("2")){
if(user.getId().equals(reportEntity.getExchangeAfterUser()) && "2".equals(reportEntity.getIfClue())){
reportPersonEmail.getCell(1).setText("");
}else{
reportPersonEmail.getCell(1).setText(reportEntity.getReportPersonEmail() == null ? "" : reportEntity.getReportPersonEmail());
}
}else {
//辅助 系统管理员
//表格第四行
XWPFTableRow qq = peopleInfoTable.createRow();
qq.getCell(0).setText("QQ号:");
//表格第五行
XWPFTableRow weixin = peopleInfoTable.createRow();
weixin.getCell(0).setText("微信号:");
User user = UserUtils.getUser();
String isAdmin = reportService.checkRole(user);
/*如果移交后是本人 且不显示数据 则设置“”*/
if(! isAdmin.equals("1") && ! isAdmin.equals("2")){
if(user.getId().equals(reportEntity.getExchangeAfterUser()) && "2".equals(reportEntity.getIfClue())){
reportPersonName.addNewTableCell().setText("");
reportPersonTel.getCell(1).setText("");
reportPersonEmail.getCell(1).setText("");
qq.getCell(1).setText("");
weixin.getCell(1).setText("");
}else{
reportPersonName.addNewTableCell().setText(reportEntity.getReportPersonName() == null ? "" : reportEntity.getReportPersonName());
reportPersonTel.getCell(1).setText(reportEntity.getReportPersonTel() == null ? "" : reportEntity.getReportPersonTel());
reportPersonEmail.getCell(1).setText(reportEntity.getReportPersonEmail() == null ? "" : reportEntity.getReportPersonEmail());
qq.getCell(1).setText(reportEntity.getQq() == null ? "" : reportEntity.getQq());
weixin.getCell(1).setText(reportEntity.getWeixin() == null ? "" : reportEntity.getWeixin());
}
}else{
//系统 辅助 管理都能看见
reportPersonName.addNewTableCell().setText(reportEntity.getReportPersonName() == null ? "" : reportEntity.getReportPersonName());
reportPersonTel.getCell(1).setText(reportEntity.getReportPersonTel() == null ? "" : reportEntity.getReportPersonTel());
reportPersonEmail.getCell(1).setText(reportEntity.getReportPersonEmail() == null ? "" : reportEntity.getReportPersonEmail());
qq.getCell(1).setText(reportEntity.getQq() == null ? "" : reportEntity.getQq());
weixin.getCell(1).setText(reportEntity.getWeixin() == null ? "" : reportEntity.getWeixin());
}
//表格第四行
......@@ -296,52 +320,23 @@ public class ReportToWordController {
supplementInfoTableWidth.setW(BigInteger.valueOf(9072));
//表格第一行
//表格第四行
XWPFTableRow supplementGroup = supplementInfoTable.createRow();
supplementGroup.getCell(0).setText("所属集团:");
String supplementName = reportEntity.getSupplementGroup();
supplementGroup.addNewTableCell().setText(supplementName == null ? "" : supplementName);
//表格第二行
XWPFTableRow supplementArea = supplementInfoTable.createRow();
supplementArea.getCell(0).setText("被举报区域:");
String supplement_area = reportEntity.getSupplementArea();
supplementArea.addNewTableCell().setText(supplement_area == null ? "" : supplement_area);
//表格第三行
XWPFTableRow supplementType = supplementInfoTable.createRow();
supplementType.getCell(0).setText("业务类型:");
String supplement_type = reportEntity.getSupplementType();
if (StringUtils.isNotBlank(supplement_type)) {
String[] types = supplement_type.split(",");
String typeStr = "";
/* for (String value : types) {
if (value.equals("1")) {
value = "营销";
} else if (value.equals("2")) {
value = "工程";
} else if (value.equals("3")) {
value = "成本";
} else if (value.equals("4")) {
value = "招采";
} else if (value.equals("5")) {
value = "财务";
} else if (value.equals("6")) {
value = "法务";
} else if (value.equals("7")) {
value = "行政";
} else if (value.equals("8")) {
value = "人力";
} else if (value.equals("9")) {
value = "开发";
} else if (value.equals("10")) {
value = "研发";
} else if (value.equals("11")) {
value = "投资";
} else if (value.equals("12")) {
value = "其他";
} else if (value.equals("13")) {
value = "物业管理";
} else if (value.equals("14")) {
value = "文旅管理";
} else if (value.equals("15")) {
value = "商业";
}
typeStr = typeStr + value + ",";
supplement_type = typeStr.substring(0, typeStr.length() - 1);
}*/
for (String str:types) {
CtBbtcBusType ctBbtcBusType = CtBbtcBusTypeService.get(str);
if(ctBbtcBusType!=null){
......@@ -357,35 +352,29 @@ public class ReportToWordController {
}
supplementType.addNewTableCell().setText(supplement_type);
//表格第五行
XWPFTableRow supplementArea = supplementInfoTable.createRow();
supplementArea.getCell(0).setText("被举报区域:");
String supplement_area = reportEntity.getSupplementArea();
XWPFTableRow supplementCategory = supplementInfoTable.createRow();
supplementCategory.getCell(0).setText("业务类别:");
String category = reportEntity.getSupplementCategory();
if (StringUtils.isNotBlank(category)) {
String[] types = category.split(",");
String typeStr = "";
for (String str:types) {
CtBbtcBusCategory ctBbtcBusCategory = ctBbtcBusCategoryService.get(str);
if(ctBbtcBusCategory!=null){
typeStr = typeStr + ctBbtcBusCategory.getName() + ",";
}else{
typeStr = typeStr + "--";
}
/* if (StringUtils.isNotBlank(supplement_area)) {
if (supplement_area.equals("North China")) {
supplement_area = "华北区域公司";
} else if (supplement_area.equals("BeiJing")) {
supplement_area = "北京区域公司";
} else if (supplement_area.equals("ShangHai")) {
supplement_area = "上海区域公司";
} else if (supplement_area.equals("SouthWest")) {
supplement_area = "西南区域公司";
} else if (supplement_area.equals("SouthEast")) {
supplement_area = "东南区域公司";
} else if (supplement_area.equals("Central China")) {
supplement_area = "华中区域公司";
} else if (supplement_area.equals("GuangShen")) {
supplement_area = "广深区域公司";
} else if (supplement_area.equals("Hainan")) {
supplement_area = "海南区域公司";
} else if (supplement_area.equals("Group")) {
supplement_area = "集团本部";
}
category = typeStr.substring(0, typeStr.length() - 1);
} else {
supplement_area = "";
}*/
category = "";
}
supplementCategory.addNewTableCell().setText(category == null ? "" : category);
supplementArea.addNewTableCell().setText(supplement_area);
//表格第六行
XWPFTableRow supplementContent = supplementInfoTable.createRow();
supplementContent.getCell(0).setText("内容:");
......
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