From 2815206d8821a79de11d6f2c3de9c4bedbe719b0 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 30 一月 2026 15:29:17 +0800
Subject: [PATCH] 提交忽略文件
---
admin/public/favicon.ico | 0
server/services/src/main/java/com/doumee/service/business/impl/CasesServiceImpl.java | 2
server/services/src/main/java/com/doumee/core/annotation/excel/ExcelImporter.java | 143 +++++++++++------
server/services/src/main/java/com/doumee/dao/business/dto/MemberImport.java | 5
admin/src/components/business/OperaCasesImportWindow.vue | 2
server/services/src/main/java/com/doumee/dao/business/model/Cases.java | 6
server/services/src/main/java/com/doumee/core/annotation/excel/ExcelPictureUtil.java | 81 +++++++++
admin/src/views/business/cases.vue | 2
admin/public/template/member.xlsx | 0
server/services/src/main/java/com/doumee/service/business/impl/ImportRecordServiceImpl.java | 190 ++++++++++++++++++++---
admin/src/components/business/OperaCasesWindow.vue | 2
server/services/src/main/java/com/doumee/dao/business/dto/CasesImport.java | 41 +++-
12 files changed, 365 insertions(+), 109 deletions(-)
diff --git a/admin/public/favicon.ico b/admin/public/favicon.ico
index e69de29..271e35f 100644
--- a/admin/public/favicon.ico
+++ b/admin/public/favicon.ico
Binary files differ
diff --git a/admin/public/template/member.xlsx b/admin/public/template/member.xlsx
index be97d45..b872ea2 100644
--- a/admin/public/template/member.xlsx
+++ b/admin/public/template/member.xlsx
Binary files differ
diff --git a/admin/src/components/business/OperaCasesImportWindow.vue b/admin/src/components/business/OperaCasesImportWindow.vue
index 65f992a..f8b6ab8 100644
--- a/admin/src/components/business/OperaCasesImportWindow.vue
+++ b/admin/src/components/business/OperaCasesImportWindow.vue
@@ -48,7 +48,7 @@
this.title = title
this.fileName = ''
this.visible = true
- this.type = 0
+ this.type = 1
},
// 瀵煎嚭妯℃澘
exportTemplate () {
diff --git a/admin/src/components/business/OperaCasesWindow.vue b/admin/src/components/business/OperaCasesWindow.vue
index f920d92..37fa7a3 100644
--- a/admin/src/components/business/OperaCasesWindow.vue
+++ b/admin/src/components/business/OperaCasesWindow.vue
@@ -74,7 +74,7 @@
return {
isUploading: false,
uploadData: {
- folder: 'dianjiang/category'
+ folder: 'dianjiang/cases'
},
// 琛ㄥ崟鏁版嵁
form: {
diff --git a/admin/src/views/business/cases.vue b/admin/src/views/business/cases.vue
index 6024fbd..c66a554 100644
--- a/admin/src/views/business/cases.vue
+++ b/admin/src/views/business/cases.vue
@@ -54,7 +54,7 @@
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55"></el-table-column>
- <el-table-column prop="name" label="妗堜緥鏍囬" min-width="100px"></el-table-column>
+ <el-table-column prop="name" label="妗堜緥鏍囬" min-width="200px"></el-table-column>
<el-table-column prop="icon" label="鎺掕姒滃浘闆�" min-width="220px">
<template slot-scope="{row}">
<div style="display: flex; flex-wrap: wrap;width: 200px;" v-if="row.fileList && row.fileList.length">
diff --git a/server/services/src/main/java/com/doumee/core/annotation/excel/ExcelImporter.java b/server/services/src/main/java/com/doumee/core/annotation/excel/ExcelImporter.java
index 56eb9a9..a19134d 100644
--- a/server/services/src/main/java/com/doumee/core/annotation/excel/ExcelImporter.java
+++ b/server/services/src/main/java/com/doumee/core/annotation/excel/ExcelImporter.java
@@ -4,6 +4,7 @@
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFPicture;
import org.apache.poi.xssf.usermodel.XSSFPictureData;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
@@ -329,64 +330,102 @@
}
StringBuilder sb = new StringBuilder();
for (Object[] os : annotationList){
- Object val = this.getCellValue(row, column++);
- if (val != null){
- ExcelColumn ef = (ExcelColumn)os[0];
- // Get param type and type cast
- Class<?> valType = Class.class;
- if (os[1] instanceof Field){
- valType = ((Field)os[1]).getType();
- }else if(os[1] instanceof Method){
- Method method = ((Method)os[1]);
- if ("get".equals(method.getName().substring(0, 3))){
- valType = method.getReturnType();
- }else if("set".equals(method.getName().substring(0, 3))){
- valType = ((Method)os[1]).getParameterTypes()[0];
- }
+ int tcolumn = column++;
+ Object val = this.getCellValue(row, tcolumn);;
+ ExcelColumn ef = (ExcelColumn)os[0];
+ // Get param type and type cast
+ Class<?> valType = Class.class;
+ if (os[1] instanceof Field){
+ valType = ((Field)os[1]).getType();
+ }else if(os[1] instanceof Method){
+ Method method = ((Method)os[1]);
+ if ("get".equals(method.getName().substring(0, 3))){
+ valType = method.getReturnType();
+ }else if("set".equals(method.getName().substring(0, 3))){
+ valType = ((Method)os[1]).getParameterTypes()[0];
}
- //log.debug("Import value type: ["+i+","+column+"] " + valType);
- try {
- if (valType == String.class){
- String s = String.valueOf(val.toString());
- if(StringUtils.endsWith(s, ".0")){
- val = StringUtils.substringBefore(s, ".0");
- }else{
- val = String.valueOf(val.toString()).trim();
+ }
+ if(ef.fieldType()== XSSFPictureData.class){
+ XSSFPictureData qrData = null;
+ if(val !=null){
+ String tid = String.valueOf(val.toString()).trim();
+ int start = tid.indexOf("(\"")+2;
+ int end = tid.indexOf("\",");
+ if(start>=0&& end>=1 && end>start){
+ String picId = tid.substring(start,end);
+ XSSFPictureData data = this.pictureList.get(picId);
+ if(data!= null && data.getData() != null){
+ qrData =data;
}
}
- else if (valType == Integer.class){
- val = Double.valueOf(val.toString()).intValue();
- }else if (valType == Long.class){
- val = Double.valueOf(val.toString()).longValue();
- }else if (valType == Double.class){
- val = Double.valueOf(val.toString());
- }else if (valType == Float.class){
- val = Float.valueOf(val.toString());
- }else if (valType == Date.class){
- val = DateUtil.getJavaDate((Double)val);
- }else{
- if (ef.fieldType() != Class.class){
- val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
- }else{
- val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
- "fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString());
+ }
+ val = null;
+ //鎮诞鍥剧墖
+ List<XSSFPictureData> xfData = ExcelPictureUtil.getPicturesFromCell(this.sheet,row.getCell(tcolumn));
+ List<XSSFPictureData> valList =new ArrayList<>();
+ if(qrData!=null){
+ valList.add(qrData);
+ }
+ if(xfData!=null){
+ valList.addAll(xfData);
+ }
+ if (valType==List.class){
+ val =valList;
+ } else if ( valType==XSSFPictureData.class){
+ val = (valList!=null && valList.size()>0)?valList.get(0):null;
+ }
+ }else{
+ if (val != null){
+ try {
+ if (valType == String.class){
+ String s = String.valueOf(val.toString());
+ if(StringUtils.endsWith(s, ".0")){
+ val = StringUtils.substringBefore(s, ".0");
+ }else{
+ val = String.valueOf(val.toString()).trim();
+ }
}
+ else if (valType == Integer.class){
+ val = Double.valueOf(val.toString()).intValue();
+ }else if (valType == Long.class){
+ val = Double.valueOf(val.toString()).longValue();
+ }else if (valType == Double.class){
+ val = Double.valueOf(val.toString());
+ }else if (valType == Float.class){
+ val = Float.valueOf(val.toString());
+ }else if (valType == Date.class){
+ val = DateUtil.getJavaDate((Double)val);
+ }else if (valType == XSSFPictureData.class){
+ }else{
+ if (ef.fieldType() != Class.class){
+ val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
+ }else{
+ val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
+ "fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString());
+ }
+ }
+ } catch (Exception ex) {
+ log.info("Get cell value ["+i+","+column+"] error: " + ex.toString());
+ val = null;
}
-
- } catch (Exception ex) {
- log.info("Get cell value ["+i+","+column+"] error: " + ex.toString());
- val = null;
}
- // set entity value
- if (os[1] instanceof Field){
- Reflections.invokeSetter(e, ((Field)os[1]).getName(), val);
- }else if (os[1] instanceof Method){
- String mthodName = ((Method)os[1]).getName();
- if ("get".equals(mthodName.substring(0, 3))){
- mthodName = "set"+StringUtils.substringAfter(mthodName, "get");
- }
- Reflections.invokeMethod(e, mthodName, new Class[] {valType}, new Object[] {val});
- }
+ }
+ if (val != null){
+ try {
+ // set entity value
+ if (os[1] instanceof Field){
+ Reflections.invokeSetter(e, ((Field)os[1]).getName(), val);
+ }else if (os[1] instanceof Method){
+ String mthodName = ((Method)os[1]).getName();
+ if ("get".equals(mthodName.substring(0, 3))){
+ mthodName = "set"+StringUtils.substringAfter(mthodName, "get");
+ }
+ Reflections.invokeMethod(e, mthodName, new Class[] {valType}, new Object[] {val});
+ }
+ }catch (Exception e1){
+ val =null;
+ }
+ }else{
}
sb.append(val+", ");
}
diff --git a/server/services/src/main/java/com/doumee/core/annotation/excel/ExcelPictureUtil.java b/server/services/src/main/java/com/doumee/core/annotation/excel/ExcelPictureUtil.java
index 4850f08..9d9ec0c 100644
--- a/server/services/src/main/java/com/doumee/core/annotation/excel/ExcelPictureUtil.java
+++ b/server/services/src/main/java/com/doumee/core/annotation/excel/ExcelPictureUtil.java
@@ -7,17 +7,13 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.openxml4j.opc.PackagePartName;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
-import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.*;
import java.io.*;
import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -315,4 +311,75 @@
}
}
+
+ /**
+ * 鑾峰彇鍗曞厓鏍间腑鐨勫浘鐗�
+ */
+
+ public static List<XSSFPictureData> getPicturesFromCell(Sheet sheet, Cell cell) {
+ try {
+ List<XSSFPictureData> cellPictures = new ArrayList<>();
+ XSSFDrawing drawing = ((XSSFSheet) sheet).createDrawingPatriarch();
+ if (drawing != null) {
+ List<XSSFPicture> pictures = drawing.getShapes().stream()
+ .filter(shape -> shape instanceof XSSFPicture)
+ .map(shape -> (XSSFPicture) shape).collect(Collectors.toList());
+ for (XSSFPicture picture : pictures) {
+ int rowIndex = picture.getPreferredSize().getRow1();
+ int colIndex = picture.getPreferredSize().getCol1();
+ if (colIndex == cell.getColumnIndex() && rowIndex == cell.getRowIndex()) {
+ cellPictures.add(picture.getPictureData());
+ }
+ }
+ }
+ return cellPictures;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private static Map<String, List<XSSFPicture>> getImgPathMap(Sheet sheet) {
+ Map<String, List<XSSFPicture>> imgPathMap = new HashMap<>();
+ XSSFDrawing drawing = ((XSSFSheet) sheet).createDrawingPatriarch();
+ if (drawing != null) {
+ List<XSSFPicture> pictures = drawing.getShapes().stream()
+ .filter(shape -> shape instanceof XSSFPicture)
+ .map(shape -> (XSSFPicture) shape).collect(Collectors.toList());
+ for (XSSFPicture picture : pictures) {
+ int rowIndex = picture.getPreferredSize().getRow1();
+ int colIndex = picture.getPreferredSize().getCol1();
+ String key = colIndex + "-" + rowIndex;
+ List<XSSFPicture> list = null;
+ if (imgPathMap.containsKey(key)) {
+ list = imgPathMap.get(key);
+ } else {
+ list = new ArrayList<>();
+ imgPathMap.put(key, list);
+ }
+ list.add(picture);
+ }
+ }
+ return imgPathMap;
+ }
+
+
+ /**
+ * 鑾峰彇鍥剧墖鐨勬墿灞曞悕
+ */
+
+ private static String getImageExtension(PictureData picture) {
+ String mimeType = picture.getMimeType();
+ switch (mimeType) {
+ case "image/jpeg":
+ return "jpg";
+ case "image/png":
+ return "png";
+ default:
+ return "";
+ }
+ }
+
+
+
}
\ No newline at end of file
diff --git a/server/services/src/main/java/com/doumee/dao/business/dto/CasesImport.java b/server/services/src/main/java/com/doumee/dao/business/dto/CasesImport.java
index 9589699..dea4720 100644
--- a/server/services/src/main/java/com/doumee/dao/business/dto/CasesImport.java
+++ b/server/services/src/main/java/com/doumee/dao/business/dto/CasesImport.java
@@ -3,6 +3,11 @@
import com.doumee.core.annotation.excel.ExcelColumn;
import io.swagger.annotations.ApiModel;
import lombok.Data;
+import org.apache.poi.xssf.usermodel.XSSFPicture;
+import org.apache.poi.xssf.usermodel.XSSFPictureData;
+
+import java.util.Date;
+import java.util.List;
/**
* 鍛樺伐淇℃伅瀵煎叆琛�
@@ -13,24 +18,30 @@
@ApiModel("鍛樺伐淇℃伅瀵煎叆")
public class CasesImport {
-// @ExcelColumn(name="搴忓彿",value = "sn")
- private Integer sn;
-
- @ExcelColumn(name="濮撳悕",value = "name",index = 1)
+ @ExcelColumn(name="妗堜緥涓婚",value = "name",index = 1)
private String name;
- @ExcelColumn(name="鎵嬫満鍙�",value = "phone",index = 2)
- private String phone;
+ @ExcelColumn(name="寮�濮嬫棩鏈�",value = "startDate",index = 2)
+ private String startDate;
- @ExcelColumn(name="韬唤璇佸彿",value = "idcardNo",index = 3)
- private String idcardNo;
+ @ExcelColumn(name="缁撴潫鏃ユ湡",value = "endDate",index = 3)
+ private String endDate;
- @ExcelColumn(name="缁勭粐鍚嶇О" , value = "companyName" ,index = 4)
- private String companyName;
+ @ExcelColumn(name="鏈嶅姟鑰佸笀" , value = "memberCode" ,index = 4)
+ private String memberCode;
- @ExcelColumn(name="宸ュ彿" , value = "code")
- private String code;
+ @ExcelColumn(name="妗堜緥璇存槑" , value = "detail",index = 5)
+ private String detail;
- @ExcelColumn(name="宀椾綅" , value = "code")
- private String positionName;
-
+ @ExcelColumn(name="妗堜緥鍥�1" , value = "imageList",fieldType = XSSFPictureData.class,index = 5)
+ private List<XSSFPictureData> imageList;
+ @ExcelColumn(name="妗堜緥鍥�2" , value = "imageList1",fieldType = XSSFPictureData.class,index = 6)
+ private List<XSSFPictureData> imageList1;
+ @ExcelColumn(name="妗堜緥鍥�3" , value = "imageList2",fieldType = XSSFPictureData.class,index = 7)
+ private List<XSSFPictureData> imageList2;
+ @ExcelColumn(name="妗堜緥鍥�4" , value = "imageList3",fieldType = XSSFPictureData.class,index = 8)
+ private List<XSSFPictureData> imageList3;
+ @ExcelColumn(name="妗堜緥鍥�5" , value = "imageList4",fieldType = XSSFPictureData.class,index = 9)
+ private List<XSSFPictureData> imageList4;
+ @ExcelColumn(name="妗堜緥鍥�6" , value = "imageList5",fieldType = XSSFPictureData.class,index = 10)
+ private List<XSSFPictureData> imageList5;
}
diff --git a/server/services/src/main/java/com/doumee/dao/business/dto/MemberImport.java b/server/services/src/main/java/com/doumee/dao/business/dto/MemberImport.java
index a2cc4ed..82dcad0 100644
--- a/server/services/src/main/java/com/doumee/dao/business/dto/MemberImport.java
+++ b/server/services/src/main/java/com/doumee/dao/business/dto/MemberImport.java
@@ -5,6 +5,7 @@
import com.doumee.dao.business.model.Category;
import io.swagger.annotations.ApiModel;
import lombok.Data;
+import org.apache.poi.xssf.usermodel.XSSFPictureData;
import java.util.List;
@@ -20,8 +21,8 @@
private String code;
@ExcelColumn(name="濮撳悕",value = "name",index = 2)
private String name;
- @ExcelColumn(name="鑱屼笟鐓�",value = "imgurl",index = 3)
- private String imgurl;
+ @ExcelColumn(name="鑱屼笟鐓�",value = "imgurl",index = 3,fieldType = XSSFPictureData.class)
+ private XSSFPictureData imgurl;
@ExcelColumn(name="绛夌骇",value = "levelName",index = 4)
private String levelName;
@ExcelColumn(name="鎬у埆" , value = "sex" ,index = 5)
diff --git a/server/services/src/main/java/com/doumee/dao/business/model/Cases.java b/server/services/src/main/java/com/doumee/dao/business/model/Cases.java
index 65a307e..9ca98ab 100644
--- a/server/services/src/main/java/com/doumee/dao/business/model/Cases.java
+++ b/server/services/src/main/java/com/doumee/dao/business/model/Cases.java
@@ -92,4 +92,10 @@
@ApiModelProperty(value = "鏈�鍚庢搷浣滀汉鍛橈紱", example = "1")
@TableField(exist = false)
private String updateUserName;
+ @ApiModelProperty(value = "鍥剧墖闆嗘暟鎹紱", example = "1")
+ @TableField(exist = false)
+ private List<byte[]> imgdataList;
+
+
}
+
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/CasesServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/CasesServiceImpl.java
index 74b8099..e19661f 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/CasesServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/CasesServiceImpl.java
@@ -209,7 +209,7 @@
}
private void initMultifileList(Cases cate) {
String path = systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.RESOURCE_PATH).getCode()
- + systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.CATEGORY_FILES).getCode();
+ + systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.CASES_FILES).getCode();
Multifile find = new Multifile();
find.setObjId(cate.getId());
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/ImportRecordServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/ImportRecordServiceImpl.java
index 1503157..4305d5c 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/ImportRecordServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/ImportRecordServiceImpl.java
@@ -10,17 +10,11 @@
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.tyyun.TyyZosUtil;
-import com.doumee.dao.business.CasesMapper;
-import com.doumee.dao.business.CategoryMapper;
-import com.doumee.dao.business.MemberMapper;
+import com.doumee.dao.business.*;
import com.doumee.dao.business.dto.CasesImport;
import com.doumee.dao.business.dto.MemberImport;
-import com.doumee.dao.business.model.Cases;
-import com.doumee.dao.business.model.Category;
-import com.doumee.dao.business.model.ImportRecord;
+import com.doumee.dao.business.model.*;
import com.doumee.core.utils.Utils;
-import com.doumee.dao.business.ImportRecordMapper;
-import com.doumee.dao.business.model.Member;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.ImportRecordService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -67,6 +61,8 @@
private MemberMapper memberMapper;
@Autowired
private CasesMapper casesMapper;
+ @Autowired
+ private MultifileMapper multifileMapper;
@Resource
private RedisTemplate<String, Object> redisTemplate;
@Resource
@@ -203,9 +199,7 @@
Map<String, XSSFPictureData> pics = ie.getExcelPictures();
if(type == 1) {
List<CasesImport> importList = (ie.getDataList(CasesImport.class,null));
- if(importList==null || importList.size()==0){
- throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵煎叆鏂囦欢妗堜緥淇℃伅鍐呭涓虹┖锛�");
- }
+ model.setCaseList(isvalidImpartCasesParam(loginUserInfo,pics,importList));
model.setTotalNum(model.getCaseList().size());
}else{
List<MemberImport> importList = (ie.getDataList(MemberImport.class,null));
@@ -242,19 +236,21 @@
int index = 1;
for(MemberImport param :memberList){
index ++;
- if(StringUtils.isBlank(param.getImgurl())
- ||StringUtils.isBlank(param.getFee())
- ||StringUtils.isBlank(param.getName())
- ||StringUtils.isBlank(param.getInfo())
- ||StringUtils.isBlank(param.getJobYear())
- ||StringUtils.isBlank(param.getPosition())
- ||StringUtils.isBlank(param.getFieldNames())
- ||StringUtils.isBlank(param.getSex())
- ||StringUtils.isBlank(param.getCode())
- ||StringUtils.isBlank(param.getZqNames())
- ||StringUtils.isBlank(param.getLevelName())
- ||StringUtils.isBlank(param.getServeNum())
- ||StringUtils.isBlank(param.getTypeNames())){
+ if(( param.getImgurl() == null
+ ||param.getImgurl().getData() == null
+ ||param.getImgurl().getData().length == 0)
+ &&StringUtils.isBlank(param.getFee())
+ &&StringUtils.isBlank(param.getName())
+ &&StringUtils.isBlank(param.getInfo())
+ &&StringUtils.isBlank(param.getJobYear())
+ &&StringUtils.isBlank(param.getPosition())
+ &&StringUtils.isBlank(param.getFieldNames())
+ &&StringUtils.isBlank(param.getSex())
+ &&StringUtils.isBlank(param.getCode())
+ &&StringUtils.isBlank(param.getZqNames())
+ &&StringUtils.isBlank(param.getLevelName())
+ &&StringUtils.isBlank(param.getServeNum())
+ &&StringUtils.isBlank(param.getTypeNames())){
continue;
}
Member member = new Member();
@@ -295,7 +291,7 @@
if(StringUtils.isBlank(param.getFee())){
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗�"+index+"琛屾暟鎹紝 璐圭敤鏍囧噯淇℃伅涓嶈兘涓虹┖");
}
- if(pics!=null && StringUtils.isNotBlank(param.getImgurl())){
+ /* if(pics!=null && StringUtils.isNotBlank(param.getImgurl())){
log.info("===================="+param.getImgurl());
int start = param.getImgurl().indexOf("(\"")+2;
int end = param.getImgurl().indexOf("\",");
@@ -307,7 +303,11 @@
member.setImgurlData(data.getData());
}
}
- }
+ }*/
+ if(param.getImgurl() ==null ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗�"+index+"琛屻��"+param.getName()+"銆戞暟鎹紝 鏈鍙栧埌浠讳綍鑱屼笟鐓у浘鐗囨暟鎹�");
+ }
+ member.setImgurlData(param.getImgurl().getData());
if(member.getImgurlData() ==null || member.getImgurlData().length==0){
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗�"+index+"琛屻��"+param.getName()+"銆戞暟鎹紝 鏈鍙栧埌浠讳綍鑱屼笟鐓у浘鐗囨暟鎹�");
}
@@ -350,6 +350,93 @@
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝鏈鍙栧埌鏈夋晥鏁版嵁");
}
return insertMember;
+
+ }
+ private List<Cases> isvalidImpartCasesParam(LoginUserInfo user, Map<String, XSSFPictureData> pics, List<CasesImport> casesImportList) {
+ if(casesImportList ==null || casesImportList.size()==0){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝鏈鍙栧埌鏈夋晥鏁版嵁");
+ }
+ if(pics ==null || pics.size()==0){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝鏈鍙栧埌浠讳綍鑱屼笟鐓у浘鐗囨暟鎹�");
+ }
+ List<Cases> insertList = new ArrayList<>();
+ List<Member> allList = memberMapper.selectList(new QueryWrapper<Member>().lambda()
+ .eq(Member::getDeleted,Constants.ZERO));
+ allList=allList==null?new ArrayList<>():allList;
+ if(allList == null || allList.size()==0){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝 璇诲彇鑰佸笀鏁版嵁寮傚父锛岃鍏堢淮鎶よ�佸笀鏁版嵁淇℃伅锛�");
+ }
+ Date date = new Date();
+ int index = 1;
+ for(CasesImport param :casesImportList){
+ index ++;
+ if( ( param.getImageList() == null
+ ||param.getImageList().size() == 0 )
+ &&StringUtils.isBlank(param.getName())
+ &&StringUtils.isBlank(param.getMemberCode())
+ &&StringUtils.isBlank(param.getStartDate())
+ &&StringUtils.isBlank(param.getEndDate())
+ &&StringUtils.isBlank(param.getDetail())){
+ continue;
+ }
+ Cases cases = new Cases();
+ cases.setStartDate(DateUtil.fromStringToDate("yyyy-MM-dd",param.getStartDate()));
+ cases.setEndDate(DateUtil.fromStringToDate("yyyy-MM-dd",param.getEndDate()));
+ if(StringUtils.isBlank(param.getName())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗�"+index+"琛屾暟鎹紝 妗堜緥涓婚涓嶈兘涓虹┖");
+ }
+ Member member =null;
+ for(Member m : allList){
+ if(StringUtils.equals(param.getMemberCode(),m.getCode())){
+ member = m;
+ }
+ }
+ if(member == null){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗�"+index+"琛屾暟鎹紝 鑰佸笀宸ュ彿銆�"+param.getMemberCode()+"銆戜俊鎭笉瀛樺湪锛岃纭涓嶈閲嶅褰曞叆");
+
+ }
+ if(StringUtils.isBlank(param.getDetail())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗�"+index+"琛屾暟鎹紝 妗堜緥璇存槑涓嶈兘涓虹┖");
+ }
+ if(param.getImageList() == null){
+ param.setImageList(new ArrayList<>());
+ }
+ param.getImageList().addAll(param.getImageList1()!=null?param.getImageList1():new ArrayList<>());
+ param.getImageList().addAll(param.getImageList2()!=null?param.getImageList2():new ArrayList<>());
+ param.getImageList().addAll(param.getImageList3()!=null?param.getImageList3():new ArrayList<>());
+ param.getImageList().addAll(param.getImageList4()!=null?param.getImageList4():new ArrayList<>());
+ param.getImageList().addAll(param.getImageList5()!=null?param.getImageList5():new ArrayList<>());
+ if(param.getImageList() == null
+ ||param.getImageList().size() == 0 ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗�"+index+"琛屾暟鎹紝 妗堜緥鍥句俊鎭笉鑳戒负绌�");
+ }
+ if(cases.getStartDate()==null){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗�"+index+"琛屾暟鎹紝 寮�濮嬫棩鏈熻鍙栧け璐�");
+ }
+ if(cases.getEndDate()==null){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝绗�"+index+"琛屾暟鎹紝 缁撴潫鏃ユ湡璇诲彇澶辫触");
+ }
+ cases.setImgdataList(new ArrayList<>());
+ for(XSSFPictureData d : param.getImageList()){
+ cases.getImgdataList().add(d.getData());
+ }
+ cases.setCreateTime(date);
+ cases.setUpdateTime(date);
+ cases.setCreateUser(user.getId());
+ cases.setUpdateUser(user.getId());
+ cases.setAddType(Constants.ONE);
+ cases.setDeleted(Constants.ZERO);
+ cases.setStatus(Constants.ZERO);
+ cases.setName(param.getName());
+ cases.setDetail(param.getDetail());
+ cases.setMemberId(member.getId());
+
+ insertList.add(cases);
+ }
+ if(insertList ==null || insertList.size()==0){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝鏈鍙栧埌鏈夋晥鏁版嵁");
+ }
+ return insertList;
}
@@ -420,16 +507,34 @@
private int dealCaseImportBiz(ImportRecord importRecord) {
int success=0;
- String msg ="";
+ String msg = "";
+ String nowDate =DateUtil.getNowShortDate();
try {
- for(Cases param:importRecord.getCaseList()){
-
+ String bucket =systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.BUCKETNAME).getCode();
+ String folder =systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.CASES_FILES).getCode();
+ TyyZosUtil obs = new TyyZosUtil(systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.ENDPOINT).getCode(),
+ systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.ACCESS_ID).getCode(),
+ systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.ACCESS_KEY).getCode());
+ for(Cases param: importRecord.getCaseList()){
+ int ts =0;
+ try {
+ param.setImportId(importRecord.getId());
+ param.setAddType(Constants.ONE);
+ ts = dealCasesInsert(obs,param,folder,nowDate,bucket);
+ }catch (Exception e){
+ log.error("澶勭悊浜哄憳淇℃伅鍙戠敓寮傚父{}",e.getMessage());
+ ts =0;
+ }
+ success += ts;
}
+ obs.shutDown();
}catch (Exception e){
}
importRecord.setDoneNum(success);
importRecord.setErrorNum(importRecord.getTotalNum() - success);
+ importRecord.setDetail(msg);
+ redisTemplate.delete(Constants.RedisKeys.IMPORTING_RECORD);
return success;
}
@@ -464,6 +569,33 @@
}
+ @Transactional
+ private int dealCasesInsert( TyyZosUtil obs,Cases param,String folder,String nowDate,String bucketName) {
+ int success = casesMapper.insert(param);
+ List<Multifile> multifileList = new ArrayList<>();
+ for(byte[] d : param.getImgdataList()){
+ String fileName = UUID.randomUUID() + ".png";
+ String tempFileName = nowDate + "/" + fileName;
+ String key = folder + tempFileName;// 鏂囦欢鍚�
+ if (obs.uploadInputstreamObjectNoShutdown(new ByteArrayInputStream(d ) ,bucketName, key)) {
+ Multifile s = new Multifile();
+ s.setIsdeleted(Constants.ZERO);
+ s.setCreator(param.getCreateUser());
+ s.setCreateDate(param.getCreateTime());
+ s.setObjId(param.getId());
+ s.setType(Constants.ZERO);
+ s.setFileurl(tempFileName);
+ s.setObjType(Constants.ONE);
+ multifileList.add(s);
+ param.setImgurl(tempFileName);//璇佷欢鐓у湴鍧�
+ }else{
+ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"鍥鹃泦涓婁紶澶辫触锛�");
+ }
+ }
+ multifileMapper.insert(multifileList);
+ return success;
+}
+
private int dealMemberInsert( TyyZosUtil obs,Member param,String folder,String nowDate,String bucketName) {
int success =0;
try {
--
Gitblit v1.9.3