|
@@ -5,6 +5,7 @@ import com.ozs.base.domain.BaseProfessional;
|
|
|
import com.ozs.base.domain.vo.BaseProfessionalVo;
|
|
|
import com.ozs.base.mapper.BaseProfessionalMapper;
|
|
|
import com.ozs.base.service.BaseProfessionalService;
|
|
|
+import com.ozs.common.core.domain.AjaxResult;
|
|
|
import com.ozs.common.core.domain.entity.SysDictType;
|
|
|
import com.ozs.common.core.domain.entity.SysUser;
|
|
|
import com.ozs.common.exception.ServiceException;
|
|
@@ -15,7 +16,10 @@ import com.ozs.common.utils.bean.BeanValidators;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Validator;
|
|
|
+import java.io.*;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -78,6 +82,52 @@ public class BaseProfessionalServiceImpl extends ServiceImpl<BaseProfessionalMap
|
|
|
return successMsg.toString();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public AjaxResult downloadPathFile(String downloadPath, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ //设置文件路径
|
|
|
+ File file = new File(downloadPath);
|
|
|
+ //获取文件名称
|
|
|
+ String fileName = file.getName();
|
|
|
+ //判断文件是否存在
|
|
|
+ if (file.exists()) {
|
|
|
+ response.setContentType("application/force-download");// 设置强制下载不打开
|
|
|
+ response.addHeader("Content-Disposition", "attachment;fileName=" + fileName);// 设置文件名
|
|
|
+ byte[] buffer = new byte[1024];
|
|
|
+ FileInputStream fis = null;
|
|
|
+ BufferedInputStream bis = null;
|
|
|
+ try {
|
|
|
+ fis = new FileInputStream(file);
|
|
|
+ bis = new BufferedInputStream(fis);
|
|
|
+ OutputStream os = response.getOutputStream();
|
|
|
+ int i = bis.read(buffer);
|
|
|
+ while (i != -1) {
|
|
|
+ os.write(buffer, 0, i);
|
|
|
+ i = bis.read(buffer);
|
|
|
+ }
|
|
|
+ file.delete();
|
|
|
+ return AjaxResult.success("下载成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ if (bis != null) {
|
|
|
+ try {
|
|
|
+ bis.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (fis != null) {
|
|
|
+ try {
|
|
|
+ fis.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success("下载失败");
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<BaseProfessionalVo> selectBaseProfessionalVo(BaseProfessionalVo baseProfessionalVo) {
|
|
|
List<BaseProfessional> allList = new ArrayList<>();
|