Bladeren bron

客户信息主营产品修改日志排序修改

anderx 4 jaren geleden
bovenliggende
commit
12f6879d3e

+ 14 - 4
.idea/workspace.xml

@@ -10,7 +10,9 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="03bdfc55-71bf-4741-8c4c-e1a0c2a3c3ba" name="Default Changelist" comment="处理相同的修改">
+    <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/common/mapper/UserDataLogMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/goafanti/common/mapper/UserDataLogMapper.xml" 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" />
     </list>
     <list id="571ad643-3e7d-4437-aedf-999fc56d0449" name="updateBusinessScope" comment="" />
@@ -235,7 +237,7 @@
       <workItem from="1630888067668" duration="852000" />
       <workItem from="1630893291690" duration="11740000" />
       <workItem from="1630976664603" duration="14614000" />
-      <workItem from="1631062478856" duration="15913000" />
+      <workItem from="1631062478856" duration="19712000" />
     </task>
     <task id="LOCAL-00001" summary="修改客户跟进列表">
       <created>1630486551669</created>
@@ -440,7 +442,14 @@
       <option name="project" value="LOCAL" />
       <updated>1631090807277</updated>
     </task>
-    <option name="localTasksCounter" value="30" />
+    <task id="LOCAL-00030" summary="导出修改">
+      <created>1631090866513</created>
+      <option name="number" value="00030" />
+      <option name="presentableId" value="LOCAL-00030" />
+      <option name="project" value="LOCAL" />
+      <updated>1631090866513</updated>
+    </task>
+    <option name="localTasksCounter" value="31" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -484,7 +493,8 @@
     <MESSAGE value="sql查询优化" />
     <MESSAGE value="config整理" />
     <MESSAGE value="处理相同的修改" />
-    <option name="LAST_COMMIT_MESSAGE" value="处理相同的修改" />
+    <MESSAGE value="导出修改" />
+    <option name="LAST_COMMIT_MESSAGE" value="导出修改" />
     <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
   </component>
   <component name="XDebuggerManager">

+ 1 - 0
src/main/java/com/goafanti/common/mapper/UserDataLogMapper.xml

@@ -80,5 +80,6 @@
     date_format(create_time ,'%Y-%m-%d %H:%i:%s')createTimes
     from user_data_log
     where uid= #{uid}
+    order by create_time desc
   </select>
 </mapper>

+ 26 - 32
src/main/java/com/goafanti/common/utils/excel/NewExcelUtil.java

@@ -179,12 +179,6 @@ public class NewExcelUtil<T> {
 
 	private void exportExcel(HttpServletResponse response) {
 		try {
-			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);
@@ -213,7 +207,6 @@ public class NewExcelUtil<T> {
 				wb.write(out);
 				out.flush();
 				out.close();
-			}
 		} catch (Exception e) {
 			e.printStackTrace();
 			throw new BusinessException("导出Excel失败,请联系网站管理员!");
@@ -254,36 +247,37 @@ public class NewExcelUtil<T> {
 	 */
 	public Result exportExcel() {
 		OutputStream out = null;
+		String filename="";
 		try {
-			// 取出一共有多少个sheet.
-			int sheetNo = (int) Math.ceil(list.size() / sheetSize);
-			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++);
+				// 取出一共有多少个sheet.
+				int sheetNo = (int) Math.ceil(list.size() / sheetSize);
+				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++);
+					}
+					filename = encodingFilename(sheetName);
+					out = new FileOutputStream(getAbsoluteFile(filename));
+					fillExcelData(index, row);
+					addStatisticsRow();
 				}
+				wb.write(out);
 
-				fillExcelData(index, row);
-				addStatisticsRow();
-			}
-			String filename = encodingFilename(sheetName);
-			out = new FileOutputStream(getAbsoluteFile(filename));
-			wb.write(out);
 			return new Result().data(filename);
 		} catch (Exception e) {
-			log.error("导出Excel异常{}", e.getMessage());
+			e.printStackTrace();
 			throw new BusinessException("导出Excel失败,请联系网站管理员!");
 		} finally {
 			if (wb != null) {