package com.persagy.server.controllers.dict


import com.persagy.database.SFilter
import com.persagy.mybatis.SMybatisDao
import com.persagy.server.datacenter.models.entities.dictdatacenter.DictTypeConversionLog
import com.persagy.service.SObjectService
import com.persagy.service.SPageContext
import com.persagy.service.models.requests.SCountRequest
import com.persagy.service.models.responses.SCountResponse
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * 项目化字典
 *
 * @author 张维新
 */
@Api(tags = ["项目化字典"])
@RestController
@RequestMapping("/dict-custom")
class DictCustomController {

    /** 数据中心向物理世界转数据 自定义字典 */
    val dictTypeConversionLogService = SObjectService(SMybatisDao(DictTypeConversionLog::class.java))

    /**
     * 项目化字典类型
     */
//    @ApiOperation(value = "项目化字典 - 统计数量", notes = "")
//    @PostMapping(value = ["/project-dict-count"])
//    fun  projectDictCount(@RequestBody request: SCountRequest): SCountResponse {
//        return DictDatacenterProjectcustomService.counts(request)
//    } // Function  projectDictCount

    /**
     * 需补充转换规则数量
     */
//    @ApiOperation(value = "项目化字典 - 需补充转换规则数量", notes = "")
//    @PostMapping(value = ["/project-dict-switch-count"])
//    fun  projectDictSwitchRuleCount(): SCountResponse{
//        return DictDatacenterProjectcustomService.projectDictSwitchRuleCounts()
//    } // Function  projectDictSwitchRuleCount


    /**
     * 项目化字典类型
     */
//    @ApiOperation(value = "项目化字典 - 内容", notes = "")
//    @PostMapping(value = ["/project-dict-info"])
//    fun  projectDictInfo(@RequestBody request: SQueryRequest): SQueryResponse<DictDatacenterProjectcustom> {
//        return DictDatacenterProjectcustomService.queryDict(request)
//    } // Function  projectDictCount()

    /**
     * 数据中心-物理世界数据转换
     */
//    @ApiOperation(value = "数据中心-物理世界数据转换 ", notes = "")
//    @PostMapping(value = ["/project-dict-datacenter"])
//    fun dataCenterDataPlatform(): SQueryResponse<EquipDictStatistics>{
//       return DictDatacenterProjectcustomService.equipStatisticsDataCenter()
//    } // Function dataCenterDataPlatform ()

    /**
     * 物理世界 - 数据中心数据转换
     */
//    @ApiOperation(value = "物理世界-数据中心数据转换 ", notes = "")
//    @PostMapping(value = ["/project-dict-dataplatfrom"])
//    fun dataPlatformdataCenter(): SQueryResponse<EquipDictStatistics>{
//        return DictDatacenterProjectcustomService.equipStatisticsDataPlatfrom()
//    } // Function dataCenterDataPlatform ()


//    @ApiOperation(value = "更新自定义自定脚本", notes = "")
//    @PostMapping(value = ["/update"])
//    fun update(@RequestBody request: ArrayList<DictDatacenterProjectcustom>): SBaseResponse {
//
//        return DictDatacenterProjectcustomService.updateDictSwitchRule(request)
//    } // Function upDate

    /**
     * 获取不能同步到物理世界对象的数量
     */
    @ApiOperation(value = "获取不能同步到物理世界对象的数量", notes = "")
    @PostMapping(value = ["/data-count"])
    fun objectCounts(@RequestBody request: SCountRequest): SCountResponse {
        return dictTypeConversionLogService.count(request,arrayListOf(SFilter.eq("projectId", SPageContext.getHeader("ProjectId").toString())))
    }  // Function objectCounts()



} //