项目分类统计:增加【环保“一塔三图”】导出
This commit is contained in:
parent
69af96be15
commit
1f3c4b17ee
|
|
@ -98,6 +98,13 @@ public class SynthesisQueryController {
|
|||
synthesisQueryService.downloadExcel(dto.getData(),response);
|
||||
}
|
||||
|
||||
@PostMapping("downloadWord")
|
||||
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "综合查询-项目分类统计", operation = "导出环保一塔三图", operDesc = "系统级事件",operType="导出")
|
||||
public void downloadWord(HttpServletResponse response, EncryptedReq<QueryParamDto> dto) {
|
||||
synthesisQueryService.downloadWord(dto.getData(),response);
|
||||
}
|
||||
|
||||
@ApiOperation("项目分类统计-查看图片")
|
||||
@PostMapping(value = "getProImgList")
|
||||
@DecryptAndVerify(decryptedClass = QueryParamDto.class)
|
||||
|
|
|
|||
|
|
@ -167,4 +167,22 @@ public interface SynthesisQueryDao {
|
|||
* @return
|
||||
*/
|
||||
List<SynthesisQueryVo> getPhotoImgList(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 环保“一塔三图”
|
||||
* @param dto
|
||||
* @return List<OneTowerThreeDiagramsVo>
|
||||
* @author cwchen
|
||||
* @date 2025/5/23 10:03
|
||||
*/
|
||||
List<OneTowerThreeDiagramsVo> getData(QueryParamDto dto);
|
||||
|
||||
/**
|
||||
* 获取环保“一塔三图”图片
|
||||
* @param vo
|
||||
* @return List<imgVo>
|
||||
* @author cwchen
|
||||
* @date 2025/5/23 10:17
|
||||
*/
|
||||
List<OneTowerThreeDiagramsVo.imgVo> getXtImgs(OneTowerThreeDiagramsVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.bonus.imgTool.backstage.entity;
|
||||
|
||||
import cn.hutool.bloomfilter.filter.SDBMFilter;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:OneTowerThreeDiagramsVo
|
||||
* @author:cwchen
|
||||
* @date:2025-05-22-17:51
|
||||
* @version:1.0
|
||||
* @description: 环保“一塔三图”-vo
|
||||
*/
|
||||
@Data
|
||||
public class OneTowerThreeDiagramsVo {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String proName = "";
|
||||
|
||||
private String line = "";
|
||||
|
||||
private int num = 0;
|
||||
|
||||
private String qz = "";
|
||||
|
||||
private String bd = "";
|
||||
|
||||
private String mainUser = "";
|
||||
|
||||
private String unit = "";
|
||||
|
||||
private String tower = "";
|
||||
|
||||
private String time = "";
|
||||
private String time2 = "";
|
||||
private String time3 = "";
|
||||
private String time4 = "";
|
||||
|
||||
private List<imgVo> imgList;
|
||||
private List<imgVo> imgList2;
|
||||
private List<imgVo> imgList3;
|
||||
private List<imgVo> imgList4 = new ArrayList<>();
|
||||
|
||||
@Data
|
||||
public static class imgVo {
|
||||
private Long index;
|
||||
private String path;
|
||||
private String suffix;
|
||||
private String base64Url;
|
||||
private String sourceType;
|
||||
private String createTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -101,6 +101,13 @@ public class QueryParamDto {
|
|||
|
||||
private String userName;
|
||||
|
||||
/**长度km*/
|
||||
private String line;
|
||||
/**塔基数*/
|
||||
private int num;
|
||||
/**起止塔号*/
|
||||
private String qz;
|
||||
|
||||
private int pageNum = 1;
|
||||
private int pageSize = 15;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public interface SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 综合查询-照片综合查询-照片数量
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
|
|
@ -27,6 +28,7 @@ public interface SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 照片综合查询
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
|
|
@ -36,6 +38,7 @@ public interface SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 收藏/取消收藏图片
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
|
|
@ -45,6 +48,7 @@ public interface SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 综合查询新增
|
||||
*
|
||||
* @param comprehensiveQueryVo
|
||||
* @return ServerResponse
|
||||
*/
|
||||
|
|
@ -52,6 +56,7 @@ public interface SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 综合查询修改
|
||||
*
|
||||
* @param comprehensiveQueryVo
|
||||
* @return ServerResponse
|
||||
*/
|
||||
|
|
@ -59,6 +64,7 @@ public interface SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 生成水印
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
|
|
@ -68,6 +74,7 @@ public interface SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 项目分类统计查询
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
|
|
@ -79,12 +86,14 @@ public interface SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 综合查询删除
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteComprehensiveQuery(Long id,String uploadType);
|
||||
void deleteComprehensiveQuery(Long id, String uploadType);
|
||||
|
||||
/**
|
||||
* 项目分类统计-查看图片
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
|
|
@ -94,6 +103,7 @@ public interface SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 项目分类统计-查看列表
|
||||
*
|
||||
* @param data
|
||||
* @return ServerResponse
|
||||
* @author cwchen
|
||||
|
|
@ -103,8 +113,20 @@ public interface SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 影像上传-查看图片
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
ServerResponse getPhotoImgList(QueryParamDto data);
|
||||
|
||||
/**
|
||||
* 导出环保一塔三图
|
||||
*
|
||||
* @param data
|
||||
* @param response
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/5/22 17:29
|
||||
*/
|
||||
void downloadWord(QueryParamDto data, HttpServletResponse response);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|||
import com.bonus.imgTool.backstage.dao.SynthesisQueryDao;
|
||||
import com.bonus.imgTool.backstage.entity.*;
|
||||
import com.bonus.imgTool.backstage.service.SynthesisQueryService;
|
||||
import com.bonus.imgTool.backstage.template.util.FreeMarkerUtil;
|
||||
import com.bonus.imgTool.backstage.template.util.WordUtils;
|
||||
import com.bonus.imgTool.system.vo.LoginUser;
|
||||
import com.bonus.imgTool.utils.HighQualityWatermark;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import com.bonus.imgTool.utils.SystemUtils;
|
||||
import com.bonus.imgTool.utils.UserUtil;
|
||||
import com.bonus.imgTool.utils.*;
|
||||
import com.bonus.imgTool.webResult.Constants;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -49,7 +49,7 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
try {
|
||||
String roleLevel = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getRoleLevel).orElse("0");
|
||||
String proIds = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getProIds).orElse("-1");
|
||||
if(Objects.equals(roleLevel, Constants.ROLE_LEVEL)){ // 项目部级
|
||||
if (Objects.equals(roleLevel, Constants.ROLE_LEVEL)) { // 项目部级
|
||||
List<Long> proList = Arrays.stream(proIds.split(",")).map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||
dto.setProIds(proList);
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
SynthesisNumVo vo = Optional.ofNullable(synthesisQueryDao.getImgNum(dto)).orElseGet(SynthesisNumVo::new);
|
||||
return ServerResponse.createSuccess(vo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe("查询失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
dto.setUserId(userId);
|
||||
String roleLevel = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getRoleLevel).orElse("0");
|
||||
String proIds = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getProIds).orElse("-1");
|
||||
if(Objects.equals(roleLevel, Constants.ROLE_LEVEL)){ // 项目部级
|
||||
if (Objects.equals(roleLevel, Constants.ROLE_LEVEL)) { // 项目部级
|
||||
List<Long> proList = Arrays.stream(proIds.split(",")).map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||
dto.setProIds(proList);
|
||||
}
|
||||
|
|
@ -101,6 +101,7 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 综合查询新增
|
||||
*
|
||||
* @param comprehensiveQueryVo
|
||||
* @return ServerResponse
|
||||
*/
|
||||
|
|
@ -111,6 +112,7 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 综合查询修改
|
||||
*
|
||||
* @param comprehensiveQueryVo
|
||||
* @return ServerResponse
|
||||
*/
|
||||
|
|
@ -128,12 +130,12 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
return ServerResponse.createErroe("原照片不存在");
|
||||
}
|
||||
String syPath = synthesisQueryDao.getSyData(vo);
|
||||
if(StringUtils.isBlank(syPath)){
|
||||
if (StringUtils.isBlank(syPath)) {
|
||||
syPath = generateWatermarkData(vo);
|
||||
}
|
||||
vo.setWatermarkFilePath(syPath);
|
||||
synthesisQueryDao.updateSyData(vo);
|
||||
return ServerResponse.createSuccess("操作成功",syPath);
|
||||
return ServerResponse.createSuccess("操作成功", syPath);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
|
|
@ -141,11 +143,11 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteComprehensiveQuery(Long id,String uploadType) {
|
||||
synthesisQueryDao.deleteComprehensiveQuery(id,uploadType);
|
||||
public void deleteComprehensiveQuery(Long id, String uploadType) {
|
||||
synthesisQueryDao.deleteComprehensiveQuery(id, uploadType);
|
||||
}
|
||||
|
||||
public String generateWatermarkData(SynthesisQueryVo vo){
|
||||
public String generateWatermarkData(SynthesisQueryVo vo) {
|
||||
// 准备多行水印文本
|
||||
List<String> watermarkLines = new ArrayList<>();
|
||||
String uploadTime = new SimpleDateFormat("yyyy-MM-dd").format(vo.getUploadTime());
|
||||
|
|
@ -159,8 +161,8 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
sourceTypeName = vo.getSourceTypeName().split("-")[1];
|
||||
}
|
||||
watermarkLines.add(sourceTypeName);
|
||||
String localPath = SystemUtils.getUploadPath() +File.separator+ vo.getOriginalFilePath();
|
||||
return HighQualityWatermark.generateWatermark(watermarkLines,localPath);
|
||||
String localPath = SystemUtils.getUploadPath() + File.separator + vo.getOriginalFilePath();
|
||||
return HighQualityWatermark.generateWatermark(watermarkLines, localPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -169,14 +171,14 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
try {
|
||||
String roleLevel = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getRoleLevel).orElse("0");
|
||||
String proIds = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getProIds).orElse("-1");
|
||||
if(Objects.equals(roleLevel, Constants.ROLE_LEVEL)){ // 项目部级
|
||||
if (Objects.equals(roleLevel, Constants.ROLE_LEVEL)) { // 项目部级
|
||||
List<Long> proList = Arrays.stream(proIds.split(",")).map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||
dto.setProIds(proList);
|
||||
}
|
||||
dto.setRoleLevel(roleLevel);
|
||||
list = Optional.ofNullable(synthesisQueryDao.getProClassifyStatisticsList(dto)).orElseGet(ArrayList::new);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
PageInfo<ProClassifyStatisticsVo> pageInfo = new PageInfo<>(list);
|
||||
return ServerResponse.createSuccessPage(pageInfo, dto.getPageNum(), dto.getPageSize());
|
||||
|
|
@ -227,7 +229,7 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
dto.setUserId(userId);
|
||||
List<ProClassifyStatisticDetailVo> list = Optional.ofNullable(synthesisQueryDao.getListData(dto)).orElseGet(ArrayList::new);
|
||||
PageHelper.clearPage();
|
||||
list.forEach(item->{
|
||||
list.forEach(item -> {
|
||||
item.setUserId(userId);
|
||||
ProClassifyStatisticDetailVo detailVo = setDataList(item);
|
||||
item.setPhotoList(detailVo.getPhotoList());
|
||||
|
|
@ -245,6 +247,7 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 影像上传-查看图片
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -263,37 +266,94 @@ public class SynthesisQueryServiceImpl implements SynthesisQueryService {
|
|||
|
||||
/**
|
||||
* 查询图片上传类型:1.安全违章、2.质量检查、3.安全措施落实、4.协调照片、5.重要事项及宣传
|
||||
*
|
||||
* @param detailVo
|
||||
* @return ProClassifyStatisticDetailVo
|
||||
* @author cwchen
|
||||
* @date 2025/4/6 18:44
|
||||
*/
|
||||
public ProClassifyStatisticDetailVo setDataList(ProClassifyStatisticDetailVo detailVo){
|
||||
public ProClassifyStatisticDetailVo setDataList(ProClassifyStatisticDetailVo detailVo) {
|
||||
try {
|
||||
switch (detailVo.getUploadType()){
|
||||
switch (detailVo.getUploadType()) {
|
||||
case "1":
|
||||
detailVo.setPhotoList(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo,1)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList2(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo,2)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo, 1)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList2(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo, 2)).orElseGet(ArrayList::new));
|
||||
break;
|
||||
case "2":
|
||||
detailVo.setPhotoList(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo,3)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList2(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo,4)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo, 3)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList2(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo, 4)).orElseGet(ArrayList::new));
|
||||
break;
|
||||
case "3":
|
||||
detailVo.setPhotoList(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo,5)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo, 5)).orElseGet(ArrayList::new));
|
||||
break;
|
||||
case "4":
|
||||
detailVo.setPhotoList(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo,6)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList2(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo,7)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList3(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo,8)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo, 6)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList2(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo, 7)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList3(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo, 8)).orElseGet(ArrayList::new));
|
||||
break;
|
||||
case "5":
|
||||
detailVo.setPhotoList(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo,9)).orElseGet(ArrayList::new));
|
||||
detailVo.setPhotoList(Optional.ofNullable(synthesisQueryDao.getImgs(detailVo, 9)).orElseGet(ArrayList::new));
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return detailVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadWord(QueryParamDto dto, HttpServletResponse response) {
|
||||
Map<String, Object> data = new HashMap<>(16);
|
||||
List<OneTowerThreeDiagramsVo> dataList = new ArrayList<>();
|
||||
try {
|
||||
List<OneTowerThreeDiagramsVo> list = Optional.ofNullable(synthesisQueryDao.getData(dto)).orElseGet(ArrayList::new);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (OneTowerThreeDiagramsVo vo : list) {
|
||||
List<OneTowerThreeDiagramsVo.imgVo> imgList = Optional.ofNullable(synthesisQueryDao.getXtImgs(vo)).orElseGet(ArrayList::new);
|
||||
OneTowerThreeDiagramsVo oneTowerThreeDiagramsVo = handleVo(vo, imgList);
|
||||
// 先设置为空
|
||||
oneTowerThreeDiagramsVo.setMainUser("");
|
||||
dataList.add(oneTowerThreeDiagramsVo);
|
||||
}
|
||||
}
|
||||
data.put("list",dataList);
|
||||
WordUtils.exportMillCertificateWord(null, response, data, "test", "demo.ftl");
|
||||
} catch (Exception e) {
|
||||
log.error("一塔三图下载", e);
|
||||
}
|
||||
}
|
||||
|
||||
private OneTowerThreeDiagramsVo handleVo(OneTowerThreeDiagramsVo vo, List<OneTowerThreeDiagramsVo.imgVo> imgList) {
|
||||
try {
|
||||
List<OneTowerThreeDiagramsVo.imgVo> list = imgList.stream().filter(imgVo -> Objects.equals(imgVo.getSourceType(), "6")).collect(Collectors.toList());
|
||||
List<OneTowerThreeDiagramsVo.imgVo> list2 = imgList.stream().filter(imgVo -> Objects.equals(imgVo.getSourceType(), "7")).collect(Collectors.toList());
|
||||
List<OneTowerThreeDiagramsVo.imgVo> list3 = imgList.stream().filter(imgVo -> Objects.equals(imgVo.getSourceType(), "8")).collect(Collectors.toList());
|
||||
for (OneTowerThreeDiagramsVo.imgVo imgVo : list) {
|
||||
imgVo.setBase64Url(FreeMarkerUtil.getImageBase(SystemUtils.getUploadPath() + imgVo.getPath()));
|
||||
}
|
||||
for (OneTowerThreeDiagramsVo.imgVo imgVo : list2) {
|
||||
imgVo.setBase64Url(FreeMarkerUtil.getImageBase(SystemUtils.getUploadPath() + imgVo.getPath()));
|
||||
}
|
||||
for (OneTowerThreeDiagramsVo.imgVo imgVo : list3) {
|
||||
imgVo.setBase64Url(FreeMarkerUtil.getImageBase(SystemUtils.getUploadPath() + imgVo.getPath()));
|
||||
}
|
||||
vo.setImgList(list);
|
||||
vo.setImgList2(list2);
|
||||
vo.setImgList3(list3);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
vo.setTime(list.get(0).getCreateTime());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list2)) {
|
||||
vo.setTime2(list2.get(0).getCreateTime());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list3)) {
|
||||
vo.setTime3(list3.get(0).getCreateTime());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return detailVo;
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,143 @@
|
|||
package com.bonus.imgTool.backstage.template.util;
|
||||
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.DefaultObjectWrapper;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateExceptionHandler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Base64;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Auther: ccw
|
||||
* @Date: 2021/06/30/16:04
|
||||
* @description:
|
||||
*/
|
||||
public class FreeMarkerUtil {
|
||||
private static Logger logger = LoggerFactory.getLogger(FreeMarkerUtil.class);
|
||||
private static final String ENCODING = "UTF-8";
|
||||
private static Configuration cfg = new Configuration();
|
||||
|
||||
//初始化cfg
|
||||
static {
|
||||
//设置模板所在文件夹
|
||||
cfg.setClassForTemplateLoading(FreeMarkerUtil.class, "/templates/word");
|
||||
// setEncoding这个方法一定要设置国家及其编码,不然在ftl中的中文在生成html后会变成乱码
|
||||
cfg.setEncoding(Locale.getDefault(), ENCODING);
|
||||
// 设置对象的包装器
|
||||
cfg.setObjectWrapper(new DefaultObjectWrapper());
|
||||
// 设置异常处理器,这样的话就可以${a.b.c.d}即使没有属性也不会出错
|
||||
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.IGNORE_HANDLER);
|
||||
|
||||
}
|
||||
|
||||
//获取模板对象
|
||||
public static Template getTemplate(String templateFileName) throws IOException {
|
||||
return cfg.getTemplate(templateFileName, ENCODING);
|
||||
}
|
||||
|
||||
/**
|
||||
* 45 * 据数据及模板生成文件
|
||||
* 46 * @param data Map的数据结果集
|
||||
* 47 * @param templateFileName ftl模版文件名
|
||||
* 48 * @param outFilePath 生成文件名称(可带路径)
|
||||
* 49
|
||||
*/
|
||||
public static File crateFile(Map<String, Object> data, String templateFileName, String outFilePath) {
|
||||
Writer out = null;
|
||||
File outFile = new File(outFilePath);
|
||||
try {
|
||||
// 获取模板,并设置编码方式,这个编码必须要与页面中的编码格式一致
|
||||
Template template = getTemplate(templateFileName);
|
||||
if (!outFile.getParentFile().exists()) {
|
||||
outFile.getParentFile().mkdirs();
|
||||
}
|
||||
out = new OutputStreamWriter(new FileOutputStream(outFile), ENCODING);
|
||||
// 处理模版
|
||||
template.process(data, out);
|
||||
out.flush();
|
||||
logger.info("由模板文件" + templateFileName + "生成" + outFilePath + "成功.");
|
||||
} catch (Exception e) {
|
||||
logger.error("由模板文件" + templateFileName + "生成" + outFilePath + "出错");
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("关闭Write对象出错", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return outFile;
|
||||
}
|
||||
|
||||
//获得图片的base64码
|
||||
public static String getImageBase(String src) throws Exception {
|
||||
try {
|
||||
if (src == null || src == "") {
|
||||
return "";
|
||||
}
|
||||
File file = new File(src);
|
||||
if (!file.exists()) {
|
||||
return "";
|
||||
}
|
||||
InputStream in = null;
|
||||
byte[] data = null;
|
||||
|
||||
in = new FileInputStream(file);
|
||||
data = new byte[in.available()];
|
||||
in.read(data);
|
||||
in.close();
|
||||
// 编码
|
||||
return Base64.getEncoder().encodeToString(data);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String getsuffix(String url) {
|
||||
String suffix = url.substring(url.lastIndexOf("."));
|
||||
String replaceStr = url.replace(suffix, ".png");
|
||||
return replaceStr;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
String imageBase = getImageBase(getsuffix("C:\\Users\\bonus\\Desktop\\按钮\\选中\\微信图片_20210129113032.jpg"));
|
||||
System.err.println(getsuffix("C:\\Users\\bonus\\Desktop\\按钮\\选中\\微信图片_20210129113032.jpg"));
|
||||
// Map<String, Object> data = new HashMap<String, Object>();
|
||||
// data.put("orgName", "段然涛");
|
||||
// data.put("proName", "男");
|
||||
// data.put("inspectionUser", "测试李");
|
||||
// data.put("inspectionDate", "1994-03-14");
|
||||
// List<Map<String, String>> RectificationList = new ArrayList<>();
|
||||
// Map<String, String> paramsMap = new HashMap<String, String>();
|
||||
// paramsMap.put("index", "1");
|
||||
// paramsMap.put("content", "2008-09");
|
||||
// paramsMap.put("rectifyRemark", "2012-06");
|
||||
// Map<String, String> paramsMap2 = new HashMap<String, String>();
|
||||
// paramsMap2.put("index", "2");
|
||||
// paramsMap2.put("content", "2012-09");
|
||||
// paramsMap2.put("rectifyRemark", "2016-07");
|
||||
// RectificationList.add(paramsMap);
|
||||
// RectificationList.add(paramsMap2);
|
||||
// data.put("RectificationList", RectificationList);
|
||||
// List<String> images = new LinkedList<String>();
|
||||
// images.add(0,getImageBase(getsuffix("C:\\Users\\bonus\\Desktop\\按钮\\选中\\微信图片_20210129113032.jpg")));
|
||||
// images.add(1,getImageBase(getsuffix("C:\\Users\\bonus\\Desktop\\按钮\\选中\\背景.jpg")));
|
||||
// data.put("images", images);
|
||||
//// logger.error("图片的数量"+images.size());
|
||||
// crateFile(data, "质量巡查问题整改单5.ftl", "C:\\Users\\bonus\\Desktop\\文档\\简历5.doc");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,250 @@
|
|||
package com.bonus.imgTool.backstage.template.util;
|
||||
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Auther: ccw
|
||||
* @Date: 2021/07/22/9:57
|
||||
* @description:
|
||||
*/
|
||||
public class WordUtils {
|
||||
|
||||
//配置信息,代码本身写的还是很可读的,就不过多注解了
|
||||
private static Configuration configuration = null;
|
||||
|
||||
//这里注意的是利用WordUtils的类加载器动态获得模板文件的位置
|
||||
// private static final String templateFolder = WordUtils.class.getClassLoader().getResource("../../").getPath() + "/templates/word";
|
||||
static {
|
||||
configuration = new Configuration();
|
||||
configuration.setDefaultEncoding("utf-8");
|
||||
configuration.setClassForTemplateLoading(WordUtils.class, "/download/");
|
||||
}
|
||||
|
||||
private WordUtils() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static void exportMillCertificateWord(HttpServletRequest request, HttpServletResponse response, Map map, String title, String ftlFile) throws IOException {
|
||||
Template freemarkerTemplate = configuration.getTemplate(ftlFile);
|
||||
File file = null;
|
||||
InputStream fin = null;
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
// 调用工具类的createDoc方法生成Word文档
|
||||
file = createDoc(map, freemarkerTemplate);
|
||||
fin = new FileInputStream(file);
|
||||
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/msword");
|
||||
// 设置浏览器以下载的方式处理该文件名
|
||||
String fileName = title + ".docx";
|
||||
response.setHeader("Content-Disposition", "attachment;filename="
|
||||
.concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
|
||||
|
||||
out = response.getOutputStream();
|
||||
byte[] buffer = new byte[512]; // 缓冲区
|
||||
int bytesToRead = -1;
|
||||
// 通过循环将读入的Word文件的内容输出到浏览器中
|
||||
while ((bytesToRead = fin.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesToRead);
|
||||
}
|
||||
} finally {
|
||||
if (fin != null) {fin.close();}
|
||||
if (out != null) {out.close();}
|
||||
// 删除临时文件
|
||||
if (file != null) {file.delete();}
|
||||
}
|
||||
}
|
||||
|
||||
private static File createDoc(Map<?, ?> dataMap, Template template) {
|
||||
String name = "sellPlan.doc";
|
||||
File f = new File(name);
|
||||
Template t = template;
|
||||
try {
|
||||
// 这个地方不能使用FileWriter因为需要指定编码类型否则生成的Word文档会因为有无法识别的编码而无法打开
|
||||
Writer w = new OutputStreamWriter(new FileOutputStream(f), "utf-8");
|
||||
t.process(dataMap, w);
|
||||
w.close();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
public static void exportMillCertificateWord2(HttpServletRequest request, HttpServletResponse response, Map map, String title, String ftlFile, String path) throws IOException {
|
||||
Template freemarkerTemplate = configuration.getTemplate(ftlFile);
|
||||
File file = null;
|
||||
InputStream fin = null;
|
||||
OutputStream out = null;
|
||||
// String systemName = System.getProperty("os.name");
|
||||
String uploadPath = path + "word" + File.separator;
|
||||
try {
|
||||
// 调用工具类的createDoc方法生成Word文档
|
||||
file = createDoc(map, freemarkerTemplate);
|
||||
fin = new FileInputStream(file);
|
||||
|
||||
File file2 = new File(uploadPath);
|
||||
// 生成文件夹
|
||||
if (!file2.exists()) {
|
||||
file2.mkdirs();
|
||||
}
|
||||
String fileName = uploadPath + File.separator + title + ".doc";
|
||||
out = new FileOutputStream(new File(fileName));
|
||||
byte[] buffer = new byte[512]; // 缓冲区
|
||||
int bytesToRead = -1;
|
||||
// 通过循环将读入的Word文件的内容输出到浏览器中
|
||||
while ((bytesToRead = fin.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesToRead);
|
||||
}
|
||||
} finally {
|
||||
if (fin != null) {fin.close();}
|
||||
if (out != null) {out.close();}
|
||||
// 删除临时文件
|
||||
if (file != null) {file.delete();}
|
||||
}
|
||||
}
|
||||
|
||||
public static void exportPDF(HttpServletRequest request, HttpServletResponse response, String titleName, String fileName) throws IOException {
|
||||
File file = null;
|
||||
InputStream fin = null;
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
file = new File(fileName);
|
||||
fin = new FileInputStream(file);
|
||||
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/pdf");
|
||||
// 设置浏览器以下载的方式处理该文件名
|
||||
response.setHeader("Content-Disposition", "attachment;filename="
|
||||
.concat(String.valueOf(URLEncoder.encode(titleName, "UTF-8"))));
|
||||
out = response.getOutputStream();
|
||||
// 缓冲区
|
||||
byte[] buffer = new byte[512];
|
||||
int bytesToRead = -1;
|
||||
// 通过循环将读入的pdf文件的内容输出到浏览器中
|
||||
while ((bytesToRead = fin.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesToRead);
|
||||
}
|
||||
} finally {
|
||||
if (fin != null) {fin.close();}
|
||||
if (out != null) {out.close();}
|
||||
}
|
||||
}
|
||||
|
||||
public static void exportFile(HttpServletRequest request, HttpServletResponse response,String fileName,byte[] decode) throws IOException {
|
||||
InputStream fin = null;
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
fin = new ByteArrayInputStream(decode);
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String subfix = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
|
||||
if(Objects.equals(subfix,"pdf")){
|
||||
response.setContentType("application/pdf");
|
||||
}else if(Objects.equals(subfix,"doc") || Objects.equals(subfix,"docx")){
|
||||
response.setContentType("application/msword");
|
||||
}
|
||||
// 设置浏览器以下载的方式处理该文件名
|
||||
response.setHeader("Content-Disposition", "attachment;filename="
|
||||
.concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
|
||||
out = response.getOutputStream();
|
||||
// 缓冲区
|
||||
byte[] buffer = new byte[512];
|
||||
int bytesToRead = -1;
|
||||
// 通过循环将读入的pdf文件的内容输出到浏览器中
|
||||
while ((bytesToRead = fin.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesToRead);
|
||||
}
|
||||
} finally {
|
||||
if (fin != null) {fin.close();}
|
||||
if (out != null) {out.close();}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @author cw chen
|
||||
* @description 下载word文件
|
||||
* @Param request
|
||||
* @Param response
|
||||
* @Param titleName
|
||||
* @Param fileName
|
||||
* @date 2023-04-17 11:07
|
||||
*/
|
||||
public static void exportWord(HttpServletRequest request, HttpServletResponse response, String titleName, String fileName) throws IOException {
|
||||
File file = null;
|
||||
InputStream fin = null;
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
file = new File(fileName);
|
||||
fin = new FileInputStream(file);
|
||||
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/msword");
|
||||
// 设置浏览器以下载的方式处理该文件名
|
||||
response.setHeader("Content-Disposition", "attachment;filename="
|
||||
.concat(String.valueOf(URLEncoder.encode(titleName, "UTF-8"))));
|
||||
out = response.getOutputStream();
|
||||
// 缓冲区
|
||||
byte[] buffer = new byte[512];
|
||||
int bytesToRead = -1;
|
||||
// 通过循环将读入的pdf文件的内容输出到浏览器中
|
||||
while ((bytesToRead = fin.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesToRead);
|
||||
}
|
||||
} finally {
|
||||
if (fin != null) {fin.close();}
|
||||
if (out != null) {out.close();}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @author cw chen
|
||||
* @description 下载word文件
|
||||
* @Param request
|
||||
* @Param response
|
||||
* @Param titleName
|
||||
* @Param fileName
|
||||
* @date 2023-04-17 11:07
|
||||
*/
|
||||
public static void exportVideo(HttpServletRequest request, HttpServletResponse response, String titleName, String fileName) throws IOException {
|
||||
File file = null;
|
||||
InputStream fin = null;
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
file = new File(fileName);
|
||||
fin = new FileInputStream(file);
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("video/mp4");
|
||||
// 设置浏览器以下载的方式处理该文件名
|
||||
response.setHeader("Content-Disposition", "attachment;filename="
|
||||
.concat(String.valueOf(URLEncoder.encode(titleName, "UTF-8"))));
|
||||
out = response.getOutputStream();
|
||||
// 缓冲区
|
||||
byte[] buffer = new byte[512];
|
||||
int bytesToRead = -1;
|
||||
// 通过循环将读入的pdf文件的内容输出到浏览器中
|
||||
while ((bytesToRead = fin.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesToRead);
|
||||
}
|
||||
} finally {
|
||||
if (fin != null) {
|
||||
fin.close();
|
||||
}
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -544,6 +544,33 @@
|
|||
AND tcq.is_active = '1'
|
||||
ORDER BY sfr.create_time DESC
|
||||
</select>
|
||||
<!--环保“一塔三图”-->
|
||||
<select id="getData" resultType="com.bonus.imgTool.backstage.entity.OneTowerThreeDiagramsVo">
|
||||
SELECT tcq.pro_name,
|
||||
#{line} AS line,
|
||||
#{num} AS num,
|
||||
#{qz} AS qz,
|
||||
IFNULL(tcq.vio_place,'') AS tower,
|
||||
tcq.id,
|
||||
IFNULL(tcq.update_user_name,tcq.create_user_name) AS mainUser
|
||||
FROM tb_comprehensive_query tcq
|
||||
WHERE tcq.pro_id = #{proId} AND tcq.upload_type = '4' AND tcq.is_active = '1'
|
||||
ORDER BY vio_place
|
||||
</select>
|
||||
<!--获取环保“一塔三图”图片-->
|
||||
<select id="getXtImgs" resultType="com.bonus.imgTool.backstage.entity.OneTowerThreeDiagramsVo$imgVo">
|
||||
SELECT sfr.id AS `index`,
|
||||
sfr.compress_file_path AS path,
|
||||
REPLACE(sfr.file_suffix, '.', '') AS suffix,
|
||||
DATE_FORMAT(sfr.create_time,'%Y-%m-%d %H:%i:%s') AS createTime,
|
||||
sfr.source_type AS sourceType
|
||||
FROM sys_file_resource sfr
|
||||
WHERE sfr.source_id = #{id}
|
||||
AND sfr.upload_type = '4'
|
||||
AND sfr.source_type IN ('6','7','8')
|
||||
AND sfr.is_active = '1'
|
||||
ORDER BY sfr.create_time DESC
|
||||
</select>
|
||||
<!--收藏/取消收藏图片-->
|
||||
<update id="collectData">
|
||||
<if test="collectType == 1">
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 732 B |
|
|
@ -9,7 +9,7 @@
|
|||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<title>后台管理系统</title>
|
||||
<title>项目全过程影像管理工具</title>
|
||||
<link rel="stylesheet" href="css/font-awesome/css/font-awesome.css" media="all" />
|
||||
<link rel="stylesheet" href="css/index2.css" media="all" />
|
||||
<link rel="stylesheet" href="css/global.css" media="all" />
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
<div class="layui-main">
|
||||
<div class="admin-login-box">
|
||||
<a class="logo" style="left: 0;" href="javascript:void(0)">
|
||||
<span style="font-size: 22px;color: #fff;letter-spacing: 2px;">后台管理系统</span>
|
||||
<span style="font-size: 22px;color: #fff;letter-spacing: 2px;">项目全过程影像管理工具</span>
|
||||
</a>
|
||||
<div class="admin-side-toggle" style="display: none;">
|
||||
<i class="fa fa-bars" aria-hidden="true"></i>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
let form, laydate, layer, objParam = {};
|
||||
|
||||
function setParams(obj) {
|
||||
objParam = JSON.parse(obj);
|
||||
layui.use(["form", 'laydate', 'layer'], function () {
|
||||
form = layui.form;
|
||||
laydate = layui.laydate;
|
||||
layer = layui.layer;
|
||||
// 表单验证
|
||||
form.verify({
|
||||
number: function (value, item) {
|
||||
const strictPositiveNumberRegex = /^([1-9]\d*(\.\d+)?|0\.\d*[1-9]\d*)$/;
|
||||
if (!strictPositiveNumberRegex.test(value)) {
|
||||
return '请输入有效的数字';
|
||||
}
|
||||
},
|
||||
});
|
||||
form.on('submit(formData)', function (data) {
|
||||
saveData(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function saveData2() {
|
||||
$('#formSubmit').trigger('click')
|
||||
}
|
||||
|
||||
/**搜索数据*/
|
||||
function saveData() {
|
||||
let data = form.val('formInfo');
|
||||
console.error(data)
|
||||
closePage(1,data);
|
||||
}
|
||||
|
||||
// 关闭页面
|
||||
function closePage(type,data) {
|
||||
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
|
||||
if(type){
|
||||
window.parent.downloadWord(JSON.stringify(data),JSON.stringify(objParam));
|
||||
}
|
||||
parent.layer.close(index); //再执行关闭
|
||||
}
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
let form, layer, table, tableIns;
|
||||
let form, layer, table, tableIns, dropdown;
|
||||
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||
layui.use(['form', 'layer', 'table'], function () {
|
||||
layui.use(['form', 'layer', 'table', 'dropdown'], function () {
|
||||
form = layui.form;
|
||||
layer = layui.layer;
|
||||
table = layui.table;
|
||||
dropdown = layui.dropdown;
|
||||
layui.form.render();
|
||||
let pros = getProsSelect();
|
||||
setSelectValueName(pros,'proId','请选择工程');
|
||||
setSelectValueName(pros, 'proId', '请选择工程');
|
||||
pages(1, 10, 1);
|
||||
})
|
||||
|
||||
|
|
@ -67,54 +68,59 @@ function initTable(dataList, limit, page) {
|
|||
return (page - 1) * limit + d.LAY_NUM;
|
||||
}
|
||||
},
|
||||
{field: "proName", title: "项目名称", width: "19%", unresize: true, align: "center"},
|
||||
{field: "proName", title: "项目名称", width: "17%", unresize: true, align: "center"},
|
||||
{
|
||||
field: "totalNum", title: "总照片数量", width: "8%", unresize: true, align: "center",
|
||||
templet: function (d) {
|
||||
return "<div class='num-btn' onclick='viewImg("+JSON.stringify(d)+",0)'><span style='color:#409EFF;'>"+d.totalNum+"</span></div>";
|
||||
return "<div class='num-btn' onclick='viewImg(" + JSON.stringify(d) + ",0)'><span style='color:#409EFF;'>" + d.totalNum + "</span></div>";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "safetyVioNum", title: "安全违章", width: "8%", unresize: true, align: "center",
|
||||
templet: function (d) {
|
||||
return "<div class='num-btn' onclick='viewImg("+JSON.stringify(d)+",1)'><span style='color:#F56C6C;'>"+d.safetyVioNum+"</span></div>";
|
||||
return "<div class='num-btn' onclick='viewImg(" + JSON.stringify(d) + ",1)'><span style='color:#F56C6C;'>" + d.safetyVioNum + "</span></div>";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "qualityInsNum", title: "质量检查", width: "8%", unresize: true, align: "center",
|
||||
templet: function (d) {
|
||||
return "<div class='num-btn' onclick='viewImg("+JSON.stringify(d)+",2)'><span style='color:#80E1BB;'>"+d.qualityInsNum+"</span></div>";
|
||||
return "<div class='num-btn' onclick='viewImg(" + JSON.stringify(d) + ",2)'><span style='color:#80E1BB;'>" + d.qualityInsNum + "</span></div>";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "safetyMeasNum", title: "安全措施落实", width: "10%", unresize: true, align: "center",
|
||||
templet: function (d) {
|
||||
return "<div class='num-btn' onclick='viewImg("+JSON.stringify(d)+",3)'><span style='color:#FFC328;'>"+d.safetyMeasNum+"</span></div>";
|
||||
return "<div class='num-btn' onclick='viewImg(" + JSON.stringify(d) + ",3)'><span style='color:#FFC328;'>" + d.safetyMeasNum + "</span></div>";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "coordinatedPhotoNum", title: "协调照片 ", width: "8%", unresize: true, align: "center",
|
||||
templet: function (d) {
|
||||
return "<div class='num-btn' onclick='viewImg("+JSON.stringify(d)+",4)'><span style='color:#F56CCF;'>"+d.coordinatedPhotoNum+"</span></div>";
|
||||
return "<div class='num-btn' onclick='viewImg(" + JSON.stringify(d) + ",4)'><span style='color:#F56CCF;'>" + d.coordinatedPhotoNum + "</span></div>";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "importIssuesAndPublicityNum", title: "重要事项及宣传 ", width: "10%", unresize: true, align: "center",
|
||||
field: "importIssuesAndPublicityNum",
|
||||
title: "重要事项及宣传 ",
|
||||
width: "10%",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
templet: function (d) {
|
||||
return "<div class='num-btn' onclick='viewImg("+JSON.stringify(d)+",5)'><span style='color:#06B6D4;'>"+d.importIssuesAndPublicityNum+"</span></div>";
|
||||
return "<div class='num-btn' onclick='viewImg(" + JSON.stringify(d) + ",5)'><span style='color:#06B6D4;'>" + d.importIssuesAndPublicityNum + "</span></div>";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "lastUpdateTime", title: "最后更新时间", width: "14%", align: "center", templet: 'center',
|
||||
},
|
||||
{
|
||||
title: "操作", unresize: true, width: "10%", align: "center",
|
||||
title: "操作", unresize: true, width: "12%", align: "center",
|
||||
templet: function (d) {
|
||||
let html = '';
|
||||
let view = "<a style='cursor:pointer;margin: 0 2px;' title='详情' onclick='viewData("+JSON.stringify(d)+")'><img src='../../img/synthesisQuery/detail-icon.png'></a>"
|
||||
let originalDownload = "<a style='cursor:pointer;margin: 0 2px;' title='原图下载' onclick='downloadFile("+JSON.stringify(d)+",1)'><img src='../../img/synthesisQuery/download-icon.png'></a>"
|
||||
let waterDownload = "<a style='cursor:pointer;margin: 0 2px;' title='水印下载' onclick='downloadFile("+JSON.stringify(d)+",2)'><img src='../../img/synthesisQuery/water-download-icon.png'></a>";
|
||||
html = view + originalDownload + waterDownload;
|
||||
let view = "<a style='cursor:pointer;margin: 0 2px;' title='详情' onclick='viewData(" + JSON.stringify(d) + ")'><img src='../../img/synthesisQuery/detail-icon.png'></a>"
|
||||
let originalDownload = "<a style='cursor:pointer;margin: 0 2px;' title='原图下载' onclick='downloadFile(" + JSON.stringify(d) + ",1)'><img src='../../img/synthesisQuery/download-icon.png'></a>"
|
||||
let waterDownload = "<a style='cursor:pointer;margin: 0 2px;' title='水印下载' onclick='downloadFile(" + JSON.stringify(d) + ",2)'><img src='../../img/synthesisQuery/water-download-icon.png'></a>";
|
||||
let more = "<div class=\"layui-btn-group\"><a lay-event=\"more\" title='更多'><img src='../../img/synthesisQuery/more.png'></a></div>";
|
||||
html = view + originalDownload + waterDownload + more;
|
||||
return html;
|
||||
}
|
||||
},
|
||||
|
|
@ -125,8 +131,32 @@ function initTable(dataList, limit, page) {
|
|||
table.resize("table_data");
|
||||
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
|
||||
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
|
||||
|
||||
},
|
||||
});
|
||||
table.on('tool(table_data)', function (obj) {
|
||||
var data = obj.data; // 获得当前行数据
|
||||
console.error(data)
|
||||
var layEvent = obj.event; // 获得 lay-event 对应的值(如:more)
|
||||
var tr = obj.tr; // 获得当前行 tr 的DOM对象
|
||||
if (layEvent === 'more') { // 更多操作的事件处理
|
||||
dropdown.render({ // 使用dropdown插件渲染下拉菜单
|
||||
elem: tr.find('.layui-btn-group').find('a[lay-event="more"]'), // 绑定元素,即触发按钮
|
||||
data: [{
|
||||
title: '导出环保“一塔三图”',
|
||||
id: 'btn1'
|
||||
}],
|
||||
click: function (menudata) {
|
||||
if (menudata.id === 'btn1') {
|
||||
fillEnvironProForm(data);
|
||||
}
|
||||
},
|
||||
id: 'dropdown-table-tool',
|
||||
align: 'right', // 右对齐弹出
|
||||
style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' // 设置额外样式
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -156,25 +186,63 @@ function getReqParams(page, limit, type) {
|
|||
// 查询/重置
|
||||
function query(type) {
|
||||
pageNum = 1;
|
||||
if(type === 2){
|
||||
if (type === 2) {
|
||||
$('#proId').val('');
|
||||
layui.form.render();
|
||||
}
|
||||
pages(1, limitSize);
|
||||
}
|
||||
|
||||
/**详情*/
|
||||
function viewData(obj){
|
||||
function viewData(obj) {
|
||||
openIframeByParamObj("viewData", "详情", "./proClassifyStatisticsDetail.html", "92%", "95%", obj);
|
||||
}
|
||||
|
||||
/**图片预览*/
|
||||
function viewImg(obj,type){
|
||||
function viewImg(obj, type) {
|
||||
obj.type = type;
|
||||
openIframeByParamObj("viewImg", "图片详情", "./photoView.html", "92%", "85%", obj);
|
||||
}
|
||||
|
||||
// 环保“一塔三图”
|
||||
function fillEnvironProForm(obj) {
|
||||
openIframeByParamObj("fillEnvironProForm", "环保“一塔三图”", "./fillEnvironProForm.html", "42%", "50%", obj);
|
||||
}
|
||||
|
||||
// 下载 环保“一塔三图”
|
||||
function downloadWord(obj,original) {
|
||||
let objParam = JSON.parse(obj);
|
||||
let originalParam = JSON.parse(original);
|
||||
objParam.proId = originalParam.proId;
|
||||
/*let params = {
|
||||
encryptedData: encryptCBC(JSON.stringify(objParam))
|
||||
}*/
|
||||
let loadingMsg = layer.msg("数据导出中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||
let url = dataUrl + "/backstage/synthesisQuery/downloadWord?token=" + tokens+ "&encryptedData=" + encodeURIComponent(encryptCBC(JSON.stringify(objParam)));
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("post", url, true);
|
||||
xhr.responseType = "blob"; // 转换流
|
||||
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8')
|
||||
xhr.onload = function () {
|
||||
layer.close(loadingMsg);
|
||||
if (this.status === 200) {
|
||||
let blob = this.response;
|
||||
var a = document.createElement("a");
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
a.href = url;
|
||||
a.download = originalParam.proName+"-环保一塔三图" + ".doc"; // 文件名
|
||||
} else {
|
||||
layer.msg("数据导出发生异常,请稍后重试", {icon: 16, scrollbar: false, time: 2000});
|
||||
}
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
};
|
||||
// xhr.send(params);
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
/*下载*/
|
||||
function downloadExcel(){
|
||||
function downloadExcel() {
|
||||
let obj = {
|
||||
id: $('#proId').val()
|
||||
}
|
||||
|
|
@ -186,7 +254,7 @@ function downloadExcel(){
|
|||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("post", url, true);
|
||||
xhr.responseType = "blob"; // 转换流
|
||||
xhr.setRequestHeader('Content-Type','application/json;charset=UTF-8')
|
||||
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8')
|
||||
xhr.onload = function () {
|
||||
layer.close(loadingMsg);
|
||||
if (this.status === 200) {
|
||||
|
|
@ -206,7 +274,7 @@ function downloadExcel(){
|
|||
}
|
||||
|
||||
/**下载原图/水印*/
|
||||
function downloadFile(obj,type){
|
||||
function downloadFile(obj, type) {
|
||||
let title = type === 1 ? "原图下载" : "水印下载";
|
||||
window.open("./fileDownload.html?type="+encryptCBC(type)+"&proId="+encryptCBC(obj.proId) + "&title=" + encryptCBC(title) + "&proName=" + encryptCBC(obj.proName));
|
||||
window.open("./fileDownload.html?type=" + encryptCBC(type) + "&proId=" + encryptCBC(obj.proId) + "&title=" + encryptCBC(title) + "&proName=" + encryptCBC(obj.proName));
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
<body>
|
||||
|
||||
<div class="login">
|
||||
<div class="message">后台管理系统</div>
|
||||
<div class="message">项目全过程影像管理工具</div>
|
||||
<div id="darkbannerwrap"></div>
|
||||
|
||||
<form id="login-form" method="post" onsubmit="return false;">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>环保“一塔三图”<</title>
|
||||
<link rel="stylesheet" href="../../js/layui-v2.9.14/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="../../css/dataForm.css">
|
||||
<link rel="stylesheet" href="../../css/font.css">
|
||||
<script src="../../js/libs/jquery-3.7.0.min.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../js/layui-v2.9.14/layui/layui.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../js/publicJs.js"></script>
|
||||
<script src="../../js/select.js"></script>
|
||||
<script src="../../js/commonUtils.js"></script>
|
||||
<script src="../../js/openIframe.js"></script>
|
||||
<script src="../../js/my/aes.js"></script>
|
||||
<script src="../../js/ajaxRequest.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
.layui-form-label{
|
||||
width: 80px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="main-box">
|
||||
<div>
|
||||
<form class="layui-form" lay-filter="formInfo" onsubmit="return false;" id="formInfo2">
|
||||
<div class="layui-form-item" style="margin-top: 2%;">
|
||||
<label class="layui-form-label">长度(km)</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="line" lay-verify="required|number" class="layui-input" autocomplete="off"
|
||||
maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="margin-top: 2%;">
|
||||
<label class="layui-form-label">塔基数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" lay-verify="required|number" name="num" class="layui-input" autocomplete="off"
|
||||
maxlength="6">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="margin-top: 2%;">
|
||||
<label class="layui-form-label">起止塔号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="qz" lay-verify="required" class="layui-input" autocomplete="off"
|
||||
maxlength="60">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" id="formSubmit" class="layui-btn" lay-submit=""
|
||||
lay-filter="formData"
|
||||
style="display: none;"></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-box">
|
||||
<button class="layui-btn layui-btn-normal save" onclick="saveData2()">保存并下载</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closePage()">取消</button>
|
||||
</div>
|
||||
</body>
|
||||
<script src="../../js/synthesisQuery/fillEnvironProForm.js" charset="UTF-8" type="text/javascript"></script>
|
||||
</html>
|
||||
Loading…
Reference in New Issue