|
|
|
@ -1,12 +1,14 @@
|
|
|
|
|
package com.hnac.hzims.ticket.twoTicket.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
|
|
|
|
import cn.afterturn.easypoi.word.WordExportUtil; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.google.common.collect.Lists; |
|
|
|
|
import com.hnac.hzims.message.entity.config.PushConfigEntity; |
|
|
|
|
import com.hnac.hzims.message.fegin.IMessageConfigClient; |
|
|
|
|
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; |
|
|
|
@ -21,6 +23,7 @@ import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
|
|
|
|
|
import com.hnac.hzims.ticket.constants.TicketConstants; |
|
|
|
|
import com.hnac.hzims.ticket.constants.WorkTicketConstants; |
|
|
|
|
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService; |
|
|
|
|
import com.hnac.hzims.ticket.utils.AsposeUtil; |
|
|
|
|
import com.hnac.hzims.ticket.utils.ExcelUtil; |
|
|
|
|
import com.hnac.hzims.ticket.utils.PdfUtils; |
|
|
|
|
import com.hnac.hzims.ticket.workTicket.dto.*; |
|
|
|
@ -34,6 +37,7 @@ import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketInfoWrapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
@ -52,6 +56,10 @@ import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.io.FileNotFoundException; |
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
@ -267,6 +275,95 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMa
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void preview(HttpServletResponse response,Long ticketId) { |
|
|
|
|
Map measure = new HashMap(3) {{ |
|
|
|
|
put("index",1); |
|
|
|
|
put("safetyMeasure","暗室逢灯你根本就发给你开始的那数据打你电话"); |
|
|
|
|
put("status","√"); |
|
|
|
|
}}; |
|
|
|
|
Map<String,Object> params = new HashMap(){{ |
|
|
|
|
put("projectName","海南三亚一级站"); |
|
|
|
|
put("code","GY-D2-2311--004"); |
|
|
|
|
put("principalName","杨汪洋"); |
|
|
|
|
put("classGroupName","白班"); |
|
|
|
|
put("classGroupMembersName","吴先强,唐钰,彭晨洋,黄兴,肖璐"); |
|
|
|
|
put("totalPerson","5"); |
|
|
|
|
put("addressEquName","#1变压器出线-三洪奇"); |
|
|
|
|
put("workContent","#29电池舱第四簇高压箱"); |
|
|
|
|
put("ps_year","2023"); |
|
|
|
|
put("ps_month","11"); |
|
|
|
|
put("ps_day","11"); |
|
|
|
|
put("ps_hour","16"); |
|
|
|
|
put("ps_minuter","45"); |
|
|
|
|
put("pe_year","2023"); |
|
|
|
|
put("pe_month","11"); |
|
|
|
|
put("pe_day","12"); |
|
|
|
|
put("pe_hour","11"); |
|
|
|
|
put("pe_minuter","13"); |
|
|
|
|
put("matterLibraryListOne", Lists.newArrayList(measure,measure,measure,measure,measure,measure,measure,measure)); |
|
|
|
|
put("signerName","杨汪洋"); |
|
|
|
|
put("s_year","2023"); |
|
|
|
|
put("s_month","11"); |
|
|
|
|
put("s_day","12"); |
|
|
|
|
put("s_hour","11"); |
|
|
|
|
put("s_minuter","13"); |
|
|
|
|
put("jobReceiver","杨汪洋"); |
|
|
|
|
put("r_year","2023"); |
|
|
|
|
put("r_month","11"); |
|
|
|
|
put("r_day","12"); |
|
|
|
|
put("r_hour","11"); |
|
|
|
|
put("r_minuter","13"); |
|
|
|
|
put("l_year","2023"); |
|
|
|
|
put("l_month","11"); |
|
|
|
|
put("l_day","12"); |
|
|
|
|
put("l_hour","11"); |
|
|
|
|
put("l_minuter","13"); |
|
|
|
|
put("licensorName","杨汪洋"); |
|
|
|
|
put("principalName1","杨汪洋"); |
|
|
|
|
}}; |
|
|
|
|
try { |
|
|
|
|
response.setHeader("content-disposition", "attachment;filename=" + new String("电气第一种工作票模版新.docx".getBytes(), "ISO8859-1")); |
|
|
|
|
} catch (UnsupportedEncodingException e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|
|
|
|
XWPFDocument xwpfDocument = null; |
|
|
|
|
try { |
|
|
|
|
xwpfDocument = WordExportUtil.exportWord07("template/电气第一种工作票模版新.docx", params); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
xwpfDocument.write(response.getOutputStream()); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
String wordPath = "E://template/" + params.get("code") + "_" + params.get("addressEquName") +".docx"; |
|
|
|
|
String pdfPath = "E://template/" + params.get("code") + "_" + params.get("addressEquName") +".pdf"; |
|
|
|
|
// String pdfPath = pdfSavePath + "/" + params.get("code") + "_" + params.get("addressEquName") +".pdf";
|
|
|
|
|
FileOutputStream outputStream = null; |
|
|
|
|
try { |
|
|
|
|
outputStream = new FileOutputStream(wordPath); |
|
|
|
|
} catch (FileNotFoundException e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
xwpfDocument.write(outputStream); |
|
|
|
|
} |
|
|
|
|
catch(Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
finally { |
|
|
|
|
try { |
|
|
|
|
outputStream.close(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
AsposeUtil.wordToPdf(wordPath,pdfPath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R evaluation(Integer isPass, Long ticketId, String reason) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|