Bläddra i källkod

修改配置文件,修改返回类型

xiewenjie 3 år sedan
förälder
incheckning
481d442cc2

+ 81 - 0
startJar.sh

@@ -0,0 +1,81 @@
+APP_NAME=changeing-dev.jar
+
+usage() {
+    echo "case: sh run.sh [start|stop|restart|status]"
+    echo "请类似这样执行 ./*.sh start   or  ./*sh restart"
+    exit 1
+}
+
+# 判断当前服务是否已经启动的函数
+is_exist(){
+    echo "执行 is_exist 方法"
+    pid=`ps -ef|grep $APP_NAME|grep -v grep|awk '{print $2}' ` #根据ps 命令查询当前服务的进程号 赋值给pid"
+    if [ -z "${pid}" ]; then #判断pid是否为空
+        echo "pid 等于null"
+        return 1
+    else
+        echo "pid 不等于null"
+        return 0
+    fi
+}
+
+
+start(){
+    is_exist
+    if [ $? -eq "0" ]; then    # [$? -eq "0"] 说明pid不等于空 说明服务正在运行中,将进程号打印出来
+        echo "${APP_NAME} running. pid=${pid}"
+    else
+        nohup java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5526 $APP_NAME > logs.log 2>error.log &  # 说明pid为空 执行java -jar 命令启动服务
+        echo "${APP_NAME} started"
+    fi
+}
+
+
+stop(){
+    echo "执行 stop 方法"
+    is_exist
+    if [ $? -eq "0" ]; then    # [$? -eq "0"] 说明pid不等于空 说明服务正在运行中,将进程号杀死
+        kill -9 $pid
+        echo "${pid} stopped"
+    else
+        echo "${APP_NAME} not running"
+    fi
+}
+
+
+status(){
+    echo "执行 status 方法"
+    is_exist
+    if [ $? -eq "0" ]; then
+        echo "${APP_NAME} running. Pid is ${pid}"
+    else
+        echo "${APP_NAME} not running"
+    fi
+}
+
+
+# 重启命令其实就是先执行关闭命令 再执行重启命令
+restart(){
+    stop
+    start
+}
+
+
+# 这里的$1 取的是当前输入命令 的第二个参数 ./start.sh start
+case "$1" in
+    "start")
+        start
+        ;;
+    "stop")
+        stop
+        ;;
+    "status")
+        status
+        ;;
+    "restart")
+        restart
+        ;;
+    *)
+    usage
+    ;;
+esac

+ 6 - 0
sxz-application/pom.xml

@@ -62,6 +62,12 @@
             </properties>
         </profile>
         <profile>
+            <id>devuat</id>
+            <properties>
+                <package.environment>devuat</package.environment>
+            </properties>
+        </profile>
+        <profile>
             <!-- 生产环境 -->
             <id>prod</id>
             <properties>

+ 1 - 0
sxz-application/src/main/resources/application-dev.properties

@@ -1,3 +1,4 @@
+server.port=8082
 server.file.location=E:\\Downloads\\
 upload.file.location=${server.file.location}/upload/
 #log

+ 87 - 0
sxz-application/src/main/resources/application-devuat.properties

@@ -0,0 +1,87 @@
+server.port=8082
+server.file.location=/web-shared/OneKeyDecorate/
+upload.file.location=${server.file.location}upload/
+#log
+logging.file.path=/mnt/change/logs/
+logging.config=classpath:logback-spring.xml
+logging.level.com.fdkk=debug
+#thymeleaf配置
+spring.thymeleaf.enabled=true
+spring.thymeleaf.prefix=classpath:/templates/
+spring.thymeleaf.suffix=.html
+spring.thymeleaf.mode=HTML5
+spring.thymeleaf.cache=false
+spring.thymeleaf.servlet.content-type=text/html
+spring.servlet.multipart.max-file-size=500MB
+spring.servlet.multipart.max-request-size=500MB
+spring.servlet.multipart.enabled=true
+spring.mvc.async.request-timeout=600000
+spring.web.static-locations=classpath:/META-INF/resources/,classpath:/resources/, classpath:/static/, file:${server.file.location},file:${upload.file.location}
+#数据库配置
+spring.datasource.url=jdbc:mysql://192.168.0.47:3306/change_clothes_x?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+spring.datasource.username=root
+spring.datasource.password=123123
+# Hikari will use the above plus the following to setup connection pooling
+spring.datasource.type=com.zaxxer.hikari.HikariDataSource
+spring.datasource.hikari.minimum-idle=5
+spring.datasource.hikari.maximum-pool-size=15
+spring.datasource.hikari.auto-commit=true
+spring.datasource.hikari.idle-timeout=30000
+spring.datasource.hikari.pool-name=DatebookHikariCP
+spring.datasource.hikari.max-lifetime=1800000
+spring.datasource.hikari.connection-timeout=30000
+#rabbitmq
+spring.rabbitmq.host=192.168.0.26
+spring.rabbitmq.port=5672
+spring.rabbitmq.username=uat
+spring.rabbitmq.password=uat
+##mybatis-plus配置 ##
+mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.slf4j.Slf4jImpl
+mybatis-plus.configuration.map-underscore-to-camel-case=true
+mybatis-plus.global-config.db-config.db-type=mysql
+mybatis-plus.global-config.db-config.field-strategy=not_null
+mybatis-plus.global-config.db-config.id-type=auto
+mybatis-plus.global-config.db-config.logic-delete-field=rec_status
+mybatis-plus.global-config.db-config.logic-delete-value=A
+mybatis-plus.global-config.db-config.logic-not-delete-value=I
+mybatis-plus.global-config.db-config.table-prefix=t_
+mybatis-plus.global-config.db-config.table-underline=true
+mybatis-plus.mapper-locations=classpath*:/mapper/*.xml
+## pagehelper分页插件配置 ##
+#标识是哪一种数据库
+pagehelper.helperDialect=mysql
+#启用合理化,如果pageNum<1会查询第一页,如果pageNum>pages会查询最后一页
+pagehelper.reasonable=true
+#为了支持startPage(Object params)方法,增加了该参数来配置参数映射,用于从对象中根据属性名取值, 可以配置pageNum,pageSize,count,pageSizeZero,reasonable,不配置映射的用默认值, 默认值为pageNum=pageNum;pageSize=pageSize;count=countSql;reasonable=reasonable;pageSizeZero=pageSizeZero
+pagehelper.params=count=countSql
+#支持通过 Mapper 接口参数来传递分页参数,默认值false,分页插件会从查询方法的参数值中,自动根据上面 params 配置的字段中取值,查找到合适的值时就会自动分页
+pagehelper.supportMethodsArguments=true
+#如果 pageSize=0 就会查询出全部的结果(相当于没有执行分页查询)
+pagehelper.page-size-zero=true
+#redis
+j2cache.config-location=classpath:/config/j2cache.properties
+j2cache.open-spring-cache=true
+j2cache.j2CacheConfig.serialization=fastjson
+j2cache.cache-clean-mode=active
+j2cache.redis-client=lettuce
+j2cache.j2CacheConfig.hosts = 192.168.0.47:6379
+j2cache.j2CacheConfig.password =
+j2cache.j2CacheConfig.database =14
+
+
+oss.point=http://oss-cn-shenzhen.aliyuncs.com
+oss.key=LTAIUrvuHqj8pvry
+oss.secrey=JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4
+oss.bucket=4dkankan
+#oss类型为oss(阿里云)或s3(亚马逊)
+oss.type=oss
+prefix.ali=https://houseoss.4dkankan.com/
+main.url=https://test.4dkankan.com/
+build.url=http://192.168.0.142:8100/
+light.build.url=http://192.168.0.142:8100/
+model.build.url=http://192.168.0.142:8100/
+#.max转datasmith和obj加减面url
+max.obj.url=http://192.168.0.75:8080/
+dingding.warning.address=https://oapi.dingtalk.com/robot/send?access_token=13ae02d6821a56ce86c3e6ad98d0260896eba5888a9bd18aed141c39f11299a8
+#缓存接口日志时间(单位小时)
+logsTimeOut=4

+ 1 - 0
sxz-application/src/main/resources/application-prod.properties

@@ -1,3 +1,4 @@
+server.port=8088
 server.file.location=/mnt/OneKeyDecorate/
 upload.file.location=${server.file.location}upload/
 #log

+ 2 - 1
sxz-application/src/main/resources/application-uat.properties

@@ -1,3 +1,4 @@
+server.port=8088
 server.file.location=/web-shared/OneKeyDecorate/
 upload.file.location=${server.file.location}upload/
 #log
@@ -15,7 +16,7 @@ spring.servlet.multipart.max-file-size=500MB
 spring.servlet.multipart.max-request-size=500MB
 spring.servlet.multipart.enabled=true
 spring.mvc.async.request-timeout=600000
-spring.web.static-locations=classpath:/META-INF/resources/,classpath:/resources/, classpath:/static/, file:${server.file.location}
+spring.web.static-locations=classpath:/META-INF/resources/,classpath:/resources/, classpath:/static/, file:${server.file.location},file:${upload.file.location}
 #数据库配置
 spring.datasource.url=jdbc:mysql://192.168.0.47:3306/change_clothes?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
 spring.datasource.username=root

+ 0 - 1
sxz-application/src/main/resources/application.properties

@@ -1,4 +1,3 @@
-server.port=8082
 
 #?? dev ,?? uat ,?? prod
 spring.profiles.active=@package.environment@

+ 1 - 0
sxz-core/src/main/java/com/fdkk/sxz/other/shiro/ShiroConfig.java

@@ -87,6 +87,7 @@ public class ShiroConfig {
         Map<String, String> filterRuleMap = new LinkedHashMap<>(Constant.Number.TWO);
         // 访问401和404页面不通过我们的Filter
         filterRuleMap.put("/logging/*", "anon");
+        filterRuleMap.put("/upload/*", "anon");
         filterRuleMap.put("/401", "anon");
         filterRuleMap.put("/404", "anon");
         filterRuleMap.put("/500", "anon");

+ 11 - 6
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/ImportDataController.java

@@ -457,10 +457,15 @@ public class ImportDataController extends BaseController {
     @RequestMapping(value = "/createJson", method = RequestMethod.GET)
     @NoAuthentication
     @AroundLog(name = "生成房型数据")
-    public String createJson(String num, String styleNum) {
+    public JSONObject createJson(String num, String styleNum) {
+
+        JSONObject resultJson = new JSONObject();
+
+
         try {
             if (StringUtils.isEmpty(num)) {
-                return "参数不能为空";
+                resultJson.put("msg","参数不能为空");
+                return resultJson;
             }
 
             String resultData = OkHttpUtils.httpGet(mainUrl + "api/scene/getInfo?num=" + num);
@@ -538,7 +543,7 @@ public class ImportDataController extends BaseController {
                     houseJson.put("version", version);
                     houseJson.put("floorPublishVer", floorPublishVer);
                     houseJson.put("entry", entryJson);
-                    return houseJson.toJSONString();
+                    return houseJson;
                 }
             }
 
@@ -550,7 +555,6 @@ public class ImportDataController extends BaseController {
             String data = FileUtils.readFile(basePath + File.separator + "floor.json");
             JSONObject inputJson = null;
             JSONArray inputArray = null;
-            JSONObject resultJson = new JSONObject();
             JSONArray resultArray = new JSONArray();
             if (StrUtil.isNotEmpty(data)) {
                 inputJson = JSON.parseObject(data);
@@ -628,10 +632,11 @@ public class ImportDataController extends BaseController {
             resultJson.put("entry", entryJson);
             cad.writeBinary(resultJson.toString().getBytes(), basePath + File.separator + "kjl.json");
 
-            return resultJson.toString();
+            return resultJson;
         } catch (Exception e) {
             e.printStackTrace();
-            return "生成json数据失败";
+            resultJson.put("msg","转换失败");
+            return resultJson;
         }
     }