|
|
@@ -3,7 +3,6 @@ package com.zd.laboratory.service.impl;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.deepoove.poi.data.PictureRenderData;
|
|
|
import com.deepoove.poi.data.PictureType;
|
|
|
-import com.deepoove.poi.policy.PictureRenderPolicy;
|
|
|
import com.deepoove.poi.util.BufferedImageUtils;
|
|
|
import com.zd.common.core.exception.ServiceException;
|
|
|
import com.zd.common.core.utils.DateUtils;
|
|
|
@@ -14,7 +13,6 @@ import com.zd.laboratory.domain.LabCheckRecordDetails;
|
|
|
import com.zd.laboratory.mapper.LabCheckOptionMapper;
|
|
|
import com.zd.laboratory.mapper.LabCheckRecordDetailsMapper;
|
|
|
import com.zd.laboratory.mapper.LabCheckRecordMapper;
|
|
|
-import com.zd.laboratory.service.ILabCheckOptionService;
|
|
|
import com.zd.laboratory.utils.word.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -22,7 +20,6 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
@@ -35,8 +32,6 @@ public class WordService {
|
|
|
@Autowired
|
|
|
private LabCheckOptionMapper labCheckOptionMapper;
|
|
|
@Autowired
|
|
|
- private ILabCheckOptionService labCheckOptionService;
|
|
|
- @Autowired
|
|
|
private LabCheckRecordMapper labCheckRecordMapper;
|
|
|
@Autowired
|
|
|
private LabCheckRecordDetailsMapper labCheckRecordDetailsMapper;
|
|
|
@@ -104,7 +99,6 @@ public class WordService {
|
|
|
|
|
|
WordUtils.getWord1(word1, list,response);
|
|
|
} catch (IOException e) {
|
|
|
- //e.printStackTrace();
|
|
|
throw new ServiceException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
@@ -119,11 +113,6 @@ public class WordService {
|
|
|
throw new ServiceException("生成失败,ID无效!");
|
|
|
}
|
|
|
|
|
|
- /*String baseUrl = request.getServerName();
|
|
|
- boolean isIntranet = false;
|
|
|
- if(baseUrl.contains("192.168")){
|
|
|
- isIntranet = true;
|
|
|
- }*/
|
|
|
|
|
|
LabCheckRecordDetails labCheckRecordDetails = new LabCheckRecordDetails();
|
|
|
labCheckRecordDetails.setCheckId(checkRecord.getId());
|
|
|
@@ -147,12 +136,10 @@ public class WordService {
|
|
|
if(deptSign == null){
|
|
|
deptSign = "";
|
|
|
}else {
|
|
|
- //deptSign = (isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + deptSign;
|
|
|
//通过配置加载文件域名
|
|
|
deptSign = fileConfigUtils.getFileDomainApp() + deptSign;
|
|
|
}
|
|
|
|
|
|
- //word2.setCheck_dept_sign(new PictureRenderData(100, 100, PictureType.PNG, BufferedImageUtils.getUrlBufferedImage(deptSign)));
|
|
|
word2.setCheck_dept_sign(new SignPictureRenderData(100, 100, deptSign, "图片加载失败", 310 ,-35));
|
|
|
word2.setCheck_dept_name(checkRecord.getJcDwName());
|
|
|
word2.setCheck_result(checkRecord.getZgJg());
|
|
|
@@ -163,8 +150,6 @@ public class WordService {
|
|
|
word2.setNow_day(DateUtil.dayOfMonth(now) + "");
|
|
|
word2.setCheck_room(checkRecord.getFjNumber());
|
|
|
word2.setCheck_date(DateUtil.format(checkRecord.getCreateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
- // 检查人名称 - 2.6 更换为用户签名
|
|
|
- //word2.setCheck_nick_name(checkRecord.getJcRyxm());
|
|
|
|
|
|
String signature = labCheckRecordMapper.selectSignatureByUserId(checkRecord.getCreateUserId());
|
|
|
word2.setCheck_nick_name(new PictureRenderData(100, 30, PictureType.PNG, BufferedImageUtils.getUrlBufferedImage(
|
|
|
@@ -183,11 +168,6 @@ public class WordService {
|
|
|
// 添加检查项 编码之后补充
|
|
|
// 数据形式存在 1,2,3, 1,, 1, 31,,, 等形式,故需要特殊处理
|
|
|
if(checkRecordDetails.get(i).getJcxId() != null){
|
|
|
-// optionId = checkRecordDetails.get(i).getJcxId().substring(0, checkRecordDetails.get(i).getJcxId().lastIndexOf(","));
|
|
|
-// if(optionId.lastIndexOf(",") != -1){
|
|
|
-// optionId = optionId.substring(optionId.lastIndexOf(","));
|
|
|
-// }
|
|
|
-
|
|
|
String[] ids = checkRecordDetails.get(i).getJcxId().split(",");
|
|
|
List<String> list1 = Arrays.asList(ids);
|
|
|
for (int i1 = 0; i1 < list1.size(); i1++) {
|
|
|
@@ -217,24 +197,19 @@ public class WordService {
|
|
|
String yhImgs = checkRecordDetails.get(i).getYhImg();
|
|
|
String[] imgs = yhImgs.split(",");
|
|
|
if(imgs.length > 0){
|
|
|
- //detail.setCheck_img1((isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + imgs[0]);
|
|
|
//通过配置加载文件域名
|
|
|
detail.setCheck_img1(fileConfigUtils.getFileDomainApp() + imgs[0]);
|
|
|
}
|
|
|
if(imgs.length > 1){
|
|
|
- //detail.setCheck_img2((isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + imgs[1]);
|
|
|
detail.setCheck_img2(fileConfigUtils.getFileDomainApp() + imgs[1]);
|
|
|
}
|
|
|
if(imgs.length > 2){
|
|
|
- //detail.setCheck_img3((isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + imgs[2]);
|
|
|
detail.setCheck_img3(fileConfigUtils.getFileDomainApp() + imgs[2]);
|
|
|
}
|
|
|
if(imgs.length > 3){
|
|
|
- //detail.setCheck_img4((isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + imgs[3]);
|
|
|
detail.setCheck_img4(fileConfigUtils.getFileDomainApp() + imgs[3]);
|
|
|
}
|
|
|
if(imgs.length > 4){
|
|
|
- //detail.setCheck_img5((isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + imgs[4]);
|
|
|
detail.setCheck_img5(fileConfigUtils.getFileDomainApp() + imgs[4]);
|
|
|
}
|
|
|
|
|
|
@@ -243,7 +218,6 @@ public class WordService {
|
|
|
|
|
|
WordUtils.getWord2(word2, list,response);
|
|
|
} catch (IOException e) {
|
|
|
- //e.printStackTrace();
|
|
|
throw new ServiceException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
@@ -251,7 +225,7 @@ public class WordService {
|
|
|
/**
|
|
|
* 小程序单个 生成整改报告
|
|
|
*/
|
|
|
- public void genReport(Long id, HttpServletResponse response, HttpServletRequest request) {
|
|
|
+ public void genReport(Long id, HttpServletResponse response) {
|
|
|
try {
|
|
|
|
|
|
LabCheckRecord checkRecord = labCheckRecordMapper.selectLabCheckRecordById(id);
|
|
|
@@ -259,12 +233,6 @@ public class WordService {
|
|
|
throw new ServiceException("生成失败,ID无效!");
|
|
|
}
|
|
|
|
|
|
- /*String baseUrl = request.getServerName();
|
|
|
- boolean isIntranet = false;
|
|
|
- if(baseUrl.contains("192.168")){
|
|
|
- isIntranet = true;
|
|
|
- }*/
|
|
|
-
|
|
|
LabCheckRecordDetails labCheckRecordDetails = new LabCheckRecordDetails();
|
|
|
labCheckRecordDetails.setCheckId(checkRecord.getId());
|
|
|
List<LabCheckRecordDetails> checkRecordDetails = labCheckRecordDetailsMapper.selectLabCheckRecordDetailsList(labCheckRecordDetails);
|
|
|
@@ -333,10 +301,7 @@ public class WordService {
|
|
|
detail.setOption_code("");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
detail.setCheck_desc(checkRecordDetails.get(i).getYhMs());
|
|
|
- // 需注意多个图片的展示情况 - 此处不展示图片
|
|
|
- //detail.setCheck_img(checkRecordDetails.get(i).getYhImg());
|
|
|
list.add(detail);
|
|
|
if(checkRecordDetails.get(i).getIsZg() == null || checkRecordDetails.get(i).getIsZg() == 1){
|
|
|
unCount ++;
|
|
|
@@ -354,23 +319,18 @@ public class WordService {
|
|
|
String yhImgs = checkRecordDetails.get(i).getYhImg();
|
|
|
String[] imgs = yhImgs.split(",");
|
|
|
if(imgs.length > 0){
|
|
|
- //desc.setCheck_img1((isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + imgs[0]);
|
|
|
desc.setCheck_img1(fileConfigUtils.getFileDomainApp() + imgs[0]);
|
|
|
}
|
|
|
if(imgs.length > 1){
|
|
|
- //desc.setCheck_img2((isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + imgs[1]);
|
|
|
desc.setCheck_img2(fileConfigUtils.getFileDomainApp() + imgs[1]);
|
|
|
}
|
|
|
if(imgs.length > 2){
|
|
|
- //desc.setCheck_img3((isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + imgs[2]);
|
|
|
desc.setCheck_img3(fileConfigUtils.getFileDomainApp() + imgs[2]);
|
|
|
}
|
|
|
if(imgs.length > 3){
|
|
|
- //desc.setCheck_img4((isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + imgs[3]);
|
|
|
desc.setCheck_img4(fileConfigUtils.getFileDomainApp() + imgs[3]);
|
|
|
}
|
|
|
if(imgs.length > 4){
|
|
|
- //desc.setCheck_img5((isIntranet ? fileConfigUtils.getLocalUrl() : fileConfigUtils.getRemoteUrl()) + imgs[4]);
|
|
|
desc.setCheck_img5(fileConfigUtils.getFileDomainApp() + imgs[4]);
|
|
|
}
|
|
|
descs.add(desc);
|