|
@@ -10,9 +10,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.rongwe.scentity.domian.*;
|
|
|
import com.rongwe.scentity.vo.AspSafetyEmergencyDrillPlanVo;
|
|
|
+import com.rongwe.scentity.vo.AspSafetyTeamMemberVo;
|
|
|
+import com.rongwe.scentity.vo.AspSafetyTeamVo;
|
|
|
import com.rongwei.rwadmincommon.system.domain.SysDictDo;
|
|
|
import com.rongwei.rwadmincommon.system.service.SysDictService;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
+import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import com.rongwei.safecommon.utils.CXCommonUtils;
|
|
@@ -21,15 +24,14 @@ import com.rongwei.sfcommon.sys.service.AspSafetyDrillProgrammeMsgNotifyRecordSe
|
|
|
import com.rongwei.sfcommon.sys.service.AspSafetyDrillProgrammeService;
|
|
|
import com.rongwei.sfcommon.sys.service.AspSafetyEmergencyPlanService;
|
|
|
import com.rongwei.sfcommon.utils.AsposeWordsUtils;
|
|
|
-import com.rongwei.sfcommon.utils.CommonUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.awt.*;
|
|
|
-import java.io.File;
|
|
|
-import java.io.FileOutputStream;
|
|
|
+import java.io.IOException;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
import java.util.List;
|
|
@@ -529,6 +531,111 @@ public class AspSafetyDrillProgrammeServiceImpl extends ServiceImpl<AspSafetyDri
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void exportDrillProgramme(String mainId, HttpServletResponse response) throws Exception {
|
|
|
+ boolean wordLicense = AsposeWordsUtils.getWordLicense();
|
|
|
+
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ //查询小组表信息
|
|
|
+ List<AspSafetyTeamVo> list = this.baseMapper.selectTeam();
|
|
|
+ //查询小组对应成员信息
|
|
|
+ for (AspSafetyTeamVo item : list) {
|
|
|
+ String id = item.getID();
|
|
|
+ String teamName = item.getTeamName();
|
|
|
+ String content = item.getContent();
|
|
|
+ List<AspSafetyTeamMemberVo> memberList = this.baseMapper.selectTeamMemberByTeamId(id);
|
|
|
+ item.setMemberList(memberList);
|
|
|
+ if(teamName.equals("演练指挥小组")){
|
|
|
+ for (AspSafetyTeamMemberVo vo : memberList) {
|
|
|
+ String roleName = vo.getRoleName();
|
|
|
+ String name = vo.getName();
|
|
|
+ if(roleName.equals("总指挥")){
|
|
|
+ map.put("item1",name);
|
|
|
+ }
|
|
|
+ if(roleName.equals("副总指挥")){
|
|
|
+ map.put("item2",name);
|
|
|
+ }
|
|
|
+ if(roleName.equals("成员")){
|
|
|
+ map.put("item3",name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(teamName.equals("指挥领导小组")){
|
|
|
+ map.put("item4",content);
|
|
|
+ }
|
|
|
+ if(teamName.equals("总指挥")){
|
|
|
+ map.put("item5",content);
|
|
|
+ }
|
|
|
+ if(teamName.equals("副总指挥")){
|
|
|
+ map.put("item6",content);
|
|
|
+ }
|
|
|
+ List<String> teamNameList = new LinkedList<>();
|
|
|
+ teamNameList.add("抢险技术组");
|
|
|
+ teamNameList.add("抢险抢修组");
|
|
|
+ teamNameList.add("医疗救护组");
|
|
|
+ teamNameList.add("监测洗消组");
|
|
|
+ teamNameList.add("消防救援组");
|
|
|
+ teamNameList.add("后勤物资保障组");
|
|
|
+ teamNameList.add("警戒疏散联络组");
|
|
|
+ teamNameList.add("财力保障组");
|
|
|
+ int index = 7;
|
|
|
+ if(teamNameList.contains(teamName)){
|
|
|
+ int i = teamNameList.indexOf(teamName);
|
|
|
+ int startIndex = index + i*4;
|
|
|
+ for (AspSafetyTeamMemberVo vo : memberList) {
|
|
|
+ String roleName = vo.getRoleName();
|
|
|
+ String name = vo.getName();
|
|
|
+ if(roleName.equals("组长")){
|
|
|
+ map.put("item"+startIndex,name);
|
|
|
+ }
|
|
|
+ if(roleName.equals("副组长")){
|
|
|
+ map.put("item"+(startIndex+1),name);
|
|
|
+ }
|
|
|
+ if(roleName.equals("成员")){
|
|
|
+ map.put("item"+(startIndex+2),name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("item"+(startIndex+3),content);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //主表数据
|
|
|
+ AspSafetyDrillProgrammeDo aspSafetyDrillProgrammeDo = this.baseMapper.selectById(mainId);
|
|
|
+ map.put("PLANNAME",aspSafetyDrillProgrammeDo.getPlanname());
|
|
|
+ map.put("DRILLTIME",DateUtil.format(aspSafetyDrillProgrammeDo.getDrilltime(), "yyyy年MM月dd日 HH时mm分"));
|
|
|
+ map.put("DRILLLOCATION",aspSafetyDrillProgrammeDo.getDrilllocation());
|
|
|
+ map.put("PARTICIPANTNAME",aspSafetyDrillProgrammeDo.getParticipantname());
|
|
|
+ map.put("OBSERVERNAMES",aspSafetyDrillProgrammeDo.getObservernames());
|
|
|
+ map.put("CAMERACREWNAME",aspSafetyDrillProgrammeDo.getCameracrewname());
|
|
|
+
|
|
|
+ map.put("PREPARATION",aspSafetyDrillProgrammeDo.getPreparation());
|
|
|
+ map.put("MOBILIZATIONTRAINING",aspSafetyDrillProgrammeDo.getMobilizationtraining());
|
|
|
+ map.put("DRILLPROCESS",aspSafetyDrillProgrammeDo.getDrillprocess());
|
|
|
+ map.put("EVALUATIONSUMMARY",aspSafetyDrillProgrammeDo.getEvaluationsummary());
|
|
|
+
|
|
|
+ //增加所需器材组装字段(equipments)
|
|
|
+ String equipments = this.baseMapper.selectEquimentByMainId(mainId);
|
|
|
+ map.put("equipments", equipments);
|
|
|
+
|
|
|
+ ClassPathResource classPathResource = new ClassPathResource("template/ExercisePlan.docx");
|
|
|
+
|
|
|
+
|
|
|
+ Document doc = new Document(classPathResource.getInputStream());
|
|
|
+ doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_UNUSED_FIELDS);
|
|
|
+ try {
|
|
|
+ doc.getMailMerge().execute(map.keySet().toArray(new String[0]),map.values().toArray());
|
|
|
+ doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_EMPTY_TABLE_ROWS);
|
|
|
+ doc.getMailMerge().deleteFields();
|
|
|
+ response.setContentType("application/octet-stream;charset=ISO8859-1");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename="+URLEncoder.encode(aspSafetyDrillProgrammeDo.getPlanname()+"演练方案.docx", "UTF-8"));
|
|
|
+ doc.save(response.getOutputStream(), com.aspose.words.SaveFormat.DOCX);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new CustomException("演练方案导出异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 消息提醒
|
|
|
*
|