|
@@ -13,8 +13,6 @@ import com.fuint.common.enums.GoodsTypeEnum;
|
|
|
import com.fuint.common.enums.StatusEnum;
|
|
|
import com.fuint.common.enums.YesOrNoEnum;
|
|
|
import com.fuint.common.service.*;
|
|
|
-import com.fuint.common.util.CommonUtil;
|
|
|
-import com.fuint.common.util.DateUtil;
|
|
|
import com.fuint.common.util.XlsUtil;
|
|
|
import com.fuint.framework.annoation.OperationServiceLog;
|
|
|
import com.fuint.framework.exception.BusinessCheckException;
|
|
@@ -41,11 +39,7 @@ import org.springframework.data.domain.PageImpl;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.util.ResourceUtils;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
@@ -91,11 +85,6 @@ public class GoodsServiceImpl extends ServiceImpl<MtGoodsMapper, MtGoods> implem
|
|
|
* */
|
|
|
private CouponService couponService;
|
|
|
|
|
|
- /**
|
|
|
- * 系统环境变量
|
|
|
- * */
|
|
|
- private Environment env;
|
|
|
-
|
|
|
/**
|
|
|
* 分页查询商品列表
|
|
|
*
|
|
@@ -830,40 +819,6 @@ public class GoodsServiceImpl extends ServiceImpl<MtGoodsMapper, MtGoods> implem
|
|
|
return storeIds.stream().collect(Collectors.joining(","));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 保存文件
|
|
|
- *
|
|
|
- * @param file excel文件
|
|
|
- * @param request
|
|
|
- * */
|
|
|
- public String saveGoodsFile(HttpServletRequest request, MultipartFile file) throws Exception {
|
|
|
- if (file == null) {
|
|
|
- throw new BusinessCheckException("上传文件出错!");
|
|
|
- }
|
|
|
- String fileName = file.getOriginalFilename();
|
|
|
- String uploadPath = fileName.substring(fileName.lastIndexOf("."));
|
|
|
- String pathRoot = env.getProperty("images.root");
|
|
|
- if (pathRoot == null || StringUtil.isEmpty(pathRoot)) {
|
|
|
- pathRoot = ResourceUtils.getURL("classpath:").getPath();
|
|
|
- }
|
|
|
- String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
-
|
|
|
- String filePath = "/static/uploadFiles/"+ DateUtil.formatDate(new Date(), "yyyyMMdd")+"/";
|
|
|
- String path = filePath + uuid + uploadPath;
|
|
|
-
|
|
|
- try {
|
|
|
- File tempFile = new File(pathRoot + path);
|
|
|
- if (!tempFile.getParentFile().exists()) {
|
|
|
- tempFile.getParentFile().mkdirs();
|
|
|
- }
|
|
|
- CommonUtil.saveMultipartFile(file, pathRoot + path);
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("上传商品保存文件出错:", e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- return path;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 导入商品
|
|
|
*
|