Commit faa790fc by HlQ

[fix] 升级 JDK17 和 SpringBoot 3 兼容性调整

1 parent 3676db0f
Showing 52 changed files with 425 additions and 348 deletions
......@@ -8,7 +8,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.17</version>
<version>3.2.3</version>
</parent>
<artifactId>Vion-DevOps</artifactId>
......@@ -17,7 +17,7 @@
<pg.version>42.7.0</pg.version>
<sqlserver.version>12.2.0.jre8</sqlserver.version>
<lombok.version>1.18.30</lombok.version>
<hutool.version>5.8.25</hutool.version>
<hutool.version>6.0.0-M11</hutool.version>
<mapstruct-plus.version>1.3.5</mapstruct-plus.version>
<mp.version>3.5.5</mp.version>
<mp-join.version>1.4.7.2</mp-join.version>
......@@ -57,7 +57,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<groupId>org.dromara.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
......@@ -68,7 +68,7 @@
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>${mp.version}</version>
</dependency>
<dependency>
......@@ -87,7 +87,7 @@
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId>
<artifactId>sa-token-spring-boot3-starter</artifactId>
<version>${sa-token.verion}</version>
</dependency>
<dependency>
......
package vion.advice;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.servlet.ServletUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
......@@ -14,14 +10,16 @@ import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.http.server.servlet.JakartaServletUtil;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletRequest;
/**
* @author HlQ
* @date 2024/1/17
......@@ -41,15 +39,15 @@ public class LogAspect {
@Before("logPointcut()")
public void doBefore(JoinPoint joinPoint) throws JsonProcessingException {
// 登录等接口,无需登录可访问,根据 token 获取当前用户会抛未登录的异常,需捕获进行处理
String username = Opt.ofTry(() -> (UserVO) StpUtil.getTokenSession().get("curLoginUser"))
var username = Opt.ofTry(() -> (UserVO) StpUtil.getTokenSession().get("curLoginUser"))
.map(UserVO::getUsername)
.orElse("未知");
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
var attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (ObjUtil.isNull(attributes)) {
return;
}
HttpServletRequest request = attributes.getRequest();
var request = attributes.getRequest();
request.setAttribute("startTime", System.currentTimeMillis());
......@@ -57,25 +55,25 @@ public class LogAspect {
log.info("Request URL:{}, Method:{}, IP:{}, Operator:{}, Args:{}, Body:{}",
request.getRequestURI(),
request.getMethod(),
ServletUtil.getClientIP(request),
JakartaServletUtil.getClientIP(request),
username,
objectMapper.writeValueAsString(request.getParameterMap()),
StrUtil.replaceChars(ServletUtil.getBody(request), " \r\n", "")
StrUtil.replaceChars(JakartaServletUtil.getBody(request), " \r\n", "")
);
}
@AfterReturning(pointcut = "logPointcut()", returning = "result")
public void doAfterReturning(JoinPoint joinPoint, Object result) throws JsonProcessingException {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
var attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (ObjUtil.isNull(attributes)) {
return;
}
HttpServletRequest request = attributes.getRequest();
var request = attributes.getRequest();
long startTime = (Long) request.getAttribute("startTime");
long responseTime = System.currentTimeMillis() - startTime;
var startTime = (Long) request.getAttribute("startTime");
var responseTime = System.currentTimeMillis() - startTime;
String resStr = objectMapper.writeValueAsString(result);
var resStr = objectMapper.writeValueAsString(result);
if (resStr.length() > 1000) {
resStr = resStr.substring(0, 1000);
}
......
......@@ -38,7 +38,7 @@ public class ResBodyAdvice implements ResponseBodyAdvice<Object> {
return body;
}
ResultVO resultVO = ResultUtil.success(body);
var resultVO = ResultUtil.success(body);
if (returnType.getParameterType().isAssignableFrom(String.class)) {
// 字符串类型特殊处理
try {
......
......@@ -27,14 +27,14 @@ public class RedisConfig {
template.setConnectionFactory(factory);
//序列化配置
//jackson的序列化
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.activateDefaultTyping(om.getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_FINAL);
// Date序列化 yyyy-MM-dd HH:mm:ss/yyyy-MM-dd hh:mm:ss:SSS
om.setDateFormat(new SimpleDateFormat("yyyy-MM-dd hh:mm:ss:SSS"));
om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
jackson2JsonRedisSerializer.setObjectMapper(om);
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(om, Object.class);
//String 的序列化
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
//key采用String的序列化方式
......
package vion.config;
import cn.hutool.core.io.IoUtil;
import jakarta.servlet.http.HttpServletRequestWrapper;
import org.dromara.hutool.core.io.IoUtil;
import jakarta.servlet.ReadListener;
import jakarta.servlet.ServletInputStream;
import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.*;
/**
......@@ -51,7 +52,6 @@ public class RequestWrapper extends HttpServletRequestWrapper {
@Override
public void setReadListener(ReadListener listener) {
}
@Override
......
package vion.config;
import cn.hutool.core.lang.Opt;
import org.dromara.hutool.core.lang.Opt;
import com.github.liaochong.myexcel.core.converter.CustomWriteContext;
import com.github.liaochong.myexcel.core.converter.CustomWriteConverter;
import lombok.RequiredArgsConstructor;
......
package vion.constant;
import cn.hutool.core.util.StrUtil;
import org.dromara.hutool.core.text.StrUtil;
import lombok.Getter;
import java.util.Arrays;
......
......@@ -2,18 +2,18 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.liaochong.myexcel.core.DefaultExcelBuilder;
import com.github.liaochong.myexcel.core.watermark.Watermark;
import com.github.liaochong.myexcel.utils.AttachmentExportUtil;
import com.github.liaochong.myexcel.utils.WatermarkUtil;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.usermodel.Workbook;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.json.JSONObject;
import org.springframework.web.bind.annotation.*;
import vion.cron.ContractRunner;
import vion.dto.ContractDTO;
......@@ -23,10 +23,10 @@ import vion.model.RContractStore;
import vion.model.RContractUser;
import vion.service.IContractService;
import vion.service.IRContractStoreService;
import vion.utils.excel.AttachmentExportUtil;
import vion.vo.ContractVO;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;
import java.util.Date;
......
package vion.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.crypto.SecureUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -47,19 +48,16 @@ public class FileController {
@DeleteMapping("/file/{id}")
public String remove(@PathVariable(name = "id") Integer id) {
FileInfo file = fileService.getById(id);
if (FileUtil.del(file.getUrl())) {
fileService.removeById(id);
return "文件删除成功";
} else {
return "文件删除失败";
}
FileUtil.del(file.getUrl());
fileService.removeById(id);
return "文件删除成功";
}
@PostMapping("/file/formFileUpload")
public String uploadFile(FileInfo fileInfo, @RequestParam(name = "file") MultipartFile infile) throws IOException {
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = getPath(fileInfo, filename);
File file = FileUtil.touch(path);
......@@ -70,7 +68,7 @@ public class FileController {
tempFileInfo.setSourceType(fileInfo.getSourceType());
tempFileInfo.setName(filename);
tempFileInfo.setUrl(path);
tempFileInfo.setType(FileUtil.extName(file));
tempFileInfo.setType(FileNameUtil.extName(file));
tempFileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
tempFileInfo.setUploader(fileInfo.getUploader());
......@@ -96,8 +94,8 @@ public class FileController {
public String uploadFile1(FileInfo fileInfo, @RequestParam(name = "files") MultipartFile[] files) throws IOException {
for (MultipartFile infile : files) {
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + fileInfo.getStoreId() + FileUtil.FILE_SEPARATOR + fileInfo.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
......@@ -109,7 +107,7 @@ public class FileController {
tempFileInfo.setSourceType(fileInfo.getSourceType());
tempFileInfo.setName(filename);
tempFileInfo.setUrl(path);
tempFileInfo.setType(FileUtil.extName(file));
tempFileInfo.setType(FileNameUtil.extName(file));
tempFileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
tempFileInfo.setUploader(fileInfo.getUploader());
......
......@@ -2,23 +2,23 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.liaochong.myexcel.core.DefaultExcelBuilder;
import com.github.liaochong.myexcel.core.watermark.Watermark;
import com.github.liaochong.myexcel.utils.AttachmentExportUtil;
import com.github.liaochong.myexcel.utils.WatermarkUtil;
import io.github.linpeilie.Converter;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.usermodel.Workbook;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.springframework.web.bind.annotation.*;
import vion.dto.InvoiceDTO;
import vion.service.IInvoiceService;
import vion.utils.excel.AttachmentExportUtil;
import vion.vo.InvoiceVO;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;
import java.util.Date;
......
......@@ -2,12 +2,12 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.text.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.liaochong.myexcel.core.DefaultExcelBuilder;
import com.github.liaochong.myexcel.core.watermark.Watermark;
import com.github.liaochong.myexcel.utils.AttachmentExportUtil;
import vion.utils.excel.AttachmentExportUtil;
import com.github.liaochong.myexcel.utils.WatermarkUtil;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
......@@ -18,7 +18,7 @@ import vion.service.IPaymentService;
import vion.vo.PaymentVO;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;
import java.util.Date;
......
......@@ -2,12 +2,12 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.text.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.liaochong.myexcel.core.DefaultExcelBuilder;
import com.github.liaochong.myexcel.core.watermark.Watermark;
import com.github.liaochong.myexcel.utils.AttachmentExportUtil;
import vion.utils.excel.AttachmentExportUtil;
import com.github.liaochong.myexcel.utils.WatermarkUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -20,7 +20,7 @@ import vion.third.WechatMod;
import vion.vo.PointInfoVO;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;
import java.util.Date;
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.Opt;
import org.dromara.hutool.core.lang.Opt;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.Opt;
import org.dromara.hutool.core.lang.Opt;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ArrayUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.array.ArrayUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.dto.RepairRecDTO;
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.tree.MapTree;
import org.springframework.web.bind.annotation.*;
import vion.dto.ResourceDTO;
import vion.dto.RoleDTO;
......@@ -33,7 +33,7 @@ public class ResourceController {
@GetMapping("/resource/tree")
@SaCheckPermission(value = "resource:tree", orRole = "admin")
public List<Tree<Long>> listTree(Long id) {
public List<MapTree<Long>> listTree(Long id) {
return resourceService.listTree(id);
}
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.StrUtil;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.text.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
......
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.data.id.IdUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
......
......@@ -2,14 +2,14 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import org.dromara.hutool.core.bean.BeanUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.text.StrUtil;
import com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder;
import com.github.liaochong.myexcel.core.watermark.Watermark;
import com.github.liaochong.myexcel.utils.AttachmentExportUtil;
import vion.utils.excel.AttachmentExportUtil;
import com.github.liaochong.myexcel.utils.WatermarkUtil;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
......@@ -20,7 +20,7 @@ import vion.service.ISparePartService;
import vion.vo.SparePartVO;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;
import java.util.ArrayList;
......
......@@ -2,16 +2,16 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.springframework.web.bind.annotation.*;
import vion.dto.StatusDTO;
import vion.dto.StoreDTO;
......
......@@ -2,12 +2,12 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.text.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.liaochong.myexcel.core.DefaultExcelBuilder;
import com.github.liaochong.myexcel.core.watermark.Watermark;
import com.github.liaochong.myexcel.utils.AttachmentExportUtil;
import vion.utils.excel.AttachmentExportUtil;
import com.github.liaochong.myexcel.utils.WatermarkUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -22,7 +22,7 @@ import vion.service.ITaskService;
import vion.vo.TaskVO;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;
import java.util.Date;
......
......@@ -2,18 +2,19 @@ package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.net.url.UrlEncoder;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.tree.MapTree;
import org.springframework.web.bind.annotation.*;
import vion.dto.DingDTO;
import vion.dto.UserDTO;
......@@ -28,7 +29,6 @@ import vion.third.WechatMod;
import vion.vo.RoleVO;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
......@@ -80,7 +80,7 @@ public class UserController {
@GetMapping("/orgTree")
@SaCheckPermission(value = "user:orgTree", orRole = "admin")
public List<Tree<String>> getOrgTree(String deptId) {
public List<MapTree<String>> getOrgTree(String deptId) {
return userService.getOrgTree(deptId);
}
......@@ -120,7 +120,7 @@ public class UserController {
Object obj = wechatMod.getOpenid(code);
if (obj instanceof Map) {
Map<String, String> map = (Map<String, String>) obj;
res.sendRedirect(StrUtil.format("https://yunwei.vionyun.com/wap?openid={}&nickname={}&active={}", map.get("openid"), URLUtil.encode(map.get("nickname")), active));
res.sendRedirect(StrUtil.format("https://yunwei.vionyun.com/wap?openid={}&nickname={}&active={}", map.get("openid"), UrlEncoder.encodeAll(map.get("nickname")), active));
} else {
return obj;
}
......
package vion.cron;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.text.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
......@@ -13,14 +13,12 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import vion.constant.RedisKeyEnum;
import vion.model.*;
import vion.model.Dictionary;
import vion.service.*;
import java.math.BigDecimal;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -63,7 +61,8 @@ public class ContractRunner {
while (resultSet.next()) {
String contractNo = resultSet.getString("contract_no");
Contract contract = new Contract();
Opt.ofBlankAble(resultSet.getString("name"))
Optional.ofNullable(resultSet.getString("name"))
.filter(StrUtil::isNotBlank)
.ifPresentOrElse(contract::setName, () -> contract.setName(contractNo));
contract.setContractNo(contractNo);
......
package vion.cron;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.json.JSONArray;
import org.dromara.hutool.json.JSONObject;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import vion.model.Task;
......@@ -15,7 +15,6 @@ import vion.service.ITaskService;
import vion.service.IUserService;
import vion.third.DingMod;
import java.util.List;
import java.util.stream.Collectors;
/**
......@@ -34,30 +33,30 @@ public class TaskRunner {
@Scheduled(cron = "0 0 17 * * ?")
void pushUndoneTask() {
log.info("开始推送未完成工单");
List<Task> taskList = taskService.list(Wrappers.<Task>lambdaQuery().notIn(Task::getStatus, 3, 5));
var taskList = taskService.list(Wrappers.<Task>lambdaQuery().notIn(Task::getStatus, 3, 5));
// todo 需要异步发送吗?
Opt.ofEmptyAble(taskList)
.map(l -> l.stream().map(Task::getActiveUser).collect(Collectors.toSet()))
.ifPresent(userIds -> {
List<User> userList = userService.list(Wrappers.<User>lambdaQuery().in(User::getId, userIds));
var userList = userService.list(Wrappers.<User>lambdaQuery().in(User::getId, userIds));
userList.forEach(user -> dingMod.workMsg(buildMsg(user)));
});
log.info("推送未完成工单完成");
}
JSONObject buildMsg(User user) {
JSONObject jsonObj = new JSONObject();
var jsonObj = new JSONObject();
jsonObj.set("agent_id", 2358374016L);
jsonObj.set("userid_list", user.getUserid());
JSONObject msg = new JSONObject();
JSONObject content = new JSONObject();
var msg = new JSONObject();
var content = new JSONObject();
content.set("title", "请查看您未完成的工单~_~");
content.set("markdown", "#### 请查看您未完成的工单" +
" \n #### 发送时间:" + DateUtil.now());
content.set("btn_orientation", "1");
JSONArray jsonArray = new JSONArray();
var jsonArray = new JSONArray();
jsonArray.add(new JSONObject().set("title", "查看详情").set("action_url", "https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingkrzwks0jpi2di3uo&response_type=code&scope=snsapi_auth&state=STATE&redirect_uri=https%3A%2F%2Fyunwei.vionyun.com%3A8443%2Fyunwei%2Fapi%2Fding%2Fcallback%2Finside%3FuserId%3D" + user.getId()));
content.set("btn_json_list", jsonArray);
......
package vion.interceptor;
import cn.hutool.core.util.IdUtil;
import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest;
import org.dromara.hutool.core.data.id.IdUtil;
import org.springframework.stereotype.Component;
import vion.config.RequestWrapper;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@Component
......
......@@ -2,8 +2,8 @@ package vion.interceptor;
import cn.dev33.satoken.stp.StpInterface;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Opt;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.lang.Opt;
import org.springframework.stereotype.Component;
import vion.model.Resource;
import vion.vo.RoleVO;
......
package vion.service;
import cn.hutool.json.JSONObject;
import org.dromara.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseService;
import org.springframework.web.bind.annotation.PathVariable;
......
package vion.service;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseService;
import org.dromara.hutool.core.tree.MapTree;
import vion.dto.ResourceDTO;
import vion.model.Resource;
import vion.vo.ResourceVO;
......@@ -17,5 +17,5 @@ public interface IResourceService extends MPJBaseService<Resource>{
Page<ResourceVO> list(ResourceDTO dto);
List<Tree<Long>> listTree(Long id);
List<MapTree<Long>> listTree(Long id);
}
package vion.service;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseService;
import org.dromara.hutool.core.tree.MapTree;
import vion.dto.UserDTO;
import vion.model.User;
import vion.vo.UserVO;
......@@ -13,6 +13,6 @@ public interface IUserService extends MPJBaseService<User> {
Page<UserVO> getUserList(UserDTO dto);
List<Tree<String>> getOrgTree(String deptId);
List<MapTree<String>> getOrgTree(String deptId);
}
package vion.service.impl;
import cn.hutool.core.util.StrUtil;
import org.dromara.hutool.core.text.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
......
package vion.service.impl;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.math.NumberUtil;
import org.dromara.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl;
import lombok.RequiredArgsConstructor;
......
package vion.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.*;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.PageUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -22,6 +11,23 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.bean.BeanUtil;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.collection.set.SetUtil;
import org.dromara.hutool.core.date.DateUnit;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.crypto.SecureUtil;
import org.dromara.hutool.json.JSONObject;
import org.dromara.hutool.json.JSONUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -147,7 +153,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
UserVO userVO = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
Set<String> roleCodeList = Opt.ofEmptyAble(userVO.getRoleVOList())
.map(l -> l.stream().map(RoleVO::getCode).collect(Collectors.toSet()))
.orElse(CollUtil.newHashSet());
.orElse(SetUtil.zero());
MPJLambdaWrapper<Contract> wrapper = new MPJLambdaWrapper<Contract>()
.selectAll(Contract.class)
.selectCollection(ContractLog.class, ContractVO::getContractLogs)
......@@ -246,8 +252,8 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
Arrays.stream(fileList).forEach(infile -> {
//上传url地址
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + "contract" + FileUtil.FILE_SEPARATOR + contract.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
......@@ -279,7 +285,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
public JSONObject calAmount(ContractDTO dto) {
Result result = getResult(dto);
JSONObject obj = JSONUtil.createObj()
JSONObject obj = JSONUtil.ofObj()
.set("totalAmount", 0)
.set("paidAmount", 0)
.set("recAmount", 0)
......@@ -423,7 +429,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
UserVO userVO = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
Set<String> roleCodeList = Opt.ofEmptyAble(userVO.getRoleVOList())
.map(l -> l.stream().map(RoleVO::getCode).collect(Collectors.toSet()))
.orElse(CollUtil.newHashSet());
.orElse(SetUtil.zero());
Assert.notEmpty(roleCodeList, "当前用户角色不详,请联系管理员");
String curName = "";
boolean isPerm = !roleCodeList.contains("admin") && !roleCodeList.contains("shangwu") && !roleCodeList.contains("caiwu");
......@@ -452,8 +458,8 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.map(name -> this.listObjs(Wrappers.<Contract>lambdaQuery()
.select(Contract::getId).eq(Contract::getSaleName, name), o -> Long.valueOf(o.toString())))
.orElse(new ArrayList<>());
Collection<Long> queryContractUserIdList = CollUtil.addAllIfNotContains(contractUserIdList1, contractUserIdList2);
Collection<Long> curContractUserIdList = CollUtil.addAllIfNotContains(contractUserIdList3, contractUserIdList4);
Collection<Long> queryContractUserIdList = ListUtil.addAllIfNotContains(contractUserIdList1, contractUserIdList2);
Collection<Long> curContractUserIdList = ListUtil.addAllIfNotContains(contractUserIdList3, contractUserIdList4);
Set<Long> allContractUserIdList;
if (StrUtil.isNotBlank(curName) && StrUtil.isNotBlank(dto.getSaleName())) {
// 当前用户和查询条件的销售人都存在,取交集
......
package vion.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.crypto.SecureUtil;
import org.dromara.hutool.json.JSONArray;
import org.dromara.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
......@@ -183,8 +184,8 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
Arrays.stream(fileList).forEach(infile -> {
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + "delivery" + FileUtil.FILE_SEPARATOR + deliveryRecord.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
......@@ -201,7 +202,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
fileInfo.setSourceType(6);
fileInfo.setName(filename);
fileInfo.setUrl(path);
fileInfo.setType(FileUtil.extName(file));
fileInfo.setType(FileNameUtil.extName(file));
fileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
fileInfo.setUploader(userVO.getUsername());
fileService.save(fileInfo);
......
package vion.service.impl;
import cn.hutool.core.lang.Opt;
import org.dromara.hutool.core.lang.Opt;
import com.github.yulichang.base.MPJBaseServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.RedisTemplate;
......
package vion.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import org.dromara.hutool.core.data.id.IdUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
......@@ -44,7 +44,7 @@ public class FormServiceImpl extends MPJBaseServiceImpl<FormMapper, Form> implem
Form form = converter.convert(dto, Form.class);
String nanoId = IdUtil.nanoId();
form.setUuid(nanoId);
return this.save(form) ? JSONUtil.createObj().set("id", form.getId()).set("uuid", nanoId) : "创建失败";
return this.save(form) ? JSONUtil.ofObj().set("id", form.getId()).set("uuid", nanoId) : "创建失败";
}
@Override
......
package vion.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Opt;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.lang.Opt;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
......
package vion.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.math.NumberUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vion.dto.InvoiceDTO;
......
package vion.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
......
package vion.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONObject;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.data.id.IdUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.crypto.SecureUtil;
import org.dromara.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -146,7 +147,7 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po
fileInfo.setSourceType(18);
fileInfo.setName(templateName);
fileInfo.setUrl(tarPath);
fileInfo.setType(FileUtil.extName(tarFile));
fileInfo.setType(FileNameUtil.extName(tarFile));
fileInfo.setSha256(SecureUtil.sha256(tarFile).toUpperCase());
fileInfo.setUploader("合同模板,系统生成");
fileService.save(fileInfo);
......@@ -211,8 +212,8 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po
private void saveFile(Long id, MultipartFile infile, PointInfoDTO dto) {
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = getPath(id, dto, filename);
File file = FileUtil.touch(path);
......@@ -229,7 +230,7 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po
fileInfo.setSourceType(dto.getSourceType());
fileInfo.setName(filename);
fileInfo.setUrl(path);
fileInfo.setType(FileUtil.extName(file));
fileInfo.setType(FileNameUtil.extName(file));
fileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
if (StrUtil.isNotBlank(dto.getContact())) {
fileInfo.setUploader(dto.getContact());
......@@ -406,8 +407,8 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po
return "消息推送成功。";
} else {
String openidStr = resSet.stream().filter(s -> s.contains("失败")).map(errInfo -> {
List<String> split = StrUtil.split(errInfo, ":");
return split.get(0);
String[] split = errInfo.split(":");
return split[0];
}).collect(Collectors.joining(","));
return ResultUtil.error(513, openidStr + "消息推送失败,请手动发送消息或联系管理员。");
}
......
package vion.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.data.id.IdUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.crypto.SecureUtil;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
......@@ -51,8 +52,8 @@ public class RepairRecServiceImpl extends MPJBaseServiceImpl<RepairRecMapper, Re
Arrays.stream(fileList).forEach(infile -> {
//上传url地址
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + "repairRec" + FileUtil.FILE_SEPARATOR + repairRec.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
......
package vion.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.tree.MapTree;
import org.dromara.hutool.core.tree.TreeNode;
import org.dromara.hutool.core.tree.TreeUtil;
import org.springframework.stereotype.Service;
import vion.dto.ResourceDTO;
import vion.mapper.ResourceMapper;
......@@ -42,12 +42,12 @@ public class ResourceServiceImpl extends MPJBaseServiceImpl<ResourceMapper, Reso
}
@Override
public List<Tree<Long>> listTree(Long id) {
public List<MapTree<Long>> listTree(Long id) {
List<Resource> resourceList = this.lambdaQuery()
.orderByAsc(Resource::getSortCode)
.list();
List<TreeNode<Long>> nodeList = CollUtil.newArrayList();
List<TreeNode<Long>> nodeList = ListUtil.zero();
resourceList.forEach(v -> {
TreeNode<Long> node = new TreeNode<>(v.getId(), v.getParentId(), v.getName(), 1);
Map<String, Object> map = MapUtil.<String, Object>builder()
......@@ -63,9 +63,9 @@ public class ResourceServiceImpl extends MPJBaseServiceImpl<ResourceMapper, Reso
node.setExtra(map);
nodeList.add(node);
});
List<Tree<Long>> wholeTree = TreeUtil.build(nodeList, 0L);
List<MapTree<Long>> wholeTree = TreeUtil.build(nodeList, 0L);
return Opt.ofNullable(id).map(d -> {
List<Tree<Long>> resTree = new ArrayList<>();
List<MapTree<Long>> resTree = new ArrayList<>();
wholeTree.forEach(t ->
t.walk(tmp -> {
if (tmp.getId().equals(d)) {
......
package vion.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Opt;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.lang.Opt;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
......
package vion.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import io.github.linpeilie.Converter;
......@@ -122,8 +123,8 @@ public class SettlementDiffServiceImpl extends MPJBaseServiceImpl<SettlementDiff
Arrays.stream(fileList).forEach(infile -> {
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + "settlementDiff" + FileUtil.FILE_SEPARATOR + dto.getContractNo() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
......@@ -140,7 +141,7 @@ public class SettlementDiffServiceImpl extends MPJBaseServiceImpl<SettlementDiff
fileInfo.setSourceType(15);
fileInfo.setName(filename);
fileInfo.setUrl(path);
fileInfo.setType(FileUtil.extName(file));
fileInfo.setType(FileNameUtil.extName(file));
fileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
fileInfo.setUploader(userVO.getUsername());
fileService.save(fileInfo);
......
package vion.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.data.id.IdUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.crypto.SecureUtil;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
......@@ -51,8 +52,8 @@ public class SparePartServiceImpl extends MPJBaseServiceImpl<SparePartMapper, Sp
Arrays.stream(fileList).forEach(infile -> {
//上传url地址
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + "sparePart" + FileUtil.FILE_SEPARATOR + sparePart.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
......
package vion.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
......@@ -188,8 +189,8 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
for (MultipartFile infile : tmpFiles) {
//上传url地址
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + statusDTO.getStoreId() + FileUtil.FILE_SEPARATOR + statusDTO.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
......@@ -205,7 +206,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
tempFileInfo.setSourceType(statusDTO.getSourceType());
tempFileInfo.setName(filename);
tempFileInfo.setUrl(path);
tempFileInfo.setType(FileUtil.extName(file));
tempFileInfo.setType(FileNameUtil.extName(file));
tempFileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
tempFileInfo.setUploader(userVO.getUsername());
......
package vion.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.*;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.core.util.DesensitizedUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.collection.set.SetUtil;
import org.dromara.hutool.core.data.id.IdUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.crypto.SecureUtil;
import org.dromara.hutool.json.JSONArray;
import org.dromara.hutool.json.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
......@@ -90,7 +96,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
* @return java.util.Set<java.lang.Long>
*/
private Set<Long> getTaskIdSet(UserVO userVO) {
Set<Long> taskIdSet = CollUtil.newHashSet();
Set<Long> taskIdSet = SetUtil.zero();
Opt.ofEmptyAble(userVO.getRoleVOList())
.map(l -> l.stream().map(RoleVO::getCode).collect(Collectors.toList()))
.map(roleCodeList -> {
......@@ -333,8 +339,8 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
.ifPresent(fileList ->
Arrays.stream(fileList).forEach(infile -> {
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + data.getStoreId() + FileUtil.FILE_SEPARATOR + task.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
......@@ -350,7 +356,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
fileInfo.setSourceType(3);
fileInfo.setName(filename);
fileInfo.setUrl(path);
fileInfo.setType(FileUtil.extName(file));
fileInfo.setType(FileNameUtil.extName(file));
fileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
fileInfo.setUploader(user.getUsername());
fileService.save(fileInfo);
......
package vion.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import org.dromara.hutool.core.bean.BeanUtil;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.date.DateUtil;
import org.dromara.hutool.core.io.file.FileNameUtil;
import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.crypto.SecureUtil;
import org.dromara.hutool.json.JSONArray;
import org.dromara.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
......@@ -87,8 +88,8 @@ public class TaskTempServiceImpl extends MPJBaseServiceImpl<TaskTempMapper, Task
Arrays.stream(fileList).forEach(infile -> {
//上传url地址
String orgName = infile.getOriginalFilename();
String mainName = FileUtil.mainName(orgName);
String fileExt = FileUtil.extName(orgName);
String mainName = FileNameUtil.mainName(orgName);
String fileExt = FileNameUtil.extName(orgName);
String filename = StrUtil.format("{}_{}.{}", mainName, DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS"), fileExt);
String path = fileUrl + FileUtil.FILE_SEPARATOR + 0 + FileUtil.FILE_SEPARATOR + taskTemp.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
......@@ -104,7 +105,7 @@ public class TaskTempServiceImpl extends MPJBaseServiceImpl<TaskTempMapper, Task
fileInfo.setSourceType(2);
fileInfo.setName(filename);
fileInfo.setUrl(path);
fileInfo.setType(FileUtil.extName(file));
fileInfo.setType(FileNameUtil.extName(file));
fileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
fileInfo.setUploader(data.getRepairPeople());
fileService.save(fileInfo);
......
package vion.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.tree.MapTree;
import org.dromara.hutool.core.tree.TreeNode;
import org.dromara.hutool.core.tree.TreeUtil;
import org.springframework.stereotype.Service;
import vion.dto.UserDTO;
import vion.mapper.UserMapper;
......@@ -58,11 +57,11 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
}
@Override
public List<Tree<String>> getOrgTree(String deptId) {
public List<MapTree<String>> getOrgTree(String deptId) {
List<Dept> deptList = deptService.list();
List<User> userList = this.list();
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
List<TreeNode<String>> nodeList = ListUtil.zero();
deptList.forEach(v -> {
TreeNode<String> node = new TreeNode<>(v.getDeptId().toString(), v.getParentId().toString(), v.getDeptName(), 1);
node.setExtra(MapUtil.<String, Object>builder().put("type", "dept").put("pkId", v.getId()).build());
......@@ -73,9 +72,9 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
node.setExtra(MapUtil.<String, Object>builder().put("type", "user").put("pkId", v.getId()).build());
nodeList.add(node);
});
List<Tree<String>> wholeTree = TreeUtil.build(nodeList, "1");
List<MapTree<String>> wholeTree = TreeUtil.build(nodeList, "1");
return Opt.ofBlankAble(deptId).map(d -> {
List<Tree<String>> resTree = new ArrayList<>();
List<MapTree<String>> resTree = new ArrayList<>();
wholeTree.forEach(t ->
t.walk(tmp -> {
if (tmp.getId().equals(d)) {
......
package vion.third;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.digest.HMac;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.codec.binary.Base64;
import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.crypto.SecureUtil;
import org.dromara.hutool.crypto.digest.mac.HMac;
import org.dromara.hutool.http.HttpUtil;
import org.dromara.hutool.http.client.Request;
import org.dromara.hutool.http.client.Response;
import org.dromara.hutool.json.JSONArray;
import org.dromara.hutool.json.JSONObject;
import org.dromara.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
......@@ -29,7 +30,8 @@ import vion.service.*;
import vion.vo.RoleVO;
import vion.vo.UserVO;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
......@@ -116,7 +118,7 @@ public class DingMod {
return;
}
List<List<String>> userIdListSplit = ListUtil.split(userIdList, 90);
List<List<String>> userIdListSplit = ListUtil.partition(userIdList, 90);
userIdListSplit.forEach(tmpList -> {
JSONObject paramJson = new JSONObject();
paramJson.set("agentid", 2358374016L);
......@@ -139,7 +141,7 @@ public class DingMod {
if (StrUtil.equals("sys00-name", tmpObj.getStr("field_code"))) {
user.setUsername(tmpObj.getJSONArray("field_value_list").getByPath("[0].value", String.class));
} else if (StrUtil.equals("sys00-mobile", tmpObj.getStr("field_code"))) {
user.setPhone(Opt.ofNullable(tmpObj.getJSONArray("field_value_list").getByPath("[0].value", String.class)).orElse(""));
user.setPhone(Opt.ofNullable((String) tmpObj.getJSONArray("field_value_list").getByPath("[0].value", String.class)).orElse(""));
} else if (StrUtil.equals("sys00-mainDeptId", tmpObj.getStr("field_code"))) {
user.setDeptId(tmpObj.getJSONArray("field_value_list").getByPath("[0].value", Long.class));
} else if (StrUtil.equals("sys01-employeeStatus", tmpObj.getStr("field_code"))) {
......@@ -161,12 +163,12 @@ public class DingMod {
public void getDeptList() {
String accessToken = getToken();
List<Long> deptIdList = ListUtil.toList(1L);
List<Long> deptIdList = ListUtil.of(1L);
int idx = 0;
while (idx < deptIdList.size()) {
// 2:试用期 3:正式 5:待离职 -1:无状态
Long value = deptIdList.get(idx++);
String res = HttpUtil.post("https://oapi.dingtalk.com/topapi/v2/department/listsub?access_token=" + accessToken, JSONUtil.createObj().set("dept_id", value).toString());
String res = HttpUtil.post("https://oapi.dingtalk.com/topapi/v2/department/listsub?access_token=" + accessToken, JSONUtil.ofObj().set("dept_id", value).toString());
JSONObject jsonObject = JSONUtil.parseObj(res);
if (StrUtil.equals("ok", jsonObject.getStr("errmsg"))) {
JSONArray resArr = jsonObject.getJSONArray("result");
......@@ -218,19 +220,19 @@ public class DingMod {
return tokenObj;
}
String accessToken = tokenObj.getStr("accessToken");
HttpResponse response = HttpRequest.get("https://api.dingtalk.com/v1.0/contact/users/me")
Response response = Request.of("https://api.dingtalk.com/v1.0/contact/users/me")
.header("x-acs-dingtalk-access-token", accessToken)
.execute();
.send();
if (!response.isOk()) {
log.error("钉钉回调接口获取unionid失败:{}", response.body());
return response.body();
log.error("钉钉回调接口获取unionid失败:{}", response.bodyStr());
return response.bodyStr();
}
JSONObject userInfoObj = JSONUtil.parseObj(response.body());
JSONObject userInfoObj = JSONUtil.parseObj(response.bodyStr());
String unionId = userInfoObj.getStr("unionId");
String response1 = HttpUtil.post("https://oapi.dingtalk.com/topapi/user/getbyunionid?access_token=" + getToken(), "{\"unionid\":\"" + unionId + "\"}");
JSONObject useridObj = JSONUtil.parseObj(response1);
if (!useridObj.containsKey("result")) {
log.error("钉钉回调接口获取userid失败:{}", userInfoObj);
log.error("钉钉回调接口获取userid失败:{}", useridObj);
return useridObj;
}
String userid = useridObj.getJSONObject("result").getStr("userid");
......@@ -277,7 +279,7 @@ public class DingMod {
StpUtil.getTokenSession().set("curLoginUser", userVO);
try {
if (ObjUtil.isAllNotEmpty(dto.getStoreId(), dto.getTaskId())) {
if (ArrayUtil.isAllNotEmpty(dto.getStoreId(), dto.getTaskId())) {
res.sendRedirect("https://yunwei.vionyun.com:8443/wap/workflow-process?token=" + token + "&storeId=" + dto.getStoreId() + "&taskId=" + dto.getTaskId());
} else if (ObjUtil.isNotEmpty(dto.getTaskTempId())) {
res.sendRedirect("https://yunwei.vionyun.com:8443/wap/workflow-assign?token=" + token + "&id=" + dto.getTaskTempId());
......
package vion.third;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts;
......@@ -13,6 +10,9 @@ import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.dromara.hutool.core.data.id.IdUtil;
import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.text.StrUtil;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
......
package vion.utils.excel;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
/**
* @author HlQ
* @date 2024/2/26
*/
public class AttachmentExportUtil {
public static void export(Workbook workbook, String fileName, HttpServletResponse response) {
try {
String suffix = ".xlsx";
if (workbook instanceof HSSFWorkbook) {
if (fileName.endsWith(suffix)) {
fileName = fileName.substring(0, fileName.length() - 1);
}
suffix = ".xls";
response.setContentType("application/vnd.ms-excel");
} else {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
}
if (!fileName.endsWith(suffix)) {
fileName = fileName + suffix;
}
setAttachmentConfig(fileName, response);
workbook.write(response.getOutputStream());
} catch (IOException var7) {
throw new RuntimeException(var7);
} finally {
clear(workbook);
}
}
private static void clear(Workbook workbook) {
if (workbook instanceof SXSSFWorkbook) {
((SXSSFWorkbook)workbook).dispose();
}
try {
workbook.close();
} catch (IOException var2) {
var2.printStackTrace();
}
}
private static void setAttachmentConfig(String fileName, HttpServletResponse response) throws UnsupportedEncodingException {
response.setCharacterEncoding("UTF-8");
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8").replace("+", "%20"));
}
}
......@@ -5,10 +5,10 @@ spring.datasource.username=vion
spring.datasource.password=jkou72j32m4K5d8k
spring.datasource.driver-class-name=org.postgresql.Driver
spring.redis.host=r-2zejlb88mng3q50aw7pd.redis.rds.aliyuncs.com
spring.redis.password=RtOTnx2V
spring.redis.port=6379
spring.redis.database=8
spring.data.redis.host=r-2zejlb88mng3q50aw7pd.redis.rds.aliyuncs.com
spring.data.redis.password=RtOTnx2V
spring.data.redis.port=6379
spring.data.redis.database=8
wx.mp.config-storage.type=RedisTemplate
wx.mp.config-storage.key-prefix=wa
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!