idea 导入功能

该代码段展示了在IDEA中使用Java实现Excel数据导入的功能。通过读取Excel文件,进行数据验证,如检查模型编码、指标编码、事业部等信息的正确性,并将有效数据保存到bean列表中,最后批量插入数据并返回导入结果。
摘要由CSDN通过智能技术生成

/**
* 导入
* @param filePath
* @return
*/
public CommonRestResponse importExcel(String filePath){
ExcelReadKit excelReadKit = new ExcelReadKit();
ExcelReadResultBean readResultBean = excelReadKit.readExcel(filePath, 0,false);
List<List> list = readResultBean.getContentList();
// String currentLoginUserName = sysUserInfoService.getCurrentLoginUserInfo().getNickName();
String currentLoginUserName = sysUserInfoService.getCurrentLoginUserName();
if (list == null || list.size() <=1) {
return new CommonRestResponse(CommonRestResponse.FAILED_FLAG,languageService.getMessage(“common.msg.w.0059”,“没有要导入的数据.”),null);
}
Map<String,String> modelCodeMap = sysDictionaryBOService.getDictionaryMapByDictTypeCode(DictionaryConfig.MODEL_CODE,SysConstants.ENABLED_Y);
Map<String, String> figureTypeMap = sysDictionaryBOService.getDictionaryMapByDictTypeCode(DictionaryConfig.ALLO_FIGURE_CODE, SysConstants.ENABLED_Y);
Map<String,String> divisionMap = sysDictionaryBOService.getDictionaryMapByDictTypeCode(DictionaryConfig.DIVISION, SysConstants.ENABLED_Y);
Map<String,String> parStoreDimMap = sysDictionaryBOService.getDictionaryMapByDictTypeCode(DictionaryConfig.ALL_PAR_STORE_DIM, SysConstants.ENABLED_Y);
Map<String,String> parStoreValMap = sysDictionaryBOService.getDictionaryMapByDictTypeCode(DictionaryConfig.MID_CATEGORY, SysConstants.ENABLED_Y);
Map<String, String> storeDimMap = sysDictionaryBOService.getDictionaryMapByDictTypeCode(DictionaryConfig.ALLO_STORE_DIM, SysConstants.ENABLED_Y);
Map<String, String> merchDimMap = sysDictionaryBOService.getDictionaryMapByDictTypeCode(DictionaryConfig.ALLO_MERCH_DIM, SysConstants.ENABLED_Y);
Map<String,Map<String,String>> storeDimValueMap = this.initTransferDimValuesMap(storeDimMap);
Map<String,Map<String,String>> merchDimValueMap = this.initTransferDimValuesMap(merchDimMap);
Map<String,String> parMerchDimMap = sysDictionaryBOService.getDictionaryMapByDictTypeCode(DictionaryConfig.ALL_PAR_MERCH_DIM, SysConstants.ENABLED_Y);
Map<String,String> parMerchValMap = sysDictionaryBOService.getDictionaryMapByDictTypeCode(DictionaryConfig.PAR_MERCH_VAL_MAP, SysConstants.ENABLED_Y);
Map<String,String> sizeGroupMap = mstSizeMappingService.getSizeGroupMap(null);

    List<ExcelImportVO> eivos = new ArrayList<>(10);
    String item;
    boolean isSuccess = true;
    List<MstAlloFigureConfig> beanList = new ArrayList<>(10);
    MstAlloFigureConfig bean = null;
    HashMap<String, Object> result = new HashMap<>(1);
    Date now = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    for1:for (int i = 1, size = list.size(); i < size; i++) {
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值