Commit b28949dc by 罗承锋

导出下载

parent 56cbcdfd
......@@ -57,7 +57,7 @@ public class ExportExcelController extends BaseController {
public ResponseData<Page<ExportExcel>> listExportExcel(@RequestParam(value = "fileName", required = false) String fileName, @RequestParam(name = "pageNo") int pageIndex, @RequestParam(name = "pageSize") int pageSize) {
ShiroUser user = getShiroUser();
Wrapper<ExportExcel> wrapper = new EntityWrapper();
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员"))) {
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员", "快递公司"))) {
wrapper.like("create_user", user.getId().toString(), SqlLike.DEFAULT);
}
wrapper.like(StringUtils.isNotBlank(fileName), "file_name", fileName, SqlLike.DEFAULT);
......@@ -70,7 +70,7 @@ public class ExportExcelController extends BaseController {
@Permission(menuname = "删除文件", value = "deleteExcel", method = RequestMethod.POST)
public ResponseData<String> deleteExcel(String exportId) {
ExportExcel exportExcel = exportExcelMapper.selectById(exportId);
File file = new File(exportExcel.getExportUrl());
File file = new File(ExportExcelServiceImpl.EXPORT + exportExcel.getExportUrl());
Boolean flag = false;
//判断文件是否存在
if (file.exists() == true) {
......
......@@ -698,9 +698,16 @@ public class OrderController extends BaseController {
if (StringUtils.isNotBlank(hehuorenName)) {
map.put("hehuorenName", hehuorenName);
}
if (StringUtils.isNotBlank(orderStatus)) {
if (user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "快递公司"))) {
map.put("orderStatus", "待配送");
}else{
map.put("orderStatus", orderStatus);
}
}
try {
taskImport.taskImport(map);
} catch (Exception e) {
......
......@@ -19,6 +19,8 @@ import java.text.SimpleDateFormat;
@Service
@Slf4j
public class ExportExcelServiceImpl implements ExportExcelService {
public static String EXPORT = "/springboot/school_center/task/";
@Override
public void uploadExcel(ExportExcel exportExcel, HttpServletResponse response) {
FileInputStream fileInputStream = null;
......@@ -28,11 +30,8 @@ public class ExportExcelServiceImpl implements ExportExcelService {
os = response.getOutputStream();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String formatPath = format.format(exportExcel.getCreateTime());
StringBuilder filePath = new StringBuilder();
filePath.append("enclosure").append(File.separator).append("export").append(File.separator)
.append(formatPath).append(File.separator).append("订单")
.append(exportExcel.getCreateTime().getTime()).append(".xls");
fileInputStream = new FileInputStream(new File(filePath.toString()));
File file = new File(ExportExcelServiceImpl.EXPORT + exportExcel.getExportUrl());
fileInputStream = new FileInputStream(file);
in = new DataInputStream(fileInputStream);
int bytes = 0;
byte[] bufferOut = new byte[1024];
......
......@@ -121,6 +121,8 @@ public class ExportService extends BaseController {
tops.add("升级套餐");
tops.add("订单状态");
tops.add("订单类型");
tops.add("地区");
tops.add("地址");
tops.add("学生证审核状态");
List<String> columns = new ArrayList<>();
columns.add("customer_name");
......@@ -135,6 +137,8 @@ public class ExportService extends BaseController {
columns.add("business_package");
columns.add("order_status");
columns.add("user_type");
columns.add("site");
columns.add("address");
columns.add("student_card_checkStatus");
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String formatPath = format.format(new Date());
......@@ -159,11 +163,17 @@ public class ExportService extends BaseController {
sheet.setColumnWidth(2, 4000);
sheet.setColumnWidth(3, 4000);
sheet.setColumnWidth(4, 4000);
sheet.setColumnWidth(5, 7000);
sheet.setColumnWidth(6, 7000);
sheet.setColumnWidth(7, 4000);
sheet.setColumnWidth(8, 4000);
sheet.setColumnWidth(9, 6500);
sheet.setColumnWidth(10, 6500);
sheet.setColumnWidth(11, 6500);
sheet.setColumnWidth(12, 6500);
sheet.setColumnWidth(13, 6500);
sheet.setColumnWidth(14, 6500);
sheet.setColumnWidth(15, 6500);
//第一行字段名称
tops.forEach(column -> {
XSSFCell cell = row.createCell(Math.max(row.getLastCellNum(), 0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment