包头bug修改

This commit is contained in:
guoshengxiong 2025-04-03 18:20:00 +08:00
parent 29d3ae7da5
commit 1f418616db
11 changed files with 167 additions and 39 deletions

View File

@ -356,6 +356,12 @@
<artifactId>poi-ooxml</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.1.2</version>
</dependency>
<!-- easypoi -->
<dependency>
<groupId>cn.afterturn</groupId>

View File

@ -4,23 +4,29 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.baotou.entity.ContractorMonthlyDetail;
import com.zhgd.xmgl.modules.baotou.entity.ContractorMonthlyPeriod;
import com.zhgd.xmgl.modules.baotou.service.*;
import com.zhgd.xmgl.modules.project.service.IProjectEnterpriseService;
import com.zhgd.xmgl.modules.worker.service.impl.EnterpriseInfoServiceImpl;
import com.zhgd.xmgl.util.WordUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.IOUtils;
import org.simpleframework.xml.core.Validate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
@ -213,4 +219,18 @@ public class ContractorMonthlyDetailController {
return Result.success(contractorMonthlyDetailService.countQuantityExcel(param));
}
@ApiOperation(value = "月报周报html转word", notes = "月报周报html转word", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "file", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/html2Word")
public void html2Word(HttpServletResponse response, MultipartFile file) {
try {
String html = IOUtils.toString(file.getInputStream(), StandardCharsets.UTF_8);
WordUtils.html2Word(response, html);
} catch (IOException e) {
log.error("", e);
}
}
}

View File

@ -149,10 +149,25 @@ public class AnticorrosionEntrust implements Serializable {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime;
@ApiModelProperty(value="时间级别1月2周")
private java.lang.Integer levelType ;
@ApiModelProperty(value = "时间级别1月2周")
private java.lang.Integer levelType;
@ApiModelProperty(value = "编号")
private java.lang.String num;
@ApiModelProperty(value = "项目组")
private java.lang.Long projectGroup;
@ApiModelProperty(value = "监理")
private java.lang.Long supervision;
@ApiModelProperty(value = "EPC承包商")
private java.lang.Long epcContractor;
@TableField(exist = false)
@ApiModelProperty(value = "项目组名称")
private java.lang.String projectGroupName;
@TableField(exist = false)
@ApiModelProperty(value = "监理名称")
private java.lang.String supervisionName;
@TableField(exist = false)
@ApiModelProperty(value = "EPC承包商名称")
private java.lang.String epcContractorName;
@TableField(exist = false)
@ApiModelProperty(value = "装置/单元名称")
private java.lang.String deviceUnitName;

View File

@ -97,25 +97,44 @@ public class AnticorrosionPlanApplication implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="创建时间 yyyy-MM-dd HH:mm:ss")
private java.util.Date createTime ;
/**更新时间 yyyy-MM-dd HH:mm:ss*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="更新时间 yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime ;
/**时间级别1月2周*/
@ApiModelProperty(value="时间级别1月2周")
private java.lang.Integer levelType ;
/**
* 更新时间 yyyy-MM-dd HH:mm:ss
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
private java.util.Date updateTime;
/**
* 时间级别1月2周
*/
@ApiModelProperty(value = "时间级别1月2周")
private java.lang.Integer levelType;
@ApiModelProperty(value = "编号")
private java.lang.String num;
@ApiModelProperty(value = "项目组")
private java.lang.Long projectGroup;
@ApiModelProperty(value = "监理")
private java.lang.Long supervision;
@ApiModelProperty(value = "EPC承包商")
private java.lang.Long epcContractor;
@TableField(exist = false)
@ApiModelProperty(value="装置/单元名称")
private java.lang.String deviceUnitName ;
@ApiModelProperty(value = "项目组名称")
private java.lang.String projectGroupName;
@TableField(exist = false)
@ApiModelProperty(value="承包商名称")
private java.lang.String contractorName ;
@ApiModelProperty(value = "监理名称")
private java.lang.String supervisionName;
@TableField(exist = false)
@ApiModelProperty(value="填报人名称")
private java.lang.String reportingPersonName ;
@ApiModelProperty(value = "EPC承包商名称")
private java.lang.String epcContractorName;
@TableField(exist = false)
@ApiModelProperty(value = "装置/单元名称")
private java.lang.String deviceUnitName;
@TableField(exist = false)
@ApiModelProperty(value = "承包商名称")
private java.lang.String contractorName;
@TableField(exist = false)
@ApiModelProperty(value = "填报人名称")
private java.lang.String reportingPersonName;
@TableField(exist = false)
@ApiModelProperty(value="承包商项目经理名称")
private java.lang.String contractorProjectManagerName ;

View File

@ -11,7 +11,13 @@
,su3.real_name as supervising_engineer_name
,su4.real_name as project_team_professional_engineer_name
,su5.real_name as anti_corrosion_contractor_responsible_person_name
,pg.project_group_name as project_group_name
,ei1.enterprise_name as supervision_name
,ei2.enterprise_name as epc_contractor_name
from anticorrosion_entrust t
left join project_group pg on pg.id=t.project_group
left join enterprise_info ei1 on ei1.id=t.supervision
left join enterprise_info ei2 on ei2.id=t.epc_contractor
left join device_unit du on du.id=t.device_unit_id
left join enterprise_info ei on ei.id=t.contractor
left join system_user su1 on su1.user_id=t.reporting_person
@ -32,7 +38,13 @@
,su3.real_name as supervising_engineer_name
,su4.real_name as project_team_professional_engineer_name
,su5.real_name as anti_corrosion_contractor_responsible_person_name
,pg.project_group_name as project_group_name
,ei1.enterprise_name as supervision_name
,ei2.enterprise_name as epc_contractor_name
from anticorrosion_entrust t
left join project_group pg on pg.id=t.project_group
left join enterprise_info ei1 on ei1.id=t.supervision
left join enterprise_info ei2 on ei2.id=t.epc_contractor
left join device_unit du on du.id=t.device_unit_id
left join enterprise_info ei on ei.id=t.contractor
left join system_user su1 on su1.user_id=t.reporting_person

View File

@ -11,7 +11,13 @@
,su3.real_name as supervising_engineer_name
,su4.real_name as project_team_professional_engineer_name
,su5.real_name as centralized_anti_corrosion_contractor_person_name
,pg.project_group_name as project_group_name
,ei1.enterprise_name as supervision_name
,ei2.enterprise_name as epc_contractor_name
from anticorrosion_plan_application t
left join project_group pg on pg.id=t.project_group
left join enterprise_info ei1 on ei1.id=t.supervision
left join enterprise_info ei2 on ei2.id=t.epc_contractor
left join device_unit du on du.id=t.device_unit_id
left join enterprise_info ei on ei.id=t.contractor
left join system_user su1 on su1.user_id=t.reporting_person
@ -32,7 +38,13 @@
,su3.real_name as supervising_engineer_name
,su4.real_name as project_team_professional_engineer_name
,su5.real_name as centralized_anti_corrosion_contractor_person_name
,pg.project_group_name as project_group_name
,ei1.enterprise_name as supervision_name
,ei2.enterprise_name as epc_contractor_name
from anticorrosion_plan_application t
left join project_group pg on pg.id=t.project_group
left join enterprise_info ei1 on ei1.id=t.supervision
left join enterprise_info ei2 on ei2.id=t.epc_contractor
left join device_unit du on du.id=t.device_unit_id
left join enterprise_info ei on ei.id=t.contractor
left join system_user su1 on su1.user_id=t.reporting_person

View File

@ -101,7 +101,8 @@ public class AnticorrosionEntrustServiceImpl extends ServiceImpl<AnticorrosionEn
public void addFromFlow(Map<String, Object> map) {
AnticorrosionEntrust e = new AnticorrosionEntrust();
e.setProjectSn(MapUtils.getString(map, "projectSn"));
e.setIsUrgent(FlowUtil.getPullDownInteger(map, "isUrgent"));
List<String> isUrgent = Arrays.asList("", "");
e.setIsUrgent(isUrgent.indexOf(FlowUtil.getString(map, "isUrgent")));
e.setDeviceUnitId(FlowUtil.getPullDownLong(map, "deviceUnitId"));
e.setContractor(FlowUtil.getPullDownLong(map, "contractor"));
e.setReportingTime(FlowUtil.getDate(map, "reportingTime"));
@ -121,6 +122,9 @@ public class AnticorrosionEntrustServiceImpl extends ServiceImpl<AnticorrosionEn
e.setInstruction(MapUtils.getString(map, "instruction"));
e.setLevelType(FlowUtil.getPullDownInteger(map, "levelType"));
e.setNum(FlowUtil.getString(map, "num"));
e.setProjectGroup(FlowUtil.getPullDownLong(map, "projectGroup"));
e.setSupervision(FlowUtil.getPullDownLong(map, "supervision"));
e.setEpcContractor(FlowUtil.getPullDownLong(map, "epcContractor"));
baseMapper.insert(e);
}

View File

@ -102,16 +102,19 @@ public class AnticorrosionPlanApplicationServiceImpl extends ServiceImpl<Anticor
e.setTotalQuantity(FlowUtil.getString(map,"totalQuantity"));
e.setTotalRemark(FlowUtil.getString(map,"totalRemark"));
e.setContractorProjectManager(FlowUtil.getPullDownLong(map,"contractorProjectManager"));
e.setContractorProjectManagerDate(FlowUtil.getDate(map,"contractorProjectManagerDate"));
e.setSupervisingEngineer(FlowUtil.getPullDownLong(map,"supervisingEngineer"));
e.setSupervisingEngineerDate(FlowUtil.getDate(map,"supervisingEngineerDate"));
e.setProjectTeamProfessionalEngineer(FlowUtil.getPullDownLong(map,"projectTeamProfessionalEngineer"));
e.setProjectTeamProfessionalEngineerDate(FlowUtil.getDate(map,"projectTeamProfessionalEngineerDate"));
e.setCentralizedAntiCorrosionContractorPerson(FlowUtil.getPullDownLong(map,"centralizedAntiCorrosionContractorPerson"));
e.setCentralizedAntiCorrosionContractorPersonDate(FlowUtil.getDate(map,"centralizedAntiCorrosionContractorPersonDate"));
e.setInstruction(FlowUtil.getString(map,"instruction"));
e.setLevelType(FlowUtil.getPullDownInteger(map,"levelType"));
e.setNum(FlowUtil.getString(map,"num"));
e.setContractorProjectManagerDate(FlowUtil.getDate(map, "contractorProjectManagerDate"));
e.setSupervisingEngineer(FlowUtil.getPullDownLong(map, "supervisingEngineer"));
e.setSupervisingEngineerDate(FlowUtil.getDate(map, "supervisingEngineerDate"));
e.setProjectTeamProfessionalEngineer(FlowUtil.getPullDownLong(map, "projectTeamProfessionalEngineer"));
e.setProjectTeamProfessionalEngineerDate(FlowUtil.getDate(map, "projectTeamProfessionalEngineerDate"));
e.setCentralizedAntiCorrosionContractorPerson(FlowUtil.getPullDownLong(map, "centralizedAntiCorrosionContractorPerson"));
e.setCentralizedAntiCorrosionContractorPersonDate(FlowUtil.getDate(map, "centralizedAntiCorrosionContractorPersonDate"));
e.setInstruction(FlowUtil.getString(map, "instruction"));
e.setLevelType(FlowUtil.getPullDownInteger(map, "levelType"));
e.setNum(FlowUtil.getString(map, "num"));
e.setProjectGroup(FlowUtil.getPullDownLong(map, "projectGroup"));
e.setSupervision(FlowUtil.getPullDownLong(map, "supervision"));
e.setEpcContractor(FlowUtil.getPullDownLong(map, "epcContractor"));
baseMapper.insert(e);
}

View File

@ -708,7 +708,7 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
}
//设置月报编辑权限增加编辑链接
// content = setMonthReportAuthority(param, contentType, period, levelType, type, content);
content = setMonthReportAuthority(param, contentType, period, levelType, type, content);
//xls设置默认样式
JSONObject rootJo1 = JSONObject.parseObject(content);
@ -914,7 +914,7 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl<ContractorMo
}
//设置月报编辑权限增加编辑链接
// content = setMonthReportAuthority(param, contentType, period, levelType, type, content);
content = setMonthReportAuthority(param, contentType, period, levelType, type, content);
//xls设置默认样式
JSONObject rootJo1 = JSONObject.parseObject(content);

View File

@ -126,7 +126,7 @@ public class LiftingOperationServiceImpl extends ServiceImpl<LiftingOperationMap
" \"operationInterval\": \"${field6812519354908}\",\n" +
" \"craneTypeLicensePlateNumber\": \"${field2253349369033}\",\n" +
" \"loadDescription\": \"${field1755249374770}\",\n" +
" \"level\": \"${field4054949396129}\",\n" +
" \"level\": \"${field3896748817717}\",\n" +
" \"operatorLicenseNumber\": \"${field7485449409029}\",\n" +
" \"safetyMeasuresList\": \"${field4081449441462}\",\n" +
" \"operationUnitConstructionApplicant\": \"${field2320203996306}\",\n" +
@ -193,7 +193,6 @@ public class LiftingOperationServiceImpl extends ServiceImpl<LiftingOperationMap
Long operationSupervisor = FlowUtil.getPullDownLong(map, "operationSupervisor");
Long safetyEngineer = FlowUtil.getPullDownLong(map, "safetyEngineer");
Long operationEquipment = FlowUtil.getPullDownLong(map, "operationEquipment");
Integer level = Optional.ofNullable(map.get("level")).map(o -> Convert.toInt(((List) o).get(0))).orElse(null);
String operationLocation = MapUtils.getString(map, "operationLocation");
String operationContent = MapUtils.getString(map, "operationContent");
String craneTypeLicensePlateNumber = MapUtils.getString(map, "craneTypeLicensePlateNumber");
@ -227,7 +226,8 @@ public class LiftingOperationServiceImpl extends ServiceImpl<LiftingOperationMap
operation.setOperationEndTime(operationEndTime);
operation.setCraneTypeLicensePlateNumber(craneTypeLicensePlateNumber);
operation.setLoadDescription(loadDescription);
operation.setLevel(level);
List<String> level = Arrays.asList("一级M100吨", "二级40吨≤M≤100吨", "三级M40吨");
operation.setLevel(level.indexOf(FlowUtil.getString(map, "level") + 1));
operation.setOperatorLicenseNumber(operatorLicenseNumber);
operation.setSafetyMeasuresList(safetyMeasuresList);
operation.setOperationUnitConstructionApplicant(operationUnitConstructionApplicant);

View File

@ -2,11 +2,14 @@ package com.zhgd.xmgl.util;
import cn.afterturn.easypoi.word.WordExportUtil;
import cn.afterturn.easypoi.word.parse.ParseWord07;
import org.apache.poi.poifs.filesystem.DirectoryEntry;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
@ -32,6 +35,40 @@ public class WordUtils {
}
}
/**
* word下载
*
* @param fileName 下载时的文件名称
* @param response
*/
private static void downLoadWord(String fileName, HttpServletResponse response, POIFSFileSystem poifsFileSystem) throws IOException {
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".docx", "UTF-8"));
poifsFileSystem.writeFilesystem(response.getOutputStream());
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
/**
* html转word
*
* @param response
* @param html
* @throws IOException
*/
public static void html2Word(HttpServletResponse response, String html) throws IOException {
// String html = FileUtil.readString("C:\\Users\\Administrator\\Desktop\\t\\文档.html", StandardCharsets.UTF_8 );
byte by[] = html.getBytes("UTF-8");
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(by);
POIFSFileSystem poifsFileSystem = new POIFSFileSystem();
DirectoryEntry directoryEntry = poifsFileSystem.getRoot();
directoryEntry.createDocument("WordDocument", byteArrayInputStream);
WordUtils.downLoadWord("导出word", response, poifsFileSystem);
}
/**
* word模板导出
*