package com.gic.haoban.manage.web.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.manage.api.dto.TabHaobanAppLogDTO;
import com.gic.haoban.manage.api.service.TabHaobanAppLogApiService;
import com.gic.haoban.manage.web.qo.TabHaobanAppLogQO;
import jdk.nashorn.internal.ir.annotations.Ignore;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @Author: wenhua
 * @Date: 2023/5/11 21:50
 */
@RestController
public class TabHaobanAppLogController {

    private static org.apache.logging.log4j.Logger logger = LogManager.getLogger(TabHaobanAppLogController.class);

    @Autowired
    private TabHaobanAppLogApiService tabHaobanAppLogApiService;

    @RequestMapping("/insert_log")
    @ResponseBody
    @IgnoreLogin
    @com.gic.web.common.ano.IgnoreLogin
    public RestResponse<Boolean> insertLog(@RequestBody TabHaobanAppLogQO qo) {
        logger.info("插入日志的参数：{}", JSON.toJSONString(qo));
        tabHaobanAppLogApiService.insert(JSONObject.parseObject(JSONObject.toJSONString(qo), TabHaobanAppLogDTO.class));
        return RestResponse.successResult();
    }

}
