|
@@ -1,22 +1,43 @@
|
|
|
package com.jpsoft.bus.modules.bus.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.bus.config.OSSConfig;
|
|
|
+import com.jpsoft.bus.modules.bus.dto.RouteInfoDTO;
|
|
|
+import com.jpsoft.bus.modules.bus.dto.RouteMapPathDTO;
|
|
|
+import com.jpsoft.bus.modules.bus.dto.StationInfoDTO;
|
|
|
+import com.jpsoft.bus.modules.bus.entity.CompanyInfo;
|
|
|
+import com.jpsoft.bus.modules.bus.entity.StationInfo;
|
|
|
+import com.jpsoft.bus.modules.bus.entity.VehicleInfo;
|
|
|
+import com.jpsoft.bus.modules.bus.service.CompanyInfoService;
|
|
|
+import com.jpsoft.bus.modules.bus.service.StationInfoService;
|
|
|
import com.jpsoft.bus.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.bus.modules.common.dto.Sort;
|
|
|
import com.jpsoft.bus.modules.bus.entity.RouteInfo;
|
|
|
import com.jpsoft.bus.modules.bus.service.RouteInfoService;
|
|
|
+import com.jpsoft.bus.modules.common.utils.OSSUtil;
|
|
|
+import com.jpsoft.bus.modules.common.utils.POIUtils;
|
|
|
import com.jpsoft.bus.modules.common.utils.PojoUtils;
|
|
|
+import com.jpsoft.bus.modules.sys.service.DataDictionaryService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.io.ByteArrayInputStream;
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 车辆表
|
|
@@ -27,38 +48,83 @@ import java.util.*;
|
|
|
public class RouteInfoController {
|
|
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OSSConfig ossConfig;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RouteInfoService routeInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CompanyInfoService companyInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StationInfoService stationInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
+
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
|
- public MessageResult<RouteInfo> create(){
|
|
|
- MessageResult<RouteInfo> msgResult = new MessageResult<>();
|
|
|
+ public MessageResult<RouteInfoDTO> create(){
|
|
|
+ RouteInfoDTO dto = new RouteInfoDTO();
|
|
|
|
|
|
- RouteInfo routeInfo = new RouteInfo();
|
|
|
+ dto.setStationList(new ArrayList<>());
|
|
|
+ dto.setRemoveStationList(new ArrayList<>());
|
|
|
|
|
|
- msgResult.setData(routeInfo);
|
|
|
- msgResult.setResult(true);
|
|
|
+ MessageResult<RouteInfoDTO> messageResult = new MessageResult<>();
|
|
|
|
|
|
- return msgResult;
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setData(dto);
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@ApiOperation(value="添加信息")
|
|
|
@PostMapping("add")
|
|
|
- public MessageResult<RouteInfo> add(@RequestBody RouteInfo routeInfo,@RequestAttribute String subject){
|
|
|
+ public MessageResult<RouteInfo> add(@Validated @RequestBody RouteInfoDTO dto, @RequestAttribute String subject){
|
|
|
MessageResult<RouteInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
+ RouteInfo routeInfo = new RouteInfo();
|
|
|
routeInfo.setId(UUID.randomUUID().toString());
|
|
|
+ routeInfo.setName(dto.getName());
|
|
|
+ routeInfo.setCompanyId(dto.getCompanyId());
|
|
|
+ routeInfo.setStartTime(dto.getStartTime());
|
|
|
+ routeInfo.setEndTime(dto.getEndTime());
|
|
|
+
|
|
|
routeInfo.setDelFlag(false);
|
|
|
routeInfo.setCreateBy(subject);
|
|
|
routeInfo.setCreateTime(new Date());
|
|
|
-
|
|
|
+
|
|
|
int affectCount = routeInfoService.insert(routeInfo);
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
+ for (StationInfoDTO stationDTO : dto.getStationList()) {
|
|
|
+ StationInfo stationInfo = new StationInfo();
|
|
|
+ PojoUtils.map(stationDTO,stationInfo);
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(stationDTO.getClassify())) {
|
|
|
+ stationInfo.setClassify(Integer.parseInt(stationDTO.getClassify()));
|
|
|
+ }
|
|
|
+ stationInfo.setRouteId(routeInfo.getId());
|
|
|
+ stationInfo.setId(UUID.randomUUID().toString());
|
|
|
+
|
|
|
+ String[] arr = stationDTO.getLocation().split(",");
|
|
|
+
|
|
|
+ if(arr.length>1){
|
|
|
+ stationInfo.setLongitude(arr[0]);
|
|
|
+ stationInfo.setLatitude(arr[1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ stationInfo.setDelFlag(false);
|
|
|
+ stationInfo.setCreateBy(subject);
|
|
|
+ stationInfo.setCreateTime(new Date());
|
|
|
+
|
|
|
+ stationInfoService.insert(stationInfo);
|
|
|
+ }
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
- msgResult.setData(routeInfo);
|
|
|
+ msgResult.setData(routeInfoService.get(routeInfo.getId()));
|
|
|
} else {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库添加失败");
|
|
@@ -76,15 +142,64 @@ public class RouteInfoController {
|
|
|
|
|
|
@ApiOperation(value="获取信息")
|
|
|
@GetMapping("edit/{id}")
|
|
|
- public MessageResult<RouteInfo> edit(@PathVariable("id") String id){
|
|
|
- MessageResult<RouteInfo> msgResult = new MessageResult<>();
|
|
|
+ public MessageResult<RouteInfoDTO> edit(@PathVariable("id") String id){
|
|
|
+ MessageResult<RouteInfoDTO> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
+ RouteInfoDTO routeInfoDTO = new RouteInfoDTO();
|
|
|
+
|
|
|
RouteInfo routeInfo = routeInfoService.get(id);
|
|
|
|
|
|
if (routeInfo != null) {
|
|
|
+ routeInfoDTO.setId(routeInfo.getId());
|
|
|
+ routeInfoDTO.setName(routeInfo.getName());
|
|
|
+ routeInfoDTO.setCompanyId(routeInfo.getCompanyId());
|
|
|
+ routeInfoDTO.setStartTime(routeInfo.getStartTime());
|
|
|
+ routeInfoDTO.setEndTime(routeInfo.getEndTime());
|
|
|
+
|
|
|
+ List<StationInfoDTO> stationInfoDTOList = new ArrayList<>();
|
|
|
+
|
|
|
+ List<StationInfo> stationList = stationInfoService.findByRouteId(routeInfo.getId());
|
|
|
+
|
|
|
+ for (StationInfo stationInfo:stationList) {
|
|
|
+ StationInfoDTO stationInfoDTO = new StationInfoDTO();
|
|
|
+ stationInfoDTO.setId(stationInfo.getId());
|
|
|
+ stationInfoDTO.setName(stationInfo.getName());
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(stationInfo.getLongitude()) && StringUtils.isNotEmpty(stationInfo.getLatitude())){
|
|
|
+ stationInfoDTO.setLocation(stationInfo.getLongitude()+","+stationInfo.getLatitude());
|
|
|
+ }
|
|
|
+
|
|
|
+ stationInfoDTO.setClassify(stationInfo.getClassify().toString());
|
|
|
+ String classifyName = dataDictionaryService.findNameByCatalogNameAndValue("站点类型",stationInfo.getClassify().toString());
|
|
|
+ stationInfoDTO.setClassifyName(classifyName);
|
|
|
+ stationInfoDTO.setRouteId(stationInfo.getRouteId());
|
|
|
+ stationInfoDTO.setSortNo(stationInfo.getSortNo());
|
|
|
+ stationInfoDTO.setDelFlag(stationInfo.getDelFlag());
|
|
|
+
|
|
|
+ stationInfoDTOList.add(stationInfoDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<StationInfoDTO> removeStationList = new ArrayList<>();
|
|
|
+
|
|
|
+ routeInfoDTO.setRemoveStationList(removeStationList);
|
|
|
+ routeInfoDTO.setStationList(stationInfoDTOList);
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(routeInfo.getMapPath())){
|
|
|
+ String[] arr = routeInfo.getMapPath().split("\\|");
|
|
|
+
|
|
|
+ List<String> pathList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (String str : arr) {
|
|
|
+ pathList.add(str);
|
|
|
+ }
|
|
|
+
|
|
|
+ routeInfoDTO.setPathList(pathList);
|
|
|
+ }
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
- msgResult.setData(routeInfo);
|
|
|
+ msgResult.setData(routeInfoDTO);
|
|
|
} else {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库不存在该记录!");
|
|
@@ -100,20 +215,99 @@ public class RouteInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="更新用户")
|
|
|
+ @ApiOperation(value="更新线路信息")
|
|
|
@PostMapping("update")
|
|
|
- public MessageResult<RouteInfo> update(@RequestBody RouteInfo routeInfo,@RequestAttribute String subject){
|
|
|
+ public MessageResult<RouteInfo> update(@Validated @RequestBody RouteInfoDTO dto,@RequestAttribute String subject){
|
|
|
MessageResult<RouteInfo> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
+ RouteInfo routeInfo = routeInfoService.get(dto.getId());
|
|
|
+
|
|
|
+ routeInfo.setName(dto.getName());
|
|
|
+ routeInfo.setCompanyId(dto.getCompanyId());
|
|
|
+ routeInfo.setStartTime(dto.getStartTime());
|
|
|
+ routeInfo.setEndTime(dto.getEndTime());
|
|
|
routeInfo.setUpdateBy(subject);
|
|
|
routeInfo.setUpdateTime(new Date());
|
|
|
-
|
|
|
+
|
|
|
int affectCount = routeInfoService.update(routeInfo);
|
|
|
|
|
|
if (affectCount > 0) {
|
|
|
+ //需要更新的数据列表
|
|
|
+ List<StationInfoDTO> stationInfoDTOList = dto.getStationList();
|
|
|
+
|
|
|
+ if(stationInfoDTOList!=null) {
|
|
|
+
|
|
|
+ for (StationInfoDTO stationInfoDTO : stationInfoDTOList) {
|
|
|
+ StationInfo stationInfo = new StationInfo();
|
|
|
+ if(StringUtils.isNotEmpty(stationInfoDTO.getId())) {
|
|
|
+ stationInfo = stationInfoService.get(stationInfoDTO.getId());
|
|
|
+ stationInfo.setName(stationInfoDTO.getName());
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(stationInfoDTO.getClassify())){
|
|
|
+ stationInfo.setClassify(Integer.parseInt(stationInfoDTO.getClassify()));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(stationInfoDTO.getLocation())) {
|
|
|
+ String[] arr = stationInfoDTO.getLocation().split(",");
|
|
|
+
|
|
|
+ if (arr.length > 1) {
|
|
|
+ stationInfo.setLongitude(arr[0]);
|
|
|
+ stationInfo.setLatitude(arr[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ stationInfo.setSortNo(stationInfoDTO.getSortNo());
|
|
|
+ stationInfo.setUpdateBy(subject);
|
|
|
+ stationInfo.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ stationInfoService.update(stationInfo);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ PojoUtils.map(stationInfoDTO,stationInfo);
|
|
|
+
|
|
|
+ stationInfo.setRouteId(routeInfo.getId());
|
|
|
+ stationInfo.setId(UUID.randomUUID().toString());
|
|
|
+ stationInfo.setName(stationInfoDTO.getName());
|
|
|
+ if(StringUtils.isNotEmpty(stationInfoDTO.getClassify())){
|
|
|
+ stationInfo.setClassify(Integer.parseInt(stationInfoDTO.getClassify()));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(stationInfoDTO.getLocation())) {
|
|
|
+ String[] arr = stationInfoDTO.getLocation().split(",");
|
|
|
+
|
|
|
+ if (arr.length > 1) {
|
|
|
+ stationInfo.setLongitude(arr[0]);
|
|
|
+ stationInfo.setLatitude(arr[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ stationInfo.setCreateBy(subject);
|
|
|
+ stationInfo.setCreateTime(new Date());
|
|
|
+
|
|
|
+ stationInfoService.insert(stationInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //已被删除的数据列表,更新删除状态
|
|
|
+ List<StationInfoDTO> removeStationList = dto.getRemoveStationList();
|
|
|
+
|
|
|
+ if(removeStationList!=null) {
|
|
|
+ for (StationInfoDTO stationInfoDTO : removeStationList) {
|
|
|
+ if(StringUtils.isNotEmpty(stationInfoDTO.getId())) {
|
|
|
+ StationInfo stationInfo = stationInfoService.get(stationInfoDTO.getId());
|
|
|
+
|
|
|
+ stationInfo.setUpdateBy(subject);
|
|
|
+ stationInfo.setUpdateTime(new Date());
|
|
|
+ stationInfo.setDelFlag(true);
|
|
|
+
|
|
|
+ stationInfoService.update(stationInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
- msgResult.setData(routeInfo);
|
|
|
+ msgResult.setData(routeInfoService.get(routeInfo.getId()));
|
|
|
} else {
|
|
|
msgResult.setResult(false);
|
|
|
msgResult.setMessage("数据库更新失败");
|
|
@@ -129,6 +323,36 @@ public class RouteInfoController {
|
|
|
return msgResult;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value="更新地图路线")
|
|
|
+ @PostMapping("updateMapPath")
|
|
|
+ public MessageResult<RouteInfo> updateMapPath(@RequestBody RouteMapPathDTO dto, @RequestAttribute String subject){
|
|
|
+ MessageResult<RouteInfo> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ RouteInfo routeInfo = new RouteInfo();
|
|
|
+
|
|
|
+ routeInfo.setId(dto.getId());
|
|
|
+
|
|
|
+ String mapPath = dto.getPathList().stream().collect(Collectors.joining("|"));
|
|
|
+
|
|
|
+ routeInfo.setMapPath(mapPath);
|
|
|
+ routeInfo.setUpdateBy(subject);
|
|
|
+ routeInfo.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ routeInfoService.update(routeInfo);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value="删除")
|
|
|
@PostMapping("delete/{id}")
|
|
|
public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
|
|
@@ -199,7 +423,7 @@ public class RouteInfoController {
|
|
|
@ApiOperation(value="列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
public MessageResult<Map> pageList(
|
|
|
- String id,
|
|
|
+ String companyId,String name,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
@RequestAttribute String subject){
|
|
@@ -212,17 +436,122 @@ public class RouteInfoController {
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(companyId)) {
|
|
|
+ searchParams.put("companyId",companyId);
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- searchParams.put("id","%" + id + "%");
|
|
|
+ if (StringUtils.isNotEmpty(name)) {
|
|
|
+ searchParams.put("name","%" + name + "%");
|
|
|
}
|
|
|
|
|
|
Page<RouteInfo> page = routeInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
|
|
+ for (RouteInfo routeInfo:page) {
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(routeInfo.getCompanyId());
|
|
|
+ if(companyInfo!=null){
|
|
|
+ routeInfo.setCompanyName(companyInfo.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="导入线路")
|
|
|
+ @PostMapping("importXls")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "uploadFile",value = "上传文件", required = true,paramType="form", dataType = "__file")
|
|
|
+ })
|
|
|
+ public MessageResult<String> importXls(MultipartFile uploadFile,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+ MessageResult<String> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ POIUtils poiUtils = new POIUtils(uploadFile.getInputStream());
|
|
|
+ int sheetIndex = 0;
|
|
|
+ Sheet sheet1 = poiUtils.getSheetAt(sheetIndex);
|
|
|
+
|
|
|
+ int affectCount = 0;
|
|
|
+ int failCount = 0;
|
|
|
+ int validateColIndex = 10;
|
|
|
+
|
|
|
+ for(int rowIndex=1 ; rowIndex<=sheet1.getLastRowNum(); rowIndex++){
|
|
|
+ try {
|
|
|
+ String companyName = (String)poiUtils.getCellValue(sheetIndex,rowIndex,0).toString().replace(" ","");
|
|
|
+ String name = (String)poiUtils.getCellValue(sheetIndex,rowIndex,1).toString().replace(" ","");
|
|
|
+ String startTime = (String)poiUtils.getCellValue(sheetIndex,rowIndex,2).toString().replace(" ","");
|
|
|
+ String endTime = (String)poiUtils.getCellValue(sheetIndex,rowIndex,3).toString().replace(" ","");
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(companyName)){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ CompanyInfo companyInfo = companyInfoService.findByName(companyName);
|
|
|
+
|
|
|
+ if (companyInfo == null) {
|
|
|
+ sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("所属单位不存在!");
|
|
|
+ failCount++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ RouteInfo routeInfo = new RouteInfo();
|
|
|
+ routeInfo.setId(UUID.randomUUID().toString());
|
|
|
+ routeInfo.setCompanyId(companyInfo.getId());
|
|
|
+ routeInfo.setName(name);
|
|
|
+ routeInfo.setStartTime(startTime);
|
|
|
+ routeInfo.setEndTime(endTime);
|
|
|
+
|
|
|
+ routeInfo.setDelFlag(false);
|
|
|
+ routeInfo.setCreateBy(subject);
|
|
|
+ routeInfo.setCreateTime(new Date());
|
|
|
+ routeInfoService.insert(routeInfo);
|
|
|
+
|
|
|
+ affectCount++;
|
|
|
+
|
|
|
+ }
|
|
|
+ catch(Exception innerEx){
|
|
|
+ logger.error(innerEx.getMessage(),innerEx);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (failCount>0){
|
|
|
+ //有导入失败的记录
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据成功导入" + affectCount + "条,有" + failCount + "条数据未导入成功,错误原因请查看报表。");
|
|
|
+
|
|
|
+ //todo 只保留错误数据的sheet
|
|
|
+ Workbook wb = poiUtils.exportErrorXls(sheetIndex,validateColIndex,1 + affectCount + failCount);
|
|
|
+
|
|
|
+ //todo 将wb保存到oss
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+ wb.write(output);
|
|
|
+
|
|
|
+ byte[] buffer = output.toByteArray();
|
|
|
+ ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
+
|
|
|
+ String downloadUrl = OSSUtil.upload(ossConfig,"import","error.xls",input);
|
|
|
+
|
|
|
+ //todo 返回导入失败报表下载链接
|
|
|
+ msgResult.setData(downloadUrl);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setMessage("数据成功导入" + affectCount + "条");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|