保存进度!

This commit is contained in:
unknown 2023-10-15 19:33:47 +08:00
parent 636ae55b43
commit 16df86e3a7
1 changed files with 14 additions and 7 deletions

View File

@ -18,9 +18,9 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.cpic.xim.mybatis.mapper.ImportBIArchievementDataMapper; import com.cpic.xim.mybatis.mapper.ImportBIArchievementDataMapper;
import com.cpic.xim.mybatis.pojo.BIDepartmentArchievementRecord; import com.cpic.xim.mybatis.pojo.BIDepartmentArchievementRecord;
@ -36,9 +36,9 @@ public class ImportBIDataController
{ {
private static Logger logger = LoggerFactory.getLogger( ImportBIDataRequest.class ); private static Logger logger = LoggerFactory.getLogger( ImportBIDataRequest.class );
@RequestMapping( method = RequestMethod.POST, path = "" ) @RequestMapping( method = RequestMethod.POST, path = "/excel.do" )
@ResponseBody @ResponseBody
public static ImportBIDataResponse importBIData( @RequestParam ImportBIDataRequest request ) public static ImportBIDataResponse importBIData( @RequestBody ImportBIDataRequest request )
{ {
ImportBIDataResponse response = new ImportBIDataResponse(); ImportBIDataResponse response = new ImportBIDataResponse();
String filePath = request.getFilePath(); String filePath = request.getFilePath();
@ -63,26 +63,33 @@ public class ImportBIDataController
} }
catch ( IOException error ) catch ( IOException error )
{ {
String message = ""; String message = "加载文件错误,错误消息:" + error.getMessage();
response.setSuccess( false ); response.setSuccess( false );
response.setMessage( message ); response.setMessage( message );
logger.error(message, error);
} }
catch ( InvalidFormatException error ) catch ( InvalidFormatException error )
{ {
String message = ""; String message = "Excel文件格式错误错误消息" + error.getMessage();
response.setSuccess( false ); response.setSuccess( false );
response.setMessage( message ); response.setMessage( message );
logger.error(message, error);
} }
catch ( PersistenceException error ) catch ( PersistenceException error )
{ {
String message = ""; String message = "Mybatis执行错误错误消息" + error.getMessage();
response.setSuccess( false ); response.setSuccess( false );
response.setMessage( message ); response.setMessage( message );
logger.error(message, error);
} }
return response; return response;
} }
private static void importBITelsalerAttachingRate( String filePath, int sheetIndex, private static void importBITelsalerAttachingRate( String filePath, int sheetIndex,
boolean hasCaption ) throws PersistenceException, IOException, InvalidFormatException boolean hasCaption ) throws PersistenceException, IOException, InvalidFormatException
{ {
@ -95,7 +102,7 @@ public class ImportBIDataController
sheetIndex, hasCaption ); sheetIndex, hasCaption );
session = MybatisUtils.getSqlSessionBatch(); session = MybatisUtils.getSqlSessionBatch();
ImportBIArchievementDataMapper mapper = ImportBIArchievementDataMapper mapper =
session.getMapper( ImportBIArchievementDataMapper.class ); session.getMapper( ImportBIArchievementDataMapper.class );
mapper.cleanTelsalerAttachingRateData(); mapper.cleanTelsalerAttachingRateData();