|
@@ -7,6 +7,7 @@ import com.caimei.model.ResponseJson;
|
|
import com.caimei.model.dto.ProductSaveDto;
|
|
import com.caimei.model.dto.ProductSaveDto;
|
|
import com.caimei.model.po.AuthImportPo;
|
|
import com.caimei.model.po.AuthImportPo;
|
|
import com.caimei.model.po.CmBrandAuthPo;
|
|
import com.caimei.model.po.CmBrandAuthPo;
|
|
|
|
+import com.caimei.model.po.LdmDataPo;
|
|
import com.caimei.model.po.ProductParamPo;
|
|
import com.caimei.model.po.ProductParamPo;
|
|
import com.caimei.model.vo.AuthFormVo;
|
|
import com.caimei.model.vo.AuthFormVo;
|
|
import com.caimei.model.vo.AuthVo;
|
|
import com.caimei.model.vo.AuthVo;
|
|
@@ -14,10 +15,17 @@ import com.caimei.model.vo.ProductFormVo;
|
|
import com.caimei.service.auth.AuthProductService;
|
|
import com.caimei.service.auth.AuthProductService;
|
|
import com.caimei.service.auth.AuthService;
|
|
import com.caimei.service.auth.AuthService;
|
|
import com.caimei.service.auth.ShopService;
|
|
import com.caimei.service.auth.ShopService;
|
|
|
|
+import com.caimei.service.AuthProductService;
|
|
|
|
+import com.caimei.service.AuthService;
|
|
|
|
+import com.caimei.service.ShopService;
|
|
|
|
+import com.caimei.service.UploadService;
|
|
import com.caimei.utils.ExcelOperateUtil;
|
|
import com.caimei.utils.ExcelOperateUtil;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
+import com.github.tobato.fastdfs.domain.StorePath;
|
|
|
|
+import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.io.FilenameUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
@@ -33,6 +41,7 @@ import javax.imageio.ImageIO;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.awt.image.BufferedImage;
|
|
import java.awt.image.BufferedImage;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -68,6 +77,13 @@ public class AuthServiceImpl implements AuthService {
|
|
this.shopService = shopService;
|
|
this.shopService = shopService;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private UploadService uploadService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ public void setUploadService(UploadService uploadService) {
|
|
|
|
+ this.uploadService = uploadService;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Value("${spring.profiles.active}")
|
|
@Value("${spring.profiles.active}")
|
|
private String active;
|
|
private String active;
|
|
|
|
|
|
@@ -77,6 +93,9 @@ public class AuthServiceImpl implements AuthService {
|
|
@Value("${caimei.imageDomain}")
|
|
@Value("${caimei.imageDomain}")
|
|
private String imageDomain;
|
|
private String imageDomain;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private FastFileStorageClient storageClient;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, Integer status, Integer auditStatus, Integer lowerAuditStatus, Integer pageNum, Integer pageSize) {
|
|
public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, Integer status, Integer auditStatus, Integer lowerAuditStatus, Integer pageNum, Integer pageSize) {
|
|
if (null == authUserId) {
|
|
if (null == authUserId) {
|
|
@@ -184,6 +203,7 @@ public class AuthServiceImpl implements AuthService {
|
|
// 保存品牌授权信息,上线状态默认为“待上线”,审核状态为“待审核”
|
|
// 保存品牌授权信息,上线状态默认为“待上线”,审核状态为“待审核”
|
|
auth.setStatus(2);
|
|
auth.setStatus(2);
|
|
auth.setAuditStatus(2);
|
|
auth.setAuditStatus(2);
|
|
|
|
+ auth.setDelFlag(0);
|
|
/*
|
|
/*
|
|
保存授权
|
|
保存授权
|
|
*/
|
|
*/
|
|
@@ -256,6 +276,75 @@ public class AuthServiceImpl implements AuthService {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson importLdmData(Integer authUserId) {
|
|
|
|
+ List<LdmDataPo> ldmDataList = authMapper.getLdmData();
|
|
|
|
+ ldmDataList.forEach(ldmData->{
|
|
|
|
+ String lngAndLat = ldmData.getLngAndLat();
|
|
|
|
+ if (StringUtils.isNotEmpty(lngAndLat)) {
|
|
|
|
+ String[] split = lngAndLat.split(",");
|
|
|
|
+ BigDecimal lng = new BigDecimal(split[0]);
|
|
|
|
+ BigDecimal lat = new BigDecimal(split[1]);
|
|
|
|
+ ldmData.setLng(lng);
|
|
|
|
+ ldmData.setLat(lat);
|
|
|
|
+ }
|
|
|
|
+ String regId1 = ldmData.getRegId1();
|
|
|
|
+ if (StringUtils.isNotEmpty(regId1)) {
|
|
|
|
+ Integer provinceId = authMapper.getProvinceId(regId1);
|
|
|
|
+ ldmData.setProvinceId(provinceId);
|
|
|
|
+ }
|
|
|
|
+ String regId2 = ldmData.getRegId2();
|
|
|
|
+ if (StringUtils.isNotEmpty(regId2)) {
|
|
|
|
+ Integer cityId = authMapper.getCityId(regId2);
|
|
|
|
+ ldmData.setCityId(cityId);
|
|
|
|
+ }
|
|
|
|
+ String regId3 = ldmData.getRegId3();
|
|
|
|
+ if (StringUtils.isNotEmpty(regId3)) {
|
|
|
|
+ Integer townId = authMapper.getTownId(regId3);
|
|
|
|
+ ldmData.setTownId(townId);
|
|
|
|
+ }
|
|
|
|
+ String pic1 = ldmData.getPic1();
|
|
|
|
+ String pic2 = ldmData.getPic2();
|
|
|
|
+ String pic3 = ldmData.getPic3();
|
|
|
|
+ String pic4 = ldmData.getPic4();
|
|
|
|
+ String pic5 = ldmData.getPic5();
|
|
|
|
+ List<String> picList = new ArrayList<>();
|
|
|
|
+ picList.add(pic1);
|
|
|
|
+ picList.add(pic2);
|
|
|
|
+ picList.add(pic3);
|
|
|
|
+ picList.add(pic4);
|
|
|
|
+ picList.add(pic5);
|
|
|
|
+ String logo = null;
|
|
|
|
+ List<String> addPicList = new ArrayList<>();
|
|
|
|
+ for (String pic : picList) {
|
|
|
|
+ if (StringUtils.isNotEmpty(pic)) {
|
|
|
|
+ try {
|
|
|
|
+ String imagePath = "https://wangdian.skinovachina.com" + pic;
|
|
|
|
+ String fileName = imagePath.substring(imagePath.lastIndexOf("/") + 1);
|
|
|
|
+ String imageUrl = uploadService.saveFileByUrl(imagePath, fileName);
|
|
|
|
+ addPicList.add(imageUrl);
|
|
|
|
+ if (null == logo) {
|
|
|
|
+ logo = imageUrl;
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ CmBrandAuthPo authPo = new CmBrandAuthPo();
|
|
|
|
+ BeanUtils.copyProperties(ldmData, authPo);
|
|
|
|
+ authPo.setAuthUserId(authUserId);
|
|
|
|
+ authPo.setCreateBy(authUserId);
|
|
|
|
+ authPo.setLogo(logo);
|
|
|
|
+ authMapper.insertAuth(authPo);
|
|
|
|
+ // 保存轮播图
|
|
|
|
+ if (addPicList.size() > 0) {
|
|
|
|
+ addPicList.forEach(banner -> authMapper.insertBanner(authPo.getId(), banner));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return ResponseJson.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public ResponseJson exportDataByExcel(Integer authUserId, HttpServletResponse response) {
|
|
public ResponseJson exportDataByExcel(Integer authUserId, HttpServletResponse response) {
|
|
try {
|
|
try {
|