mirror of https://github.com/jeecgboot/jeecg-boot
zhangdaiscott
3 years ago
487 changed files with 9749 additions and 2923 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,39 +0,0 @@
|
||||
-- 第三方用户表应该加上创建人,创建时间、修改人、修改时间 |
||||
ALTER TABLE `sys_third_account` |
||||
ADD COLUMN `create_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人登录名称' AFTER `third_user_id`, |
||||
ADD COLUMN `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建日期' AFTER `create_by`, |
||||
ADD COLUMN `update_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人登录名称' AFTER `create_time`, |
||||
ADD COLUMN `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新日期' AFTER `update_by`; |
||||
|
||||
-- online 表单字段db类型,区分年月日和年月日时分秒 |
||||
UPDATE onl_cgform_field SET db_type = 'Datetime' where db_type = 'Date'; |
||||
|
||||
-- 对象存储字段太短 |
||||
ALTER TABLE `oss_file` |
||||
MODIFY COLUMN `url` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件地址' AFTER `file_name`; |
||||
|
||||
-- 地址获取到多个地址, 地址过长导致权限菜单修改失败 |
||||
ALTER TABLE `sys_role_permission` |
||||
MODIFY COLUMN `operate_ip` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作ip' AFTER `operate_date`; |
||||
|
||||
-- 修改 sys_permission 下的两个字段为 tinyint 类型 |
||||
ALTER TABLE `sys_permission` |
||||
MODIFY COLUMN `hidden` tinyint(1) NULL DEFAULT 0 COMMENT '是否隐藏路由: 0否,1是' AFTER `keep_alive`, |
||||
MODIFY COLUMN `hide_tab` tinyint(1) NULL DEFAULT NULL COMMENT '是否隐藏tab: 0否,1是' AFTER `hidden`; |
||||
|
||||
-- 默认示例,内嵌百度改成jeecg.com官网 |
||||
UPDATE sys_permission SET name = 'JEECG官方网站' , url = 'http://www.jeecg.com' WHERE id = 'a400e4f4d54f79bf5ce160ae432231af'; |
||||
|
||||
-- 菜单名和代码改名 erp风格 |
||||
UPDATE `sys_permission` SET `parent_id` = '2a470fc0c3954d9dbb61de6d80846549', `name` = '一对多erp风格示例', `url` = '/jeecg/tablist/JeecgOrderDMainList', `component` = 'jeecg/tablist/JeecgOrderDMainList', `component_name` = NULL, `redirect` = NULL, `menu_type` = 1, `perms` = NULL, `perms_type` = NULL, `sort_no` = 2.00, `always_show` = 0, `icon` = NULL, `is_route` = 1, `is_leaf` = 1, `keep_alive` = 0, `hidden` = 0, `description` = NULL, `status` = NULL, `del_flag` = 0, `rule_flag` = 0, `create_by` = 'admin', `create_time` = '2019-02-20 14:45:09', `update_by` = 'admin', `update_time` = '2022-01-17 17:02:51', `internal_or_external` = 0, `hide_tab` = '0' WHERE `id` = '6ad53fd1b220989a8b71ff482d683a5a'; |
||||
|
||||
-- 分类字典 列表页 显示数据id |
||||
UPDATE sys_category SET code='B01-2-3' WHERE id='1404629269499936770'; |
||||
UPDATE sys_category SET code='B01-2-2' WHERE id='937fd2e9aa13b8bab1da1ca36d3fd344'; |
||||
|
||||
-- 新的表格合计菜单 |
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_route`, `is_leaf`, `keep_alive`, `hidden`, `description`, `status`, `del_flag`, `rule_flag`, `create_by`, `create_time`, `update_by`, `update_time`, `internal_or_external`, `hide_tab`) VALUES ('1494641317580423169', '2a470fc0c3954d9dbb61de6d80846549', '表格合计News', '/jeecg/tableOrderTotal', 'jeecg/TableOrderTotal', NULL, NULL, 1, NULL, '1', 3.00, 0, NULL, 1, 1, 0, 0, NULL, '1', 0, 0, 'admin', '2022-02-18 19:53:54', 'admin', '2022-02-18 19:55:04', 0, '0'); |
||||
|
||||
-- online老数据,存在字符串类型key值不一致的情况,String改为string |
||||
UPDATE onl_cgform_field SET db_type = 'string' where binary db_type = 'String'; |
||||
|
@ -0,0 +1,16 @@
|
||||
-- ---------------------------- |
||||
-- Table structure for sys_role_index |
||||
-- ---------------------------- |
||||
CREATE TABLE `sys_role_index` ( |
||||
`id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, |
||||
`role_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色编码', |
||||
`url` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由地址', |
||||
`priority` int(11) NULL DEFAULT 0 COMMENT '优先级', |
||||
`status` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '状态0:无效 1:有效', |
||||
`create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人登录名称', |
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期', |
||||
`update_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人登录名称', |
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新日期', |
||||
`sys_org_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属部门', |
||||
PRIMARY KEY (`id`) USING BTREE |
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色首页表' ROW_FORMAT = Dynamic; |
@ -1,89 +0,0 @@
|
||||
package org.jeecg.common.bpm.api; |
||||
|
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.constant.ServiceNameConstants; |
||||
import org.jeecg.common.online.api.factory.OnlineBaseExtAPIFallbackFactory; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.stereotype.Component; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
/** |
||||
* 流程接口 |
||||
* |
||||
* @author scott |
||||
*/ |
||||
@Component |
||||
@FeignClient(contextId = "bpmBaseRemoteApi", value = ServiceNameConstants.SYSTEM_SERVICE, |
||||
fallbackFactory = OnlineBaseExtAPIFallbackFactory.class) |
||||
public interface IBpmBaseExtAPI { |
||||
/** |
||||
* 23. 流程提交接口(online,自定义开发) |
||||
* |
||||
* @param flowCode |
||||
* 流程业务关联 例如:joa_leave_01 |
||||
* @param id |
||||
* 表单业务数据data id |
||||
* @param formUrl |
||||
* 流程审批时附件页面默认展示的PC端表单组件(地址) |
||||
* @param formUrlMobile |
||||
* 流程审批时附件页面默认展示的移动端表单组件(地址) |
||||
* @param username |
||||
* 流程发起人账号 |
||||
* @param jsonData |
||||
* Json串,额外扩展的流程变量值 【非必填】 |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
@PostMapping(value = "/act/process/extActProcess/startMutilProcess") |
||||
Result<String> startMutilProcess(@RequestParam("flowCode") String flowCode, @RequestParam("id") String id, |
||||
@RequestParam("formUrl") String formUrl, @RequestParam("formUrlMobile") String formUrlMobile, |
||||
@RequestParam("username") String username, @RequestParam("jsonData") String jsonData) throws Exception; |
||||
|
||||
/** |
||||
* 24. 流程提交接口(自定义表单设计器) |
||||
* |
||||
* @param flowCode |
||||
* 流程业务关联 例如:joa_leave_01 |
||||
* @param id |
||||
* 表单业务数据data id |
||||
* @param formUrl |
||||
* 流程审批时附件页面默认展示的PC端表单组件(地址) |
||||
* @param formUrlMobile |
||||
* 流程审批时附件页面默认展示的移动端表单组件(地址) |
||||
* @param username |
||||
* 流程发起人账号 |
||||
* @param jsonData |
||||
* Json串,额外扩展的流程变量值 【非必填】 |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
@PostMapping(value = "/act/process/extActProcess/startDesFormMutilProcess") |
||||
Result<String> startDesFormMutilProcess(@RequestParam("flowCode") String flowCode, @RequestParam("id") String id, |
||||
@RequestParam("formUrl") String formUrl, @RequestParam("formUrlMobile") String formUrlMobile, |
||||
@RequestParam("username") String username, @RequestParam("jsonData") String jsonData) throws Exception; |
||||
|
||||
/** |
||||
* 25. 保存流程草稿箱接口(自定义开发表单、online表单) |
||||
* |
||||
* @param flowCode |
||||
* 流程业务关联 例如:joa_leave_01 |
||||
* @param id |
||||
* 表单业务数据data id |
||||
* @param formUrl |
||||
* 流程审批时附件页面默认展示的PC端表单组件(地址) 【非必填】 |
||||
* @param formUrlMobile |
||||
* 流程审批时附件页面默认展示的移动端表单组件(地址) 【非必填】 |
||||
* @param username |
||||
* 流程发起人账号 |
||||
* @param jsonData |
||||
* Json串,额外扩展的流程变量值 【非必填】 |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
@PostMapping(value = "/act/process/extActProcess/saveMutilProcessDraft") |
||||
Result<String> saveMutilProcessDraft(@RequestParam("flowCode") String flowCode, @RequestParam("id") String id, |
||||
@RequestParam("formUrl") String formUrl, @RequestParam("formUrlMobile") String formUrlMobile, |
||||
@RequestParam("username") String username, @RequestParam("jsonData") String jsonData) throws Exception; |
||||
|
||||
} |
@ -1,18 +0,0 @@
|
||||
package org.jeecg.common.bpm.api.factory; |
||||
|
||||
import org.jeecg.common.bpm.api.IBpmBaseExtAPI; |
||||
import org.jeecg.common.bpm.api.fallback.BpmBaseExtAPIFallback; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import feign.hystrix.FallbackFactory; |
||||
|
||||
@Component |
||||
public class BpmBaseExtAPIFallbackFactory implements FallbackFactory<IBpmBaseExtAPI> { |
||||
|
||||
@Override |
||||
public IBpmBaseExtAPI create(Throwable throwable) { |
||||
BpmBaseExtAPIFallback fallback = new BpmBaseExtAPIFallback(); |
||||
fallback.setCause(throwable); |
||||
return fallback; |
||||
} |
||||
} |
@ -1,42 +0,0 @@
|
||||
package org.jeecg.common.bpm.api.fallback; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.bpm.api.IBpmBaseExtAPI; |
||||
import org.jeecg.common.online.api.IOnlineBaseExtAPI; |
||||
import org.jeecg.common.system.vo.DictModel; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
|
||||
import lombok.Setter; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
/** |
||||
* 进入fallback的方法 检查是否token未设置 |
||||
*/ |
||||
@Slf4j |
||||
public class BpmBaseExtAPIFallback implements IBpmBaseExtAPI { |
||||
|
||||
@Setter |
||||
private Throwable cause; |
||||
|
||||
@Override |
||||
public Result<String> startMutilProcess(String flowCode, String id, String formUrl, String formUrlMobile, |
||||
String username, String jsonData) throws Exception { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Result<String> startDesFormMutilProcess(String flowCode, String id, String formUrl, String formUrlMobile, |
||||
String username, String jsonData) throws Exception { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Result<String> saveMutilProcessDraft(String flowCode, String id, String formUrl, String formUrlMobile, |
||||
String username, String jsonData) throws Exception { |
||||
return null; |
||||
} |
||||
} |
@ -1,73 +0,0 @@
|
||||
package org.jeecg.common.online.api; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import org.jeecg.common.constant.ServiceNameConstants; |
||||
import org.jeecg.common.online.api.factory.OnlineBaseExtAPIFallbackFactory; |
||||
import org.jeecg.common.system.vo.DictModel; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.stereotype.Component; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 【Online】Feign API接口 |
||||
*/ |
||||
@Component |
||||
@FeignClient(contextId = "onlineBaseRemoteApi", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = OnlineBaseExtAPIFallbackFactory.class) |
||||
//@FeignClient(contextId = "onlineBaseRemoteApi", value = ServiceNameConstants.SYSTEM_ONLINE, fallbackFactory = OnlineBaseExtAPIFallbackFactory.class)
|
||||
public interface IOnlineBaseExtAPI { |
||||
|
||||
/** |
||||
* 【Online】 表单设计器专用:同步新增 |
||||
*/ |
||||
@PostMapping(value = "/online/api/cgform/crazyForm/{name}") |
||||
String cgformPostCrazyForm(@PathVariable("name") String tableName, @RequestBody JSONObject jsonObject) throws Exception; |
||||
|
||||
/** |
||||
* 【Online】 表单设计器专用:同步编辑 |
||||
*/ |
||||
@PutMapping(value = "/online/api/cgform/crazyForm/{name}") |
||||
String cgformPutCrazyForm(@PathVariable("name") String tableName, @RequestBody JSONObject jsonObject) throws Exception; |
||||
|
||||
/** |
||||
* 通过online表名查询数据,同时查询出子表的数据 |
||||
* |
||||
* @param tableName online表名 |
||||
* @param dataIds online数据ID |
||||
* @return |
||||
*/ |
||||
@GetMapping(value = "/online/api/cgform/queryAllDataByTableName") |
||||
JSONObject cgformQueryAllDataByTableName(@RequestParam("tableName") String tableName, @RequestParam("dataIds") String dataIds); |
||||
|
||||
/** |
||||
* online表单删除数据 |
||||
* |
||||
* @param cgformCode Online表单code |
||||
* @param dataIds 数据ID,可逗号分割 |
||||
* @return |
||||
*/ |
||||
@DeleteMapping("/online/api/cgform/cgformDeleteDataByCode") |
||||
String cgformDeleteDataByCode(@RequestParam("cgformCode") String cgformCode, @RequestParam("dataIds") String dataIds); |
||||
|
||||
/** |
||||
* 【cgreport】通过 head code 获取 sql语句,并执行该语句返回查询数据 |
||||
* |
||||
* @param code 报表Code,如果没传ID就通过code查 |
||||
* @param forceKey |
||||
* @param dataList |
||||
* @return |
||||
*/ |
||||
@GetMapping("/online/api/cgreportGetData") |
||||
Map<String, Object> cgreportGetData(@RequestParam("code") String code, @RequestParam("forceKey") String forceKey, @RequestParam("dataList") String dataList); |
||||
|
||||
/** |
||||
* 【cgreport】对 cgreportGetData 的返回值做优化,封装 DictModel 集合 |
||||
* |
||||
* @return |
||||
*/ |
||||
@GetMapping("/online/api/cgreportGetDataPackage") |
||||
List<DictModel> cgreportGetDataPackage(@RequestParam("code") String code, @RequestParam("dictText") String dictText, @RequestParam("dictCode") String dictCode, @RequestParam("dataList") String dataList); |
||||
|
||||
} |
@ -1,17 +0,0 @@
|
||||
package org.jeecg.common.online.api.factory; |
||||
|
||||
import feign.hystrix.FallbackFactory; |
||||
import org.jeecg.common.online.api.IOnlineBaseExtAPI; |
||||
import org.jeecg.common.online.api.fallback.OnlineBaseExtAPIFallback; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component |
||||
public class OnlineBaseExtAPIFallbackFactory implements FallbackFactory<IOnlineBaseExtAPI> { |
||||
|
||||
@Override |
||||
public IOnlineBaseExtAPI create(Throwable throwable) { |
||||
OnlineBaseExtAPIFallback fallback = new OnlineBaseExtAPIFallback(); |
||||
fallback.setCause(throwable); |
||||
return fallback; |
||||
} |
||||
} |
@ -1,51 +0,0 @@
|
||||
package org.jeecg.common.online.api.fallback; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import lombok.Setter; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.jeecg.common.online.api.IOnlineBaseExtAPI; |
||||
import org.jeecg.common.system.vo.DictModel; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 进入fallback的方法 检查是否token未设置 |
||||
*/ |
||||
@Slf4j |
||||
public class OnlineBaseExtAPIFallback implements IOnlineBaseExtAPI { |
||||
|
||||
@Setter |
||||
private Throwable cause; |
||||
|
||||
@Override |
||||
public String cgformPostCrazyForm(String tableName, JSONObject jsonObject) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public String cgformPutCrazyForm(String tableName, JSONObject jsonObject) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public JSONObject cgformQueryAllDataByTableName(String tableName, String dataIds) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public String cgformDeleteDataByCode(String cgformCode, String dataIds) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Map<String, Object> cgreportGetData(String code, String forceKey, String dataList) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<DictModel> cgreportGetDataPackage(String code, String dictText, String dictCode, String dataList) { |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -1,164 +1,180 @@
|
||||
package org.jeecg.config; |
||||
|
||||
import java.io.IOException; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.SortedMap; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
|
||||
import org.jeecg.common.config.mqtoken.UserTokenContext; |
||||
import org.jeecg.common.constant.CommonConstant; |
||||
import org.jeecg.common.util.DateUtils; |
||||
import org.jeecg.common.util.PathMatcherUtil; |
||||
import org.jeecg.config.sign.interceptor.SignAuthConfiguration; |
||||
import org.jeecg.config.sign.util.HttpUtils; |
||||
import org.jeecg.config.sign.util.SignUtil; |
||||
import org.springframework.beans.factory.ObjectFactory; |
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters; |
||||
import org.springframework.cloud.openfeign.FeignAutoConfiguration; |
||||
import org.springframework.cloud.openfeign.support.SpringDecoder; |
||||
import org.springframework.cloud.openfeign.support.SpringEncoder; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.context.annotation.Primary; |
||||
import org.springframework.context.annotation.Scope; |
||||
import org.springframework.http.MediaType; |
||||
import org.springframework.web.context.request.RequestContextHolder; |
||||
import org.springframework.web.context.request.ServletRequestAttributes; |
||||
|
||||
import com.alibaba.fastjson.JSON; |
||||
import com.alibaba.fastjson.serializer.SerializerFeature; |
||||
import com.alibaba.fastjson.support.config.FastJsonConfig; |
||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; |
||||
import com.alibaba.fastjson.support.springfox.SwaggerJsonSerializer; |
||||
|
||||
import feign.Feign; |
||||
import feign.Logger; |
||||
import feign.RequestInterceptor; |
||||
import feign.codec.Decoder; |
||||
import feign.codec.Encoder; |
||||
import feign.form.spring.SpringFormEncoder; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
@ConditionalOnClass(Feign.class) |
||||
@AutoConfigureBefore(FeignAutoConfiguration.class) |
||||
@Slf4j |
||||
@Configuration |
||||
public class FeignConfig { |
||||
|
||||
@Bean |
||||
public RequestInterceptor requestInterceptor() { |
||||
return requestTemplate -> { |
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
||||
if (null != attributes) { |
||||
HttpServletRequest request = attributes.getRequest(); |
||||
log.debug("Feign request: {}", request.getRequestURI()); |
||||
// 将token信息放入header中
|
||||
String token = request.getHeader(CommonConstant.X_ACCESS_TOKEN); |
||||
if(token==null || "".equals(token)){ |
||||
token = request.getParameter("token"); |
||||
} |
||||
log.debug("Feign request token: {}", token); |
||||
requestTemplate.header(CommonConstant.X_ACCESS_TOKEN, token); |
||||
|
||||
//根据URL地址过滤请求 【字典表参数签名验证】
|
||||
if (PathMatcherUtil.matches(Arrays.asList(SignAuthConfiguration.urlList),requestTemplate.path())) { |
||||
try { |
||||
log.info("============================ [begin] fegin api url ============================"); |
||||
log.info(requestTemplate.path()); |
||||
log.info(requestTemplate.method()); |
||||
String queryLine = requestTemplate.queryLine(); |
||||
if(queryLine!=null && queryLine.startsWith("?")){ |
||||
queryLine = queryLine.substring(1); |
||||
} |
||||
log.info(queryLine); |
||||
if(requestTemplate.body()!=null){ |
||||
log.info(new String(requestTemplate.body())); |
||||
} |
||||
SortedMap<String, String> allParams = HttpUtils.getAllParams(requestTemplate.path(),queryLine,requestTemplate.body(),requestTemplate.method()); |
||||
String sign = SignUtil.getParamsSign(allParams); |
||||
log.info(" Feign request params sign: {}",sign); |
||||
log.info("============================ [end] fegin api url ============================"); |
||||
requestTemplate.header(CommonConstant.X_SIGN, sign); |
||||
requestTemplate.header(CommonConstant.X_TIMESTAMP, DateUtils.getCurrentTimestamp().toString()); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
}else{ |
||||
String token = UserTokenContext.getToken(); |
||||
log.debug("Feign request token: {}", token); |
||||
requestTemplate.header(CommonConstant.X_ACCESS_TOKEN, token); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* Feign 客户端的日志记录,默认级别为NONE |
||||
* Logger.Level 的具体级别如下: |
||||
* NONE:不记录任何信息 |
||||
* BASIC:仅记录请求方法、URL以及响应状态码和执行时间 |
||||
* HEADERS:除了记录 BASIC级别的信息外,还会记录请求和响应的头信息 |
||||
* FULL:记录所有请求与响应的明细,包括头信息、请求体、元数据 |
||||
*/ |
||||
@Bean |
||||
Logger.Level feignLoggerLevel() { |
||||
return Logger.Level.FULL; |
||||
} |
||||
|
||||
/** |
||||
* Feign支持文件上传 |
||||
* @param messageConverters |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
@Primary |
||||
@Scope("prototype") |
||||
public Encoder multipartFormEncoder(ObjectFactory<HttpMessageConverters> messageConverters) { |
||||
return new SpringFormEncoder(new SpringEncoder(messageConverters)); |
||||
} |
||||
|
||||
// update-begin--Author:sunjianlei Date:20210604 for: 给 Feign 添加 FastJson 的解析支持 ----------
|
||||
@Bean |
||||
public Encoder feignEncoder() { |
||||
return new SpringEncoder(feignHttpMessageConverter()); |
||||
} |
||||
|
||||
@Bean |
||||
public Decoder feignDecoder() { |
||||
return new SpringDecoder(feignHttpMessageConverter()); |
||||
} |
||||
|
||||
/** |
||||
* 设置解码器为fastjson |
||||
* |
||||
* @return |
||||
*/ |
||||
private ObjectFactory<HttpMessageConverters> feignHttpMessageConverter() { |
||||
final HttpMessageConverters httpMessageConverters = new HttpMessageConverters(this.getFastJsonConverter()); |
||||
return () -> httpMessageConverters; |
||||
} |
||||
|
||||
private FastJsonHttpMessageConverter getFastJsonConverter() { |
||||
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); |
||||
|
||||
List<MediaType> supportedMediaTypes = new ArrayList<>(); |
||||
MediaType mediaTypeJson = MediaType.valueOf(MediaType.APPLICATION_JSON_VALUE); |
||||
supportedMediaTypes.add(mediaTypeJson); |
||||
converter.setSupportedMediaTypes(supportedMediaTypes); |
||||
FastJsonConfig config = new FastJsonConfig(); |
||||
config.getSerializeConfig().put(JSON.class, new SwaggerJsonSerializer()); |
||||
config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect); |
||||
converter.setFastJsonConfig(config); |
||||
|
||||
return converter; |
||||
} |
||||
// update-end--Author:sunjianlei Date:20210604 for: 给 Feign 添加 FastJson 的解析支持 ----------
|
||||
|
||||
} |
||||
//package org.jeecg.config;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Arrays;
|
||||
//import java.util.List;
|
||||
//import java.util.SortedMap;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//
|
||||
//import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||
//import org.jeecg.common.constant.CommonConstant;
|
||||
//import org.jeecg.common.util.DateUtils;
|
||||
//import org.jeecg.common.util.PathMatcherUtil;
|
||||
//import org.jeecg.config.sign.interceptor.SignAuthConfiguration;
|
||||
//import org.jeecg.config.sign.util.HttpUtils;
|
||||
//import org.jeecg.config.sign.util.SignUtil;
|
||||
//import org.springframework.beans.factory.ObjectFactory;
|
||||
//import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
//import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||
//import org.springframework.cloud.openfeign.FeignAutoConfiguration;
|
||||
//import org.springframework.cloud.openfeign.support.SpringDecoder;
|
||||
//import org.springframework.cloud.openfeign.support.SpringEncoder;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.context.annotation.Primary;
|
||||
//import org.springframework.context.annotation.Scope;
|
||||
//import org.springframework.http.MediaType;
|
||||
//import org.springframework.web.context.request.RequestContextHolder;
|
||||
//import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSON;
|
||||
//import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
//import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||
//import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||
//import com.alibaba.fastjson.support.springfox.SwaggerJsonSerializer;
|
||||
//
|
||||
//import feign.Feign;
|
||||
//import feign.Logger;
|
||||
//import feign.RequestInterceptor;
|
||||
//import feign.codec.Decoder;
|
||||
//import feign.codec.Encoder;
|
||||
//import feign.form.spring.SpringFormEncoder;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//
|
||||
///**
|
||||
// * @Description: FeignConfig
|
||||
// * @author: JeecgBoot
|
||||
// */
|
||||
//@ConditionalOnClass(Feign.class)
|
||||
//@AutoConfigureBefore(FeignAutoConfiguration.class)
|
||||
//@Slf4j
|
||||
//@Configuration
|
||||
//public class FeignConfig {
|
||||
//
|
||||
// /**
|
||||
// * 设置feign header参数
|
||||
// * 【X_ACCESS_TOKEN】【X_SIGN】【X_TIMESTAMP】
|
||||
// * @return
|
||||
// */
|
||||
// @Bean
|
||||
// public RequestInterceptor requestInterceptor() {
|
||||
// return requestTemplate -> {
|
||||
// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
// if (null != attributes) {
|
||||
// HttpServletRequest request = attributes.getRequest();
|
||||
// log.debug("Feign request: {}", request.getRequestURI());
|
||||
// // 将token信息放入header中
|
||||
// String token = request.getHeader(CommonConstant.X_ACCESS_TOKEN);
|
||||
// if(token==null || "".equals(token)){
|
||||
// token = request.getParameter("token");
|
||||
// }
|
||||
// log.info("Feign Login Request token: {}", token);
|
||||
// requestTemplate.header(CommonConstant.X_ACCESS_TOKEN, token);
|
||||
// }else{
|
||||
// //解决后台任务、MQ中调用feign接口,无会话token的问题
|
||||
// String token = UserTokenContext.getToken();
|
||||
// log.info("Feign No Login token: {}", token);
|
||||
// requestTemplate.header(CommonConstant.X_ACCESS_TOKEN, token);
|
||||
// }
|
||||
//
|
||||
// //================================================================================================================
|
||||
// //针对特殊接口,进行加签验证 ——根据URL地址过滤请求 【字典表参数签名验证】
|
||||
// if (PathMatcherUtil.matches(Arrays.asList(SignAuthConfiguration.SIGN_URL_LIST),requestTemplate.path())) {
|
||||
// try {
|
||||
// log.info("============================ [begin] fegin api url ============================");
|
||||
// log.info(requestTemplate.path());
|
||||
// log.info(requestTemplate.method());
|
||||
// String queryLine = requestTemplate.queryLine();
|
||||
// String questionMark="?";
|
||||
// if(queryLine!=null && queryLine.startsWith(questionMark)){
|
||||
// queryLine = queryLine.substring(1);
|
||||
// }
|
||||
// log.info(queryLine);
|
||||
// if(requestTemplate.body()!=null){
|
||||
// log.info(new String(requestTemplate.body()));
|
||||
// }
|
||||
// SortedMap<String, String> allParams = HttpUtils.getAllParams(requestTemplate.path(),queryLine,requestTemplate.body(),requestTemplate.method());
|
||||
// String sign = SignUtil.getParamsSign(allParams);
|
||||
// log.info(" Feign request params sign: {}",sign);
|
||||
// log.info("============================ [end] fegin api url ============================");
|
||||
// requestTemplate.header(CommonConstant.X_SIGN, sign);
|
||||
// requestTemplate.header(CommonConstant.X_TIMESTAMP, DateUtils.getCurrentTimestamp().toString());
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// //================================================================================================================
|
||||
// };
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Feign 客户端的日志记录,默认级别为NONE
|
||||
// * Logger.Level 的具体级别如下:
|
||||
// * NONE:不记录任何信息
|
||||
// * BASIC:仅记录请求方法、URL以及响应状态码和执行时间
|
||||
// * HEADERS:除了记录 BASIC级别的信息外,还会记录请求和响应的头信息
|
||||
// * FULL:记录所有请求与响应的明细,包括头信息、请求体、元数据
|
||||
// */
|
||||
// @Bean
|
||||
// Logger.Level feignLoggerLevel() {
|
||||
// return Logger.Level.FULL;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Feign支持文件上传
|
||||
// * @param messageConverters
|
||||
// * @return
|
||||
// */
|
||||
// @Bean
|
||||
// @Primary
|
||||
// @Scope("prototype")
|
||||
// public Encoder multipartFormEncoder(ObjectFactory<HttpMessageConverters> messageConverters) {
|
||||
// return new SpringFormEncoder(new SpringEncoder(messageConverters));
|
||||
// }
|
||||
//
|
||||
// // update-begin--Author:sunjianlei Date:20210604 for: 给 Feign 添加 FastJson 的解析支持 ----------
|
||||
// /**
|
||||
// * 给 Feign 添加 FastJson 的解析支持
|
||||
// */
|
||||
// @Bean
|
||||
// public Encoder feignEncoder() {
|
||||
// return new SpringEncoder(feignHttpMessageConverter());
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public Decoder feignDecoder() {
|
||||
// return new SpringDecoder(feignHttpMessageConverter());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 设置解码器为fastjson
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// private ObjectFactory<HttpMessageConverters> feignHttpMessageConverter() {
|
||||
// final HttpMessageConverters httpMessageConverters = new HttpMessageConverters(this.getFastJsonConverter());
|
||||
// return () -> httpMessageConverters;
|
||||
// }
|
||||
//
|
||||
// private FastJsonHttpMessageConverter getFastJsonConverter() {
|
||||
// FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
|
||||
//
|
||||
// List<MediaType> supportedMediaTypes = new ArrayList<>();
|
||||
// MediaType mediaTypeJson = MediaType.valueOf(MediaType.APPLICATION_JSON_VALUE);
|
||||
// supportedMediaTypes.add(mediaTypeJson);
|
||||
// converter.setSupportedMediaTypes(supportedMediaTypes);
|
||||
// FastJsonConfig config = new FastJsonConfig();
|
||||
// config.getSerializeConfig().put(JSON.class, new SwaggerJsonSerializer());
|
||||
// config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);
|
||||
// converter.setFastJsonConfig(config);
|
||||
//
|
||||
// return converter;
|
||||
// }
|
||||
// // update-end--Author:sunjianlei Date:20210604 for: 给 Feign 添加 FastJson 的解析支持 ----------
|
||||
//
|
||||
//}
|
||||
|
@ -1,55 +0,0 @@
|
||||
package org.jeecg.common.bpm.api; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.system.vo.DictModel; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
|
||||
/** |
||||
* 流程接口 |
||||
* |
||||
* @author scott |
||||
*/ |
||||
public interface IBpmBaseExtAPI { |
||||
/** |
||||
* 23. 流程提交接口(online,自定义开发) |
||||
* @param flowCode 流程业务关联 例如:joa_leave_01 |
||||
* @param id 表单业务数据data id |
||||
* @param formUrl 流程审批时附件页面默认展示的PC端表单组件(地址) |
||||
* @param formUrlMobile 流程审批时附件页面默认展示的移动端表单组件(地址) |
||||
* @param username 流程发起人账号 |
||||
* @param jsonData Json串,额外扩展的流程变量值 【非必填】 |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
Result<String> startMutilProcess(String flowCode, String id, String formUrl, String formUrlMobile, String username, String jsonData) throws Exception; |
||||
|
||||
/** |
||||
* 24. 流程提交接口(自定义表单设计器) |
||||
* @param flowCode 流程业务关联 例如:joa_leave_01 |
||||
* @param id 表单业务数据data id |
||||
* @param formUrl 流程审批时附件页面默认展示的PC端表单组件(地址) |
||||
* @param formUrlMobile 流程审批时附件页面默认展示的移动端表单组件(地址) |
||||
* @param username 流程发起人账号 |
||||
* @param jsonData Json串,额外扩展的流程变量值 【非必填】 |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
Result<String> startDesFormMutilProcess(String flowCode, String id, String formUrl, String formUrlMobile, String username, String jsonData) throws Exception; |
||||
/** |
||||
* 25. 保存流程草稿箱接口(自定义开发表单、online表单) |
||||
* @param flowCode 流程业务关联 例如:joa_leave_01 |
||||
* @param id 表单业务数据data id |
||||
* @param formUrl 流程审批时附件页面默认展示的PC端表单组件(地址) 【非必填】 |
||||
* @param formUrlMobile 流程审批时附件页面默认展示的移动端表单组件(地址) 【非必填】 |
||||
* @param username 流程发起人账号 |
||||
* @param jsonData Json串,额外扩展的流程变量值 【非必填】 |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
Result<String> saveMutilProcessDraft(String flowCode, String id, String formUrl, String formUrlMobile, String username, String jsonData) throws Exception; |
||||
|
||||
} |
@ -1,61 +0,0 @@
|
||||
package org.jeecg.common.online.api; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import org.jeecg.common.system.vo.DictModel; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 表单设计器【Online】翻译API接口 |
||||
* |
||||
* @author sunjianlei |
||||
*/ |
||||
public interface IOnlineBaseExtAPI { |
||||
|
||||
/** |
||||
* 【Online】 表单设计器专用:同步新增 |
||||
*/ |
||||
String cgformPostCrazyForm(String tableName, JSONObject jsonObject) throws Exception; |
||||
|
||||
/** |
||||
* 【Online】 表单设计器专用:同步编辑 |
||||
*/ |
||||
String cgformPutCrazyForm(String tableName, JSONObject jsonObject) throws Exception; |
||||
|
||||
/** |
||||
* online表单删除数据 |
||||
* |
||||
* @param cgformCode Online表单code |
||||
* @param dataIds 数据ID,可逗号分割 |
||||
* @return |
||||
*/ |
||||
String cgformDeleteDataByCode(String cgformCode, String dataIds); |
||||
|
||||
/** |
||||
* 通过online表名查询数据,同时查询出子表的数据 |
||||
* |
||||
* @param tableName online表名 |
||||
* @param dataIds online数据ID |
||||
* @return |
||||
*/ |
||||
JSONObject cgformQueryAllDataByTableName(String tableName, String dataIds); |
||||
|
||||
/** |
||||
* 对 cgreportGetData 的返回值做优化,封装 DictModel 集合 |
||||
* |
||||
* @return |
||||
*/ |
||||
List<DictModel> cgreportGetDataPackage(String code, String dictText, String dictCode, String dataList); |
||||
|
||||
/** |
||||
* 【cgreport】通过 head code 获取 sql语句,并执行该语句返回查询数据 |
||||
* |
||||
* @param code 报表Code,如果没传ID就通过code查 |
||||
* @param forceKey |
||||
* @param dataList |
||||
* @return |
||||
*/ |
||||
Map<String, Object> cgreportGetData(String code, String forceKey, String dataList); |
||||
|
||||
} |
@ -0,0 +1,89 @@
|
||||
package org.jeecg.common.constant; |
||||
|
||||
/** |
||||
* @Description: 符号和特殊符号常用类 |
||||
* @author: wangshuai |
||||
* @date: 2022年03月30日 17:44 |
||||
*/ |
||||
public class SymbolConstant { |
||||
|
||||
/** |
||||
* 符号:点 |
||||
*/ |
||||
public static final String SPOT = "."; |
||||
|
||||
/** |
||||
* 符号:双斜杠 |
||||
*/ |
||||
public static final String DOUBLE_BACKSLASH = "\\"; |
||||
|
||||
/** |
||||
* 符号:冒号 |
||||
*/ |
||||
public static final String COLON = ":"; |
||||
|
||||
/** |
||||
* 符号:逗号 |
||||
*/ |
||||
public static final String COMMA = ","; |
||||
|
||||
/** |
||||
* 符号:左花括号 } |
||||
*/ |
||||
public static final String LEFT_CURLY_BRACKET = "{"; |
||||
|
||||
/** |
||||
* 符号:右花括号 } |
||||
*/ |
||||
public static final String RIGHT_CURLY_BRACKET = "}"; |
||||
|
||||
/** |
||||
* 符号:井号 # |
||||
*/ |
||||
public static final String WELL_NUMBER = "#"; |
||||
|
||||
/** |
||||
* 符号:单斜杠 |
||||
*/ |
||||
public static final String SINGLE_SLASH = "/"; |
||||
|
||||
/** |
||||
* 符号:双斜杠 |
||||
*/ |
||||
public static final String DOUBLE_SLASH = "//"; |
||||
|
||||
/** |
||||
* 符号:感叹号 |
||||
*/ |
||||
public static final String EXCLAMATORY_MARK = "!"; |
||||
|
||||
/** |
||||
* 符号:下划线 |
||||
*/ |
||||
public static final String UNDERLINE = "_"; |
||||
|
||||
/** |
||||
* 符号:单引号 |
||||
*/ |
||||
public static final String SINGLE_QUOTATION_MARK = "'"; |
||||
|
||||
/** |
||||
* 符号:星号 |
||||
*/ |
||||
public static final String ASTERISK = "*"; |
||||
|
||||
/** |
||||
* 符号:百分号 |
||||
*/ |
||||
public static final String PERCENT_SIGN = "%"; |
||||
|
||||
/** |
||||
* 符号:美元 $ |
||||
*/ |
||||
public static final String DOLLAR = "$"; |
||||
|
||||
/** |
||||
* 符号:和 & |
||||
*/ |
||||
public static final String AND = "&"; |
||||
} |
@ -0,0 +1,95 @@
|
||||
package org.jeecg.common.constant.enums; |
||||
|
||||
import org.jeecg.common.constant.CommonConstant; |
||||
|
||||
/** |
||||
* @Description: 操作类型 |
||||
* @author: jeecg-boot |
||||
* @date: 2022/3/31 10:05 |
||||
*/ |
||||
public enum OperateTypeEnum { |
||||
|
||||
/** |
||||
* 列表 |
||||
*/ |
||||
LIST(CommonConstant.OPERATE_TYPE_1, "list"), |
||||
|
||||
/** |
||||
* 新增 |
||||
*/ |
||||
ADD(CommonConstant.OPERATE_TYPE_2, "add"), |
||||
|
||||
/** |
||||
* 编辑 |
||||
*/ |
||||
EDIT(CommonConstant.OPERATE_TYPE_3, "edit"), |
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
DELETE(CommonConstant.OPERATE_TYPE_4, "delete"), |
||||
|
||||
/** |
||||
* 导入 |
||||
*/ |
||||
IMPORT(CommonConstant.OPERATE_TYPE_5, "import"), |
||||
|
||||
/** |
||||
* 导出 |
||||
*/ |
||||
EXPORT(CommonConstant.OPERATE_TYPE_6, "export"); |
||||
|
||||
/** |
||||
* 类型 1列表,2新增,3编辑,4删除,5导入,6导出 |
||||
*/ |
||||
int type; |
||||
|
||||
/** |
||||
* 编码(请求方式) |
||||
*/ |
||||
String code; |
||||
|
||||
|
||||
public int getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(int type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public String getCode() { |
||||
return code; |
||||
} |
||||
|
||||
public void setCode(String code) { |
||||
this.code = code; |
||||
} |
||||
|
||||
/** |
||||
* 构造器 |
||||
* |
||||
* @param type 类型 |
||||
* @param code 编码(请求方式) |
||||
*/ |
||||
OperateTypeEnum(int type, String code) { |
||||
this.type = type; |
||||
this.code = code; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 根据请求名称匹配 |
||||
* |
||||
* @param methodName 请求名称 |
||||
* @return Integer 类型 |
||||
*/ |
||||
public static Integer getTypeByMethodName(String methodName) { |
||||
for (OperateTypeEnum e : OperateTypeEnum.values()) { |
||||
if (methodName.startsWith(e.getCode())) { |
||||
return e.getType(); |
||||
} |
||||
} |
||||
return CommonConstant.OPERATE_TYPE_1; |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue