Loading censoft-rongtong/src/main/java/com/censoft/censoftrongtong/controller/RiskPlanController.java +9 −5 Original line number Diff line number Diff line Loading @@ -132,18 +132,22 @@ public class RiskPlanController extends BaseController RiskNotificationExportWordDto exportWordDto = riskPlanInherentListService.getRiskNotificationExportWordDto(inherentId); Map<String, Object> dataMap = Convert.convert(Map.class, exportWordDto); WordUtil word = new WordUtil(); word.exportWord(request, response,dataMap,"风险告知卡"); dataMap.put("title", "风险告知卡"); dataMap.put("path", "D:/ruoyi/uploadPath/upload/"); // 数据填装至模板,保存文件 String name = WordUtil.createDoc(dataMap, "word.ftl"); // word导出 WordUtil.responseDownloadFile(request, response, "D:/ruoyi/uploadPath/upload/", name); } /** * 导出项目风险清单表 */ @PostMapping("/exportExcel/InherentList/{inherentId}") public void export(@PathVariable Long inherentId, HttpServletResponse response) { @PostMapping("/exportExcel/InherentList/{planId}") public void export(@PathVariable Long planId, HttpServletResponse response) { try { List<RiskInherentListExportDto> dtos = riskPlanInherentListService.getPlanInherentListByPlanId(inherentId); List<RiskInherentListExportDto> dtos = riskPlanInherentListService.getPlanInherentListByPlanId(planId); riskPlanInherentListService.exportPlanInherentList(response,dtos); } catch (IOException e) { e.printStackTrace(); Loading censoft-rongtong/src/main/java/com/censoft/censoftrongtong/domain/dto/RiskNotificationExportWordDto.java +0 −1 Original line number Diff line number Diff line Loading @@ -59,6 +59,5 @@ public class RiskNotificationExportWordDto { /** * 应急措施 */ @TableField("measures_emergency") private String measuresEmergency; } censoft-rongtong/src/main/java/com/censoft/censoftrongtong/service/impl/RiskPlanInherentListServiceImpl.java +7 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ import com.censoft.censoftrongtong.mapper.RiskPlanTaskMapper; import com.censoft.censoftrongtong.service.IRiskPlanInherentListService; import com.censoft.censoftrongtong.service.IRiskPlanTaskService; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.WordUtil; import com.ruoyi.system.service.ISysUploadFileService; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Workbook; Loading @@ -29,6 +30,7 @@ import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; Loading Loading @@ -235,7 +237,11 @@ public class RiskPlanInherentListServiceImpl @Override public RiskNotificationExportWordDto getRiskNotificationExportWordDto(Long inherentId) { return riskPlanInherentListMapper.getRiskNotificationExportWordDto(inherentId); RiskNotificationExportWordDto dto = riskPlanInherentListMapper.getRiskNotificationExportWordDto(inherentId); if (StrUtil.isNotBlank(dto.getSafetyWarningSigns())){ dto.setSafetyWarningSigns(WordUtil.getImageStr("D:\\ruoyi\\uploadPath\\upload\\警告标志\\"+dto.getSafetyWarningSigns()+".png")); } return dto; } @Override Loading censoft-rongtong/src/main/resources/mapper/system/RiskPlanInherentListMapper.xml +4 −2 Original line number Diff line number Diff line Loading @@ -423,7 +423,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN risk_plan_inherent_list rpil ON rpil.room_id = lr.id LEFT JOIN risk_plan_existing_list rpel ON rpel.inherent_id = rpil.id WHERE rp.id = #{planId} -- rp.id = #{planId} rpil.plan_id = #{planId} AND rpil.id IS NOT NULL GROUP BY rpel.id </select> </mapper> No newline at end of file ruoyi-admin/src/main/resources/templates/ftl/word.ftl 0 → 100644 +1034 −0 File added.Preview size limit exceeded, changes collapsed. Show changes Loading
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/controller/RiskPlanController.java +9 −5 Original line number Diff line number Diff line Loading @@ -132,18 +132,22 @@ public class RiskPlanController extends BaseController RiskNotificationExportWordDto exportWordDto = riskPlanInherentListService.getRiskNotificationExportWordDto(inherentId); Map<String, Object> dataMap = Convert.convert(Map.class, exportWordDto); WordUtil word = new WordUtil(); word.exportWord(request, response,dataMap,"风险告知卡"); dataMap.put("title", "风险告知卡"); dataMap.put("path", "D:/ruoyi/uploadPath/upload/"); // 数据填装至模板,保存文件 String name = WordUtil.createDoc(dataMap, "word.ftl"); // word导出 WordUtil.responseDownloadFile(request, response, "D:/ruoyi/uploadPath/upload/", name); } /** * 导出项目风险清单表 */ @PostMapping("/exportExcel/InherentList/{inherentId}") public void export(@PathVariable Long inherentId, HttpServletResponse response) { @PostMapping("/exportExcel/InherentList/{planId}") public void export(@PathVariable Long planId, HttpServletResponse response) { try { List<RiskInherentListExportDto> dtos = riskPlanInherentListService.getPlanInherentListByPlanId(inherentId); List<RiskInherentListExportDto> dtos = riskPlanInherentListService.getPlanInherentListByPlanId(planId); riskPlanInherentListService.exportPlanInherentList(response,dtos); } catch (IOException e) { e.printStackTrace(); Loading
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/domain/dto/RiskNotificationExportWordDto.java +0 −1 Original line number Diff line number Diff line Loading @@ -59,6 +59,5 @@ public class RiskNotificationExportWordDto { /** * 应急措施 */ @TableField("measures_emergency") private String measuresEmergency; }
censoft-rongtong/src/main/java/com/censoft/censoftrongtong/service/impl/RiskPlanInherentListServiceImpl.java +7 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ import com.censoft.censoftrongtong.mapper.RiskPlanTaskMapper; import com.censoft.censoftrongtong.service.IRiskPlanInherentListService; import com.censoft.censoftrongtong.service.IRiskPlanTaskService; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.WordUtil; import com.ruoyi.system.service.ISysUploadFileService; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Workbook; Loading @@ -29,6 +30,7 @@ import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; Loading Loading @@ -235,7 +237,11 @@ public class RiskPlanInherentListServiceImpl @Override public RiskNotificationExportWordDto getRiskNotificationExportWordDto(Long inherentId) { return riskPlanInherentListMapper.getRiskNotificationExportWordDto(inherentId); RiskNotificationExportWordDto dto = riskPlanInherentListMapper.getRiskNotificationExportWordDto(inherentId); if (StrUtil.isNotBlank(dto.getSafetyWarningSigns())){ dto.setSafetyWarningSigns(WordUtil.getImageStr("D:\\ruoyi\\uploadPath\\upload\\警告标志\\"+dto.getSafetyWarningSigns()+".png")); } return dto; } @Override Loading
censoft-rongtong/src/main/resources/mapper/system/RiskPlanInherentListMapper.xml +4 −2 Original line number Diff line number Diff line Loading @@ -423,7 +423,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN risk_plan_inherent_list rpil ON rpil.room_id = lr.id LEFT JOIN risk_plan_existing_list rpel ON rpel.inherent_id = rpil.id WHERE rp.id = #{planId} -- rp.id = #{planId} rpil.plan_id = #{planId} AND rpil.id IS NOT NULL GROUP BY rpel.id </select> </mapper> No newline at end of file
ruoyi-admin/src/main/resources/templates/ftl/word.ftl 0 → 100644 +1034 −0 File added.Preview size limit exceeded, changes collapsed. Show changes