Merge branch 'develop_master' into origin/Three

This commit is contained in:
张超然
2021-11-30 09:25:34 +08:00
152 changed files with 4538 additions and 627 deletions
@@ -44,6 +44,9 @@ public interface workFlowFeignClient {
@RequestMapping(value = "/bat-wkflow/todoTaskList",method = RequestMethod.POST)
List<BusProcessName> todoTaskListByUserId(@RequestBody TaskCommonQuery taskCommonQuery);
@RequestMapping(value = "/bat-wkflow/todoTaskListNew",method = RequestMethod.POST)
List<BusProcessName> todoTaskListByUserIdNew(@RequestBody TaskCommonQuery taskCommonQuery);
@RequestMapping(value = "/bat-wkflow/completeTask",method = RequestMethod.POST)
Wrapper<String> completeTaskByUserId(@RequestBody BusMes busMes);
@@ -64,6 +64,11 @@ public class workFlowFeignClientImpl {
return mapWrapper;
}
public List<BusProcessName> todoTaskListByUserIdNew(@RequestBody TaskCommonQuery taskCommonQuery){
List<BusProcessName> mapWrapper = workFlowFeignClient.todoTaskListByUserId(taskCommonQuery);
return mapWrapper;
}
/**
* 开始分页
* @param list
@@ -46,6 +46,11 @@ public class ActDefineStartMap {
map.put("18","policyResearchGroupAttendMeeting");
map.put("19","policyResearchGroupAfterMeeting");
//企标复审流程
map.put("23","enterpriseBidReviewProcess");
map.put("24","Aboliish");
map.put("25","enterpriseStandardSystemRevisionPlan");
return map.get(type);
}
}
@@ -56,7 +56,7 @@ public class PolicyWorkFlowController {
private PolicyWorkFlowService policyWorkFlowService;
/**
* 政策征求意见导出
* 纳入重点问题管控
*/
@PostMapping("/enterIssue")
@ApiOperation("纳入重点问题管控")
@@ -280,6 +280,27 @@ public class WorkFlowController {
return pageInfo;
}
@ApiOperation(value = "我的待办任务列表")
@PostMapping("/todoTaskListNew")
public PageInfo<BusProcessName> todoTaskListNew(@RequestBody TaskCommonQuery taskCommonQuery){
List<BusProcessName> busProcessNames = workFlowFeignClient.todoTaskListByUserId(taskCommonQuery);
List list1 = this.startPage(busProcessNames, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
PageInfo<BusProcessName> pageInfo= new PageInfo<BusProcessName>();
if(busProcessNames!=null){
pageInfo.setList(list1);
pageInfo.setPageNo(taskCommonQuery.getCurrent());
pageInfo.setCount(Long.valueOf(busProcessNames.size()));
pageInfo.setPageSize(taskCommonQuery.getSize());
}else{
List<BusProcessName> list = new ArrayList<>();
pageInfo.setList(list);
pageInfo.setPageNo(taskCommonQuery.getCurrent());
pageInfo.setCount(Long.valueOf(0));
pageInfo.setPageSize(taskCommonQuery.getSize());
}
return pageInfo;
}
@ApiOperation(value = "完成任务")
@PostMapping("/completeTask")
public Wrapper<String> completeTaskByUserId( BusMes busMes){
@@ -21,9 +21,11 @@ public class PolicyWorkFlowService {
public boolean enterIssue(String json){
boolean count=false; //是否成功
JSONObject dataJsonObj = JSONObject.parseObject(json);
JSONObject jsonData = dataJsonObj.getJSONObject("json");
if ("1".equals(dataJsonObj.getString("department"))) {
JSONArray dataList = dataJsonObj.getJSONArray("dataList");
if ("1".equals( jsonData.getString("feedbackDept"))) {
JSONArray dataList = jsonData.getJSONArray("infoTableDatas");
/**
* 把json对象转换未实体对象
@@ -31,11 +33,15 @@ public class PolicyWorkFlowService {
List<BusinessDeptIssue> data = dataList
.stream()
.map(jsonObj -> {
BusinessDeptIssue businessDeptIssue = JSONObject.parseObject(jsonObj.toString(), BusinessDeptIssue.class);
businessDeptIssue.setLawId(businessDeptIssue.getId());
businessDeptIssue.setId(UUIDUtils.randomUUID20());
businessDeptIssue.setIsClose("0");
return businessDeptIssue;
}).collect(Collectors.toList());
}).collect(Collectors.toList())
.stream()
.filter(item->"1".equals(item.getIsRisk()))
.collect(Collectors.toList());
count=businessDeptIssueService.saveBatch(data);
}
@@ -49,18 +49,19 @@ public class WaterMarkUtil {
// set Transparency
PdfGState gs = new PdfGState();
// 设置透明度为0.2
gs.setFillOpacity(0.5f);
gs.setFillOpacity(0.25f);
under.setGState(gs);
under.restoreState();
under.beginText();
under.setFontAndSize(base, 25);
under.setFontAndSize(base, 50);
under.setTextMatrix(30, 30);
under.setColorFill(BaseColor.LIGHT_GRAY);
for (int y = 0; y < 10; y++) {
for (int x = 0; x < 8; x++) {
for (int y = 0; y < 5; y++) {
for (int x = 0; x < 10; x++) {
// 水印文字成45度角倾斜
under.showTextAligned(Element.ALIGN_LEFT
, waterMarkName, 100 + 300 * x, 300 * y, 45); }
, waterMarkName, 100 + 300 * x, 300 * y, 40);
}
}
// 添加水印文字
+37 -1
View File
@@ -22,6 +22,42 @@
<artifactId>adc-da-sys</artifactId>
<version>3.0.0</version>
</dependency>
<!-- 导入本地jar -->
<!-- 操作ppt -->
<dependency>
<groupId>com.artofsolving</groupId>
<artifactId>jodconverter</artifactId>
<scope>system</scope>
<version>2.2.2</version>
<systemPath>${basedir}/src/main/lib/jodconverter-2.2.2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/aspose-words-15.8.0-jdk16.jar</systemPath>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>8.5.2</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/aspose-cells-8.5.2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>16.7.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/aspose.slides-16.7.0.jar</systemPath>
</dependency>
<!-- 操作文本文件-->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
</dependency>
<!-- openOffice 和 jobconverter-->
<dependency>
@@ -46,7 +82,7 @@
<artifactId>jodconverter-local</artifactId>
<version>4.3.0</version>
</dependency>
<!-- openOffice end-->
<!-- openOffice end-->
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>juh</artifactId>
@@ -0,0 +1,37 @@
package com.adc.da.convert.common;
import org.apache.commons.lang.StringUtils;
public class AsposeOfficeConvertUtils {
public static void convertOfficeFileToPDF(String fileType,String attFilePath,String savePdfPath) throws Exception {
if(StringUtils.isNotBlank(fileType)){
//去掉文件类型中的点
fileType = fileType.replace(".","");
fileType = fileType.toUpperCase();
switch (fileType){
case "DOC":
WordTPdfUtils.doc2pdf(attFilePath,savePdfPath);
break;
case "DOCX":
WordTPdfUtils.doc2pdf(attFilePath,savePdfPath);
break;
case "PPT":
SlidesTPdfUtils.ppt2pdf(attFilePath,savePdfPath);
break;
case "PPTX":
SlidesTPdfUtils.ppt2pdf(attFilePath,savePdfPath);
break;
case "XLS":
ExcelTPdfUtils.excel2pdf(attFilePath,savePdfPath);
break;
case "XLSX":
ExcelTPdfUtils.excel2pdf(attFilePath,savePdfPath);
break;
}
}
}
}
@@ -0,0 +1,122 @@
package com.adc.da.convert.common;
import com.aspose.cells.PdfSaveOptions;
import com.aspose.cells.Workbook;
import com.aspose.cells.License;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;
import org.aspectj.weaver.ast.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
public class ExcelTPdfUtils {
private static final Logger logger = LoggerFactory.getLogger(WordTPdfUtils.class);
private static final String myLicense = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
/**
* 获取license 去除水印
* @return
*/
public static boolean getLicense() {
boolean result = false;
try {
ByteArrayInputStream is = new ByteArrayInputStream(myLicense.getBytes());
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return result;
}
/**
* excel 转为pdf 输出。
*
* @param sourceFilePath excel文件
* @param desFilePathd pad 输出文件目录
*/
public static void excel2pdf(String sourceFilePath, String desFilePathd ) throws Exception {
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
return;
}
File file = new File(desFilePathd); // 新建一个空白pdf文档
FileOutputStream fileOS = null;
try {
fileOS = new FileOutputStream(desFilePathd);
long old = System.currentTimeMillis();
Workbook wb = new Workbook(sourceFilePath);// 原始excel路径
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setOnePagePerSheet(true);
int[] autoDrawSheets={3};
//当excel中对应的sheet页宽度太大时,在PDF中会拆断并分页。此处等比缩放。
// autoDraw(wb,autoDrawSheets);
int[] showSheets={0};
//隐藏workbook中不需要的sheet页。
printSheetPage(wb,showSheets);
wb.save(fileOS, pdfSaveOptions);
fileOS.flush();
fileOS.close();
long now = System.currentTimeMillis();
logger.info("转换文档:"+sourceFilePath+" "+"共耗时:" + ((now - old) / 1000.0) + "");
} catch (Exception e) {
if(fileOS!=null){
fileOS.flush();
fileOS.close();
}
file.delete();
logger.error("Document Convert Error:"+sourceFilePath);
logger.error(e.getMessage(),e);
throw new Exception("Document Convert Error:"+sourceFilePath);
}
}
/**
* 设置打印的sheet 自动拉伸比例
* @param wb
* @param page 自动拉伸的页的sheet数组
*/
public static void autoDraw(Workbook wb,int[] page){
if(null!=page&&page.length>0){
for (int i = 0; i < page.length; i++) {
wb.getWorksheets().get(i).getHorizontalPageBreaks().clear();
wb.getWorksheets().get(i).getVerticalPageBreaks().clear();
}
}
}
/**
* 隐藏workbook中不需要的sheet页。
* @param wb
* @param page 显示页的sheet数组
*/
public static void printSheetPage(Workbook wb,int[] page){
for (int i= 1; i < wb.getWorksheets().getCount(); i++) {
wb.getWorksheets().get(i).setVisible(false);
}
if(null==page||page.length==0){
wb.getWorksheets().get(0).setVisible(true);
}else{
for (int i = 0; i < page.length; i++) {
wb.getWorksheets().get(i).setVisible(true);
}
}
}
public static void main(String[] args) {
String sourceFilePath="E:\\EXCELTEXT\\一阶段问题清单426.xlsx";
String desFilePath="E:\\EXCELTEXT\\一阶段问题清单426.pdf";
try {
excel2pdf(sourceFilePath, desFilePath);
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
}
}
@@ -0,0 +1,72 @@
package com.adc.da.convert.common;
import com.aspose.slides.Presentation;
import com.aspose.slides.License;
import com.aspose.slides.SaveFormat;
import org.aspectj.weaver.ast.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
/**
* 采用破解版的Aspire插件转换文件
*/
public class SlidesTPdfUtils {
private static final Logger logger = LoggerFactory.getLogger(SlidesTPdfUtils.class);
private static final String myLicense = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
public static boolean getLicense() {
boolean result = false;
try {
ByteArrayInputStream is = new ByteArrayInputStream(myLicense.getBytes());
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return result;
}
public static void ppt2pdf(String inPath, String outPath) throws Exception{
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
return;
}
File file = new File(outPath); // 新建一个空白pdf文档
FileOutputStream os =null;
try {
long old = System.currentTimeMillis();
os = new FileOutputStream(file);
Presentation pres = new Presentation(inPath);
pres.save(os, SaveFormat.Pdf);
os.flush();
os.close();
// EPUB, XPS, SWF 相互转换
long now = System.currentTimeMillis();
logger.info("转换文档:"+inPath+" "+"共耗时:" + ((now - old) / 1000.0) + "");
} catch (Exception e) {
if(os!=null){
os.flush();
os.close();
}
file.delete();
logger.error("Document Convert Error:"+inPath);
logger.error(e.getMessage(),e);
throw new Exception("Document Convert Error:"+inPath);
}
}
public static void main(String[] args) throws Exception {
String sourceFilePath="E:\\PPTTEXT\\2.pptx";
String desFilePath="E:\\PPTTEXT\\2.pdf";
ppt2pdf(sourceFilePath, desFilePath);
}
}
@@ -0,0 +1,65 @@
package com.adc.da.convert.common;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import com.adc.da.util.exception.AdcDaBaseException;
import com.aspose.words.Document;
import org.aspectj.weaver.ast.Test;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 采用破解版的Aspire插件转换文件
*/
public class WordTPdfUtils {
private static final Logger logger = LoggerFactory.getLogger(WordTPdfUtils.class);
private static final String myLicense = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
public static boolean getLicense() {
boolean result = false;
try {
ByteArrayInputStream is = new ByteArrayInputStream(myLicense.getBytes());
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return result;
}
public static void doc2pdf(String inPath, String outPath) throws Exception{
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
return;
}
File file = new File(outPath); // 新建一个空白pdf文档
FileOutputStream os = new FileOutputStream(file);
try {
long old = System.currentTimeMillis();
Document doc = new Document(inPath); // Address是将要被转化的word文档
doc.save(os, SaveFormat.PDF);// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,
os.flush();
os.close();
// EPUB, XPS, SWF 相互转换
long now = System.currentTimeMillis();
logger.info("转换文档:"+inPath+" "+"共耗时:" + ((now - old) / 1000.0) + "");
} catch (Exception e) {
if(os!=null){
os.flush();
os.close();
}
file.delete();
logger.error("Document Convert Error:"+inPath);
logger.error(e.getMessage(),e);
throw new Exception("Document Convert Error:"+inPath);
}
}
}
@@ -4,12 +4,15 @@ import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.common.SarTypeEnum;
import com.adc.da.common.UseModuleEnum;
import com.adc.da.convert.common.AsposeOfficeConvertUtils;
import com.adc.da.convert.common.DocConverterPdf;
import com.adc.da.mq.CreateMQService;
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
import com.adc.da.slrs.otConvertMq.service.IOtConvertMqService;
import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile;
import com.adc.da.slrs.sarLawsFile.dao.SarLawsFileDao;
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao;
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
import com.adc.da.sys.util.LoginUserUtil;
@@ -62,6 +65,9 @@ public class SendConvertMQService {
@Autowired
private SarBussStandFileDao sarBussStandFileEODao;
@Autowired
private SarLawsFileDao sarLawsFileDao;
private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class);
@RabbitListener(bindings = @QueueBinding(
@@ -152,6 +158,7 @@ public class SendConvertMQService {
public ResponseMessage docUploadConvert(OtConvertMq convertMqEO) throws Exception{
//保存在数据库中的ID
String path = localFilePath + convertMqEO.getFilePath();
path = path.replace("//","/");
String convertId = convertMqEO.getId();
try {
//进入转换方法中,修改OT_CONVERT表中状态为转换中
@@ -164,24 +171,28 @@ public class SendConvertMQService {
String converfilename = path.replaceAll("\\\\", "/");
logger.info("*****上传路径:*******"+localFilePath);
logger.info("************文件路径:**********" + convertMqEO.getFilePath());
logger.info("************接口:**********" + port);
// logger.info("************接口:**********" + port);
logger.info("*****上传路径替换,加入文件名*******"+converfilename);
//截取文件类型
int index = converfilename.lastIndexOf(".");
String fileType = converfilename.substring(index,converfilename.length());
String fileOriName = converfilename.substring(0,index);
//调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
d.setConvertHost(convertHost);
//调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
File getPdf = d.conver(fileType);
//调用getswfPath()方法,打印转换后的swf文件路径
String dPath = d.getpdfPath();
logger.info("*****转换后的pdf文件路径*******"+dPath);
// //调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
// DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
// d.setConvertHost(convertHost);
// //调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
// File getPdf = d.conver(fileType);
// //调用getswfPath()方法,打印转换后的swf文件路径
// String dPath = d.getpdfPath();
String savePdfFileName = converfilename.substring(0, converfilename.lastIndexOf("."));
String savePdfPath = savePdfFileName+".pdf";
AsposeOfficeConvertUtils.convertOfficeFileToPDF(fileType,converfilename,savePdfPath);
File pdfFile = new File(savePdfPath);
logger.info("*****转换后的pdf文件路径*******"+savePdfPath);
//判断是否转换成功,修改数据状态
if(!dPath.isEmpty() && getPdf.length()>0){
if(!savePdfPath.isEmpty() && pdfFile.length()>0){
// 上传转换后文件
String pdfId = attFileEOService.saveFileAttId(getPdf);
String pdfId = attFileEOService.saveFileAttId(pdfFile);
logger.info("////////转换后文件id"+pdfId);
int count = 0;
if("0".equals(convertMqEO.getAddOrUp())){
@@ -212,11 +223,11 @@ public class SendConvertMQService {
convertMqEO.setModifyTime(new Date());
convertMqEO.setMqState(2);
convertMqEOService.updateById(convertMqEO);
if(convertMqEO.getAgainNum()<=5){
throw new Exception("转换失败");
}
// if(convertMqEO.getAgainNum()<=5){
// throw new Exception("转换失败");
// }
}
return Result.success(dPath);
return Result.success(savePdfPath);
} else {
logger.error("转换时未获取到文件路径!");
return Result.error("文件存储失败,请重试");
@@ -228,7 +239,7 @@ public class SendConvertMQService {
convertMqEO.setId(convertId);
convertMqEO.setMqState(2);
convertMqEOService.updateById(convertMqEO);
this.restartUploadConvert(convertMqEO);
// this.restartUploadConvert(convertMqEO);
return Result.error("r0072", "文件转换失败,请重试");
}
}
@@ -270,14 +281,14 @@ public class SendConvertMQService {
lawsFile.setModifyTime(new Date());
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
countSuccess = sarStandFileEODao.updateByPrimaryKeySelective(lawsFile);
} else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) {
// SarLawsFile lawsFile = new SarLawsFile();
// lawsFile.setId(convertMq.getPdfId());
// lawsFile.setAttId(pdfId);
// lawsFile.setOriAttId(convertMq.getOriAttId());
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
// lawsFile.setModifyTime(new Date());
// countSuccess = sarLawsFileEODao.updateByPrimaryKeySelective(lawsFile);
} else if (SarTypeEnum.LAWS_STAND.getValue().equals(convertMq.getConvertType())) {
SarLawsFile lawsFile = new SarLawsFile();
lawsFile.setId(convertMq.getPdfId());
lawsFile.setAttId(pdfId);
lawsFile.setOriAttId(convertMq.getOriAttId());
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
lawsFile.setModifyTime(new Date());
countSuccess = sarLawsFileDao.updateByPrimaryKeySelective(lawsFile);
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
SarBussStandFile lawsFile = new SarBussStandFile();
lawsFile.setId(convertMq.getPdfId());
@@ -336,21 +347,21 @@ public class SendConvertMQService {
lawsFile.setFileName(fileOriName+".pdf");
lawsFile.setFileSuffix("pdf");
countSuccess = sarStandFileEODao.insertSelective(lawsFile);
} else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) {
// SarLawsFile lawsFile = new SarLawsFile();
// lawsFile.setId(UUID.randomUUID(20));
// lawsFile.setLawsId(convertMq.getLawsId());
// lawsFile.setResId(convertMq.getResId());
// lawsFile.setAttId(pdfId);
// lawsFile.setOriAttId(convertMq.getOriAttId());
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
// lawsFile.setValidFlag("0");
// lawsFile.setCreationTime(new Date());
// lawsFile.setModifyTime(new Date());
// lawsFile.setLawsFileClassify(convertMq.getLawsFileClassify());
// lawsFile.setFileName(fileOriName+".pdf");
// lawsFile.setFileSuffix("pdf");
// countSuccess = sarLawsFileEODao.insertSelective(lawsFile);
} else if (SarTypeEnum.LAWS_STAND.getValue().equals(convertMq.getConvertType())) {
SarLawsFile lawsFile = new SarLawsFile();
lawsFile.setId(UUID.randomUUID(20));
lawsFile.setLawsId(convertMq.getLawsId());
lawsFile.setResId(convertMq.getResId());
lawsFile.setAttId(pdfId);
lawsFile.setOriAttId(convertMq.getOriAttId());
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
lawsFile.setValidFlag(0);
lawsFile.setCreationTime(new Date());
lawsFile.setModifyTime(new Date());
lawsFile.setLawsFileClassify(convertMq.getLawsFileClassify());
lawsFile.setFileName(fileOriName+".pdf");
lawsFile.setFileSuffix("pdf");
countSuccess = sarLawsFileDao.insertSelective(lawsFile);
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
SarBussStandFile lawsFile = new SarBussStandFile();
lawsFile.setId(UUID.randomUUID(20));
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,14 @@
<License>
<Data>
<Products>
<Product>Aspose.Total for Java</Product>
<Product>Aspose.Words for Java</Product>
</Products>
<EditionType>Enterprise</EditionType>
<SubscriptionExpiry>20991231</SubscriptionExpiry>
<LicenseExpiry>20991231</LicenseExpiry>
<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
</Data>
<Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=
</Signature>
</License>
@@ -75,6 +75,12 @@ public class WebMvcConfig implements WebMvcConfigurer {
addInterceptor.excludePathPatterns("/api/sarStandProjectLibrary/exportStandAttrInfoExcel");
// 拆分查看页,导出程序异常
addInterceptor.excludePathPatterns("/api/lawss/sarFileSplitItems/exportSplitInfoZip");
//调研流程下载接口
addInterceptor.excludePathPatterns("/api/att/attFile/downloadFile");
// //测试接口使用
// addInterceptor.excludePathPatterns("/api/**");
@@ -61,6 +61,7 @@ spring.rabbitmq.listener.simple.retry.max-attempts= 5
# 文档存储路径指向
# ==============================================
file.path=/usr/laws/file/
file.split.path=/usr/laws/file/
# 云端OCR识别集成配置参数
#OCR请求识别URL地址
@@ -31,5 +31,6 @@ public class WarningEO extends EarlyWarningEO {
private String standYear;
private String issueTime;
}
@@ -0,0 +1,81 @@
package com.adc.da.slrs.ImportExcelDatas.POIUtil;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DateUtil;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
@Component
public class POIUtil {
//获取单元格各类型值,返回字符串类型
public static String getCellValueByCell(Cell cell) {
//判断是否为null或空串
if (cell==null || cell.toString().trim().equals("")) {
return "";
}
String cellValue = "";
CellType cellType = cell.getCellType();
cell.getCellType();
switch (cellType) {
case NUMERIC: // 数字
short format = cell.getCellStyle().getDataFormat();
if (DateUtil.isCellDateFormatted(cell)) {
SimpleDateFormat sdf = null;
//System.out.println("cell.getCellStyle().getDataFormat()="+cell.getCellStyle().getDataFormat());
if (format == 20 || format == 32) {
sdf = new SimpleDateFormat("HH:mm");
} else if (format == 14 || format == 31 || format == 57 || format == 58) {
// 处理自定义日期格式:m月d日(通过判断单元格的格式id解决,id的值是58)
sdf = new SimpleDateFormat("yyyy-MM-dd");
double value = cell.getNumericCellValue();
Date date = org.apache.poi.ss.usermodel.DateUtil
.getJavaDate(value);
cellValue = sdf.format(date);
}else {// 日期
sdf = new SimpleDateFormat("yyyy-MM-dd");
}
try {
cellValue = sdf.format(cell.getDateCellValue());// 日期
} catch (Exception e) {
try {
throw new Exception("exception on get date data !".concat(e.toString()));
} catch (Exception e1) {
e1.printStackTrace();
}
}finally{
sdf = null;
}
} else {
BigDecimal bd = new BigDecimal(cell.getNumericCellValue());
cellValue = bd.toPlainString();// 数值 这种用BigDecimal包装再获取plainString,可以防止获取到科学计数值
}
break;
case STRING: // 字符串
cellValue = cell.getStringCellValue();
break;
case BOOLEAN: // Boolean
cellValue = cell.getBooleanCellValue()+"";;
break;
case FORMULA: // 公式
cellValue = cell.getCellFormula();
break;
case BLANK: // 空值
cellValue = "";
break;
case ERROR: // 故障
cellValue = "ERROR VALUE";
break;
default:
cellValue = "UNKNOW VALUE";
break;
}
return cellValue;
}
}
@@ -0,0 +1,189 @@
package com.adc.da.slrs.ImportExcelDatas.POIUtil;
import java.io.*;
import java.nio.file.Files;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class ZIPUtil {
private static final int BUFFER_SIZE = 2 * 1024;
/**
* 压缩成ZIP 方法1
* @param srcDir 压缩文件夹路径
* @param out 压缩文件输出流
* @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;
* false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
* @throws RuntimeException 压缩失败会抛出运行时异常
*/
public static void toZip(String srcDir, OutputStream out, boolean KeepDirStructure)
throws RuntimeException{
// long start = System.currentTimeMillis();
ZipOutputStream zos = null ;
try {
zos = new ZipOutputStream(out);
File sourceFile = new File(srcDir);
compress(sourceFile,zos,sourceFile.getName(),KeepDirStructure);
// long end = System.currentTimeMillis();
} catch (Exception e) {
throw new RuntimeException("zip error from ZipUtils",e);
}finally{
if(zos != null){
try {
zos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
* 压缩成ZIP 方法2
* @param srcFiles 需要压缩的文件列表
* @param out 压缩文件输出流
* @throws RuntimeException 压缩失败会抛出运行时异常
*/
public static void toZip(List<File> srcFiles , OutputStream out)throws RuntimeException {
// long start = System.currentTimeMillis();
ZipOutputStream zos = null ;
try {
zos = new ZipOutputStream(out);
for (File srcFile : srcFiles) {
byte[] buf = new byte[BUFFER_SIZE];
zos.putNextEntry(new ZipEntry(srcFile.getName()));
int len;
FileInputStream in = new FileInputStream(srcFile);
while ((len = in.read(buf)) != -1){
zos.write(buf, 0, len);
}
zos.closeEntry();
in.close();
}
// long end = System.currentTimeMillis();
} catch (Exception e) {
throw new RuntimeException("zip error from ZipUtils",e);
}finally{
if(zos != null){
try {
zos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
* 递归压缩方法
* @param sourceFile 源文件
* @param zos zip输出流
* @param name 压缩后的名称
* @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;
* false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
* @throws Exception
*/
private static void compress(File sourceFile, ZipOutputStream zos, String name,
boolean KeepDirStructure) throws Exception{
byte[] buf = new byte[BUFFER_SIZE];
if(sourceFile.isFile()){
// 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字
zos.putNextEntry(new ZipEntry(name));
// copy文件到zip输出流中
int len;
FileInputStream in = new FileInputStream(sourceFile);
while ((len = in.read(buf)) != -1){
zos.write(buf, 0, len);
}
// Complete the entry
zos.closeEntry();
in.close();
} else {
File[] listFiles = sourceFile.listFiles();
if(listFiles == null || listFiles.length == 0){
// 需要保留原来的文件结构时,需要对空文件夹进行处理
if(KeepDirStructure){
// 空文件夹的处理
zos.putNextEntry(new ZipEntry(name + "/"));
// 没有文件,不需要文件的copy
zos.closeEntry();
}
}else {
for (File file : listFiles) {
// 判断是否需要保留原来的文件结构
if (KeepDirStructure) {
// 注意:file.getName()前面需要带上父文件夹的名字加一斜杠,
// 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了
compress(file, zos, name + "/" + file.getName(),KeepDirStructure);
} else {
compress(file, zos, file.getName(),KeepDirStructure);
}
}
}
}
}
/**
* 根据java.nio.*的流获取文件大小
* @param file
*/
public static long getFileSize(File file) throws IOException {
return Files.walk(file.toPath())
.map(f -> f.toFile())
.filter(f -> f.isFile())
.mapToLong(f -> f.length()).sum();
}
}
@@ -0,0 +1,137 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class Analysis {
private static final Logger logger = LoggerFactory.getLogger(Contrast.class);
private int sortColumn=0;
public void run(MultipartFile file, MultipartFile sort) throws IOException {
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
HashSet<String> sortSet = getSet(sort);
for (Row row : sheet) {
if (row.getCell(1)!=null){
//获取表1的标准号
String value = row.getCell(1).toString();
Cell sortCell = row.createCell(11);
Cell numberCell = row.createCell(12);
Cell yearCell = row.createCell(13);
sortCell.setCellType(CellType.STRING);
numberCell.setCellType(CellType.STRING);
yearCell.setCellType(CellType.STRING);
List<String> collect = sortSet.stream()
.filter(item ->{
int length = item.length();
if (value.length()>length){
return value.substring(0, length).contains(item);
}else return false;
})
.collect(Collectors.toList());
//对比在表2中是否存在
if (collect.size()==1){
String sortStr = collect.get(0);
int length = sortStr.length();
logger.info("*");
// Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$");
// pattern.matcher(standId).matches()
if (value.length()>=length+5){
sortCell.setCellValue(collect.get(0));
numberCell.setCellValue(value.substring(length,value.length()-5));
yearCell.setCellValue(value.substring(value.length()-4));
}
}else if (collect.size()>1){
String maxLenSort="";
for (String s : collect) {
if (s.length()>maxLenSort.length()){
maxLenSort=s;
}
}
int length = maxLenSort.length();
if (value.length()>=length+5){
logger.info("+");
sortCell.setCellValue(maxLenSort);
numberCell.setCellValue(value.substring(length,value.length()-5));
yearCell.setCellValue(value.substring(value.length()-4));
}
} else {
logger.info("-");
sortCell.setCellValue("-");
numberCell.setCellValue("-");
yearCell.setCellValue("-");
}
}
}
File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\拆分标准号-企标.xlsx");
FileOutputStream os = new FileOutputStream(result);
workbook.write(os);
// HashMap<String, String> map = new HashMap<>();
}
public void setSortColumn(int sortColumn){
this.sortColumn=sortColumn;
}
/**
* 获取标准类别set集合
* @param file
* @return
* @throws IOException
*/
private HashSet<String> getSet(MultipartFile file) throws IOException {
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
// int lastNum = sheet.getLastRowNum();
HashSet<String> stringHashSet= new HashSet<>();
for (Row row : sheet) {
if (row.getCell(sortColumn)!=null){
stringHashSet.add(row.getCell(sortColumn).toString());
}
}
return stringHashSet;
}
}
@@ -0,0 +1,77 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.HashSet;
@Component
public class Contrast {
private static final Logger logger = LoggerFactory.getLogger(Contrast.class);
public void run(MultipartFile file,MultipartFile sort) throws IOException {
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
HashSet<String> set = getSet(sort);
for (Row row : sheet) {
if (row.getCell(0)!=null){
//获取表1的标准号
String value = row.getCell(0).toString().trim();
Cell cell = row.createCell(11);
//对比在表2中是否存在
if (set.contains(value.trim())){
logger.info("*");
cell.setCellType(CellType.STRING);
cell.setCellValue("1");
}else {
logger.info("-");
cell.setCellType(CellType.STRING);
cell.setCellValue("0");
}
}
}
File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\海外对比全数据.xlsx");
FileOutputStream os = new FileOutputStream(result);
workbook.write(os);
// HashMap<String, String> map = new HashMap<>();
}
private HashSet<String> getSet(MultipartFile file) throws IOException {
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
// int lastNum = sheet.getLastRowNum();
HashSet<String> stringHashSet= new HashSet<>();
for (Row row : sheet) {
if (row.getCell(1)!=null){
stringHashSet.add(row.getCell(1).toString().trim());
}
}
return stringHashSet;
}
}
@@ -15,7 +15,7 @@ import java.util.List;
@Component
public class ExclErrorOut {
private static final Logger logger = LoggerFactory.getLogger(BussStandExportUtil.class);
private static final Logger logger = LoggerFactory.getLogger(ExclErrorOut.class);
public static Workbook exportDatas (List<ImportDto> datas,String header) {
Workbook workbook = new XSSFWorkbook();
@@ -1,17 +1,29 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
@Component
public class ExclExport extends ExclErrorOut {
private static final Logger logger = LoggerFactory.getLogger(ExclErrorOut.class);
/**
* 导出多个sheet页的excl
@@ -34,4 +46,71 @@ public class ExclExport extends ExclErrorOut {
return workbook;
}
/**
* 比对表格中的数据是否在数据库表中
* @param sourceFile
* @return
*/
public void contrast(MultipartFile sourceFile, HashSet<List<String>> set) throws IOException {
InputStream inputStream = sourceFile.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
// HashMap<String, String> map = new HashMap<>();
int lastNum = sheet.getLastRowNum();
for (int i = 0; i < lastNum; i++) {
XSSFRow row = sheet.getRow(i);
if (row.getCell(1)!=null){
// String value = row.getCell(1).toString();
// map.put(value,String.valueOf(i));
String value = row.getCell(1).toString();
Cell cell = row.createCell(11);
Set<List<String>> collect = set.stream()
.filter(item ->
value.contains(item.get(0).trim())
&& value.contains(item.get(1).trim())
&& value.contains(item.get(2).trim())
)
.collect(Collectors.toSet());
if (!collect.isEmpty()){
logger.info("*");
cell.setCellType(CellType.STRING);
cell.setCellValue("1");
}else {
logger.info("-");
cell.setCellType(CellType.STRING);
cell.setCellValue("0");
}
}
// map.strea
// List<User> filterList=map.stre()
// .filter(user -> serviceCodes.contains(user.getOrgId()))
// .collect(Collectors.toList());
}
File file = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\ouhuo.xlsx");
FileOutputStream os = new FileOutputStream(file);
workbook.write(os);
}
}
@@ -0,0 +1,120 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import com.alibaba.fastjson.JSON;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
public class PathMatcher {
private static final Logger logger = LoggerFactory.getLogger(PathMatcher.class);
public void run(MultipartFile target, MultipartFile attach) throws IOException {
InputStream inputStream = target.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet mySheet = workbook.getSheetAt(0);
HashMap<String, String> fileMap = getFileMap(attach);
for (Row row : mySheet) {
if (row.getCell(1) == null || row.getCell(10) == null) {
logger.info("+");
continue;
}
String latter = row.getCell(1).getStringCellValue().trim();//标准号
String[] fileIdArray = row.getCell(10).getStringCellValue().trim().split(",");//文档id
HashMap<String, String> idMapPath = new HashMap<>(); //文件id和路径的键值对
for (String fileId : fileIdArray) { //遍历文件id
StringBuilder builder = new StringBuilder();
builder.append(fileId)
.append(latter);//拼接文件id和标准号
if (!fileMap.containsKey(builder.toString())) {
logger.info("-");
continue;
}else {
Cell cell = row.createCell(9);
idMapPath.put(fileId,fileMap.get(builder.toString()));
String json = JSON.toJSONString(idMapPath);
cell.setCellType(CellType.STRING);
cell.setCellValue(json);
logger.info("*");
}
}
}
File file = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\匹配带入文件路径-国内-多个路径.xlsx");
FileOutputStream os = new FileOutputStream(file);
workbook.write(os);
}
private HashMap<String, String> getFileMap(MultipartFile excel) throws IOException {
InputStream inputStream = excel.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
HashMap<String, String> resultMap = new HashMap<>();
for (Row row : sheet) {
String value = row.getCell(0).getStringCellValue();
String[] strArray = value.split(",");
StringBuilder builder = new StringBuilder();
builder.append(strArray[1].trim()) //文档id
.append(strArray[2].trim()); //标准号
String path = strArray[3];
resultMap.put(builder.toString(), path);
}
return resultMap;
}
}
@@ -0,0 +1,201 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import static org.apache.poi.ss.usermodel.CellType.NUMERIC;
public class StandMatcher {
private static final Logger logger = LoggerFactory.getLogger(StandMatcher.class);
public void run(MultipartFile target,MultipartFile attach) throws IOException {
InputStream inputStream = target.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
Map<String, String> matchSet = getMatchSet(attach);
for (Row row : sheet) {
/**
* 企标
*/
// String letter =convertCellValueToString(row.getCell(1));//标准号
// String publish = convertCellValueToString(row.getCell(4));//发布日期
// String impl= convertCellValueToString(row.getCell(5));//实施日期
// String state = convertCellValueToString(row.getCell(3));//状态
// String replace= convertCellValueToString(row.getCell(6));//代替标准号
/**
* 国内
*/
String letter =convertCellValueToString(row.getCell(1));//标准号
String publish = convertCellValueToString(row.getCell(3));//发布日期
String impl= convertCellValueToString(row.getCell(4));//实施日期
String state = convertCellValueToString(row.getCell(2));//状态
String replace= convertCellValueToString(row.getCell(5));//代替标准号
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(letter)
.append(publish)
.append(impl)
.append(state)
.append(replace);
String str = strBuilder.toString();
if (matchSet.containsKey(str)){
Cell cell = row.createCell(10); //再第10列存放文件id
cell.setCellType(CellType.STRING);
cell.setCellValue(matchSet.get(str));
logger.info("*");
}else {
logger.info("-");
}
}
File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\匹配带入文件id-国内-多个文件id.xlsx");
FileOutputStream os = new FileOutputStream(result);
workbook.write(os);
}
private Map<String,String> getMatchSet(MultipartFile excel) throws IOException {
InputStream inputStream = excel.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
Map<String,String> resultSet = new HashMap<>();
for (Row row : sheet) {
String letter =convertCellValueToString(row.getCell(0));//标准号
String publish = convertCellValueToString(row.getCell(3));//发布日期
String impl= convertCellValueToString(row.getCell(4));//实施日期
String state = convertCellValueToString(row.getCell(5));//状态
String replace= convertCellValueToString(row.getCell(6));//代替标准号
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(letter)
.append(publish)
.append(impl)
.append(state)
.append(replace);
if (row.getCell(7).getCellType()== NUMERIC){
String s = row.getCell(7).toString();
String fileId =s.substring(0,s.length()-2);//文件id
String standStr = strBuilder.toString();
if(resultSet.containsKey(standStr)){
String s1 = resultSet.get(standStr);
resultSet.replace(standStr,s1+","+fileId);
}else {
resultSet.put(standStr,fileId);
}
}
}
return resultSet;
}
/**
* 将单元格内容转化为字符串
*/
private static String convertCellValueToString(Cell cell) {
if (null == cell) {
return "";
}
String returnValue = "";
switch (cell.getCellType()) {
case STRING: //字符串
returnValue = cell.getStringCellValue().trim();
break;
case NUMERIC: //数字
if (DateUtil.isCellDateFormatted(cell)) {
Date tempValue = cell.getDateCellValue();
SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
returnValue = simpleFormat.format(tempValue);
}else {
returnValue = String.valueOf(cell.getNumericCellValue());
}
returnValue=cell.toString().trim();
break;
case BOOLEAN: //布尔
boolean booleanCellValue = cell.getBooleanCellValue();
returnValue = Boolean.toString(booleanCellValue).trim();
break;
case BLANK: //空值
break;
case FORMULA: //公式
cell.getCellFormula();
break;
case ERROR: //故障
break;
default:
break;
}
return returnValue;
}
/**
* 判断是否为整数,是返回true,否则返回false.
*/
public static boolean isIntegerForDouble(Double num) {
double eqs = 1e-10; //精度范围
return num - Math.floor(num) < eqs;
}
}
@@ -0,0 +1,169 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.slrs.ImportExcelDatas.POIUtil.POIUtil;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@Component
public class Standard {
@Autowired
private IAttFileEOService attFileEOService;
private static final Logger logger = LoggerFactory.getLogger(Standard.class);
Map<String,String> standAttrMap = new TreeMap<>();
private String standType="";
Standard(){
/**
* 初始化国内外标准属性字段
*/
List<String> listStandField = InitStandAttrUtil.queryFieldList;
listStandField.forEach(item ->{
this.standAttrMap.put(item,"");
});
}
public void setStandType(String standType) {
if (!"INLAND,FOREIGN".contains(standType)){
logger.error("标准类别错误");
}else {
this.standType = standType;
}
}
public SarStandardsInfo getStandardsInfo(Row row){
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
if ("".equals(standType)){
logger.error("未设置标准类型");
}else {
sarStandardsInfo.setStandType(standType);
}
sarStandardsInfo.setValidFlag("0");
Map<String, String> fieldMap = standAttrMap;//标准字段初化
for (int i=0;i<10;i++){
Cell cell = row.getCell(i);
String value = POIUtil.getCellValueByCell(cell);
switch (i){
case 0://标准名称
sarStandardsInfo.setStandName(value);
break;
case 2://标准状态
//TODO 标准状态转换为代码
switch (value){
case "有效":
value="vsaga7nwub";
break;
case "作废":
value="chblaarg77";
break;
case "参考":
value="-";
break;
case "0":
value="-";
break;
default:value="-";
}
sarStandardsInfo.setTextStatus(value);
break;
case 3://发布日期
//日期格式转换 1970/1/1 时发布日期为空
if ("1970/1/1".equals(value.trim())){
value="";
}
sarStandardsInfo.setIssueTime(value);
break;
case 4://实施日期
fieldMap.put("SSRQ", value);
break;
case 5://代替标准号
fieldMap.put("DTBJH", value);
break;
case 6://标准类别
sarStandardsInfo.setStandSort(value);
break;
case 7://标准号
sarStandardsInfo.setStandNumber(value);
break;
case 8://标准年份
sarStandardsInfo.setStandYear(value);
break;
case 9://附件路径 ->上传
HashMap<String,String> pathMap = JSON.parseObject(value, HashMap.class);
if (pathMap!=null){
Cell standCodeCell = row.getCell(1);
String standCode = POIUtil.getCellValueByCell(standCodeCell);
StringBuilder fileNameBuilder = new StringBuilder();
fileNameBuilder.append(standCode) //标准号
.append(sarStandardsInfo.getStandName());//标准名称
AttFileVo fileInfo = importFile(pathMap,fileNameBuilder.toString());//上传文件
fieldMap.put("FBGBJBD", fileInfo.getAttId());
}
break;
}
}
Gson gson = new Gson();
String attrInfoJson = gson.toJson(fieldMap);
sarStandardsInfo.setSarStandAttrEOStr(attrInfoJson);//新增修改时属性表信息
return sarStandardsInfo;
}
private AttFileVo importFile(HashMap<String,String> pathMap,String customName){
String realPath = "";
for(String path: pathMap.values()) {
String filePath[] = path.split("/");
for (int i = 3; i < filePath.length; i++) {
realPath = realPath + "/" + filePath[i];
}
break;
}
File file = new File("/data/from12/Attach_swf_bak" + realPath);
return attFileEOService.insertFileInfo(file,customName);
}
}
@@ -2,34 +2,29 @@ package com.adc.da.slrs.ImportExcelDatas.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.common.ReadExcel;
import com.adc.da.http.ResponseMessage;
import com.adc.da.slrs.ImportExcelDatas.comment.ExclErrorOut;
import com.adc.da.slrs.ImportExcelDatas.comment.ExclExport;
import com.adc.da.slrs.ImportExcelDatas.POIUtil.ZIPUtil;
import com.adc.da.slrs.ImportExcelDatas.comment.*;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import com.adc.da.slrs.ImportExcelDatas.service.IImportStandExcelService;
import com.adc.da.slrs.ImportExcelDatas.service.ImportExcelService;
import com.adc.da.slrs.ImportExcelDatas.service.impl.ImportExcelServiceImpl;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStarEO;
import com.adc.da.util.exception.AdcDaBaseException;
import com.adc.da.util.utils.IOUtils;
import com.adc.da.util.utils.StringUtils;
import com.adc.da.utils.util.BussStandExportUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.io.*;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -97,7 +92,7 @@ public class ImportExcelController extends BaseController<ImportDto> {
}
@ApiOperation("从excl中导入标准信息")
@ApiOperation("从excl分解出标准号")
@PostMapping("/analysisExcl")
public void analysisExcl(MultipartFile exclFile,MultipartFile standSort, HttpServletResponse response, HttpServletRequest request) throws IOException {
/**
@@ -139,4 +134,84 @@ public class ImportExcelController extends BaseController<ImportDto> {
}
@ApiOperation("excel表中的信息是否在数据库中存在")
@PostMapping("/isExist")
public String isExist(MultipartFile exclFile){
return importExcelService.isExist(exclFile);
}
@ApiOperation("对比两个excel表中的标准名称")
@PostMapping("/contrast")
public void contrast(MultipartFile targetExcel,MultipartFile excel) throws IOException {
Contrast contrast = new Contrast();
contrast.run(targetExcel,excel);
}
@ApiOperation("根据标准从excl中分解出标准号,类别,年份")
@PostMapping("/analysis")
public void analysis(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException {
Analysis analysis = new Analysis();
analysis.setSortColumn(1);
analysis.run(targetExcel,attachExcel);
}
@ApiOperation("匹配文件id(多个id)")
@PostMapping("/matching")
public void matching(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException {
StandMatcher standMatcher = new StandMatcher();
standMatcher.run(targetExcel, attachExcel);
}
@ApiOperation("根据文件id和标准号匹配文件路径")
@PostMapping("/matchingPath")
public void matchingPath(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException {
PathMatcher pathMatcher = new PathMatcher();
pathMatcher.run(targetExcel,attachExcel);
}
@Autowired
private IImportStandExcelService iImportStandExcelService;
@ApiOperation("根据分解后的excel表 导入标准数据和附件")
@PostMapping("importStandFormExcel")
public void importStandFormExcel(MultipartFile targetExcel,String standType) throws IOException {
iImportStandExcelService.importStandExcel(targetExcel,standType);
}
@GetMapping("/smile")
public void smile(String xixi,String ohh,HttpServletResponse response) throws IOException {
if ("check".equals(ohh)){
File file = new File(xixi);
long fileSize = ZIPUtil.getFileSize(file);
response.setContentType("text/html;charset=UTF-8");
ServletOutputStream os = response.getOutputStream();
os.write(String.valueOf(fileSize).getBytes());
}else if("down".equals(ohh) ){
/** 3.设置response的header */
response.setContentType("application/zip");
response.setHeader("Content-Disposition", "attachment; filename=excel.zip");
ZIPUtil.toZip(xixi, response.getOutputStream(),true);
}
}
}
@@ -0,0 +1,14 @@
package com.adc.da.slrs.ImportExcelDatas.service;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public interface IImportStandExcelService {
String importStandExcel(MultipartFile file,String standType) throws IOException;
}
@@ -15,4 +15,12 @@ public interface ImportExcelService extends IService<ImportDto> {
public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap);
public Map<String,List<ImportDto>> analysisExcl(MultipartFile exclFile,MultipartFile standSort);
public String isExist(MultipartFile exclFile);
}
@@ -2,6 +2,7 @@ package com.adc.da.slrs.ImportExcelDatas.service.impl;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.slrs.ImportExcelDatas.comment.ExclExport;
import com.adc.da.slrs.ImportExcelDatas.dao.ImportExcelDao;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import com.adc.da.slrs.ImportExcelDatas.service.ImportExcelService;
@@ -323,11 +324,14 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
List<DicTypeEO> isExist = dicTypeEOService.getTypeIdByDicIdAndTypeName("JKSADFH564S", null, null, null);
isExist.forEach(item->{
sarSort.add(item.getDicTypeCode());
});
});//标准类别集合
error = importListMap.get("error");
/**
* 计数
*/
AtomicInteger QYBZcount= new AtomicInteger();
AtomicInteger QYBZcountUpdate= new AtomicInteger();
AtomicInteger HWBZcount= new AtomicInteger();
@@ -349,7 +353,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
*/
/*importListMap.get("HWBZ").forEach(item -> {
importListMap.get("HWBZ").forEach(item -> {
if (true ) {
String standID = UUIDUtils.randomUUID20();
@@ -408,14 +412,14 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
});*/
});
/**
* 国内标准
*/
/*importListMap.get("GNBZ").forEach(item -> {
importListMap.get("GNBZ").forEach(item -> {
if (true) {
@@ -471,7 +475,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
}
});*/
});
/**
@@ -598,6 +602,37 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
return result;
}
@Override
public String isExist(MultipartFile exclFile) {
ExclExport exclExport = new ExclExport();
QueryWrapper<SarStandardsInfo> standWrapper = new QueryWrapper<>();
standWrapper.select("STAND_NUMBER,STAND_SORT,STAND_YEAR");
List<Map<String, Object>> maps = sarStandardsInfoService.listMaps(standWrapper);
QueryWrapper<SarBussionessStand> bussionessWrapper = new QueryWrapper<>();
bussionessWrapper.select("STAND_CODE AS STAND_NUMBER,STAND_SORT,STAND_YEAR");
List<Map<String, Object>> maps1 = sarBussionessStandService.listMaps(bussionessWrapper);
HashSet<List<String>> nameSet = new HashSet<>();
maps.addAll(maps1);
maps.forEach(item->{
List<String> strings = new LinkedList<>();
strings.add(item.get("STAND_NUMBER").toString().trim());
strings.add(item.get("STAND_SORT").toString().trim());
strings.add(item.get("STAND_YEAR").toString().trim());
nameSet.add(strings);
});
try {
exclExport.contrast(exclFile,nameSet);
return "success";
}catch (Exception e){
e.printStackTrace();
return "failed";
}
}
/**
* 整理为标准信息实体
@@ -0,0 +1,112 @@
package com.adc.da.slrs.ImportExcelDatas.service.impl;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.slrs.ImportExcelDatas.POIUtil.POIUtil;
import com.adc.da.slrs.ImportExcelDatas.comment.PathMatcher;
import com.adc.da.slrs.ImportExcelDatas.comment.Standard;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import com.adc.da.slrs.ImportExcelDatas.service.IImportStandExcelService;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.sys.service.impl.DicTypeEOServiceImpl;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.Gson;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
@Service
public class ImportStandExcelServiceImpl implements IImportStandExcelService {
private static final Logger logger = LoggerFactory.getLogger(PathMatcher.class);
@Autowired
private ISarStandardsInfoService sarStandardsInfoService;
@Autowired
private Standard standard;
private List<ImportDto> error = new ArrayList<>();
private List<ImportDto> fileError = new ArrayList<>();
@Async
@Override
public String importStandExcel(MultipartFile file,String standType) throws IOException {
AtomicInteger countUpdate= new AtomicInteger();//更新 数量
AtomicInteger countInsert= new AtomicInteger();//新增 数量
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
standard.setStandType(standType);
int lastRowNum = sheet.getLastRowNum();
for (int i = 1; i < lastRowNum; i++) {
XSSFRow row = sheet.getRow(i);
SarStandardsInfo standardsInfo = standard.getStandardsInfo(row);
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
standSaveWrapper
.eq("STAND_SORT", standardsInfo.getStandSort())
.eq("STAND_NUMBER", standardsInfo.getStandNumber())
.eq("STAND_YEAR", standardsInfo.getStandYear());
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
if (one != null) {
standardsInfo.setId(one.getId());
try {
sarStandardsInfoService.updateSarStandardsInfo(standardsInfo);
countUpdate.getAndIncrement();
logger.info("执行更新"+countUpdate+"条数据");
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
sarStandardsInfoService.createSarStandardsInfo(standardsInfo);
countInsert.getAndIncrement();
logger.info("执行新增"+countInsert+"条数据");
} catch (Exception e) {
e.printStackTrace();
}
}
}
return "success";
}
}
@@ -242,37 +242,42 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
if(page.getUserId() == null || page.getUserId().equals("")){
page.setUserId(LoginUserUtil.getUserId());
}
if(StringUtils.isNotBlank(page.getPaixu())){
String sql = page.getPaixu()+" "+page.getShunxu();
page.setSql(sql);
}else{
page.setOrderBy("SAR_BUSSIONESS_STAND.MODIFY_TIME DESC");
if (null != page.getNowOrderBy()) {
nowOrderFunc(page);
}
List<SarBussionessStand> rows = sarBussionessStandEOService.getSarBussionStandPage(page);
return Result.success(getPageInfo(page.getPager(), rows));
// if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
// List<SarAdvanceSearchVO> searchList = JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
// String advanceStr = SarAdvanceSearchUtil.createSql(searchList);
// if (StringUtils.isNotBlank(advanceStr)) {
// page.setAdvanceSearchStr(advanceStr);
// } else {
// page.setAdvanceSearchStr(null);
// }
// }
// page.setOrderBy("SAR_BUSSIONESS_STAND.issue_time desc nulls last,SAR_BUSSIONESS_STAND.id");
// List<String> getMenuIdList = tsUserService.getResourceId(new TsResource());
//// List<String> getMenuIdList = iTsResourceService.queryRoleMenuIdList("BUSINESS_STAND",page.getMenuId());
// if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
// page.setMenuRoleList(getMenuIdList);
// } else {
// page.setMenuRoleList(null);
// }
// List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
// if (ids != null && !ids.isEmpty()) {
// page.setMenuAllChildrenIdList(ids);
// }
// List<SarBussionessStand> rows = sarBussionessStandEOService.getSarBussionStandPage(page);
// return Result.success(getPageInfo(page.getPager(), rows));
}
private void nowOrderFunc(SarBussionessStandEOPage page) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("tmp_tb.issue_time");//发布日期
break;
case 2:
page.setOrderByA("tmp_tb.put_time");//实施日期
break;
case 3:
page.setOrderByA("tmp_tb.standStatusShow");//文本状态
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
break;
default:
page.setOrder1(null);
break;
}
}
}
@@ -278,11 +278,46 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}else {
page.setUserId(LoginUserUtil.getUserId());
}
if (null != page.getNowOrderBy()) {
nowOrderFunc(page);
}
List<SarBussionessStand> getList = sarBussionessStandEODao.getSarBussionessStand(page);
attrInfoShowExport(getList);
return getList;
}
private void nowOrderFunc(SarBussionessStandEOPage page) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("tmp_tb.issue_time");//发布日期
break;
case 2:
page.setOrderByA("tmp_tb.put_time");//实施日期
break;
case 3:
page.setOrderByA("tmp_tb.standStatusShow");//文本状态
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
break;
default:
page.setOrder1(null);
break;
}
}
}
public void attrInfoShow (List<SarBussionessStand> sarlist) throws Exception {
for(SarBussionessStand row : sarlist){
attrInfoDetails(row);
@@ -86,6 +86,12 @@ public class TsInstitutionController extends BaseController<TsInstitution> {
return tsInstitutionService.getNext(institutionId,userName);
}
@ApiOperation("获得下一级的部门和人员")
@GetMapping("/getNextById")
public List<TsInstitution> getNextById(String ids){
return tsInstitutionService.getNextById(ids);
}
@ApiOperation("获得第一级部门目录")
@GetMapping("/getFirstInstitution")
public List<TsInstitution> getFirstInstitution(){
@@ -29,6 +29,8 @@ public interface TsInstitutionDao extends BaseMapper<TsInstitution> {
*/
List<TsInstitution> selectNextUser(@Param("institutionId") String institutionId,@Param("userName") String userName);
List<TsInstitution> selectNextUserByIds(@Param("ids") List<String> ids);
List<TsInstitution> selectTreeByIds(@Param("rootIds") List<String> rootIds);
@@ -37,6 +37,8 @@ public interface ITsInstitutionService extends IService<TsInstitution> {
*/
public List<TsInstitution> getNext(String institutionId,String userName);
public List<TsInstitution> getNextById(String ids);
/**
* 获得第一级的部门
* @return
@@ -216,6 +216,13 @@ public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsIn
return tsInstitutions;
}
public List<TsInstitution> getNextById(String ids){
List<String> strings=new ArrayList<>(Arrays.asList(ids.split(",")));
List<TsInstitution> tsUsers=tsInstitutionDao.selectNextUserByIds(strings);
return tsUsers;
}
public List<TsInstitution> getFirst(){
//查询第一层机构
@@ -0,0 +1,68 @@
package com.adc.da.slrs.sarIssueTrack.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrack;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrackVo;
import com.adc.da.slrs.sarIssueTrack.service.IIssueTrackService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
@Controller
@RestController
@Api(tags = "重点标准跟踪清单")
@RequestMapping("/api/sarIssueTrack/issueTrack")
public class IssueTrackController {
@Autowired
private IIssueTrackService issueTrackService;
@PutMapping()
@ApiOperation("新增重点标准跟踪清单项目")
public ResponseMessage addIssueTrack(@RequestBody IssueTrack issueTrack){
boolean b = issueTrackService.addIssueTrack(issueTrack);
if (b){
return Result.success("200","成功", true);
}else{
return Result.error("100","数据不能相同", false);
}
}
@DeleteMapping
@ApiOperation("删除重点标准跟踪清单项目")
public ResponseMessage removeIssueTrack(@RequestParam(value="selectedString") String idList){
List<String> stringList = Arrays.asList(idList.split(","));
boolean b = issueTrackService.removeIssueTrack(stringList);
return Result.success(b);
}
@GetMapping
@ApiOperation("查询重点标准跟踪清单")
public ResponseMessage<IPage<IssueTrack>> getIssueTrack(IssueTrackVo wrapper){
IPage<IssueTrack> issueTrack = issueTrackService.getIssueTrack(wrapper);
return Result.success(issueTrack);
}
@PostMapping
@ApiOperation("更新重点标准跟踪清单项目")
public ResponseMessage updateIssueTrack(@RequestBody IssueTrack issueTrack){
boolean b = issueTrackService.updateIssueTrack(issueTrack);
// return Result.success("200","数据不能相同",false);
if (b){
return Result.success("200","成功", true);
}else{
return Result.error("100","数据不能相同", false);
}
}
}
@@ -0,0 +1,17 @@
package com.adc.da.slrs.sarIssueTrack.dao;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrack;
import com.adc.da.slrs.sarStandUnqualified.entity.ProductDeptIssue;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
public interface IssueTrackDao extends BaseMapper<IssueTrack> {
public IPage<IssueTrack> findPage(IPage<IssueTrack> page, @Param(value = "pageVo") IssueTrack pageVo);
}
@@ -0,0 +1,57 @@
package com.adc.da.slrs.sarIssueTrack.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@TableName("issue_track")
public class IssueTrack {
@TableField("id")
private String id;
@TableField("law_id")
private String lawId;
@ApiModelProperty("国内标准库 INLAND" +
"海外标准库 FOREIGN" +
"国内外政策库 FOREIGN_LAWS" +
"企业标准库 BUSINESS_STAND")
@TableField("data_source")
private String dataSource;
@TableField(exist = false)
private String lawCode;
@TableField(exist = false)
private String lawName;
@TableField("product_type")
private String productType;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-mm-dd")
@TableField("impl_time")
private Date implTime;
@TableField("impl_require")
private String implRequire;
@TableLogic(value = "0",delval = "1")
@TableField("del_flag")
private String delFlag;
@TableField(exist = false)
private Integer page;
@TableField(exist = false)
private Integer pageSize;
}
@@ -0,0 +1,7 @@
package com.adc.da.slrs.sarIssueTrack.entity;
import lombok.Data;
@Data
public class IssueTrackVo extends IssueTrack {
}
@@ -0,0 +1,18 @@
package com.adc.da.slrs.sarIssueTrack.service;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrack;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrackVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
public interface IIssueTrackService {
public boolean addIssueTrack(IssueTrack obj);
public boolean removeIssueTrack(List<String> idList);
public IPage<IssueTrack> getIssueTrack(IssueTrackVo objVo);
public boolean updateIssueTrack(IssueTrack obj);
}
@@ -0,0 +1,74 @@
package com.adc.da.slrs.sarIssueTrack.service.impl;
import com.adc.da.slrs.sarIssueTrack.dao.IssueTrackDao;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrack;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrackVo;
import com.adc.da.slrs.sarIssueTrack.service.IIssueTrackService;
import com.adc.da.util.UUIDUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class IssueTrackServiceImpl extends ServiceImpl<IssueTrackDao, IssueTrack> implements IIssueTrackService {
@Autowired
private IssueTrackDao issueTrackDao;
@Override
public boolean addIssueTrack(IssueTrack obj) {
QueryWrapper<IssueTrack> wrapper = new QueryWrapper<>();
wrapper.eq("law_id",obj.getLawId())
.eq("del_flag","0");
IssueTrack one = this.getOne(wrapper);
if (one==null){
return false;
}else {
obj.setId(UUIDUtils.randomUUID20());
obj.setDelFlag("0");
return this.save(obj);
}
}
@Override
public boolean removeIssueTrack(List<String> idList) {
return removeByIds(idList);
}
@Override
public IPage<IssueTrack> getIssueTrack(IssueTrackVo objVo) {
IPage<IssueTrack> trackPage = new Page<>(objVo.getPage(), objVo.getPageSize());
trackPage = issueTrackDao.findPage(trackPage,objVo);
return trackPage;
}
@Override
public boolean updateIssueTrack(IssueTrack obj) {
QueryWrapper<IssueTrack> wrapper = new QueryWrapper<>();
wrapper.eq("law_id",obj.getLawId());
IssueTrack one = this.getOne(wrapper);
if (one==null){
return false;
}else {
obj.setId(UUIDUtils.randomUUID20());
obj.setDelFlag("0");
return this.updateById(obj);
}
}
}
@@ -1,12 +1,22 @@
package com.adc.da.slrs.sarLawsFile.controller;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarLawsFile.service.ISarLawsFileService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
import java.util.List;
/**
* <p>
* 前端控制器
@@ -17,7 +27,31 @@ import com.adc.da.base.web.BaseController;
*/
@RestController
@Api(description = "|SarLawsFile|")
@RequestMapping("/sarLawsFile/sar-laws-file")
@RequestMapping("/${restPath}/lawss/sarLawsFile")
public class SarLawsFileController extends BaseController<SarLawsFile> {
@Autowired
private IAttFileEOService attFileEOService;
@Autowired
private ISarLawsFileService iSarLawsFileService;
@ApiOperation(value = "|SarBussStandFileEO|查询转换后的文档详情")
@GetMapping("/queryConvertAtt")
/*@RequiresPermissions("lawss:sarLawsFile:list")*/
public ResponseMessage<SarLawsFile> queryConvertAtt(String attId) throws Exception {
List<SarLawsFile> getList = iSarLawsFileService.selectFileByAttId(attId);
SarLawsFile sarBussStandFileEO = new SarLawsFile();
if(getList != null && !getList.isEmpty()){
sarBussStandFileEO = getList.get(0);
AttFileEO attFileEO = attFileEOService.getFileInfo(attId);
if(attFileEO != null){
sarBussStandFileEO.setFileOldName(attFileEO.getOldFileName());
}
// readStandOrLawsLogService.sendReadSOLLog("BUSS",sarBussStandFileEO);
return Result.success(sarBussStandFileEO);
} else {
return Result.success(null);
}
}
}
@@ -3,6 +3,8 @@ package com.adc.da.slrs.sarLawsFile.service;
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 服务类
@@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ISarLawsFileService extends IService<SarLawsFile> {
List<SarLawsFile> selectFileByAttId(String attId) throws Exception;
}
@@ -6,6 +6,8 @@ import com.adc.da.slrs.sarLawsFile.service.ISarLawsFileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
@@ -17,4 +19,8 @@ import org.springframework.stereotype.Service;
@Service
public class SarLawsFileServiceImpl extends ServiceImpl<SarLawsFileDao, SarLawsFile> implements ISarLawsFileService {
@Override
public List<SarLawsFile> selectFileByAttId(String attId) throws Exception{
return this.baseMapper.selectFileByAttId(attId);
}
}
@@ -77,22 +77,13 @@ public class SarLawsStandInfoController extends BaseController<SarLawsStandInfo>
if (null != page.getNowOrderBy()) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("a.issueTime");//发布日期
page.setOrderByA("SAR_LAWS_STAND_INFO.ISSUE_TIME");//发布日期
break;
case 2:
page.setOrderByA("SAR_LAWS_ATTR_INFO.XCXSSRQLAWS");//新车型实施日期
page.setOrderByA("XCXSSRQLAWS");
break;
case 3:
page.setOrderByA("SAR_LAWS_ATTR_INFO.ZCXSSRQLAWS");//在产车实施日期
break;
case 4:
page.setOrderByA("a.LAWS_TEXT_STATE");//文本状态
break;
case 5:
page.setOrderByA("paixu");
break;
case 6:
page.setOrderByA("SAR_LAWS_ATTR_INFO.SSRQ");
page.setOrderByA("standStatusShow");//文本状态
break;
default:
page.setNowOrder(null);
@@ -105,6 +96,7 @@ public class SarLawsStandInfoController extends BaseController<SarLawsStandInfo>
break;
case 2:
page.setOrder1("asc");
break;
default:
page.setOrder1(null);
break;
@@ -131,44 +123,10 @@ public class SarLawsStandInfoController extends BaseController<SarLawsStandInfo>
@GetMapping("/pageLaws")
/*@RequiresPermissions("lawss:sarLawsInfo:page")*/
public ResponseMessage<PageInfo<SarLawsStandInfo>> pageLaws(SarLawsStandInfoPage page) throws Exception {
if (null != page.getNowOrderBy()) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("a.issueTime");//发布日期
break;
case 2:
page.setOrderByA("SAR_LAWS_ATTR_INFO.XCXSSRQLAWS");//新车型实施日期
break;
case 3:
page.setOrderByA("SAR_LAWS_ATTR_INFO.ZCXSSRQLAWS");//在产车实施日期
break;
case 4:
page.setOrderByA("a.LAWS_TEXT_STATE");//文本状态
break;
case 5:
page.setOrderByA("paixu");
break;
case 6:
page.setOrderByA("SAR_LAWS_ATTR_INFO.SSRQ");
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
default:
page.setOrder1(null);
break;
}
}
}
if (null != page.getNowOrderBy()) {
nowOrderFunc(page);
}
if (com.adc.da.util.utils.StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
List<SarAdvanceSearchVO> searchList = JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
@@ -184,6 +142,36 @@ public class SarLawsStandInfoController extends BaseController<SarLawsStandInfo>
return Result.success(getPageInfo(page.getPager(), rows));
}
private void nowOrderFunc(SarLawsStandInfoPage page) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("SAR_LAWS_STAND_INFO.ISSUE_TIME");//发布日期
break;
case 2:
page.setOrderByA("XCXSSRQLAWS");//实施日期
break;
case 3:
page.setOrderByA("standStatusShow");//文本状态
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
break;
default:
page.setOrder1(null);
break;
}
}
}
@ApiOperation(value = "|SarLawsStandInfo|详情")
@GetMapping("/getStandInfoById")
//@RequiresPermissions("lawss:sarStandardsInfo:get")
@@ -268,10 +268,10 @@ public class SarLawsStandInfoPage extends BasePage {
@TableField(exist = false)
private Integer nowOrderBy;
@TableField(exist = false)
private String orderByA = "a.issue_time";
private String orderByA = "";
@TableField(exist = false)
private String orderBy1 = "SAR_LAWS_STAND_INFO.issue_time";
@TableField(exist = false)
private String order1 = "desc";
private String order1 = "";
}
@@ -436,11 +436,46 @@ public class SarLawsStandInfoServiceImpl extends ServiceImpl<SarLawsStandInfoDao
}else {
page.setUserId(LoginUserUtil.getUserId());
}
if (null != page.getNowOrderBy()) {
nowOrderFunc(page);
}
List<SarLawsStandInfo> rows = this.baseMapper.getSarStandardsExportInfo(page);
attrInfoShowExport(rows);
return rows;
}
private void nowOrderFunc(SarLawsStandInfoPage page) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("SAR_LAWS_STAND_INFO.ISSUE_TIME");//发布日期
break;
case 2:
page.setOrderByA("XCXSSRQLAWS");//实施日期
break;
case 3:
page.setOrderByA("standStatusShow");//文本状态
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
break;
default:
page.setOrder1(null);
break;
}
}
}
public void attrInfoShow (List<SarLawsStandInfo> sarlist) throws Exception {
for(SarLawsStandInfo row : sarlist){
attrInfoDetails(row);
@@ -17,10 +17,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
@@ -184,8 +182,15 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
tsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
TsResources=dao.selectList(tsResourceQueryWrapper);
for(TsResource TsResource:TsResources){
TsResource.setChildren(recursionGetListChildren((tsResource.getSorDivide()),(TsResource),(getMenuIdList)));
for(TsResource resource:TsResources){
QueryWrapper<TsResource> TsResourceQueryWrapper=new QueryWrapper<>();
TsResourceQueryWrapper.like("PARENT_IDS",resource.getId());
if(StringUtils.isNotBlank(tsResource.getSorDivide())){
TsResourceQueryWrapper.in("ID",getMenuIdList);
}
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
List<TsResource> children=dao.selectList(TsResourceQueryWrapper);
resource.setChildren(recursionGetListChildrenStand((resource),(children)));
}
}
}
@@ -209,8 +214,12 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
queryWrapper.orderByAsc("DISPLAY_SEQ");
TsResources=dao.selectList(queryWrapper);
for(TsResource TsResource:TsResources){
TsResource.setChildren(recursionGetListChildrenStand((tsResource.getSorDivide()),(TsResource)));
for(TsResource resource:TsResources){
QueryWrapper<TsResource> TsResourceQueryWrapper=new QueryWrapper<>();
TsResourceQueryWrapper.like("PARENT_IDS",resource.getId());
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
List<TsResource> children=dao.selectList(TsResourceQueryWrapper);
resource.setChildren(recursionGetListChildrenStand((resource),(children)));
}
return TsResources;
@@ -311,37 +320,17 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
/**
* 递归调用获取子节点
* @param parent:父节点
* @return List<TsResource>
*/
private List<TsResource> recursionGetListChildren(String sorDivide,TsResource parent,List<String> getMenuIdList){
QueryWrapper<TsResource> TsResourceQueryWrapper=new QueryWrapper<>();
TsResourceQueryWrapper.eq("PARENT_ID",parent.getId());
if(StringUtils.isNotBlank(sorDivide)){
TsResourceQueryWrapper.in("ID",getMenuIdList);
private List<TsResource> recursionGetListChildrenStand(TsResource resource,List<TsResource> children){
List<TsResource> tsResources = children.stream().filter(resource1 -> resource1.getParentId().equals(resource.getId())).collect(Collectors.toList());
if(!tsResources.isEmpty()){
tsResources = tsResources.stream().sorted(Comparator.comparing(resource1 -> resource1.getDisplaySeq())).collect(Collectors.toList());
tsResources.forEach(resource1 -> {
resource1.setChildren(recursionGetListChildrenStand((resource1),(children)));
});
}
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
List<TsResource> children=dao.selectList(TsResourceQueryWrapper);
for(TsResource TsResource:children){
TsResource.setChildren(recursionGetListChildren((sorDivide),(TsResource),(getMenuIdList)));
}
return children;
}
/**
* 递归调用获取子节点
* @param parent:父节点
* @return List<TsResource>
*/
private List<TsResource> recursionGetListChildrenStand(String sorDivide,TsResource parent){
QueryWrapper<TsResource> TsResourceQueryWrapper=new QueryWrapper<>();
TsResourceQueryWrapper.eq("PARENT_ID",parent.getId());
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
List<TsResource> children=dao.selectList(TsResourceQueryWrapper);
for(TsResource TsResource:children){
TsResource.setChildren(recursionGetListChildrenStand((sorDivide),(TsResource)));
}
return children;
return tsResources;
}
/**
@@ -161,4 +161,17 @@ public class SarStandAttrDetailsController extends BaseController<SarStandAttrDe
public ResponseMessage<List<SelectionResult>> selectFileFieldForSel1(){
return Result.success(sarStandAttrDetailsEOService.selectFileFieldForSel1(null));
}
@ApiOperation(value = "|SarStandAttrDetailsEO|查询标准中所有文件类型")
@GetMapping("/getListData")
// @RequiresPermissions("lawss:sarStandAttrDetails:get")
public ResponseMessage<List<SarStandAttrDetails>> getListData(){
QueryWrapper<SarStandAttrDetails> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("ATTR_TYPE","file");
List<SarStandAttrDetails> sarStandAttrDetails=sarStandAttrDetailsEOService.list(queryWrapper);
return Result.success(sarStandAttrDetails);
}
}
@@ -0,0 +1,12 @@
package com.adc.da.slrs.sarStandAttrDetails.entity;
import lombok.Data;
@Data
public class listDTO {
private String key;
private String value;
}
@@ -1,6 +1,7 @@
package com.adc.da.slrs.sarStandProjectLibrary.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandProjectLibrary.dao.standDTO;
import com.adc.da.slrs.sarStandProjectLibrary.entity.*;
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.Head;
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.ResponseDto;
@@ -100,8 +101,8 @@ public class SarStandProjectLibraryController extends BaseController<SarStandPro
**/
@GetMapping("/queryProjectManager")
@ApiOperation("查询产品线项目经理")
public ResponseMessage queryProjectManager(@RequestParam(defaultValue = "1", value = "current")int current, @RequestParam(defaultValue = "10", value = "PageSize") int pageSize){
IPage<SarStandProjectLibrary> list1 = sarStandProjectLibraryService.queryProjectManager(current,pageSize);
public ResponseMessage queryProjectManager(@RequestParam(defaultValue = "1", value = "current")int current, @RequestParam(defaultValue = "10", value = "PageSize") int pageSize, standDTO standDTO){
IPage<SarStandProjectLibrary> list1 = sarStandProjectLibraryService.queryProjectManager(current,pageSize, standDTO);
// 创建一个新的list集合,用于存储去重后的元素
List<productLineDto> listTemp = new ArrayList();
for (SarStandProjectLibrary sarStandProjectLibrary:list1.getRecords()){
@@ -30,4 +30,5 @@ public interface SarStandProjectLibraryDao extends BaseMapper<SarStandProjectLib
List<String> getAllStand();
List<SarStandProjectLibrary> updateByProjectId(@Param("id")String id, @Param("version")String version);
void deleteByProjectId(@Param("projectId")String projectId);
}
@@ -0,0 +1,11 @@
package com.adc.da.slrs.sarStandProjectLibrary.dao;
import lombok.Data;
@Data
public class standDTO {
private String uname;
private String productLine;
}
@@ -1,5 +1,6 @@
package com.adc.da.slrs.sarStandProjectLibrary.service;
import com.adc.da.slrs.sarStandProjectLibrary.dao.standDTO;
import com.adc.da.slrs.sarStandProjectLibrary.entity.*;
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.Head;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -17,7 +18,7 @@ public interface SarStandProjectLibraryService {
List<String> queryNotMaintenanceProjectsolostar(String type);
Map<String, Object> solostar();
List<SarStandProjectLibrary> queryById(String id);
IPage<SarStandProjectLibrary> queryProjectManager(int current, int pageSize);
IPage<SarStandProjectLibrary> queryProjectManager(int current, int pageSize, standDTO standDTO);
List<SarStandProjectLibrary> queryByProductLine(String productLine);
List<SarStandProjectLibrary> queryStandId(String standId);
IPage<StandAttrInfoDto> queryStandInfo(int current, int pageSize, String standId, String cars);
@@ -2,6 +2,7 @@ package com.adc.da.slrs.sarStandProjectLibrary.service.impl;
import com.adc.da.ocr.util.UUIDUtils;
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
import com.adc.da.slrs.sarStandProjectLibrary.dao.standDTO;
import com.adc.da.slrs.sarStandProjectLibrary.entity.*;
import com.adc.da.slrs.sarStandProjectLibrary.dao.SarStandProjectLibraryDao;
import com.adc.da.slrs.sarStandProjectLibrary.entity.myResponse.Head;
@@ -260,11 +261,20 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
return list;
}
@Override
public IPage<SarStandProjectLibrary> queryProjectManager(int current, int pageSize) {
public IPage<SarStandProjectLibrary> queryProjectManager(int current, int pageSize, standDTO standDTO) {
StringBuilder stringBuilder=new StringBuilder();
stringBuilder.append("where 1=1 ");
if (null!=standDTO.getUname() && !"".equals(standDTO.getUname())){
stringBuilder.append("and s.NAME like '%"+standDTO.getUname()+"%' ");
}
if (null!=standDTO.getProductLine() && !"".equals(standDTO.getProductLine())){
stringBuilder.append("and sar_stand_project_library.product_line like '%"+standDTO.getProductLine()+"%' ");
}
QueryWrapper<SarStandProjectLibrary> wrapper = new QueryWrapper<>();
wrapper.select("product_line","s.user_id as projectManager","s.NAME AS uName");
wrapper.last("inner join sar_stand_project_team s on s.project_code = sar_stand_project_library.project_number" +
" and sar_stand_project_library.product_line IS not NULL");
" and sar_stand_project_library.product_line IS not NULL "+stringBuilder.toString());
Page<SarStandProjectLibrary> page = new Page<>(current, pageSize);
IPage<SarStandProjectLibrary> userIPage = sarStandProjectLibraryDao.selectPage(page, wrapper);
System.out.println("总条数"+userIPage.getTotal());
@@ -0,0 +1,122 @@
package com.adc.da.slrs.sarStandUnqualified.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssue;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssueVo;
import com.adc.da.slrs.sarStandUnqualified.service.IBusinessDeptIssueService;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.List;
@Controller
@RestController
@RequestMapping("/api/sarStandUnqualified/businessDeptIssue")
@Api(tags = "事业部重点问题")
public class BusinessDeptIssueController extends BaseController {
@Autowired
private IBusinessDeptIssueService iBusinessDeptIssueService;
@PutMapping()
@ApiOperation("新增事业部重点问题")
public ResponseMessage addBussDeptIssue(@RequestBody BusinessDeptIssue issue){
boolean b = iBusinessDeptIssueService.addBusinessDeptIssue(issue);
return Result.success(b);
}
@DeleteMapping
@ApiOperation("删除事业部重点问题")
public ResponseMessage removeBussDeptIssue(@RequestParam(value="selectedString") String idList){
List<String> stringList = Arrays.asList(idList.split(","));
boolean b = iBusinessDeptIssueService.removeBusinessDeptIssue(stringList);
return Result.success(b);
}
@GetMapping
@ApiOperation("查询事业部重点问题")
public ResponseMessage<IPage<BusinessDeptIssue>> getBussDeptIssue(BusinessDeptIssueVo pageVo){
IPage<BusinessDeptIssue> page = iBusinessDeptIssueService.getBusinessDeptIssue(pageVo);
return Result.success(page);
}
@PostMapping
@ApiOperation("更新事业部重点问题")
public ResponseMessage updateBussDeptIssue(@RequestBody BusinessDeptIssue issue){
boolean b = iBusinessDeptIssueService.updateBusinessDeptIssue(issue);
return Result.success(b);
}
@PostMapping("/closeIssue")
@ApiOperation("批量关闭事业部重点问题")
public ResponseMessage closeBusinessIssue(@RequestParam(value="ids")String idList){
List<String> stringList = Arrays.asList(idList.split(","));
boolean b = iBusinessDeptIssueService.closeBusinessDeptIssue(stringList);
return Result.success(b);
}
@GetMapping("/exportIssue")
@ApiOperation("导出事业部重点问题")
public void exportIssue(HttpServletResponse response,BusinessDeptIssueVo issue) throws IOException {
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
//TODO
try {
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
if(issue.getFileName()==null || issue.getFileName()==""){
issue.setFileName("事业部重点问题信息");
}
String fileName = URLEncoder.encode(issue.getFileName(), "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
/**
* 重写了get方法,无法使用net.sf.json.JSONObject转换对象
*/
// net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(issue.getExportContent());
// BusinessDeptIssueVo businessDeptIssueVo = (BusinessDeptIssueVo) net.sf.json.JSONObject.toBean(jsonObject, BusinessDeptIssueVo.class);
JSONObject jsonObject = JSONObject.parseObject(issue.getExportContent());
BusinessDeptIssueVo businessDeptIssueVo = JSONObject.toJavaObject(jsonObject, BusinessDeptIssueVo.class);
IPage<BusinessDeptIssue> page = iBusinessDeptIssueService.getBusinessDeptIssue(businessDeptIssueVo);
// 这里需要设置不关闭流
EasyExcel.write(response.getOutputStream(), BusinessDeptIssue.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
.doWrite(page.getRecords());
} catch (Exception e) {
e.printStackTrace();
// 重置response
response.reset();
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
response.getWriter().println(JSONObject.toJSONString(Result.error()));
}
}
}
@@ -0,0 +1,69 @@
package com.adc.da.slrs.sarStandUnqualified.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssue;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssueVo;
import com.adc.da.slrs.sarStandUnqualified.entity.ProductDeptIssue;
import com.adc.da.slrs.sarStandUnqualified.entity.ProductDeptIssueVo;
import com.adc.da.slrs.sarStandUnqualified.service.IBusinessDeptIssueService;
import com.adc.da.slrs.sarStandUnqualified.service.IProductDeptIssueService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
@Controller
@RequestMapping("/api/sarStandUnqualified/productDeptIssue")
@Api(tags = "产品规划部重点问题项管控")
public class ProductDeptIssueController {
@Autowired
private IProductDeptIssueService iProductDeptIssueService;
@PutMapping()
@ApiOperation("新增产品规划部重点问题")
public ResponseMessage addProductDeptIssue(@RequestBody ProductDeptIssue issue){
boolean b = iProductDeptIssueService.addProductDeptIssue(issue);
return Result.success(b);
}
@DeleteMapping
@ApiOperation("删除产品规划部重点问题")
public ResponseMessage removeProductDeptIssue(@RequestParam(value="selectedString") String idList){
List<String> stringList = Arrays.asList(idList.split(","));
boolean b = iProductDeptIssueService.removeProductDeptIssue(stringList);
return Result.success(b);
}
@GetMapping
@ApiOperation("查询产品规划部重点问题")
public ResponseMessage<IPage<ProductDeptIssue>> getProductDeptIssue(@RequestParam ProductDeptIssueVo wrapper){
IPage<ProductDeptIssue> issueList = iProductDeptIssueService.getProductDeptIssue(wrapper);
return Result.success(issueList);
}
@PostMapping
@ApiOperation("更新产品规划部重点问题")
public ResponseMessage updateProductDeptIssue(@RequestBody ProductDeptIssue issue){
boolean b = iProductDeptIssueService.updateProductDeptIssue(issue);
return Result.success(b);
}
@PostMapping("/closeProductIssue")
@ApiOperation("关闭产品规划部重点问题")
public ResponseMessage closeProductDeptIssue(String idList){
List<String> stringList = Arrays.asList(idList.split(","));
boolean b = iProductDeptIssueService.closeProductDeptIssue(stringList);
return Result.success(b);
}
}
@@ -56,6 +56,29 @@ public class SarStandUnqualifiedController extends BaseController<SarStandUnqual
}
}
@ApiOperation("未符合项整改新增")
@PostMapping("/addOne")
public ResponseMessage<Object> add(@RequestBody SarStandUnqualified sarStandUnqualified){
sarStandUnqualified.setCreateTime(new Date());
if (sarStandUnqualifiedService.save(sarStandUnqualified)) {
return Result.success("新增成功");
}
else{
return Result.error("新增失败");
}
}
@ApiOperation("未符合项整改新增")
@PostMapping("/updateOne")
public ResponseMessage<Object> update(@RequestBody SarStandUnqualified sarStandUnqualified){
if (sarStandUnqualifiedService.updateById(sarStandUnqualified)) {
return Result.success("新增成功");
}
else{
return Result.error("新增失败");
}
}
/**
* 分页查询未符合项
* @param sarStandUnqualifiedPage:筛选、分页信息
@@ -2,11 +2,18 @@ package com.adc.da.slrs.sarStandUnqualified.dao;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssue;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface BusinessDeptIssueDao extends BaseMapper<BusinessDeptIssue> {
IPage<BusinessDeptIssue> findPage(IPage<BusinessDeptIssue> page, @Param(Constants.WRAPPER) QueryWrapper<BusinessDeptIssue> queryWrapper);
}
@@ -1,8 +1,15 @@
package com.adc.da.slrs.sarStandUnqualified.dao;
import com.adc.da.slrs.sarStandUnqualified.entity.ProductDeptIssue;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
public interface ProductDeptIssueDao extends BaseMapper<ProductDeptIssue> {
public IPage<ProductDeptIssue> findPage(IPage<ProductDeptIssue> page,@Param(Constants.WRAPPER) QueryWrapper<ProductDeptIssue> wrapper);
}
@@ -1,7 +1,15 @@
package com.adc.da.slrs.sarStandUnqualified.entity;
import com.adc.da.base.page.BasePage;
import com.adc.da.http.PageInfo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@@ -10,17 +18,82 @@ import java.util.Date;
@TableName("business_dept_issue")
public class BusinessDeptIssue {
@ExcelIgnore
@TableId
private String id;
@ExcelIgnore
@TableField("law_id")
private String lawId;
@ExcelProperty("标准号")
@TableField(exist = false)
private String lawNumber;
@ExcelProperty("标准名称")
@TableField(exist = false)
private String lawName;
@ExcelProperty("产品类别")
@TableField("product_type")
private String productType;
@ExcelProperty("实施实践")
@TableField("impl_time")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-mm-dd")
private Date implTime;
@ExcelProperty("实施要求")
@TableField("impl_require")
private String implRequire;
@ExcelProperty("资源符合状态")
@TableField("conform_situation")
private String conformSituation;
@ExcelProperty("开发情况")
@TableField("dev_scheme")
private String devScheme;
@ExcelProperty("sop时间")
@TableField("sop_time")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-mm-dd")
private Date sopTime;
@ExcelProperty("完成情况")
@TableField("complete_situation")
private String completeSituation;
@ExcelProperty("超出sop时限后计划")
@TableField("timeout_situation")
private String timeoutSituation;
@ExcelIgnore
@TableLogic(value = "0",delval = "1")
private String delFlag;
@ExcelProperty("责任部门")
@TableField("response_dept")
private String responseDept;
@ExcelProperty("责任人")
@TableField("response_people")
private String responsePeople;
@ExcelIgnore
@TableField("is_close")
private String isClose;
@ExcelIgnore
@TableField("is_risk")
private String isRisk;
@ExcelIgnore
@TableField(exist = false)
private Integer page;
@ExcelIgnore
@TableField(exist = false)
private Integer pageSize;
}
@@ -0,0 +1,26 @@
package com.adc.da.slrs.sarStandUnqualified.entity;
import lombok.Data;
import java.util.Arrays;
import java.util.List;
@Data
public class BusinessDeptIssueVo extends BusinessDeptIssue {
private String numberOrName;
private String fileName;
private String idList;
private String exportContent;
public List<String> getIdList(){
if (this.idList!=null){
return Arrays.asList(this.idList.split(","));
}else {
return null;
}
}
}
@@ -1,7 +1,12 @@
package com.adc.da.slrs.sarStandUnqualified.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.models.auth.In;
import lombok.Data;
import java.util.Date;
@@ -10,16 +15,59 @@ import java.util.Date;
@TableName("product_dept_issue")
public class ProductDeptIssue {
@TableId
private String id;
@TableField("law_id")
private String lawId;
@TableField(exist = false)
private String lawsNumber;
@TableField(exist = false)
private String lawsName;
@TableField("product_business")
private String productBusiness;
@TableField("platform")
private String platform;
@TableField("poj_name")
private String pojName;
@TableField("poj_description")
private String pojDescription;
@TableField("current_node")
private String currentNode;
@TableField("conceptual_state")
private String conceptualState;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-mm-dd")
@TableField("scheduled_issuance_time")
private Date scheduledIssuanceTime;
@TableField("revised_plan")
private String revisedPlan;
@TableField("explanation")
private String explanation;
@TableField("response_dept")
private String responseDept;
@TableLogic(value = "0",delval = "1")
private String delFlag;
@TableField("is_close")
private String isClose;
@TableField(exist = false)
private Integer page;
@TableField(exist = false)
private Integer pageSize;
}
@@ -0,0 +1,4 @@
package com.adc.da.slrs.sarStandUnqualified.entity;
public class ProductDeptIssueVo extends ProductDeptIssue {
}
@@ -1,7 +1,24 @@
package com.adc.da.slrs.sarStandUnqualified.service;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrack;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrackVo;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssue;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssueVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface IBusinessDeptIssueService extends IService<BusinessDeptIssue> {
public boolean addBusinessDeptIssue(BusinessDeptIssue obj);
public boolean removeBusinessDeptIssue(List<String> idList);
public IPage<BusinessDeptIssue> getBusinessDeptIssue(BusinessDeptIssueVo objVo);
public boolean updateBusinessDeptIssue(BusinessDeptIssue obj);
public boolean closeBusinessDeptIssue(List<String> idList);
}
@@ -1,4 +1,21 @@
package com.adc.da.slrs.sarStandUnqualified.service;
import com.adc.da.slrs.sarStandUnqualified.entity.ProductDeptIssue;
import com.adc.da.slrs.sarStandUnqualified.entity.ProductDeptIssueVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
public interface IProductDeptIssueService {
public boolean addProductDeptIssue(ProductDeptIssue obj);
public boolean removeProductDeptIssue(List<String> idList);
public IPage<ProductDeptIssue> getProductDeptIssue(ProductDeptIssueVo objVo);
public boolean updateProductDeptIssue(ProductDeptIssue obj);
public boolean closeProductDeptIssue(List<String> idList);
}
@@ -2,10 +2,99 @@ package com.adc.da.slrs.sarStandUnqualified.service.impl;
import com.adc.da.slrs.sarStandUnqualified.dao.BusinessDeptIssueDao;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssue;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssueVo;
import com.adc.da.slrs.sarStandUnqualified.service.IBusinessDeptIssueService;
import com.adc.da.util.UUIDUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class BusinessDeptIssueService extends ServiceImpl<BusinessDeptIssueDao, BusinessDeptIssue> implements IBusinessDeptIssueService {
@Autowired
private BusinessDeptIssueDao businessDeptIssueDao;
@Override
public boolean addBusinessDeptIssue(BusinessDeptIssue obj) {
obj.setId(UUIDUtils.randomUUID20());
obj.setDelFlag("0");
return this.save(obj);
}
@Override
public boolean removeBusinessDeptIssue(List<String> idList) {
return removeByIds(idList);
}
@Override
public IPage<BusinessDeptIssue> getBusinessDeptIssue(BusinessDeptIssueVo pageVo) {
IPage<BusinessDeptIssue> page = new Page<>();
QueryWrapper<BusinessDeptIssue> wrapper = new QueryWrapper<>();
//是否分页
if (pageVo.getPage()!=null && pageVo.getPageSize()!=null){
page=new Page<>(pageVo.getPage(),pageVo.getPageSize());
}else {
Integer count = businessDeptIssueDao.selectCount(wrapper);
page=new Page<>(0,count,false);
}
//查询条件
if (pageVo.getIsClose()!=null){
wrapper.like("is_close",pageVo.getIsClose());
}
if (pageVo.getLawNumber()!=null || pageVo.getLawName()!=null){
wrapper.like("laws.LAWS_NUMBER",pageVo.getLawNumber())
.or()
.like("laws.LAWS_NAME",pageVo.getLawName());
}
if (pageVo.getProductType()!=null){
wrapper.like("product_type",pageVo.getProductType());
}
if (pageVo.getResponseDept()!=null){
wrapper.like("response_dept",pageVo.getResponseDept());
}
/**
* 导出
*/
if (pageVo.getIdList()!=null){
wrapper.in("issue.ID",pageVo.getIdList());
}
page = businessDeptIssueDao.findPage(page, wrapper);
return page;
}
@Override
public boolean updateBusinessDeptIssue(BusinessDeptIssue obj) {
return this.updateById(obj);
}
@Override
public boolean closeBusinessDeptIssue(List<String> idList){
List<BusinessDeptIssue> collect = idList.stream()
.map(item -> {
BusinessDeptIssue businessDeptIssue = new BusinessDeptIssue();
businessDeptIssue.setId(item);
businessDeptIssue.setIsClose("1");
return businessDeptIssue;
}).collect(Collectors.toList());
return this.updateBatchById(collect);
}
}
@@ -2,8 +2,81 @@ package com.adc.da.slrs.sarStandUnqualified.service.impl;
import com.adc.da.slrs.sarStandUnqualified.dao.ProductDeptIssueDao;
import com.adc.da.slrs.sarStandUnqualified.entity.ProductDeptIssue;
import com.adc.da.slrs.sarStandUnqualified.entity.ProductDeptIssueVo;
import com.adc.da.slrs.sarStandUnqualified.service.IProductDeptIssueService;
import com.adc.da.util.UUIDUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class ProductDeptIssueService extends ServiceImpl<ProductDeptIssueDao,ProductDeptIssue> implements IProductDeptIssueService {
@Autowired
private ProductDeptIssueDao productDeptIssueDao;
@Override
public boolean addProductDeptIssue(ProductDeptIssue obj) {
obj.setId(UUIDUtils.randomUUID20());
obj.setDelFlag("0");
return this.save(obj);
}
@Override
public boolean removeProductDeptIssue(List<String> idList) {
return removeByIds(idList);
}
@Override
public IPage<ProductDeptIssue> getProductDeptIssue(ProductDeptIssueVo objVo) {
IPage<ProductDeptIssue> page=new Page<>(objVo.getPage(),objVo.getPage());
QueryWrapper<ProductDeptIssue> wrapper = new QueryWrapper<>();
if (objVo.getLawsNumber()!=null){
wrapper.like("laws.LAWS_NAME",objVo.getLawsName())
.or()
.like("laws.LAWS_NUMBER",objVo.getLawsNumber());
}
if (objVo.getPojName()!=null){
wrapper.like("poj_name",objVo.getPojName());
}
if (objVo.getResponseDept()!=null){
wrapper.like("response_dept",objVo.getResponseDept());
}
productDeptIssueDao.findPage(page,wrapper);
return page;
}
@Override
public boolean updateProductDeptIssue(ProductDeptIssue obj) {
return this.updateById(obj);
}
@Override
public boolean closeProductDeptIssue(List<String> idList){
List<ProductDeptIssue> collect = idList.stream()
.map(id -> {
ProductDeptIssue productDeptIssue = new ProductDeptIssue();
productDeptIssue.setId(id);
productDeptIssue.setIsClose("1");
return productDeptIssue;
}).collect(Collectors.toList());
return this.updateBatchById(collect);
}
}
@@ -5,6 +5,7 @@ import com.adc.da.base.web.BaseController;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO;
import com.adc.da.slrs.sarStandWarning.service.Impl.EarlyWarningEOServiceImpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -41,7 +42,7 @@ public class EarlyWarningEOController extends BaseController<EarlyWarningEO> {
* @author zj
* date 2021-06-15
**/
@GetMapping("/StandWarning")
@GetMapping("/${restPath}/StandWarning")
@ApiOperation("标准预警查询")
public ResponseMessage newPageInfo(@RequestParam(defaultValue = "1", value = "newStandPage")int newStandPage, @RequestParam(defaultValue = "10", value = "newStandPageSize") int newStandPageSize,
@RequestParam(defaultValue = "1", value = "oldStandPage")int oldStandPage, @RequestParam(defaultValue = "10", value = "oldStandPageSize") int oldStandPageSize,
@@ -53,6 +54,16 @@ public class EarlyWarningEOController extends BaseController<EarlyWarningEO> {
IPage<EarlyWarningEO> list4 = earlyWarningEOService.oldItemsQuery(oldItemsPage,oldItemsPageSize,earlyWarningEO);//在产车条款预警
return getResponseMessage(list1, list2, list3, list4);
}
@GetMapping("/getStandWarning")
@ApiOperation("标准预警查询")
public ResponseMessage<IPage<StandWarningEO>> getStandWaring(StandWarningEO queryPageEO){
IPage<StandWarningEO> standWarning = earlyWarningEOService.getStandWarning(queryPageEO);
return Result.success(standWarning);
}
private ResponseMessage getResponseMessage(IPage<EarlyWarningEO> list1, IPage<EarlyWarningEO> list2, IPage<EarlyWarningEO> list3, IPage<EarlyWarningEO> list4) {
List<Map<String, Object>> listMap = new ArrayList<Map<String,Object>>();
Map<String, Object> map = new HashMap<String, Object>();
@@ -71,7 +82,7 @@ public class EarlyWarningEOController extends BaseController<EarlyWarningEO> {
* date 2021-06-15
**/
@GetMapping("/ChangePermissions")
@ApiOperation("更改权限")
@ApiOperation("取消预警")
public ResponseMessage ChangePermissions(String id) {
String power = earlyWarningEOService.ChangePermissions(id);
return Result.success("200",power);
@@ -2,9 +2,13 @@ package com.adc.da.slrs.sarStandWarning.dao;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
public interface EarlyWarningEODao extends BaseMapper<EarlyWarningEO> {
IPage<StandWarningEO> selectWarningPage(IPage<StandWarningEO> page, @Param("waringEO") StandWarningEO warningEO);
}
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.Tag;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@@ -23,37 +25,51 @@ public class EarlyWarningEO extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
@TableId("ID")
private String id;
@ApiModelProperty("标准id")
@TableField("STAND_ID")
private String standId;
@ApiModelProperty("标准类别")
@TableField("STAND_TYPE")
private String standType;
@ApiModelProperty("标准号")
@TableField("STAND_CODE")
private String standCode;
@ApiModelProperty("标准名称")
@TableField("STAND_NAME")
private String standName;
@ApiModelProperty("发布日期")
@TableField("PUT_TIME")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date putTime;
@TableField(exist = false)
private Date lastTime;
@ApiModelProperty("适用车型")
@TableField("APPLY_TYPE")
private String applyType;
@ApiModelProperty("责任工程师")
@TableField("DUTY_ENGINEER")
private String dutyEngineer;
@ApiModelProperty("条款(分解单)id")
@TableField("ITEMS_ID")
private String itemsId;
@ApiModelProperty("条款(分解单)编号")
@TableField("ITEMS_NUM")
private String itemsNum;
@ApiModelProperty("条款(分解单)名称")
@TableField("ITEMS_NAME")
private String itemsName;
@@ -70,4 +86,5 @@ public class EarlyWarningEO extends BaseEntity {
private String power;
}
@@ -0,0 +1,73 @@
package com.adc.da.slrs.sarStandWarning.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@Accessors(chain = true)
public class StandWarningEO extends EarlyWarningEO {
private static final long serialVersionUID = 1L;
@ApiModelProperty("新车型实施日期")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String XCXSSRQ;
@ApiModelProperty("在产车实施日期")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String ZCCSSRQ;
@ApiModelProperty("实施日期")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String SSRQ;
private String standNum;
private String standSort;
private String standYear;
private String issueTime;
private Integer page;
private Integer pageSize;
@ApiModelProperty("范围查询新车型实施日期开始")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String startXCXSSRQ;
@ApiModelProperty("范围查询新车型实施日期结束")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String endXCXSSRQ;
@ApiModelProperty("范围查询在产车实施日期开始")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String startZCCSSRQ;
@ApiModelProperty("范围查询在产车实施日期结束")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String endZCCSSRQ;
@ApiModelProperty("范围查询实施日期开始")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String startSSRQ;
@ApiModelProperty("范围查询实施日期结束")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String endSSRQ;
@ApiModelProperty("范围查询发布日期开始")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String startPutTime;
@ApiModelProperty("范围查询发布日期结束")
@DateTimeFormat(pattern = "YYYY-MM-dd")
private String endPutTime;
}
@@ -2,6 +2,7 @@ package com.adc.da.slrs.sarStandWarning.service;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -16,4 +17,7 @@ public interface EarlyWarningEOService extends IService<EarlyWarningEO> {
IPage<EarlyWarningEO> oldPolicyQuery(int current,int pageSize);
String batchSave(List<EarlyWarningEO> earlyWarningEOS);
String ChangePermissions(String id);
IPage<StandWarningEO> getStandWarning(StandWarningEO queryPage);
}
@@ -4,6 +4,7 @@ package com.adc.da.slrs.sarStandWarning.service.Impl;
import com.adc.da.scheduled.entity.DataDTO;
import com.adc.da.slrs.sarStandWarning.dao.EarlyWarningEODao;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO;
import com.adc.da.slrs.sarStandWarning.service.EarlyWarningEOService;
import com.adc.da.sys.util.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -41,24 +42,7 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
@Override
public IPage<EarlyWarningEO> newStandQuery(int current,int pageSize,EarlyWarningEO earlyWarningEO){
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
//根据标准编号查询
if (earlyWarningEO.getStandCode() != null && earlyWarningEO.getStandCode().length() != 0){
wrapper.like("STAND_CODE",earlyWarningEO.getStandCode());
}
//根据标准名称查询
if (earlyWarningEO.getStandName() != null && earlyWarningEO.getStandName().length() != 0){
wrapper.like("STAND_NAME",earlyWarningEO.getStandName());
}
//根据实施日期查询
if (earlyWarningEO.getPutTime() != null ){
SimpleDateFormat formater = new SimpleDateFormat();
formater.applyPattern("yyyy-MM-dd");
wrapper.eq("PUT_TIME",formater.format(earlyWarningEO.getPutTime()));
}
//根据适用车型查询
if (earlyWarningEO.getApplyType() != null && earlyWarningEO.getApplyType().length() != 0){
wrapper.like("APPLY_TYPE",earlyWarningEO.getApplyType());
}
selectMethods(earlyWarningEO, wrapper);
wrapper.eq("mark",1);
return getEarlyWarningEOIPage(current, pageSize, wrapper);
}
@@ -66,23 +50,7 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
public IPage<EarlyWarningEO> oldStandQuery(int current,int pageSize,EarlyWarningEO earlyWarningEO){
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
//根据标准编号查询
if (earlyWarningEO.getStandCode() != null && earlyWarningEO.getStandCode().length() != 0){
wrapper.like("STAND_CODE",earlyWarningEO.getStandCode());
}
//根据标准名称查询
if (earlyWarningEO.getStandName() != null && earlyWarningEO.getStandName().length() != 0){
wrapper.like("STAND_NAME",earlyWarningEO.getStandName());
}
//根据实施日期查询
if (earlyWarningEO.getPutTime() != null ){
SimpleDateFormat formater = new SimpleDateFormat();
formater.applyPattern("yyyy-MM-dd");
wrapper.eq("PUT_TIME",formater.format(earlyWarningEO.getPutTime()));
}
//根据适用车型查询
if (earlyWarningEO.getApplyType() != null && earlyWarningEO.getApplyType().length() != 0){
wrapper.like("APPLY_TYPE",earlyWarningEO.getApplyType());
}
selectMethods(earlyWarningEO, wrapper);
wrapper.eq("mark",2);
return getEarlyWarningEOIPage(current, pageSize, wrapper);
}
@@ -90,23 +58,7 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
public IPage<EarlyWarningEO> newItemsQuery(int current,int pageSize,EarlyWarningEO earlyWarningEO){
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
//根据标准编号查询
if (earlyWarningEO.getStandCode() != null && earlyWarningEO.getStandCode().length() != 0){
wrapper.like("STAND_CODE",earlyWarningEO.getStandCode());
}
//根据标准名称查询
if (earlyWarningEO.getStandName() != null && earlyWarningEO.getStandName().length() != 0){
wrapper.like("STAND_NAME",earlyWarningEO.getStandName());
}
//根据实施日期查询
if (earlyWarningEO.getPutTime() != null ){
SimpleDateFormat formater = new SimpleDateFormat();
formater.applyPattern("yyyy-MM-dd");
wrapper.eq("PUT_TIME",formater.format(earlyWarningEO.getPutTime()));
}
//根据适用车型查询
if (earlyWarningEO.getApplyType() != null && earlyWarningEO.getApplyType().length() != 0){
wrapper.like("APPLY_TYPE",earlyWarningEO.getApplyType());
}
selectMethods(earlyWarningEO, wrapper);
wrapper.eq("mark",3);
return getEarlyWarningEOIPage(current, pageSize, wrapper);
}
@@ -114,23 +66,7 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
public IPage<EarlyWarningEO> oldItemsQuery(int current,int pageSize,EarlyWarningEO earlyWarningEO){
QueryWrapper<EarlyWarningEO> wrapper = new QueryWrapper<>();
//根据标准编号查询
if (earlyWarningEO.getStandCode() != null && earlyWarningEO.getStandCode().length() != 0){
wrapper.like("STAND_CODE",earlyWarningEO.getStandCode());
}
//根据标准名称查询
if (earlyWarningEO.getStandName() != null && earlyWarningEO.getStandName().length() != 0){
wrapper.like("STAND_NAME",earlyWarningEO.getStandName());
}
//根据实施日期查询
if (earlyWarningEO.getPutTime() != null ){
SimpleDateFormat formater = new SimpleDateFormat();
formater.applyPattern("yyyy-MM-dd");
wrapper.eq("PUT_TIME",formater.format(earlyWarningEO.getPutTime()));
}
//根据适用车型查询
if (earlyWarningEO.getApplyType() != null && earlyWarningEO.getApplyType().length() != 0){
wrapper.like("APPLY_TYPE",earlyWarningEO.getApplyType());
}
selectMethods(earlyWarningEO, wrapper);
wrapper.eq("mark",4);
return getEarlyWarningEOIPage(current, pageSize, wrapper);
}
@@ -171,6 +107,17 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
}
return "更改成功";
}
/**
* 分页查询标准预警
* @return
*/
@Override
public IPage<StandWarningEO> getStandWarning(StandWarningEO queryPage) {
IPage<StandWarningEO> iPage = new Page<>(queryPage.getPage(),queryPage.getPageSize());
return earlyWarningEODao.selectWarningPage(iPage,queryPage);
}
private IPage<EarlyWarningEO> getEarlyWarningEOIPage(int current,int pageSize, QueryWrapper<EarlyWarningEO> wrapper) {
wrapper.eq("power",1);
Page<EarlyWarningEO> page = new Page<>(current, pageSize);
@@ -179,4 +126,38 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
System.out.println("总页数"+userIPage.getPages());
return userIPage;
}
private void selectMethods(EarlyWarningEO earlyWarningEO, QueryWrapper<EarlyWarningEO> wrapper) {
//根据标准编号查询
if (earlyWarningEO.getStandCode() != null && earlyWarningEO.getStandCode().length() != 0) {
wrapper.like("STAND_CODE", earlyWarningEO.getStandCode());
}
//根据标准名称查询
if (earlyWarningEO.getStandName() != null && earlyWarningEO.getStandName().length() != 0) {
wrapper.like("STAND_NAME", earlyWarningEO.getStandName());
}
//根据实施日期查询
if (earlyWarningEO.getPutTime() != null) {
SimpleDateFormat formater = new SimpleDateFormat();
formater.applyPattern("yyyy-MM-dd");
if (earlyWarningEO.getLastTime() != null) {
wrapper.between("PUT_TIME", formater.format(earlyWarningEO.getPutTime()), formater.format(earlyWarningEO.getLastTime()));
} else {
wrapper.ge("PUT_TIME", formater.format(earlyWarningEO.getPutTime()));
}
}
if (earlyWarningEO.getLastTime() != null) {
SimpleDateFormat formater = new SimpleDateFormat();
formater.applyPattern("yyyy-MM-dd");
wrapper.le("PUT_TIME", formater.format(earlyWarningEO.getLastTime()));
}
//根据适用车型查询
if (earlyWarningEO.getApplyType() != null && earlyWarningEO.getApplyType().length() != 0) {
wrapper.like("APPLY_TYPE", earlyWarningEO.getApplyType());
}
}
}
@@ -1,6 +1,8 @@
package com.adc.da.slrs.sarStandardComplianceAssessResult.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
import com.adc.da.slrs.sarStandardComplianceAssessResult.service.impl.SarInterpretationNationalStandardServiceImpl;
import io.swagger.annotations.ApiOperation;
@@ -37,4 +39,14 @@ public class SarInterpretationNationalStandardController extends BaseController<
return sarInterpretationNationalStandardService.saveBath(findStandDto);
}
@ApiOperation(value = "修改技术评估结果")
@PostMapping("/updateById")
public ResponseMessage<String> updateById(@RequestBody SarInterpretationNationalStandard findStandDto){
if (sarInterpretationNationalStandardService.updateData(findStandDto)) {
return Result.success("success");
}else {
return Result.error("error");
}
}
}
@@ -79,7 +79,7 @@ public class SarStandardComplianceAssessResultController {
if (eo.getPosition() == 1) {
QueryWrapper<SarInterpretationNationalStandard> queryWrapper = new QueryWrapper<>();
IPage<SarInterpretationNationalStandard> iPage = new Page<>(eo.getCurrent(), eo.getSize());
queryWrapper.select("distinct STAND_ID, STAND_NUMBER, STAND_NAME, STAND_TYPE, INTERPRETATION_TIME");
queryWrapper.select("distinct STAND_ID, STAND_NUMBER, STAND_NAME, STAND_TYPE, INTERPRETATION_TIME,risk_degree");
if (eo.getStandName() != null && !eo.getStandName().trim().equals("")) {
queryWrapper.like("STAND_NAME", eo.getStandName().trim());
}
@@ -2,6 +2,7 @@ package com.adc.da.slrs.sarStandardComplianceAssessResult.dao;
import com.adc.da.slrs.sarStandardComplianceAssessResult.entity.SarInterpretationNationalStandard;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
@@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface SarInterpretationNationalStandardDao extends BaseMapper<SarInterpretationNationalStandard> {
boolean updateData(@Param("find") SarInterpretationNationalStandard findStandDto);
}
@@ -93,4 +93,9 @@ public class SarInterpretationNationalStandard extends BaseEntity {
@TableField("ID")
private String id;
@ApiModelProperty(value = "风险程度")
@TableField("risk_degree")
private String riskDegree;
}
@@ -16,4 +16,6 @@ import java.util.List;
public interface ISarInterpretationNationalStandardService extends IService<SarInterpretationNationalStandard> {
String saveBath(List<SarInterpretationNationalStandard> sarInterpretationNationalStandards);
boolean updateData(SarInterpretationNationalStandard findStandDto);
}
@@ -24,8 +24,8 @@ import java.util.List;
@Service
public class SarInterpretationNationalStandardServiceImpl extends ServiceImpl<SarInterpretationNationalStandardDao, SarInterpretationNationalStandard> implements ISarInterpretationNationalStandardService {
// @Autowired
// SarStandardComplianceProductAssessDao sarStandardComplianceProductAssessDao;
@Autowired
SarInterpretationNationalStandardDao sarInterpretationNationalStandardDao;
@Override
public String saveBath(List<SarInterpretationNationalStandard> sarInterpretationNationalStandards) {
@@ -50,4 +50,9 @@ public class SarInterpretationNationalStandardServiceImpl extends ServiceImpl<Sa
String res = flag ? "1":"0";
return res;
}
@Override
public boolean updateData(SarInterpretationNationalStandard findStandDto) {
return sarInterpretationNationalStandardDao.updateData(findStandDto);
}
}
@@ -92,46 +92,10 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
@GetMapping("/getSarStandardsInfoPage")
//@RequiresPermissions("lawss:sarStandardsInfo:getSarStandardsInfoPage")
public ResponseMessage<PageInfo<SarStandardsInfo>> getSarStandardsInfoPage(SarStandardsInfoEOPage page,@RequestParam(defaultValue = "0") String mark) throws Exception {
int isNull = -1;
if (null != page.getNowOrderBy()) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("ISSUE_TIME");//发布日期
break;
case 2:
page.setOrderByA("SAR_STAND_ATTR_INFO.ZCCSSRQ");//新车型实施日期
break;
case 3:
page.setOrderByA("SAR_STAND_ATTR_INFO.XCXSSRQ");//在产车实施日期
break;
case 4:
page.setOrderByA("SAR_STANDARDS_INFO.text_status");//文本状态
break;
case 5:
page.setOrderByA("paixu");
break;
case 6:
page.setOrderByA("SAR_STAND_ATTR_INFO.SSRQ");
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
default:
page.setOrder1(null);
break;
}
}
nowOrderFunc(page);
}
if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
List<SarAdvanceSearchVO> searchList = JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
String advanceStr = SarAdvanceSearchUtil.createStandSql(searchList);
@@ -142,40 +106,6 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
}
}
// if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
// List<SarAdvanceSearchVO> searchList = JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
// int i = 0;
// for (SarAdvanceSearchVO sarAdvanceSearchVO:searchList){
// if ("SVPPS".equals(sarAdvanceSearchVO.getField()) && StringUtils.isBlank(sarAdvanceSearchVO.getValue())){
// isNull = i;
// }
// i++;
// }
// if (-1 != isNull) {
// searchList.remove(isNull);
// }
// if (isNull == 0 && searchList.size() > 0){
// searchList.get(0).setConnect("");
// }
// String advanceStr = SarAdvanceSearchUtil.createSql(searchList);
// if (null != advanceStr) {
// advanceStr = advanceStr.replace("stand_number", "concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER,'-',SAR_STANDARDS_INFO.STAND_YEAR)");
// }
// if (-1 != isNull && StringUtils.isBlank(advanceStr)){
// advanceStr = advanceStr + " SVPPS is null";
// }else if (-1 != isNull && StringUtils.isNotBlank(advanceStr)){
// advanceStr = advanceStr + " and SVPPS is null";
// }
// if (StringUtils.isNotBlank(advanceStr)) {
// page.setAdvanceSearchStr(advanceStr);
// } else {
// page.setAdvanceSearchStr(null);
// }
// }
if(page.getUserId() == null || page.getUserId().equals("")){
page.setUserId(LoginUserUtil.getUserId());
}
@@ -183,6 +113,45 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
return Result.success(getPageInfo(page.getPager(), rows));
}
private void nowOrderFunc(SarStandardsInfoEOPage page) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("ISSUE_TIME");//发布日期
break;
case 2:
page.setOrderByA("ZCCSSRQ");//新车型实施日期
break;
case 3:
page.setOrderByA("XCXSSRQ");//在产车实施日期
break;
case 4:
page.setOrderByA("standTextStatusShow");//文本状态
break;
case 5:
page.setOrderByA("paixu");
break;
case 6:
page.setOrderByA("SSRQ");
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
break;
default:
page.setOrder1(null);
break;
}
}
}
@ApiOperation(value = "|SarStandardsInfoEO|自定义分页查询")
@GetMapping("/getSarStandardsInfoPageBak")
//@RequiresPermissions("lawss:sarStandardsInfo:getSarStandardsInfoPage")
@@ -120,6 +120,10 @@ public class SarBussionessStandEOPage extends BasePage {
private String paixu;
private String shunxu;
private String sql;
private Integer nowOrder;
private Integer nowOrderBy;
private String orderByA = "";
private String order1 = "";
// 新增字段
private String FZRQBUSS;
@@ -144,6 +148,38 @@ public class SarBussionessStandEOPage extends BasePage {
private String GLWJBUSS;
private String XCSJBUSS;
public Integer getNowOrder() {
return nowOrder;
}
public void setNowOrder(Integer nowOrder) {
this.nowOrder = nowOrder;
}
public Integer getNowOrderBy() {
return nowOrderBy;
}
public void setNowOrderBy(Integer nowOrderBy) {
this.nowOrderBy = nowOrderBy;
}
public String getOrderByA() {
return orderByA;
}
public void setOrderByA(String orderByA) {
this.orderByA = orderByA;
}
public String getOrder1() {
return order1;
}
public void setOrder1(String order1) {
this.order1 = order1;
}
public String getFZRQBUSS() {
return FZRQBUSS;
}
@@ -84,9 +84,9 @@ public class SarStandardsInfoEOPage extends BasePage {
private String productId;
private Integer nowOrder;
private Integer nowOrderBy;
private String orderByA = "a.issue_time";
private String orderByA = "";
private String orderBy1 = "SAR_STANDARDS_INFO.issue_time";
private String order1 = "desc";
private String order1 = "";
// zhaokaiyao
private String textStatus;//文本状态
@@ -53,6 +53,9 @@ import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.slrs.standardSplit.dao.SarFileSplitInfoEODao;
import com.adc.da.slrs.standardSplit.entity.SarFileSplitInfoEO;
import com.adc.da.slrs.standardSplit.entity.SarFileSplitInfoEOPage;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
import com.adc.da.slrs.tsDictionaryType.dao.TsDicTypeDao;
import com.adc.da.slrs.tsDictionaryType.dao.TsDictionaryDao;
@@ -539,16 +542,23 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
return resultMap;
}
@Autowired
private SarFileSplitInfoEODao sarFileSplitInfoEODao;
public void attrInfoShowDetails(List<SarStandardsInfo> sarlist) throws Exception {
for (SarStandardsInfo row : sarlist) {
attrInfoDetails(row);
Map<String, Object> getAttrMap = row.getAttrInfoMap();
if (getAttrMap != null && getAttrMap.size() > 0) {
//存在的分解单文本名称列表
LinkedList<String> itemExistList = new LinkedList<>();
//判断文本是否已被拆分,把已被拆分过的文件给前端判断是否显示分解单
SarFileSplitInfoEOPage sarFileSplitInfoEOPage = new SarFileSplitInfoEOPage();
sarFileSplitInfoEOPage.setStandId(row.getId());
List<SarFileSplitInfoEO> sarFileSplitInfoEOS = sarFileSplitInfoEODao.queryByPageOwn(sarFileSplitInfoEOPage);
List<String> itemExistList = sarFileSplitInfoEOS.stream()
.map(item -> item.getFileType())
.collect(Collectors.toList());
getAttrMap.put("itemExistList",itemExistList);
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
String value = "";
@@ -557,15 +567,6 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
if (StringUtils.isNotBlank(value)) {
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
entry.setValue(fileObj);
//以标准id和文本类型查询分解单表 有数据设标记为为 1
FindSarItemsPageReqDTO sarItemCount = new FindSarItemsPageReqDTO();
sarItemCount.setStandId(row.getId());
sarItemCount.setFileType(name);
Integer sarItemsCount = standItemsDao.sarItemCount(sarItemCount);
if (sarItemsCount>0){
//存在分解单的文本名称存入列表
itemExistList.add(name);
}
}
}else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
value = entry.getValue().toString();
@@ -1613,11 +1614,53 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
}else {
page.setUserId(LoginUserUtil.getUserId());
}
if (null != page.getNowOrderBy()) {
nowOrderFunc(page);
}
List<SarStandardsInfo> getList = dao.getSarStandardsExportInfo(page);
attrInfoShowExport(getList);
return getList;
}
private void nowOrderFunc(SarStandardsInfoEOPage page) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("ISSUE_TIME");//发布日期
break;
case 2:
page.setOrderByA("ZCCSSRQ");//新车型实施日期
break;
case 3:
page.setOrderByA("XCXSSRQ");//在产车实施日期
break;
case 4:
page.setOrderByA("text_status");//文本状态
break;
case 5:
page.setOrderByA("paixu");
break;
case 6:
page.setOrderByA("SSRQ");
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
break;
default:
page.setOrder1(null);
break;
}
}
}
public ResponseMessage<SarStandardsInfo> importSarStandardsInfoData(List<Map<String, String>> dataList, String standType, String menuId, String filepath) {
//此处需要做各种验证数据库操作
try {
@@ -40,10 +40,10 @@ public class SarVppsTreeController extends BaseController<SarVppsTree> {
@ApiOperation("根据父ID查询子所有资源")
@GetMapping("/childByList")
public ResponseMessage<List<SarVppsTree>> childByList(String ids){
SarVppsTree tree = new SarVppsTree();
tree.setId(ids);
List<SarVppsTree> tsResources = iSarVppsTreeService.recursionGetChildren(tree);
public ResponseMessage<List<SarVppsTree>> childByList(SarVppsTree parent){
// SarVppsTree tree = new SarVppsTree();
// tree.setId(ids);
List<SarVppsTree> tsResources = iSarVppsTreeService.recursionGetChildren(parent);
return Result.success(tsResources);
}
@@ -13,7 +13,7 @@ import java.util.List;
/**
* <p>
*
*
* </p>
*
* @author super_liu
@@ -66,6 +66,15 @@ public class SarVppsTree extends BaseEntity {
@TableField(exist = false)
private String parentIdsName;
@ApiModelProperty("层级")
@TableField("LEVEL")
private Integer level;
@ApiModelProperty("类型")
@TableField("TYPE")
private String type;
@TableField(exist=false)
private List<String> roleIds;
@@ -27,8 +27,11 @@ public class SarVppsTreeServiceImpl extends ServiceImpl<SarVppsTreeDao, SarVppsT
@Override
public List<SarVppsTree> getAll(SarVppsTree sarVppsTree) {
QueryWrapper<SarVppsTree> tsResourceQueryWrapper=new QueryWrapper<>();
tsResourceQueryWrapper.isNull("PID");
tsResourceQueryWrapper.eq("TYPE",sarVppsTree.getType())
.eq("LEVEL",0);
List<SarVppsTree> list = this.baseMapper.selectList(tsResourceQueryWrapper);
list.forEach(item->item.setVppsCode("10"));
// for(SarVppsTree tree:list){
// tree.setChildren(recursionGetChildren((tree)));
// }
@@ -44,11 +47,14 @@ public class SarVppsTreeServiceImpl extends ServiceImpl<SarVppsTreeDao, SarVppsT
public List<SarVppsTree> recursionGetChildren(SarVppsTree parent){
QueryWrapper<SarVppsTree> sarMenuQueryWrapper=new QueryWrapper<>();
sarMenuQueryWrapper.orderByAsc("SORT");
sarMenuQueryWrapper.in("PID",parent.getId());
// sarMenuQueryWrapper.in("PID",parent.getId());
sarMenuQueryWrapper.eq("LEVEL", parent.getLevel()+1)
.eq("TYPE",parent.getType())
.like("VPPS_CODE",parent.getVppsCode());
List<SarVppsTree> children=this.baseMapper.selectList(sarMenuQueryWrapper);
for(SarVppsTree sarMenu:children){
sarMenu.setChildren(recursionGetChildren((sarMenu)));
}
// for(SarVppsTree sarMenu:children){
// sarMenu.setChildren(recursionGetChildren((sarMenu)));
// }
return children;
}
}
@@ -4,6 +4,8 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.PageInfo;
import com.adc.da.person.entity.PersonMsgEO;
@@ -193,20 +195,40 @@ public class SarFileSplitInfoEOController extends BaseController<SarFileSplitInf
/**
* 使选定的拆分条款 插入分解单
*/
querySame.forEach(item->{
QueryWrapper<SarStandItems> sarStandItemsQueryWrapper = new QueryWrapper<>();
sarStandItemsQueryWrapper.eq("edit_flag",item.getEditFlag());
SarStandItems sarStandItems = new SarStandItems();
sarStandItems.setStandId(sarFileSplitInfoEO.getStandId());
sarStandItems.setEditFlag(item.getEditFlag());
sarStandItems.setItemsName(item.getItemsName());
sarStandItems.setTermsConditions(item.getItermsConditions());
sarStandItems.setItemsNum(item.getItemsNum());
sarStandItems.setId(UUIDUtils.randomUUID20());
sarStandItems.setFileType(sarFileSplitInfoEO.getFileType());
ServiceImpl.saveOrUpdate(sarStandItems,sarStandItemsQueryWrapper);
});
List<SarStandItems> sarStandItemList = querySame.stream()
.map(item -> {
SarStandItems sarStandItem = new SarStandItems();
sarStandItem.setStandId(sarFileSplitInfoEO.getStandId());
sarStandItem.setEditFlag(item.getEditFlag());
sarStandItem.setItemsName(item.getItemsName());
sarStandItem.setTermsConditions(item.getItermsConditions());
sarStandItem.setItemsNum(item.getItemsNum());
sarStandItem.setId(UUIDUtils.randomUUID20());
sarStandItem.setFileType(sarFileSplitInfoEO.getFileType());
sarStandItem.setEditFlag(item.getEditFlag());
return sarStandItem;
})
.collect(Collectors.toList());
ServiceImpl.saveBatch(sarStandItemList);
// querySame.forEach(item->{
// QueryWrapper<SarStandItems> sarStandItemsQueryWrapper = new QueryWrapper<>();
// sarStandItemsQueryWrapper.eq("edit_flag",item.getEditFlag());
// SarStandItems sarStandItems = new SarStandItems();
// sarStandItems.setStandId(sarFileSplitInfoEO.getStandId());
// sarStandItems.setEditFlag(item.getEditFlag());
// sarStandItems.setItemsName(item.getItemsName());
// sarStandItems.setTermsConditions(item.getItermsConditions());
// sarStandItems.setItemsNum(item.getItemsNum());
// sarStandItems.setId(UUIDUtils.randomUUID20());
// sarStandItems.setFileType(sarFileSplitInfoEO.getFileType());
// ServiceImpl.saveOrUpdate(sarStandItems,sarStandItemsQueryWrapper);
//
// });
//根据标准号查询标准是否存在
@@ -190,7 +190,7 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
nowFile.mkdirs();
String fileName = fileOriName + ".xls";
HSSFSheet sheetItems = workbook.createSheet("条款内容");
String[] headers = {"条款号","条款名称","内容简介","责任部门","FO","责任工程师","SVPPS","适用车辆类型","要求类型","企标覆盖关系"};
String[] headers = {"条款号","条款名称","内容简介"};
HSSFCellStyle cellStyle =workbook.createCellStyle();
cellStyle.setWrapText(true);
// cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
@@ -4,6 +4,7 @@ import com.adc.da.base.web.BaseController;
import com.adc.da.http.PageInfo;
import com.adc.da.person.dao.PersonCollectEODao;
import com.adc.da.person.dao.PersonShareEODao;
import com.adc.da.slrs.standardSplit.dao.SarStandCompareHisEODao;
import com.adc.da.slrs.standardSplit.entity.SarStandCompareHisEO;
import com.adc.da.slrs.standardSplit.entity.SarStandCompareHisEOPage;
import com.adc.da.slrs.standardSplit.service.SarItemsCompareHisEOService;
@@ -18,6 +19,7 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@@ -46,6 +48,9 @@ public class SarStandCompareHisEOController extends BaseController<SarStandCompa
@Autowired
private PersonCollectEODao personCollectEODao;
@Autowired
private SarStandCompareHisEODao dao;
@ApiOperation(value = "|SarStandCompareHisEO|分页查询")
@GetMapping("/page")
// @RequiresPermissions("lawss:sarStandCompareHis:page")
@@ -126,8 +131,15 @@ public class SarStandCompareHisEOController extends BaseController<SarStandCompa
@ApiOperation(value = "全文比对")
@PostMapping("/fullTextComparison")
public ResponseMessage<Map<String,Object>> fullTextComparison(String leftStandard, String rightStandard) throws Exception {
Map<String,Object> resultMap = sarStandCompareHisEOService.fullTextComparison(leftStandard,rightStandard);
return Result.success(resultMap);
public ResponseMessage<String> fullTextComparison(String leftStandard, String rightStandard) throws Exception {
String id=UUIDUtils.randomUUID(32);
SarStandCompareHisEO sarStandCompareHisEO =new SarStandCompareHisEO();
sarStandCompareHisEO.setId(id);
sarStandCompareHisEO.setCompareStatus("比对中");
sarStandCompareHisEO.setCompareType("全文比对");
sarStandCompareHisEO.setCreateTime(new Date());
dao.insertSelective(sarStandCompareHisEO);
Map<String,Object> resultMap = sarStandCompareHisEOService.fullTextComparison(leftStandard,rightStandard,id);
return Result.success("标准正在比对中请稍后查看结果");
}
}
@@ -3,6 +3,10 @@ package com.adc.da.slrs.standardSplit.controller;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.PageInfo;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.slrs.standardSplit.entity.SarFileSplitItemsEO;
import com.adc.da.slrs.standardSplit.entity.SarStandFileEO;
import com.adc.da.slrs.standardSplit.entity.SarStandFileEOPage;
@@ -144,4 +148,12 @@ public class SarStandFileEOController extends BaseController<SarStandFileEO> {
return Result.success(sarStandFileEOS);
}
@ApiOperation(value = "查询文本信息")
@GetMapping("/queryFileInfoNew")
public ResponseMessage<List<SarStandFileEO>> queryFileInfoNew(@RequestParam("standId") String standId,@RequestParam("type") String type) throws Exception {
List<SarStandFileEO> sarStandFileEOS = sarStandFileEOService.selectFileByStandIdOCR(standId,type);
return Result.success(sarStandFileEOS);
}
}
@@ -2,6 +2,7 @@ package com.adc.da.slrs.standardSplit.entity;
import com.adc.da.base.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.ArrayList;
import java.util.Date;
@@ -13,6 +14,7 @@ import java.util.List;
* <b>日期</b> 2020-02-24 <br>
* <b>版权所有<b>版权归北京卡达克数据技术中心所有<br>
*/
@Data
public class SarStandCompareHisEO extends BaseEntity {
private String compareType;
@@ -36,6 +38,7 @@ public class SarStandCompareHisEO extends BaseEntity {
private String newFileTypeShow;
private String newSarType;
private String collectId;
private String compareStatus;
private List<SarStandItemsCompareHisEO> resLeftMapList = new ArrayList<>();
@@ -1,6 +1,7 @@
package com.adc.da.slrs.standardSplit.entity;
import com.adc.da.base.page.BasePage;
import lombok.Data;
/**
* <b>功能</b>SAR_STAND_COMPARE_HIS SarStandCompareHisEOPage<br>
@@ -8,6 +9,7 @@ import com.adc.da.base.page.BasePage;
* <b>日期</b> 2020-02-24 <br>
* <b>版权所有<b>版权归北京卡达克数据技术中心所有<br>
*/
@Data
public class SarStandCompareHisEOPage extends BasePage {
private String compareType;
@@ -50,6 +52,7 @@ public class SarStandCompareHisEOPage extends BasePage {
private String oldNumOrName;
private String newNumOrName;
private String compareStatus;
private String shunxu;
@@ -21,5 +21,5 @@ public interface SarStandCompareHisEOService {
Map<String,Object> clauseComparison(String oldItemId, String newItemId, String standHisId);
Map<String,Object> fullTextComparison(String leftStandard, String rightStandard) throws Exception;
Map<String,Object> fullTextComparison(String leftStandard, String rightStandard,String id) throws Exception;
}
@@ -25,4 +25,6 @@ public interface SarStandFileEOService {
List<SarStandFileEO> selectFileByStandId(String standId);
List<SarStandFileEO> selectFileByStandIdOCR(String standId,String type) throws Exception;
}

Some files were not shown because too many files have changed in this diff Show More