Commit 98157e7d by landerliang@163.com

新增查看上传文件(但是不能看大图)

parent 6ba89545
...@@ -32,8 +32,12 @@ public class ReportTask { ...@@ -32,8 +32,12 @@ public class ReportTask {
AssertUtil.isNotNull(jsonObject.get("snKey1"),"缺少授权人签名盘符,自动任务执行终止!"); AssertUtil.isNotNull(jsonObject.get("snKey1"),"缺少授权人签名盘符,自动任务执行终止!");
AssertUtil.isNotNull(jsonObject.get("snKey2"),"缺少批准人签名盘符,自动任务执行终止!"); AssertUtil.isNotNull(jsonObject.get("snKey2"),"缺少批准人签名盘符,自动任务执行终止!");
AssertUtil.isNotNull(jsonObject.get("snKey3"),"缺少公章签名盘符,自动任务执行终止!"); AssertUtil.isNotNull(jsonObject.get("snKey3"),"缺少公章签名盘符,自动任务执行终止!");
AssertUtil.isNotNull(jsonObject.get("snName1"),"缺少授权人签章名称,自动任务执行终止!");
AssertUtil.isNotNull(jsonObject.get("snName2"),"缺少批准人签章名称,自动任务执行终止!");
AssertUtil.isNotNull(jsonObject.get("snName3"),"缺少公章签章名称,自动任务执行终止!");
reportService.autoDownloadAndSignAndUploadReport(jsonObject.getString("account"),jsonObject.getString("password"), reportService.autoDownloadAndSignAndUploadReport(jsonObject.getString("account"),jsonObject.getString("password"),
jsonObject.getString("snKey1"),jsonObject.getString("snKey2"),jsonObject.getString("snKey3")); jsonObject.getString("snKey1"),jsonObject.getString("snKey2"),jsonObject.getString("snKey3"),
jsonObject.getString("snName1"),jsonObject.getString("snName2"),jsonObject.getString("snName3"));
} }
} }
...@@ -39,6 +39,7 @@ public class ReportController { ...@@ -39,6 +39,7 @@ public class ReportController {
} }
@ApiOperation("上传车检文件") @ApiOperation("上传车检文件")
@PostMapping(value = "/uploadReportFilesNotCertificate") @PostMapping(value = "/uploadReportFilesNotCertificate")
@ResponseBody @ResponseBody
...@@ -155,4 +156,13 @@ public class ReportController { ...@@ -155,4 +156,13 @@ public class ReportController {
public ResultVo<IPage<TestReportVo>> page(@RequestBody ReportPageQueryVo pageQueryVo){ public ResultVo<IPage<TestReportVo>> page(@RequestBody ReportPageQueryVo pageQueryVo){
return ResultVo.success(reportService.page(pageQueryVo)); return ResultVo.success(reportService.page(pageQueryVo));
} }
@ApiOperation("查看上传文件个数")
@GetMapping("/showFiles/{businessKey}")
public ResultVo showFiles(@PathVariable String businessKey){
AssertUtil.isNotBlank(businessKey,"缺少参数businessKey");
return ResultVo.success(reportService.getUploadFileList(businessKey));
}
} }
...@@ -22,6 +22,7 @@ import me.zhengjie.modules.system.repository.TaskErrorMapper; ...@@ -22,6 +22,7 @@ import me.zhengjie.modules.system.repository.TaskErrorMapper;
import me.zhengjie.modules.system.repository.UserMapper; import me.zhengjie.modules.system.repository.UserMapper;
import me.zhengjie.modules.system.util.CarReportUtil; import me.zhengjie.modules.system.util.CarReportUtil;
import me.zhengjie.utils.AssertUtil; import me.zhengjie.utils.AssertUtil;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
...@@ -36,6 +37,7 @@ import org.springframework.web.client.RestTemplate; ...@@ -36,6 +37,7 @@ import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Encoder; import sun.misc.BASE64Encoder;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -93,6 +95,32 @@ public class ReportService { ...@@ -93,6 +95,32 @@ public class ReportService {
); );
} }
/**
* 获取上传文件显示页面
* @param businessKey
* @return
*/
public String getUploadFileList(String businessKey){
Long currentUserId = SecurityUtils.getCurrentUserId();
AssertUtil.isNotNull(currentUserId,"登录身份已失效请重新登录");
SysUserVo sysUserVo = userMapper.selectById(currentUserId);
AssertUtil.isNotNull(sysUserVo,"登录身份已失效请重新登录");
DeptVo deptVo = deptMapper.getById(sysUserVo.getDeptId());
AssertUtil.isNotNull(deptVo,"查询不到当前用户的部门信息");
String s = null;
try {
s = carReportUtil.downloadUploadFilesView(deptVo.getEpAccount(), deptVo.getEpPassword(),businessKey);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException(e.getCause().getMessage());
}
return s;
}
/** /**
* 自动下载检测报告并签章上传 * 自动下载检测报告并签章上传
*/ */
...@@ -126,11 +154,11 @@ public class ReportService { ...@@ -126,11 +154,11 @@ public class ReportService {
reportPdfMapper.insert(reportPdfVo); reportPdfMapper.insert(reportPdfVo);
//根据snKey查询签章信息 //根据snKey查询签章信息
SignatureVo signatureVo1 = signatureService.getBySnKey(snKey1); SignatureVo signatureVo1 = signatureService.getBySnKeyAndSnName(snKey1,snName1);
AssertUtil.isNotNull(signatureVo1,"找不到snKey为: " + snKey1 + "的签名章"); AssertUtil.isNotNull(signatureVo1,"找不到snKey为: " + snKey1 + "的签名章");
SignatureVo signatureVo2 = signatureService.getBySnKey(snKey2); SignatureVo signatureVo2 = signatureService.getBySnKeyAndSnName(snKey2,snName2);
AssertUtil.isNotNull(signatureVo2,"找不到snKey为: " + snKey2 + "的签名章"); AssertUtil.isNotNull(signatureVo2,"找不到snKey为: " + snKey2 + "的签名章");
SignatureVo signatureVo3 = signatureService.getBySnKey(snKey3); SignatureVo signatureVo3 = signatureService.getBySnKeyAndSnName(snKey3,snName3);
AssertUtil.isNotNull(signatureVo3,"找不到snKey为: " + snKey3 + "的公章"); AssertUtil.isNotNull(signatureVo3,"找不到snKey为: " + snKey3 + "的公章");
//进行签章 //进行签章
...@@ -157,11 +185,12 @@ public class ReportService { ...@@ -157,11 +185,12 @@ public class ReportService {
} }
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
//记录错误信息 //记录错误信息
log.error(e.getCause().getMessage()); log.error(e.getCause().getMessage());
TaskErrorVo taskErrorVo = new TaskErrorVo(); TaskErrorVo taskErrorVo = new TaskErrorVo();
taskErrorVo.setCreateTime(DateUtil.date()); taskErrorVo.setCreateTime(DateUtil.date());
taskErrorVo.setErrMsg(e.getCause().getMessage()); taskErrorVo.setErrMsg(e.getCause().getMessage()==null?e.getMessage():e.getCause().getMessage());
taskErrorMapper.insert(taskErrorVo); taskErrorMapper.insert(taskErrorVo);
} }
} }
...@@ -238,6 +267,7 @@ public class ReportService { ...@@ -238,6 +267,7 @@ public class ReportService {
* @return * @return
*/ */
public ReportPdfVo signature(SignReportVo signReportVo){ public ReportPdfVo signature(SignReportVo signReportVo){
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
AssertUtil.isNotNull(authentication,"登录身份已失效请重新登录"); AssertUtil.isNotNull(authentication,"登录身份已失效请重新登录");
UserDetails userDetails = (UserDetails) authentication.getPrincipal(); UserDetails userDetails = (UserDetails) authentication.getPrincipal();
......
...@@ -44,8 +44,8 @@ public class SignatureService { ...@@ -44,8 +44,8 @@ public class SignatureService {
* @param snKey * @param snKey
* @return * @return
*/ */
public SignatureVo getBySnKey(String snKey){ public SignatureVo getBySnKeyAndSnName(String snKey,String snName){
return signatureMapper.selectOne(new QueryWrapper<SignatureVo>().lambda().eq(SignatureVo::getSnKey,snKey)); return signatureMapper.selectOne(new QueryWrapper<SignatureVo>().lambda().and(i -> i.eq(SignatureVo::getSnKey,snKey).eq(SignatureVo::getSnName,snName)));
} }
/** /**
......
...@@ -17,12 +17,10 @@ import me.zhengjie.exception.BusinessException; ...@@ -17,12 +17,10 @@ import me.zhengjie.exception.BusinessException;
import me.zhengjie.modules.system.constants.MyConstants; import me.zhengjie.modules.system.constants.MyConstants;
import me.zhengjie.modules.system.domain.vo.report.*; import me.zhengjie.modules.system.domain.vo.report.*;
import me.zhengjie.utils.AssertUtil; import me.zhengjie.utils.AssertUtil;
import me.zhengjie.utils.StringUtils;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.openqa.selenium.By; import org.openqa.selenium.*;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.Select;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -30,6 +28,8 @@ import org.springframework.stereotype.Component; ...@@ -30,6 +28,8 @@ import org.springframework.stereotype.Component;
import sun.misc.BASE64Encoder; import sun.misc.BASE64Encoder;
import java.io.File; import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -49,6 +49,8 @@ public class CarReportUtil { ...@@ -49,6 +49,8 @@ public class CarReportUtil {
private String likeUrl; private String likeUrl;
@Value("${like.uploadFileUrl}") @Value("${like.uploadFileUrl}")
private String uploadFileUrl; private String uploadFileUrl;
@Value("${like.showFilesUrl}")
private String showFilesUrl;
@Value("${like.host}") @Value("${like.host}")
private String host; private String host;
@Value("${file.linux.report}") @Value("${file.linux.report}")
...@@ -58,6 +60,36 @@ public class CarReportUtil { ...@@ -58,6 +60,36 @@ public class CarReportUtil {
@Value("${uploadFilePath}") @Value("${uploadFilePath}")
private String uploadFilePath; private String uploadFilePath;
/**
* 爬取上传文件显示页
* @param account
* @param password
* @return
*/
public String downloadUploadFilesView(String account,String password,String businessKey) throws InterruptedException {
WebDriver webDriver = loginEp(account, password, null);
Object[] cookies = webDriver.manage().getCookies().toArray();
AssertUtil.isTrue(cookies != null && cookies.length>0,"登录环保系统失败,获取不到信息请重试");
webDriver.get(showFilesUrl + "?businesskey=" + businessKey + "&ColumnCount=3&businessType=11");
//延迟加载html
webDriver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS)
.setScriptTimeout(60,TimeUnit.SECONDS).pageLoadTimeout(120,TimeUnit.SECONDS);
Thread.sleep(2000);
String body = webDriver.getPageSource();
body = body.replace("../../Scripts",host + "/Scripts")
.replace("../../Entities/",host + "/Entities/");
Document parse = Jsoup.parse(body);
return parse.toString();
}
/** /**
* 上传post * 上传post
* @param formData * @param formData
...@@ -406,15 +438,24 @@ public class CarReportUtil { ...@@ -406,15 +438,24 @@ public class CarReportUtil {
stationCodvO.setVals(Arrays.asList(stationCode)); stationCodvO.setVals(Arrays.asList(stationCode));
conditionVoList.add(stationCodvO); conditionVoList.add(stationCodvO);
//是否过滤已上传的 //是否检测通过
if(reportPageQueryVo.getIsZero() == 1){ /*if(reportPageQueryVo.getIsZero() == 1){
ConditionVo carNumVo=new ConditionVo(); ConditionVo carNumVo=new ConditionVo();
carNumVo.setFld(MyContext.VDCT_FLD); carNumVo.setFld(MyContext.VDCT_FLD);
carNumVo.setFldtype(MyContext.FLD_TYPE); carNumVo.setFldtype(MyContext.FLD_TYPE);
carNumVo.setOp(MyContext.VDCT_OP); carNumVo.setOp(MyContext.VDCT_OP);
carNumVo.setVals(Arrays.asList("0")); carNumVo.setVals(Arrays.asList("0"));
conditionVoList.add(carNumVo); conditionVoList.add(carNumVo);
} }*/
/*if(reportPageQueryVo.getIsZero() == 1){
ConditionVo carNumVo=new ConditionVo();
carNumVo.setFld("PDFCount");
carNumVo.setFldtype(MyContext.FLD_TYPE);
carNumVo.setOp(MyContext.VDCT_OP);
carNumVo.setVals(Arrays.asList("0"));
conditionVoList.add(carNumVo);
}*/
//如果车牌号不为空 //如果车牌号不为空
if(StrUtil.isNotBlank(reportPageQueryVo.getCarNum())){ if(StrUtil.isNotBlank(reportPageQueryVo.getCarNum())){
...@@ -462,6 +503,9 @@ public class CarReportUtil { ...@@ -462,6 +503,9 @@ public class CarReportUtil {
JSONObject body = JSONUtil.createObj(); JSONObject body = JSONUtil.createObj();
body.put("data",queryDataVo); body.put("data",queryDataVo);
body.put("rows",reportPageQueryVo.getSize()); body.put("rows",reportPageQueryVo.getSize());
if(reportPageQueryVo.getIsZero() == 1){
body.put("UploadDate","");
}
body.put("page",reportPageQueryVo.getCurrNo()); body.put("page",reportPageQueryVo.getCurrNo());
body.put("sort","DetectEndTime"); body.put("sort","DetectEndTime");
body.put("order","DESC"); body.put("order","DESC");
...@@ -731,7 +775,7 @@ public class CarReportUtil { ...@@ -731,7 +775,7 @@ public class CarReportUtil {
/** /**
* 获取最新五条检测报告 * 获取最新五条没上传文件的检测报告
* @param stationCode * @param stationCode
* @param cookies * @param cookies
* @return * @return
...@@ -753,7 +797,7 @@ public class CarReportUtil { ...@@ -753,7 +797,7 @@ public class CarReportUtil {
//开始检索 按照检测时间倒叙 目前只检索最新的5条 //开始检索 按照检测时间倒叙 目前只检索最新的5条
QueryDataVo queryDataVo=new QueryDataVo(MyContext.INSPEC_TABLE, QueryDataVo queryDataVo=new QueryDataVo(MyContext.INSPEC_TABLE,
MyContext.PHOTO_TABLE_NAME,MyContext.PHOTO_WHERE,fldsVo.getFld(),conditionVoList,null,5); MyContext.PHOTO_TABLE_NAME,MyContext.ESIGN_NULL,fldsVo.getFld(),conditionVoList,null,5);
JSONObject body = JSONUtil.createObj(); JSONObject body = JSONUtil.createObj();
body.put("data",queryDataVo); body.put("data",queryDataVo);
body.put("rows",5); body.put("rows",5);
......
...@@ -26,6 +26,9 @@ public class MyContext { ...@@ -26,6 +26,9 @@ public class MyContext {
//检索车检表 photowhere //检索车检表 photowhere
public static final String PHOTO_WHERE = "u.BusinessKey = a.InspectionNum"; public static final String PHOTO_WHERE = "u.BusinessKey = a.InspectionNum";
//检索车检表为空
public static final String ESIGN_NULL = "u.BusinessKey = a.InspectionNum AND a.UploadDate IS NULL";
//通用字符op //通用字符op
public static final String NORMAL_OP = "like"; public static final String NORMAL_OP = "like";
//通用 filtype //通用 filtype
...@@ -56,6 +59,7 @@ public class MyContext { ...@@ -56,6 +59,7 @@ public class MyContext {
//车牌号检索 fld //车牌号检索 fld
public static final String VLPN_FLD = "VLPN"; public static final String VLPN_FLD = "VLPN";
//文件个数检索 fld //文件个数检索 fld
public static final String VDCT_FLD = "VDCT"; public static final String VDCT_FLD = "VDCT";
//文件个数 op //文件个数 op
......
...@@ -78,6 +78,7 @@ like: ...@@ -78,6 +78,7 @@ like:
uploadFileUrl: http://10.48.21.198:8899/uploadFile/UploadFileData/SaveUploadVIMFiles uploadFileUrl: http://10.48.21.198:8899/uploadFile/UploadFileData/SaveUploadVIMFiles
url: http://10.48.21.198:8899/businesscom/common/DataAndPhotoPageQuery url: http://10.48.21.198:8899/businesscom/common/DataAndPhotoPageQuery
inspectReportUrl: http://10.48.21.198:8899/Addins_NanNing/Template/InspectionReport_GasMethod_NN.aspx inspectReportUrl: http://10.48.21.198:8899/Addins_NanNing/Template/InspectionReport_GasMethod_NN.aspx
showFilesUrl: http://10.48.21.198:8899/Addins/Template/DocumentList.aspx
#签章 #签章
kinggrid: kinggrid:
......
#뻔괏되쩌토零
login.userName=lanbin
login.userPassword=XXt123456/
login.loginURL=http://10.48.21.198:8899/Login.aspx
login.defualtUrl=http://10.48.21.198:8899/default.aspx
#뻔괏쇱乞토零
like.host=http://10.48.21.198:8899/
like.url=http://10.48.21.198:8899/businesscom/common/DataAndPhotoPageQuery
like.inspectReportUrl=http://10.48.21.198:8899/Addins_NanNing/Template/InspectionReport_GasMethod_NN.aspx
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment