Merge branch 'dev' into dev
This commit is contained in:
commit
1ed143cd37
85
build.sh
85
build.sh
@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# id : AL1009
|
# id : AL1009
|
||||||
#
|
#
|
||||||
# Last modified: 2021-04-07 21:45
|
# Last modified: 2021-04-12 21:18
|
||||||
#
|
#
|
||||||
# Filename: build.sh
|
# Filename: build.sh
|
||||||
#
|
#
|
||||||
@ -35,7 +35,6 @@ function echo_done() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_db_config() {
|
function get_db_config() {
|
||||||
cwd=$(pwd)
|
|
||||||
key=$1
|
key=$1
|
||||||
|
|
||||||
value=$(sed -n '/database/,/domain/p' "${CONFIG_FILE}" |awk -F : /^[[:space:]]*${key}/'{print $2}')
|
value=$(sed -n '/database/,/domain/p' "${CONFIG_FILE}" |awk -F : /^[[:space:]]*${key}/'{print $2}')
|
||||||
@ -128,9 +127,15 @@ function test_mysql_connect() {
|
|||||||
user=$3
|
user=$3
|
||||||
password=$4
|
password=$4
|
||||||
db=$5
|
db=$5
|
||||||
command="CREATE TABLE IF NOT EXISTS test(id INT); DROP TABLE test;"
|
sql_command="CREATE TABLE IF NOT EXISTS test(id INT); DROP TABLE test;"
|
||||||
|
command -v mysql > /dev/null
|
||||||
|
if [ "$?" -eq 0 ];then
|
||||||
|
mysql -h${host} -P${port} -u${user} -p${password} ${db} -e "${sql_command}" 2>/dev/null
|
||||||
|
else
|
||||||
|
[ "${host}" == "127.0.0.1" ] && return 0
|
||||||
echo_green "\n>>> $(gettext '拉取mysql docker 镜像如果是首次需要耗时,请稍等...')"
|
echo_green "\n>>> $(gettext '拉取mysql docker 镜像如果是首次需要耗时,请稍等...')"
|
||||||
docker run -it --rm mysql:5 mysql -h${host} -P${port} -u${user} -p${password} ${db} -e "${command}" 2>/dev/null
|
docker run -it --rm mysql:5 mysql -h${host} -P${port} -u${user} -p${password} ${db} -e "${sql_command}" 2>/dev/null
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
@ -148,11 +153,27 @@ function init(){
|
|||||||
if [ -f "${BASE_DIR}/build/config/settings.yml" ];then
|
if [ -f "${BASE_DIR}/build/config/settings.yml" ];then
|
||||||
CONFIG_FILE=${BASE_DIR}/build/config/settings.yml
|
CONFIG_FILE=${BASE_DIR}/build/config/settings.yml
|
||||||
else
|
else
|
||||||
echo_red "配置文件不存在,请检查配置文件是否存在。"
|
echo_red "配置文件: ${BASE_DIR}/build/config/settings.yml 不存在,请检查。"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo_done
|
}
|
||||||
|
|
||||||
|
function set_external_redis() {
|
||||||
|
redis_host=$(awk --re-interval '/url: redis/{match($0,/([0-9]{1,3}\.){3}[0-9]{1,3}/,a); print a[0]}' ${CONFIG_FILE})
|
||||||
|
read_from_input redis_host "$(gettext 'Please enter Redis server IP')" "" "${redis_host}"
|
||||||
|
|
||||||
|
redis_port=$(awk -F : '/url: redis/{print $NF}' ${CONFIG_FILE})
|
||||||
|
read_from_input redis_port "$(gettext 'Please enter Redis server port')" "" "${redis_port}"
|
||||||
|
|
||||||
|
redis_pass=$(awk -F '/' '/url: redis/{if($0~"@")print $3}' ${CONFIG_FILE} |cut -f 1 -d '@')
|
||||||
|
read_from_input redis_pass "$(gettext 'Please enter Redis password, 密码里面不能带@ /, 密码为空请务必修改配置文件!!')" "" "${redis_pass}"
|
||||||
|
|
||||||
|
# 设置redis账号密码到配置文件
|
||||||
|
if [ "${redis_pass}" == "" ];then
|
||||||
|
sed -i "s/url: redis:\/\/.*/url: redis:\/\/${redis_host}:${redis_port}/g" ${CONFIG_FILE}
|
||||||
|
else
|
||||||
|
sed -i "s/url: redis:\/\/.*/url: redis:\/\/${redis_pass}@${redis_host}:${redis_port}/g" ${CONFIG_FILE}
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_external_mysql() {
|
function set_external_mysql() {
|
||||||
@ -197,8 +218,20 @@ function config_mysql {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function config_redis {
|
||||||
|
echo_green "\n>>> $(gettext '回车前请确保你已经安装了Redis,且启动服务')"
|
||||||
|
read_from_input confirm "$(gettext 'Do you have been installed Redis')?" "y/n" "y"
|
||||||
|
|
||||||
|
if [[ "${confirm}" == "y" ]]; then
|
||||||
|
set_external_redis
|
||||||
|
else
|
||||||
|
echo_red "未安装Redis结束此次编译"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function get_variables {
|
function get_variables {
|
||||||
read_from_input front_url "$(gettext '请输入您的程序访问地址: ')" "" "https://fdevops.com:8001"
|
read_from_input front_url "$(gettext '请输入您的程序访问地址: ')" "" "https://fdevops.com:8002"
|
||||||
read_from_input front_clone_from "$(gettext '请选择从哪里拉取前端代码,默认是gitee: 1:gitee, 2: github, 3:自定义地址')" "" "1"
|
read_from_input front_clone_from "$(gettext '请选择从哪里拉取前端代码,默认是gitee: 1:gitee, 2: github, 3:自定义地址')" "" "1"
|
||||||
|
|
||||||
if [ $front_clone_from == 1 ]; then
|
if [ $front_clone_from == 1 ]; then
|
||||||
@ -210,15 +243,23 @@ function get_variables {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
config_mysql
|
config_mysql
|
||||||
read_from_input confirm "$(gettext '请确认是否创建配置文件中的redis库')?" "y/n[y]" "y"
|
config_redis
|
||||||
if [[ "${confirm}" != "y" ]]; then
|
|
||||||
echo_red "结束此次编译"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo_done
|
echo_done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function config_front {
|
||||||
|
echo_green "\n>>> $(gettext '替换程序访问地址...')"
|
||||||
|
cat > ${BASE_DIR}/ferry_web/.env.production << EOF
|
||||||
|
# just a flag
|
||||||
|
ENV = 'production'
|
||||||
|
|
||||||
|
# base api
|
||||||
|
VUE_APP_BASE_API = '$front_url'
|
||||||
|
EOF
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function install_front {
|
function install_front {
|
||||||
echo_green "\n>>> $(gettext '开始拉取前端程序...')"
|
echo_green "\n>>> $(gettext '开始拉取前端程序...')"
|
||||||
read_from_input confirm "$(gettext '此处会执行 rm -rf ./ferry_web 的命令,若此命令不会造成当前环境的损伤则请继续')?" "y/n[y]" "y"
|
read_from_input confirm "$(gettext '此处会执行 rm -rf ./ferry_web 的命令,若此命令不会造成当前环境的损伤则请继续')?" "y/n[y]" "y"
|
||||||
@ -238,7 +279,7 @@ function install_front {
|
|||||||
echo_red "克隆代码失败,请检查git地址: ${ui_address}或者网络质量"
|
echo_red "克隆代码失败,请检查git地址: ${ui_address}或者网络质量"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
config_front
|
||||||
echo_green "\n>>> $(gettext '开始安装前端依赖...')"
|
echo_green "\n>>> $(gettext '开始安装前端依赖...')"
|
||||||
cnpm_base_dir=$(dirname $(dirname $(which npm)))
|
cnpm_base_dir=$(dirname $(dirname $(which npm)))
|
||||||
npm install -g cnpm --registry=https://registry.npm.taobao.org --prefix ${cnpm_base_dir}
|
npm install -g cnpm --registry=https://registry.npm.taobao.org --prefix ${cnpm_base_dir}
|
||||||
@ -246,19 +287,6 @@ function install_front {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function config_front {
|
|
||||||
echo_green "\n>>> $(gettext '替换程序访问地址...')"
|
|
||||||
cat > ${BASE_DIR}/ferry_web/.env.production << EOF
|
|
||||||
# just a flag
|
|
||||||
ENV = 'production'
|
|
||||||
|
|
||||||
# base api
|
|
||||||
VUE_APP_BASE_API = '$front_url'
|
|
||||||
EOF
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function install_backend {
|
function install_backend {
|
||||||
echo_green "\n>>> $(gettext '开始编译后端程序...')"
|
echo_green "\n>>> $(gettext '开始编译后端程序...')"
|
||||||
|
|
||||||
@ -282,7 +310,7 @@ function install_backend {
|
|||||||
fi
|
fi
|
||||||
cp -r ${BASE_DIR}/ferry ${BASE_DIR}/build/
|
cp -r ${BASE_DIR}/ferry ${BASE_DIR}/build/
|
||||||
cd ${BASE_DIR}/build
|
cd ${BASE_DIR}/build
|
||||||
${BASE_DIR}/ferry init -c=config/settings.yml
|
${BASE_DIR}/build/ferry init -c=config/settings.yml
|
||||||
cd - &>/dev/null
|
cd - &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,13 +319,12 @@ function install_app() {
|
|||||||
init
|
init
|
||||||
get_variables
|
get_variables
|
||||||
install_front
|
install_front
|
||||||
config_front
|
|
||||||
install_backend
|
install_backend
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_backend {
|
function start_backend {
|
||||||
cd ${BASE_DIR}/build
|
cd ${BASE_DIR}/build
|
||||||
${BASE_DIR}/ferry server -c=config/settings.yml
|
./ferry server -c=config/settings.yml
|
||||||
}
|
}
|
||||||
|
|
||||||
function main {
|
function main {
|
||||||
|
@ -34,11 +34,12 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
|||||||
)
|
)
|
||||||
|
|
||||||
err = orm.Eloquent.Model(&processValue).Where("id = ?", processId).Find(&processValue).Error
|
err = orm.Eloquent.Model(&processValue).Where("id = ?", processId).Find(&processValue).Error
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
err = fmt.Errorf("查询流程失败,%v", err.Error())
|
// err = fmt.Errorf("查询流程失败,%v", err.Error())
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
if processValue.Structure != nil && len(processValue.Structure) > 0 {
|
||||||
err = json.Unmarshal([]byte(processValue.Structure), &processStructureDetails)
|
err = json.Unmarshal([]byte(processValue.Structure), &processStructureDetails)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("json转map失败,%v", err.Error())
|
err = fmt.Errorf("json转map失败,%v", err.Error())
|
||||||
@ -67,6 +68,7 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
|||||||
} else {
|
} else {
|
||||||
processNode = processStructureDetails["nodes"].([]map[string]interface{})
|
processNode = processStructureDetails["nodes"].([]map[string]interface{})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
processValue.Structure = nil
|
processValue.Structure = nil
|
||||||
result = map[string]interface{}{
|
result = map[string]interface{}{
|
||||||
@ -141,6 +143,7 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
|||||||
if len(stateList) > 0 {
|
if len(stateList) > 0 {
|
||||||
breakStateTag:
|
breakStateTag:
|
||||||
for _, stateValue := range stateList {
|
for _, stateValue := range stateList {
|
||||||
|
if processStructureDetails["nodes"] != nil {
|
||||||
for _, processNodeValue := range processStructureDetails["nodes"].([]interface{}) {
|
for _, processNodeValue := range processStructureDetails["nodes"].([]interface{}) {
|
||||||
if stateValue["id"].(string) == processNodeValue.(map[string]interface{})["id"] {
|
if stateValue["id"].(string) == processNodeValue.(map[string]interface{})["id"] {
|
||||||
if _, ok := stateValue["processor"]; ok {
|
if _, ok := stateValue["processor"]; ok {
|
||||||
@ -157,6 +160,7 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if workOrderInfo.CurrentState == "" {
|
if workOrderInfo.CurrentState == "" {
|
||||||
workOrderInfo.CurrentState = stateList[0]["id"].(string)
|
workOrderInfo.CurrentState = stateList[0]["id"].(string)
|
||||||
|
@ -44,13 +44,16 @@ func JudgeUserAuthority(c *gin.Context, workOrderId int, currentState string) (s
|
|||||||
|
|
||||||
// 获取流程信息
|
// 获取流程信息
|
||||||
err = orm.Eloquent.Model(&process.Info{}).Where("id = ?", workOrderInfo.Process).Find(&processInfo).Error
|
err = orm.Eloquent.Model(&process.Info{}).Where("id = ?", workOrderInfo.Process).Find(&processInfo).Error
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
if processInfo.Structure != nil && len(processInfo.Structure) > 0 {
|
||||||
err = json.Unmarshal(processInfo.Structure, &processState.Structure)
|
err = json.Unmarshal(processInfo.Structure, &processState.Structure)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stateValue, err = processState.GetNode(currentState)
|
stateValue, err = processState.GetNode(currentState)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user