|
|
|
@@ -11,6 +11,7 @@ import cn.afterturn.easypoi.handler.inter.IExcelDataHandler; |
|
|
|
|
|
|
|
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.MallUserInfo; |
|
|
|
import com.iformall.domain.po.TtMerchantPoi; |
|
|
|
import com.iformall.domain.po.WxMerchant; |
|
|
|
@@ -23,6 +24,7 @@ import com.iformall.domain.vo.MerchantPoiTNew; |
|
|
|
import com.iformall.domain.vo.WxCardPriceTemplate; |
|
|
|
import com.iformall.enums.EnumMerchantCreateFrom; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.file.aliyun.AliyunOSS; |
|
|
|
import com.iformall.service.TtMerchantPoiService; |
|
|
|
import com.iformall.service.WxCUserBasicInfoService; |
|
|
|
import com.iformall.service.WxCouponPasswordService; |
|
|
|
@@ -39,7 +41,10 @@ import org.springframework.data.redis.core.StringRedisTemplate; |
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.File; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
@@ -71,6 +76,9 @@ public class AsyncTask { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxMerchantService wxMerchantService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AliyunOSS aliyunOSS; |
|
|
|
|
|
|
|
private class UserExcelHandler extends ExcelDataHandlerDefaultImpl<CUserBaseInfoT> { |
|
|
|
@Override |
|
|
|
@@ -391,7 +399,7 @@ public class AsyncTask { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void exportExcel(HttpServletRequest request, HttpServletResponse response,List successList, Class dataClass, String fileName) throws Exception { |
|
|
|
private void exportExcel(HttpServletRequest request, HttpServletResponse response,List successList, Class dataClass, String fileName) throws Exception { |
|
|
|
ExportParams exportParams = new ExportParams(); |
|
|
|
exportParams.setType(ExcelType.XSSF); |
|
|
|
Workbook workBook = ExcelExportUtil.exportExcel(exportParams, dataClass, successList); |
|
|
|
@@ -407,6 +415,37 @@ public class AsyncTask { |
|
|
|
out.close(); |
|
|
|
} |
|
|
|
|
|
|
|
private String uploadErrorExcel(List successList, Class dataClass, String fileName) throws Exception { |
|
|
|
ExportParams exportParams = new ExportParams(); |
|
|
|
exportParams.setType(ExcelType.XSSF); |
|
|
|
Workbook workBook = ExcelExportUtil.exportExcel(exportParams, dataClass, successList); |
|
|
|
ByteArrayOutputStream bos = null; |
|
|
|
try { |
|
|
|
bos = new ByteArrayOutputStream(); |
|
|
|
workBook.write(bos); |
|
|
|
byte[] barray = bos.toByteArray(); |
|
|
|
InputStream is = new ByteArrayInputStream(barray); |
|
|
|
int dot = fileName.lastIndexOf('.'); |
|
|
|
String fileFormat = ""; |
|
|
|
if (dot >= 0) { |
|
|
|
fileFormat = fileName.substring(dot, fileName.length()); |
|
|
|
} |
|
|
|
return aliyunOSS.upload("temp/errorexcel", fileFormat, is); |
|
|
|
}catch(Exception e) { |
|
|
|
logger.error("uploadErrorExcel error.",e); |
|
|
|
}finally { |
|
|
|
if (bos != null) { |
|
|
|
try { |
|
|
|
bos.flush(); |
|
|
|
bos.close(); |
|
|
|
}catch(Exception e) { |
|
|
|
logger.error("uploadErrorExcel error.",e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Async |
|
|
|
public void importExcelPoiDataForNew(File file, MallUserInfo user, String importKey,HttpServletRequest request, HttpServletResponse response) { |
|
|
|
// 需要验证 |
|
|
|
|