# -------------------------------------------------------------------------------
# Filename:    java_deploy.sh
# Revision:    1.0
# Date:        2016/09
# Author:      Xiaolin.zhu
# Description: 该脚本负责build java项目。
# Usage：used by ../deploy/java_deploy.sh
# -------------------------------------------------------------------------------

pwd_path="/home/qa-deploy-utils/qa_shell_script"

cd /home/quant_group/han-gu-guan
echo "关闭han-gu-guan验证码"
echo `git checkout ./`
num=`grep -n "Boolean validCaptcha" src/main/java/cn/quantgroup/xyqb/aspect/captcha/CaptchaValidateAdvisor.java|awk -F ':' '{print $1}'`
echo "----------------------${num}-------------------"
sed -i "${num}s/false/true/"  src/main/java/cn/quantgroup/xyqb/aspect/captcha/CaptchaValidateAdvisor.java
num1=`expr ${num} + 1`
num6=`expr ${num} + 7`
echo "注释掉第${num1}行到${num6}行"
sed -i "${num1}i/*"  src/main/java/cn/quantgroup/xyqb/aspect/captcha/CaptchaValidateAdvisor.java
sed -i "${num6}i*/"  src/main/java/cn/quantgroup/xyqb/aspect/captcha/CaptchaValidateAdvisor.java

sh $pwd_path/4_build_by_name.sh han-gu-guan
sh $pwd_path/5_restart_by_name.sh han-gu-guan


cd /home/quant_group/xyqb-user2
echo `git checkout ./`
echo "关闭xyqb-user2验证码"
num=`grep -n "if (validCaptcha)" src/main/java/cn/quantgroup/xyqb/aspect/captcha/CaptchaValidateAdvisor.java|awk -F ':' '{print $1}'`
echo "----------------------${num}----------------------"
sed -i "${num}s/if (validCaptcha)/if (true)/g" src/main/java/cn/quantgroup/xyqb/aspect/captcha/CaptchaValidateAdvisor.java

sh $pwd_path/4_build_by_name.sh xyqb-user2
sh $pwd_path/5_restart_by_name.sh xyqb-user2