/*
 * ********************************************************************************************************************
 *
 *                      :*$@@%$*:                         ;:                ;;    ;;
 *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
 *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
 *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
 *                   =@*                                  %!              @ $= % %@=   =%@!      %=
 *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
 *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
 *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
 *          $@*   ;@@@%=!:                *@*
 *          =@$    ;;;!=%@@@@=!           =@!
 *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
 *            ;%@@$=$@@%*       *@@@$=%@@%;
 *               ::;::             ::;::                                              All rights reserved.
 *
 * ********************************************************************************************************************
 */

package com.persagy.revit

import com.alibaba.fastjson.PropertyNamingStrategy
import com.alibaba.fastjson.serializer.SerializeConfig
import com.persagy.service.json.SJsonHttpMessageConverter
import org.mybatis.spring.annotation.MapperScan
import org.slf4j.LoggerFactory
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.builder.SpringApplicationBuilder
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan

/**
 * 应用配置
 *
 * @author  Andy
 */
@ComponentScan(basePackages = ["com.persagy.revit", "com.persagy"])           // 配置组件扫描路径
@MapperScan("com.persagy", "com.persagy.revit")                       // Mapper组件扫描路径
@SpringBootApplication
open class AlgorithmApp : SpringBootServletInitializer() {
    companion object {
        // 日志
        private val logger = LoggerFactory.getLogger(AlgorithmApp::class.java)
    } // Companion object


    /**
     * 配置FastJson
     *
     * @return  HttpMessageConverters
     */
//    @Bean
//    @Suppress("MoveLambdaOutsideParentheses")
//    open fun jsonHttpMessageConverters(): SJsonHttpMessageConverter {
////        ParserConfig.getGlobalInstance().isAutoTypeSupport = true
//        val fastConverter = SJsonHttpMessageConverter()
//        fastConverter.propertyNamingStrategy = PropertyNamingStrategy.PascalCase
//        return fastConverter
//    } // Function fastJsonHttpMessageConverters()
//    /**
//     * 配置FastJson
//     *
//     * @return  HttpMessageConverters
//     */
//    @Bean
//    @Suppress("MoveLambdaOutsideParentheses")
//    open fun jsonMessageConverterConfig(): SerializeConfig {
////        ParserConfig.getGlobalInstance().isAutoTypeSupport = true
//        val config = SerializeConfig()
//        config.propertyNamingStrategy = PropertyNamingStrategy.PascalCase
//        return config
//    } // Function fastJsonHttpMessageConverters()

    /**
     * 配置应用
     *
     * @param   application     应用构建对象
     */
    override fun configure(application: SpringApplicationBuilder): SpringApplicationBuilder {
        return application.sources(AlgorithmApp::class.java)
    } // Function configure
} // Class Application

/**
 * Web应用入口
 *
 * @param   args        命令行参数
 */
fun main(args: Array<String>) {
    val ctx = SpringApplication.run(AlgorithmApp::class.java, *args)
//    var it = ctx.beanFactory.beanNamesIterator
//    while (it.hasNext()){
//        var str = it.next()
//        if(str.toLowerCase() == "algorithmApp")
//            println(str)
//    }
    return
} // Function main()

//网关:
//新地址: http://api.sagacloud.cn/data-platform-3                        原地址:   http://172.17.11.168:8888/data-platform-3
//新地址: http://api.sagacloud.cn/ScanBuilding                           原地址:   http://172.17.11.175:8080/ScanBuilding
//新地址: http://api.sagacloud.cn/fm-service/fm-plugins                  原地址:   http://172.17.11.175:8080/fm-plugins
//新地址: http://api.sagacloud.cn/fm-service/assign-order                原地址:   http://172.17.11.175:8080/assign-order
//新地址: http://api.sagacloud.cn/fm-service/qrcode                      原地址:   http://172.17.11.175:8080/qrcode
//新地址: http://api.sagacloud.cn/fm-service/sms-platform                原地址:   http://172.17.11.175:8080/sms-platform
//新地址: http://api.sagacloud.cn/fm-service/person-service              原地址:   http://172.17.11.175:8081/person-service
//新地址: http://api.sagacloud.cn/fm-service/sop                         原地址:   http://172.17.11.175:8081/sop
//新地址: http://api.sagacloud.cn/fm-service/saas                        原地址:   http://172.17.11.175:8081/saas
//新地址: http://api.sagacloud.cn/fm-service/workorder                   原地址:   http://172.17.11.175:8081/workorder
//新地址: http://api.sagacloud.cn/dp-auxiliary/alarm-system              原地址:   http://172.17.11.172:8889/alarm-system
//新地址: http://api.sagacloud.cn/dp-auxiliary/custom-data               原地址:   http://172.17.11.172:8889/custom-data
//新地址: http://api.sagacloud.cn/dp-auxiliary/data-front                原地址:   http://172.17.11.172:8889/data-front
//新地址: http://api.sagacloud.cn/dp-auxiliary/dict                      原地址:   http://172.17.11.172:8889/dict
//新地址: http://api.sagacloud.cn/dp-auxiliary/image-service             原地址:   http://172.17.11.172:8889/image-service
//新地址: http://api.sagacloud.cn/dp-auxiliary/metadata-web              原地址:   http://172.17.11.172:8889/metadata-web
//新地址: http://api.sagacloud.cn/dp-auxiliary/public-service            原地址:   http://172.17.11.172:8889/public-service
//新地址: http://api.sagacloud.cn/dp-auxiliary/static-content            原地址:   http://172.17.11.172:8889/static-content
//新地址: http://api.sagacloud.cn/duoduo-service/workorder-service       原地址:   http://172.17.11.170:51003
//新地址: http://api.sagacloud.cn/duoduo-service/alarm-service           原地址:   http://172.17.11.170:51004
//新地址: http://api.sagacloud.cn/duoduo-service/businessos-service      原地址:   http://172.17.11.170:51006
//新地址: http://api.sagacloud.cn/pythonserver                           原地址:   http://172.17.11.173:8001

