mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 02:08:15 +08:00
新增导出以及数据库列表
This commit is contained in:
parent
c6d90bac31
commit
a5c9b26571
Binary file not shown.
|
Before Width: | Height: | Size: 956 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 956 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 956 KiB |
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.web.controller.house;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -27,7 +28,7 @@ import com.ruoyi.system.service.IBuyHousesService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】
|
||||
* 一期后台接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-27
|
||||
@ -41,7 +42,7 @@ public class BuyHousesController extends BaseController {
|
||||
private final IBuyHousesService iBuyHousesService;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
* 一期后台接口查询列表
|
||||
*/
|
||||
@SaCheckPermission("system:houses:list")
|
||||
@GetMapping("/list")
|
||||
@ -50,18 +51,36 @@ public class BuyHousesController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出【请填写功能名称】列表
|
||||
* 预约导出
|
||||
* @param bo
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/subscribeExport")
|
||||
public R subscribeExport(BuyHousesBo bo) throws IOException {
|
||||
return iBuyHousesService.subscribeExport(bo);
|
||||
}
|
||||
/**
|
||||
* 导出excel
|
||||
*/
|
||||
@GetMapping("/exportExcel")
|
||||
public void exportExcel(BuyHousesBo bo,HttpServletResponse response){
|
||||
iBuyHousesService.exportExcel(bo,response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 一期导出列表
|
||||
*/
|
||||
@SaCheckPermission("system:houses:export")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@PostMapping("一期导出列表")
|
||||
public void export(BuyHousesBo bo, HttpServletResponse response) {
|
||||
List<BuyHousesVo> list = iBuyHousesService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "【请填写功能名称】", BuyHousesVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
* 获取详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
|
||||
@ -28,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -50,7 +51,7 @@ public class HousesReviewController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 购房登记录入
|
||||
* 购房登记录入列表
|
||||
* @param bo
|
||||
* @param pageQuery
|
||||
* @return
|
||||
@ -61,6 +62,26 @@ public class HousesReviewController extends BaseController {
|
||||
return iHousesReviewService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 预约导出
|
||||
* @param bo
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/subscribeExport")
|
||||
public R subscribeExport(HousesReviewBo bo) throws IOException {
|
||||
return iHousesReviewService.subscribeExport(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*/
|
||||
@GetMapping("/exportExcel")
|
||||
public void exportExcel(HousesReviewBo bo,HttpServletResponse response){
|
||||
iHousesReviewService.exportExcel(bo,response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询购房复审登记列表
|
||||
*/
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.core.validate.QueryGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.vo.SubscribeExportVo;
|
||||
import com.ruoyi.system.domain.bo.SubscribeExportBo;
|
||||
import com.ruoyi.system.service.ISubscribeExportService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 预约导出
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-04-20
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/export")
|
||||
public class SubscribeExportController extends BaseController {
|
||||
|
||||
private final ISubscribeExportService iSubscribeExportService;
|
||||
|
||||
/**
|
||||
* 查询预约导出列表
|
||||
*/
|
||||
@SaCheckPermission("system:export:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SubscribeExportVo> list(SubscribeExportBo bo, PageQuery pageQuery) {
|
||||
return iSubscribeExportService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出预约导出列表
|
||||
*/
|
||||
@SaCheckPermission("system:export:export")
|
||||
@Log(title = "预约导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SubscribeExportBo bo, HttpServletResponse response) {
|
||||
List<SubscribeExportVo> list = iSubscribeExportService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "预约导出", SubscribeExportVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取预约导出详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("system:export:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<SubscribeExportVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(iSubscribeExportService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增预约导出
|
||||
*/
|
||||
@SaCheckPermission("system:export:add")
|
||||
@Log(title = "预约导出", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SubscribeExportBo bo) {
|
||||
return toAjax(iSubscribeExportService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改预约导出
|
||||
*/
|
||||
@SaCheckPermission("system:export:edit")
|
||||
@Log(title = "预约导出", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SubscribeExportBo bo) {
|
||||
return toAjax(iSubscribeExportService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除预约导出
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:export:remove")
|
||||
@Log(title = "预约导出", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iSubscribeExportService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
}
|
||||
@ -68,7 +68,6 @@ public class SysLoginController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 短信登录(示例)
|
||||
*
|
||||
@ -115,7 +114,6 @@ public class SysLoginController {
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
@ -144,7 +142,6 @@ public class SysLoginController {
|
||||
//----------------------------------------------------客户端-------------------------------------------------------------
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -199,7 +196,6 @@ public class SysLoginController {
|
||||
|
||||
/**
|
||||
* 忘记密码发送短信Aliyun
|
||||
*
|
||||
* @param phones 电话号
|
||||
*/
|
||||
// @RateLimiter(count = 1)
|
||||
|
||||
@ -173,7 +173,7 @@ sms:
|
||||
# 本地文件存储
|
||||
file:
|
||||
domain: http://192.168.0.54:8080
|
||||
path: D:\\gaoxin\\images
|
||||
path: D:\\gaoxin\\images\\
|
||||
prefix: /images
|
||||
size: 10
|
||||
template: D:\\gaoxin\\file\\
|
||||
|
||||
@ -0,0 +1,336 @@
|
||||
package com.ruoyi.common.utils.file;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 文件处理工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class MyFileUtils extends FileUtils
|
||||
{
|
||||
/** 字符常量:斜杠 {@code '/'} */
|
||||
public static final char SLASH = '/';
|
||||
|
||||
/** 字符常量:反斜杠 {@code '\\'} */
|
||||
public static final char BACKSLASH = '\\';
|
||||
|
||||
public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
|
||||
|
||||
/**
|
||||
* 输出指定文件的byte数组
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @param fileName 文件名字
|
||||
* @return
|
||||
*/
|
||||
public static void writeBytes(String filePath, String fileName) throws IOException
|
||||
{
|
||||
FileInputStream fis = null;
|
||||
FileOutputStream os = null;
|
||||
try
|
||||
{
|
||||
File file = new File(filePath);
|
||||
os = new FileOutputStream(fileName);
|
||||
if (!file.exists())
|
||||
{
|
||||
throw new FileNotFoundException(filePath);
|
||||
}
|
||||
fis = new FileInputStream(file);
|
||||
|
||||
byte[] b = new byte[1024];
|
||||
int length;
|
||||
while ((length = fis.read(b)) > 0)
|
||||
{
|
||||
os.write(b, 0, length);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
//不抛异常
|
||||
e.printStackTrace();
|
||||
// throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (os != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
os.close();
|
||||
}
|
||||
catch (IOException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (fis != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
fis.close();
|
||||
}
|
||||
catch (IOException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void downLoadPic(String str,String fileName) {
|
||||
// 完成从网络上下载图片的功能
|
||||
try {
|
||||
// 建立连接
|
||||
URL url = new URL(str);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");//POST
|
||||
InputStream inputStream = conn.getInputStream();
|
||||
FileOutputStream fos = new FileOutputStream(fileName);
|
||||
byte[] temp = new byte[1024];
|
||||
int len = 0;
|
||||
while ((len = inputStream.read(temp)) != -1) {
|
||||
fos.write(temp, 0, len);
|
||||
}
|
||||
inputStream.close();
|
||||
fos.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param filePath 文件
|
||||
* @return
|
||||
*/
|
||||
public static boolean deleteFile(String filePath)
|
||||
{
|
||||
boolean flag = false;
|
||||
File file = new File(filePath);
|
||||
// 路径为文件且不为空则进行删除
|
||||
if (file.isFile() && file.exists())
|
||||
{
|
||||
file.delete();
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件名称验证
|
||||
*
|
||||
* @param filename 文件名称
|
||||
* @return true 正常 false 非法
|
||||
*/
|
||||
public static boolean isValidFilename(String filename)
|
||||
{
|
||||
return filename.matches(FILENAME_PATTERN);
|
||||
}
|
||||
|
||||
/* public static void main(String[] args) {
|
||||
boolean b = checkAllowDownload("C:\\Users\\vimdr\\Pictures\\Camera Roll\\Snipaste_2021-06-03_15-11-34.png");
|
||||
System.out.println(b);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 检查文件是否可下载
|
||||
*
|
||||
* @param resource 需要下载的文件
|
||||
* @return true 正常 false 非法
|
||||
*/
|
||||
public static boolean checkAllowDownload(String resource)
|
||||
{
|
||||
// 禁止目录上跳级别
|
||||
if (StringUtils.contains(resource, ".."))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查允许下载的文件规则
|
||||
if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// 不在允许下载的文件规则
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件名重新编码
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param fileName 文件名
|
||||
* @return 编码后的文件名
|
||||
*/
|
||||
public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException
|
||||
{
|
||||
final String agent = request.getHeader("USER-AGENT");
|
||||
String filename = fileName;
|
||||
if (agent.contains("MSIE"))
|
||||
{
|
||||
// IE浏览器
|
||||
filename = URLEncoder.encode(filename, "utf-8");
|
||||
filename = filename.replace("+", " ");
|
||||
}
|
||||
else if (agent.contains("Firefox"))
|
||||
{
|
||||
// 火狐浏览器
|
||||
filename = new String(fileName.getBytes(), "ISO8859-1");
|
||||
}
|
||||
else if (agent.contains("Chrome"))
|
||||
{
|
||||
// google浏览器
|
||||
filename = URLEncoder.encode(filename, "utf-8");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 其它浏览器
|
||||
filename = URLEncoder.encode(filename, "utf-8");
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回文件名
|
||||
*
|
||||
* @param filePath 文件
|
||||
* @return 文件名
|
||||
*/
|
||||
public static String getName(String filePath)
|
||||
{
|
||||
if (null == filePath)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
int len = filePath.length();
|
||||
if (0 == len)
|
||||
{
|
||||
return filePath;
|
||||
}
|
||||
if (isFileSeparator(filePath.charAt(len - 1)))
|
||||
{
|
||||
// 以分隔符结尾的去掉结尾分隔符
|
||||
len--;
|
||||
}
|
||||
|
||||
int begin = 0;
|
||||
char c;
|
||||
for (int i = len - 1; i > -1; i--)
|
||||
{
|
||||
c = filePath.charAt(i);
|
||||
if (isFileSeparator(c))
|
||||
{
|
||||
// 查找最后一个路径分隔符(/或者\)
|
||||
begin = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return filePath.substring(begin, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为Windows或者Linux(Unix)文件分隔符<br>
|
||||
* Windows平台下分隔符为\,Linux(Unix)为/
|
||||
*
|
||||
* @param c 字符
|
||||
* @return 是否为Windows或者Linux(Unix)文件分隔符
|
||||
*/
|
||||
public static boolean isFileSeparator(char c)
|
||||
{
|
||||
return SLASH == c || BACKSLASH == c;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件名重新编码
|
||||
*
|
||||
* @param response 响应对象
|
||||
* @param realFileName 真实文件名
|
||||
* @return
|
||||
*/
|
||||
public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException
|
||||
{
|
||||
String percentEncodedFileName = percentEncode(realFileName);
|
||||
|
||||
StringBuilder contentDispositionValue = new StringBuilder();
|
||||
contentDispositionValue.append("attachment; filename=")
|
||||
.append(percentEncodedFileName)
|
||||
.append(";")
|
||||
.append("filename*=")
|
||||
.append("utf-8''")
|
||||
.append(percentEncodedFileName);
|
||||
|
||||
response.setHeader("Content-disposition", contentDispositionValue.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 百分号编码工具方法
|
||||
*
|
||||
* @param s 需要百分号编码的字符串
|
||||
* @return 百分号编码后的字符串
|
||||
*/
|
||||
public static String percentEncode(String s) throws UnsupportedEncodingException
|
||||
{
|
||||
String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
|
||||
return encode.replaceAll("\\+", "%20");
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本地图片进行Base64位编码
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static String encodeImgageToBase64(File imageFile) {
|
||||
// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
|
||||
// 其进行Base64编码处理
|
||||
byte[] data = null;
|
||||
// 读取图片字节数组
|
||||
try {
|
||||
InputStream in = new FileInputStream(imageFile);
|
||||
data = new byte[in.available()];
|
||||
in.read(data);
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 对字节数组Base64编码
|
||||
// BASE64Encoder encoder = new BASE64Encoder();
|
||||
return Base64.encodeBase64String(data);
|
||||
// return encoder.encode(data);// 返回Base64编码过的字节数组字符串
|
||||
}
|
||||
|
||||
|
||||
public static File MultipartFileToFile(MultipartFile multipartFile) {
|
||||
// 获取文件名
|
||||
String fileName = multipartFile.getOriginalFilename();
|
||||
// 获取文件后缀
|
||||
String suffix = fileName.substring(fileName.lastIndexOf("."));
|
||||
try {
|
||||
File file = File.createTempFile(System.currentTimeMillis() + "", suffix);
|
||||
//multipartFile.transferTo(file);
|
||||
FileUtils.copyInputStreamToFile(multipartFile.getInputStream(), file);
|
||||
return file;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
package com.ruoyi.common.utils.poi;
|
||||
|
||||
/**
|
||||
* Created by shuaibin_yang on 2019/5/9 0009.
|
||||
*/
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* 删除文件和目录
|
||||
*
|
||||
*/
|
||||
public class DeleteFileUtil {
|
||||
|
||||
/**
|
||||
* 删除文件,可以是文件或文件夹
|
||||
*
|
||||
* @param fileName
|
||||
* 要删除的文件名
|
||||
* @return 删除成功返回true,否则返回false
|
||||
*/
|
||||
public static boolean delete(String fileName) {
|
||||
File file = new File(fileName);
|
||||
if (!file.exists()) {
|
||||
System.out.println("删除文件失败:" + fileName + "不存在!");
|
||||
return false;
|
||||
} else {
|
||||
if (file.isFile())
|
||||
return deleteFile(fileName);
|
||||
else
|
||||
return deleteDirectory(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单个文件
|
||||
*
|
||||
* @param fileName
|
||||
* 要删除的文件的文件名
|
||||
* @return 单个文件删除成功返回true,否则返回false
|
||||
*/
|
||||
public static boolean deleteFile(String fileName) {
|
||||
File file = new File(fileName);
|
||||
// 如果文件路径所对应的文件存在,并且是一个文件,则直接删除
|
||||
if (file.exists() && file.isFile()) {
|
||||
if (file.delete()) {
|
||||
System.out.println("删除单个文件" + fileName + "成功!");
|
||||
return true;
|
||||
} else {
|
||||
System.out.println("删除单个文件" + fileName + "失败!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
System.out.println("删除单个文件失败:" + fileName + "不存在!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除目录及目录下的文件
|
||||
*
|
||||
* @param dir
|
||||
* 要删除的目录的文件路径
|
||||
* @return 目录删除成功返回true,否则返回false
|
||||
*/
|
||||
public static boolean deleteDirectory(String dir) {
|
||||
// 如果dir不以文件分隔符结尾,自动添加文件分隔符
|
||||
if (!dir.endsWith(File.separator))
|
||||
dir = dir + File.separator;
|
||||
File dirFile = new File(dir);
|
||||
// 如果dir对应的文件不存在,或者不是一个目录,则退出
|
||||
if ((!dirFile.exists()) || (!dirFile.isDirectory())) {
|
||||
System.out.println("删除目录失败:" + dir + "不存在!");
|
||||
return false;
|
||||
}
|
||||
boolean flag = true;
|
||||
// 删除文件夹中的所有文件包括子目录
|
||||
File[] files = dirFile.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
// 删除子文件
|
||||
if (files[i].isFile()) {
|
||||
flag = DeleteFileUtil.deleteFile(files[i].getAbsolutePath());
|
||||
if (!flag)
|
||||
break;
|
||||
}
|
||||
// 删除子目录
|
||||
else if (files[i].isDirectory()) {
|
||||
flag = DeleteFileUtil.deleteDirectory(files[i]
|
||||
.getAbsolutePath());
|
||||
if (!flag)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
System.out.println("删除目录失败!");
|
||||
return false;
|
||||
}
|
||||
// 删除当前目录
|
||||
if (dirFile.delete()) {
|
||||
System.out.println("删除目录" + dir + "成功!");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* public static void main(String[] args) {
|
||||
// // 删除单个文件
|
||||
// String file = "c:/test/test.txt";
|
||||
// DeleteFileUtil.deleteFile(file);
|
||||
// System.out.println();
|
||||
// 删除一个目录
|
||||
String dir = "E:/template/20190509222628.zip";
|
||||
// DeleteFileUtil.deleteDirectory(dir);
|
||||
deleteFile(dir);
|
||||
// System.out.println();
|
||||
// // 删除文件
|
||||
// dir = "c:/test/test0";
|
||||
// DeleteFileUtil.delete(dir);
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
package com.ruoyi.common.utils.poi;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
|
||||
public class ZipUtils {
|
||||
private static final int BUFFER_SIZE = 2 * 1024;
|
||||
|
||||
|
||||
public static void toZip(String srcDir, String out, boolean KeepDirStructure)
|
||||
throws RuntimeException {
|
||||
long start = System.currentTimeMillis();
|
||||
ZipOutputStream zos = null;
|
||||
try {
|
||||
FileOutputStream fos1 = new FileOutputStream(new File(out));
|
||||
zos = new ZipOutputStream(fos1);
|
||||
File sourceFile = new File(srcDir);
|
||||
compress(sourceFile, zos, sourceFile.getName(), KeepDirStructure);
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println("压缩完成,耗时:" + (end - start) + " ms");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("zip error from ZipUtils", e);
|
||||
} finally {
|
||||
if (zos != null) {
|
||||
try {
|
||||
zos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void toZip(List<File> srcFiles, OutputStream out) throws RuntimeException {
|
||||
long start = System.currentTimeMillis();
|
||||
ZipOutputStream zos = null;
|
||||
try {
|
||||
zos = new ZipOutputStream(out);
|
||||
for (File srcFile : srcFiles) {
|
||||
byte[] buf = new byte[BUFFER_SIZE];
|
||||
zos.putNextEntry(new ZipEntry(srcFile.getName()));
|
||||
int len;
|
||||
FileInputStream in = new FileInputStream(srcFile);
|
||||
while ((len = in.read(buf)) != -1) {
|
||||
zos.write(buf, 0, len);
|
||||
}
|
||||
zos.closeEntry();
|
||||
in.close();
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println("压缩完成,耗时:" + (end - start) + " ms");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("zip error from ZipUtils", e);
|
||||
} finally {
|
||||
if (zos != null) {
|
||||
try {
|
||||
zos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void compress(File sourceFile, ZipOutputStream zos, String name,
|
||||
boolean KeepDirStructure) throws Exception {
|
||||
byte[] buf = new byte[BUFFER_SIZE];
|
||||
if (sourceFile.isFile()) {
|
||||
// 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字
|
||||
zos.putNextEntry(new ZipEntry(name));
|
||||
// copy文件到zip输出流中
|
||||
int len;
|
||||
FileInputStream in = new FileInputStream(sourceFile);
|
||||
while ((len = in.read(buf)) != -1) {
|
||||
zos.write(buf, 0, len);
|
||||
}
|
||||
zos.closeEntry();
|
||||
in.close();
|
||||
} else {
|
||||
File[] listFiles = sourceFile.listFiles();
|
||||
if (listFiles == null || listFiles.length == 0) {
|
||||
// 需要保留原来的文件结构时,需要对空文件夹进行处理
|
||||
if (KeepDirStructure) {
|
||||
// 空文件夹的处理
|
||||
zos.putNextEntry(new ZipEntry(name + "/"));
|
||||
// 没有文件,不需要文件的copy
|
||||
zos.closeEntry();
|
||||
}
|
||||
} else {
|
||||
for (File file : listFiles) {
|
||||
// 判断是否需要保留原来的文件结构
|
||||
if (KeepDirStructure) {
|
||||
// 注意:file.getName()前面需要带上父文件夹的名字加一斜杠,
|
||||
// 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了
|
||||
compress(file, zos, name + "/" + file.getName(), KeepDirStructure);
|
||||
} else {
|
||||
compress(file, zos, file.getName(), KeepDirStructure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
// FileOutputStream fos1 = new FileOutputStream(new File("H:/mytest01.zip"));
|
||||
// ZipUtils.toZip("H:/a", fos1, true);
|
||||
|
||||
// List<File> fileList = new ArrayList<>();
|
||||
//// fileList.add(new File("H:/1.png"));
|
||||
// fileList.add(new File("E:/a"));
|
||||
// FileOutputStream fos2 = new FileOutputStream(new File("H:/123.zip"));
|
||||
// ZipUtils.toZip(fileList, fos2);
|
||||
// DocumentHandler documentHandler = new DocumentHandler();
|
||||
// String str = "http://192.168.0.66:8090/file/d4d076edcfc34415ae0e4296fd8dc035.png";
|
||||
//// String[] split = str.split(".");
|
||||
// String n1=str.substring(str.lastIndexOf("."));
|
||||
// System.out.println(n1);
|
||||
//// documentHandler.download(str, "aaaa"+split[split.length - 1]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -28,13 +28,11 @@
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-oss</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SMS功能模块 -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-sms</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-work</artifactId>
|
||||
|
||||
@ -146,7 +146,7 @@ public class BuyHouses extends BaseEntity {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date affTime;
|
||||
private Date passTime;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -171,5 +171,4 @@ public class BuyHouses extends BaseEntity {
|
||||
private List<BuyHousesMember> buyHousesMemberList;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 购房复审登记对象 houses_review
|
||||
*
|
||||
@ -132,4 +134,6 @@ public class HousesReview extends BaseEntity {
|
||||
*/
|
||||
private String typeExtend;
|
||||
|
||||
private Date passTime;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 预约导出对象 subscribe_export
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-04-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("subscribe_export")
|
||||
public class SubscribeExport extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 路径
|
||||
*/
|
||||
private String path;
|
||||
/**
|
||||
* 申请人id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
}
|
||||
@ -209,7 +209,7 @@ public class BuyHousesBo extends BaseEntity {
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date affTime;
|
||||
private Date passTime;
|
||||
|
||||
/**
|
||||
*人才影像卡
|
||||
@ -241,5 +241,7 @@ public class BuyHousesBo extends BaseEntity {
|
||||
|
||||
private String companyId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long[] ids;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.domain.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
@ -11,6 +12,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -183,6 +185,9 @@ public class HousesReviewBo extends BaseEntity {
|
||||
*/
|
||||
private String typeExtend;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long[] ids;
|
||||
|
||||
private Date passTime;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package com.ruoyi.system.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 预约导出业务对象 subscribe_export
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-04-20
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SubscribeExportBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 路径
|
||||
*/
|
||||
@NotBlank(message = "路径不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 申请人id
|
||||
*/
|
||||
@NotBlank(message = "申请人id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String userId;
|
||||
|
||||
|
||||
}
|
||||
@ -206,13 +206,13 @@ public class BuyHousesVo {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Date affTime;
|
||||
@ExcelProperty(value = "审核通过时间")
|
||||
private Date passTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
@ExcelProperty(value = "人才影像卡")
|
||||
private String pictureInformationUrl;
|
||||
|
||||
/**
|
||||
@ -237,5 +237,4 @@ public class BuyHousesVo {
|
||||
|
||||
private String companyId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -135,13 +135,13 @@ public class HousesReviewVo implements Serializable {
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
// @ExcelProperty(value = "公司名称")
|
||||
@ExcelProperty(value = "公司名称")
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 人才类型
|
||||
*/
|
||||
// @ExcelProperty(value = "人才类型")
|
||||
@ExcelProperty(value = "人才类型")
|
||||
private String talentsType;
|
||||
|
||||
/**
|
||||
@ -153,8 +153,7 @@ public class HousesReviewVo implements Serializable {
|
||||
/**
|
||||
* 企业所在地
|
||||
*/
|
||||
// @ExcelProperty(value = "企业所在地")
|
||||
|
||||
@ExcelProperty(value = "企业所在地")
|
||||
private String companyAddress;
|
||||
|
||||
/**
|
||||
@ -183,6 +182,11 @@ public class HousesReviewVo implements Serializable {
|
||||
*/
|
||||
private String typeExtend;
|
||||
|
||||
/**
|
||||
* 审核通过时间
|
||||
*/
|
||||
@ExcelProperty(value = "审核通过时间")
|
||||
private Date passTime;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 预约导出视图对象 subscribe_export
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-04-20
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class SubscribeExportVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 路径
|
||||
*/
|
||||
@ExcelProperty(value = "路径")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 申请人id
|
||||
*/
|
||||
@ExcelProperty(value = "申请人id")
|
||||
private String userId;
|
||||
|
||||
|
||||
}
|
||||
@ -132,7 +132,4 @@ public class UserVo {
|
||||
|
||||
private String companyId;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.system.domain.SubscribeExport;
|
||||
import com.ruoyi.system.domain.vo.SubscribeExportVo;
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 预约导出Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-04-20
|
||||
*/
|
||||
public interface SubscribeExportMapper extends BaseMapperPlus<SubscribeExportMapper, SubscribeExport, SubscribeExportVo> {
|
||||
|
||||
}
|
||||
@ -8,6 +8,8 @@ import com.ruoyi.system.domain.bo.BuyHousesBo;
|
||||
import com.ruoyi.system.domain.dto.DeclareListDTO;
|
||||
import com.ruoyi.system.domain.vo.BuyHousesVo;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -60,4 +62,18 @@ public interface IBuyHousesService {
|
||||
R<?> getInfo(BuyHouses buyHouses);
|
||||
|
||||
R getGaoXinCandidateInfoByCardId(String cardId);
|
||||
|
||||
/**
|
||||
* 导出列表
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
R subscribeExport(BuyHousesBo bo) throws IOException;
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
* @param bo
|
||||
* @param response
|
||||
*/
|
||||
void exportExcel(BuyHousesBo bo, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import com.ruoyi.system.domain.HousesReview;
|
||||
import com.ruoyi.system.domain.bo.HousesReviewBo;
|
||||
import com.ruoyi.system.domain.vo.HousesReviewVo;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -55,4 +57,18 @@ public interface IHousesReviewService {
|
||||
HousesReviewVo queryByIdOne(Long id);
|
||||
|
||||
R<?> getMaterialByBusinessId(Long id);
|
||||
|
||||
/**
|
||||
* 预约导出
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
R subscribeExport(HousesReviewBo bo) throws IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param bo
|
||||
*/
|
||||
void exportExcel(HousesReviewBo bo, HttpServletResponse response);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.system.domain.SubscribeExport;
|
||||
import com.ruoyi.system.domain.vo.SubscribeExportVo;
|
||||
import com.ruoyi.system.domain.bo.SubscribeExportBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 预约导出Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-04-20
|
||||
*/
|
||||
public interface ISubscribeExportService {
|
||||
|
||||
/**
|
||||
* 查询预约导出
|
||||
*/
|
||||
SubscribeExportVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询预约导出列表
|
||||
*/
|
||||
TableDataInfo<SubscribeExportVo> queryPageList(SubscribeExportBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询预约导出列表
|
||||
*/
|
||||
List<SubscribeExportVo> queryList(SubscribeExportBo bo);
|
||||
|
||||
/**
|
||||
* 新增预约导出
|
||||
*/
|
||||
Boolean insertByBo(SubscribeExportBo bo);
|
||||
|
||||
/**
|
||||
* 修改预约导出
|
||||
*/
|
||||
Boolean updateByBo(SubscribeExportBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除预约导出信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -14,28 +14,39 @@ import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.BeanCopyUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.MyFileUtils;
|
||||
import com.ruoyi.common.utils.poi.DeleteFileUtil;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.utils.poi.ExportWordUtil;
|
||||
import com.ruoyi.system.domain.BuyHouses;
|
||||
import com.ruoyi.system.domain.BuyHousesMember;
|
||||
import com.ruoyi.system.domain.MaterialProof;
|
||||
import com.ruoyi.common.utils.poi.ZipUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.bo.BuyHousesBo;
|
||||
import com.ruoyi.system.domain.dto.DeclareListDTO;
|
||||
import com.ruoyi.system.domain.vo.BuyHousesVo;
|
||||
import com.ruoyi.system.domain.vo.HousesReviewVo;
|
||||
import com.ruoyi.system.domain.vo.MaterialModuleVo;
|
||||
import com.ruoyi.system.mapper.BuyHousesMapper;
|
||||
import com.ruoyi.system.mapper.BuyHousesMemberMapper;
|
||||
import com.ruoyi.system.mapper.MaterialProofMapper;
|
||||
import com.ruoyi.system.mapper.SubscribeExportMapper;
|
||||
import com.ruoyi.system.service.IBuyHousesService;
|
||||
import com.ruoyi.work.domain.vo.ProcessVo;
|
||||
import com.ruoyi.work.utils.WorkComplyUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
@ -70,6 +81,8 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
|
||||
private final MaterialModuleServiceImpl materialModuleService;
|
||||
|
||||
private final SubscribeExportMapper subscribeExportMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*/
|
||||
@ -110,6 +123,9 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
private LambdaQueryWrapper<BuyHouses> buildQueryWrapper(BuyHousesBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<BuyHouses> lqw = Wrappers.lambdaQuery();
|
||||
if (ObjectUtil.isNotNull(bo.getIds())){
|
||||
lqw.in(BuyHouses::getId,bo.getIds());
|
||||
}
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getInsidepageUrl()), BuyHouses::getInsidepageUrl, bo.getInsidepageUrl());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCardId()), BuyHouses::getCardId, bo.getCardId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCommitmentUrl()), BuyHouses::getCommitmentUrl, bo.getCommitmentUrl());
|
||||
@ -139,7 +155,7 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getType()), BuyHouses::getType, bo.getType());
|
||||
lqw.eq(bo.getUserId() != null, BuyHouses::getUserId, bo.getUserId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getUserName()), BuyHouses::getUserName, bo.getUserName());
|
||||
lqw.eq(bo.getAffTime() != null, BuyHouses::getAffTime, bo.getAffTime());
|
||||
lqw.eq(bo.getPassTime() != null, BuyHouses::getPassTime, bo.getPassTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPictureInformationUrl()), BuyHouses::getPictureInformationUrl, bo.getPictureInformationUrl());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getWorkAddress()), BuyHouses::getWorkAddress, bo.getWorkAddress());
|
||||
return lqw;
|
||||
@ -410,4 +426,206 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出列表
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R subscribeExport(BuyHousesBo bo) throws IOException {
|
||||
export(bo);
|
||||
return R.ok("预约成功");
|
||||
}
|
||||
|
||||
/**
|
||||
*导出excel
|
||||
* @param bo
|
||||
* @param response
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void exportExcel(BuyHousesBo bo, HttpServletResponse response) {
|
||||
LambdaQueryWrapper<BuyHouses> lqw = buildQueryWrapper(bo);
|
||||
List<BuyHousesVo> buyHousesVoList = baseMapper.selectVoList(lqw);
|
||||
ExcelUtil.exportExcel(buyHousesVoList,"人才列表", BuyHousesVo.class,response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 起步执行导出zip
|
||||
* @param bo
|
||||
* @throws IOException
|
||||
*/
|
||||
@Async
|
||||
public void export(BuyHousesBo bo) throws IOException {
|
||||
LambdaQueryWrapper<BuyHouses> lqw = buildQueryWrapper(bo);
|
||||
List<BuyHousesVo> buyHousesVoList = baseMapper.selectVoList(lqw);
|
||||
String title = "人才认定申请表";
|
||||
String separator = File.separator;
|
||||
String format = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||
String path = filePath + separator + format;
|
||||
if (buyHousesVoList.size() > 0) {
|
||||
//查询家庭附件
|
||||
List<Long> collect = buyHousesVoList.stream().map(BuyHousesVo::getId).collect(Collectors.toList());
|
||||
List<BuyHousesMember> buyHousesMemberList = buyHousesMemberMapper.selectList(new LambdaQueryWrapper<>(BuyHousesMember.class).in(BuyHousesMember::getBuyHousesId, collect));
|
||||
//对每一个HouseId分组
|
||||
Map<String, List<BuyHousesMember>> buyHousesMemberMap = buyHousesMemberList.stream().collect(Collectors.groupingBy(BuyHousesMember::getBuyHousesId));
|
||||
buyHousesVoList.stream().forEach(r -> {
|
||||
String userNameFile = path + separator + r.getUserName();
|
||||
File userFile = new File(userNameFile);
|
||||
if (!userFile.exists() && !userFile.isDirectory()) {
|
||||
userFile.mkdirs();
|
||||
}
|
||||
String s = userNameFile + separator + r.getUserName() + "--";
|
||||
|
||||
//护照或者身份证
|
||||
if (ObjectUtil.isNotNull(r.getInsidepageUrl())){
|
||||
String insidepageUrl = r.getInsidepageUrl();
|
||||
String fileName=null;
|
||||
if ("中国籍".equals(r.getNationality())){
|
||||
fileName = s + "户口簿内页" + insidepageUrl.substring(insidepageUrl.lastIndexOf("."));
|
||||
}else {
|
||||
fileName = s + "护照内页" + insidepageUrl.substring(insidepageUrl.lastIndexOf("."));
|
||||
}
|
||||
MyFileUtils.downLoadPic(insidepageUrl, fileName);
|
||||
}
|
||||
//申请表
|
||||
if (ObjectUtil.isNotNull(r.getCommitmentUrl())){
|
||||
String commitmentUrl = r.getCommitmentUrl();
|
||||
String fileName= s + "申请表" + commitmentUrl.substring(commitmentUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(commitmentUrl, fileName);
|
||||
}
|
||||
|
||||
//申明书
|
||||
if (ObjectUtil.isNotNull(r.getDeclarationUrl())){
|
||||
String declarationUrl = r.getDeclarationUrl();
|
||||
String fileName= s + "申明书" + declarationUrl.substring(declarationUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(declarationUrl, fileName);
|
||||
}
|
||||
|
||||
//身份证正面
|
||||
if (ObjectUtil.isNotNull(r.getFrontUrl())){
|
||||
String frontUrl = r.getFrontUrl();
|
||||
String fileName= s + "身份证正面" + frontUrl.substring(frontUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(frontUrl, fileName);
|
||||
}
|
||||
|
||||
//房屋记录
|
||||
if (ObjectUtil.isNotNull(r.getHomeRecordUrl())){
|
||||
String homeRecordUrl = r.getHomeRecordUrl();
|
||||
String fileName= s + "房屋记录" + homeRecordUrl.substring(homeRecordUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(homeRecordUrl, fileName);
|
||||
}
|
||||
|
||||
//户口簿主页
|
||||
if (ObjectUtil.isNotNull(r.getHomepageUrl())){
|
||||
String homepageUrl = r.getHomepageUrl();
|
||||
String fileName= s + "户口簿主页" + homepageUrl.substring(homepageUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(homepageUrl, fileName);
|
||||
}
|
||||
|
||||
//劳动合同
|
||||
if (ObjectUtil.isNotNull(r.getLaborContractUrl())){
|
||||
String laborContractUrl = r.getLaborContractUrl();
|
||||
String fileName= s + "劳动合同" + laborContractUrl.substring(laborContractUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(laborContractUrl, fileName);
|
||||
}
|
||||
|
||||
//企业营业执照
|
||||
if (ObjectUtil.isNotNull(r.getLicenseUrl())){
|
||||
String licenseUrl = r.getLicenseUrl();
|
||||
String fileName= s + "企业营业执照" + licenseUrl.substring(licenseUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(licenseUrl, fileName);
|
||||
}
|
||||
|
||||
//户口簿主页
|
||||
if (ObjectUtil.isNotNull(r.getHomepageUrl())){
|
||||
String homepageUrl = r.getHomepageUrl();
|
||||
String fileName= s + "户口簿主页" + homepageUrl.substring(homepageUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(homepageUrl, fileName);
|
||||
}
|
||||
|
||||
//婚姻证明材料
|
||||
if (ObjectUtil.isNotNull(r.getMaritalUrl())){
|
||||
String maritalUrl = r.getMaritalUrl();
|
||||
String fileName= s + "婚姻证明材料" + maritalUrl.substring(maritalUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(maritalUrl, fileName);
|
||||
}
|
||||
|
||||
//身份证背面
|
||||
if (ObjectUtil.isNotNull(r.getReverseUrl())){
|
||||
String reverseUrl = r.getReverseUrl();
|
||||
String fileName= s + "身份证背面" + reverseUrl.substring(reverseUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(reverseUrl, fileName);
|
||||
}
|
||||
|
||||
//社保证明
|
||||
if (ObjectUtil.isNotNull(r.getSocialSecurityUrl())){
|
||||
String socialSecurityUrl = r.getSocialSecurityUrl();
|
||||
String fileName= s + "社保证明" + socialSecurityUrl.substring(socialSecurityUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(socialSecurityUrl, fileName);
|
||||
}
|
||||
|
||||
//人才影像卡
|
||||
if (ObjectUtil.isNotNull(r.getPictureInformationUrl())){
|
||||
String pictureInformationUrl = r.getPictureInformationUrl();
|
||||
String fileName= s + "人才影像卡" + pictureInformationUrl.substring(pictureInformationUrl.lastIndexOf("."));
|
||||
MyFileUtils.downLoadPic(pictureInformationUrl, fileName);
|
||||
}
|
||||
|
||||
List<BuyHousesMember> buyHousesMembers = buyHousesMemberMap.get(r.getId().toString());
|
||||
if (buyHousesMembers.size()>0) {
|
||||
buyHousesMembers.stream().forEach(m -> {
|
||||
String userNameFile1 = path + separator + m.getName();
|
||||
if (ObjectUtil.isNotNull(m.getFrontUrl())) {
|
||||
String frontUrl = m.getFrontUrl();
|
||||
String fileName = userNameFile1 + separator + m.getRelation() + "身份证正面" + frontUrl.substring(frontUrl.lastIndexOf("."), frontUrl.length());
|
||||
MyFileUtils.downLoadPic(frontUrl, fileName);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(m.getInsidepageUrl())) {
|
||||
String insidepageUrl = m.getInsidepageUrl();
|
||||
String fileName = userNameFile1 + separator + m.getRelation() + "户口簿内页" + insidepageUrl.substring(insidepageUrl.lastIndexOf("."), insidepageUrl.length());
|
||||
MyFileUtils.downLoadPic(insidepageUrl, fileName);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(m.getReverseUrl())) {
|
||||
String reverseUrl = m.getReverseUrl();
|
||||
String fileName = userNameFile1 + separator + m.getRelation() + "身份证正面" + reverseUrl.substring(reverseUrl.lastIndexOf("."), reverseUrl.length());
|
||||
MyFileUtils.downLoadPic(reverseUrl, fileName);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(m.getHomeRecordUrl())) {
|
||||
String homeRecordUrl = m.getHomeRecordUrl();
|
||||
String fileName = userNameFile1 + separator + m.getRelation() + "身份证正面" + homeRecordUrl.substring(homeRecordUrl.lastIndexOf("."), homeRecordUrl.length());
|
||||
MyFileUtils.downLoadPic(homeRecordUrl, fileName);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
String p = path + separator + title + ".xlsx";
|
||||
String fo = filePath + separator + format + ".zip";
|
||||
File file = new File(p);
|
||||
//获取父目录
|
||||
File fileParent = file.getParentFile();
|
||||
//判断是否存在
|
||||
if (!fileParent.exists()) {
|
||||
//创建父目录文件
|
||||
fileParent.mkdirs();
|
||||
}
|
||||
file.createNewFile();
|
||||
OutputStream outXlsx = new FileOutputStream(p);
|
||||
ExcelUtil.exportExcel(buyHousesVoList,"111",BuyHousesVo.class,outXlsx);
|
||||
outXlsx.close();
|
||||
ZipUtils.toZip(path, fo, true);
|
||||
System.out.println("path = " + path);
|
||||
System.out.println("fo = " + fo);
|
||||
//生成后删除文件
|
||||
DeleteFileUtil.delete(path);
|
||||
String zip = format+".zip";
|
||||
String url =download+prefix+zip;
|
||||
SubscribeExport subscribeExport = new SubscribeExport();
|
||||
subscribeExport.setPath(url);
|
||||
subscribeExport.setUserId(LoginHelper.getUserId().toString());
|
||||
subscribeExportMapper.insert(subscribeExport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,28 +8,36 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.BuyHousesReviewMember;
|
||||
import com.ruoyi.system.domain.HousesReview;
|
||||
import com.ruoyi.system.domain.MaterialModule;
|
||||
import com.ruoyi.system.domain.MaterialProof;
|
||||
import com.ruoyi.common.utils.file.MyFileUtils;
|
||||
import com.ruoyi.common.utils.poi.DeleteFileUtil;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.utils.poi.ZipUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.bo.HousesReviewBo;
|
||||
import com.ruoyi.system.domain.vo.HousesReviewVo;
|
||||
import com.ruoyi.system.domain.vo.MaterialModuleVo;
|
||||
import com.ruoyi.system.mapper.BuyHousesReviewMemberMapper;
|
||||
import com.ruoyi.system.mapper.HousesReviewMapper;
|
||||
import com.ruoyi.system.mapper.MaterialProofMapper;
|
||||
import com.ruoyi.system.mapper.SubscribeExportMapper;
|
||||
import com.ruoyi.system.service.IHousesReviewService;
|
||||
import com.ruoyi.work.domain.vo.ProcessVo;
|
||||
import com.ruoyi.work.utils.WorkComplyUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -53,6 +61,21 @@ public class HousesReviewServiceImpl implements IHousesReviewService {
|
||||
private final SysOssServiceImpl sysOssService;
|
||||
|
||||
|
||||
private final SubscribeExportMapper subscribeExportMapper;
|
||||
|
||||
@Value("${file.template}")
|
||||
private String template;
|
||||
|
||||
@Value("${file.path}")
|
||||
private String filePath;
|
||||
|
||||
@Value("${file.domain}")
|
||||
private String download;
|
||||
|
||||
@Value("${file.prefix}")
|
||||
private String prefix;
|
||||
|
||||
|
||||
/**
|
||||
* 查询购房复审登记
|
||||
*/
|
||||
@ -91,6 +114,9 @@ public class HousesReviewServiceImpl implements IHousesReviewService {
|
||||
private LambdaQueryWrapper<HousesReview> buildQueryWrapper(HousesReviewBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<HousesReview> lqw = Wrappers.lambdaQuery();
|
||||
if (ObjectUtil.isNotNull(bo.getIds())){
|
||||
lqw.in(HousesReview::getId,bo.getIds());
|
||||
}
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCardType()), HousesReview::getCardType, bo.getCardType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCard()), HousesReview::getCard, bo.getCard());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), HousesReview::getName, bo.getName());
|
||||
@ -327,4 +353,85 @@ public class HousesReviewServiceImpl implements IHousesReviewService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导出列表
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R subscribeExport(HousesReviewBo bo) throws IOException {
|
||||
export(bo);
|
||||
return R.ok("预约成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载excel
|
||||
* @param bo
|
||||
*/
|
||||
@Override
|
||||
public void exportExcel(HousesReviewBo bo, HttpServletResponse response) {
|
||||
LambdaQueryWrapper<HousesReview> lqw = buildQueryWrapper(bo);
|
||||
List<HousesReviewVo> housesReviews = baseMapper.selectVoList(lqw);
|
||||
ExcelUtil.exportExcel(housesReviews,"人才列表", HousesReviewVo.class,response);
|
||||
}
|
||||
|
||||
@Async
|
||||
public void export(HousesReviewBo bo) throws IOException {
|
||||
LambdaQueryWrapper<HousesReview> lqw = buildQueryWrapper(bo);
|
||||
List<HousesReview> housesReviews = baseMapper.selectList(lqw);
|
||||
if (housesReviews.size() > 0) {
|
||||
List<Long> collect = housesReviews.stream().map(HousesReview::getId).collect(Collectors.toList());
|
||||
List<MaterialProof> materialProofList = materialProofMapper.selectList(new LambdaQueryWrapper<>(MaterialProof.class).in(MaterialProof::getHouseId, collect));
|
||||
//根据业务id进行分组
|
||||
Map<String, List<MaterialProof>> collectMap = materialProofList.stream().collect(Collectors.groupingBy(MaterialProof::getHouseId));
|
||||
String title = "人才认定申请表";
|
||||
String separator = File.separator;
|
||||
String format = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||
String path = filePath + separator + format;
|
||||
housesReviews.stream().forEach(r -> {
|
||||
List<MaterialProof> materialProofs = collectMap.get(r.getId().toString());
|
||||
if (materialProofs.size()>0) {
|
||||
materialProofs.stream().forEach(p -> {
|
||||
String userNameFile = path + separator + r.getName();
|
||||
File userFile = new File(userNameFile);
|
||||
if (!userFile.exists() && !userFile.isDirectory()) {
|
||||
userFile.mkdirs();
|
||||
}
|
||||
String s = userNameFile + separator + r.getName() + "--";
|
||||
String file = p.getFile();
|
||||
MyFileUtils.downLoadPic(file, s + p.getDescription() + file.substring(file.lastIndexOf(".")));
|
||||
// MyFileUtils.writeBytes(file, s + p.getDescription() + file.substring(file.lastIndexOf(".")));
|
||||
System.out.println("file = " + file);
|
||||
});
|
||||
}
|
||||
});
|
||||
String p = path + separator + title + ".xlsx";
|
||||
String fo = filePath + separator + format + ".zip";
|
||||
File file = new File(p);
|
||||
//获取父目录
|
||||
File fileParent = file.getParentFile();
|
||||
//判断是否存在
|
||||
if (!fileParent.exists()) {
|
||||
//创建父目录文件
|
||||
fileParent.mkdirs();
|
||||
}
|
||||
file.createNewFile();
|
||||
OutputStream outXlsx = new FileOutputStream(p);
|
||||
ExcelUtil.exportExcel(housesReviews,"111",HousesReview.class,outXlsx);
|
||||
outXlsx.close();
|
||||
ZipUtils.toZip(path, fo, true);
|
||||
System.out.println("path = " + path);
|
||||
System.out.println("fo = " + fo);
|
||||
//生成后删除文件
|
||||
DeleteFileUtil.delete(path);
|
||||
String zip = format+".zip";
|
||||
String url =download+prefix+zip;
|
||||
SubscribeExport subscribeExport = new SubscribeExport();
|
||||
subscribeExport.setPath(url);
|
||||
subscribeExport.setUserId(LoginHelper.getUserId().toString());
|
||||
subscribeExportMapper.insert(subscribeExport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,110 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.domain.bo.SubscribeExportBo;
|
||||
import com.ruoyi.system.domain.vo.SubscribeExportVo;
|
||||
import com.ruoyi.system.domain.SubscribeExport;
|
||||
import com.ruoyi.system.mapper.SubscribeExportMapper;
|
||||
import com.ruoyi.system.service.ISubscribeExportService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 预约导出Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-04-20
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SubscribeExportServiceImpl implements ISubscribeExportService {
|
||||
|
||||
private final SubscribeExportMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询预约导出
|
||||
*/
|
||||
@Override
|
||||
public SubscribeExportVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询预约导出列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SubscribeExportVo> queryPageList(SubscribeExportBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SubscribeExport> lqw = buildQueryWrapper(bo);
|
||||
Page<SubscribeExportVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询预约导出列表
|
||||
*/
|
||||
@Override
|
||||
public List<SubscribeExportVo> queryList(SubscribeExportBo bo) {
|
||||
LambdaQueryWrapper<SubscribeExport> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SubscribeExport> buildQueryWrapper(SubscribeExportBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SubscribeExport> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPath()), SubscribeExport::getPath, bo.getPath());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getUserId()), SubscribeExport::getUserId, bo.getUserId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增预约导出
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SubscribeExportBo bo) {
|
||||
SubscribeExport add = BeanUtil.toBean(bo, SubscribeExport.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改预约导出
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SubscribeExportBo bo) {
|
||||
SubscribeExport update = BeanUtil.toBean(bo, SubscribeExport.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SubscribeExport entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除预约导出
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="type" column="type"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
<result property="affTime" column="aff_time"/>
|
||||
<result property="passTime" column="pass_time"/>
|
||||
<result property="pictureInformationUrl" column="picture_information_url"/>
|
||||
<result property="workAddress" column="work_address"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
|
||||
@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="processStatus" column="process_status"/>
|
||||
<result property="companyAddressArea" column="company_address_area"/>
|
||||
<result property="typeExtend" column="type_extend"/>
|
||||
<result property="passTime" column="pass_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.SubscribeExportMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.system.domain.SubscribeExport" id="SubscribeExportResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="path" column="path"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -39,7 +39,6 @@ import java.util.Map;
|
||||
public class WorkController extends BaseController {
|
||||
private final ProcessMapper processMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 获取待办
|
||||
*/
|
||||
@ -67,9 +66,14 @@ public class WorkController extends BaseController {
|
||||
@SaCheckPermission("work:task:processPlan")
|
||||
@PostMapping("/processPlan")
|
||||
public R<?> processPlan(@RequestBody ActProcess actProcess){
|
||||
LambdaQueryWrapper<TProcess> wrapper = new LambdaQueryWrapper<TProcess>()
|
||||
.eq(TProcess::getProcessKey, actProcess.getProcessKey());
|
||||
List<TProcess> tProcesses = processMapper.selectList(wrapper);
|
||||
if (ObjectUtil.isNull(actProcess.getBusinessId())){
|
||||
return R.fail("businessId不可为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(actProcess.getProcessKey())){
|
||||
return R.fail("key不可为空");
|
||||
}
|
||||
List<TProcess> tProcesses = processMapper.selectList(new LambdaQueryWrapper<TProcess>()
|
||||
.eq(TProcess::getProcessKey, actProcess.getProcessKey()));
|
||||
if (tProcesses.size()==0){
|
||||
throw new ServiceException("当前流程不存在");
|
||||
}
|
||||
@ -98,9 +102,6 @@ public class WorkController extends BaseController {
|
||||
List<HisProcessVoResultDto> step = WorkComplyUtils.getStep(businessDTO);
|
||||
return R.ok(step);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 流程办理
|
||||
*/
|
||||
@ -143,6 +144,12 @@ public class WorkController extends BaseController {
|
||||
@SaCheckPermission("work:task:taskInfo")
|
||||
@PostMapping("/taskInfo")
|
||||
public R<?> getInfoById(@RequestBody ActProcess actProcess){
|
||||
if (ObjectUtil.isNull(actProcess.getProcessKey())){
|
||||
return R.fail("key不可为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(actProcess.getBusinessId())){
|
||||
return R.fail("businessId不可为空");
|
||||
}
|
||||
LambdaQueryWrapper<TProcess> wrapper = new LambdaQueryWrapper<TProcess>()
|
||||
.eq(TProcess::getProcessKey, actProcess.getProcessKey());
|
||||
List<TProcess> tProcesses = processMapper.selectList(wrapper);
|
||||
@ -150,13 +157,18 @@ public class WorkController extends BaseController {
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "获取审核日志",businessType = BusinessType.OTHER)
|
||||
@PostMapping("/auditLogList")
|
||||
public R<?> getAuditLogListByOtherId(@RequestBody BusinessDTO businessDTO){
|
||||
return WorkComplyUtils.getAuditLogListByOtherId(businessDTO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退回操作
|
||||
* @param rollBackLog
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "回退",businessType = BusinessType.OTHER)
|
||||
@PostMapping("/rollBackLog")
|
||||
public R<?> rollBackLog(@RequestBody RollBackLog rollBackLog){
|
||||
@ -170,7 +182,5 @@ public class WorkController extends BaseController {
|
||||
rollBackLog.setParams(map);
|
||||
return toAjax(WorkComplyUtils.rollBack(rollBackLog)>1?1:0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
package com.ruoyi.work.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 方法参数对象
|
||||
*
|
||||
* @author gssong
|
||||
* @date 2021-12-17
|
||||
*/
|
||||
@Data
|
||||
public class ActBusinessRuleParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 参数类型
|
||||
*/
|
||||
private String paramType;
|
||||
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
private String param;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer orderNo;
|
||||
|
||||
}
|
||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -68,7 +69,6 @@ public class ActProcess {
|
||||
@TableField(exist = false)
|
||||
private String name;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String description;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ -87,4 +87,5 @@ public class ActProcess {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -78,7 +78,6 @@ public class HisProcess{
|
||||
/**
|
||||
* 相隔时间差
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String timeBetween;
|
||||
|
||||
private String companyName;
|
||||
@ -92,7 +91,6 @@ public class HisProcess{
|
||||
@TableField(exist = false)
|
||||
private String bean;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String description;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ -102,6 +100,13 @@ public class HisProcess{
|
||||
|
||||
private Boolean isNext;
|
||||
|
||||
/**
|
||||
* 该字段只对企业审核做扩展
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String companyId;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -55,5 +55,7 @@ public class ActProcessBo {
|
||||
|
||||
private String userId;
|
||||
|
||||
private String description;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -60,5 +60,7 @@ public class HisProcessBo extends BaseEntity {
|
||||
|
||||
private String userId;
|
||||
|
||||
private String description;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.ruoyi.work.domain;
|
||||
package com.ruoyi.work.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
@ -73,5 +73,9 @@ public class ActProcessVo {
|
||||
|
||||
private String userId;
|
||||
|
||||
private String companyId;
|
||||
|
||||
private String description;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -81,7 +81,6 @@ public class HisProcessVo {
|
||||
|
||||
private String userId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String description;
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ package com.ruoyi.work.mapper;
|
||||
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
import com.ruoyi.work.domain.ActBusinessRule;
|
||||
import com.ruoyi.work.domain.ActBusinessRuleVo;
|
||||
import com.ruoyi.work.domain.vo.ActBusinessRuleVo;
|
||||
|
||||
/**
|
||||
* 业务规则Mapper接口
|
||||
|
||||
@ -24,4 +24,5 @@ public interface HisProcessMapper extends BaseMapperPlus<HisProcessMapper, HisPr
|
||||
|
||||
List<HisProcess> selectVoHisList( @Param(Constants.WRAPPER) Wrapper<HisProcess> queryWrapper);
|
||||
|
||||
Page<HisProcess> selectListPageByCC(@Param("page") Page<HisProcess> page, @Param("hisProcess") HisProcess hisProcess);
|
||||
}
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
package com.ruoyi.work.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
package com.ruoyi.work.utils;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.BetweenFormatter;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
@ -26,7 +27,6 @@ import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.work.domain.*;
|
||||
import com.ruoyi.work.domain.vo.ActProcessVo;
|
||||
import com.ruoyi.work.domain.vo.HisProcessVo;
|
||||
import com.ruoyi.work.domain.vo.ProcessVo;
|
||||
import com.ruoyi.work.dto.BusinessDTO;
|
||||
import com.ruoyi.work.dto.HisProcessVoResultDto;
|
||||
@ -38,6 +38,7 @@ import com.ruoyi.work.service.IWorkSysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -46,7 +47,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class WorkComplyUtils {
|
||||
|
||||
private static final ProcessMapper processMapper = SpringUtils.getBean(ProcessMapper.class);
|
||||
@ -68,12 +69,11 @@ public class WorkComplyUtils {
|
||||
* 任务创建
|
||||
* @param processVo
|
||||
*/
|
||||
public static void comply(ProcessVo processVo){
|
||||
public static void comply(ProcessVo processVo){
|
||||
ActProcess actProcessVo = new ActProcess();
|
||||
LambdaQueryWrapper<TProcess> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq( TProcess::getProcessKey, processVo.getProcessKey());
|
||||
lqw.eq(TProcess::getStep, processVo.getStep());
|
||||
|
||||
//判断这条业务是否在进行中
|
||||
LambdaQueryWrapper<ActProcess> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ActProcess::getBusinessId,processVo.getBusinessId());
|
||||
@ -89,18 +89,31 @@ public class WorkComplyUtils {
|
||||
actProcessVo.setStartUser(processVo.getStartUser());
|
||||
actProcessVo.setProcessId(tProcessByKey.getId().toString());
|
||||
actProcessVo.setBusinessId(processVo.getBusinessId());
|
||||
actProcessVo.setDescription(tProcessByKey.getDescription());
|
||||
actProcessVo.setIsNext(tProcessByKey.getIsNext());
|
||||
if ("1".equals(tProcessByKey.getType())){//普通流程,只需要将人员设置到运行流程中即可
|
||||
actProcessVo.setType(tProcessByKey.getType());
|
||||
if (1L==tProcessByKey.getProcessCheck()) {
|
||||
if("4".equals(tProcessByKey.getCheckType())){//企业审核
|
||||
String audit = processVo.getParams().get(tProcessByKey.getParam()).toString();
|
||||
actProcessVo.setAudit(audit);
|
||||
Object param = processVo.getParams().get(tProcessByKey.getParam());
|
||||
if (ObjectUtil.isNull(param)){
|
||||
throw new ServiceException("param不可为空");
|
||||
}
|
||||
actProcessVo.setAudit(param.toString());
|
||||
|
||||
Object paramName = processVo.getParams().get(tProcessByKey.getParamName());
|
||||
if (ObjectUtil.isNull(paramName)){
|
||||
throw new ServiceException("paramName不可为空");
|
||||
}
|
||||
actProcessVo.setCompanyName(paramName.toString());
|
||||
}else {
|
||||
actProcessVo.setAudit(tProcessByKey.getAudit());
|
||||
}
|
||||
}else if (2==tProcessByKey.getProcessCheck()){
|
||||
// 根据接口获取
|
||||
if (ObjectUtil.isNull(tProcessByKey.getRuleId())){
|
||||
throw new ServiceException("业务id不可为空");
|
||||
}
|
||||
List<String> personByRule = WorkUtils.getPersonByRule(tProcessByKey.getRuleId(),processVo.getParams());
|
||||
actProcessVo.setAudit(personByRule.get(0));
|
||||
}
|
||||
@ -119,7 +132,7 @@ public class WorkComplyUtils {
|
||||
}
|
||||
}else if (2L==tProcessByKey.getProcessCheck()){
|
||||
//根据接口获取
|
||||
ArrayList<String> personByRule = WorkUtils.getPersonByRule(tProcessByKey.getRuleId(),processVo.getParams());
|
||||
List<String> personByRule = WorkUtils.getPersonByRule(tProcessByKey.getRuleId(),processVo.getParams());
|
||||
//将某些固定的审核人员添加进去
|
||||
if (ObjectUtil.isNotEmpty(tProcessByKey.getAudit())){
|
||||
String[] split = tProcessByKey.getAudit().split(",");
|
||||
@ -128,7 +141,7 @@ public class WorkComplyUtils {
|
||||
for (String s : personByRule) {
|
||||
ActProcess actProcess = new ActProcess();
|
||||
BeanUtil.copyProperties(actProcessVo,actProcess);
|
||||
actProcessVo.setAudit(s);
|
||||
actProcess.setAudit(s);
|
||||
list.add(actProcess);
|
||||
}
|
||||
}
|
||||
@ -163,8 +176,12 @@ public class WorkComplyUtils {
|
||||
audit = loginUser.getDeptId().toString();
|
||||
}else if ("3".equals(checkType)){
|
||||
audit = loginUser.getRoleId().toString();
|
||||
}else if ("4".equals(checkType)){
|
||||
audit =String.valueOf(loginUser.getCompanyId());
|
||||
}else if ("4".equals(checkType)) {
|
||||
if (ObjectUtil.isNotNull(hisProcess.getCompanyId())) {
|
||||
audit = hisProcess.getCompanyId();
|
||||
} else {
|
||||
audit = String.valueOf(loginUser.getCompanyId());
|
||||
}
|
||||
}
|
||||
String finalAudit = audit;
|
||||
List<ActProcessVo> collect = actProcessVos.stream().filter(e -> checkType.equals(e.getCheckType()) && finalAudit.equals(e.getAudit())).collect(Collectors.toList());
|
||||
@ -177,8 +194,15 @@ public class WorkComplyUtils {
|
||||
hisProcess.setCreateTime(actProcessVo.getCreateTime());
|
||||
hisProcess.setStep(actProcessVo.getStep());
|
||||
hisProcess.setType(actProcessVo.getType());
|
||||
hisProcess.setDescription(actProcessVo.getDescription());
|
||||
hisProcess.setStartUser(actProcessVo.getStartUser());
|
||||
hisProcess.setIsNext(actProcessVo.getIsNext());
|
||||
//获取当前业务处理耗时
|
||||
Date date1 = hisProcess.getCreateTime();
|
||||
Date date2 = hisProcess.getEndTime();
|
||||
//精确到秒
|
||||
String formatBetween = DateUtil.formatBetween(date1, date2, BetweenFormatter.Level.SECOND);
|
||||
hisProcess.setTimeBetween(formatBetween);
|
||||
if ("1".equals(actProcessVo.getCheckType())) {//人员id
|
||||
Long userId = loginUser.getUserId();
|
||||
hisProcess.setAudit(ObjectUtil.isNotEmpty(userId) ? userId.toString() : "");
|
||||
@ -189,9 +213,9 @@ public class WorkComplyUtils {
|
||||
Long roleId = loginUser.getRoleId();
|
||||
hisProcess.setAudit(ObjectUtil.isNotEmpty(roleId) ? roleId.toString() : "");
|
||||
} else if ("4".equals(actProcessVo.getCheckType())) {//企业
|
||||
String userId = String.valueOf(hisProcess.getParams().get("companyId"));
|
||||
// String userId = String.valueOf(hisProcess.getParams().get("companyId"));
|
||||
hisProcess.setCompanyName(hisProcess.getParams().get("companyName").toString());
|
||||
hisProcess.setAudit(ObjectUtil.isNotEmpty(userId) ? userId : "");
|
||||
hisProcess.setAudit(actProcessVo.getAudit());
|
||||
}
|
||||
//先添加一个属于当前用户的记录
|
||||
hisProcessMapper.insert(hisProcess);
|
||||
@ -209,6 +233,9 @@ public class WorkComplyUtils {
|
||||
auditLogMapper.insert(auditLog);
|
||||
//如果成功就删除当前条0
|
||||
if ("1".equals(hisProcess.getStatus())) {//失败删除全部当前业务相关数据
|
||||
//新增系统消息
|
||||
//获取流程的名称
|
||||
TProcess tProcess = processMapper.selectById(actProcessVo.getProcessId());
|
||||
//删除当前业务的数据
|
||||
List<Long> collect1 = actProcessVos.stream().map(ActProcessVo::getId).collect(Collectors.toList());
|
||||
actProcessMapper.deleteBatchIds(collect1);
|
||||
@ -298,6 +325,7 @@ public class WorkComplyUtils {
|
||||
actProcess.setCompanyName(hisProcess.getCompanyName());
|
||||
actProcess.setCreateTime(hisProcess.getCreateTime());
|
||||
actProcess.setStep(hisProcess.getStep());
|
||||
actProcess.setDescription(hisProcess.getDescription());
|
||||
actProcess.setStartUser(hisProcess.getStartUser());
|
||||
actProcess.setBusinessId(hisProcess.getBusinessId());
|
||||
actProcess.setAudit(hisProcess.getAudit());
|
||||
@ -410,7 +438,11 @@ public class WorkComplyUtils {
|
||||
if ("4".equals(hisProcess.getCheckType())){
|
||||
hisProcess.setCompanyUserId(ObjectUtil.isNotNull(loginUser.getUserId())?loginUser.getUserId().toString():"");
|
||||
}
|
||||
Page<HisProcess> hisProcessPage = hisProcessMapper.selectVoListPage(pageQuery.build(), hisProcess);
|
||||
Page<HisProcess> hisProcessPage = new Page<>();
|
||||
hisProcessPage = hisProcessMapper.selectVoListPage(pageQuery.build(), hisProcess);
|
||||
if (hisProcessPage.getRecords().size()==0){
|
||||
hisProcessPage = hisProcessMapper.selectListPageByCC(pageQuery.build(),hisProcess);
|
||||
}
|
||||
List<HisProcess> records = hisProcessPage.getRecords();
|
||||
for (HisProcess record : records) {
|
||||
if("4".equals(record.getCheckType())){//企业审核
|
||||
@ -426,20 +458,6 @@ public class WorkComplyUtils {
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(new Long(record.getAudit()));
|
||||
record.setAudit(sysRole.getRoleName());
|
||||
}
|
||||
switch (record.getType()){
|
||||
case "1" :record.setType("基本类型");
|
||||
break;
|
||||
case "2" : record.setType("会签");
|
||||
break;
|
||||
default:record.setType("未知类型");
|
||||
break;
|
||||
}
|
||||
//获取当前业务处理耗时
|
||||
Date date1 = record.getCreateTime();
|
||||
Date date2 = record.getEndTime();
|
||||
//精确到秒
|
||||
String formatBetween = DateUtil.formatBetween(date1, date2, BetweenFormatter.Level.SECOND);
|
||||
record.setTimeBetween(formatBetween);
|
||||
}
|
||||
return TableDataInfo.build(hisProcessPage);
|
||||
}
|
||||
@ -464,12 +482,21 @@ public class WorkComplyUtils {
|
||||
}else if("1".equals(record.getCheckType())) {
|
||||
//根据id获取人员信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(new Long( record.getAudit()));
|
||||
if (ObjectUtil.isNull(sysUser)){
|
||||
throw new ServiceException("用户获取失败");
|
||||
}
|
||||
record.setAudit(sysUser.getUserName());
|
||||
}else if ("2".equals(record.getCheckType())){
|
||||
SysDept sysDept = sysDeptMapper.selectDeptById(new Long(record.getAudit()));
|
||||
if (ObjectUtil.isNull(sysDept)){
|
||||
throw new ServiceException("部门获取失败");
|
||||
}
|
||||
record.setAudit(sysDept.getDeptName());
|
||||
}else if ("3".equals(record.getCheckType())){
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(new Long(record.getAudit()));
|
||||
if (ObjectUtil.isNull(sysRole)){
|
||||
throw new ServiceException("角色获取失败");
|
||||
}
|
||||
record.setAudit(sysRole.getRoleName());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(record.getTimeout())&& ObjectUtil.isNotNull(record.getTimeout())){
|
||||
@ -584,20 +611,18 @@ public class WorkComplyUtils {
|
||||
if (ObjectUtil.isNull(processKey)){
|
||||
throw new ServiceException("processKey不可为空");
|
||||
}
|
||||
LambdaQueryWrapper<TProcess> wrapper = new LambdaQueryWrapper<TProcess>()
|
||||
.eq(TProcess::getProcessKey, params.get("processKey"))
|
||||
.orderByAsc(TProcess::getStep);
|
||||
List<ProcessVo> processVos = processMapper.selectVoList(wrapper);
|
||||
List<ProcessVo> list1 = new ArrayList<>();
|
||||
LambdaQueryWrapper<ActProcess> queryWrapper = new LambdaQueryWrapper<ActProcess>()
|
||||
.eq(ActProcess::getBusinessId, businessId);
|
||||
List<ActProcessVo> actProcessVoList = actProcessMapper.selectVoList(queryWrapper);
|
||||
|
||||
LambdaQueryWrapper<AuditLog> wrapperLog = new LambdaQueryWrapper<AuditLog>()
|
||||
List<ProcessVo> processVos = processMapper.selectVoList(new LambdaQueryWrapper<TProcess>()
|
||||
.eq(TProcess::getProcessKey, params.get("processKey"))
|
||||
.orderByAsc(TProcess::getStep));
|
||||
|
||||
List<ActProcessVo> actProcessVoList = actProcessMapper.selectVoList(new LambdaQueryWrapper<ActProcess>()
|
||||
.eq(ActProcess::getBusinessId, businessId));
|
||||
List<AuditLog> auditLogs = auditLogMapper.selectList(new LambdaQueryWrapper<AuditLog>()
|
||||
.eq(AuditLog::getProcessKey, processKey)
|
||||
.eq(AuditLog::getOtherId, businessId)
|
||||
.orderByAsc(AuditLog::getCreateTime);
|
||||
List<AuditLog> auditLogs = auditLogMapper.selectList(wrapperLog);
|
||||
.orderByAsc(AuditLog::getCreateTime));
|
||||
List<ProcessVo> list1 = new ArrayList<>();
|
||||
processVos.stream().forEach(e ->{
|
||||
e.setAuditLogList1(auditLogs);
|
||||
e.setActProcessVoList(actProcessVoList);
|
||||
@ -677,9 +702,41 @@ public class WorkComplyUtils {
|
||||
* @param e
|
||||
*/
|
||||
public static void dd(ProcessVo e){
|
||||
if("4".equals(e.getCheckType())){//企业审核
|
||||
Map params = e.getParams();
|
||||
if (ObjectUtil.isNull(e.getParamName())){
|
||||
throw new ServiceException("param_name不可为空");
|
||||
}
|
||||
String o = params.get(e.getParamName()).toString();
|
||||
e.setAudit1(params.get(e.getParam()).toString());
|
||||
e.setAudit(o);
|
||||
}else if("1".equals(e.getCheckType())) {
|
||||
//根据id获取人员信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(new Long( e.getAudit()));
|
||||
if(ObjectUtil.isNull(sysUser)){
|
||||
throw new ServiceException("根据id获取人员信息失败");
|
||||
}
|
||||
e.setAudit1(e.getAudit());
|
||||
e.setAudit(sysUser.getUserName());
|
||||
}else if ("2".equals(e.getCheckType())){
|
||||
SysDept sysDept = sysDeptMapper.selectDeptById(new Long(e.getAudit()));
|
||||
if(ObjectUtil.isNull(sysDept)){
|
||||
throw new ServiceException("根据id获取部门信息失败");
|
||||
}
|
||||
e.setAudit1(e.getAudit());
|
||||
e.setAudit(sysDept.getDeptName());
|
||||
}else if ("3".equals(e.getCheckType())){
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(new Long(e.getAudit()));
|
||||
if(ObjectUtil.isNull(sysRole)){
|
||||
throw new ServiceException("根据id获取角色信息失败");
|
||||
}
|
||||
e.setAudit1(e.getAudit());
|
||||
e.setAudit(sysRole.getRoleName());
|
||||
}
|
||||
|
||||
List<ActProcessVo> actProcessVoList =e.getActProcessVoList();
|
||||
List<AuditLog> auditLogs = e.getAuditLogList1();
|
||||
List<ActProcessVo> collect1 = actProcessVoList.stream().filter(a -> a.getAudit().equals(e.getAudit()) && a.getCheckType().equals(e.getCheckType()) && a.getStep().equals(e.getStep()) && a.getType().equals(e.getType())).collect(Collectors.toList());
|
||||
List<ActProcessVo> collect1 = actProcessVoList.stream().filter(a -> a.getAudit().equals(e.getAudit1()) && a.getCheckType().equals(e.getCheckType()) && a.getStep().equals(e.getStep()) && a.getType().equals(e.getType())).collect(Collectors.toList());
|
||||
if (actProcessVoList.size()>0){
|
||||
actProcessVoList.stream().forEach(a ->{
|
||||
if ( new Integer(e.getStep())< new Integer(a.getStep())){
|
||||
@ -703,7 +760,7 @@ public class WorkComplyUtils {
|
||||
}else if (Constants.FAILD.equals(process_status.toString())){
|
||||
if (auditLogs.size()>0){
|
||||
AuditLog auditLog = auditLogs.get(auditLogs.size()-1);
|
||||
if (auditLog.getAudit().equals(e.getAudit()) && auditLog.getStep().equals(e.getStep()) && auditLog.getAuditType().equals(e.getCheckType())){
|
||||
if (auditLog.getAudit().equals(e.getAudit1()) && auditLog.getStep().equals(e.getStep()) && auditLog.getAuditType().equals(e.getCheckType())){
|
||||
e.setChecked("2");
|
||||
}
|
||||
}
|
||||
@ -719,9 +776,9 @@ public class WorkComplyUtils {
|
||||
if (ObjectUtil.isNull(companyId)){
|
||||
throw new ServiceException("companyId不可为空");
|
||||
}
|
||||
e.setAudit(String.valueOf(e.getParams().get("companyId")));
|
||||
// e.setAudit1(String.valueOf(e.getParams().get("companyId")));
|
||||
}
|
||||
List<AuditLog> collect = auditLogs.stream().filter(a -> e.getStep().equals(a.getStep()) && e.getAudit().equals(a.getAudit())).collect(Collectors.toList());
|
||||
List<AuditLog> collect = auditLogs.stream().filter(a -> e.getStep().equals(a.getStep()) && e.getAudit1().equals(a.getAudit())).collect(Collectors.toList());
|
||||
collect.stream().forEach(a -> {
|
||||
if (ObjectUtil.isNotNull(a.getStatus())) {
|
||||
switch (a.getStatus()) {
|
||||
@ -741,33 +798,6 @@ public class WorkComplyUtils {
|
||||
}else {
|
||||
e.setAuditLogList(new ArrayList<>());
|
||||
}
|
||||
if("4".equals(e.getCheckType())){//企业审核
|
||||
Map params = e.getParams();
|
||||
if (ObjectUtil.isNull(e.getParamName())){
|
||||
throw new ServiceException("param_name不可为空");
|
||||
}
|
||||
String o = params.get(e.getParamName()).toString();
|
||||
e.setAudit(o);
|
||||
}else if("1".equals(e.getCheckType())) {
|
||||
//根据id获取人员信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(new Long( e.getAudit()));
|
||||
if(ObjectUtil.isNull(sysUser)){
|
||||
throw new ServiceException("根据id获取人员信息失败");
|
||||
}
|
||||
e.setAudit(sysUser.getUserName());
|
||||
}else if ("2".equals(e.getCheckType())){
|
||||
SysDept sysDept = sysDeptMapper.selectDeptById(new Long(e.getAudit()));
|
||||
if(ObjectUtil.isNull(sysDept)){
|
||||
throw new ServiceException("根据id获取部门信息失败");
|
||||
}
|
||||
e.setAudit(sysDept.getDeptName());
|
||||
}else if ("3".equals(e.getCheckType())){
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(new Long(e.getAudit()));
|
||||
if(ObjectUtil.isNull(sysRole)){
|
||||
throw new ServiceException("根据id获取角色信息失败");
|
||||
}
|
||||
e.setAudit(sysRole.getRoleName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,16 +1,22 @@
|
||||
package com.ruoyi.work.utils;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.JsonUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.work.domain.ActBusinessRuleVo;
|
||||
import com.ruoyi.work.domain.ActBusinessRuleParam;
|
||||
import com.ruoyi.work.domain.vo.ActBusinessRuleVo;
|
||||
import com.ruoyi.work.mapper.ActBusinessRuleMapper;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.text.CaseUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class WorkUtils {
|
||||
@ -19,56 +25,76 @@ public class WorkUtils {
|
||||
/**
|
||||
* 根据bean获取审核人员
|
||||
*/
|
||||
public static ArrayList<String> getPersonByRule(Long id, Map paramMap){
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
public static List<String> getPersonByRule(Long id, Map<String,Object> variables){
|
||||
//获取业务规则信息
|
||||
ActBusinessRuleVo actBusinessRuleVo = actBusinessRuleMapper.selectVoById(id);
|
||||
String param =paramMap.get(actBusinessRuleVo.getParam()).toString();
|
||||
//方法名
|
||||
String methodName = actBusinessRuleVo.getMethod();
|
||||
//类名
|
||||
Object beanName = SpringUtils.getBean(actBusinessRuleVo.getBeanName());
|
||||
//值
|
||||
Class aClass;
|
||||
Object params="";
|
||||
switch (actBusinessRuleVo.getParamType()){
|
||||
case "String":
|
||||
aClass= String.valueOf(param).getClass();
|
||||
//将数值转类型
|
||||
params = String.valueOf(param);
|
||||
break;
|
||||
case "Integer":
|
||||
aClass= Integer.valueOf(param).getClass();
|
||||
//将数值转类型
|
||||
params = Integer.valueOf(param);
|
||||
break;
|
||||
case "Long":
|
||||
aClass= Long.valueOf(param).getClass();
|
||||
//将数值转类型
|
||||
params = Long.valueOf(param);
|
||||
break;
|
||||
case "Float":
|
||||
aClass= Float.valueOf(param).getClass();
|
||||
//将数值转类型
|
||||
params = Float.valueOf(param);
|
||||
break;
|
||||
case "Double":
|
||||
aClass= Double.valueOf(param).getClass();
|
||||
//将数值转类型
|
||||
params = Double.valueOf(param);
|
||||
break;
|
||||
default:
|
||||
aClass=String.valueOf(param).getClass();
|
||||
break;
|
||||
|
||||
ActBusinessRuleVo businessRule = actBusinessRuleMapper.selectVoById(id);
|
||||
try {
|
||||
//返回值
|
||||
Object obj;
|
||||
//方法名称
|
||||
String methodName = businessRule.getMethod();
|
||||
//全类名
|
||||
Object beanName = SpringUtils.getBean(businessRule.getBeanName());
|
||||
if (StringUtils.isNotBlank(businessRule.getParam())) {
|
||||
List<ActBusinessRuleParam> businessRuleParams = JsonUtils.parseArray(businessRule.getParam(), ActBusinessRuleParam.class);
|
||||
Class[] paramClass = new Class[businessRuleParams.size()];
|
||||
List<Object> params = new ArrayList<>();
|
||||
for (int i = 0; i < businessRuleParams.size(); i++) {
|
||||
if (variables.containsKey(businessRuleParams.get(i).getParam())) {
|
||||
String variable = (String) variables.get(businessRuleParams.get(i).getParam());
|
||||
switch (businessRuleParams.get(i).getParamType()) {
|
||||
case "String":
|
||||
paramClass[i] = String.valueOf(variable).getClass();
|
||||
params.add(String.valueOf(variable));
|
||||
break;
|
||||
case "Short":
|
||||
paramClass[i] = Short.valueOf(variable).getClass();
|
||||
params.add(Short.valueOf(variable));
|
||||
break;
|
||||
case "Integer":
|
||||
paramClass[i] = Integer.valueOf(variable).getClass();
|
||||
params.add(Integer.valueOf(variable));
|
||||
break;
|
||||
case "Long":
|
||||
paramClass[i] = Long.valueOf(variable).getClass();
|
||||
params.add(Long.valueOf(variable));
|
||||
break;
|
||||
case "Float":
|
||||
paramClass[i] = Float.valueOf(variable).getClass();
|
||||
params.add(Float.valueOf(variable));
|
||||
break;
|
||||
case "Double":
|
||||
paramClass[i] = Double.valueOf(variable).getClass();
|
||||
params.add(Double.valueOf(variable));
|
||||
break;
|
||||
case "Boolean":
|
||||
paramClass[i] = Boolean.valueOf(variable).getClass();
|
||||
params.add(Boolean.valueOf(variable));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(paramClass) && CollectionUtil.isNotEmpty(businessRuleParams)) {
|
||||
String variableParams = businessRuleParams.stream().map(ActBusinessRuleParam::getParam).collect(Collectors.joining(","));
|
||||
throw new ServiceException("【" + variableParams + "】流程变量不存在");
|
||||
}
|
||||
Method method = ReflectionUtils.findMethod(beanName.getClass(), methodName, paramClass);
|
||||
assert method != null;
|
||||
obj = ReflectionUtils.invokeMethod(method, beanName, params.toArray());
|
||||
} else {
|
||||
Method method = ReflectionUtils.findMethod(beanName.getClass(), methodName);
|
||||
assert method != null;
|
||||
obj = ReflectionUtils.invokeMethod(method, beanName);
|
||||
}
|
||||
if (obj == null) {
|
||||
throw new ServiceException("任务环节未配置审批人,请确认传值是否正确,检查:【" + businessRule.getBeanName() + "】Bean容器中【" + methodName + "】方法");
|
||||
}
|
||||
return Arrays.asList(obj.toString().split(","));
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
//调用方法
|
||||
Method method = ReflectionUtils.findMethod(beanName.getClass(), methodName, aClass);
|
||||
Object obj = ReflectionUtils.invokeMethod(method, beanName,params);
|
||||
System.out.println("obj = " + obj.toString());
|
||||
String[] split = obj.toString().split(",");
|
||||
Collections.addAll(list,split);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
<result property="bean" column="bean"/>
|
||||
<result property="timeout" column="timeout"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="description" column="description"/>
|
||||
</resultMap>
|
||||
<select id="selectVoListPage" resultType="com.ruoyi.work.domain.ActProcess" parameterType="com.ruoyi.work.domain.ActProcess">
|
||||
SELECT a.create_time AS createTime,a.business_id AS businessId,a.audit, a.step ,a.start_user AS startUser,a.id,p.process_key AS processKey,
|
||||
|
||||
@ -19,13 +19,15 @@
|
||||
<result property="companyName" column="companyName"/>
|
||||
<result property="isNext" column="is_next"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="timeBetween" column="time_between"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectVoListPage" resultType="com.ruoyi.work.domain.HisProcess" parameterType="com.ruoyi.work.domain.HisProcess">
|
||||
SELECT p.`name` ,process_key AS processKey,d.audit,d.check_type AS checkType ,d.type,p.bean,d.`status`,d.create_time AS createTime,d.end_time AS endTime ,
|
||||
d.business_id AS businessId,d.start_user AS startUser,p.cc,p.description,d.step
|
||||
d.business_id AS businessId,d.start_user AS startUser,p.cc,p.description,d.step,d.time_between
|
||||
FROM
|
||||
(SELECT process_id,h.create_time,business_id,h.audit,h.check_type,h.`status`,end_time,h.step,h.type,h.start_user
|
||||
(SELECT process_id,h.create_time,business_id,h.audit,h.check_type,h.`status`,end_time,h.step,h.type,h.start_user,h.time_between
|
||||
FROM
|
||||
`his_process` h
|
||||
WHERE h.id IN (SELECT MAX(id) FROM his_process
|
||||
@ -52,6 +54,19 @@
|
||||
INNER JOIN process p ON p.id = h.process_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
<select id="selectListPageByCC" resultType="com.ruoyi.work.domain.HisProcess">
|
||||
SELECT p.`name` ,process_key AS processKey,d.audit,d.check_type AS checkType ,d.type,p.bean,d.`status`,d.create_time AS createTime,d.end_time AS endTime,d.business_id AS businessId,d.start_user AS startUser,p.cc,p.description,d.step,d.time_between
|
||||
FROM
|
||||
(SELECT process_id,h.create_time,business_id,h.audit,h.check_type,h.`status`,end_time,h.step,h.type,h.start_user,h.time_between
|
||||
FROM
|
||||
`his_process` h
|
||||
WHERE h.id IN (SELECT MAX(id) FROM his_process GROUP BY business_id) ) d
|
||||
INNER JOIN process p ON p.id = d.process_id
|
||||
<where>
|
||||
FIND_IN_SET(#{hisProcess.userId},p.cc)
|
||||
<if test="hisProcess.startUser !='' and hisProcess.startUser !=null"> and d.start_user like concat('%', #{hisProcess.startUser}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
</resultMap>
|
||||
<update id="updateCommonByBusinessId">
|
||||
update ${bean} set process_status = #{processStatus} where id = #{businessId}
|
||||
update ${bean} set process_status = #{processStatus} ,pass_time =now() where id = #{businessId}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user