| @@ -174,6 +174,7 @@ public class TtMerchantPoiController extends DouyinBaseController { | |||||
| } | } | ||||
| } | } | ||||
| //UrlCheck里加上该url | |||||
| @TenantIgnore | @TenantIgnore | ||||
| @PostMapping(value = "/addLocationInfo", consumes = "multipart/*") | @PostMapping(value = "/addLocationInfo", consumes = "multipart/*") | ||||
| public void addLocationInfo(@RequestParam("poiFile") MultipartFile mFile,HttpServletRequest request, HttpServletResponse response) { | public void addLocationInfo(@RequestParam("poiFile") MultipartFile mFile,HttpServletRequest request, HttpServletResponse response) { | ||||
| @@ -244,14 +245,14 @@ public class TtMerchantPoiController extends DouyinBaseController { | |||||
| logger.error("poi import error.",e); | logger.error("poi import error.",e); | ||||
| throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); | throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); | ||||
| } finally { | } finally { | ||||
| if (isSetCacheLock) { | |||||
| stringRedisTemplate.expire(importKey,3,TimeUnit.SECONDS); | |||||
| stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", "1"); | |||||
| } | |||||
| if (fos != null) { | if (fos != null) { | ||||
| try { | try { | ||||
| fos.close(); | fos.close(); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| if (isSetCacheLock) { | |||||
| stringRedisTemplate.expire(importKey,3,TimeUnit.SECONDS); | |||||
| stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", "1"); | |||||
| } | |||||
| logger.error("poi import error.",e); | logger.error("poi import error.",e); | ||||
| throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); | throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); | ||||
| } | } | ||||
| @@ -260,10 +261,6 @@ public class TtMerchantPoiController extends DouyinBaseController { | |||||
| try { | try { | ||||
| fs.close(); | fs.close(); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| if (isSetCacheLock) { | |||||
| stringRedisTemplate.expire(importKey,3,TimeUnit.SECONDS); | |||||
| stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", "1"); | |||||
| } | |||||
| logger.error("poi import error.",e); | logger.error("poi import error.",e); | ||||
| throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); | throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); | ||||
| } | } | ||||
| @@ -271,6 +268,7 @@ public class TtMerchantPoiController extends DouyinBaseController { | |||||
| } | } | ||||
| } | } | ||||
| //UrlCheck里加上该url | |||||
| @TenantIgnore | @TenantIgnore | ||||
| @PostMapping(value = "/importPoi", consumes = "multipart/*") | @PostMapping(value = "/importPoi", consumes = "multipart/*") | ||||
| @SystemControllerLog(description = "poi-导入数据") | @SystemControllerLog(description = "poi-导入数据") | ||||
| @@ -293,6 +291,7 @@ public class TtMerchantPoiController extends DouyinBaseController { | |||||
| } | } | ||||
| } | } | ||||
| //UrlCheck里加上该url | |||||
| @TenantIgnore | @TenantIgnore | ||||
| @PostMapping(value = "/importMerchantInitByPoi", consumes = "multipart/*") | @PostMapping(value = "/importMerchantInitByPoi", consumes = "multipart/*") | ||||
| @SystemControllerLog(description = "poi-初始化商户商户") | @SystemControllerLog(description = "poi-初始化商户商户") | ||||
| @@ -25,6 +25,7 @@ import com.iformall.domain.vo.WxCardPriceTemplate; | |||||
| import com.iformall.enums.EnumMerchantCreateFrom; | import com.iformall.enums.EnumMerchantCreateFrom; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.file.aliyun.AliyunOSS; | import com.iformall.file.aliyun.AliyunOSS; | ||||
| import com.iformall.service.ExcelService; | |||||
| import com.iformall.service.TtMerchantPoiService; | import com.iformall.service.TtMerchantPoiService; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | import com.iformall.service.WxCUserBasicInfoService; | ||||
| import com.iformall.service.WxCouponPasswordService; | import com.iformall.service.WxCouponPasswordService; | ||||
| @@ -79,6 +80,9 @@ public class AsyncTask { | |||||
| @Autowired | @Autowired | ||||
| private AliyunOSS aliyunOSS; | private AliyunOSS aliyunOSS; | ||||
| @Autowired | |||||
| ExcelService excelService; | |||||
| private class UserExcelHandler extends ExcelDataHandlerDefaultImpl<CUserBaseInfoT> { | private class UserExcelHandler extends ExcelDataHandlerDefaultImpl<CUserBaseInfoT> { | ||||
| @Override | @Override | ||||
| @@ -413,6 +417,7 @@ public class AsyncTask { | |||||
| workBook.write(out); | workBook.write(out); | ||||
| out.flush(); | out.flush(); | ||||
| out.close(); | out.close(); | ||||
| //excelService.exportExcel(successList, null, null, dataClass, fileName, response, false); | |||||
| } | } | ||||
| private String uploadErrorExcel(List successList, Class dataClass, String fileName) throws Exception { | private String uploadErrorExcel(List successList, Class dataClass, String fileName) throws Exception { | ||||
| @@ -545,7 +550,9 @@ public class AsyncTask { | |||||
| } | } | ||||
| } | } | ||||
| stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); | stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); | ||||
| exportExcel(request, response, successList,MerchantPoiTNew.class, "POI初始化商户.xlsx"); | |||||
| //exportExcel(request, response, successList,MerchantPoiTNew.class, "POI初始化商户.xlsx"); | |||||
| String url = uploadErrorExcel(successList, MerchantPoiTNew.class, "POI初始化商户.xlsx"); | |||||
| logger.info(">>>>>>> url :"+url); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("导入模板失败:"+e.getMessage(),e); | logger.error("导入模板失败:"+e.getMessage(),e); | ||||
| stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); | stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); | ||||
| @@ -26,6 +26,7 @@ public class UrlCheck { | |||||
| || url.contains("/video/upload") | || url.contains("/video/upload") | ||||
| || url.contains("/merchantPoi/importPoi") | || url.contains("/merchantPoi/importPoi") | ||||
| || url.contains("/merchantPoi/addLocationInfo") | || url.contains("/merchantPoi/addLocationInfo") | ||||
| || url.contains("/merchantPoi/importMerchantInitByPoi") | |||||
| || url.contains("/couponPassword/importPrice"); | || url.contains("/couponPassword/importPrice"); | ||||
| } | } | ||||
| @@ -2206,7 +2206,13 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| shop.setOperationArea("0"); | shop.setOperationArea("0"); | ||||
| shop.setBusinessId(0); | shop.setBusinessId(0); | ||||
| shop.setRentUnit(2); | shop.setRentUnit(2); | ||||
| wxShopService.saveOrUpdate(shop); | |||||
| Result result = wxShopService.saveOrUpdate(shop); | |||||
| if (null == result) { | |||||
| return null; | |||||
| } | |||||
| if (result.code != Result.SUCCESS) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),result.message); | |||||
| } | |||||
| } | } | ||||
| return shop; | return shop; | ||||
| } | } | ||||
| @@ -2223,6 +2229,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| if (null == merchant) { | if (null == merchant) { | ||||
| merchant = new WxMerchant(); | merchant = new WxMerchant(); | ||||
| merchant.updateTenantInfo(shop); | |||||
| merchant.setIsAdmin(EnumMerchantAdmin.PUBLIC_COMMON.getCode()); | merchant.setIsAdmin(EnumMerchantAdmin.PUBLIC_COMMON.getCode()); | ||||
| merchant.setCarVendorType(0); | merchant.setCarVendorType(0); | ||||
| merchant.setImgUrl("https://formall.oss-accelerate.aliyuncs.com/234/WechatIMG5071.png"); | merchant.setImgUrl("https://formall.oss-accelerate.aliyuncs.com/234/WechatIMG5071.png"); | ||||
| @@ -2240,7 +2247,13 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| merchant.setType(1); | merchant.setType(1); | ||||
| merchant.setCreateFrom(EnumMerchantCreateFrom.DOUYIN_LAIKE.getCode()); | merchant.setCreateFrom(EnumMerchantCreateFrom.DOUYIN_LAIKE.getCode()); | ||||
| merchant.setCreateFromId(poiId); | merchant.setCreateFromId(poiId); | ||||
| this.addMerchant(merchant, user.getId()); | |||||
| Result result = this.addMerchant(merchant, user.getId()); | |||||
| if (null == result) { | |||||
| return null; | |||||
| } | |||||
| if (result.code != Result.SUCCESS) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),result.message); | |||||
| } | |||||
| } | } | ||||
| return merchant; | return merchant; | ||||
| } | } | ||||