|
@@ -3,6 +3,7 @@ package com.caimei.service.auth.impl;
|
|
import com.caimei.config.FastDfsClient;
|
|
import com.caimei.config.FastDfsClient;
|
|
import com.caimei.mapper.cmMapper.AuthMapper;
|
|
import com.caimei.mapper.cmMapper.AuthMapper;
|
|
import com.caimei.mapper.cmMapper.AuthProductMapper;
|
|
import com.caimei.mapper.cmMapper.AuthProductMapper;
|
|
|
|
+import com.caimei.mapper.ldmMapper.LdmMapper;
|
|
import com.caimei.model.ResponseJson;
|
|
import com.caimei.model.ResponseJson;
|
|
import com.caimei.model.dto.ProductSaveDto;
|
|
import com.caimei.model.dto.ProductSaveDto;
|
|
import com.caimei.model.po.*;
|
|
import com.caimei.model.po.*;
|
|
@@ -50,6 +51,9 @@ public class AuthServiceImpl implements AuthService {
|
|
@Resource
|
|
@Resource
|
|
private AuthMapper authMapper;
|
|
private AuthMapper authMapper;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private LdmMapper ldmMapper;
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private AuthProductMapper authProductMapper;
|
|
private AuthProductMapper authProductMapper;
|
|
|
|
|
|
@@ -156,6 +160,50 @@ public class AuthServiceImpl implements AuthService {
|
|
return ResponseJson.success(authList);
|
|
return ResponseJson.success(authList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson importLdmImage(Integer authUserId) {
|
|
|
|
+ List<LdmDataPo> ldmClubData = ldmMapper.getLdmClubData(null, 0);
|
|
|
|
+ ldmClubData.forEach(ldmClub->{
|
|
|
|
+ String pic2 = ldmClub.getPic2();
|
|
|
|
+ String pic3 = ldmClub.getPic3();
|
|
|
|
+ String pic4 = ldmClub.getPic4();
|
|
|
|
+ List<AuthVo> authList = authMapper.getAuthByNameAndAddress(ldmClub.getAuthParty(), ldmClub.getAddress());
|
|
|
|
+ if (null != authList && authList.size() > 0 ) {
|
|
|
|
+ if (authList.size() > 1) {
|
|
|
|
+ log.info(">>>>>>>>>>>>>>>>>>>>>导入ldm门店图错误:对应门店过多,门店名称:" + ldmClub.getAuthParty());
|
|
|
|
+ } else {
|
|
|
|
+ AuthVo auth = authList.get(0);
|
|
|
|
+ Integer authId = auth.getAuthId();
|
|
|
|
+ if (StringUtils.isNotEmpty(pic2) || StringUtils.isNotEmpty(pic3) || StringUtils.isNotEmpty(pic4)) {
|
|
|
|
+ authMapper.deleteBanner(authId);
|
|
|
|
+ insertBanner(pic2, authId);
|
|
|
|
+ insertBanner(pic3, authId);
|
|
|
|
+ insertBanner(pic4, authId);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(ldmClub.getRemarks())) {
|
|
|
|
+ authMapper.updateRemarks(authId, ldmClub.getRemarks());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ log.info(">>>>>>>>>>>>>>>>>>>>>导入ldm门店图错误:找不到对应门店,门店名称:" + ldmClub.getAuthParty());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return ResponseJson.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void insertBanner(String pic, Integer authId) {
|
|
|
|
+ if (StringUtils.isNotEmpty(pic)) {
|
|
|
|
+ String imagePath = "https://wangdian.skinovachina.com" + pic;
|
|
|
|
+ String fileName = imagePath.substring(imagePath.lastIndexOf("/") + 1);
|
|
|
|
+ try {
|
|
|
|
+ String banner = uploadService.saveFileByUrl(imagePath, fileName);
|
|
|
|
+ authMapper.insertBanner(authId, banner);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public ResponseJson saveAuth(CmBrandAuthPo auth, List<String> bannerList, boolean importFlag, Integer source) {
|
|
public ResponseJson saveAuth(CmBrandAuthPo auth, List<String> bannerList, boolean importFlag, Integer source) {
|
|
Integer authId = auth.getId();
|
|
Integer authId = auth.getId();
|