Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 11 months ago
parent
commit
78aaa3440e
  1. 0
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/annotation/DateTimeToMap.java
  2. 2
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/TicketConstants.java
  3. 18
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/WorkTicketConstants.java
  4. 6
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java
  5. 2
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/StockAlertServiceImpl.java
  6. 4
      hzims-service/message/pom.xml
  7. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/service/impl/TicketMatterGroupServiceImpl.java
  8. 171
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java
  9. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/utils/WordMapUtils.java
  10. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/MergeDocUtils.java
  11. 32
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/ObjectUtils.java
  12. 32
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/PdfUtils.java
  13. BIN
      hzims-service/ticket/src/main/resources/template/水力机械工作票模版.docx
  14. BIN
      hzims-service/ticket/src/main/resources/template/水力机械工作票模版_bak.docx
  15. BIN
      hzims-service/ticket/src/main/resources/template/电气第一种工作票模版.docx
  16. BIN
      hzims-service/ticket/src/main/resources/template/电气第一种工作票模版_bak.docx
  17. BIN
      hzims-service/ticket/src/main/resources/template/电气第一种工作票模版新.docx
  18. BIN
      hzims-service/ticket/src/main/resources/template/电气第二种工作票模版.docx
  19. BIN
      hzims-service/ticket/src/main/resources/template/电气第二种工作票模版_bak.docx

0
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/annotation/DateTimeToMap.java → hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/annotation/DateTimeToMap.java

2
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/TicketConstants.java

@ -10,7 +10,7 @@ import java.util.Optional;
* @author hx * @author hx
*/ */
public interface TicketConstants { public interface TicketConstants {
String APP_NAME = "hzims-ticket"; String APP_NAME = "hzims-ticket-hx";
String TICKET_DATE_PATTERN = "yyyy年MM月dd日 HH时mm分"; String TICKET_DATE_PATTERN = "yyyy年MM月dd日 HH时mm分";
String TICKET_TYPE = "ticketType"; String TICKET_TYPE = "ticketType";

18
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/constants/WorkTicketConstants.java

@ -36,6 +36,11 @@ public interface WorkTicketConstants {
private String type; private String type;
@Getter @Getter
private String convertAttributes; private String convertAttributes;
public static String getKeyByMeasureType(String type) {
Optional<WorkTicketMeasureTypeEnum> measureEnum = Arrays.stream(WorkTicketMeasureTypeEnum.class.getEnumConstants()).filter(e -> type.equals(e.getType())).findAny();
return measureEnum.map(WorkTicketMeasureTypeEnum::getConvertAttributes).orElse(null);
}
} }
@AllArgsConstructor @AllArgsConstructor
@ -87,21 +92,28 @@ public interface WorkTicketConstants {
@AllArgsConstructor @AllArgsConstructor
enum TicketSignageEnum { enum TicketSignageEnum {
/**第一种工作票**/ /**第一种工作票**/
FIRST("6","D1"), FIRST("6","D1","电气第一种工作票模版.docx"),
/**第二种工作票**/ /**第二种工作票**/
SECOND("7","D2"), SECOND("7","D2","电气第二种工作票模版.docx"),
/**机械工作票**/ /**机械工作票**/
MACHINE("8","JX"), MACHINE("8","JX","水力机械工作票模版.docx"),
; ;
@Getter @Getter
private String ticketType; private String ticketType;
@Getter @Getter
private String signage; private String signage;
@Getter
private String fileName;
public static String getTicketSignageByType(String ticketType) { public static String getTicketSignageByType(String ticketType) {
Optional<TicketSignageEnum> exist = Arrays.stream(TicketSignageEnum.class.getEnumConstants()) Optional<TicketSignageEnum> exist = Arrays.stream(TicketSignageEnum.class.getEnumConstants())
.filter(e -> ticketType.equals(e.getTicketType())).findFirst(); .filter(e -> ticketType.equals(e.getTicketType())).findFirst();
return exist.map(TicketSignageEnum::getSignage).orElse(null); return exist.map(TicketSignageEnum::getSignage).orElse(null);
} }
public static String getTempFileNameByType(String ticketType) {
Optional<TicketSignageEnum> exist = Arrays.stream(TicketSignageEnum.class.getEnumConstants())
.filter(e -> ticketType.equals(e.getTicketType())).findFirst();
return exist.map(TicketSignageEnum::getFileName).orElse(null);
}
} }
} }

6
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer; import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.hnac.hzims.ticket.annotation.DateTimeToMap;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
@ -174,6 +175,7 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "计划开始时间") @ApiModelProperty(value = "计划开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeToMap(prefix = "ps")
private LocalDateTime planStartTime; private LocalDateTime planStartTime;
/** /**
@ -182,6 +184,7 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "计划结束时间") @ApiModelProperty(value = "计划结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeToMap(prefix = "pe")
private LocalDateTime planEndTime; private LocalDateTime planEndTime;
@ -204,6 +207,7 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "签发人签发时间") @ApiModelProperty(value = "签发人签发时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeToMap(prefix = "s")
private LocalDateTime signerDateTime; private LocalDateTime signerDateTime;
@ -250,6 +254,7 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "许可时间") @ApiModelProperty(value = "许可时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeToMap(prefix = "l")
private LocalDateTime licenseTime; private LocalDateTime licenseTime;
@ -456,6 +461,7 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable {
@ApiModelProperty("工作接收人时间") @ApiModelProperty("工作接收人时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeToMap(prefix = "r")
private LocalDateTime jobReceiverTime; private LocalDateTime jobReceiverTime;

2
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/StockAlertServiceImpl.java

@ -1,7 +1,5 @@
package com.hnac.hzims.spare.service.impl; package com.hnac.hzims.spare.service.impl;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.message.fegin.IMessagePushClient;
import com.hnac.hzims.message.fegin.IPushMsgClient; import com.hnac.hzims.message.fegin.IPushMsgClient;
import com.hnac.hzims.spare.service.IStockAlertService; import com.hnac.hzims.spare.service.IStockAlertService;
import com.hnac.hzims.spare.service.IWtSpTotalService; import com.hnac.hzims.spare.service.IWtSpTotalService;

4
hzims-service/message/pom.xml

@ -118,10 +118,6 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId> <artifactId>spring-boot-starter-mail</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>hzims-operational-api</artifactId>
</dependency>
<!--邮件推送--> <!--邮件推送-->
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-http --> <!-- https://mvnrepository.com/artifact/cn.hutool/hutool-http -->

8
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/service/impl/TicketMatterGroupServiceImpl.java

@ -671,19 +671,19 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
String pathName = null; String pathName = null;
switch (status) { switch (status) {
case 1: case 1:
pathName = "电气第一种工作票模版.docx"; pathName = "电气第一种工作票模版_bak.docx";
break; break;
case 2: case 2:
pathName = "电气第二种工作票模版.docx"; pathName = "电气第二种工作票模版_bak.docx";
break; break;
case 3: case 3:
pathName = "水力机械工作票模版.docx"; pathName = "水力机械工作票模版_bak.docx";
break; break;
case 4: case 4:
pathName = "电气操作票.docx"; pathName = "电气操作票.docx";
break; break;
default: default:
pathName = "电气第一种工作票模版.docx"; pathName = "电气第一种工作票模版_bak.docx";
} }
return pathName; return pathName;
} }

171
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java

@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.entity.config.PushConfigEntity;
import com.hnac.hzims.message.fegin.IMessageConfigClient; import com.hnac.hzims.message.fegin.IMessageConfigClient;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
@ -22,9 +21,12 @@ import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.constants.WorkTicketConstants; import com.hnac.hzims.ticket.constants.WorkTicketConstants;
import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish;
import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService; import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService;
import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService;
import com.hnac.hzims.ticket.utils.AsposeUtil; import com.hnac.hzims.ticket.utils.AsposeUtil;
import com.hnac.hzims.ticket.utils.ExcelUtil; import com.hnac.hzims.ticket.utils.ExcelUtil;
import com.hnac.hzims.ticket.utils.ObjectUtils;
import com.hnac.hzims.ticket.utils.PdfUtils; import com.hnac.hzims.ticket.utils.PdfUtils;
import com.hnac.hzims.ticket.workTicket.dto.*; import com.hnac.hzims.ticket.workTicket.dto.*;
import com.hnac.hzims.ticket.workTicket.entity.*; import com.hnac.hzims.ticket.workTicket.entity.*;
@ -59,13 +61,13 @@ import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream;
/** /**
* @author hx * @author hx
@ -90,6 +92,7 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMa
private final IWorkTicketInfoService ticketInfoService; private final IWorkTicketInfoService ticketInfoService;
private final TicketInfoEvaluateService evaluateService; private final TicketInfoEvaluateService evaluateService;
private final IWorkTicketContentService contentService; private final IWorkTicketContentService contentService;
private final IWorkTicketFinishService workTicketFinishService;
/**工作票流程修改后的key**/ /**工作票流程修改后的key**/
@Value("${hzims.ticket.first-work-flow-key-new}") @Value("${hzims.ticket.first-work-flow-key-new}")
@ -276,72 +279,114 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMa
@Override @Override
public void preview(HttpServletResponse response,Long ticketId) { public void preview(HttpServletResponse response,Long ticketId) {
Map measure = new HashMap(3) {{ WorkTicketInfoEntity workTicketInfoEntity = this.getById(ticketId);
put("index",1); Map params = this.getTicketParamById(ticketId,workTicketInfoEntity);
put("safetyMeasure","暗室逢灯你根本就发给你开始的那数据打你电话"); String tempFileName = WorkTicketConstants.TicketSignageEnum.getTempFileNameByType(workTicketInfoEntity.getType());
put("status","√"); Assert.isTrue(StringUtil.isNotBlank(tempFileName),() -> {
}}; throw new ServiceException("未找到模板文件,预览失败!");
Map<String,Object> params = new HashMap(){{ });
put("projectName","海南三亚一级站"); String wordPath = this.getFileSavePath() + params.get("code") + "_" + params.get("addressEquName") +".docx";
put("code","GY-D2-2311--004"); this.exportTicketWord("template/"+tempFileName, wordPath, params);
put("principalName","杨汪洋"); String pdfPath = this.getFileSavePath() + params.get("code") + "_" + params.get("addressEquName") +".pdf";
put("classGroupName","白班"); AsposeUtil.wordToPdf(wordPath,pdfPath);
put("classGroupMembersName","吴先强,唐钰,彭晨洋,黄兴,肖璐"); PdfUtils.readPdf(response,pdfPath);
put("totalPerson","5"); }
put("addressEquName","#1变压器出线-三洪奇");
put("workContent","#29电池舱第四簇高压箱"); private String getFileSavePath() {
put("ps_year","2023"); String os = System.getProperty("os.name").toLowerCase();
put("ps_month","11"); if("linux".equals(os)) {
put("ps_day","11"); return pdfSavePath;
put("ps_hour","16"); }
put("ps_minuter","45"); else {
put("pe_year","2023"); return "E://template/";
put("pe_month","11"); }
put("pe_day","12"); }
put("pe_hour","11");
put("pe_minuter","13"); private Map<String,Object> getTicketParamById(Long ticketId,WorkTicketInfoEntity workTicketInfoEntity) {
put("matterLibraryListOne", Lists.newArrayList(measure,measure,measure,measure,measure,measure,measure,measure)); Map params = ObjectUtils.obj2Map(workTicketInfoEntity);
put("signerName","杨汪洋"); params.put("signerName",Optional.ofNullable(workTicketInfoEntity.getSigner()).map(UserCache::getUser).map(User::getName).orElse(null));
put("s_year","2023"); // 获取两票安措
put("s_month","11"); List<WorkTicketSafetyMeasureEntity> measures = workTicketSafetyMeasureService.selectByTicketId(ticketId);
put("s_day","12"); if(CollectionUtil.isNotEmpty(measures)) {
put("s_hour","11"); Map<String, List<Map>> measureMap = measures.stream().map(ObjectUtils::obj2Map).peek(m -> m.put("status", TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(m.get("status")) ? "√" : null)).collect(Collectors.groupingBy(m -> (String) m.get("type")));
put("s_minuter","13"); Arrays.stream(WorkTicketConstants.WorkTicketMeasureTypeEnum.class.getEnumConstants()).forEach(e -> {
put("jobReceiver","杨汪洋"); if(ObjectUtil.isNotEmpty(measureMap.get(e.getType()))) {
put("r_year","2023"); List<Map> list = measureMap.get(e.getType());
put("r_month","11"); List<HashMap<String, Object>> measureList = IntStream.iterate(0, index -> index + 1).limit(list.size()> 4 ? list.size() : 4).mapToObj(index -> {
put("r_day","12"); if(list.size() != 0 && list.size() >= index + 1) {
put("r_hour","11"); HashMap<String, Object> map = new HashMap<String, Object>() {{
put("r_minuter","13"); putAll(list.get(index));
put("l_year","2023"); put("index", index + 1);
put("l_month","11"); }};
put("l_day","12"); return map;
put("l_hour","11"); }
put("l_minuter","13"); return new HashMap<String,Object>();
put("licensorName","杨汪洋"); }).collect(Collectors.toList());
put("principalName1","杨汪洋"); params.put(e.getConvertAttributes(),measureList);
put("groundNum","11"); }
put("dismantleNum","12"); else {
put("retainNum","8"); params.put(e.getConvertAttributes(),IntStream.iterate(0, index -> index + 1).limit(4).mapToObj(index -> new HashMap<String,Object>()).collect(Collectors.toList()));
put("brakeNumber","A7758258"); }
put("licensorName2","A7758258"); });
put("isSafety ","☑"); List<Map> addressList = measureMap.get(WorkTicketConstants.WorkTicketMeasureTypeEnum.Five.getType());
put("isHazard","☑"); List<Map> fillList = measureMap.get(WorkTicketConstants.WorkTicketMeasureTypeEnum.Flow.getType());
put("isRailway","☑"); List<Map<String, Object>> measureList = IntStream.iterate(0, index -> index + 1).limit(4).mapToObj(index -> {
put("isLimited","☑"); Map<String,Object> result = new HashMap();
}}; if(CollectionUtil.isNotEmpty(addressList) && addressList.size() >= index + 1) {
result.put("safetyMeasure",addressList.get(index).get("measure"));
}
if(CollectionUtil.isNotEmpty(fillList) && fillList.size() >= index + 1) {
result.put("safetyMeasure1",fillList.get(index).get("measure"));
}
return result;
}).collect(Collectors.toList());
params.put("matterLibraryList",measureList);
}
params.put("isSafety",workTicketInfoEntity.getIsSafety() ? "☑" : "□");
params.put("isHazard",workTicketInfoEntity.getIsHazard() ? "☑" : "□");
params.put("isRailway",workTicketInfoEntity.getIsRailway() ? "☑" : "□");
params.put("isLimited",workTicketInfoEntity.getIsLimited() ? "☑" : "□");
params.put("isStart",workTicketInfoEntity.getIsStart() ? "☑" : "□");
// 许可人许可环节
if(ObjectUtil.isNotEmpty(workTicketInfoEntity.getLicenseTime())) {
params.put("licensorName",Optional.ofNullable(workTicketInfoEntity.getLicensor()).map(UserCache::getUser).map(User::getName).orElse(null));
params.put("principalName1",params.get("principalName"));
}
WorkTicketFinish finish = workTicketFinishService.selectByTicketId(ticketId);
if(ObjectUtil.isNotEmpty(finish)) {
if(Func.isNotEmpty(finish.getWorkEndTime())) {
params.put("principalName3",params.get("principalName"));
params.put("licensorName1",params.get("licensorName"));
params.putAll(ObjectUtils.LocalDateConvertMap(finish.getWorkEndTime(),"f","_"));
}
if(Func.isNotEmpty(finish.getLicensorEndTime())) {
params.put("licensorName2",params.get("licensorName"));
params.put("groundNum",finish.getGroundNum());
params.put("dismantleNum",finish.getDismantleNum());
params.put("retainNum",finish.getRetainNum());
params.put("brakeNumber",finish.getBrakeNumber());
params.put("tellContent",finish.getTellContent());
params.putAll(ObjectUtils.LocalDateConvertMap(finish.getLicensorEndTime(),"e","_"));
}
}
return params;
}
/**
* word模板填充内容并将结果导出
* @param templatePath 模板路径
* @param savePath 结果导出路径
* @param params 填充对象
*/
private void exportTicketWord(String templatePath, String savePath, Map params) {
XWPFDocument xwpfDocument = null; XWPFDocument xwpfDocument = null;
try { try {
xwpfDocument = WordExportUtil.exportWord07("template/电气第一种工作票模版新.docx", params); xwpfDocument = WordExportUtil.exportWord07(templatePath, params);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); e.printStackTrace();
} }
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; FileOutputStream outputStream = null;
try { try {
outputStream = new FileOutputStream(wordPath); outputStream = new FileOutputStream(savePath);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -358,8 +403,6 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMa
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
AsposeUtil.wordToPdf(wordPath,pdfPath);
PdfUtils.readPdf(response,pdfPath);
} }
@Override @Override

8
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/utils/WordMapUtils.java

@ -102,16 +102,16 @@ public class WordMapUtils {
String pathName = null; String pathName = null;
switch (status) { switch (status) {
case 1: case 1:
pathName = "电气第一种工作票模版.docx"; pathName = "电气第一种工作票模版_bak.docx";
break; break;
case 2: case 2:
pathName = "电气第二种工作票模版.docx"; pathName = "电气第二种工作票模版_bak.docx";
break; break;
case 3: case 3:
pathName = "水力机械工作票模版.docx"; pathName = "水力机械工作票模版_bak.docx";
break; break;
default: default:
pathName = "电气第一种工作票模版.docx"; pathName = "电气第一种工作票模版_bak.docx";
break; break;
} }
return pathName; return pathName;

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/MergeDocUtils.java

@ -148,7 +148,7 @@ public class MergeDocUtils {
// public static void main(String[] args) throws Exception { // public static void main(String[] args) throws Exception {
// //new一个list 模拟要合并的word对象集合 // //new一个list 模拟要合并的word对象集合
// List<File>docFileList = new ArrayList<>(); // List<File>docFileList = new ArrayList<>();
// docFileList.add(new File("F:\\idea项目\\flowable\\demo\\src\\main\\resources\\电气第一种工作票模版.docx")); // docFileList.add(new File("F:\\idea项目\\flowable\\demo\\src\\main\\resources\\电气第一种工作票模版_bak.docx"));
// docFileList.add(new File("F:\\idea项目\\flowable\\demo\\src\\main\\resources\\动火工作票.docx")); // docFileList.add(new File("F:\\idea项目\\flowable\\demo\\src\\main\\resources\\动火工作票.docx"));
// //
// //合并之后doc存储路径 此处读的配置文件的存储路径 D:/pdfData/ // //合并之后doc存储路径 此处读的配置文件的存储路径 D:/pdfData/

32
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/ObjectUtils.java

@ -6,6 +6,7 @@ import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -40,12 +41,7 @@ public class ObjectUtils {
result.put(field.getName(),time.format(DateUtil.TIME_FORMATTER)); result.put(field.getName(),time.format(DateUtil.TIME_FORMATTER));
} }
else { else {
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"year",time.getYear()); result.putAll(LocalDateConvertMap(time,dateTimeToMap.prefix(),dateTimeToMap.split()));
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"month",time.getMonth());
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"day",time.getDayOfMonth());
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"hour",time.getHour());
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"minute",time.getMinute());
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"second",time.getSecond());
} }
} }
else if(value instanceof Date) { else if(value instanceof Date) {
@ -59,14 +55,36 @@ public class ObjectUtils {
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"month",time.getMonth()); result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"month",time.getMonth());
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"day",time.getDay()); result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"day",time.getDay());
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"hour",time.getHours()); result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"hour",time.getHours());
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"minute",time.getMinutes()); result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"minuter",time.getMinutes());
result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"second",time.getSeconds()); result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"second",time.getSeconds());
} }
} }
else {
result.put(field.getName(),value);
}
}); });
return result; return result;
} }
return null; return null;
} }
/**
* 将时间按格式转化为map对象
* @param dateTime 待转换时间
* @param prefix 转换格式Key前缀
* @param split 转换格式Key分隔符
* @return map对象
*/
public static Map LocalDateConvertMap(LocalDateTime dateTime,String prefix,String split) {
HashMap<String, Object> result = new HashMap<String, Object>() {{
put(prefix + split + "year", dateTime.getYear());
put(prefix + split + "month", dateTime.getMonthValue());
put(prefix + split + "day", dateTime.getDayOfMonth());
put(prefix + split + "hour", dateTime.getHour());
put(prefix + split + "minuter", dateTime.getMinute());
put(prefix + split + "second", dateTime.getSecond());
}};
return result;
}
} }

32
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/PdfUtils.java

@ -326,36 +326,4 @@ public class PdfUtils {
} }
} }
} }
// public static void main(String[] args) {
// Runnable runnable = new Runnable() {
// @Override
// public void run() {
// try {
// Thread.sleep(3000);
// log.info("---调用结束---");
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
// };
// new Thread(runnable).start();
// log.info("---返回结果---");
// Callable callable = new Callable() {
// @Override
// public Object call() throws Exception {
// try {
// log.info("进入包装方法");
// Thread.sleep(4000);
// log.info("包装方法执行完成");
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// return null;
// }
// };
// FutureTask<String> ft1 = new FutureTask<String>(callable);
// new Thread(ft1).start();
// log.info("---返回结果---");
// }
} }

BIN
hzims-service/ticket/src/main/resources/template/水力机械工作票模版.docx

Binary file not shown.

BIN
hzims-service/ticket/src/main/resources/template/水力机械工作票模版_bak.docx

Binary file not shown.

BIN
hzims-service/ticket/src/main/resources/template/电气第一种工作票模版.docx

Binary file not shown.

BIN
hzims-service/ticket/src/main/resources/template/电气第一种工作票模版_bak.docx

Binary file not shown.

BIN
hzims-service/ticket/src/main/resources/template/电气第一种工作票模版新.docx

Binary file not shown.

BIN
hzims-service/ticket/src/main/resources/template/电气第二种工作票模版.docx

Binary file not shown.

BIN
hzims-service/ticket/src/main/resources/template/电气第二种工作票模版_bak.docx

Binary file not shown.
Loading…
Cancel
Save