Compare commits

..

2 Commits

Author SHA1 Message Date
姜玉琦 e0bebe66f7 Merge branch 'main' of http://62.234.3.186:3000/sxyanzhu/jhprjv2 2023-08-10 21:20:46 +08:00
姜玉琦 cd88f0544c 提交 2023-08-10 21:20:40 +08:00
1149 changed files with 29983 additions and 163280 deletions

View File

@ -1 +0,0 @@
mvn clean

View File

@ -1 +0,0 @@
mvn clean package -Dmaven.test.skip=true

14
bin/run
View File

@ -1,14 +0,0 @@
@echo off
echo.
echo [信息] 运行Web工程。
echo.
cd %~dp0
cd ../ruoyi-admin/target
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -jar %JAVA_OPTS% ruoyi-admin.jar
cd bin
pause

13
pom.xml
View File

@ -10,7 +10,7 @@
<name>ruoyi</name>
<url>http://www.ruoyi.vip</url>
<description>长安区数字工程监管系统</description>
<description>北跨泾河-产发工程数字管理平台</description>
<properties>
<ruoyi.version>3.8.6</ruoyi.version>
@ -31,9 +31,8 @@
<velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version>
<flowable.version>6.7.2</flowable.version>
<hutool.version>5.8.20</hutool.version>
</properties>
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies>
@ -108,6 +107,7 @@
<artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version>
</dependency>
<!-- collections工具类 -->
<dependency>
<groupId>commons-collections</groupId>
@ -194,12 +194,6 @@
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
<version>1.18.30</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -212,7 +206,6 @@
<module>ruoyi-generator</module>
<module>ruoyi-common</module>
<module>ruoyi-flowable</module>
<module>yanzhu-deviceApi</module>
<module>yanzhu-bigscreen</module>
<module>yanzhu-jh</module>
</modules>

View File

@ -78,12 +78,6 @@
<artifactId>ruoyi-flowable</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>

View File

@ -1,6 +1,5 @@
package com.ruoyi;
import com.ruoyi.common.utils.file.FileUploadUtils;
import org.mybatis.spring.annotation.MapperScan;;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -32,6 +31,5 @@ public class RuoYiApplication
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
//FileUploadUtils.minPath("/data/uploadPath/upload/");
}
}

View File

@ -1,78 +0,0 @@
package com.ruoyi.api.base;
import com.ruoyi.common.utils.AuthRsaUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sign.Md5Utils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* token
*
* @author: JiangYuQi
* @date: 2024/01/13 10:17
*/
@Data
@Slf4j
public class PubTokenReqVo {
/**
* AppId
*/
@NotBlank(message = "AppId不能为空")
@Size(min = 1, max = 64, message = "AppId格式异常")
private String appId;
/**
*
* RSA( + )
*/
@NotBlank(message = "签名不能为空")
private String sign;
/**
*
*/
@NotNull(message = "时间戳不能为空")
private Long timestamp;
/**
*
*
* @author: JiangYuQi
* @date: 2024/01/13 10:17
*/
public Boolean getLoginSign(String privateKey) {
boolean signFlag = false;
try {
System.out.println("appId=>>>"+appId);
System.out.println("privateKey=>>>"+privateKey);
System.out.println("timestamp=>>>"+timestamp);
String key = Md5Utils.hash(appId + privateKey + timestamp);
System.out.println("key=>>>"+key);
System.out.println("sign=>>>"+sign);
if (StringUtils.equals(sign, key)) {
signFlag = true;
}
} catch (Exception e) {
log.error(e.getMessage());
}
return signFlag;
}
/**
* [3]
*/
public Boolean checkTimestamp() {
boolean timestampFlag = false;
long timePoor = Math.abs(timestamp - System.currentTimeMillis());
if (timePoor < 1000 * 60 * 3) {
timestampFlag = true;
}
return timestampFlag;
}
}

View File

@ -1,72 +0,0 @@
package com.ruoyi.api.base;
import com.ruoyi.common.utils.AuthRsaUtils;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* token
*
* @author: JiangYuQi
* @date: 2024/01/13 10:17
*/
@Data
@Slf4j
public class TokenReqVo {
/**
* AppId
*/
@NotBlank(message = "AppId不能为空")
@Size(min = 1, max = 64, message = "AppId格式异常")
private String appId;
/**
*
* RSA( + )
*/
@NotBlank(message = "签名不能为空")
private String sign;
/**
*
*/
@NotNull(message = "时间戳不能为空")
private Long timestamp;
/**
*
*
* @author: JiangYuQi
* @date: 2024/01/13 10:17
*/
public Boolean getLoginSign(String privateKey) {
boolean signFlag = false;
try {
String decryptByPrivateKey = AuthRsaUtils.decryptByPrivateKey(privateKey,sign);
if (StringUtils.equals(appId + timestamp, decryptByPrivateKey)) {
signFlag = true;
}
} catch (Exception e) {
log.error(e.getMessage());
}
return signFlag;
}
/**
* [3]
*/
public Boolean checkTimestamp() {
boolean timestampFlag = true;
/**long timePoor = Math.abs(timestamp - System.currentTimeMillis());
if (timePoor < 1000 * 60 * 3) {
timestampFlag = true;
}*/
return timestampFlag;
}
}

View File

@ -1,199 +0,0 @@
package com.ruoyi.api.labour.controller;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.api.base.PubTokenReqVo;
import com.ruoyi.api.labour.domain.AiBoxApiReqVo;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.annotation.RateLimiter;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.*;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sign.Md5Utils;
import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.system.domain.SysApplyConfig;
import com.ruoyi.system.service.ISysUserService;
import com.yanzhu.jh.video.domain.DevAiProjectData;
import com.yanzhu.jh.video.service.IDevAiProjectDataService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* AiAPIController
*
* @author JiangYuQi
* @date 2024-01-13
*/
@Slf4j
@RestController
@RequestMapping("/api/aiboxs")
public class AiBoxApiController extends BaseController {
@Autowired
private RedisCache redisCache;
@Autowired
private ISysUserService userService;
@Autowired
private SysLoginService loginService;
@Autowired
private IDevAiProjectDataService devAiProjectDataService;
/**
* token
* [6010IP]
* @param req
* @author JiangYuQi
* @date 2024-01-13
*/
@Anonymous
@ApiOperation(value = "获取TOKEN")
@RateLimiter(count = 10, limitType = LimitType.IP)
@PostMapping("/v1/getToken")
public AjaxResult getToken(@Validated @RequestBody PubTokenReqVo req) {
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+req.getAppId());
if(sysApplyConfig==null){
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(),HttpStatusEnum.ERROR.getCode());
}
if(StringUtils.equals(ShiFouEnum.SHI.getCode(),sysApplyConfig.getIsDel())){
throw new ServiceException(HttpStatusEnum.DISABLE.getInfo(),HttpStatusEnum.DISABLE.getCode());
}
if(!Objects.equals(ApplyCfgTypeEnum.AIBOXS.getCode(),sysApplyConfig.getCfgType())){
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(),HttpStatusEnum.ERROR.getCode());
}
if(!req.checkTimestamp()){
throw new ServiceException(HttpStatusEnum.SINGET_TIMEOUT.getInfo(),HttpStatusEnum.SINGET_TIMEOUT.getCode());
}
AjaxResult ajax = AjaxResult.success();
String Authorization = "";
if (req.getLoginSign(sysApplyConfig.getPublicKey())) {
String key = "api.aiboxs.getToken:"+req.getAppId();
String obj = redisCache.getCacheObject(key);
if(StringUtils.isNotEmpty(obj)){
ajax.put("Authorization", obj);
}else{
Authorization = this.getAppIdLoginToken(req.getAppId(),sysApplyConfig);
ajax.put("Authorization", Authorization);
redisCache.setCacheObject(key,Authorization,30, TimeUnit.MINUTES);
}
} else {
throw new ServiceException(HttpStatusEnum.SINGET_ERROR.getInfo(),HttpStatusEnum.SINGET_ERROR.getCode());
}
return ajax;
}
/**
* appId
*
* @param appId
* @return token
*/
private String getAppIdLoginToken(String appId,SysApplyConfig sysApplyConfig) {
// 查询用户是否存在,不存在则保存
SysUser sysUser = userService.selectUserByUserName(appId);
String password = Convert.toStr(System.currentTimeMillis());
if (sysUser == null) {
sysUser = new SysUser();
sysUser.setDeptId(sysApplyConfig.getDeptId());
sysUser.setUserName(Convert.toStr(sysApplyConfig.getAppId()));
sysUser.setNickName(Convert.toStr(sysApplyConfig.getAppId()));
sysUser.setUserType(UserTypeEnum.APPLY.getCode());
sysUser.setStatus("0");
sysUser.setCreateBy("AppId登录创建用户");
sysUser.setPassword(SecurityUtils.encryptPassword(password));
userService.insertUser(sysUser);
} else {
sysUser.setPassword(SecurityUtils.encryptPassword(password));
sysUser.setUpdateBy("AppId登录更新用户密码");
userService.updateUser(sysUser);
}
return loginService.unifiedLogin(appId, password);
}
/**
*
* [6010IP]
* @param req
* @author JiangYuQi
* @date 2024-01-13
*/
@ApiOperation(value = "获取视频预警信息")
@RateLimiter(time = 10, limitType = LimitType.IP)
@GetMapping("/v1/list")
public TableDataInfo list(AiBoxApiReqVo req) {
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+super.getUsername());
if(StringUtils.equals(ShiFouEnum.SHI.getCode(),sysApplyConfig.getIsDel())){
throw new ServiceException(HttpStatusEnum.DISABLE.getInfo(),HttpStatusEnum.DISABLE.getCode());
}
if(!Objects.equals(ApplyCfgTypeEnum.AIBOXS.getCode(),sysApplyConfig.getCfgType())){
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(),HttpStatusEnum.ERROR.getCode());
}
DevAiProjectData query = new DevAiProjectData();
query.setDeptId(sysApplyConfig.getDeptId());
query.setProjectId(sysApplyConfig.getProjectId());
Map<String, Object> params = new HashMap<>();
if(Objects.nonNull(req.getBeginTimestamp()) && Objects.nonNull(req.getEndTimestamp())){
Date beginTime = new Date(req.getBeginTimestamp());
params.put("beginTime",beginTime);
Date endTime = new Date(req.getEndTimestamp());
params.put("endTime",endTime);
}else{
if(Objects.nonNull(req.getBeginTimestamp())){
Date beginTime = new Date(req.getBeginTimestamp());
params.put("beginDate",beginTime);
}
if(Objects.nonNull(req.getEndTimestamp())){
Date endTime = new Date(req.getEndTimestamp());
params.put("endDate",endTime);
}
}
query.setParams(params);
startPage();
List<DevAiProjectData> list = devAiProjectDataService.selectDevAiProjectDataList(query);
for(DevAiProjectData item:list){
item.setImageUrl(RuoYiConfig.getProjectUrl()+item.getImageUrl());
item.setMinImage(item.getImageUrl()+".min.jpg");
}
return getDataTable(list);
}
private static final String baseUrl = "http://localhost:8090/jhapi";
public static void main(String[] args) {
String appId = "jhcf17140956314490N6VSHsPjx008";
String AppSecret = "xx+UsVJ9cIJ8PTWpWU5GcNx+x+chJBQIDAQAB";
Long time = System.currentTimeMillis();
String sign = Md5Utils.hash(appId+AppSecret+time);
System.out.println(time);
System.out.println(sign);
String url = baseUrl + "/api/aiboxs/v1/getToken";
Map<String, Object> body = new HashMap<>();
body.put("appId",appId);
body.put("sign",sign);
body.put("timestamp",time);
String result = HttpUtil.post(url, body);
JSONObject jsonObject = JSONObject.parseObject(result);
if(jsonObject.getInteger("code")==200){
// 获取到存入redis设置30分钟有效期
String token = jsonObject.getString("Authorization");
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,21 +0,0 @@
package com.ruoyi.api.labour.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
/**
* API
*
* @author: JiangYuQi
* @date: 2024/01/13 12:21
*/
@Data
@Slf4j
public class AiBoxApiReqVo extends BaseEntity {
private Long beginTimestamp;
private Long endTimestamp;
}

View File

@ -1,74 +0,0 @@
package com.ruoyi.api.labour.domain;
import com.ruoyi.common.utils.AuthRsaUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sign.Md5Utils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
*
*
* @author: JiangYuQi
* @date: 2024/01/13 12:21
*/
@Data
@Slf4j
public class LabourSignetVo {
/**
*
* RSA(dataMd5 + )
*/
@NotBlank(message = "签名不能为空")
private String sign;
/**
*
*/
@NotBlank(message = "推送数据不能为空")
private String data;
/**
*
*/
@NotNull(message = "时间戳不能为空")
private Long timestamp;
/**
*
*
* @author: JiangYuQi
* @date: 2024/01/13 10:17
*/
public Boolean getDataSign(String privateKey) {
boolean signFlag = false;
try {
String decryptByPrivateKey = AuthRsaUtils.decryptByPrivateKey(privateKey,sign);
String privateDataStr = Md5Utils.hash(data) + timestamp;
log.info("签名值...{}",privateDataStr);
log.info("解密值...{}",decryptByPrivateKey);
if (StringUtils.equals(privateDataStr, decryptByPrivateKey)) {
signFlag = true;
}
} catch (Exception e) {
log.error(e.getMessage());
}
return signFlag;
}
/**
* [30]
*/
public Boolean checkTimestamp() {
boolean timestampFlag = true;
/**long timePoor = Math.abs(timestamp - System.currentTimeMillis());
if (timePoor < 1000 * 60 * 30) {
timestampFlag = true;
}*/
return timestampFlag;
}
}

View File

@ -1,150 +0,0 @@
package com.ruoyi.web.controller.system;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.ApplyCfgTypeEnum;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.ShiFouEnum;
import com.ruoyi.common.utils.NoUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysApplyConfig;
import com.ruoyi.system.service.ISysApplyConfigService;
import com.yanzhu.jh.project.domain.SurProjectAttendanceCfg;
import com.yanzhu.jh.project.service.ISurProjectAttendanceCfgService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* Controller
*
* @author JiangYuQi
* @date 2024-01-13
*/
@RestController
@RequestMapping("/system/applyConfig")
public class SysApplyConfigController extends BaseController
{
private static final String vendorsCode = "yanzhu";
@Autowired
private ISysApplyConfigService sysApplyConfigService;
@Autowired
private ISurProjectAttendanceCfgService surProjectAttendanceCfgService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:applyConfig:list')")
@GetMapping("/list")
public TableDataInfo list(SysApplyConfig sysApplyConfig)
{
startPage();
List<SysApplyConfig> list = sysApplyConfigService.selectSysApplyConfigList(sysApplyConfig);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:applyConfig:export')")
@Log(title = "系统应用注册", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysApplyConfig sysApplyConfig)
{
List<SysApplyConfig> list = sysApplyConfigService.selectSysApplyConfigList(sysApplyConfig);
ExcelUtil<SysApplyConfig> util = new ExcelUtil<SysApplyConfig>(SysApplyConfig.class);
util.exportExcel(response, list, "系统应用注册数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:applyConfig:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sysApplyConfigService.selectSysApplyConfigById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:applyConfig:add')")
@Log(title = "系统应用注册", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysApplyConfig sysApplyConfig)
{
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
SurProjectAttendanceCfg surProjectAttendanceCfg = new SurProjectAttendanceCfg();
surProjectAttendanceCfg.setProjectId(sysApplyConfig.getProjectId());
surProjectAttendanceCfg.setSubDeptId(sysApplyConfig.getDeptId());
surProjectAttendanceCfg.setVendorsCode(vendorsCode);
surProjectAttendanceCfg.setEnabled(sysApplyConfig.getIsDel().equals(ShiFouEnum.FOU.getCode())?ShiFouEnum.SHI.getLongCode():ShiFouEnum.FOU.getLongCode());
surProjectAttendanceCfg.setState(ShiFouEnum.FOU.getLongCode());
int res = surProjectAttendanceCfgService.insertSurProjectAttendanceCfg(surProjectAttendanceCfg);
if(res>0){
// 同步将信息保存到sur_project_attendance_cfg
sysApplyConfig.setCfgId(surProjectAttendanceCfg.getId());
}
}
return toAjax(sysApplyConfigService.insertSysApplyConfig(sysApplyConfig));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:applyConfig:edit')")
@Log(title = "系统应用注册", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysApplyConfig sysApplyConfig)
{
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
SurProjectAttendanceCfg surProjectAttendanceCfg = new SurProjectAttendanceCfg();
surProjectAttendanceCfg.setId(sysApplyConfig.getCfgId());
surProjectAttendanceCfg.setEnabled(sysApplyConfig.getIsDel().equals(ShiFouEnum.FOU.getCode())?ShiFouEnum.SHI.getLongCode():ShiFouEnum.FOU.getLongCode());
surProjectAttendanceCfgService.updateSurProjectAttendanceCfg(surProjectAttendanceCfg);
}
return toAjax(sysApplyConfigService.updateSysApplyConfig(sysApplyConfig));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:applyConfig:remove')")
@Log(title = "系统应用注册", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
List<Long> cfgIds = new ArrayList<>();
for(Long id:ids){
SysApplyConfig sysApplyConfig = sysApplyConfigService.selectSysApplyConfigById(id);
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
cfgIds.add(sysApplyConfig.getCfgId());
}
}
if(CollectionUtils.isNotEmpty(cfgIds)){
surProjectAttendanceCfgService.deleteSurProjectAttendanceCfgByIds(cfgIds.stream().toArray(Long[]::new));
}
return toAjax(sysApplyConfigService.deleteSysApplyConfigByIds(ids));
}
/**
* AppId
*/
@PreAuthorize("@ss.hasPermi('system:applyConfig:add')")
@GetMapping("/createAppId")
public AjaxResult createAppId()
{
return success(NoUtils.createAppId());
}
}

View File

@ -1,11 +1,7 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.system.domain.vo.AlertUserPassVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -21,8 +17,6 @@ import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.system.service.ISysMenuService;
import javax.validation.Valid;
/**
*
*
@ -62,7 +56,7 @@ public class SysLoginController
*
* @return
*/
@GetMapping("/getInfo")
@GetMapping("getInfo")
public AjaxResult getInfo()
{
SysUser user = SecurityUtils.getLoginUser().getUser();
@ -71,14 +65,6 @@ public class SysLoginController
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
AjaxResult ajax = AjaxResult.success();
List<SysRole> list= user.getRoles();
long roleId= list.get(0).getRoleId();
for(SysRole role :list){
if(role.getRoleId()<roleId){
roleId=role.getRoleId();
}
}
ajax.put("roleId",roleId);
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
@ -90,7 +76,7 @@ public class SysLoginController
*
* @return
*/
@GetMapping("/getRouters")
@GetMapping("getRouters")
public AjaxResult getRouters()
{
Long userId = SecurityUtils.getUserId();

View File

@ -1,13 +1,8 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.system.domain.vo.AlertUserPassVo;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -253,26 +248,4 @@ public class SysUserController extends BaseController
{
return success(deptService.selectDeptTreeList(dept));
}
/**
*
* @param data
* @return
*/
@Anonymous
@PostMapping("/v1/sendPhoneMessage")
public AjaxResult sendPhoneMessage(@RequestBody Map<String,String> data){
return userService.sendPhoneMessage(data.get("phoneNumber"));
}
/**
* &token
* @param alertUserPassVo
* @return
*/
@Anonymous
@PostMapping(value = "/v1/codeUpdatePwd")
public AjaxResult codeUpdatePwd(@RequestBody @Valid AlertUserPassVo alertUserPassVo){
return userService.updataUserPassWord(alertUserPassVo);
}
}

View File

@ -113,7 +113,7 @@ public class SwaggerConfig
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("标题:长安区数字工程监管系统_接口文档")
.title("标题:北跨泾河-产发工程数字管理平台_接口文档")
// 描述
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
// 作者信息

View File

@ -1,46 +1,3 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.8.6
# 版权年份
copyrightYear: 2023
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/data2/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
# 服务回调地址
projectUrl: http://106.55.153.13:8888
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8088
servlet:
# 应用的访问路径
context-path: /jhapi
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
#微信公众号配置
wechat:
mpAppId: wxe6fd9ad863ac09bf
mpAppSecret: ed08e7f6f42a40fc9fa0ebbc1bc6a1db
wxAppId: wx9997d071b4996f23
wxAppSecret: 5bcc9ca17b31133d93a025871fc5021d
# 数据源配置
spring:
datasource:
@ -49,9 +6,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://106.55.153.13:3306/yanzhu_jh?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
url: jdbc:mysql://cd-cynosdbmysql-grp-9rqrhxsm.sql.tencentcdb.com:27981/yanzhu_jh?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
username: root
password: sxyz@uqw8qmash!<76j
password: Sxyanzhu@cf
# 从库数据源
slave:
# 从数据源开关/默认关闭
@ -101,26 +58,4 @@ spring:
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password: 123456
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
multi-statement-allow: true

View File

@ -1,134 +0,0 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.8.6
# 版权年份
copyrightYear: 2023
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: /data/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
# 服务回调地址
projectUrl: http://106.55.153.13:8888
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8088
servlet:
# 应用的访问路径
context-path: /jhapi
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
#微信公众号配置
wechat:
mpAppId: wxe6fd9ad863ac09bf
mpAppSecret: ed08e7f6f42a40fc9fa0ebbc1bc6a1db
wxAppId: wx9997d071b4996f23
wxAppSecret: 5bcc9ca17b31133d93a025871fc5021d
# 日志配置
logging:
level:
com.ruoyi: info
com.yanzhu.jh: info
org.springframework: error
org.flowable: error
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://127.0.0.1:3306/yanzhu_jh?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
username: root
password: sxyz@uqw8qmash!<76j
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 1
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms

View File

@ -1,125 +0,0 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.8.6
# 版权年份
copyrightYear: 2023
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: /data/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
# 服务回调地址
projectUrl: http://106.55.153.13:8888
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8088
servlet:
# 应用的访问路径
context-path: /jhapi
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
#微信公众号配置
wechat:
mpAppId: #wxe6fd9ad863ac09bf
mpAppSecret: #ed08e7f6f42a40fc9fa0ebbc1bc6a1db
wxAppId: #wx9997d071b4996f23
wxAppSecret: #5bcc9ca17b31133d93a025871fc5021d
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://106.55.153.13:3306/yanzhu_jh?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
username: root
password: sxyz@uqw8qmash!<76j
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 1
# 密码
password: 123456
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms

View File

@ -1,10 +1,45 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.8.6
# 版权年份
copyrightYear: 2023
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: /data/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8090
servlet:
# 应用的访问路径
context-path: /jhapi
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
# 日志配置
logging:
level:
com.ruoyi: debug
com.yanzhu.jh: debug
org.springframework: warn
org.flowable: debug
# 用户配置
user:
password:
@ -15,28 +50,46 @@ user:
# Spring配置
spring:
# 微信资源验证访问
web:
resources:
static-locations: classpath:/wxstatic/
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: prod
active: druid
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 200MB
max-file-size: 10MB
# 设置总上传的文件大小
max-request-size: 500MB
max-request-size: 20MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password: 123456
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# token配置
token:
@ -74,9 +127,9 @@ xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice,/common/*
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*,/api/*,/flow/*
urlPatterns: /system/*,/monitor/*,/tool/*
# flowable相关表
flowable:

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/usr/local/xaqjgwh/log/ruoyi-admin" />
<property name="log.path" value="/Users/2y/zhj/logs" />
<!-- 彩色日志 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>

View File

@ -1 +0,0 @@
29aef62cd1316f1635063c5b86a3ffee

View File

@ -29,11 +29,6 @@
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<!-- spring security 安全认证 -->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -142,13 +137,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>${hutool.version}</version>
<version>5.3.3</version>
</dependency>
<dependency>
@ -157,24 +146,6 @@
<version>7.2.12</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>2.7.0</version>
</dependency>
</dependencies>
</project>

View File

@ -53,9 +53,6 @@ public @interface Excel
*/
public int scale() default -1;
public boolean isLink() default false;
public String linkText() default "";
/**
* BigDecimal :BigDecimal.ROUND_HALF_EVEN
*/

View File

@ -48,9 +48,4 @@ public @interface Log
*
*/
public String[] excludeParamNames() default {};
/**
*
*/
public String nickname() default "";
}

View File

@ -33,11 +33,6 @@ public class RuoYiConfig
/** 验证码类型 */
private static String captchaType;
/**
*
*/
private static String projectUrl;
public String getName()
{
return name;
@ -106,14 +101,6 @@ public class RuoYiConfig
RuoYiConfig.captchaType = captchaType;
}
public static String getProjectUrl() {
return projectUrl;
}
public void setProjectUrl(String projectUrl) {
RuoYiConfig.projectUrl = projectUrl;
}
/**
*
*/

View File

@ -1,91 +0,0 @@
package com.ruoyi.common.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* ////////////////////////////////////////////////////////////////////
* // _ooOoo_
* // o8888888o
* // 88" . "88
* // (| ^_^ |)
* // O\ = /O
* // ____/`---'\____
* // .' \\| |// `.
* // / \\||| : |||// \
* // / _||||| -:- |||||- \
* // | | \\\ - /// | |
* // | \_| ''\---/'' | |
* // \ .-\__ `-` ___/-. /
* // ___`. .' /--.--\ `. . ___
* // ."" '< `.___\_<|>_/___.' >'"".
* // | | : `- \`.;`\ _ /`;.`/ - ` : | |
* // \ \ `-. \_ __\ /__ _/ .-` / /
* // ========`-.____`-.___\_____/___.-`____.-'========
* // `=---='
* // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* // 佛祖保佑 永无BUG 永不修改
* ////////////////////////////////////////////////////////////////////
*
* @ClassName SmsConfig
* @Description TODO
* @Author QiangZi
* @DateTime 2022/3/31 18:15
* @Version 1.0
*/
@Component
@PropertySource(value = "classpath:message.properties",encoding = "UTF-8")
@ConfigurationProperties(prefix = "sms.jiuwei")
public class SmsConfig {
/**
* url
**/
private String url;
/**
*
*/
private String username;
/**
*
*/
private String password;
/**
* ID
*/
private String productid;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getProductid() {
return productid;
}
public void setProductid(String productid) {
this.productid = productid;
}
}

View File

@ -1,92 +0,0 @@
package com.ruoyi.common.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* Created by tao.
* Date: 2023/3/21 15:02
* :
*/
@Component
@ConfigurationProperties(prefix = "wechat")
public class WechatAccountConfig {
/**
* id
*/
private static String mpAppId;
/**
*
*/
private static String mpAppSecret;
/**
* Token
*/
private static String myToken;
/**
* AccessToken
*/
private static String myAccessToken;
/**
* AppId
*/
private static String wxAppId;
/**
* Secret
*/
private static String wxAppSecret;
public static String getMpAppId() {
return mpAppId;
}
public void setMpAppId(String mpAppId) {
WechatAccountConfig.mpAppId = mpAppId;
}
public static String getMpAppSecret() {
return mpAppSecret;
}
public void setMpAppSecret(String mpAppSecret) {
WechatAccountConfig.mpAppSecret = mpAppSecret;
}
public static String getMyToken() {
return myToken;
}
public void setMyToken(String myToken) {
WechatAccountConfig.myToken = myToken;
}
public static String getMyAccessToken() {
return myAccessToken;
}
public void setMyAccessToken(String myAccessToken) {
WechatAccountConfig.myAccessToken = myAccessToken;
}
public static String getWxAppId() {
return wxAppId;
}
public void setWxAppId(String wxAppId) {
WechatAccountConfig.wxAppId = wxAppId;
}
public static String getWxAppSecret() {
return wxAppSecret;
}
public void setWxAppSecret(String wxAppSecret) {
WechatAccountConfig.wxAppSecret = wxAppSecret;
}
}

View File

@ -1,54 +0,0 @@
package com.ruoyi.common.config;
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
/**
* Created by tao.
* Date: 2023/3/21 15:00
* :
*/
@Component
public class WechatMpConfig {
@Autowired
private WechatAccountConfig accountConfig;
/**
* @author tao
* @date Created in 2021/3/12 10:15
* @param:
* @return WxMpService
* wxMpConfigStorage, WxMpService
*/
@Bean
public WxMpService wxMpService() {
WxMpService wxMpService = new WxMpServiceImpl();
wxMpService.setWxMpConfigStorage(wxMpConfigStorage());
return wxMpService;
}
/**
* @author tao
* @date Created in 2021/3/12 10:20
* @param:
* @return WxMpConfigStorage
* AppIdAppSecretWxMpConfigStorage
*/
@Bean
public WxMpConfigStorage wxMpConfigStorage() {
WxMpInMemoryConfigStorage wxMpConfigStorage = new WxMpInMemoryConfigStorage();
wxMpConfigStorage.setAppId(accountConfig.getMpAppId());
wxMpConfigStorage.setSecret(accountConfig.getMpAppSecret());
wxMpConfigStorage.setToken(accountConfig.getMyToken());
wxMpConfigStorage.setAccessToken(accountConfig.getMyAccessToken());
return wxMpConfigStorage;
}
}

View File

@ -1,14 +0,0 @@
package com.ruoyi.common.constant;
/**
*
*
* @author ruoyi
*/
public class ApiConstants {
/**
* IOTHOST&&
*/
public static final String IOT_SD_HOST = "https://api.e.v1.i-sada.net";
}

View File

@ -41,59 +41,4 @@ public class CacheConstants
* redis key
*/
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
/**
* yanzhu redis key
*/
public static final String YANZHU_SYSTEM_CONFIG = "yanzhu_system_config:";
/**
* yanzhu redis key
*/
public static final String YANZHU_DEVICE_TOWER = "device.tower_cfg:";
/**
* yanzhu redis key
*/
public static final String YANZHU_DEVICE_AI = "device.aibox_cfg:";
/**
* redis key
*/
public static final String WX_MPMESSAGE_KEY = "wx.mpmessage.key::";
/**
* openId
*/
public static final String WX_MPMESSAGE_OPENID = "wx.mpmessage.openId::";
/**
*
*/
public static final String WX_MPMESSAGE_UNAME = "wx.mpmessage.uname::";
/**
*
*/
public static final String WX_MPMESSAGE_PNAME = "wx.mpmessage.pname::";
/**
*
*/
public static final String WX_MPMESSAGE_DNAME = "wx.mpmessage.dname::";
/**
*
*/
public static final String WX_MPMESSAGE_P_SUP = "wx.mpmessage.p.sup::";
/**
*
*/
public static final String WX_MPMESSAGE_P_MAG = "wx.mpmessage.p.mag::";
/**
*
*/
public static final String WX_MPMESSAGE_P_ORG = "wx.mpmessage.p.org::";
}

View File

@ -133,7 +133,7 @@ public class Constants
/**
* 访
*/
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi","com.yanzhu.jh"};
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
/**
*

View File

@ -21,11 +21,6 @@ import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
/**
* web
@ -61,14 +56,6 @@ public class BaseController
PageUtils.startPage();
}
/**
*
*/
protected void startPage(Integer pageNum, Integer pageSize)
{
PageUtils.startPage(pageNum,pageSize);
}
/**
*
*/
@ -104,45 +91,6 @@ public class BaseController
return rspData;
}
/**
* CookieBIDS,b.,
* @return
*/
protected List<Long> getProjectIds(){
String ids=getCookie("__ids__");
List<Long> list=new ArrayList<>();
if(StringUtils.isNotEmpty(ids)){
String[] tmps= ids.split(",");
for(String s:tmps){
if(s.length()>0){
try{
list.add(Long.parseLong(s));
}catch (Exception e){
}
}
}
}
return list;
}
protected HttpServletRequest getRequest(){
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
return servletRequestAttributes.getRequest();
}
protected String getCookie(String key){
Cookie[] cookies =getRequest().getCookies();
if(cookies!=null && cookies.length>0){
for(Cookie cookie :cookies){
if(cookie.getName().toLowerCase().equals(key.toLowerCase())){
return cookie.getValue();
}
}
}
return "";
}
/**
*
*/

View File

@ -3,16 +3,10 @@ package com.ruoyi.common.core.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* Entity
@ -23,24 +17,6 @@ public class BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
public List<Long> getPrjIds() {
return prjIds;
}
public void setPrjIds(List<Long> prjIds) {
this.prjIds = prjIds;
}
/**
* ID,B b.,
*/
private List<Long> prjIds;
/**
*
*/
private String proType;
/** 搜索值 */
@JsonIgnore
private String searchValue;
@ -66,9 +42,6 @@ public class BaseEntity implements Serializable
private String nowRole;
private String nowDept;
private String nowUser;
private String nowUserName;
private String projectDeptId;
private String comment;
/** 请求参数 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@ -166,30 +139,6 @@ public class BaseEntity implements Serializable
this.activeName = activeName;
}
public String getNowUserName() {
return nowUserName;
}
public void setNowUserName(String nowUserName) {
this.nowUserName = nowUserName;
}
public String getProjectDeptId() {
return projectDeptId;
}
public void setProjectDeptId(String projectDeptId) {
this.projectDeptId = projectDeptId;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Map<String, Object> getParams()
{
if (params == null)
@ -203,22 +152,4 @@ public class BaseEntity implements Serializable
{
this.params = params;
}
public String getProType() {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
if(servletRequestAttributes==null){
return "";
}
RequestContextHolder.setRequestAttributes(servletRequestAttributes,true);
HttpServletRequest request = servletRequestAttributes.getRequest();
String str= request.getHeader("proType");
if("0".equals(str)){
str="";
}
return str;
}
public void setProType(String proType) {
this.proType = proType;
}
}

View File

@ -37,9 +37,6 @@ public class SysUser extends BaseEntity
@Excel(name = "用户名称")
private String nickName;
/** 用户类型 */
private String userType;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
@ -300,14 +297,6 @@ public class SysUser extends BaseEntity
this.roleId = roleId;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -27,11 +27,6 @@ public class LoginBody
*/
private String uuid;
/**
* ID
*/
private String openId;
public String getUsername()
{
return username;
@ -71,12 +66,4 @@ public class LoginBody
{
this.uuid = uuid;
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
}

View File

@ -1,39 +0,0 @@
package com.ruoyi.common.enums;
public enum DeptTypeEnum {
JTGS("1", "泾河产业发展集团"),
ZGS("11", "发展集团子公司"),
JLDW("4", "监理单位"),
ZBDW("2", "总包单位"),
FBDW("3", "分包单位"),
JTGSTYPE("3", "泾河产业发展集团"),
ZGSTYPE("4", "发展集团子公司"),
JFDBTYPE("5", "甲方代表"),
JLDWTYPE("6", "监理单位"),
ZBDWTYPE("7", "总包单位"),
FBDWTYPE("8", "分包单位"),
COMFLAG("1","子公司标识");
private final String code;
private final String info;
DeptTypeEnum(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -1,36 +0,0 @@
package com.ruoyi.common.enums;
/**
* Http
*
* @author JiangYuQi
*/
public enum HttpStatusEnum {
ERROR(11110, "AppId不存在或已被删除"),
DISABLE(11112, "AppId已被停用"),
SINGET_ERROR(11113, "签名值不正确"),
SINGET_TIMEOUT(11114, "签名数据已过期"),
SINGET_EXCEPTION(11115, "签名数据解密异常"),
DARA_EXCEPTION(11116, "数据解析异常");
private final Integer code;
private final String info;
HttpStatusEnum(Integer code, String info)
{
this.code = code;
this.info = info;
}
public Integer getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -1,51 +0,0 @@
package com.ruoyi.common.enums;
/**
*
*
* @author JiangYuQi
*/
public enum MessageTypeEnum {
AQYHZG("10", "安全隐患整改"),
ZLYHZG("20", "质量隐患整改"),
CSCLSP("30", "实测实量审批"),
JPYSSP("40", "举牌验收审批"),
CLFYSP("50", "材料封样审批"),
QYFSSP("60", "取样复试审批"),
GCSPCSBL("70", "办理工程审批超时提醒"),
GCSPCSCS("80", "抄送工程审批超时提醒"),
YHZGCSGZ("90", "隐患整改超时通知"),
YHFJCSGZ("100", "隐患复检超时通知"),
LZYJSP("110", "劳资预警审批"),
LZYJCSTZ("120", "劳资预警审批超时"),
GCGNJY("130", "工程功能检验审批");
//工作流审批由ProcDefKey组成
private final String code;
private final String name;
MessageTypeEnum(String code, String name)
{
this.code = code;
this.name = name;
}
public String getCode()
{
return code;
}
public String getName()
{
return name;
}
public static String getYHPCLX(Long infoType){
if(infoType==0){
return MessageTypeEnum.AQYHZG.code;
}else{
return MessageTypeEnum.ZLYHZG.code;
}
}
}

View File

@ -1,62 +0,0 @@
package com.ruoyi.common.enums;
/**
*
*/
public enum PublicStateEnum {
YES("Y", "YES"),
NO("N", "NO"),
OK("0", "正常"),
DISABLE("1", "停用"),
DELETED("2", "删除"),
HG("1","合格"),
BHG("2","不合格"),
USERTYPE_JFJL("21", "甲方经理"),
/**********************************项目验收***************************************/
PROJECT_CHECK_TYPE_JPYS("1", "举牌验收"),
PROJECT_CHECK_POSITION_TYPE("1", "默认工序部位类型"),
/**********************************项目验收***************************************/
/**********************************审批相关***************************************/
AUDIT_TYPE_QYFS("1", "取样复试"),
AUDIT_TYPE_CLFY("4", "材料封样"),
AUDIT_TYPE_JPYS("3", "举牌验收"),
AUDIT_TYPE_SCSL("2", "实测实量"),
AUDIT_TYPE_GCGNJY("5", "工程功能检验"),
AUDITINFO_DSH("1", "待审核"),
AUDITINFO_SHBH("3", "审核驳回"),
AUDITINFO_SHTG("4", "审核通过"),
/**********************************审批相关***************************************/
/**********************************视频设备***************************************/
VIDEO_ONLINE("1", "在线"),
VIDEO_OFFLINE("2", "离线"),
VIDEO_UNKNOWN("3", "未知"),
/**********************************视频设备***************************************/
/**********************************材料进场取样复试***************************************/
CHECK_STATE_SJ("1", "送检中"),
/**********************************材料进场取样复试***************************************/
COMZGS("1","子公司状态标识");
private final String code;
private final String info;
PublicStateEnum(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -1,38 +0,0 @@
package com.ruoyi.common.enums;
import com.ruoyi.common.core.text.Convert;
/**
*
*
* @author JiangYuQi
*/
public enum ShiFouEnum {
FOU("0", "否"), SHI("1", "是");
private final String code;
private final String info;
ShiFouEnum(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
public Long getLongCode()
{
return Convert.toLong(code);
}
}

View File

@ -1,7 +1,5 @@
package com.ruoyi.common.enums;
import com.ruoyi.common.core.text.Convert;
public enum SysRoleEnum {
ADMIN("1", "admin"),
@ -11,9 +9,6 @@ public enum SysRoleEnum {
JLDW("5", "监理单位"),
ZBDW("6", "总包单位"),
FBDW("7", "分包单位"),
JLDWGR("15", "监理单位"),
ZBDWGR("16", "总包单位"),
FBDWGR("17", "分包单位"),
COMMON("99", "普通角色");
private final String code;
@ -30,11 +25,6 @@ public enum SysRoleEnum {
return code;
}
public Long getLongCode()
{
return Convert.toLong(code);
}
public String getInfo()
{
return info;

View File

@ -1,25 +1,24 @@
package com.ruoyi.common.enums;
/**
*
*
*
* @author ruoyi
*/
public enum ApplyCfgTypeEnum {
public enum SysStatusEnum {
LABOUR("1", "劳务人员信息接入"),
AIBOXS("2", "视频智能预警接入");
OK(0L, "正常"), DISABLE(1L, "停用"), DELETED(2L, "删除");
private final String code;
private final Long code;
private final String info;
ApplyCfgTypeEnum(String code, String info)
SysStatusEnum(Long code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
public Long getCode()
{
return code;
}

View File

@ -1,37 +0,0 @@
package com.ruoyi.common.enums;
/**
*
*
* @author JiangYuQi
*/
public enum TemplateMessageEnum {
SERVER_ERROR("_YCnCRtgbtFNNg_78koc8nbFl2gWjeaWFHXV7WV1if8","服务异常通知"),
TROUBLE_SUBMIT("f3saBGJCnUAjXHw1KooxEQOOiKEHlQxLIK-sPDgoL_E", "隐患整改通知"),
TROUBLE_HANDLE("6mGOWPXS3l5a5fzXd9GIV9_IkEfZmeJ_6G2P_SQkWnU", "隐患处理完成通知"),
ROUBLE_EXPIRED_ZG("f3saBGJCnUAjXHw1KooxESpSdHMrh5liznpsbWZV8oA", "隐患整改超时通知"),
ROUBLE_EXPIRED_FJ("f3saBGJCnUAjXHw1KooxESpSdHMrh5liznpsbWZV8oA", "隐患复检超时通知"),
APPLY_DEFAULT("KY7oAHgqFxUSaE3ByxFJfv_0U3LnSWfgUCwV-CZyEdo", "系统流程审批提醒"),
APPLY_EXPIRED_MY("MUAXGjyaNE-maYn6XSNycRfZfPtdVTxubqlT8lHcYqw", "办理流程审批超时提醒"),
APPLY_EXPIRED_COPY("MUAXGjyaNE-maYn6XSNyceRFN9h8nfIjKvyZTOLnKDE", "抄送流程审批超时提醒");
private final String id;
private final String name;
TemplateMessageEnum(String id, String name)
{
this.id = id;
this.name = name;
}
public String getId()
{
return id;
}
public String getName()
{
return name;
}
}

View File

@ -1,18 +1,18 @@
package com.ruoyi.common.enums;
/**
*
*
*
*
* @author ruoyi
*/
public enum VendorsCodeEnum {
YANZHU("yanzhu", "研筑");
public enum UserStatus
{
OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
private final String code;
private final String info;
VendorsCodeEnum(String code, String info)
UserStatus(String code, String info)
{
this.code = code;
this.info = info;
@ -27,5 +27,4 @@ public enum VendorsCodeEnum {
{
return info;
}
}

View File

@ -1,30 +0,0 @@
package com.ruoyi.common.enums;
/**
*
* @author JiangYuQi
*/
public enum UserTypeEnum {
SYSTEM("00","系统用户"),
APPLY("99","应用用户");
private final String code;
private final String info;
UserTypeEnum(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -1,34 +0,0 @@
package com.ruoyi.common.enums;
/**
*
* @author ruoyi
*/
public enum WorkJournalismEnum {
DFB("1", "待发布"),
YFB("2", "已发布"),
YCH("3", "已撤回"),
YZD("1", "已置顶"),
BZD("0", "不置顶");
private final String code;
private final String info;
WorkJournalismEnum(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -1,206 +0,0 @@
/*
* Copyright (c) 2016-2021. 西 All rights reserved.
*/
package com.ruoyi.common.utils;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.utils.sign.Md5Utils;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Cipher;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* RSA
**/
public class AuthRsaUtils {
// Rsa 私钥
public static String privateKey = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMwgEvQL6w3ahkRoKxxzyBoSNe/zsX8aCaXhdyMWZZrDzFDS9/AbNjrB0bp5MwtbQVXcZJLGzaWxUmeuOQc0CeoWgwafdEdweesiUCbj4Au3xLitDVMiCrO5qy5XKRSQa6dMNjMARw5tORnvRlOiPypDBEKSyR+BtQiLDhelepLZAgMBAAECgYBO9nleft3G1inqfIFw2DkoHLNQx2x6RpBE4xs7L4bOf7+h5HqVH3Gy+Rcwk4HzerGjjUY6oT0cQ6QlB3h4GOFcQq/fN79eOKd8KwgPq+e0l/dFXDI4TAJJ61nY40zwl/KlzdRRKF4KIrM8YmA74YhjG92p6KyxBdx8QMM7NkshIQJBAP+5AXa35n/9aoENfCGr5IDoCIqOUoaOEoNGQ+DcvEW2Z443gHZ6B4QLZcMhtvn+7YQHXXjUhAw4A23dIG83ZvsCQQDMWL5lvbETU6iXhhfbF08LHqI0g83QIYckvt1ndMcTgDKR3b+T6CUJCI2VHR3kOrJ77jcIHd65nP0QRXG+ZdU7AkEAnYml4zNL5xGBaVubW0sADIHlsSYYpRglQ4YoDwEtY20Jws1icJqgwrIa0OmWRdDNFgdLiEKzzqs7QZV2g82HvQJAZLgA8Ei09J+xYy3WqEguz35D2Lp2QPWllLj2i72FOdlgE4FGofIz/uXWUv7M8ubzfh4FxdxjIP19xf1UeNHcbQJBAN53AtJB671xNU+4WBfC/hX/L45Y+kc2zkxFXDFopdbIXzoVoC2pA9urze2B8+azWWTPfqv6i620SSflHEvls2Q=";
// Rsa 公钥
public static String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMIBL0C+sN2oZEaCscc8gaEjXv87F/Ggml4XcjFmWaw8xQ0vfwGzY6wdG6eTMLW0FV3GSSxs2lsVJnrjkHNAnqFoMGn3RHcHnrIlAm4+ALt8S4rQ1TIgqzuasuVykUkGunTDYzAEcObTkZ70ZToj8qQwRCkskfgbUIiw4XpXqS2QIDAQAB";
/**
*
*
* @param text
* @return
*/
public static String decryptByPrivateKey(String text) throws Exception {
return decryptByPrivateKey(privateKey, text);
}
/**
*
*
* @param publicKeyString
* @param text
* @return
*/
public static String decryptByPublicKey(String publicKeyString, String text) throws Exception {
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, publicKey);
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
return new String(result);
}
/**
*
*
* @param privateKeyString
* @param text
* @return
*/
public static String encryptByPrivateKey(String privateKeyString, String text) throws Exception {
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
byte[] result = cipher.doFinal(text.getBytes());
return Base64.encodeBase64String(result);
}
/**
*
*
* @param privateKeyString
* @param text
* @return
*/
public static String decryptByPrivateKey(String privateKeyString, String text) throws Exception {
PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
return new String(result);
}
/**
*
*
* @param publicKeyString
* @param text
* @return
*/
public static String encryptByPublicKey(String publicKeyString, String text) throws Exception {
X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] result = cipher.doFinal(text.getBytes());
return Base64.encodeBase64String(result);
}
/**
* RSA
*
* @return
*/
public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(1024);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
String publicKeyString = Base64.encodeBase64String(rsaPublicKey.getEncoded());
String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded());
return new RsaKeyPair(publicKeyString, privateKeyString);
}
/**
* RSA
*/
public static class RsaKeyPair {
private final String publicKey;
private final String privateKey;
public RsaKeyPair(String publicKey, String privateKey) {
this.publicKey = publicKey;
this.privateKey = privateKey;
}
public String getPublicKey() {
return publicKey;
}
public String getPrivateKey() {
return privateKey;
}
}
public static void main(String[] args) {
// try {
// RsaKeyPair rsaKeyPair = generateKeyPair();
// System.out.println("私钥:" + rsaKeyPair.getPrivateKey());
// System.out.println("公钥:" + rsaKeyPair.getPublicKey());
// } catch (NoSuchAlgorithmException e) {
// throw new RuntimeException(e);
// }
try {
//String timestamp = String.valueOf(System.currentTimeMillis());
String timestamp = "1705165273935";
//String str = "jhcf170515993052073qrDFKJmk001" + timestamp;
// Map<String,Object> map = new HashMap<>();
// map.put("serverid","123");
// map.put("companyName","测试名称");
// String str = JSON.toJSONString(map);
List<Object> list = new ArrayList<>();
Map<String,Object> map1 = new HashMap<>();
map1.put("serverid","1231");
map1.put("companyName","测试名称1");
list.add(map1);
Map<String,Object> map2 = new HashMap<>();
map2.put("serverid","1232");
map2.put("companyName","测试名称2");
list.add(map2);
Map<String,Object> map3 = new HashMap<>();
map3.put("serverid","1233");
map3.put("companyName","测试名称3");
list.add(map3);
Map<String,Object> map4 = new HashMap<>();
map4.put("serverid","1234");
map4.put("companyName","测试名称4");
list.add(map4);
String str = JSON.toJSONString(list);
System.out.println("明文信息:" + str);
str = Md5Utils.hash(str)+timestamp;
// 公钥加密->私钥解密
String encryptByPublicKeyStr = encryptByPublicKey(publicKey, str);
System.out.println("公钥加密:" + encryptByPublicKeyStr);
String decryptByPrivateKeyStr = decryptByPrivateKey(privateKey, encryptByPublicKeyStr);
System.out.println("私钥解密:" + decryptByPrivateKeyStr);
System.out.println("***********************************");
// 私钥加密->公钥解密
String encryptByPrivateKeyStr = encryptByPrivateKey(privateKey, str);
System.out.println("私钥加密:" + encryptByPrivateKeyStr);
String decryptByPublicKeyStr = decryptByPublicKey(publicKey, encryptByPrivateKeyStr);
System.out.println("公钥解密:" + decryptByPublicKeyStr);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -8,10 +8,7 @@ import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import org.apache.commons.lang3.time.DateFormatUtils;
/**
@ -29,8 +26,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = {
@ -193,30 +188,4 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
public static Date[] getCurrentWeekDate() {
Calendar calendar = Calendar.getInstance();
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8"));
//start of the week
if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
calendar.add(Calendar.DAY_OF_YEAR, -1);
}
calendar.add(Calendar.DAY_OF_WEEK, -(calendar.get(Calendar.DAY_OF_WEEK) - 2));
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
//String startTime = conversion(calendar.getTimeInMillis());
Date dtStart=calendar.getTime();
//end of the week
calendar.add(Calendar.DAY_OF_WEEK, 6);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
//String endTime = conversion(calendar.getTimeInMillis());
Date dtEnd=calendar.getTime();
return new Date[]{dtStart,dtEnd};
}
}

View File

@ -1,242 +0,0 @@
package com.ruoyi.common.utils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
public class ExcelUtils {
/**
*
* @param wb
* @return
*/
public static CellStyle createTitleCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);//居于底部
//cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// cellStyle.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());//背景颜色
Font headerFont1 = wb.createFont(); // 创建字体样式
headerFont1.setBold(true); //字体加粗
headerFont1.setFontName("宋体"); // 设置字体类型
headerFont1.setFontHeightInPoints((short) 15); // 设置字体大小
cellStyle.setFont(headerFont1); // 为标题样式设置字体样式
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createHeadCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setWrapText(true);// 设置自动换行
// cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景颜色
cellStyle.setAlignment(HorizontalAlignment.CENTER); //水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //垂直对齐
//cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// cellStyle.setBottomBorderColor(IndexedColors.BLACK.index);
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
Font headerFont = wb.createFont(); // 创建字体样式
// headerFont.setBold(true); //字体加粗
headerFont.setFontName("宋体"); // 设置字体类型
headerFont.setFontHeightInPoints((short) 10); // 设置字体大小
cellStyle.setFont(headerFont); // 为标题样式设置字体样式
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentRightCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.RIGHT);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentWeightCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.LEFT);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setBold(true); //字体加粗
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentWeightRightCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.RIGHT);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景颜色
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setBold(true); //字体加粗
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentWeightCenterCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景颜色
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setBold(true); //字体加粗
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentNoBorderCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.LEFT);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle myCreateContentCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
cellStyle.setFillBackgroundColor(IndexedColors.YELLOW.getIndex());
cellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());//背景颜色
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle myCreateTitleCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);//居于底部
cellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());//背景颜色
cellStyle.setFillBackgroundColor(IndexedColors.YELLOW.getIndex());
Font headerFont1 = wb.createFont(); // 创建字体样式
headerFont1.setBold(true); //字体加粗
headerFont1.setFontName("宋体"); // 设置字体类型
headerFont1.setFontHeightInPoints((short) 15); // 设置字体大小
cellStyle.setFont(headerFont1); // 为标题样式设置字体样式
return cellStyle;
}
}

View File

@ -1,33 +0,0 @@
package com.ruoyi.common.utils;
/**
*
*
* @author JiangYuQi
* @date 2023-11-07
*/
public class NoUtils {
private static final String PREFIX = "jhcf";
private static int COUNTER = 0;
/**
* appId
*
* @author JiangYuQi
* @date 2023-11-07
*/
public static String createAppId() {
long timestamp = System.currentTimeMillis();
String sequencePart = String.format("%03d", getContractNextSequence());
return PREFIX + timestamp+ StringUtils.randomString(10) + sequencePart;
}
private static synchronized int getContractNextSequence() {
if (COUNTER >= 999) {
COUNTER = 0;
}
return ++COUNTER;
}
}

View File

@ -1,16 +1,12 @@
package com.ruoyi.common.utils;
import com.ruoyi.common.core.domain.entity.SysRole;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import java.util.List;
/**
*
*
@ -25,7 +21,7 @@ public class SecurityUtils
{
try
{
return getLoginUser().getUserId();
return getLoginUser().getUserId();
}
catch (Exception e)
{
@ -33,24 +29,6 @@ public class SecurityUtils
}
}
public static long getRoleId(){
try
{
List<SysRole> list= getLoginUser().getUser().getRoles();
long roleId= list.get(0).getRoleId();
for(SysRole role :list){
if(role.getRoleId()<roleId){
roleId=role.getRoleId();
}
}
return roleId;
}
catch (Exception e)
{
return 0;
}
}
/**
* ID
**/
@ -73,8 +51,7 @@ public class SecurityUtils
{
try
{
LoginUser loginUser=getLoginUser();
return loginUser!=null?loginUser.getUsername():null;
return getLoginUser().getUsername();
}
catch (Exception e)
{
@ -89,11 +66,7 @@ public class SecurityUtils
{
try
{
Authentication auth=getAuthentication();
if(auth!=null) {
return (LoginUser) auth.getPrincipal();
}
return null;
return (LoginUser) getAuthentication().getPrincipal();
}
catch (Exception e)
{
@ -106,8 +79,7 @@ public class SecurityUtils
*/
public static Authentication getAuthentication()
{
SecurityContext ctx=SecurityContextHolder.getContext();
return ctx!=null? SecurityContextHolder.getContext().getAuthentication():null;
return SecurityContextHolder.getContext().getAuthentication();
}
/**
@ -145,17 +117,4 @@ public class SecurityUtils
{
return userId != null && 1L == userId;
}
/**
*
* @return role
*/
public Long getUserFirstRole(){
return getLoginUser().getUser().getRoles().stream().mapToLong(r->r.getRoleId()).min().getAsLong();
}
public static boolean isUserB() {
long roleId=getRoleId();
return 5==roleId || 6==roleId || 7==roleId || 99==roleId || 15==roleId || 16==roleId || 17==roleId;
}
}

View File

@ -1,88 +0,0 @@
package com.ruoyi.common.utils;
import com.ruoyi.common.config.SmsConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
/**
* ////////////////////////////////////////////////////////////////////
* // _ooOoo_
* // o8888888o
* // 88" . "88
* // (| ^_^ |)
* // O\ = /O
* // ____/`---'\____
* // .' \\| |// `.
* // / \\||| : |||// \
* // / _||||| -:- |||||- \
* // | | \\\ - /// | |
* // | \_| ''\---/'' | |
* // \ .-\__ `-` ___/-. /
* // ___`. .' /--.--\ `. . ___
* // ."" '< `.___\_<|>_/___.' >'"".
* // | | : `- \`.;`\ _ /`;.`/ - ` : | |
* // \ \ `-. \_ __\ /__ _/ .-` / /
* // ========`-.____`-.___\_____/___.-`____.-'========
* // `=---='
* // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* // 佛祖保佑 永无BUG 永不修改
* ////////////////////////////////////////////////////////////////////
*
* @ClassName SMSUtils
* @Description
* @Author QiangZi
* @DateTime 2022/3/10 17:51
* @Version 1.0
*/
@Component
public class SmsUtils {
private static SmsConfig smsConfig;
/**
* @param phoneNumber
* @param message
* @return boolean
* @throws
* @Author QiangZi
* @Description
* @Date 2022/3/10 17:53
**/
public static boolean sendMsg(String phoneNumber, String message) {
boolean result = false;
try {
StringBuffer sb = new StringBuffer(smsConfig.getUrl());
sb.append("?username=").append(smsConfig.getUsername());
sb.append("&password=").append(smsConfig.getPassword());
sb.append("&productid=").append(smsConfig.getProductid());
sb.append("&mobile=" + phoneNumber);
//sb.append("&dstime="+URLEncoder.encode("2015-01-01 14:41:00", "utf-8"));
sb.append("&content=" + URLEncoder.encode(message, "utf-8"));
URL url = new URL(sb.toString());
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");//or set POST
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputline = in.readLine();
System.out.println("SEND_MSG_XSMS===" + inputline);
String code = inputline.split(",")[0];
result = code.equals("1");
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
@Autowired
public void setSmsConfig(SmsConfig smsConfig) {
SmsUtils.smsConfig = smsConfig;
}
}

View File

@ -1,7 +1,11 @@
package com.ruoyi.common.utils;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.util.AntPathMatcher;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.text.StrFormatter;
@ -140,17 +144,6 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return !isNull(object);
}
/**
* *
*
* @param object Object
* @return true false
*/
public static boolean isNotEmpty(Object object)
{
return !isNull(object) && !"".equals(object);
}
/**
* * Java
*
@ -170,28 +163,6 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return (str == null ? "" : str.trim());
}
/**
*
*
* @param obj1 1
* @param obj2 2
* @return value
*/
public static boolean eqObj(Object obj1, Object obj2)
{
if(obj1==null && obj2==null){
return true;
}else{
if(obj1==null){
return false;
}
if(obj2==null){
return false;
}
return obj1.toString().equals(obj2.toString());
}
}
/**
*
*
@ -640,27 +611,4 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
}
return sb.toString();
}
private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
/**
*
*
* @param length
* @return
*/
public static String randomString(int length) {
if (length < 1) {
length = 1;
}
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++) {
int randomIndex = random.nextInt(CHARACTERS.length());
char randomChar = CHARACTERS.charAt(randomIndex);
sb.append(randomChar);
}
String randomString = sb.toString();
return randomString;
}
}

View File

@ -1,16 +1,9 @@
package com.ruoyi.common.utils.file;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Base64;
import java.util.List;
import java.util.Objects;
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.io.FileUtil;
import org.apache.commons.io.FilenameUtils;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig;
@ -32,17 +25,12 @@ public class FileUploadUtils
/**
* 50M
*/
public static final long DEFAULT_MAX_SIZE = 200 * 1024 * 1024;
/**
* 1M
*/
public static final long API_PROFILE_MAX_SIZE = 1 * 1024 * 1024;
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
/**
* 100
*/
public static final int DEFAULT_FILE_NAME_LENGTH = 200;
public static final int DEFAULT_FILE_NAME_LENGTH = 100;
/**
*
@ -98,30 +86,6 @@ public class FileUploadUtils
}
}
/**
*
*
* @param baseDir
* @param file []
* @return
* @throws IOException
*/
public static final String uploadImages(String baseDir, MultipartFile file) throws IOException
{
try
{
if (file.getSize() > API_PROFILE_MAX_SIZE)
{
throw new FileSizeLimitExceededException(1);
}
return upload(baseDir, file, MimeTypeUtils.IMAGE_EXTENSION);
}
catch (Exception e)
{
throw new IOException(e.getMessage(), e);
}
}
/**
*
*
@ -150,69 +114,16 @@ public class FileUploadUtils
String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
file.transferTo(Paths.get(absPath));
makeMiniImage(absPath);
return getPathFileName(baseDir, fileName);
}
private static void makeMiniImage(String absPath) {
try {
String ext = FileUtils.getFileExt(absPath).toLowerCase();
String exts = Arrays.toString(new String[]{"jpg", "jpeg", "png", "bmp"});
if (exts.contains(ext)) {
if (new File(absPath).exists()) {
int w = ImgUtil.read(FileUtil.file(absPath)).getWidth();
if(w>2000) {
ImgUtil.scale(FileUtil.file(absPath),
FileUtil.file(absPath), (float) (2000.0 / w));
}
ImgUtil.scale(FileUtil.file(absPath),
FileUtil.file(absPath + ".1000.jpg"), (float) (1000.0 / w));
ImgUtil.scale(FileUtil.file(absPath),
FileUtil.file(absPath + ".min.jpg"), (float) (300.0 / w));
}
}
}catch (Exception ex){
ex.printStackTrace();
}
}
public static void minPath(String path){
List<File> list= FileUtil.loopFiles(path);
for(File f :list){
String p=f.getAbsolutePath().toLowerCase();
if(p.endsWith(".min.jpg")||p.endsWith(".1000.jpg")){
continue;
}
System.out.println(f.getAbsolutePath());
makeMiniImage(f.getAbsolutePath());
}
}
/**
*
*/
public static final String extractFilename(MultipartFile file)
{
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
FilenameUtils.getBaseName(getYzFilename(file.getOriginalFilename())), Seq.getId(Seq.uploadSeqType), getExtension(file));
}
/**
*
* @param fileName
* @return
*/
public static final String getYzFilename(String fileName){
// 定义正则表达式,匹配除了字母和数字以外的任何字符
String regex = "[#%\\[\\]&',;=?$()]";
// 使用指定的替换字符替换非法字符
String replacedString = fileName.replaceAll(regex,"").replaceAll("__","");
return replacedString;
}
public static void main(String[] args) {
String s = " 3#、6#楼塔吊单位及人员资质报审____________________[asd]20240621095052A847.pdf";
System.out.println(getYzFilename(s));
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
}
public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException

View File

@ -104,27 +104,6 @@ public class FileUtils
return FileUploadUtils.getPathFileName(uploadDir, pathName);
}
public static String writeBytes(byte[] data, String uploadDir,String fileName) throws IOException
{
FileOutputStream fos = null;
String pathName = "";
try
{
String extension = getFileExtendName(data);
pathName = DateUtils.datePath() + "/" + fileName;
File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName);
if(file.exists()){
file.delete();
}
fos = new FileOutputStream(file);
fos.write(data);
}
finally
{
IOUtils.close(fos);
}
return FileUploadUtils.getPathFileName(uploadDir, pathName);
}
/**
*
*

View File

@ -17,7 +17,7 @@ public class MimeTypeUtils
public static final String IMAGE_GIF = "image/gif";
public static final String[] IMAGE_EXTENSION = { "jpg", "jpeg", "png" };
public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" };
public static final String[] FLASH_EXTENSION = { "swf", "flv" };

View File

@ -1,33 +0,0 @@
package com.ruoyi.common.utils.file;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.Base64;
/**
* JiangYuQi
*/
public class MultipartFileUtils {
/**
* Base64
* @param
* @return
*/
public static MultipartFile base64ToMultipartFile(String base64) throws IOException {
String[] parts = base64.split(",");
if(parts.length>1){
String contentType = parts[0].split(";")[0].split(":")[1];
byte[] bytes = Base64.getDecoder().decode(parts[1]);
return new MockMultipartFile("file","file."+contentType.split("/")[1], contentType, bytes);
}else{
//默认格式为jpeg
String contentType = "image/jpeg";
byte[] bytes = Base64.getDecoder().decode(base64);
return new MockMultipartFile("file", "file"+contentType.split("/")[1], contentType, bytes);
}
}
}

View File

@ -1,522 +0,0 @@
package com.ruoyi.common.utils.http;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.Consts;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* HttpClient
*
* @author: xingxixingzhe
* @date: 2023/9/25 14:18
*/
@Slf4j
public class HttpClientUtil {
public static final String HTTP_CHARSET = "utf-8";
private static final String CONTENTTYPE = "Content-Type";
/**
* get
*
* @param url
* @param headers null
* @return String
*/
public static String doGet(String url, Map<String, String> headers) {
// 创建HttpClient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建HttpResponse对象
CloseableHttpResponse response = null;
log.info("request param info : {}", url);
log.info("request header info : {}", headers);
try {
try {
// 创建HttpPost对象
HttpGet get = new HttpGet(url);
// 封装请求头
if (null != headers) {
headers.keySet().forEach(key -> {
get.addHeader(key, headers.get(key));
});
}
response = httpClient.execute(get);
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
log.info("response info : {}", result);
return result;
} catch (IOException e) {
log.error("get链接失败" + e.getMessage());
} finally {
// 释放连接
if (response != null) {
response.close();
}
}
} catch (IOException e) {
log.error("get关闭response失败" + e.getMessage());
}
return null;
}
/**
* get
*
* @param url
* @param headers null
* @param paramMap
* @return String
*/
public static String doGetQueryParams(String url, Map<String, String> headers, Map<String, Object> paramMap) {
// 创建HttpClient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建HttpResponse对象
CloseableHttpResponse response = null;
StringBuilder urlTemp = new StringBuilder(url);
if (null != paramMap && paramMap.size() > 0) {
int index = 0;
for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
if (index == 0) {
urlTemp.append("?").append(entry.getKey()).append("=").append(entry.getValue());
} else {
urlTemp.append("&").append(entry.getKey()).append("=").append(entry.getValue());
}
index++;
}
}
url = urlTemp.toString();
log.info("request param info : {}", url);
log.info("request header info : {}", headers);
try {
try {
// 创建HttpPost对象
HttpGet get = new HttpGet(url);
// 封装请求头
if (null != headers) {
headers.keySet().forEach(key -> {
get.addHeader(key, headers.get(key));
});
}
response = httpClient.execute(get);
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
log.info("response info : {}", result);
return result;
} catch (IOException e) {
log.error("get链接失败" + e.getMessage());
} finally {
// 释放连接
if (response != null) {
response.close();
}
}
} catch (IOException e) {
log.error("get关闭response失败" + e.getMessage());
}
return null;
}
/**
* get
*
* @param url
* @param headers null
* @param downloadPath
* @return String
*/
public static String doGetDownloadSaveLocal(String url, Map<String, String> headers, String downloadPath) {
// 创建HttpClient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建HttpResponse对象
CloseableHttpResponse response = null;
log.info("request param info : {}", url);
log.info("request header info : {}", headers);
try {
try {
// 创建HttpPost对象
HttpGet get = new HttpGet(url);
// 封装请求头
if (null != headers) {
headers.keySet().forEach(key -> {
get.addHeader(key, headers.get(key));
});
}
response = httpClient.execute(get);
// 获取下载文件流
InputStream inputStream = response.getEntity().getContent();
// 获取下载文件的文件名,此处的 File-Name 头信息,需要在服务端进行自定义
Header header = response.getFirstHeader("Content-Disposition");
String fileName = header.getValue();
fileName = StringUtils.substringAfter(fileName, "=");
fileName = System.currentTimeMillis() + fileName;
log.info("下载的文件名称:" + fileName);
File file = new File(downloadPath + fileName);
file.getParentFile().mkdirs();
FileOutputStream fileOut = new FileOutputStream(file);
byte[] buffer = new byte[2048];
int ch = 0;
while ((ch = inputStream.read(buffer)) != -1) {
fileOut.write(buffer, 0, ch);
}
inputStream.close();
fileOut.flush();
fileOut.close();
return file.getPath();
} catch (IOException e) {
log.error("get链接失败" + e.getMessage());
} finally {
// 释放连接
if (response != null) {
response.close();
}
}
} catch (IOException e) {
log.error("get关闭response失败" + e.getMessage());
}
return null;
}
/**
* get
*
* @param url
* @param headers null
* @param connectTimeout
* @param connectionRequestTimeout
* @param socketTimeout
* @return String
*/
public static String doGet(String url, Map<String, String> headers,
int connectTimeout, int connectionRequestTimeout, int socketTimeout) {
// 创建HttpClient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建HttpResponse对象
CloseableHttpResponse response = null;
log.info("request param info : {}", url);
log.info("request header info : {}", headers);
try {
try {
// 创建HttpPost对象
HttpGet get = new HttpGet(url);
get.setConfig(RequestConfig.custom()
.setConnectTimeout(connectTimeout)
.setConnectionRequestTimeout(connectionRequestTimeout)
.setSocketTimeout(socketTimeout).build());
// 封装请求头
if (null != headers) {
headers.keySet().forEach(key -> {
get.addHeader(key, headers.get(key));
});
}
response = httpClient.execute(get);
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
log.info("response info : {}", result);
return result;
} catch (IOException e) {
log.error("get链接失败" + e.getMessage());
} finally {
// 释放连接
if (response != null) {
response.close();
}
}
} catch (IOException e) {
log.error("get关闭response失败" + e.getMessage());
}
return null;
}
/**
* post bodyjson
*
* @param url
* @param headers null
* @param body json
* @param connectTimeout
* @param connectionRequestTimeout
* @param socketTimeout
* @return String
* @author: lll
* @date: 20221121 14:11:49
*/
public static String doPost(String url, Map<String, String> headers, String body,
int connectTimeout, int connectionRequestTimeout, int socketTimeout) {
// 创建HttpClient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建HttpResponse对象
CloseableHttpResponse response = null;
log.info("request param info : {}", body);
log.info("request header info : {}", headers);
try {
try {
// 创建HttpPost对象
HttpPost post = new HttpPost(url);
post.setConfig(RequestConfig.custom()
.setConnectTimeout(connectTimeout)
.setConnectionRequestTimeout(connectionRequestTimeout)
.setSocketTimeout(socketTimeout)
.build());
// 封装请求头
if (null != headers) {
headers.keySet().forEach(key -> {
post.addHeader(key, headers.get(key));
});
}
post.addHeader(HTTP.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
// 封装请求体
if (StringUtils.isNotBlank(body)) {
// 请求体主要封装在HttpEntity中
post.setEntity(new StringEntity(body, Charset.forName(HTTP_CHARSET)));
}
response = httpClient.execute(post);
// 处理响应
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
log.info("response info : {}", result);
return result;
} catch (IOException e) {
log.error("post链接失败" + e.getMessage());
} finally {
// 释放连接
if (response != null) {
response.close();
}
}
} catch (IOException e) {
log.error("post关闭response失败" + e.getMessage());
}
return null;
}
/**
* post bodyjson
*
* @param url
* @param headers null
* @param body json
* @return String
*/
public static String doPost(String url, Map<String, String> headers, String body) {
// 创建HttpClient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建HttpResponse对象
CloseableHttpResponse response = null;
log.info("request header url : {}", url);
log.info("request param body : {}", body);
log.info("request header headers : {}", headers);
try {
try {
// 创建HttpPost对象
HttpPost post = new HttpPost(url);
// 封装请求头
if (null != headers) {
headers.keySet().forEach(key -> {
post.addHeader(key, headers.get(key));
});
}
post.addHeader(HTTP.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
// 封装请求体
if (StringUtils.isNotBlank(body)) {
// 请求体主要封装在HttpEntity中
post.setEntity(new StringEntity(body, Charset.forName(HTTP_CHARSET)));
}
response = httpClient.execute(post);
// 处理响应
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
log.info("response result : {}", result);
return result;
} catch (IOException e) {
log.error("post链接失败" + e.getMessage());
} finally {
// 释放连接
if (response != null) {
response.close();
}
}
} catch (IOException e) {
log.error("post关闭response失败" + e.getMessage());
}
return null;
}
/**
* post bodyform
* <p>
* post bodyjson
*
* @param url
* @param headers null
* @param body form
* @return String
*/
public static String doPost(String url, Map<String, String> headers, Map<String, Object> body,
int connectTimeout, int connectionRequestTimeout, int socketTimeout) {
// 创建HttpClient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建HttpResponse对象
CloseableHttpResponse response = null;
log.info("request param info : {}", body);
log.info("request header info : {}", headers);
try {
try {
// 创建HttpPost对象
HttpPost post = new HttpPost(url);
post.setConfig(RequestConfig.custom().setConnectTimeout(connectTimeout).setConnectionRequestTimeout(connectionRequestTimeout).setSocketTimeout(socketTimeout).build());
// 封装请求头
if (null != headers) {
headers.keySet().forEach(key -> {
post.addHeader(key, headers.get(key));
});
}
// 封装请求体
List<NameValuePair> nvpList = new ArrayList<>();
for (String name : body.keySet()) {
String value = String.valueOf(body.get(name));
nvpList.add(new BasicNameValuePair(name, value));
}
post.setEntity(new UrlEncodedFormEntity(nvpList));
response = httpClient.execute(post);
// 处理响应
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
log.info("response info : {}", result);
return result;
} catch (IOException e) {
log.error("post链接失败" + e.getMessage());
} finally {
// 释放连接
if (response != null) {
response.close();
}
}
} catch (IOException e) {
log.error("post关闭response失败" + e.getMessage());
}
return null;
}
/**
* post bodyform
* <p>
*
* @param url
* @param headers null
* @param body json
* @return String
*/
public static String doPost(String url, Map<String, String> headers, Map<String, Object> body) {
// 创建HttpClient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建HttpResponse对象
CloseableHttpResponse response = null;
log.info("request param info : {}", body);
log.info("request header info : {}", headers);
try {
try {
// 创建HttpPost对象
HttpPost post = new HttpPost(url);
// 封装请求头
if (null != headers) {
headers.keySet().forEach(key -> {
post.addHeader(key, headers.get(key));
});
}
// 封装请求体
List<NameValuePair> nvpList = new ArrayList<>();
for (String name : body.keySet()) {
String value = String.valueOf(body.get(name));
nvpList.add(new BasicNameValuePair(name, value));
}
post.setEntity(new UrlEncodedFormEntity(nvpList,HTTP_CHARSET));
response = httpClient.execute(post);
// 处理响应
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
log.info("response info : {}", result);
return result;
} catch (IOException e) {
log.error("post链接失败" + e.getMessage());
} finally {
// 释放连接
if (response != null) {
response.close();
}
}
} catch (IOException e) {
log.error("post关闭response失败" + e.getMessage());
}
return null;
}
/**
* delete
*
* @param url
* @param headers null
* @return String
*/
public static String doDelete(String url, Map<String, String> headers) {
// 创建HttpClient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
// 创建HttpResponse对象
CloseableHttpResponse response = null;
log.info("request param info : {}", url);
log.info("request header info : {}", headers);
try {
try {
// 创建HttpPost对象
HttpDelete delete = new HttpDelete(url);
// 封装请求头
if (null != headers) {
headers.keySet().forEach(key -> {
delete.addHeader(key, headers.get(key));
});
}
response = httpClient.execute(delete);
String result = EntityUtils.toString(response.getEntity(), Charset.forName(HTTP_CHARSET));
log.info("response info : {}", result);
return result;
} catch (IOException e) {
log.error("delete链接失败" + e.getMessage());
} finally {
// 释放连接
if (response != null) {
response.close();
}
}
} catch (IOException e) {
log.error("delete关闭response失败" + e.getMessage());
}
return null;
}
}

View File

@ -27,15 +27,45 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.poi.common.usermodel.HyperlinkType;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFPicture;
import org.apache.poi.hssf.usermodel.HSSFPictureData;
import org.apache.poi.hssf.usermodel.HSSFShape;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ooxml.POIXMLDocumentPart;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.DataValidation;
import org.apache.poi.ss.usermodel.DataValidationConstraint;
import org.apache.poi.ss.usermodel.DataValidationHelper;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Name;
import org.apache.poi.ss.usermodel.PictureData;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.apache.poi.xssf.usermodel.XSSFDrawing;
import org.apache.poi.xssf.usermodel.XSSFPicture;
import org.apache.poi.xssf.usermodel.XSSFShape;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -986,7 +1016,6 @@ public class ExcelUtil<T>
{
// 创建cell
cell = row.createCell(column);
if (isSubListValue(vo) && getListCellValue(vo).size() > 1 && attr.needMerge())
{
CellRangeAddress cellAddress = new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column);
@ -1030,20 +1059,7 @@ public class ExcelUtil<T>
// 设置列类型
setCellVo(value, attr, cell);
}
if(attr.isLink()){
CreationHelper createHelper= row.getSheet().getWorkbook().getCreationHelper();
XSSFHyperlink link = (XSSFHyperlink) createHelper.createHyperlink(HyperlinkType.URL);
link.setAddress((String) value);
cell.setHyperlink(link);
if( StringUtils.isNotEmpty (attr.linkText())){
cell.setCellValue(attr.linkText());
}else{
cell.setCellValue(value.toString());
}
}
addStatisticsData(column, Convert.toStr(value), attr);
}
}
catch (Exception e)

View File

@ -2,10 +2,6 @@ package com.ruoyi.common.utils.sign;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.List;
import java.util.Objects;
import com.ruoyi.common.core.text.Convert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,23 +32,6 @@ public class Md5Utils
return null;
}
private static byte[] md5(byte[] bytes)
{
MessageDigest algorithm;
try
{
algorithm = MessageDigest.getInstance("MD5");
algorithm.update(bytes);
byte[] messageDigest = algorithm.digest();
return messageDigest;
}
catch (Exception e)
{
log.error("MD5 Error...", e);
}
return null;
}
private static final String toHex(byte hash[])
{
if (hash == null)
@ -73,36 +52,6 @@ public class Md5Utils
return buf.toString();
}
public static String hash(byte[] uploadBytes)
{
try
{
return new String(toHex(md5(uploadBytes)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
}
catch (Exception e)
{
log.error("not supported charset...{}", e);
return null;
}
}
public static String hash(List<Long> objs)
{
if(objs==null){
return null;
}
String s = objs.toString();
try
{
return new String(toHex(md5(s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
}
catch (Exception e)
{
log.error("not supported charset...{}", e);
return s;
}
}
public static String hash(String s)
{
try
@ -115,12 +64,4 @@ public class Md5Utils
return s;
}
}
public static String yzMd5(String s){
String tmp="HelloYanzhu"+s+"陕西研筑";
tmp=hash(tmp);
tmp=tmp.substring(3,15)+"yanzhu"+tmp.substring(20)+"研筑陕西";
tmp=hash(tmp);
return "sxyz"+tmp.substring(21,tmp.length()-3)+tmp.substring(3,14);
}
}

View File

@ -1,356 +0,0 @@
package com.ruoyi.common.utils.sign;
import javax.crypto.Cipher;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
/**
* @description: Rsa
* @author: JiangYuQi
* @date: 2024/1/13 15:14
*/
public final class RSAUtil {
private RSAUtil() {}
private static final String RSA = "RSA";
private static final String SIGN_ALGORITHMS = "SHA1WithRSA";
private static final Base64.Decoder DECODER = Base64.getDecoder();
private static final Base64.Encoder ENCODER = Base64.getEncoder();
public static void main(String[] args) throws NoSuchAlgorithmException {
// 生成密钥对
KeyPair keyPair = getKeyPair();
// 公匙
String publicKey = getPublicKeyBase64(keyPair);
System.out.println("公匙 -> " + publicKey);
// 私匙
String privateKey = getPrivateKeyBase64(keyPair);
System.out.println("私匙 -> " + privateKey);
// 明文
String plaintext = "hello world!";
System.out.println("明文 -> " + plaintext);
// 密文base64公匙加密
String ciphertext = publicKeyEncrypt(plaintext, publicKey);
System.out.println("密文base64 -> " + ciphertext);
// 解密后明文(私匙解密)
String decryptString = privateKeyDecrypt(ciphertext, privateKey);
System.out.println("解密后明文 -> " + decryptString);
// 数字签名
// String sign = sign(ciphertext, privateKey);
// System.out.println("数字签名 -> " + decryptString);
// // 验证签名
// boolean pass = verify(ciphertext, sign, publicKey);
// System.out.println("验证签名 -> " + pass);
}
/**
*
*
* @return
* @throws Exception
*/
public static KeyPair getKeyPair() throws NoSuchAlgorithmException {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(RSA);
keyPairGenerator.initialize(1024);
return keyPairGenerator.generateKeyPair();
}
/**
* (Base64)
*
* @param keyPair
* @return
*/
public static String getPublicKeyBase64(KeyPair keyPair) {
PublicKey publicKey = keyPair.getPublic();
byte[] bytes = publicKey.getEncoded();
// 先用base64编码再转换为字符串
return new String(ENCODER.encode(bytes), StandardCharsets.UTF_8);
}
/**
* (Base64)
*
* @param keyPair
* @return
*/
public static String getPrivateKeyBase64(KeyPair keyPair) {
PrivateKey privateKey = keyPair.getPrivate();
byte[] bytes = privateKey.getEncoded();
// 先用base64编码再转换为字符串
return new String(ENCODER.encode(bytes), StandardCharsets.UTF_8);
}
/**
* Base64PublicKey
*
* @param publicKeyBase64 base64
* @return
*/
public static PublicKey getPublicKey(String publicKeyBase64) throws NoSuchAlgorithmException, InvalidKeySpecException {
byte[] keyBytes = DECODER.decode(publicKeyBase64);
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(RSA);
return keyFactory.generatePublic(keySpec);
}
/**
* Base64PrivateKey
*
* @param privateKeyBase64 base64
* @return
* @throws Exception
*/
public static PrivateKey getPrivateKey(String privateKeyBase64) throws NoSuchAlgorithmException, InvalidKeySpecException {
byte[] keyBytes = DECODER.decode((privateKeyBase64));
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(RSA);
return keyFactory.generatePrivate(keySpec);
}
/**
*
*
* @param plaintext
* @param publicKeyBase64 base64
* @return base64
*/
public static String publicKeyEncrypt(String plaintext, String publicKeyBase64) {
try {
// 获取明文字节数组
byte[] bytes = plaintext.getBytes(StandardCharsets.UTF_8);
Cipher cipher = Cipher.getInstance(RSA);
// 编码前设定编码方式及密钥
PublicKey publicKey = getPublicKey(publicKeyBase64);
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
int keyBit = getKeySize(publicKey);
int inputLen = bytes.length;
ByteArrayOutputStream out = new ByteArrayOutputStream();
int offSet = 0;
int step = keyBit / 8 - 11;
for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
byte[] cache;
if (inputLen - offSet > step) {
cache = cipher.doFinal(bytes, offSet, step);
} else {
cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
}
out.write(cache, 0, cache.length);
++i;
}
// 密文字节数组
byte[] ciphertextBytes = out.toByteArray();
out.close();
// 返回密文字节数组base64编码后的字符串
return new String(ENCODER.encode(ciphertextBytes), StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
*
*
* @param ciphertext
* @param publicKeyBase64 base64
* @return
*/
public static String publicKeyDecrypt(String ciphertext, String publicKeyBase64) {
try {
// 密文base64解码字节数组
byte[] bytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
Cipher cipher = Cipher.getInstance(RSA);
PublicKey publicKey = getPublicKey(publicKeyBase64);
cipher.init(Cipher.DECRYPT_MODE, publicKey);
int keyBit = getKeySize(publicKey);
int inputLen = bytes.length;
ByteArrayOutputStream out = new ByteArrayOutputStream();
int offSet = 0;
int step = keyBit / 8;
for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
byte[] cache;
if (inputLen - offSet > step) {
cache = cipher.doFinal(bytes, offSet, step);
} else {
cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
}
out.write(cache, 0, cache.length);
++i;
}
// 明文字节数组
byte[] plaintextBytes = out.toByteArray();
out.close();
return new String(plaintextBytes, StandardCharsets.UTF_8);
} catch (Exception e) {
return null;
}
}
/**
*
*
* @param plaintext
* @param privateKeyBase64 base64
* @return
*/
public static String privateKeyEncrypt(String plaintext, String privateKeyBase64) {
try {
// 获取明文字节数组
byte[] bytes = plaintext.getBytes(StandardCharsets.UTF_8);
Cipher cipher = Cipher.getInstance(RSA);
// 编码前设定编码方式及密钥
PrivateKey privateKey = getPrivateKey(privateKeyBase64);
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
int keyBit = getKeySize(privateKey);
int inputLen = bytes.length;
ByteArrayOutputStream out = new ByteArrayOutputStream();
int offSet = 0;
int step = keyBit / 8 - 11;
for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
byte[] cache;
if (inputLen - offSet > step) {
cache = cipher.doFinal(bytes, offSet, step);
} else {
cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
}
out.write(cache, 0, cache.length);
++i;
}
// 密文字节数组
byte[] ciphertextBytes = out.toByteArray();
out.close();
// 返回密文字节数组base64编码后的字符串
return new String(ENCODER.encode(ciphertextBytes), StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
*
*
* @param ciphertext
* @param privateKeyBase64 base64
* @return
*/
public static String privateKeyDecrypt(String ciphertext, String privateKeyBase64) {
try {
// 密文base64解码字节数组
byte[] bytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
Cipher cipher = Cipher.getInstance(RSA);
PrivateKey privateKey = getPrivateKey(privateKeyBase64);
cipher.init(Cipher.DECRYPT_MODE, privateKey);
int keyBit = getKeySize(privateKey);
int inputLen = bytes.length;
ByteArrayOutputStream out = new ByteArrayOutputStream();
int offSet = 0;
int step = keyBit / 8;
for (int i = 0; inputLen - offSet > 0; offSet = i * step) {
byte[] cache;
if (inputLen - offSet > step) {
cache = cipher.doFinal(bytes, offSet, step);
} else {
cache = cipher.doFinal(bytes, offSet, inputLen - offSet);
}
out.write(cache, 0, cache.length);
++i;
}
// 明文字节数组
byte[] plaintextBytes = out.toByteArray();
out.close();
return new String(plaintextBytes, StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 使
*
* @param ciphertext
* @param privateKeyBase64 Base64
* @return base64
*/
public static String sign(String ciphertext, String privateKeyBase64) {
try {
// 密文字节数组
byte[] ciphertextBytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
PrivateKey privateKey = getPrivateKey(privateKeyBase64);
Signature signature = Signature.getInstance(SIGN_ALGORITHMS);
signature.initSign(privateKey);
signature.update(ciphertextBytes);
byte[] signed = signature.sign();
return new String(ENCODER.encode(signed), StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 使
*
* @param ciphertext
* @param sign
* @param publicKeyBase64 base64
* @return
*/
public static boolean verify(String ciphertext, String sign, String publicKeyBase64) {
try {
// 密文base64解码字节数组
byte[] ciphertextBytes = DECODER.decode(ciphertext.getBytes(StandardCharsets.UTF_8));
// 签名base64解码字节数组
byte[] signBytes = DECODER.decode(sign.getBytes(StandardCharsets.UTF_8));
PublicKey publicKey = getPublicKey(publicKeyBase64);
Signature signature = Signature.getInstance(SIGN_ALGORITHMS);
signature.initVerify(publicKey);
signature.update(ciphertextBytes);
return signature.verify(signBytes);
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/**
*
*
* @param publicKey
* @return
*/
public static int getKeySize(PublicKey publicKey) {
RSAPublicKey rsaPublicKey = (RSAPublicKey) publicKey;
return rsaPublicKey.getModulus().bitLength();
}
/**
*
*
* @param privateKey
* @return
*/
public static int getKeySize(PrivateKey privateKey) {
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) privateKey;
return rsaPrivateKey.getModulus().bitLength();
}
}

View File

@ -1,5 +0,0 @@
# sms短信平台配置 企信通--九维
sms.jiuwei.url=http://123.206.19.78:9001/sendXSms.do
sms.jiuwei.username=gwzdyjc
sms.jiuwei.password=308517
sms.jiuwei.productid=621215

View File

@ -84,4 +84,13 @@
</dependencies>
<!-- <build>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project>

View File

@ -16,8 +16,8 @@ public enum FlowComment {
REJECT("3", "驳回意见"),
DELEGATE("4", "委派意见"),
ASSIGN("5", "转办意见"),
STOP("6", "终止流程"),
REVOKE("7", "撤回");
STOP("6", "终止流程");
/**
*
*/

View File

@ -1,41 +0,0 @@
package com.ruoyi.flowable.config;
import com.ruoyi.flowable.listener.GlobalEventListener;
import lombok.RequiredArgsConstructor;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;
/**
* Flowable
*
* @author JiangYuQi
*/
@Configuration
@RequiredArgsConstructor
public class FlowableGlobalListenerConfig implements ApplicationListener<ContextRefreshedEvent> {
private final SpringProcessEngineConfiguration configuration;
private final GlobalEventListener globalEventListener;
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
FlowableEventDispatcher dispatcher = configuration.getEventDispatcher();
/**
* -
* PROCESS_CREATED
* TASK_CREATED
* TASK_COMPLETED
* PROCESS_COMPLETED
*
*/
dispatcher.addEventListener(globalEventListener,FlowableEngineEventType.TASK_CREATED);
dispatcher.addEventListener(globalEventListener,FlowableEngineEventType.PROCESS_COMPLETED);
}
}

View File

@ -1,95 +1,95 @@
package com.ruoyi.flowable.config;
import org.flowable.bpmn.model.AssociationDirection;
import org.flowable.image.impl.DefaultProcessDiagramCanvas;
import java.awt.*;
import java.awt.geom.Line2D;
import java.awt.geom.RoundRectangle2D;
/**
* @author Tony
* @date 2021-04-03
*/
public class MyDefaultProcessDiagramCanvas extends DefaultProcessDiagramCanvas {
//设置高亮线的颜色 这里我设置成绿色
protected static Color HIGHLIGHT_SEQUENCEFLOW_COLOR = Color.GREEN;
public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
}
public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType) {
super(width, height, minX, minY, imageType);
}
/**
* 线
*/
@Override
public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType,
AssociationDirection associationDirection, boolean highLighted, double scaleFactor) {
Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke();
g.setPaint(CONNECTION_COLOR);
if (connectionType.equals("association")) {
g.setStroke(ASSOCIATION_STROKE);
} else if (highLighted) {
//设置线的颜色
g.setPaint(originalPaint);
g.setStroke(HIGHLIGHT_FLOW_STROKE);
}
for (int i = 1; i < xPoints.length; i++) {
Integer sourceX = xPoints[i - 1];
Integer sourceY = yPoints[i - 1];
Integer targetX = xPoints[i];
Integer targetY = yPoints[i];
Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY);
g.draw(line);
}
if (isDefault) {
Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
drawDefaultSequenceFlowIndicator(line, scaleFactor);
}
if (conditional) {
Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
drawConditionalSequenceFlowIndicator(line, scaleFactor);
}
if (associationDirection == AssociationDirection.ONE || associationDirection == AssociationDirection.BOTH) {
Line2D.Double line = new Line2D.Double(xPoints[xPoints.length - 2], yPoints[xPoints.length - 2], xPoints[xPoints.length - 1], yPoints[xPoints.length - 1]);
drawArrowHead(line, scaleFactor);
}
if (associationDirection == AssociationDirection.BOTH) {
Line2D.Double line = new Line2D.Double(xPoints[1], yPoints[1], xPoints[0], yPoints[0]);
drawArrowHead(line, scaleFactor);
}
g.setPaint(originalPaint);
g.setStroke(originalStroke);
}
/**
*
*/
@Override
public void drawHighLight(int x, int y, int width, int height) {
Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke();
//设置高亮节点的颜色
g.setPaint(HIGHLIGHT_COLOR);
g.setStroke(THICK_TASK_BORDER_STROKE);
RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);
g.draw(rect);
g.setPaint(originalPaint);
g.setStroke(originalStroke);
}
}
//package com.ruoyi.flowable.config;
//
//import com.sun.prism.paint.Color;
//import org.flowable.bpmn.model.AssociationDirection;
//import org.flowable.image.impl.DefaultProcessDiagramCanvas;
//
//import java.awt.*;
//import java.awt.geom.Line2D;
//import java.awt.geom.RoundRectangle2D;
//
///**
// * @author Tony
// * @date 2021-04-03
// */
//public class MyDefaultProcessDiagramCanvas extends DefaultProcessDiagramCanvas {
// //设置高亮线的颜色 这里我设置成绿色
// protected static Color HIGHLIGHT_SEQUENCEFLOW_COLOR = Color.GREEN;
//
// public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
// super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
// }
//
// public MyDefaultProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType) {
// super(width, height, minX, minY, imageType);
// }
//
//
// /**
// * 画线颜色设置
// */
// @Override
// public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType,
// AssociationDirection associationDirection, boolean highLighted, double scaleFactor) {
//
// Paint originalPaint = g.getPaint();
// Stroke originalStroke = g.getStroke();
//
// g.setPaint(CONNECTION_COLOR);
// if (connectionType.equals("association")) {
// g.setStroke(ASSOCIATION_STROKE);
// } else if (highLighted) {
// //设置线的颜色
// g.setPaint(originalPaint);
// g.setStroke(HIGHLIGHT_FLOW_STROKE);
// }
//
// for (int i = 1; i < xPoints.length; i++) {
// Integer sourceX = xPoints[i - 1];
// Integer sourceY = yPoints[i - 1];
// Integer targetX = xPoints[i];
// Integer targetY = yPoints[i];
// Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY);
// g.draw(line);
// }
//
// if (isDefault) {
// Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
// drawDefaultSequenceFlowIndicator(line, scaleFactor);
// }
//
// if (conditional) {
// Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
// drawConditionalSequenceFlowIndicator(line, scaleFactor);
// }
//
// if (associationDirection == AssociationDirection.ONE || associationDirection == AssociationDirection.BOTH) {
// Line2D.Double line = new Line2D.Double(xPoints[xPoints.length - 2], yPoints[xPoints.length - 2], xPoints[xPoints.length - 1], yPoints[xPoints.length - 1]);
// drawArrowHead(line, scaleFactor);
// }
// if (associationDirection == AssociationDirection.BOTH) {
// Line2D.Double line = new Line2D.Double(xPoints[1], yPoints[1], xPoints[0], yPoints[0]);
// drawArrowHead(line, scaleFactor);
// }
// g.setPaint(originalPaint);
// g.setStroke(originalStroke);
// }
//
// /**
// * 高亮节点设置
// */
// @Override
// public void drawHighLight(int x, int y, int width, int height) {
// Paint originalPaint = g.getPaint();
// Stroke originalStroke = g.getStroke();
// //设置高亮节点的颜色
// g.setPaint(HIGHLIGHT_COLOR);
// g.setStroke(THICK_TASK_BORDER_STROKE);
//
// RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);
// g.draw(rect);
//
// g.setPaint(originalPaint);
// g.setStroke(originalStroke);
// }
//}

View File

@ -1,126 +0,0 @@
package com.ruoyi.flowable.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.SysRoleEnum;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.flowable.service.IFlowBusinessKeyService;
import com.ruoyi.system.domain.FlowTaskEntity;
import com.ruoyi.system.service.ISysDeptService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.stream.Collectors;
/**
* <p>
*
* </p>
*
* @author JiangYuQi
* @date 2021-04-03
*/
@Slf4j
@Api(tags = "流程定义")
@RestController
@RequestMapping("/flowable/businessKey")
public class FlowBusinessKeyController extends BaseController {
@Autowired
private ISysDeptService sysDeptService;
@Autowired
private IFlowBusinessKeyService flowBusinessKeyService;
/**
*
* @param flowTaskEntity
* @return
*/
@GetMapping(value = "/allList")
public TableDataInfo allList(FlowTaskEntity flowTaskEntity) {
startPage();
flowTaskEntity.setNowRole(Convert.toStr(getUserFirstRole()));
if(SysRoleEnum.ZGS.getCode().equals(flowTaskEntity.getNowRole())){
flowTaskEntity.setNowDept(Convert.toStr(sysDeptService.getZGSDeptId(getDeptId())));
}else{
flowTaskEntity.setNowDept(Convert.toStr(getDeptId()));
}
flowTaskEntity.setNowUser(Convert.toStr(getUserId()));
return getDataTable(flowBusinessKeyService.selectAllFlowTaskByParams(flowTaskEntity));
}
/**
*
* @param flowTaskEntity
* @return
*/
@GetMapping(value = "/queryCount")
public AjaxResult queryCount(FlowTaskEntity flowTaskEntity) {
flowTaskEntity.setNowRole(Convert.toStr(getUserFirstRole()));
if(SysRoleEnum.ZGS.getCode().equals(flowTaskEntity.getNowRole())){
flowTaskEntity.setNowDept(Convert.toStr(sysDeptService.getZGSDeptId(getDeptId())));
}else{
flowTaskEntity.setNowDept(Convert.toStr(getDeptId()));
}
flowTaskEntity.setNowUser(Convert.toStr(getUserId()));
return success(flowBusinessKeyService.quueryCount(flowTaskEntity));
}
/**
* Id
* @param procInsId
* @return
*/
@GetMapping(value = "/findCommentByProcInsId")
public AjaxResult findCommentByProcInsId(String procInsId) {
return success(flowBusinessKeyService.selectCommentByProcInsId(procInsId));
}
/**
* Id
* @param procInsId
* @return
*/
@GetMapping(value = "/findFormDatasByProcInsId")
public AjaxResult findFormDatasByProcInsId(String procInsId) {
return success(flowBusinessKeyService.selectFormDatasByProcInsId(procInsId));
}
/**
*
* @param flowTaskEntity
* @return
*/
@GetMapping(value = "/myAwaitFlowTaskList")
public TableDataInfo myAwaitFlowTaskList(FlowTaskEntity flowTaskEntity) {
startPage();
flowTaskEntity.setNowRole(Convert.toStr(getUserFirstRole()));
if(SysRoleEnum.ZGS.getCode().equals(flowTaskEntity.getNowRole())){
flowTaskEntity.setNowDept(Convert.toStr(sysDeptService.getZGSDeptId(getDeptId())));
}else{
flowTaskEntity.setNowDept(Convert.toStr(getDeptId()));
}
flowTaskEntity.setNowUser(Convert.toStr(SecurityUtils.getUserId()));
flowTaskEntity.setRoleIds(SecurityUtils.getLoginUser().getUser().getRoles().stream().map(role -> role.getRoleId()).collect(Collectors.toList()));
return getDataTable(flowBusinessKeyService.selectMyAwaitFlowTask(flowTaskEntity));
}
/**
*
* @param flowTaskEntity
* @return
*/
@GetMapping(value = "/myFinishedFlowTaskList")
public TableDataInfo myFinishedFlowTaskList(FlowTaskEntity flowTaskEntity) {
startPage();
flowTaskEntity.setNowUser(Convert.toStr(SecurityUtils.getUserId()));
return getDataTable(flowBusinessKeyService.selectMyFinishedFlowTask(flowTaskEntity));
}
}

View File

@ -1,13 +1,10 @@
package com.ruoyi.flowable.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.flowable.domain.dto.FlowSaveXmlVo;
import com.ruoyi.flowable.domain.vo.ProcKeyRole;
import com.ruoyi.flowable.service.IFlowDefinitionService;
import com.ruoyi.system.domain.FlowProcDefDto;
import com.ruoyi.system.domain.SysExpression;
@ -63,19 +60,8 @@ public class FlowDefinitionController extends BaseController {
@ApiOperation(value = "流程定义列表", response = FlowProcDefDto.class)
public AjaxResult list(@ApiParam(value = "当前页码", required = true) @RequestParam Integer pageNum,
@ApiParam(value = "每页条数", required = true) @RequestParam Integer pageSize,
@ApiParam(value = "发起角色", required = false) @RequestParam(required = false) String roleId,
@ApiParam(value = "流程类型", required = false) @RequestParam(required = false) String category,
@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name) {
return AjaxResult.success(flowDefinitionService.list(roleId, category, name, pageNum, pageSize));
}
@GetMapping(value = "/myList")
@ApiOperation(value = "流程定义列表", response = FlowProcDefDto.class)
public AjaxResult myList(@ApiParam(value = "当前页码", required = true) @RequestParam Integer pageNum,
@ApiParam(value = "每页条数", required = true) @RequestParam Integer pageSize,
@ApiParam(value = "流程类型", required = false) @RequestParam(required = false) String category,
@ApiParam(value = "流程名称", required = false) @RequestParam(required = false) String name) {
return AjaxResult.success(flowDefinitionService.myList(getUsername(), category, name, pageNum, pageSize));
return AjaxResult.success(flowDefinitionService.list(name, pageNum, pageSize));
}
@ -143,6 +129,7 @@ public class FlowDefinitionController extends BaseController {
}
@ApiOperation(value = "保存流程设计器内的xml文件")
@PostMapping("/save")
public AjaxResult save(@RequestBody FlowSaveXmlVo vo) {
@ -166,32 +153,15 @@ public class FlowDefinitionController extends BaseController {
return AjaxResult.success("导入成功");
}
@ApiOperation(value = "发起流程")
@Log(title = "发起流程", businessType = BusinessType.INSERT)
@PostMapping("/start/{procDefId}")
public AjaxResult start(@ApiParam(value = "流程定义id") @PathVariable(value = "procDefId") String procDefId,
@ApiParam(value = "变量集合,json对象") @RequestBody Map<String, Object> variables) {
SysUser sysUser = getLoginUser().getUser();
return flowDefinitionService.startProcessInstanceById(procDefId, sysUser.getUserId().toString(), sysUser.getNickName(), variables);
return flowDefinitionService.startProcessInstanceById(procDefId, variables);
}
@ApiOperation(value = "流程发起角色配置")
@Log(title = "流程发起角色配置", businessType = BusinessType.UPDATE)
@PostMapping("/updateProcKeyByRoleId")
public AjaxResult updateProcKeyByRoleId(@RequestBody ProcKeyRole procKeyRole) {
flowDefinitionService.updateProcKeyByRoleId(procKeyRole.getRoleId(),procKeyRole.getKeys());
return success();
}
@ApiOperation(value = "流程发起排序设置")
@Log(title = "流程发起排序设置", businessType = BusinessType.UPDATE)
@PostMapping("/updateProcKeyRoleSort")
public AjaxResult updateProcKeyRoleSort(@RequestBody ProcKeyRole procKeyRole) {
flowDefinitionService.updateProcKeyRoleSort(procKeyRole);
return success();
}
@ApiOperation(value = "激活或挂起流程定义")
@PutMapping(value = "/updateState")
public AjaxResult updateState(@ApiParam(value = "1:激活,2:挂起", required = true) @RequestParam Integer state,

View File

@ -1,8 +1,7 @@
package com.ruoyi.flowable.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.flowable.domain.vo.FlowTaskVo;
import com.ruoyi.flowable.service.IFlowInstanceService;
import io.swagger.annotations.Api;
@ -37,6 +36,7 @@ public class FlowInstanceController {
}
@ApiOperation(value = "激活或挂起流程实例")
@PostMapping(value = "/updateState")
public AjaxResult updateState(@ApiParam(value = "1:激活,2:挂起", required = true) @RequestParam Integer state,
@ -53,7 +53,6 @@ public class FlowInstanceController {
}
@ApiOperation(value = "删除流程实例")
@Log(title = "删除流程", businessType = BusinessType.INSERT)
@DeleteMapping(value = "/delete/{instanceIds}")
public AjaxResult delete(@ApiParam(value = "流程实例ID", required = true) @PathVariable String[] instanceIds,
@ApiParam(value = "删除原因") @RequestParam(required = false) String deleteReason) {

View File

@ -1,8 +1,6 @@
package com.ruoyi.flowable.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.flowable.domain.dto.FlowTaskDto;
import com.ruoyi.flowable.domain.vo.FlowQueryVo;
import com.ruoyi.flowable.domain.vo.FlowTaskVo;
@ -43,14 +41,12 @@ public class FlowTaskController {
}
@ApiOperation(value = "取消申请", response = FlowTaskDto.class)
@Log(title = "终止申请", businessType = BusinessType.UPDATE)
@PostMapping(value = "/stopProcess")
public AjaxResult stopProcess(@RequestBody FlowTaskVo flowTaskVo) {
return flowTaskService.stopProcess(flowTaskVo);
}
@ApiOperation(value = "撤回流程", response = FlowTaskDto.class)
@Log(title = "撤回流程", businessType = BusinessType.UPDATE)
@PostMapping(value = "/revokeProcess")
public AjaxResult revokeProcess(@RequestBody FlowTaskVo flowTaskVo) {
return flowTaskService.revokeProcess(flowTaskVo);
@ -89,14 +85,12 @@ public class FlowTaskController {
}
@ApiOperation(value = "审批任务")
@Log(title = "审批流程", businessType = BusinessType.UPDATE)
@PostMapping(value = "/complete")
public AjaxResult complete(@RequestBody FlowTaskVo flowTaskVo) {
return flowTaskService.complete(flowTaskVo);
}
@ApiOperation(value = "驳回任务")
@Log(title = "驳回流程", businessType = BusinessType.UPDATE)
@PostMapping(value = "/reject")
public AjaxResult taskReject(@RequestBody FlowTaskVo flowTaskVo) {
flowTaskService.taskReject(flowTaskVo);
@ -104,7 +98,6 @@ public class FlowTaskController {
}
@ApiOperation(value = "退回任务")
@Log(title = "退回流程", businessType = BusinessType.UPDATE)
@PostMapping(value = "/return")
public AjaxResult taskReturn(@RequestBody FlowTaskVo flowTaskVo) {
flowTaskService.taskReturn(flowTaskVo);
@ -118,7 +111,6 @@ public class FlowTaskController {
}
@ApiOperation(value = "删除任务")
@Log(title = "删除流程", businessType = BusinessType.UPDATE)
@DeleteMapping(value = "/delete")
public AjaxResult delete(@RequestBody FlowTaskVo flowTaskVo) {
flowTaskService.deleteTask(flowTaskVo);

View File

@ -32,7 +32,6 @@ import com.ruoyi.common.core.page.TableDataInfo;
@RestController
@RequestMapping("/flowable/form")
public class SysFormController extends BaseController {
@Autowired
private ISysFormService SysFormService;
@ -106,10 +105,10 @@ public class SysFormController extends BaseController {
return toAjax(SysFormService.deleteSysFormByIds(formIds));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('flowable:form:edit')")
@Log(title = "流程表单", businessType = BusinessType.INSERT)
@PostMapping("/addDeployForm")
public AjaxResult addDeployForm(@RequestBody SysDeployForm sysDeployForm) {

View File

@ -1,6 +1,7 @@
package com.ruoyi.flowable.domain.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.entity.SysUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -8,6 +9,8 @@ import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p><p>
@ -20,9 +23,6 @@ import java.util.Date;
@ApiModel("工作流任务相关-返回参数")
public class FlowTaskDto implements Serializable {
@ApiModelProperty("业务名称")
private String businessKeyName;
@ApiModelProperty("任务编号")
private String taskId;

View File

@ -1,44 +0,0 @@
package com.ruoyi.flowable.domain.enums;
/**
*
*
* @author Xuan xuan
* @date 2021/4/19
*/
public enum FlowComment {
/**
*
*/
NORMAL("1", "正常"),
REBACK("2", "退回"),
REJECT("3", "驳回"),
DELEGATE("4", "委派"),
TRANSFER("5", "转办"),
STOP("6", "终止"),
REVOKE("7", "撤回");
/**
*
*/
private final String type;
/**
*
*/
private final String remark;
FlowComment(String type, String remark) {
this.type = type;
this.remark = remark;
}
public String getType() {
return type;
}
public String getRemark() {
return remark;
}
}

View File

@ -1,33 +0,0 @@
package com.ruoyi.flowable.domain.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author KonBAI
* @createTime 2022/6/28 9:51
*/
@Getter
@AllArgsConstructor
public enum FormType {
/**
*
*/
PROCESS(0),
/**
*
*/
EXTERNAL(1),
/**
*
*/
INDEPENDENT(2);
/**
*
*/
private final Integer type;
}

View File

@ -1,44 +0,0 @@
package com.ruoyi.flowable.domain.enums;
import com.ruoyi.common.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author konbai
* @since 2023/3/9 00:45
*/
@Getter
@AllArgsConstructor
public enum ProcessStatus {
/**
*
*/
RUNNING("running"),
/**
*
*/
TERMINATED("terminated"),
/**
*
*/
COMPLETED("completed"),
/**
*
*/
CANCELED("canceled");
private final String status;
public static ProcessStatus getProcessStatus(String str) {
if (StringUtils.isNotBlank(str)) {
for (ProcessStatus value : values()) {
if (StringUtils.equalsIgnoreCase(str, value.getStatus())) {
return value;
}
}
}
return null;
}
}

View File

@ -20,9 +20,6 @@ public class FlowQueryVo {
@ApiModelProperty("流程名称")
private String name;
@ApiModelProperty("流程类别")
private String category;
@ApiModelProperty("开始时间")
private String startTime;

View File

@ -1,50 +0,0 @@
package com.ruoyi.flowable.domain.vo;
import java.io.Serializable;
import java.util.List;
public class ProcKeyRole implements Serializable
{
private static final long serialVersionUID = 1L;
private String roleId;
private String key;
private String sort;
private List<String> keys;
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public List<String> getKeys() {
return keys;
}
public void setKeys(List<String> keys) {
this.keys = keys;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
}

View File

@ -1,63 +0,0 @@
package com.ruoyi.flowable.domain.vo;
import java.io.Serializable;
import java.util.Map;
/**
*
*
* @author JiangYuQi
* @date 2020-07-07
*/
public class StartTaskVO implements Serializable
{
private static final long serialVersionUID = 1L;
//流程实例ID
private String procDefId;
private String userId;
private String userName;
private String nickName;
private Map<String, Object> variables;
public String getProcDefId() {
return procDefId;
}
public void setProcDefId(String procDefId) {
this.procDefId = procDefId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public Map<String, Object> getVariables() {
return variables;
}
public void setVariables(Map<String, Object> variables) {
this.variables = variables;
}
}

View File

@ -1,373 +0,0 @@
package com.ruoyi.flowable.flow;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import org.flowable.bpmn.converter.BpmnXMLConverter;
import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.*;
import org.flowable.common.engine.impl.util.io.StringStreamSource;
import java.util.*;
/**
* @author KonBAI
* @createTime 2022/3/26 19:04
*/
public class ModelUtils {
private static final BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
/**
* xmlbpmnModel
*
* @param xml xml
* @return bpmnModel
*/
public static BpmnModel getBpmnModel(String xml) {
return bpmnXMLConverter.convertToBpmnModel(new StringStreamSource(xml), false, false);
}
/**
* bpmnModelxml
*
* @deprecated bpmn 线
* @param bpmnModel bpmnModel
* @return xml
*/
@Deprecated
public static String getBpmnXmlStr(BpmnModel bpmnModel) {
return StrUtil.utf8Str(getBpmnXml(bpmnModel));
}
/**
* bpmnModelxml
*
* @deprecated bpmn 线
* @param bpmnModel bpmnModel
* @return xml
*/
@Deprecated
public static byte[] getBpmnXml(BpmnModel bpmnModel) {
return bpmnXMLConverter.convertToXML(bpmnModel);
}
/**
* 线
*
* @param source
* @return 线
*/
public static List<SequenceFlow> getElementIncomingFlows(FlowElement source) {
List<SequenceFlow> sequenceFlows = new ArrayList<>();
if (source instanceof FlowNode) {
sequenceFlows = ((FlowNode) source).getIncomingFlows();
}
return sequenceFlows;
}
/**
* 线
*
* @param source
* @return 线
*/
public static List<SequenceFlow> getElementOutgoingFlows(FlowElement source) {
List<SequenceFlow> sequenceFlows = new ArrayList<>();
if (source instanceof FlowNode) {
sequenceFlows = ((FlowNode) source).getOutgoingFlows();
}
return sequenceFlows;
}
/**
*
*
* @param model bpmnModel
* @return null
*/
public static StartEvent getStartEvent(BpmnModel model) {
Process process = model.getMainProcess();
FlowElement startElement = process.getInitialFlowElement();
if (startElement instanceof StartEvent) {
return (StartEvent) startElement;
}
return getStartEvent(process.getFlowElements());
}
/**
*
*
* @param flowElements
* @return null
*/
public static StartEvent getStartEvent(Collection<FlowElement> flowElements) {
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof StartEvent) {
return (StartEvent) flowElement;
}
}
return null;
}
/**
*
*
* @param model bpmnModel
* @return null
*/
public static EndEvent getEndEvent(BpmnModel model) {
Process process = model.getMainProcess();
return getEndEvent(process.getFlowElements());
}
/**
*
*
* @param flowElements
* @return null
*/
public static EndEvent getEndEvent(Collection<FlowElement> flowElements) {
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof EndEvent) {
return (EndEvent) flowElement;
}
}
return null;
}
public static UserTask getUserTaskByKey(BpmnModel model, String taskKey) {
Process process = model.getMainProcess();
FlowElement flowElement = process.getFlowElement(taskKey);
if (flowElement instanceof UserTask) {
return (UserTask) flowElement;
}
return null;
}
/**
*
*
* @param model bpmnModel
* @param flowElementId ID
* @return
*/
public static FlowElement getFlowElementById(BpmnModel model, String flowElementId) {
Process process = model.getMainProcess();
return process.getFlowElement(flowElementId);
}
/**
* Key
*
* @param flowElement
* @return Key
*/
public static String getFormKey(FlowElement flowElement) {
if (flowElement != null) {
if (flowElement instanceof StartEvent) {
return ((StartEvent) flowElement).getFormKey();
} else if (flowElement instanceof UserTask) {
return ((UserTask) flowElement).getFormKey();
}
}
return null;
}
/**
*
* @param model bpmnModel
* @param name
* @return
*/
public static String getStartEventAttributeValue(BpmnModel model, String name) {
StartEvent startEvent = getStartEvent(model);
return getElementAttributeValue(startEvent, name);
}
/**
*
* @param model bpmnModel
* @param name
* @return
*/
public static String getEndEventAttributeValue(BpmnModel model, String name) {
EndEvent endEvent = getEndEvent(model);
return getElementAttributeValue(endEvent, name);
}
/**
*
* @param model bpmnModel
* @param taskKey Key
* @param name
* @return
*/
public static String getUserTaskAttributeValue(BpmnModel model, String taskKey, String name) {
UserTask userTask = getUserTaskByKey(model, taskKey);
return getElementAttributeValue(userTask, name);
}
/**
*
* @param baseElement
* @param name
* @return
*/
public static String getElementAttributeValue(BaseElement baseElement, String name) {
if (baseElement != null) {
List<ExtensionAttribute> attributes = baseElement.getAttributes().get(name);
if (attributes != null && !attributes.isEmpty()) {
attributes.iterator().next().getValue();
Iterator<ExtensionAttribute> attrIterator = attributes.iterator();
if(attrIterator.hasNext()) {
ExtensionAttribute attribute = attrIterator.next();
return attribute.getValue();
}
}
}
return null;
}
public static boolean isMultiInstance(BpmnModel model, String taskKey) {
UserTask userTask = getUserTaskByKey(model, taskKey);
if (ObjectUtil.isNotNull(userTask)) {
return userTask.hasMultiInstanceLoopCharacteristics();
}
return false;
}
/**
*
*
* @param model bpmnModel
* @return
*/
public static Collection<UserTask> getAllUserTaskEvent(BpmnModel model) {
Process process = model.getMainProcess();
Collection<FlowElement> flowElements = process.getFlowElements();
return getAllUserTaskEvent(flowElements, null);
}
/**
*
* @param flowElements
* @param allElements
* @return
*/
public static Collection<UserTask> getAllUserTaskEvent(Collection<FlowElement> flowElements, Collection<UserTask> allElements) {
allElements = allElements == null ? new ArrayList<>() : allElements;
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof UserTask) {
allElements.add((UserTask) flowElement);
}
if (flowElement instanceof SubProcess) {
// 继续深入子流程,进一步获取子流程
allElements = getAllUserTaskEvent(((SubProcess) flowElement).getFlowElements(), allElements);
}
}
return allElements;
}
/**
*
* @param source
* @return
*/
public static List<UserTask> findNextUserTasks(FlowElement source) {
return findNextUserTasks(source, null, null);
}
/**
*
* @param source
* @param hasSequenceFlow 线 ID线
* @param userTaskList
* @return
*/
public static List<UserTask> findNextUserTasks(FlowElement source, Set<String> hasSequenceFlow, List<UserTask> userTaskList) {
hasSequenceFlow = Optional.ofNullable(hasSequenceFlow).orElse(new HashSet<>());
userTaskList = Optional.ofNullable(userTaskList).orElse(new ArrayList<>());
// 获取出口连线
List<SequenceFlow> sequenceFlows = getElementOutgoingFlows(source);
if (!sequenceFlows.isEmpty()) {
for (SequenceFlow sequenceFlow : sequenceFlows) {
// 如果发现连线重复,说明循环了,跳过这个循环
if (hasSequenceFlow.contains(sequenceFlow.getId())) {
continue;
}
// 添加已经走过的连线
hasSequenceFlow.add(sequenceFlow.getId());
FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement();
if (targetFlowElement instanceof UserTask) {
// 若节点为用户任务,加入到结果列表中
userTaskList.add((UserTask) targetFlowElement);
} else {
// 若节点非用户任务,继续递归查找下一个节点
findNextUserTasks(targetFlowElement, hasSequenceFlow, userTaskList);
}
}
}
return userTaskList;
}
/**
*
* 退
* @param source
* @param target
* @param visitedElements 线 ID线
* @return
*/
public static boolean isSequentialReachable(FlowElement source, FlowElement target, Set<String> visitedElements) {
visitedElements = visitedElements == null ? new HashSet<>() : visitedElements;
if (source instanceof StartEvent && isInEventSubprocess(source)) {
return false;
}
// 根据类型,获取入口连线
List<SequenceFlow> sequenceFlows = getElementIncomingFlows(source);
if (sequenceFlows != null && sequenceFlows.size() > 0) {
// 循环找到目标元素
for (SequenceFlow sequenceFlow: sequenceFlows) {
// 如果发现连线重复,说明循环了,跳过这个循环
if (visitedElements.contains(sequenceFlow.getId())) {
continue;
}
// 添加已经走过的连线
visitedElements.add(sequenceFlow.getId());
FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement();
// 这条线路存在目标节点,这条线路完成,进入下个线路
if (target.getId().equals(sourceFlowElement.getId())) {
continue;
}
// 如果目标节点为并行网关,则不继续
if (sourceFlowElement instanceof ParallelGateway) {
return false;
}
// 否则就继续迭代
boolean isSequential = isSequentialReachable(sourceFlowElement, target, visitedElements);
if (!isSequential) {
return false;
}
}
}
return true;
}
protected static boolean isInEventSubprocess(FlowElement flowElement) {
FlowElementsContainer flowElementsContainer = flowElement.getParentContainer();
while (flowElementsContainer != null) {
if (flowElementsContainer instanceof EventSubProcess) {
return true;
}
if (flowElementsContainer instanceof FlowElement) {
flowElementsContainer = ((FlowElement) flowElementsContainer).getParentContainer();
} else {
flowElementsContainer = null;
}
}
return false;
}
}

View File

@ -22,7 +22,11 @@ public class FlowTaskListener implements TaskListener{
@Override
public void notify(DelegateTask delegateTask) {
log.info("任务监听器:{}", delegateTask.getEventName(),delegateTask.getId());
log.info("任务监听器:{}", delegateTask);
// TODO 获取事件类型 delegateTask.getEventName(),可以通过监听器给任务执行人发送相应的通知消息
}
}

View File

@ -1,317 +0,0 @@
package com.ruoyi.flowable.listener;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.config.WechatAccountConfig;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.TemplateMessageEnum;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.flowable.flow.FindNextNodeUtil;
import com.ruoyi.flowable.service.IFlowBusinessKeyService;
import com.ruoyi.system.domain.SysUserOpenid;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.SysUserOpenidMapper;
import com.ruoyi.system.service.ISysConfigService;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.apache.commons.collections4.CollectionUtils;
import org.flowable.bpmn.model.UserTask;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.identitylink.api.IdentityLink;
import org.flowable.task.api.Task;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* Flowable
*
* @author JiangYuQi
*/
@Slf4j
@Component
public class GlobalEventListener extends AbstractFlowableEngineEventListener {
@Autowired
private RedisCache redisCache;
@Autowired
private ISysConfigService configService;
@Autowired
private TaskService taskService;
@Autowired
private WxMpService wxMpService;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private RuntimeService runtimeService;
@Autowired
private RepositoryService repositoryService;
@Autowired
private SysUserOpenidMapper sysUserOpenidMapper;
@Autowired
private IFlowBusinessKeyService flowBusinessKeyService;
@Override
protected void processCompleted(FlowableEngineEntityEvent event) {
log.info("任务流程审批完成...{}",event.getProcessInstanceId());
super.processCompleted(event);
List<WxMpTemplateMessage> list = new ArrayList<>();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(event.getProcessInstanceId()).singleResult();
String startUserId = processInstance.getStartUserId();
SysUser sysUser = sysUserMapper.selectUserById(Convert.toLong(startUserId));
Map<String, Object> map = flowBusinessKeyService.selectLastCommentByProcInsId(processInstance.getId());
String nodeName = "工程审批";
if(map!=null){
nodeName += Convert.toStr(map.get("commentResult"),"");
}
//模板数据
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(this.getMsgId(sysUser.getPhonenumber()))
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(Convert.toLong(processInstance.getBusinessKey()))));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", processInstance.getProcessDefinitionName()));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", nodeName));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,processInstance.getStartTime())));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", sysUser.getNickName()+"["+this.getMsgDepName(sysUser.getDeptId())+"]"));
list.add(templateMessage);
this.send(list,processInstance.getProcessDefinitionKey());
}
@Override
protected void taskCreated(FlowableEngineEntityEvent event) {
log.info("创建任务节点...{}",event.getProcessInstanceId());
super.taskCreated(event);
List<WxMpTemplateMessage> list = new ArrayList<>();
TaskEntity taskEntity = (TaskEntity)event.getEntity();
List<IdentityLink> idList = taskService.getIdentityLinksForTask(taskEntity.getId());
if (CollectionUtils.isNotEmpty(idList)) {
List<String> candidateUsers = new ArrayList<>();
List<String> candidateGroups = new ArrayList<>();
idList.forEach(identityLink -> {
if (StringUtils.isNotBlank(identityLink.getUserId())) {
candidateUsers.add(identityLink.getUserId());
}
if (StringUtils.isNotBlank(identityLink.getGroupId())) {
candidateGroups.add(identityLink.getGroupId());
}
});
log.info("查询任务节点...{}",String.join(",",candidateUsers),String.join(",",candidateGroups));
if(StringUtils.isNotEmpty(candidateUsers) || StringUtils.isNotEmpty(candidateGroups)){
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(taskEntity.getProcessInstanceId()).singleResult();
List<SysUser> sysUserList = flowBusinessKeyService.findFlowTaskUsers(processInstance.getBusinessKey(),candidateUsers,candidateGroups);
Map<String, Object> map = flowBusinessKeyService.selectLastCommentByProcInsId(processInstance.getId());
String nodeName = "待"+taskEntity.getName();
if(map!=null && "驳回".equals(map.get("commentResult"))){
nodeName += "工程审批驳回,请重新提交或审批";
}
if(StringUtils.isNotEmpty(sysUserList)){
String startUserId = processInstance.getStartUserId();
SysUser sysUser = sysUserMapper.selectUserById(Convert.toLong(startUserId));
for(SysUser taskUser:sysUserList){
//模板数据
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(this.getMsgId(taskUser.getPhonenumber()))
.miniProgram(new WxMpTemplateMessage.MiniProgram(WechatAccountConfig.getWxAppId(), "/pages/project_flowable/await/index?category="+taskEntity.getCategory()+"&barProId="+processInstance.getBusinessKey()))
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(Convert.toLong(processInstance.getBusinessKey()))));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", processInstance.getProcessDefinitionName()));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", nodeName));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,processInstance.getStartTime())));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", sysUser.getNickName()+"["+this.getMsgDepName(sysUser.getDeptId())+"]"));
list.add(templateMessage);
}
this.send(list,processInstance.getProcessDefinitionKey());
}
}
}
}
/**
* [使...使]
* @param event
*/
@Override
protected void taskCompleted(FlowableEngineEntityEvent event) {
log.info("任务节点审批通过...{}",event.getProcessInstanceId());
super.taskCompleted(event);
List<WxMpTemplateMessage> list = new ArrayList<>();
TaskEntity taskEntity = (TaskEntity)event.getEntity();
Task task = taskService.createTaskQuery().taskId(taskEntity.getId()).singleResult();
// 查询任务...
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(taskEntity.getProcessInstanceId()).singleResult();
String startUserId = processInstance.getStartUserId();
SysUser sysUser = sysUserMapper.selectUserById(Convert.toLong(startUserId));
if (Objects.nonNull(task)) {
// Step 2. 获取当前流程所有流程变量(网关节点时需要校验表达式)
Map<String, Object> variables = taskEntity.getVariables();
UserTask nextUserTask = FindNextNodeUtil.getNextUserTasks(repositoryService, task, variables).get(0);
List<SysUser> sysUserList = flowBusinessKeyService.findFlowTaskUsers(processInstance.getBusinessKey(),nextUserTask.getCandidateUsers(),nextUserTask.getCandidateGroups());
if(StringUtils.isNotEmpty(sysUserList)){
for(SysUser taskUser:sysUserList){
//模板数据
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(this.getMsgId(taskUser.getPhonenumber()))
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(Convert.toLong(processInstance.getBusinessKey()))));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", processInstance.getProcessDefinitionName()));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", "待"+nextUserTask.getName()));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,processInstance.getStartTime())));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", sysUser.getNickName()+"["+this.getMsgDepName(sysUser.getDeptId())+"]"));
list.add(templateMessage);
}
this.send(list,processInstance.getProcessDefinitionKey());
}
}
}
/**
*
* @param depId
* @return
*/
private String getMsgDepName(Long depId){
String name = Convert.toStr(redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_DNAME +depId));
if(StringUtils.isNotEmpty(name)){
return name;
}else{
SysDept sysDept = sysDeptMapper.selectDeptById(depId);
//项目名称截取&&超过20字符微信限制并抛出异常
String depName = sysDept.getDeptName();
if(depName.length()>13){
depName = sysDept.getDeptName().substring(0,13);
}
//设置30分钟有效期
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_DNAME +depId,depName,30, TimeUnit.MINUTES);
return depName;
}
}
/**
*
* @param proId
* @return
*/
private String getMsgProName(Long proId){
String name = Convert.toStr(redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_PNAME +proId));
if(StringUtils.isNotEmpty(name)){
return name;
}else{
Map<String, Object> proMap = flowBusinessKeyService.selectSurProjectById(proId);
//项目名称截取&&超过20字符微信限制并抛出异常
String proName = Convert.toStr(proMap.get("projectName"));
if(proName.length()>20){
proName = proName.substring(0,20);
}
//设置30分钟有效期
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_PNAME +proId,proName,30, TimeUnit.MINUTES);
return proName;
}
}
/**
*
* @param userName
* @return
*/
private String getMsgId(String userName){
String openIds = Convert.toStr(redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_OPENID +userName));
if(StringUtils.isNotEmpty(openIds)){
return openIds;
}else{
List<SysUserOpenid> list = sysUserOpenidMapper.findSysUserOpenidsByUser(userName);
if(StringUtils.isNotEmpty(list)){
List<SysUserOpenid> ids = list.stream().filter(u -> StringUtils.isNotBlank(u.getMsgOpenId())).collect(Collectors.toList());
if(StringUtils.isNotEmpty(ids)){
List<String> strs = ids.stream().map(SysUserOpenid :: getMsgOpenId).collect(Collectors.toList());
openIds = String.join(",",strs);
}
}
//设置30分钟有效期
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_OPENID +userName,openIds,30, TimeUnit.MINUTES);
return openIds;
}
}
/**
*
*/
private boolean wxSwitch = false;
/**
*
* @param lsit
*/
private void send(List<WxMpTemplateMessage> lsit, String messageType){
try {
wxSwitch = Convert.toBool(configService.selectConfigByKey("sys.wx.message"),false);
if(wxSwitch && StringUtils.isNotEmpty(lsit)){
for(WxMpTemplateMessage message:lsit){
if(StringUtils.isNotEmpty(message.getToUser())){
String[] toUsers = message.getToUser().split(",");
for(String toUser:toUsers){
//判断短时间内是否已发送相同类型的消息
String key = CacheConstants.WX_MPMESSAGE_KEY +toUser+"-"+messageType;
if(Convert.toBool(redisCache.getCacheObject(key),true)){
//多个登录账号时批量发送
message.setToUser(toUser);
wxMpService.getTemplateMsgService().sendTemplateMsg(message);
//5分钟内不推送相同类型的消息
redisCache.setCacheObject(key,false,5, TimeUnit.MINUTES);
}
}
}
}
}
}catch (Exception e){
log.info("出错了...{}",e.getMessage());
try {
JSONObject jsonObject = JSONObject.parseObject(e.getMessage());
if(Objects.equals(jsonObject.getString("errcode"),"40164")){
String ip = jsonObject.getString("errmsg").split("ipv6")[0].split(" ")[2];
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser("oM5rN6Wb8UyBLuTAFNGjnZCeQs1U")
.templateId(TemplateMessageEnum.SERVER_ERROR.getId())
.build();
templateMessage.addWxMpTemplateData(new WxMpTemplateData("character_string7", "IP>"+ip));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time6", DateUtils.dateTimeNow()));
wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
}
}catch (Exception ex){
ex.printStackTrace();
}
}
}
}

View File

@ -1,130 +0,0 @@
package com.ruoyi.flowable.service;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.FlowTaskEntity;
import java.util.List;
import java.util.Map;
/**
* @author JiangYuQi
* @date 2021-04-03 14:41
*/
public interface IFlowBusinessKeyService {
/**
*
* @param flowTaskEntity
* @return
*/
public List<FlowTaskEntity> selectAllFlowTaskByParams(FlowTaskEntity flowTaskEntity);
/**
*
* @param procInsId
* @return
*/
public FlowTaskEntity findFlowTaskByProcInsId(String procInsId);
/**
*
* @param proId
* @return
*/
public Map<String,Object> selectSurProjectById(Long proId);
/**
*
* @param flowTaskEntity
* @return
*/
public Map<String,Object> quueryCount(FlowTaskEntity flowTaskEntity);
/**
* Id
* @param procInsId
* @return
*/
public List<Map<String, Object>> selectCommentByProcInsId(String procInsId);
/**
* Id
* @param procInsId
* @return
*/
public Map<String, Object> selectLastCommentByProcInsId(String procInsId);
/**
* Id
* @param procInsId
* @return
*/
public Map<String, Object> selectFormDatasByProcInsId(String procInsId);
/**
*
* @param flowTaskEntity
* @return
*/
public List<Map<String, Object>> selectMyAwaitFlowTask(FlowTaskEntity flowTaskEntity);
/**
*
* @param flowTaskEntity
* @return
*/
public List<Map<String, Object>> findAwaitCountGroupByCategory(FlowTaskEntity flowTaskEntity);
/**
*
* @param flowTaskEntity
* @return
*/
public List<Map<String, Object>> selectMyFinishedFlowTask(FlowTaskEntity flowTaskEntity);
public List<FlowTaskEntity> groupByCategory(FlowTaskEntity where);
public List<FlowTaskEntity> groupByUnit(FlowTaskEntity where);
public List<FlowTaskEntity> listByUnit(FlowTaskEntity where);
public List<FlowTaskEntity> listByState(FlowTaskEntity where);
public List<FlowTaskEntity> groupByUnitTotal(FlowTaskEntity where);
public List<FlowTaskEntity> groupByUnitFinish(FlowTaskEntity where);
public List<FlowTaskEntity> groupByProject(long deptId,String proType);
/**
*
* @param flowTaskEntity
* @return
*/
public List<FlowTaskEntity> findSafetyWorkList(FlowTaskEntity flowTaskEntity);
public List<FlowTaskEntity> listByCategory(FlowTaskEntity where);
/**
*
* @param businessKey
* @param candidateUsers
* @param candidateGroups
* @return
*/
public List<SysUser> findFlowTaskUsers(String businessKey, List<String> candidateUsers, List<String> candidateGroups);
/**
* -
* @param where
* @return
*/
public List<FlowTaskEntity> groupFlowBySubDeptType(FlowTaskEntity where);
/**
* -
* @param where
* @return
*/
public List<FlowTaskEntity> listFlowBySubDeptType(FlowTaskEntity where);
}

View File

@ -2,14 +2,10 @@ package com.ruoyi.flowable.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.flowable.domain.vo.ProcKeyRole;
import com.ruoyi.system.domain.FlowProcDefDto;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.UserTask;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
/**
@ -20,29 +16,15 @@ public interface IFlowDefinitionService {
boolean exist(String processDefinitionKey);
/**
*
*
* @param roleId
* @param category
* @param name
* @param pageNum
* @param pageSize
* @return
*/
Page<FlowProcDefDto> list(String roleId, String category, String name, Integer pageNum, Integer pageSize);
/**
*
*
* @param username
* @param category
* @param name
* @param pageNum
* @param pageSize
* @return
*/
Page<FlowProcDefDto> myList(String username, String category,String name,Integer pageNum, Integer pageSize);
Page<FlowProcDefDto> list(String name,Integer pageNum, Integer pageSize);
/**
*
@ -69,7 +51,8 @@ public interface IFlowDefinitionService {
* @return
*/
AjaxResult startProcessInstanceById(String procDefId, String userId, String nickName, Map<String, Object> variables);
AjaxResult startProcessInstanceById(String procDefId, Map<String, Object> variables);
/**
*
@ -94,33 +77,4 @@ public interface IFlowDefinitionService {
* @return
*/
InputStream readImage(String deployId);
/**
*
* @param deployId
* @return
*/
public List<FlowElement> readNodes(String deployId);
/**
*
* @param roleId
* @param keys
* @return
*/
public void updateProcKeyByRoleId(String roleId,List<String> keys);
/**
*
* @param procKeyRole
* @return
*/
public void updateProcKeyRoleSort(ProcKeyRole procKeyRole);
/**
*
* @param deployId
* @return
*/
public List<UserTask> findFlowNodes(String deployId);
}

View File

@ -1,225 +0,0 @@
package com.ruoyi.flowable.service.impl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.flowable.service.IFlowBusinessKeyService;
import com.ruoyi.system.domain.FlowTaskEntity;
import com.ruoyi.system.mapper.FlowBusinessKeyMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
/**
*
*
* @author Tony
* @date 2021-04-03
*/
@Service
@Slf4j
public class FlowBusinessKeyServiceImpl implements IFlowBusinessKeyService {
@Resource
private FlowBusinessKeyMapper flowBusinessKeyMapper;
/**
*
* @param flowTaskEntity
* @return
*/
@Override
public List<FlowTaskEntity> selectAllFlowTaskByParams(FlowTaskEntity flowTaskEntity) {
return flowBusinessKeyMapper.selectAllFlowTaskByParams(flowTaskEntity);
}
/**
*
* @param procInsId
* @return
*/
@Override
public FlowTaskEntity findFlowTaskByProcInsId(String procInsId) {
return flowBusinessKeyMapper.findFlowTaskByProcInsId(procInsId);
}
/**
*
* @param proId
* @return
*/
@Override
public Map<String,Object> selectSurProjectById(Long proId) {
return flowBusinessKeyMapper.selectSurProjectById(proId);
}
/**
*
* @param flowTaskEntity
* @return
*/
@Override
public Map<String,Object> quueryCount(FlowTaskEntity flowTaskEntity) {
flowTaskEntity.setActiveName("await");
int awaitSize = flowBusinessKeyMapper.selectAllFlowTaskByParams(flowTaskEntity).size();
flowTaskEntity.setActiveName("finished");
int finishedSize = flowBusinessKeyMapper.selectAllFlowTaskByParams(flowTaskEntity).size();
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("await",awaitSize);
dataMap.put("finished",finishedSize);
return dataMap;
}
/**
* Id
* @param procInsId
* @return
*/
@Override
public List<Map<String, Object>> selectCommentByProcInsId(String procInsId) {
return flowBusinessKeyMapper.selectCommentByProcInsId(procInsId);
}
/**
* Id
* @param procInsId
* @return
*/
@Override
public Map<String, Object> selectLastCommentByProcInsId(String procInsId){
return flowBusinessKeyMapper.selectLastCommentByProcInsId(procInsId);
}
/**
* Id
* @param procInsId
* @return
*/
@Override
public Map<String, Object> selectFormDatasByProcInsId(String procInsId) {
Map<String, Object> dataMap = new HashMap<>();
List<Map<String, Object>> list = flowBusinessKeyMapper.selectFormDatasByProcInsId(procInsId);
Iterator<Map<String, Object>> it = list.iterator();
while (it.hasNext()) {
Map<String, Object> map = it.next();
dataMap.put(Convert.toStr(map.get("name")), map.get("text"));
}
return dataMap;
}
/**
*
* @param flowTaskEntity
* @return
*/
@Override
public List<Map<String, Object>> selectMyAwaitFlowTask(FlowTaskEntity flowTaskEntity){
return flowBusinessKeyMapper.selectMyAwaitFlowTask(flowTaskEntity);
}
/**
*
* @param flowTaskEntity
* @return
*/
@Override
public List<Map<String, Object>> findAwaitCountGroupByCategory(FlowTaskEntity flowTaskEntity){
return flowBusinessKeyMapper.findAwaitCountGroupByCategory(flowTaskEntity);
}
/**
*
* @param flowTaskEntity
* @return
*/
@Override
public List<Map<String, Object>> selectMyFinishedFlowTask(FlowTaskEntity flowTaskEntity) {
return flowBusinessKeyMapper.selectMyFinishedFlowTask(flowTaskEntity);
}
@Override
public List<FlowTaskEntity> groupByCategory(FlowTaskEntity where) {
return flowBusinessKeyMapper.groupByCategory(where);
}
@Override
public List<FlowTaskEntity> groupByUnit(FlowTaskEntity where) {
return flowBusinessKeyMapper.groupByUnit(where);
}
@Override
public List<FlowTaskEntity> listByUnit(FlowTaskEntity where) {
return flowBusinessKeyMapper.listByUnit(where);
}
@Override
public List<FlowTaskEntity> listByState(FlowTaskEntity where) {
return flowBusinessKeyMapper.listByState(where);
}
@Override
public List<FlowTaskEntity> groupByUnitTotal(FlowTaskEntity where) {
return flowBusinessKeyMapper.groupByUnitTotal(where);
}
@Override
public List<FlowTaskEntity> groupByUnitFinish(FlowTaskEntity where) {
return flowBusinessKeyMapper.groupByUnitFinish(where);
}
@Override
public List<FlowTaskEntity> groupByProject(long deptId,String proType) {
return flowBusinessKeyMapper.groupByProject(deptId,proType);
}
/**
*
* @param flowTaskEntity
* @return
*/
@Override
public List<FlowTaskEntity> findSafetyWorkList(FlowTaskEntity flowTaskEntity) {
return flowBusinessKeyMapper.findSafetyWorkList(flowTaskEntity);
}
@Override
public List<FlowTaskEntity> listByCategory(FlowTaskEntity where) {
return flowBusinessKeyMapper.listByCategory(where);
}
/**
*
* @param businessKey
* @param candidateUsers
* @param candidateGroups
* @return
*/
@Override
public List<SysUser> findFlowTaskUsers(String businessKey, List<String> candidateUsers, List<String> candidateGroups){
if(StringUtils.isNotEmpty(candidateGroups) && candidateGroups.contains("47")){
return flowBusinessKeyMapper.findFlowTaskDeptUsers(businessKey,candidateUsers,candidateGroups);
}else{
return flowBusinessKeyMapper.findFlowTaskUsers(businessKey,candidateUsers,candidateGroups);
}
}
/**
* -
* @param where
* @return
*/
@Override
public List<FlowTaskEntity> groupFlowBySubDeptType(FlowTaskEntity where) {
return flowBusinessKeyMapper.groupFlowBySubDeptType(where);
}
/**
* -
* @param where
* @return
*/
@Override
public List<FlowTaskEntity> listFlowBySubDeptType(FlowTaskEntity where) {
return flowBusinessKeyMapper.listFlowBySubDeptType(where);
}
}

View File

@ -3,39 +3,32 @@ package com.ruoyi.flowable.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.flowable.common.constant.ProcessConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.flowable.common.enums.FlowComment;
import com.ruoyi.flowable.domain.vo.ProcKeyRole;
import com.ruoyi.flowable.service.IFlowBusinessKeyService;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.FlowProcDefDto;
import com.ruoyi.flowable.factory.FlowServiceFactory;
import com.ruoyi.flowable.service.IFlowDefinitionService;
import com.ruoyi.flowable.service.ISysDeployFormService;
import com.ruoyi.system.domain.FlowTaskEntity;
import com.ruoyi.system.domain.SysForm;
import com.ruoyi.system.mapper.FlowBusinessKeyMapper;
import com.ruoyi.system.mapper.FlowDeployMapper;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.UserTask;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.repository.ProcessDefinitionQuery;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.image.impl.DefaultProcessDiagramGenerator;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
@ -68,9 +61,6 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
@Resource
private FlowDeployMapper flowDeployMapper;
@Autowired
private FlowBusinessKeyMapper flowBusinessKeyMapper;
private static final String BPMN_FILE_SUFFIX = ".bpmn";
@Override
@ -85,57 +75,52 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
/**
*
*
* @param roleId
* @param category
* @param name
* @param pageNum
* @param pageSize
* @return
*/
@Override
public Page<FlowProcDefDto> list(String roleId, String category, String name, Integer pageNum, Integer pageSize) {
public Page<FlowProcDefDto> list(String name, Integer pageNum, Integer pageSize) {
Page<FlowProcDefDto> page = new Page<>();
// // 流程定义列表数据查询
// final ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
// if (StringUtils.isNotEmpty(name)) {
// processDefinitionQuery.processDefinitionNameLike(name);
// }
//// processDefinitionQuery.orderByProcessDefinitionKey().asc();
// page.setTotal(processDefinitionQuery.count());
// List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage(pageSize * (pageNum - 1), pageSize);
//
// List<FlowProcDefDto> dataList = new ArrayList<>();
// for (ProcessDefinition processDefinition : processDefinitionList) {
// String deploymentId = processDefinition.getDeploymentId();
// Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
// FlowProcDefDto reProcDef = new FlowProcDefDto();
// BeanUtils.copyProperties(processDefinition, reProcDef);
// SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(deploymentId);
// if (Objects.nonNull(sysForm)) {
// reProcDef.setFormName(sysForm.getFormName());
// reProcDef.setFormId(sysForm.getFormId());
// }
// // 流程定义时间
// reProcDef.setDeploymentTime(deployment.getDeploymentTime());
// dataList.add(reProcDef);
// }
PageHelper.startPage(pageNum, pageSize);
final List<FlowProcDefDto> dataList = flowDeployMapper.selectDeployList(roleId,category,name);
final List<FlowProcDefDto> dataList = flowDeployMapper.selectDeployList(name);
// 加载挂表单
//for (FlowProcDefDto procDef : dataList) {
// SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId());
// if (Objects.nonNull(sysForm)) {
// procDef.setFormName(sysForm.getFormName());
// procDef.setFormId(sysForm.getFormId());
// }
//}
for (FlowProcDefDto procDef : dataList) {
SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId());
if (Objects.nonNull(sysForm)) {
procDef.setFormName(sysForm.getFormName());
procDef.setFormId(sysForm.getFormId());
}
}
page.setTotal(new PageInfo(dataList).getTotal());
page.setRecords(dataList);
return page;
}
/**
*
*
* @param category
* @param name
* @param pageNum
* @param pageSize
* @return
*/
@Override
public Page<FlowProcDefDto> myList(String username, String category, String name, Integer pageNum, Integer pageSize) {
Page<FlowProcDefDto> page = new Page<>();
PageHelper.startPage(pageNum, pageSize);
final List<FlowProcDefDto> dataList = flowDeployMapper.selectMyDeployList(username, category ,name);
// 加载挂表单
//for (FlowProcDefDto procDef : dataList) {
// SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(procDef.getDeploymentId());
// if (Objects.nonNull(sysForm)) {
// procDef.setFormName(sysForm.getFormName());
// procDef.setFormId(sysForm.getFormId());
// }
//}
page.setTotal(new PageInfo(dataList).getTotal());
page.setRecords(dataList);
return page;
}
/**
*
@ -195,42 +180,6 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
}
/**
*
* @param deployId
* @return
*/
@Override
public List<FlowElement> readNodes(String deployId) {
List<FlowElement> list = new ArrayList<>();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
//获得图片流
DefaultProcessDiagramGenerator diagramGenerator = new DefaultProcessDiagramGenerator();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
Collection<FlowElement> flowElements = bpmnModel.getProcesses().get(0).getFlowElements();
if(flowElements.size()>0){
for(FlowElement fe:flowElements){
list.add(fe);
}
}
//输出为节点描述
return list;
}
/**
*
* @param deployId
* @return
*/
@Override
public List<UserTask> findFlowNodes(String deployId){
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
//获得图片流
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
List<UserTask> list = bpmnModel.getProcesses().get(0).findFlowElementsOfType(UserTask.class);
return list;
}
/**
* ID
*
@ -239,45 +188,30 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
* @return
*/
@Override
@Transactional
public AjaxResult startProcessInstanceById(String procDefId, String userId, String nickName, Map<String, Object> variables) {
public AjaxResult startProcessInstanceById(String procDefId, Map<String, Object> variables) {
try {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId)
.latestVersion().singleResult();
if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) {
return AjaxResult.error("流程已被挂起,请联系管理员先激活流程");
return AjaxResult.error("流程已被挂起,请先激活流程");
}
/*try {
//分包单位资质审批需要验证是否已经提交过相关审批
if(Objects.equals("9",processDefinition.getCategory())){
FlowTaskEntity flowTaskEntity = new FlowTaskEntity();
flowTaskEntity.setBusinessKey(Convert.toStr(variables.get("businessKey")));
flowTaskEntity.setProcDefKey(processDefinition.getKey());
flowTaskEntity.setStartDeptName(SecurityUtils.getLoginUser().getUser().getDept().getDeptName());
List<FlowTaskEntity> list = flowBusinessKeyMapper.selectAllFlowTaskByParams(flowTaskEntity);
if(StringUtils.isNotEmpty(list)){
return AjaxResult.error("当前单位已提交过分包单位资质审批,请勿重复提交");
}
}
}catch (Exception e){
e.printStackTrace();
}*/
// 设置流程发起人Id到流程中
identityService.setAuthenticatedUserId(userId);
variables.put(ProcessConstants.PROCESS_INITIATOR, userId);
ProcessInstance processInstance;
if(variables.get("businessKey")!=null){
processInstance = runtimeService.startProcessInstanceById(procDefId, Convert.toStr(variables.get("businessKey")),variables);
}else{
processInstance = runtimeService.startProcessInstanceById(procDefId, variables);
}
// 给第一步申请人节点设置任务执行人和意见
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult();
if (Objects.nonNull(task)) {
taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), nickName + "发起流程申请");
taskService.setAssignee(task.getId(), Convert.toStr(userId));
taskService.complete(task.getId(), variables);
}
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
identityService.setAuthenticatedUserId(sysUser.getUserId().toString());
variables.put(ProcessConstants.PROCESS_INITIATOR, sysUser.getUserId());
runtimeService.startProcessInstanceById(procDefId, variables);
// 流程发起时 跳过发起人节点
// SysUser sysUser = SecurityUtils.getLoginUser().getUser();
// identityService.setAuthenticatedUserId(sysUser.getUserId().toString());
// variables.put(ProcessConstants.PROCESS_INITIATOR, "");
// ProcessInstance processInstance = runtimeService.startProcessInstanceById(procDefId, variables);
// // 给第一步申请人节点设置任务执行人和意见
// Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult();
// if (Objects.nonNull(task)) {
// taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.NORMAL.getType(), sysUser.getNickName() + "发起流程申请");
//// taskService.setAssignee(task.getId(), sysUser.getUserId().toString());
// taskService.complete(task.getId(), variables);
// }
return AjaxResult.success("流程启动成功");
} catch (Exception e) {
e.printStackTrace();
@ -317,35 +251,5 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
repositoryService.deleteDeployment(deployId, true);
}
/**
*
* @param roleId
* @param keys
* @return
*/
@Override
public void updateProcKeyByRoleId(String roleId,List<String> keys) {
//根据角色删除原有流程定义
flowDeployMapper.deleteDeployByRoleId(roleId);
if(keys.size()>0){
List<Map<String, Object>> list = new ArrayList<>();
for(int i=0;i<keys.size();i++){
Map<String, Object> map = new HashMap<>();
map.put("key",keys.get(i));
map.put("roleId",roleId);
list.add(map);
}
flowDeployMapper.batchDeployRoleRole(list);
}
}
/**
*
* @param procKeyRole
* @return
*/
public void updateProcKeyRoleSort(ProcKeyRole procKeyRole) {
flowDeployMapper.updateProcKeyRoleSort(procKeyRole.getRoleId(),procKeyRole.getKey(),procKeyRole.getSort());
}
}

View File

@ -9,9 +9,12 @@ import com.ruoyi.flowable.service.IFlowInstanceService;
import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.task.api.Task;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

View File

@ -1,12 +1,12 @@
package com.ruoyi.flowable.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.flowable.common.constant.ProcessConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
@ -24,12 +24,10 @@ import com.ruoyi.flowable.factory.FlowServiceFactory;
import com.ruoyi.flowable.flow.CustomProcessDiagramGenerator;
import com.ruoyi.flowable.flow.FindNextNodeUtil;
import com.ruoyi.flowable.flow.FlowableUtils;
import com.ruoyi.flowable.flow.ModelUtils;
import com.ruoyi.flowable.service.IFlowTaskService;
import com.ruoyi.flowable.service.ISysDeployFormService;
import com.ruoyi.flowable.service.ISysFormService;
import com.ruoyi.system.domain.SysForm;
import com.ruoyi.system.mapper.FlowBusinessKeyMapper;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
@ -46,6 +44,7 @@ import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.task.Comment;
@ -87,8 +86,6 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
private ISysDeployFormService sysInstanceFormService;
@Resource
private ISysFormService sysFormService;
@Resource
private FlowBusinessKeyMapper flowBusinessKeyMapper;
/**
*
@ -106,12 +103,9 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment());
taskService.resolveTask(taskVo.getTaskId(), taskVo.getVariables());
} else {
if(StringUtils.isNotEmpty(taskVo.getComment())){
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment());
}else{
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getAssignee()+"重新提交流程申请!!");
}
taskService.setAssignee(taskVo.getTaskId(), taskVo.getUserId());
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment());
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
taskService.setAssignee(taskVo.getTaskId(), userId.toString());
taskService.complete(taskVo.getTaskId(), taskVo.getVariables());
}
return AjaxResult.success();
@ -188,6 +182,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
}
// 目的获取所有需要被跳转的节点 currentIds
// 取其中一个父级任务,因为后续要么存在公共网关,要么就是串行公共线路
UserTask oneUserTask = parentUserTaskList.get(0);
@ -215,9 +210,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
}));
// 设置驳回意见
currentTaskIds.forEach(item ->
taskService.addComment(item, task.getProcessInstanceId(), FlowComment.REJECT.getType(), flowTaskVo.getComment()));
taskService.setAssignee(flowTaskVo.getTaskId(), flowTaskVo.getUserId());
currentTaskIds.forEach(item -> taskService.addComment(item, task.getProcessInstanceId(), FlowComment.REJECT.getType(), flowTaskVo.getComment()));
try {
// 如果父级任务多于 1 个,说明当前节点不是并行节点,原因为不考虑多对多情况
if (targetIds.size() > 1) {
@ -305,7 +299,6 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}));
// 设置回退意见
currentTaskIds.forEach(currentTaskId -> taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), flowTaskVo.getComment()));
taskService.setAssignee(flowTaskVo.getTaskId(), flowTaskVo.getUserId());
try {
// 1 对 1 或 多 对 1 情况currentIds 当前要跳转的节点列表(1或多)targetKey 跳转到的节点(1)
@ -528,59 +521,58 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery.listPage(queryVo.getPageSize() * (queryVo.getPageNum() - 1), queryVo.getPageSize());
page.setTotal(historicProcessInstanceQuery.count());
List<FlowTaskDto> flowList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(historicProcessInstances)){
for (HistoricProcessInstance hisIns : historicProcessInstances) {
FlowTaskDto flowTask = new FlowTaskDto();
flowTask.setCreateTime(hisIns.getStartTime());
flowTask.setFinishTime(hisIns.getEndTime());
flowTask.setProcInsId(hisIns.getId());
// 计算耗时
if (Objects.nonNull(hisIns.getEndTime())) {
long time = hisIns.getEndTime().getTime() - hisIns.getStartTime().getTime();
flowTask.setDuration(getDate(time));
} else {
long time = System.currentTimeMillis() - hisIns.getStartTime().getTime();
flowTask.setDuration(getDate(time));
}
// 流程定义信息
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(hisIns.getProcessDefinitionId())
.singleResult();
flowTask.setDeployId(pd.getDeploymentId());
flowTask.setProcDefName(pd.getName());
flowTask.setProcDefVersion(pd.getVersion());
flowTask.setCategory(pd.getCategory());
flowTask.setProcDefVersion(pd.getVersion());
// 当前所处流程
List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
if (CollectionUtils.isNotEmpty(taskList)) {
flowTask.setTaskId(taskList.get(0).getId());
flowTask.setTaskName(taskList.get(0).getName());
if (StringUtils.isNotBlank(taskList.get(0).getAssignee())) {
// 当前任务节点办理人信息
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(taskList.get(0).getAssignee()));
if (Objects.nonNull(sysUser)) {
flowTask.setAssigneeId(sysUser.getUserId());
flowTask.setAssigneeName(sysUser.getNickName());
flowTask.setAssigneeDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : "");
}
}
} else {
List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
flowTask.setTaskId(historicTaskInstance.get(0).getId());
flowTask.setTaskName(historicTaskInstance.get(0).getName());
if (StringUtils.isNotBlank(historicTaskInstance.get(0).getAssignee())) {
// 当前任务节点办理人信息
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(historicTaskInstance.get(0).getAssignee()));
if (Objects.nonNull(sysUser)) {
flowTask.setAssigneeId(sysUser.getUserId());
flowTask.setAssigneeName(sysUser.getNickName());
flowTask.setAssigneeDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : "");
}
}
}
flowList.add(flowTask);
for (HistoricProcessInstance hisIns : historicProcessInstances) {
FlowTaskDto flowTask = new FlowTaskDto();
flowTask.setCreateTime(hisIns.getStartTime());
flowTask.setFinishTime(hisIns.getEndTime());
flowTask.setProcInsId(hisIns.getId());
// 计算耗时
if (Objects.nonNull(hisIns.getEndTime())) {
long time = hisIns.getEndTime().getTime() - hisIns.getStartTime().getTime();
flowTask.setDuration(getDate(time));
} else {
long time = System.currentTimeMillis() - hisIns.getStartTime().getTime();
flowTask.setDuration(getDate(time));
}
// 流程定义信息
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(hisIns.getProcessDefinitionId())
.singleResult();
flowTask.setDeployId(pd.getDeploymentId());
flowTask.setProcDefName(pd.getName());
flowTask.setProcDefVersion(pd.getVersion());
flowTask.setCategory(pd.getCategory());
flowTask.setProcDefVersion(pd.getVersion());
// 当前所处流程
List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
if (CollectionUtils.isNotEmpty(taskList)) {
flowTask.setTaskId(taskList.get(0).getId());
flowTask.setTaskName(taskList.get(0).getName());
if (StringUtils.isNotBlank(taskList.get(0).getAssignee())) {
// 当前任务节点办理人信息
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(taskList.get(0).getAssignee()));
if (Objects.nonNull(sysUser)) {
flowTask.setAssigneeId(sysUser.getUserId());
flowTask.setAssigneeName(sysUser.getNickName());
flowTask.setAssigneeDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : "");
}
}
} else {
List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
flowTask.setTaskId(historicTaskInstance.get(0).getId());
flowTask.setTaskName(historicTaskInstance.get(0).getName());
if (StringUtils.isNotBlank(historicTaskInstance.get(0).getAssignee())) {
// 当前任务节点办理人信息
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(historicTaskInstance.get(0).getAssignee()));
if (Objects.nonNull(sysUser)) {
flowTask.setAssigneeId(sysUser.getUserId());
flowTask.setAssigneeName(sysUser.getNickName());
flowTask.setAssigneeDeptName(Objects.nonNull(sysUser.getDept()) ? sysUser.getDept().getDeptName() : "");
}
}
}
flowList.add(flowTask);
}
page.setRecords(flowList);
return AjaxResult.success(page);
@ -609,10 +601,11 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
List<EndEvent> endNodes = process.findFlowElementsOfType(EndEvent.class, false);
if (CollectionUtils.isNotEmpty(endNodes)) {
// TODO 取消流程为什么要设置流程发起人?
Authentication.setAuthenticatedUserId(flowTaskVo.getUserId());
taskService.addComment(task.get(0).getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(),
StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment());
taskService.setAssignee(task.get(0).getId(), flowTaskVo.getUserId());
// SysUser loginUser = SecurityUtils.getLoginUser().getUser();
// Authentication.setAuthenticatedUserId(loginUser.getUserId().toString());
// taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(),
// StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment());
// 获取当前流程最后一个节点
String endId = endNodes.get(0).getId();
List<Execution> executions = runtimeService.createExecutionQuery()
@ -624,75 +617,66 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
.moveExecutionsToSingleActivityId(executionIds, endId).changeState();
}
}
return AjaxResult.success();
}
/**
*
*
*
* @param flowTaskVo
* @param flowTaskVo
* @return
*/
@Override
@Transactional()
public AjaxResult revokeProcess(FlowTaskVo flowTaskVo) {
String procInsId = flowTaskVo.getInstanceId();
String taskId = flowTaskVo.getTaskId();
// 校验流程是否结束
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
.processInstanceId(procInsId)
.active()
.singleResult();
if(ObjectUtil.isNull(processInstance)) {
throw new RuntimeException("流程已结束或已挂起,无法执行撤回操作");
Task task = taskService.createTaskQuery().processInstanceId(flowTaskVo.getInstanceId()).singleResult();
if (task == null) {
throw new CustomException("流程未启动或已执行完成,无法撤回");
}
// 获取待撤回任务实例
HistoricTaskInstance currTaskIns = historyService.createHistoricTaskInstanceQuery()
.taskId(taskId)
.taskAssignee(flowTaskVo.getUserId())
.singleResult();
if (ObjectUtil.isNull(currTaskIns)) {
throw new RuntimeException("当前任务无法执行撤回操作或不存在。");
}
// 获取 bpmn 模型
BpmnModel bpmnModel = repositoryService.getBpmnModel(currTaskIns.getProcessDefinitionId());
UserTask currUserTask = ModelUtils.getUserTaskByKey(bpmnModel, currTaskIns.getTaskDefinitionKey());
// 查找下一级用户任务列表
List<UserTask> nextUserTaskList = ModelUtils.findNextUserTasks(currUserTask);
List<String> nextUserTaskKeys = nextUserTaskList.stream().map(UserTask::getId).collect(Collectors.toList());
// 获取当前节点之后已完成的流程历史节点
List<HistoricTaskInstance> finishedTaskInsList = historyService.createHistoricTaskInstanceQuery()
.processInstanceId(procInsId)
.taskCreatedAfter(currTaskIns.getEndTime())
.finished()
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
List<HistoricTaskInstance> htiList = historyService.createHistoricTaskInstanceQuery()
.processInstanceId(task.getProcessInstanceId())
.orderByTaskCreateTime()
.asc()
.list();
for (HistoricTaskInstance finishedTaskInstance : finishedTaskInsList) {
// 检查已完成流程历史节点是否存在下一级中
if (CollUtil.contains(nextUserTaskKeys, finishedTaskInstance.getTaskDefinitionKey())) {
throw new RuntimeException("下一流程已处理,无法执行撤回操作");
String myTaskId = null;
HistoricTaskInstance myTask = null;
for (HistoricTaskInstance hti : htiList) {
if (loginUser.getUserId().toString().equals(hti.getAssignee())) {
myTaskId = hti.getId();
myTask = hti;
break;
}
}
// 获取所有激活的任务节点,找到需要撤回的任务
List<Task> activateTaskList = taskService.createTaskQuery().processInstanceId(procInsId).list();
List<String> revokeExecutionIds = new ArrayList<>();
for (Task task : activateTaskList) {
// 检查激活的任务节点是否存在下一级中,如果存在,则加入到需要撤回的节点
if (CollUtil.contains(nextUserTaskKeys, task.getTaskDefinitionKey())) {
// 添加撤回审批信息
taskService.setAssignee(task.getId(), flowTaskVo.getUserId());
taskService.addComment(task.getId(), task.getProcessInstanceId(), FlowComment.REVOKE.getType(), flowTaskVo.getAssignee() + "撤回流程审批");
revokeExecutionIds.add(task.getExecutionId());
if (null == myTaskId) {
throw new CustomException("该任务非当前用户提交,无法撤回");
}
String processDefinitionId = myTask.getProcessDefinitionId();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
//变量
// Map<String, VariableInstance> variables = runtimeService.getVariableInstances(currentTask.getExecutionId());
String myActivityId = null;
List<HistoricActivityInstance> haiList = historyService.createHistoricActivityInstanceQuery()
.executionId(myTask.getExecutionId()).finished().list();
for (HistoricActivityInstance hai : haiList) {
if (myTaskId.equals(hai.getTaskId())) {
myActivityId = hai.getActivityId();
break;
}
}
try {
runtimeService.createChangeActivityStateBuilder()
.processInstanceId(procInsId)
.moveExecutionsToSingleActivityId(revokeExecutionIds, currTaskIns.getTaskDefinitionKey()).changeState();
} catch (FlowableObjectNotFoundException e) {
throw new RuntimeException("未找到流程实例,流程可能已发生变化");
} catch (FlowableException e) {
throw new RuntimeException("执行撤回操作失败");
}
FlowNode myFlowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(myActivityId);
Execution execution = runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult();
String activityId = execution.getActivityId();
FlowNode flowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(activityId);
//记录原活动方向
List<SequenceFlow> oriSequenceFlows = new ArrayList<>(flowNode.getOutgoingFlows());
return AjaxResult.success();
}
@ -895,13 +879,13 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
map.put("flowList", hisFlowList);
}
// 第一次申请获取初始化表单
// if (StringUtils.isNotBlank(deployId)) {
// SysForm sysForm = sysInstanceFormService.selectSysDeployFormByDeployId(deployId);
// if (Objects.isNull(sysForm)) {
// return AjaxResult.error("请先配置流程表单");
// }
// map.put("formData", JSONObject.parseObject(sysForm.getFormContent()));
// }
if (StringUtils.isNotBlank(deployId)) {
SysForm sysForm = sysInstanceFormService.selectSysDeployFormByDeployId(deployId);
if (Objects.isNull(sysForm)) {
return AjaxResult.error("请先配置流程表单");
}
map.put("formData", JSONObject.parseObject(sysForm.getFormContent()));
}
return AjaxResult.success(map);
}
@ -1135,39 +1119,36 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
public AjaxResult flowXmlAndNode(String procInsId, String deployId) {
try {
List<FlowViewerDto> flowViewerList = new ArrayList<>();
if(StringUtils.isNotEmpty(procInsId)){
// 获取已经完成的节点
List<HistoricActivityInstance> listFinished = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(procInsId)
.finished()
.list();
// 获取已经完成的节点
List<HistoricActivityInstance> listFinished = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(procInsId)
.finished()
.list();
// 保存已经完成的流程节点编号
listFinished.forEach(s -> {
FlowViewerDto flowViewerDto = new FlowViewerDto();
flowViewerDto.setKey(s.getActivityId());
flowViewerDto.setCompleted(true);
flowViewerList.add(flowViewerDto);
});
// 保存已经完成的流程节点编号
listFinished.forEach(s -> {
FlowViewerDto flowViewerDto = new FlowViewerDto();
flowViewerDto.setKey(s.getActivityId());
flowViewerDto.setCompleted(true);
flowViewerList.add(flowViewerDto);
});
// 获取代办节点
List<HistoricActivityInstance> listUnFinished = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(procInsId)
.unfinished()
.list();
// 获取代办节点
List<HistoricActivityInstance> listUnFinished = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(procInsId)
.unfinished()
.list();
// 保存需要代办的节点编号
listUnFinished.forEach(s -> {
FlowViewerDto flowViewerDto = new FlowViewerDto();
flowViewerDto.setKey(s.getActivityId());
flowViewerDto.setCompleted(false);
flowViewerList.add(flowViewerDto);
});
}
// 保存需要代办的节点编号
listUnFinished.forEach(s -> {
FlowViewerDto flowViewerDto = new FlowViewerDto();
flowViewerDto.setKey(s.getActivityId());
flowViewerDto.setCompleted(false);
flowViewerList.add(flowViewerDto);
});
Map<String, Object> result = new HashMap();
// xmlData 数据
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deployId).singleResult();
InputStream inputStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName());
String xmlData = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
result.put("nodeData", flowViewerList);

View File

@ -2,7 +2,6 @@ package com.ruoyi.framework.aspectj;
import java.util.Collection;
import java.util.Map;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
@ -85,11 +84,7 @@ public class LogAspect
try
{
// 获取当前的用户
LoginUser loginUser = null;
if(!SecurityUtils.getAuthentication().getPrincipal().equals("anonymousUser")) {
loginUser = SecurityUtils.getLoginUser();
}
LoginUser loginUser = SecurityUtils.getLoginUser();
// *========数据库日志=========*//
SysOperLog operLog = new SysOperLog();
@ -101,9 +96,6 @@ public class LogAspect
if (loginUser != null)
{
operLog.setOperName(loginUser.getUsername());
/*********************getAuthentication未获取用户信息时从RequestURI中获取操作人信息***************************/
}else if(ServletUtils.getRequest().getHeader("Username")!=null){
operLog.setOperName(ServletUtils.getRequest().getHeader("Username"));
}
if (e != null)

View File

@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login","/wechat/**", "/common/**", "/register", "/captchaImage","/bgscreen/**","/publics/**","/system/dict/data/**").permitAll()
.antMatchers("/login", "/register", "/captchaImage", "/weixin/**","/bgscreen/**","/publics/**").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/**/img/**", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

View File

@ -1,16 +1,11 @@
package com.ruoyi.framework.web.service;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Component;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants;
@ -42,8 +37,6 @@ import com.ruoyi.system.service.ISysUserService;
@Component
public class SysLoginService
{
private static final Logger log = LoggerFactory.getLogger(SysLoginService.class);
@Autowired
private TokenService tokenService;
@ -107,107 +100,6 @@ public class SysLoginService
return tokenService.createToken(loginUser);
}
/**
*
*
* @param username
* @param password
* @param code
* @param uuid
* @return
*/
public String wxLogin(String username, String password, String code, String uuid, String openId)
{
// 验证码校验
validateCaptcha(username, code, uuid);
// 登录前置校验
loginPreCheck(username, password);
// 用户验证
Authentication authentication = null;
try
{
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken);
}
catch (Exception e)
{
if (e instanceof BadCredentialsException)
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
}
else
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
throw new ServiceException(e.getMessage());
}
}
finally
{
AuthenticationContextHolder.clearContext();
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
recordLoginInfo(loginUser.getUserId());
// 生成token
return tokenService.createWxToken(loginUser,openId);
}
@Autowired
private SysPermissionService permissionService;
/**
*
*
* @param username
* @param openId openId
* @return
*/
public String wxLogin(String username,String openId)
{
log.info("【"+username+"】免密登录...openId==>{}",openId);
SysUser user = userService.selectUserByUserName(username);
LoginUser loginUser = new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
recordLoginInfo(loginUser.getUserId());
// 生成token
return tokenService.createWxToken(loginUser,openId);
}
/**
*
*
* @param username
* @param password
*/
public String unifiedLogin(String username, String password) {
// 用户验证
Authentication authentication = null;
try {
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken);
} catch (Exception e) {
if (e instanceof BadCredentialsException) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
} else {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
throw new ServiceException(e.getMessage());
}
} finally {
AuthenticationContextHolder.clearContext();
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser)authentication.getPrincipal();
recordLoginInfo(loginUser.getUserId());
return tokenService.createToken(loginUser);
}
/**
*
*

View File

@ -1,9 +1,6 @@
package com.ruoyi.framework.web.service;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
@ -31,8 +28,6 @@ public class SysPasswordService
@Autowired
private RedisCache redisCache;
public static final String defaultNoSecurityPassWord = "??????????????????????";
@Value(value = "${user.password.maxRetryCount}")
private int maxRetryCount;
@ -70,7 +65,7 @@ public class SysPasswordService
throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime);
}
if (!Objects.equals(password,defaultNoSecurityPassWord) && !matches(user, password))
if (!matches(user, password))
{
retryCount = retryCount + 1;
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL,

View File

@ -80,7 +80,7 @@ public class SysRegisterService
boolean regFlag = userService.registerUser(sysUser);
if (!regFlag)
{
msg = "注册失败,请联系系统理人员";
msg = "注册失败,请联系系统理人员";
}
else
{

View File

@ -100,23 +100,6 @@ public class TokenService
}
}
/**
*
*/
public String delLoginUser(HttpServletRequest request)
{
String token = this.getToken(request);
if (StringUtils.isNotEmpty(token))
{
Claims claims = parseToken(token);
String openId = (String) claims.get(Constants.LOGIN_USER_KEY);
String userKey = getTokenKey(openId);
redisCache.deleteObject(userKey);
return openId;
}
return null;
}
/**
*
*
@ -135,23 +118,6 @@ public class TokenService
return createToken(claims);
}
/**
*
*
* @param loginUser
* @return
*/
public String createWxToken(LoginUser loginUser,String openId)
{
loginUser.setToken(openId);
setUserAgent(loginUser);
refreshToken(loginUser);
Map<String, Object> claims = new HashMap<>();
claims.put(Constants.LOGIN_USER_KEY, openId);
return createToken(claims);
}
/**
* 20
*
@ -182,25 +148,6 @@ public class TokenService
redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
}
/**
*
*
* @param token token
*/
public void refreshMobileToken(String token)
{
Claims claims = parseToken(token);
// 解析对应的权限以及用户信息
String uuid = (String) claims.get(Constants.LOGIN_USER_KEY);
String userKey = getTokenKey(uuid);
LoginUser user = redisCache.getCacheObject(userKey);
user.setLoginTime(System.currentTimeMillis());
int mobileExpireTime = expireTime * 3650 * 60 ;
user.setExpireTime(user.getLoginTime() + mobileExpireTime * MILLIS_MINUTE);
// 根据uuid将loginUser缓存
redisCache.setCacheObject(userKey, user, mobileExpireTime, TimeUnit.HOURS);
}
/**
*
*

View File

@ -1,6 +1,5 @@
package com.ruoyi.framework.web.service;
import com.ruoyi.common.enums.PublicStateEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -10,6 +9,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysUserService;
@ -42,12 +42,12 @@ public class UserDetailsServiceImpl implements UserDetailsService
log.info("登录用户:{} 不存在.", username);
throw new ServiceException("登录用户:" + username + " 不存在");
}
else if (PublicStateEnum.DELETED.getCode().equals(user.getDelFlag()))
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{
log.info("登录用户:{} 已被删除.", username);
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
}
else if (PublicStateEnum.DISABLE.getCode().equals(user.getStatus()))
else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
{
log.info("登录用户:{} 已被停用.", username);
throw new ServiceException("对不起,您的账号:" + username + " 已停用");

View File

@ -35,15 +35,6 @@
<artifactId>ruoyi-common</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,440 +0,0 @@
package com.ruoyi.quartz.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* -- dev_pitmonit_southsmos_alarm
*
* @author ruoyi
* @date 2024-08-08
*/
public class DevPitmonitSouthsmosAlarm extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 配置ID */
@Excel(name = "配置ID")
private Long cfgId;
/** 服务端ID */
@Excel(name = "服务端ID")
private Long srvId;
/** 该条报警信息的一个描述 */
@Excel(name = "该条报警信息的一个描述")
private String alarmInfo;
/** 产生报警的来源,格式:点名-监测分项名 */
@Excel(name = "产生报警的来源,格式:点名-监测分项名")
private String alarmSource;
/** 次产生报警的时间(暂时没用上) */
@Excel(name = "次产生报警的时间", readConverterExp = "次产生报警的时间(暂时没用上)")
private Date gmtAlarm;
/** 报警时间,如果数据回落至正常范围或被处理,则报警结束 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报警时间,如果数据回落至正常范围或被处理,则报警结束", width = 30, dateFormat = "yyyy-MM-dd")
private Date gmtAlarmOver;
/** 开始后第一次产生报警的时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "开始后第一次产生报警的时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date gmtAlarmStart;
/** 数据库记录创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "数据库记录创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date gmtCreate;
/** 报警更新时间,该报警每产生一次都会更新该时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报警更新时间,该报警每产生一次都会更新该时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date gmtModified;
/** 报警所处最高级别1超预警2超报警3超控制 */
@Excel(name = "报警所处最高级别1超预警2超报警3超控制")
private Long level;
/** 监测项id */
@Excel(name = "监测项id")
private Long meId;
/** 监测项名称 */
@Excel(name = "监测项名称")
private String meName;
/** 监测分项id */
@Excel(name = "监测分项id")
private Long monitorItemId;
/** 报警产生次数,如果报警来源一样,类型一样,则认为是同一条报警,多次产生也只会累加次数 */
@Excel(name = "报警产生次数,如果报警来源一样,类型一样,则认为是同一条报警,多次产生也只会累加次数")
private Long numbers;
/** 报警处理结果 */
@Excel(name = "报警处理结果")
private String result;
/** 处理图片地址 */
@Excel(name = "处理图片地址")
private String resultUrl;
/** 报警测点id */
@Excel(name = "报警测点id")
private Long spId;
/** 报警测点名 */
@Excel(name = "报警测点名")
private String spName;
/** 处理人 */
@Excel(name = "处理人")
private String staff;
/** 处理电话 */
@Excel(name = "处理电话")
private String staffPhone;
/** 报警状态:实时、历史,处理过的报警信息将变为历史,不再返回 */
@Excel(name = "报警状态:实时、历史,处理过的报警信息将变为历史,不再返回")
private String status;
/** 报警工程id */
@Excel(name = "报警工程id")
private Long structureId;
/** 报警工程名 */
@Excel(name = "报警工程名")
private String structureName;
/** 该警最高级别设置的阈值 */
@Excel(name = "该警最高级别设置的阈值")
private String threshold;
/** 类型:数据异常、设备异常,数据报警都是数据异常 */
@Excel(name = "类型:数据异常、设备异常,数据报警都是数据异常")
private String type;
/** 判断的标准:测量值、单次变化量、累计变化量、变化速率 */
@Excel(name = "判断的标准:测量值、单次变化量、累计变化量、变化速率")
private String variety;
/** 状态 */
@Excel(name = "状态")
private Long state;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long isDel;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCfgId(Long cfgId)
{
this.cfgId = cfgId;
}
public Long getCfgId()
{
return cfgId;
}
public void setSrvId(Long srvId)
{
this.srvId = srvId;
}
public Long getSrvId()
{
return srvId;
}
public void setAlarmInfo(String alarmInfo)
{
this.alarmInfo = alarmInfo;
}
public String getAlarmInfo()
{
return alarmInfo;
}
public void setAlarmSource(String alarmSource)
{
this.alarmSource = alarmSource;
}
public String getAlarmSource()
{
return alarmSource;
}
public void setGmtAlarm(Date gmtAlarm)
{
this.gmtAlarm = gmtAlarm;
}
public Date getGmtAlarm()
{
return gmtAlarm;
}
public void setGmtAlarmOver(Date gmtAlarmOver)
{
this.gmtAlarmOver = gmtAlarmOver;
}
public Date getGmtAlarmOver()
{
return gmtAlarmOver;
}
public void setGmtAlarmStart(Date gmtAlarmStart)
{
this.gmtAlarmStart = gmtAlarmStart;
}
public Date getGmtAlarmStart()
{
return gmtAlarmStart;
}
public void setGmtCreate(Date gmtCreate)
{
this.gmtCreate = gmtCreate;
}
public Date getGmtCreate()
{
return gmtCreate;
}
public void setGmtModified(Date gmtModified)
{
this.gmtModified = gmtModified;
}
public Date getGmtModified()
{
return gmtModified;
}
public void setLevel(Long level)
{
this.level = level;
}
public Long getLevel()
{
return level;
}
public void setMeId(Long meId)
{
this.meId = meId;
}
public Long getMeId()
{
return meId;
}
public void setMeName(String meName)
{
this.meName = meName;
}
public String getMeName()
{
return meName;
}
public void setMonitorItemId(Long monitorItemId)
{
this.monitorItemId = monitorItemId;
}
public Long getMonitorItemId()
{
return monitorItemId;
}
public void setNumbers(Long numbers)
{
this.numbers = numbers;
}
public Long getNumbers()
{
return numbers;
}
public void setResult(String result)
{
this.result = result;
}
public String getResult()
{
return result;
}
public void setResultUrl(String resultUrl)
{
this.resultUrl = resultUrl;
}
public String getResultUrl()
{
return resultUrl;
}
public void setSpId(Long spId)
{
this.spId = spId;
}
public Long getSpId()
{
return spId;
}
public void setSpName(String spName)
{
this.spName = spName;
}
public String getSpName()
{
return spName;
}
public void setStaff(String staff)
{
this.staff = staff;
}
public String getStaff()
{
return staff;
}
public void setStaffPhone(String staffPhone)
{
this.staffPhone = staffPhone;
}
public String getStaffPhone()
{
return staffPhone;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setStructureId(Long structureId)
{
this.structureId = structureId;
}
public Long getStructureId()
{
return structureId;
}
public void setStructureName(String structureName)
{
this.structureName = structureName;
}
public String getStructureName()
{
return structureName;
}
public void setThreshold(String threshold)
{
this.threshold = threshold;
}
public String getThreshold()
{
return threshold;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setVariety(String variety)
{
this.variety = variety;
}
public String getVariety()
{
return variety;
}
public void setState(Long state)
{
this.state = state;
}
public Long getState()
{
return state;
}
public void setIsDel(Long isDel)
{
this.isDel = isDel;
}
public Long getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("cfgId", getCfgId())
.append("srvId", getSrvId())
.append("alarmInfo", getAlarmInfo())
.append("alarmSource", getAlarmSource())
.append("gmtAlarm", getGmtAlarm())
.append("gmtAlarmOver", getGmtAlarmOver())
.append("gmtAlarmStart", getGmtAlarmStart())
.append("gmtCreate", getGmtCreate())
.append("gmtModified", getGmtModified())
.append("level", getLevel())
.append("meId", getMeId())
.append("meName", getMeName())
.append("monitorItemId", getMonitorItemId())
.append("numbers", getNumbers())
.append("result", getResult())
.append("resultUrl", getResultUrl())
.append("spId", getSpId())
.append("spName", getSpName())
.append("staff", getStaff())
.append("staffPhone", getStaffPhone())
.append("status", getStatus())
.append("structureId", getStructureId())
.append("structureName", getStructureName())
.append("threshold", getThreshold())
.append("type", getType())
.append("variety", getVariety())
.append("state", getState())
.append("remark", getRemark())
.append("isDel", getIsDel())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -1,288 +0,0 @@
package com.ruoyi.quartz.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* -- dev_pitmonit_southsmos_data
*
* @author ruoyi
* @date 2024-08-09
*/
public class DevPitmonitSouthsmosData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private Long id;
/** 配置ID */
@Excel(name = "配置ID")
private Long cfgId;
/** 数据类型:horizontal-水平位移(x,y),presureWallsideSoil-围护墙侧向土压力,waterLevel-地下水位 */
@Excel(name = "数据类型:horizontal-水平位移(x,y),presureWallsideSoil-围护墙侧向土压力,waterLevel-地下水位")
private String dataType;
/** 服务端dataId */
@Excel(name = "服务端dataId")
private Long dataId;
/** 测点Id */
@Excel(name = "测点Id")
private Long spId;
/** 测点名 */
@Excel(name = "测点名")
private String spName;
/** 收集时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "收集时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date collectTime;
/** 变化速率(X) */
@Excel(name = "变化速率(X)")
private BigDecimal changeRate;
/** 变化速率(Y) */
@Excel(name = "变化速率(Y)")
private BigDecimal changeRate2;
/** */
@Excel(name = "")
private BigDecimal displace;
/** */
@Excel(name = "")
private BigDecimal displace2;
/** 累计变化量单位为m(X) */
@Excel(name = "累计变化量单位为m(X)")
private BigDecimal totalize;
/** 累计变化量单位为m(Y) */
@Excel(name = "累计变化量单位为m(Y)")
private BigDecimal totalize2;
/** 单次变化量单位为m(X) */
@Excel(name = "单次变化量单位为m(X)")
private BigDecimal variation;
/** 单次变化量单位为m(Y) */
@Excel(name = "单次变化量单位为m(Y)")
private BigDecimal variation2;
/** 状态 */
@Excel(name = "状态")
private Long state;
/** */
@Excel(name = "")
private Long isDel;
public void convertToHorizontal(JSONObject o) {
changeRate=o.getBigDecimal("changeRateX");
changeRate2=o.getBigDecimal("changeRateY");
displace=o.getBigDecimal("displaceX");
displace2=o.getBigDecimal("displaceY");
totalize=o.getBigDecimal("totalizeX");
totalize2=o.getBigDecimal("totalizeY");
variation=o.getBigDecimal("variationX");
variation2=o.getBigDecimal("variationY");
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCfgId(Long cfgId)
{
this.cfgId = cfgId;
}
public Long getCfgId()
{
return cfgId;
}
public void setDataType(String dataType)
{
this.dataType = dataType;
}
public String getDataType()
{
return dataType;
}
public void setDataId(Long dataId)
{
this.dataId = dataId;
}
public Long getDataId()
{
return dataId;
}
public void setSpId(Long spId)
{
this.spId = spId;
}
public Long getSpId()
{
return spId;
}
public void setSpName(String spName)
{
this.spName = spName;
}
public String getSpName()
{
return spName;
}
public void setCollectTime(Date collectTime)
{
this.collectTime = collectTime;
}
public Date getCollectTime()
{
return collectTime;
}
public void setChangeRate(BigDecimal changeRate)
{
this.changeRate = changeRate;
}
public BigDecimal getChangeRate()
{
return changeRate;
}
public void setChangeRate2(BigDecimal changeRate2)
{
this.changeRate2 = changeRate2;
}
public BigDecimal getChangeRate2()
{
return changeRate2;
}
public void setDisplace(BigDecimal displace)
{
this.displace = displace;
}
public BigDecimal getDisplace()
{
return displace;
}
public void setDisplace2(BigDecimal displace2)
{
this.displace2 = displace2;
}
public BigDecimal getDisplace2()
{
return displace2;
}
public void setTotalize(BigDecimal totalize)
{
this.totalize = totalize;
}
public BigDecimal getTotalize()
{
return totalize;
}
public void setTotalize2(BigDecimal totalize2)
{
this.totalize2 = totalize2;
}
public BigDecimal getTotalize2()
{
return totalize2;
}
public void setVariation(BigDecimal variation)
{
this.variation = variation;
}
public BigDecimal getVariation()
{
return variation;
}
public void setVariation2(BigDecimal variation2)
{
this.variation2 = variation2;
}
public BigDecimal getVariation2()
{
return variation2;
}
public void setState(Long state)
{
this.state = state;
}
public Long getState()
{
return state;
}
public void setIsDel(Long isDel)
{
this.isDel = isDel;
}
public Long getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("cfgId", getCfgId())
.append("dataType", getDataType())
.append("dataId", getDataId())
.append("spId", getSpId())
.append("spName", getSpName())
.append("collectTime", getCollectTime())
.append("changeRate", getChangeRate())
.append("changeRate2", getChangeRate2())
.append("displace", getDisplace())
.append("displace2", getDisplace2())
.append("totalize", getTotalize())
.append("totalize2", getTotalize2())
.append("variation", getVariation())
.append("variation2", getVariation2())
.append("state", getState())
.append("remark", getRemark())
.append("isDel", getIsDel())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
//围护墙侧向土压力
public void convertToPresureWallsideSoil(JSONObject jsonObject) {
}
//地下水位
public void convertToWaterLevel(JSONObject jsonObject) {
}
}

View File

@ -1,112 +0,0 @@
package com.ruoyi.quartz.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* --- dev_pitmonit_southsmos_dev_sp
*
* @author ruoyi
* @date 2024-08-11
*/
public class DevPitmonitSouthsmosDevSp extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 配置ID */
@Excel(name = "配置ID")
private Long cfgId;
/** 设备ID */
@Excel(name = "设备ID")
private Long devId;
/** 测点ID */
@Excel(name = "测点ID")
private Long spId;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long state;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long isDel;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCfgId(Long cfgId)
{
this.cfgId = cfgId;
}
public Long getCfgId()
{
return cfgId;
}
public void setDevId(Long devId)
{
this.devId = devId;
}
public Long getDevId()
{
return devId;
}
public void setSpId(Long spId)
{
this.spId = spId;
}
public Long getSpId()
{
return spId;
}
public void setState(Long state)
{
this.state = state;
}
public Long getState()
{
return state;
}
public void setIsDel(Long isDel)
{
this.isDel = isDel;
}
public Long getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("cfgId", getCfgId())
.append("devId", getDevId())
.append("spId", getSpId())
.append("state", getState())
.append("remark", getRemark())
.append("isDel", getIsDel())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

Some files were not shown because too many files have changed in this diff Show More