|
@@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.hwrj.cloud.admin.dao.PmsProductExcelDao;
|
|
import com.hwrj.cloud.admin.dao.PmsProductExcelDao;
|
|
import com.hwrj.cloud.admin.dto.param.ForestPath;
|
|
import com.hwrj.cloud.admin.dto.param.ForestPath;
|
|
import com.hwrj.cloud.admin.dto.param.PmsProductExcel;
|
|
import com.hwrj.cloud.admin.dto.param.PmsProductExcel;
|
|
-import com.hwrj.cloud.admin.dto.param.PmsProductParam;
|
|
|
|
|
|
+import com.hwrj.cloud.admin.dto.param.PmsProductExcelParam;
|
|
import com.hwrj.cloud.admin.dto.utilEntity.LagLatEntity;
|
|
import com.hwrj.cloud.admin.dto.utilEntity.LagLatEntity;
|
|
import com.hwrj.cloud.admin.excelEntity.UmsCompanyInfoExcel;
|
|
import com.hwrj.cloud.admin.excelEntity.UmsCompanyInfoExcel;
|
|
import com.hwrj.cloud.admin.excelEntity.UmsMemberOriginExcel;
|
|
import com.hwrj.cloud.admin.excelEntity.UmsMemberOriginExcel;
|
|
@@ -64,7 +64,7 @@ public class UploadCompanyInfoAndProductController {
|
|
@Autowired
|
|
@Autowired
|
|
private CompanyLatLagGet companyLatLagGet;
|
|
private CompanyLatLagGet companyLatLagGet;
|
|
|
|
|
|
- List<PmsProductParam> listAll = new ArrayList<>();
|
|
|
|
|
|
+ List<PmsProductExcelParam> listAll = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
@ApiOperation("上传文件")
|
|
@ApiOperation("上传文件")
|
|
@@ -338,7 +338,7 @@ public class UploadCompanyInfoAndProductController {
|
|
if (listAll != null || listAll.size() < 1) {
|
|
if (listAll != null || listAll.size() < 1) {
|
|
log.info("好像没有数据哦");
|
|
log.info("好像没有数据哦");
|
|
}
|
|
}
|
|
- for (PmsProductParam pms : listAll) {
|
|
|
|
|
|
+ for (PmsProductExcelParam pms : listAll) {
|
|
if (directory.contains(pms.getProductNo())) {
|
|
if (directory.contains(pms.getProductNo())) {
|
|
updateFile(forestPath.getPath(), pms.getId(), pms.getProductNo());
|
|
updateFile(forestPath.getPath(), pms.getId(), pms.getProductNo());
|
|
}
|
|
}
|
|
@@ -478,7 +478,7 @@ public class UploadCompanyInfoAndProductController {
|
|
umsCompanyInfoExcel.setCreateId(0l);
|
|
umsCompanyInfoExcel.setCreateId(0l);
|
|
companyId = umsCompanyInfoExcel.getCompName();
|
|
companyId = umsCompanyInfoExcel.getCompName();
|
|
LagLatEntity lagLat = companyLatLagGet.getLagLat(umsCompanyInfoExcel.getCityId(), umsCompanyInfoExcel.getCountyId(), umsCompanyInfoExcel.getDetailAddress());
|
|
LagLatEntity lagLat = companyLatLagGet.getLagLat(umsCompanyInfoExcel.getCityId(), umsCompanyInfoExcel.getCountyId(), umsCompanyInfoExcel.getDetailAddress());
|
|
- if (lagLat != null ){
|
|
|
|
|
|
+ if (lagLat != null) {
|
|
umsCompanyInfoExcel.setLatitude(new BigDecimal(lagLat.getLat()));
|
|
umsCompanyInfoExcel.setLatitude(new BigDecimal(lagLat.getLat()));
|
|
umsCompanyInfoExcel.setLongitude(new BigDecimal(lagLat.getLag()));
|
|
umsCompanyInfoExcel.setLongitude(new BigDecimal(lagLat.getLag()));
|
|
}
|
|
}
|
|
@@ -519,7 +519,7 @@ public class UploadCompanyInfoAndProductController {
|
|
excel.setCreateId(1);
|
|
excel.setCreateId(1);
|
|
excel.setState(0);
|
|
excel.setState(0);
|
|
LagLatEntity lagLat = companyLatLagGet.getLagLat(excel.getCityName(), excel.getCountyName(), excel.getDetailAddress());
|
|
LagLatEntity lagLat = companyLatLagGet.getLagLat(excel.getCityName(), excel.getCountyName(), excel.getDetailAddress());
|
|
- if (lagLat != null ){
|
|
|
|
|
|
+ if (lagLat != null) {
|
|
excel.setLatitude(lagLat.getLat());
|
|
excel.setLatitude(lagLat.getLat());
|
|
excel.setLongitude(lagLat.getLag());
|
|
excel.setLongitude(lagLat.getLag());
|
|
}
|
|
}
|
|
@@ -554,7 +554,6 @@ public class UploadCompanyInfoAndProductController {
|
|
public void importBasic(MultipartFile file) throws IOException {
|
|
public void importBasic(MultipartFile file) throws IOException {
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
listAll = new ArrayList<>();
|
|
listAll = new ArrayList<>();
|
|
if (file != null) {
|
|
if (file != null) {
|
|
List<Object> list = null;
|
|
List<Object> list = null;
|
|
@@ -567,19 +566,19 @@ public class UploadCompanyInfoAndProductController {
|
|
if (list != null && list.size() > 0) {
|
|
if (list != null && list.size() > 0) {
|
|
for (Object obj : list) {
|
|
for (Object obj : list) {
|
|
PmsProductExcel excel = (PmsProductExcel) obj;
|
|
PmsProductExcel excel = (PmsProductExcel) obj;
|
|
- PmsProductParam pmsProductParam = addData(excel);
|
|
|
|
- listAll.add(pmsProductParam);
|
|
|
|
|
|
+ PmsProductExcelParam pmsProductExcelParam = addData(excel);
|
|
|
|
+ listAll.add(pmsProductExcelParam);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<PmsBrand> bandlist = new ArrayList<>();
|
|
List<PmsBrand> bandlist = new ArrayList<>();
|
|
//去除品牌里面的空格以及空字符
|
|
//去除品牌里面的空格以及空字符
|
|
- for(PmsProductParam pmsProductParam:listAll){
|
|
|
|
- String brandName = pmsProductParam.getBrandName();
|
|
|
|
- pmsProductParam.setBrandName(MyStringUtils.replaceBlank(brandName));
|
|
|
|
|
|
+ for (PmsProductExcelParam pmsProductExcelParam : listAll) {
|
|
|
|
+ String brandName = pmsProductExcelParam.getBrandName();
|
|
|
|
+ pmsProductExcelParam.setBrandName(MyStringUtils.replaceBlank(brandName));
|
|
}
|
|
}
|
|
log.info("开始插入品牌数据");
|
|
log.info("开始插入品牌数据");
|
|
- List<String> BandNames = listAll.stream().map(PmsProductParam::getBrandName).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> BandNames = listAll.stream().map(PmsProductExcelParam::getBrandName).distinct().collect(Collectors.toList());
|
|
for (String bandName : BandNames) {
|
|
for (String bandName : BandNames) {
|
|
PmsBrand pmsBrand = new PmsBrand();
|
|
PmsBrand pmsBrand = new PmsBrand();
|
|
pmsBrand.setName(bandName);
|
|
pmsBrand.setName(bandName);
|
|
@@ -600,7 +599,7 @@ public class UploadCompanyInfoAndProductController {
|
|
log.info(JSONObject.toJSONString(listAll));
|
|
log.info(JSONObject.toJSONString(listAll));
|
|
productExcelDao.saveData(listAll);
|
|
productExcelDao.saveData(listAll);
|
|
}
|
|
}
|
|
- List<String> compNames = listAll.stream().map(PmsProductParam::getUmsCompanyInfo).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> compNames = listAll.stream().map(PmsProductExcelParam::getUmsCompanyInfo).distinct().collect(Collectors.toList());
|
|
if (compNames.size() > 0) {
|
|
if (compNames.size() > 0) {
|
|
//更新大小类以及品牌生产地
|
|
//更新大小类以及品牌生产地
|
|
updateProductType(compNames);
|
|
updateProductType(compNames);
|
|
@@ -610,52 +609,53 @@ public class UploadCompanyInfoAndProductController {
|
|
|
|
|
|
//更新大小类
|
|
//更新大小类
|
|
public void updateProductType(List<String> compName) {
|
|
public void updateProductType(List<String> compName) {
|
|
- productExcelDao.updateBrand(compName);
|
|
|
|
- productExcelDao.updateBigType(compName);
|
|
|
|
- productExcelDao.updateSimType(compName);
|
|
|
|
- productExcelDao.updateMemberOrigin(compName);
|
|
|
|
- productExcelDao.updateBrandComp(compName);
|
|
|
|
|
|
+ List<Long> ids = listAll.stream().map(PmsProductExcelParam::getId).distinct().collect(Collectors.toList());
|
|
|
|
+ productExcelDao.updateBrand(compName, ids);
|
|
|
|
+ productExcelDao.updateBigType(compName, ids);
|
|
|
|
+ productExcelDao.updateSimType(compName, ids);
|
|
|
|
+ productExcelDao.updateMemberOrigin(compName, ids);
|
|
|
|
+ productExcelDao.updateBrandComp(compName, ids);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private PmsProductParam addData(PmsProductExcel pmsProductExcel) {
|
|
|
|
|
|
+ private PmsProductExcelParam addData(PmsProductExcel pmsProductExcel) {
|
|
|
|
|
|
- PmsProductParam pmsProductParam = new PmsProductParam();
|
|
|
|
- BeanUtils.copyProperties(pmsProductExcel, pmsProductParam);
|
|
|
|
|
|
+ PmsProductExcelParam pmsProductExcelParam = new PmsProductExcelParam();
|
|
|
|
+ BeanUtils.copyProperties(pmsProductExcel, pmsProductExcelParam);
|
|
//名称
|
|
//名称
|
|
String name = pmsProductExcel.getName();
|
|
String name = pmsProductExcel.getName();
|
|
//价格
|
|
//价格
|
|
BigDecimal price = pmsProductExcel.getPrice();
|
|
BigDecimal price = pmsProductExcel.getPrice();
|
|
//标题
|
|
//标题
|
|
- pmsProductParam.setDetailTitle(name);
|
|
|
|
|
|
+ pmsProductExcelParam.setDetailTitle(name);
|
|
//笔记
|
|
//笔记
|
|
- pmsProductParam.setNote(name);
|
|
|
|
|
|
+ pmsProductExcelParam.setNote(name);
|
|
//关键字
|
|
//关键字
|
|
- pmsProductParam.setKeywords(name);
|
|
|
|
|
|
+ pmsProductExcelParam.setKeywords(name);
|
|
|
|
|
|
String description = replaceBlank(pmsProductExcel.getDescription());
|
|
String description = replaceBlank(pmsProductExcel.getDescription());
|
|
|
|
|
|
- pmsProductParam.setUmsCompanyInfoId(companyId(pmsProductExcel.getUmsCompanyInfo()));
|
|
|
|
|
|
+ pmsProductExcelParam.setUmsCompanyInfoId(companyId(pmsProductExcel.getUmsCompanyInfo()));
|
|
|
|
|
|
//商品描述
|
|
//商品描述
|
|
- pmsProductParam.setDescription(description);
|
|
|
|
|
|
+ pmsProductExcelParam.setDescription(description);
|
|
//简述
|
|
//简述
|
|
- pmsProductParam.setSubTitle(description);
|
|
|
|
|
|
+ pmsProductExcelParam.setSubTitle(description);
|
|
//使用说明
|
|
//使用说明
|
|
String instructions = replaceBlank(pmsProductExcel.getInstructions());
|
|
String instructions = replaceBlank(pmsProductExcel.getInstructions());
|
|
//默认文本
|
|
//默认文本
|
|
- pmsProductParam.setDetailDesc(instructions);
|
|
|
|
|
|
+ pmsProductExcelParam.setDetailDesc(instructions);
|
|
//web网页显示
|
|
//web网页显示
|
|
- pmsProductParam.setDetailHtml(instructions);
|
|
|
|
|
|
+ pmsProductExcelParam.setDetailHtml(instructions);
|
|
//手机网页显示
|
|
//手机网页显示
|
|
- pmsProductParam.setDetailMobileHtml(instructions);
|
|
|
|
|
|
+ pmsProductExcelParam.setDetailMobileHtml(instructions);
|
|
//市场价
|
|
//市场价
|
|
- pmsProductParam.setOriginalPrice(price);
|
|
|
|
|
|
+ pmsProductExcelParam.setOriginalPrice(price);
|
|
//创建人 admin 1
|
|
//创建人 admin 1
|
|
- pmsProductParam.setCreateUser((long) 1);
|
|
|
|
|
|
+ pmsProductExcelParam.setCreateUser((long) 1);
|
|
//创建时间
|
|
//创建时间
|
|
- pmsProductParam.setCreateTime(new Date());
|
|
|
|
- return pmsProductParam;
|
|
|
|
|
|
+ pmsProductExcelParam.setCreateTime(new Date());
|
|
|
|
+ return pmsProductExcelParam;
|
|
}
|
|
}
|
|
|
|
|
|
public static String replaceBlank(String str) {
|
|
public static String replaceBlank(String str) {
|