|
@@ -11,6 +11,8 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.core.validate.AddGroup;
|
|
import com.ruoyi.common.core.validate.AddGroup;
|
|
import com.ruoyi.common.core.validate.EditGroup;
|
|
import com.ruoyi.common.core.validate.EditGroup;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
|
+import com.ruoyi.common.utils.file.FolderToZipUtil;
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.zdsz.domain.bo.ZEngineeringIndustryBo;
|
|
import com.ruoyi.zdsz.domain.bo.ZEngineeringIndustryBo;
|
|
import com.ruoyi.zdsz.domain.vo.ZEngineeringIndustryTypeVo;
|
|
import com.ruoyi.zdsz.domain.vo.ZEngineeringIndustryTypeVo;
|
|
@@ -19,12 +21,15 @@ import com.ruoyi.zdsz.mapper.ZEngineeringCivilMapper;
|
|
import com.ruoyi.zdsz.service.IZEngineeringIndustryService;
|
|
import com.ruoyi.zdsz.service.IZEngineeringIndustryService;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.constraints.NotEmpty;
|
|
import javax.validation.constraints.NotEmpty;
|
|
import javax.validation.constraints.NotNull;
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.LinkedList;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -124,10 +129,43 @@ public class ZEngineeringIndustryController extends BaseController {
|
|
*/
|
|
*/
|
|
// @SaCheckPermission("zdsz:engineeringIndustry:query")
|
|
// @SaCheckPermission("zdsz:engineeringIndustry:query")
|
|
@GetMapping("/{id}/{type}")
|
|
@GetMapping("/{id}/{type}")
|
|
- public R<ZEngineeringIndustryVo> query(@NotNull(message = "主键不能为空") @PathVariable String id, @PathVariable String type) {
|
|
|
|
|
|
+ public R<ZEngineeringIndustryVo> query(@PathVariable String id, @PathVariable String type) {
|
|
return R.ok(iZEngineeringIndustryService.query(id, type));
|
|
return R.ok(iZEngineeringIndustryService.query(id, type));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Value("${filePath}")
|
|
|
|
+ private String filePath;
|
|
|
|
+
|
|
|
|
+ @GetMapping(value = "/downloadZip/{type}/{name}")
|
|
|
|
+ public void downloadZip(@PathVariable String type,@PathVariable String name,HttpServletResponse response) {
|
|
|
|
+// File file = new File(zipPath);//创建指定目录和文件名称的文件对象
|
|
|
|
+ try {
|
|
|
|
+ // 创建最外层文件夹
|
|
|
|
+ byte[] fileNameBytes = filePath.getBytes("UTF-8");
|
|
|
|
+ // 使用UTF-8编码创建文件
|
|
|
|
+ File file = new File(new String(fileNameBytes, "UTF-8"));
|
|
|
|
+ if (!file.exists()) {
|
|
|
|
+ file.mkdirs();
|
|
|
|
+ }
|
|
|
|
+ byte[] typeFileNameBytes = (file.getPath() + "/" + type).getBytes("UTF-8");
|
|
|
|
+ // 使用UTF-8编码创建文件
|
|
|
|
+ File typeFile = new File(new String(typeFileNameBytes, "UTF-8"));
|
|
|
|
+ if (!typeFile.exists()) {
|
|
|
|
+ typeFile.mkdirs();
|
|
|
|
+ }
|
|
|
|
+ byte[] enginNameFileNameBytes = (typeFile.getPath() + "/" + name).getBytes("UTF-8");
|
|
|
|
+ // 使用UTF-8编码创建文件
|
|
|
|
+ File enginNameFile = new File(new String(enginNameFileNameBytes, "UTF-8"));
|
|
|
|
+ if (!enginNameFile.exists()) {
|
|
|
|
+ enginNameFile.mkdirs();
|
|
|
|
+ }
|
|
|
|
+ System.out.println(enginNameFile.getPath());
|
|
|
|
+ FolderToZipUtil.zip(enginNameFile.getPath(),name,response);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 工业工程|市政工程根据工程类型查询工程名称
|
|
* 工业工程|市政工程根据工程类型查询工程名称
|
|
*/
|
|
*/
|