雄安一机游管理后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

199 lines
8.0 KiB

1.部署项目需要用到的第三方工具:
a.rabbitmq
b.redis
c.doc文件中的jar包导入
d.注册多数据源-com.cjy.db.DynamicDataSourceRegister
pom坐标:
<!--MQ-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!-- 极光推送 -->
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jiguang-common</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.6.Final</version>
<scope>compile</scope>
</dependency>
<!--需要有gson坐标。已经导入-->
<!--<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<!--极光推送结束 -->
<!--百度ai图片等所需坐标-->
<dependency>
<groupId>com.baidu.aip</groupId>
<artifactId>java-sdk</artifactId>
<version>4.12.0</version>
</dependency>
html发送ajax注意事项:
ajax添加:
xhrFields: {
withCredentials: true // 这里设置了withCredentials
},
async:false,
注意:两个都必须要添加。
html所有显示图片的地方拼接 filectx 字段,该字段在 common > js > initParam.js
删除图片时在 attr("src") 后添加.replace(filectx,""); 否则造成存数据库出现带 前缀地址,如:http://localhost:8080/
$("#imglists").find("img").each(function(i) {
mpicss += (i > 0 ? "," : "") + $(this).attr("src").replace(filectx,"");
});
html三级联动地域回显与初始化:
引用cjy_show_city.js文件即可,回显调用setProCityCoun('回显的地域编码');
html静态页的样式:必须有 id="province" id="city" id="county" 根据这三个属性赋值
<div class=layui-form-item style="width: 90%">
<label class="layui-form-label"><span style="color:red;">*</span>行政区划</label>
<div class="layui-input-inline" style="margin-bottom:4px">
<select name="province" id="province" lay-filter="province"
lay-verify="required|province">
<option value=''>-请选择-</option>
</select>
</div>
<div class="layui-input-inline" style="margin-bottom:4px">
<select name="city" id="city" lay-filter="city" ><!--lay-verify="required|city" onchange="cityareacode()"-->
<option value=''>-请选择-</option>
</select>
</div>
<div class="layui-input-inline" style="margin-bottom:4px;">
<select name="county" id="county" lay-filter="county"><!--lay-verify="required|county"-->
<option value=''>-请选择-</option>
</select>
</div>
</div>
注:前后分离富文本与项目session冲突,更换session名称解决问题。应该也可以都用 修改application.properties的方式
jar方式启动:application.properties 添加:server.session.cookie.name=session名称
tomcat方式:
<session-config>
<session-timeout>120</session-timeout>
<cookie-config>
<name>ybsj-session</name>
<http-only>true</http-only>
<secure>false</secure>
<max-age>7200</max-age>
</cookie-config>
</session-config>
部署注意事项:
1.富文本上传图片路径前缀修改:
\js\ueditor1_4_3_3\jsp\config.json 修改图片访问路径前缀有多处
2.检出项目后,需要将webapp放入source;操作步骤如下:
右击项目-properties-java build path - source
3.idea > maven install 跟MyEclipse不同需要在pom文件添加一段内容,
因为加了springboot提供的Thymeleaf所以要把webapp目录设置为数据源Sources,
MyEclipse直接设置就行,idea需要在pom配置:
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>**/**</include>
</includes>
<!-- 是否替换资源中的属性 -->
<filtering>false</filtering>
</resource>
4. idea下注意这两个左边的作用域。MyEclipse两个作用域时一样的,Idea需要修改
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- tomcat的支持. -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>compile</scope>
</dependency>
5.单独部署html页面
只需把html目录复制出来;并在html同级目录需要有WEB-INF > lib > 富文本jar包(供富文本上传使用,\html\common\ueditor1_4_3_3\jsp\lib)
修改common > js > initParam.js文件中的 ctx(接口地址)、filectx(文件地址)路径。
注意::: 修改common > ueditor1_4_3_3 > jsp > config.json的访问前缀为富文本所在项目的地址和端口号
html\back\ybsjMap\js\config.js 路径也需要更改
6.后台代码部署:两种
1.打包复制所有到tomcat
2.maven打包复制项目下WEB-INF目录到tomcat目录下;然后classes里边只需要com、WEB-INF目录以及配置文件即可,其他可以没有。
7.附件使用nginx启动,指向目录;在项目的application.properties文件的fileURL参数为访问URL;
8.org.apache.catalina.LifecycleException 启动项目遇到这个错误
在apache-tomcat-8.5.34-10003\conf\catalina.properties文件中
tomcat.util.scan.StandardJarScanFilter.jarsToScan=\ 后加 ,* 变为:tomcat.util.scan.StandardJarScanFilter.jarsToScan=\,*
org.apache.catalina.LifecycleException 启动项目遇到这个错误
(1)在apache-tomcat-8.5.34-10003\conf\catalina.properties文件中
tomcat.util.scan.StandardJarScanFilter.jarsToScan=\ 后加 ,* 变为:tomcat.util.scan.StandardJarScanFilter.jarsToScan=\,*
启动后如果仍然无法访问主页 再加:org.apache.catalina.startup.ContextConfig.jarsToSkip=*.jar
(2)在apache-tomcat-8.5.34-10003\conf\catalina.properties文件中
tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\ 后加 ,* 变为:tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\,*
tomcat.util.scan.StandardJarScanFilter.jarsToScan=\ 后加 ,* 变为:tomcat.util.scan.StandardJarScanFilter.jarsToScan=\,*
9.主从数据库将mysql client窗口误关闭,重启启动解决方法:
正式启动后,主库和从库的mysql client的DOS窗口不可关闭。
误关闭后的操作:
A.主库:
mysql> show master status\G
mysql> flush logs;
mysql> show master status\G
B.从库(主要看主库中的File文件和Position这两个值,分别填到从库的MASTER_LOG_FILE和MASTER_LOG_POS中)
mysql> stop slave;
Query OK, 0 rows affected (0.02 sec)
mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000004',MASTER_LOG_POS=120;
Query OK, 0 rows affected (0.03 sec)
mysql> start slave;
Query OK, 0 rows affected (0.02 sec)
mysql> show slave status\G
10.Redis的key监听过期事件
1.修改redis配置文件 将notify-keyspace-events 设置为 "Ex" 默认为 ""
2.两个类: config ---> RedisConfiguration
listener ---> KeyExpiredListener
3.项目配置文件添加
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.database=0
4.pom文件 ,springboot是1.5.9的 spring-data-redis 不能使用 2.x版本
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.8.9.RELEASE</version>
</dependency>
11.rabbitmq使用流程:
1.pom.xml 引入
2.application.properties 配置
3.RabbitMQConfig.java 注册
4.各业务逻辑调用 ScenicInfoServiceImpl.java 等
5.InitData.java 监听