2022-11-23 19:20:03 +08:00
|
|
|
|
# 常用的数据信息
|
|
|
|
|
|
2022-11-24 14:39:42 +08:00
|
|
|
|
## 其他
|
|
|
|
|
|
|
|
|
|
> 维护人员: youhong.ai
|
|
|
|
|
|
2022-11-23 19:20:03 +08:00
|
|
|
|
+ 缓存地址: `/commcache/cacheMonitor.jsp`
|
2022-11-24 14:39:42 +08:00
|
|
|
|
+ 移动端流程模拟地址: `/spa/workflow/static4mobile/index.html#/center/doing`
|
|
|
|
|
|
2023-04-24 14:09:53 +08:00
|
|
|
|
### 操作
|
|
|
|
|
|
|
|
|
|
#### 设置邮箱和用户名
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# 设置用户名
|
|
|
|
|
git config --global user.name "username"
|
|
|
|
|
# 设置邮箱
|
|
|
|
|
git config --global user.email "useremail@email.email"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
一个简单的操作步骤:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
$ git init
|
|
|
|
|
$ git add .
|
|
|
|
|
$ git commit
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
git init - 初始化仓库。
|
|
|
|
|
git add . - 添加文件到暂存区。
|
|
|
|
|
git commit - 将暂存区内容添加到仓库中。
|
|
|
|
|
|
|
|
|
|
#### 创建分支
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
git checkout -b 分支名称
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
它是下面两条命令的简写:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# 创建分支
|
|
|
|
|
git branch 分支名称
|
|
|
|
|
# 切换分支
|
|
|
|
|
git checkout 分支名称
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### git提交暂存区
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
git commit -m "提交描述"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### git提交代码到远程
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
git push 远程服务名称 分支名称
|
|
|
|
|
# 示例
|
|
|
|
|
# git push origin dev
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### git拉去服务端代码
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
git pull 远程服务名称 分支名称
|
|
|
|
|
# 示例
|
|
|
|
|
# git pull origin dev
|
|
|
|
|
```
|
|
|
|
|
|
2023-05-10 14:15:05 +08:00
|
|
|
|
## 移动端模拟地址
|
|
|
|
|
|
|
|
|
|
| 描述 | 移动端模拟地址 |
|
|
|
|
|
|--------|----------------------------------------------------------------------------------|
|
|
|
|
|
| 流程代办页面 | /spa/workflow/static4mobile/index.html#/center/doing |
|
|
|
|
|
| 工作台 | /spa/coms/static4mobile/index.html#/menu-preview?id=appDefaultPage&checkAccess=1 |
|
|
|
|
|
| 新建流程 | /spa/workflow/static4mobile/index.html#/add |
|
|
|
|
|
| 日程 | /spa/workplan/static4mobile/index.html#/calendar/myCalendar |
|
|
|
|
|
| 我的请求 | /spa/workflow/static4mobile/index.html#/center/mine |
|
|
|
|
|
|
2022-11-24 14:39:42 +08:00
|
|
|
|
## 常用代码
|
|
|
|
|
|
|
|
|
|
### 前端
|
|
|
|
|
|
2022-11-27 20:49:32 +08:00
|
|
|
|
**1.获取用户信息**
|
2022-11-24 14:39:42 +08:00
|
|
|
|
> 维护人员:youhong.ai
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
const userInfo = JSON.parse(localStorage.getItem("theme-account"))
|
2022-11-24 14:59:07 +08:00
|
|
|
|
```
|
|
|
|
|
|
2022-11-27 20:49:32 +08:00
|
|
|
|
**2.ecode访问上传的resource静态文件**
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
let src = "/cloudstore/release/${appId}/resources/"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**3.获取url参数**
|
2022-11-24 14:59:07 +08:00
|
|
|
|
> 维护人员: youHong.ai
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
getQueryString = (name) => {
|
|
|
|
|
let reg = new RegExp("(^|&|\/?)" + name + "=([^&]*)(&|$)", "i");
|
|
|
|
|
let searchStr = window.location.href
|
|
|
|
|
if (searchStr.startsWith('&')) {
|
|
|
|
|
searchStr = searchStr.substr(1)
|
|
|
|
|
}
|
|
|
|
|
search = searchStr.match(reg)
|
|
|
|
|
if (search != null) {
|
|
|
|
|
return unescape(search[2]);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
2022-11-27 20:49:32 +08:00
|
|
|
|
**4.ajax请求**
|
2022-11-24 14:59:07 +08:00
|
|
|
|
> 维护人员: youHong.ai
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
class ApiUtils {
|
|
|
|
|
static request = (url, type = "GET", data, isAsync = true, success = () => {
|
|
|
|
|
}, error = () => {
|
|
|
|
|
}, complete = () => {
|
|
|
|
|
}, contentType = 'application/json', beforeSend = () => {
|
|
|
|
|
}) => {
|
|
|
|
|
let options = {
|
|
|
|
|
url,
|
|
|
|
|
type,
|
|
|
|
|
dataType: "json",
|
|
|
|
|
contentType,
|
|
|
|
|
async: isAsync,
|
|
|
|
|
data,
|
|
|
|
|
beforeSend,
|
|
|
|
|
success,
|
|
|
|
|
error,
|
|
|
|
|
complete,
|
|
|
|
|
}
|
|
|
|
|
if (contentType == 'application/json') {
|
|
|
|
|
options.data = JSON.stringify(data)
|
|
|
|
|
}
|
|
|
|
|
return $.ajax(options)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2022-11-27 20:49:32 +08:00
|
|
|
|
**5.通过js获取react组件,操作组件内部数据**
|
2022-11-24 14:59:07 +08:00
|
|
|
|
|
|
|
|
|
```javascript
|
2023-02-16 19:00:32 +08:00
|
|
|
|
function findReact(dom, traverseUp = 0) {
|
2022-11-24 14:59:07 +08:00
|
|
|
|
const key = Object.keys(dom).find(key => {
|
|
|
|
|
return key.startsWith("__reactFiber$") // react 17+
|
|
|
|
|
|| key.startsWith("__reactInternalInstance$"); // react <17
|
|
|
|
|
});
|
|
|
|
|
const domFiber = dom[key];
|
|
|
|
|
if (domFiber == null) return null;
|
|
|
|
|
|
|
|
|
|
// react <16
|
|
|
|
|
if (domFiber._currentElement) {
|
|
|
|
|
let compFiber = domFiber._currentElement._owner;
|
|
|
|
|
for (let i = 0; i < traverseUp; i++) {
|
|
|
|
|
compFiber = compFiber._currentElement._owner;
|
|
|
|
|
}
|
|
|
|
|
return compFiber._instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// react 16+
|
|
|
|
|
const GetCompFiber = fiber => {
|
|
|
|
|
let parentFiber = fiber.return;
|
|
|
|
|
while (typeof parentFiber.type == "string") {
|
|
|
|
|
parentFiber = parentFiber.return;
|
|
|
|
|
}
|
|
|
|
|
return parentFiber;
|
|
|
|
|
};
|
|
|
|
|
let compFiber = GetCompFiber(domFiber);
|
|
|
|
|
for (let i = 0; i < traverseUp; i++) {
|
|
|
|
|
compFiber = GetCompFiber(compFiber);
|
|
|
|
|
}
|
|
|
|
|
return compFiber.stateNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用法
|
|
|
|
|
const someElement = document.getElementById("someElement");
|
|
|
|
|
const myComp = FindReact(someElement);
|
|
|
|
|
myComp.setState({test1: test2});
|
|
|
|
|
```
|
|
|
|
|
|
2022-11-27 20:49:32 +08:00
|
|
|
|
**6.ecode集成iconfont**
|
|
|
|
|
|
|
|
|
|
```css
|
|
|
|
|
/*修改url,字体文件上传到cloudstore/iconfont/xx/下,没有目录自己创建*/
|
2022-12-10 16:45:29 +08:00
|
|
|
|
/*修改font-family,命名为其他名称,防止与系统自带的或与其他iconfont冲突,并将修改后的css文件内容copy到ecode中,将文件夹发布,并且将css样式文件前置加载*/
|
2022-11-27 20:49:32 +08:00
|
|
|
|
@font-face {
|
|
|
|
|
font-family: "cus_iconfont"; /* Project id 3789451 */
|
|
|
|
|
src: url('/cloudstore/iconfont/pcn/iconfont.woff2?t=1669223019749') format('woff2'),
|
|
|
|
|
url('/cloudstore/iconfont/pcn/iconfont.woff?t=1669223019749') format('woff'),
|
|
|
|
|
url('/cloudstore/iconfont/pcn/iconfont.ttf?t=1669223019749') format('truetype');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*修改iconfont类名为font-family的名称*/
|
|
|
|
|
.cus_iconfont {
|
|
|
|
|
font-family: "cus_iconfont" !important;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-style: normal;
|
|
|
|
|
-webkit-font-smoothing: antialiased;
|
|
|
|
|
-moz-osx-font-smoothing: grayscale;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2022-12-10 16:45:29 +08:00
|
|
|
|
**7.ecode组件样式引入(非前值加载)**
|
|
|
|
|
> 维护人员 youhong.ai
|
|
|
|
|
|
|
|
|
|
在ecode开发时,需要编写css样式文件,但是偶尔会出现className与其他组件的className一样,导致样式发生覆盖或影响原来的组件的样式(前置加载会将css文件合并到init。css中,并且会全局引入,所以可能会造成样式污染)
|
|
|
|
|
在ecode中,找到config文件夹,找到config.js文件,可以看到的是js文件属于前置加载,我们只需要在这个js文件中将css文件动态添加到页面中就可以了
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
|
|
|
|
|
$(() => {
|
2023-05-10 14:15:05 +08:00
|
|
|
|
if (window.location.hash.indexOf("${appId}_") !== -1) {
|
2022-12-10 16:45:29 +08:00
|
|
|
|
loadCssArr(['index.css'])
|
|
|
|
|
/* ******************** 下面两个文件为开发新页面时候,如果用户登陆超时,用于集成系统登陆弹窗的依赖和css样式文件 ******************* */
|
|
|
|
|
// loadJs('/spa/portal/public/index.js')
|
|
|
|
|
// loadCss('/spa/portal/public/index.css')
|
|
|
|
|
// 使用方法,当请求结果返回的errorCode === '002',然后调用下面的方法
|
|
|
|
|
// doLoginPop()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加载当前appId下的css资源文件
|
|
|
|
|
* @param cssArr css文件名称数组 (所有的css会被合并为index.css)
|
|
|
|
|
*/
|
|
|
|
|
function loadCssArr(cssArr) {
|
|
|
|
|
cssArr.forEach(item => {
|
|
|
|
|
let href = '/cloudstore/release/${appId}/' + item;
|
|
|
|
|
loadCss(href)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加载自定义的css样式文件,可以用于加载上传到resources文件加下的css文件,需要自己拼接路径
|
|
|
|
|
* @param url 样式文件的路径
|
|
|
|
|
*/
|
|
|
|
|
function loadCss(url) {
|
|
|
|
|
const head = document.getElementsByTagName('head')[0];
|
|
|
|
|
const link = document.createElement('link');
|
|
|
|
|
link.type = 'text/css';
|
|
|
|
|
link.rel = 'stylesheet';
|
|
|
|
|
link.href = url;
|
|
|
|
|
head.appendChild(link);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加载当前ecode文件夹下的js文件,一般js文件会被打包成index.js文件
|
|
|
|
|
* @param jsArr js文件名数组
|
|
|
|
|
*/
|
|
|
|
|
function loadJsArr(jsArr) {
|
|
|
|
|
jsArr.forEach(item => {
|
|
|
|
|
let src = href = '/cloudstore/release/${appId}/' + item;
|
|
|
|
|
loadJs(src)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加载自定义js文件,可用于加载第三方js库
|
|
|
|
|
* @param url js文件路径
|
|
|
|
|
* @param callback 加载完成后回调方法
|
|
|
|
|
*/
|
|
|
|
|
function loadJs(url, callback) {
|
|
|
|
|
let script = document.createElement('script'),
|
|
|
|
|
fn = callback || function () {
|
|
|
|
|
};
|
|
|
|
|
script.type = 'text/javascript';
|
|
|
|
|
//IE
|
|
|
|
|
if (script.readyState) {
|
|
|
|
|
script.onreadystatechange = function () {
|
|
|
|
|
if (script.readyState == 'loaded' || script.readyState == 'complete') {
|
|
|
|
|
script.onreadystatechange = null;
|
|
|
|
|
fn();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
//其他浏览器
|
|
|
|
|
script.onload = function () {
|
|
|
|
|
fn();
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
script.src = url;
|
|
|
|
|
document.getElementsByTagName('head')[0].appendChild(script);
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2022-11-24 14:59:07 +08:00
|
|
|
|
### 数据库
|
|
|
|
|
|
|
|
|
|
**备份mysql数据库**
|
|
|
|
|
> 维护人员: youHong.ai
|
|
|
|
|
|
|
|
|
|
```shell
|
2022-12-07 15:08:39 +08:00
|
|
|
|
mysqldump -uroot -p'passowrd' --single-transaction -ApiResult -E --databases ecology_dev> /tmp/ecology_dev_back.sql
|
2022-11-24 14:59:07 +08:00
|
|
|
|
```
|
|
|
|
|
|
2023-03-14 15:12:53 +08:00
|
|
|
|
### 常用视图
|
2022-11-24 15:08:27 +08:00
|
|
|
|
|
2023-03-14 15:12:53 +08:00
|
|
|
|
请查询查看项目根目录下的相关视图文件
|
2022-11-24 15:08:27 +08:00
|
|
|
|
|
2022-11-24 14:59:07 +08:00
|
|
|
|
### 后端
|
2022-11-25 16:32:54 +08:00
|
|
|
|
|
|
|
|
|
**1.后端根据请求获取登录用户信息**
|
|
|
|
|
> 维护人员:xuanran.wang
|
2022-11-25 17:35:20 +08:00
|
|
|
|
|
2022-11-25 16:32:54 +08:00
|
|
|
|
```java
|
2022-12-01 16:35:18 +08:00
|
|
|
|
//@Context HttpServletRequest request, @Context HttpServletResponse response
|
|
|
|
|
User logInUser=HrmUserVarify.getUser(request,response);
|
2023-02-16 19:00:32 +08:00
|
|
|
|
// 传入id会将此人员信息带出
|
|
|
|
|
User user=new User(id);
|
|
|
|
|
// 获取人员id
|
|
|
|
|
user.getUID();
|
2022-11-25 16:32:54 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**2.发送邮件**
|
|
|
|
|
> 维护人员:xuanran.wang
|
2022-11-25 17:35:20 +08:00
|
|
|
|
|
2022-11-25 16:32:54 +08:00
|
|
|
|
```java
|
|
|
|
|
/**
|
|
|
|
|
* <h1>发送邮件</h1>
|
|
|
|
|
* @param address 邮箱地址
|
|
|
|
|
* @param title 标题
|
|
|
|
|
* @param content 正文
|
|
|
|
|
**/
|
2022-11-25 17:35:20 +08:00
|
|
|
|
EmailWorkRunnable.threadModeReminder(address,title,content);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
> 维护人员: youHong.ai
|
|
|
|
|
|
|
|
|
|
```java
|
|
|
|
|
/**
|
|
|
|
|
* <h2>发送附件邮件</h2>
|
|
|
|
|
* @param sendTo 收件人邮箱地址(多个值之间用英文逗号分隔)
|
|
|
|
|
* @param sendCc 抄送人邮箱地址(多个值之间用英文逗号分隔)
|
|
|
|
|
* @param sendBcc 密送人邮箱地址(多个值之间用英文逗号分隔)
|
|
|
|
|
* @param subject 主题
|
|
|
|
|
* @param content 内容
|
|
|
|
|
* @param imageFileIds 附件id
|
|
|
|
|
*/
|
|
|
|
|
EmailWorkRunnable.threadModeReminder(sendTo,sendCc,sendBcc,subject,content,imageFileIds);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
或者
|
|
|
|
|
|
|
|
|
|
```java
|
|
|
|
|
/*
|
|
|
|
|
@param sendTo 收件人邮箱地址(多个值之间用英文逗号分隔)
|
|
|
|
|
@param sendCc 抄送人邮箱地址(多个值之间用英文逗号分隔)
|
|
|
|
|
@param sendBcc 密送人邮箱地址(多个值之间用英文逗号分隔)
|
|
|
|
|
@param subject 主题
|
|
|
|
|
@param content 内容
|
|
|
|
|
@param imageFileIds 附件id
|
|
|
|
|
*/
|
|
|
|
|
EmailWorkRunnable emailWorkRunable=new EmailWorkRunnable(sendTo,sendCc,sendBcc,subject,content);
|
2023-02-16 19:00:32 +08:00
|
|
|
|
emailWorkRunable.setImagefileids(imageFileIds);
|
|
|
|
|
MailCommonUtils.executeThreadPool(EmailPoolSubTypeEnum.EMAIL_SYS_ALTER.toString(),emailWorkRunable);
|
2022-11-25 16:32:54 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**3.短信服务**
|
|
|
|
|
> 维护人员:xuanran.wang
|
2022-11-25 17:35:20 +08:00
|
|
|
|
|
2022-11-25 16:32:54 +08:00
|
|
|
|
```java
|
|
|
|
|
public class SendSms implements SmsService {
|
2023-02-16 19:00:32 +08:00
|
|
|
|
@Override
|
|
|
|
|
public boolean sendSMS(String smsId, String number, String msg) {
|
|
|
|
|
//执行短信调用接口逻辑
|
|
|
|
|
return SMSUtil.sendSms(number, msg, url, sn, pwd);
|
|
|
|
|
}
|
2022-11-25 16:32:54 +08:00
|
|
|
|
}
|
|
|
|
|
```
|
2022-11-25 17:35:20 +08:00
|
|
|
|
|
2022-11-25 16:32:54 +08:00
|
|
|
|
**4.三方插件文档转PDF(培训群找过来的)**
|
|
|
|
|
> 维护人员:xuanran.wang
|
2022-11-25 17:35:20 +08:00
|
|
|
|
|
2022-11-25 16:32:54 +08:00
|
|
|
|
```java
|
2022-11-25 17:35:20 +08:00
|
|
|
|
//wps转PDF:
|
|
|
|
|
DocImagefileToPdfUseWps toPdfUseWps=new DocImagefileToPdfUseWps();
|
2023-02-16 19:00:32 +08:00
|
|
|
|
newimagefileid=toPdfUseWps.officeDocumetnToPdfByImagefileid(docimagefileid);
|
|
|
|
|
|
|
|
|
|
//永中转PDF:
|
|
|
|
|
DocImagefileToPdf yozoToPdf=new DocImagefileToPdf();
|
|
|
|
|
newimagefileid=yozoToPdf.officeDocumetnToPdfByImagefileid(docimagefileid);
|
2022-11-25 16:32:54 +08:00
|
|
|
|
```
|