|
@@ -1,18 +1,18 @@
|
|
package com.management.platform.service.impl;
|
|
package com.management.platform.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
-import com.management.platform.entity.CustomerInfo;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.management.platform.entity.ProviderInfo;
|
|
import com.management.platform.entity.ProviderInfo;
|
|
-import com.management.platform.mapper.CustomerInfoMapper;
|
|
|
|
|
|
+import com.management.platform.entity.User;
|
|
import com.management.platform.mapper.ProviderInfoMapper;
|
|
import com.management.platform.mapper.ProviderInfoMapper;
|
|
import com.management.platform.mapper.UserMapper;
|
|
import com.management.platform.mapper.UserMapper;
|
|
import com.management.platform.service.ProviderInfoService;
|
|
import com.management.platform.service.ProviderInfoService;
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.management.platform.util.ExcelUtil;
|
|
import com.management.platform.util.ExcelUtil;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import org.apache.poi.EncryptedDocumentException;
|
|
import org.apache.poi.EncryptedDocumentException;
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -23,6 +23,7 @@ import java.io.*;
|
|
import java.text.DateFormat;
|
|
import java.text.DateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -41,6 +42,8 @@ public class ProviderInfoServiceImpl extends ServiceImpl<ProviderInfoMapper, Pro
|
|
ProviderInfoMapper providerInfoMapper;
|
|
ProviderInfoMapper providerInfoMapper;
|
|
@Resource
|
|
@Resource
|
|
UserMapper userMapper;
|
|
UserMapper userMapper;
|
|
|
|
+ @Value(value = "${upload.path}")
|
|
|
|
+ String path;
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg importData(HttpServletRequest request, MultipartFile multipartFile) {
|
|
public HttpRespMsg importData(HttpServletRequest request, MultipartFile multipartFile) {
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
@@ -145,4 +148,32 @@ public class ProviderInfoServiceImpl extends ServiceImpl<ProviderInfoMapper, Pro
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg exportData(HttpServletRequest request) {
|
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
|
+ List<List<String>> dataList=new ArrayList<>();
|
|
|
|
+ String[] titleString=new String[]{"供应商名称","供应商编码","分类","联系人","联系人电话","邮箱","地址","备注"};
|
|
|
|
+ List<String> titleList = Arrays.asList(titleString);
|
|
|
|
+ dataList.add(titleList);
|
|
|
|
+ List<ProviderInfo> providerInfoList = providerInfoMapper.selectList(new QueryWrapper<ProviderInfo>().eq("company_id", user.getCompanyId()));
|
|
|
|
+ for (ProviderInfo providerInfo : providerInfoList) {
|
|
|
|
+ List<String> item=new ArrayList<>();
|
|
|
|
+ item.add(providerInfo.getProviderName()==null?"":providerInfo.getProviderName());
|
|
|
|
+ item.add(providerInfo.getProviderCode()==null?"":providerInfo.getProviderCode());
|
|
|
|
+ item.add(providerInfo.getProviderCategoryName()==null?"":providerInfo.getProviderCategoryName());
|
|
|
|
+ item.add(providerInfo.getContactName()==null?"":providerInfo.getContactName());
|
|
|
|
+ item.add(providerInfo.getContactPhone()==null?"":providerInfo.getContactPhone());
|
|
|
|
+ item.add(providerInfo.getEmail()==null?"":providerInfo.getEmail());
|
|
|
|
+ item.add(providerInfo.getAddress()==null?"":providerInfo.getAddress());
|
|
|
|
+ item.add(providerInfo.getRemark()==null?"":providerInfo.getRemark());
|
|
|
|
+ dataList.add(item);
|
|
|
|
+ }
|
|
|
|
+ //生成excel文件导出
|
|
|
|
+ String fileName = "供应商统计_"+System.currentTimeMillis();
|
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , dataList, path);
|
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
+ httpRespMsg.data = resp;
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|