|
@@ -3,19 +3,20 @@ package com.sckw.fleet.service;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.excel.ExcelReader;
|
|
import com.alibaba.excel.ExcelReader;
|
|
|
import com.alibaba.excel.read.metadata.ReadSheet;
|
|
import com.alibaba.excel.read.metadata.ReadSheet;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.sckw.core.common.enums.enums.DictEnum;
|
|
import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
|
|
+import com.sckw.core.common.enums.enums.FileEnum;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
import com.sckw.core.exception.SystemException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.enums.SystemTypeEnum;
|
|
import com.sckw.core.model.enums.SystemTypeEnum;
|
|
|
-import com.sckw.core.utils.BeanUtils;
|
|
|
|
|
-import com.sckw.core.utils.CollectionUtils;
|
|
|
|
|
-import com.sckw.core.utils.PasswordUtils;
|
|
|
|
|
-import com.sckw.core.utils.StringUtils;
|
|
|
|
|
|
|
+import com.sckw.core.model.file.FileInfo;
|
|
|
|
|
+import com.sckw.core.utils.*;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.excel.easyexcel.ExcelImportListener;
|
|
import com.sckw.excel.easyexcel.ExcelImportListener;
|
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
|
|
|
+import com.sckw.file.api.dubbo.FileApiDubboService;
|
|
|
import com.sckw.fleet.dao.*;
|
|
import com.sckw.fleet.dao.*;
|
|
|
import com.sckw.fleet.model.*;
|
|
import com.sckw.fleet.model.*;
|
|
|
import com.sckw.fleet.model.dto.*;
|
|
import com.sckw.fleet.model.dto.*;
|
|
@@ -31,6 +32,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
|
|
+import java.text.ParseException;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
@@ -55,11 +57,16 @@ public class KwfDriverService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
KwfDriverQualificationMapper KwfDriverQualificationDao;
|
|
KwfDriverQualificationMapper KwfDriverQualificationDao;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ KwfDriverImportMapper kwfDriverImportDao;
|
|
|
|
|
+ @Autowired
|
|
|
KwfTruckReportMapper truckReportDao;
|
|
KwfTruckReportMapper truckReportDao;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
KwfFleetDriverMapper fleetDriverDao;
|
|
KwfFleetDriverMapper fleetDriverDao;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private RemoteSystemService remoteSystemService;
|
|
private RemoteSystemService remoteSystemService;
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
|
|
+ private FileApiDubboService remoteFileService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @param key 逐渐id
|
|
* @param key 逐渐id
|
|
@@ -226,6 +233,9 @@ public class KwfDriverService {
|
|
|
* @date 2023/07/11
|
|
* @date 2023/07/11
|
|
|
**/
|
|
**/
|
|
|
public HttpResult importExcel(MultipartFile file) {
|
|
public HttpResult importExcel(MultipartFile file) {
|
|
|
|
|
+ /**文件存储**/
|
|
|
|
|
+ importFileSave(file);
|
|
|
|
|
+
|
|
|
/**参数校验**/
|
|
/**参数校验**/
|
|
|
HttpResult result = this.checkParams(file);
|
|
HttpResult result = this.checkParams(file);
|
|
|
if (result.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
if (result.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
@@ -748,6 +758,29 @@ public class KwfDriverService {
|
|
|
return count > 0 ? HttpResult.ok("密码修改成功!") : HttpResult.error("密码修改失败!");
|
|
return count > 0 ? HttpResult.ok("密码修改成功!") : HttpResult.error("密码修改失败!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param file 上传文件
|
|
|
|
|
+ * @desc 上传文件持久化
|
|
|
|
|
+ * @author zk
|
|
|
|
|
+ * @date 2023/7/6
|
|
|
|
|
+ **/
|
|
|
|
|
+ public void importFileSave(MultipartFile file) {
|
|
|
|
|
+ FileInfo fileInfo = FileUtils.getFileDataList(file);
|
|
|
|
|
+ fileInfo.setType(FileEnum.FILE_STORE_TYPE_OSS.getFileType());
|
|
|
|
|
+ FileInfo returnFileInfo = FileUtils.uploadFileInfo(file, fileInfo, FileEnum.FILE_STORE_TYPE_OSS);
|
|
|
|
|
+
|
|
|
|
|
+ KwfDriverImport driverImport = new KwfDriverImport();
|
|
|
|
|
+ driverImport.setEntId(LoginUserHolder.getEntId());
|
|
|
|
|
+ driverImport.setUrl(returnFileInfo.getFilePath());
|
|
|
|
|
+ driverImport.setRemark(JSON.toJSONString(returnFileInfo));
|
|
|
|
|
+ kwfDriverImportDao.insert(driverImport);
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ //remoteFileService.fileInfoInsert(fileInfo);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @param params 参数
|
|
* @param params 参数
|