Browse Source

处理相同的修改

anderx 4 years ago
parent
commit
014b6ae9ff

+ 14 - 5
.idea/workspace.xml

@@ -10,9 +10,10 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="03bdfc55-71bf-4741-8c4c-e1a0c2a3c3ba" name="Default Changelist" comment="config整理">
+    <list default="true" id="03bdfc55-71bf-4741-8c4c-e1a0c2a3c3ba" name="Default Changelist" comment="处理相同的修改">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/goafanti/common/utils/excel/NewExcelUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/goafanti/common/utils/excel/NewExcelUtil.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/goafanti/patent/service/impl/PatentNewServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/goafanti/patent/service/impl/PatentNewServiceImpl.java" afterDir="false" />
     </list>
     <list id="571ad643-3e7d-4437-aedf-999fc56d0449" name="updateBusinessScope" comment="" />
     <option name="SHOW_DIALOG" value="false" />
@@ -236,7 +237,7 @@
       <workItem from="1630888067668" duration="852000" />
       <workItem from="1630893291690" duration="11740000" />
       <workItem from="1630976664603" duration="14614000" />
-      <workItem from="1631062478856" duration="13605000" />
+      <workItem from="1631062478856" duration="15872000" />
     </task>
     <task id="LOCAL-00001" summary="修改客户跟进列表">
       <created>1630486551669</created>
@@ -427,7 +428,14 @@
       <option name="project" value="LOCAL" />
       <updated>1631081269129</updated>
     </task>
-    <option name="localTasksCounter" value="28" />
+    <task id="LOCAL-00028" summary="处理相同的修改">
+      <created>1631085457045</created>
+      <option name="number" value="00028" />
+      <option name="presentableId" value="LOCAL-00028" />
+      <option name="project" value="LOCAL" />
+      <updated>1631085457045</updated>
+    </task>
+    <option name="localTasksCounter" value="29" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -470,7 +478,8 @@
     <MESSAGE value="1、资料列表修改" />
     <MESSAGE value="sql查询优化" />
     <MESSAGE value="config整理" />
-    <option name="LAST_COMMIT_MESSAGE" value="config整理" />
+    <MESSAGE value="处理相同的修改" />
+    <option name="LAST_COMMIT_MESSAGE" value="处理相同的修改" />
     <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
   </component>
   <component name="XDebuggerManager">

+ 33 - 29
src/main/java/com/goafanti/common/utils/excel/NewExcelUtil.java

@@ -170,7 +170,6 @@ public class NewExcelUtil<T> {
 	 * 	导出CXCEL表到指定目录
 	 * @param list 导出数据集合
 	 * @param sheetName 工作表的名称
-	 * @param response
 	 */
 	public Result exportExcel(List<T> list, String sheetName, String uploadPath) {
 		this.init(list, sheetName);
@@ -180,35 +179,41 @@ public class NewExcelUtil<T> {
 
 	private void exportExcel(HttpServletResponse response) {
 		try {
-			OutputStream out = response.getOutputStream();
-			// 取出一共有多少个sheet.
-			int sheetNo = (int) Math.ceil(list.size() / sheetSize);
-			
-			String dateFilename =DateFilename(sheetName);
-			for (int index = 0; index <= sheetNo; index++) {
-				createSheet(sheetNo, index);
-				// 产生一行
-				Row title = sheet.createRow(0);
-				Cell cell = title.createCell(0);
-				cell.setCellValue(sheetName);
-				CellRangeAddress region = new CellRangeAddress(0, 0, 0, fields.size()-1);
-				sheet.addMergedRegion(region);
-				cell.setCellStyle(styles.get("total"));
-				Row row = sheet.createRow(1);
-				int column = 0;
-				// 写入各个字段的列头名称
-				for (Object[] os : fields) {
-					Excel excel = (Excel) os[1];
-					this.createCell(excel, row, column++);
+			log.debug("导出至本地开始");
+
+			if (list.isEmpty()){
+				log.debug("导出数据为空");
+			}else{
+				log.debug("导出数据"+list.size());
+				OutputStream out = response.getOutputStream();
+				// 取出一共有多少个sheet.
+				int sheetNo = (int) Math.ceil(list.size() / sheetSize);
+				String dateFilename =DateFilename(sheetName);
+				for (int index = 0; index <= sheetNo; index++) {
+					createSheet(sheetNo, index);
+					// 产生一行
+					Row title = sheet.createRow(0);
+					Cell cell = title.createCell(0);
+					cell.setCellValue(sheetName);
+					CellRangeAddress region = new CellRangeAddress(0, 0, 0, fields.size()-1);
+					sheet.addMergedRegion(region);
+					cell.setCellStyle(styles.get("total"));
+					Row row = sheet.createRow(1);
+					int column = 0;
+					// 写入各个字段的列头名称
+					for (Object[] os : fields) {
+						Excel excel = (Excel) os[1];
+						this.createCell(excel, row, column++);
+					}
+					fillExcelData(index, row);
+					addStatisticsRow();
 				}
-				fillExcelData(index, row);
-				addStatisticsRow();
+				response.addHeader("Content-Disposition", "attachment;filename="  + new String(dateFilename.getBytes(),"iso-8859-1"));
+				response.setContentType("application/octet-stream;charset=utf-8");
+				wb.write(out);
+				out.flush();
+				out.close();
 			}
-			response.addHeader("Content-Disposition", "attachment;filename="  + new String(dateFilename.getBytes(),"iso-8859-1"));  
-			response.setContentType("application/octet-stream;charset=utf-8");  
-			wb.write(out);
-			out.flush();
-			out.close();
 		} catch (Exception e) {
 			log.error("导出Excel异常{}", e.getMessage());
 			throw new BusinessException("导出Excel失败,请联系网站管理员!");
@@ -1021,7 +1026,6 @@ public class NewExcelUtil<T> {
 	/**
 	 * 读取文件为字节数据
 	 * 
-	 * @param key 地址
 	 * @return 字节数据
 	 */
 	public static byte[] readFile(String url) {

+ 0 - 1
src/main/java/com/goafanti/patent/service/impl/PatentNewServiceImpl.java

@@ -558,7 +558,6 @@ public class PatentNewServiceImpl  extends BaseMybatisDao<PatentNewMapper> imple
 		return null;
 	}
 
-	@SuppressWarnings("unchecked")
 	@Override
 	public Object export(PatentNewBo p, Integer pageSize, Integer pageNo) {
 		NewExcelUtil<PatentNewBo> excel=new NewExcelUtil<PatentNewBo>(PatentNewBo.class);