package com.fdkankan.platform.feign;

import com.fdkankan.platform.user.entity.User;
import com.fdkankan.platform.user.entity.UserIncrement;
import com.fdkankan.platform.user.service.IUserIncrementService;
import com.fdkankan.platform.user.service.IUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 提供计算调用
 */
@RestController
@RequestMapping("/feign")
public class ModelingFeign {

    private static Logger log = LoggerFactory.getLogger("programLog");

    @Autowired
    private IUserService userService;
    @Autowired
    private IUserIncrementService userIncrementService;

    @PostMapping("/getUserByName")
    public User getUserByName(@RequestParam(value = "userName", required = false) String userName) {
        log.info("modeling服务调用:getUserByName,参数：userName:{},",userName);
        User entity = userService.getUserByUserName(userName);
        log.info("modeling服务调用:getUserByName,返回:{}",entity);
        return entity;
    }
    @PostMapping("/getUserIncrementByCameraId")
    public UserIncrement getUserIncrementByCameraId(@RequestParam(value = "cameraId", required = false) Long cameraId) {
        log.info("modeling服务调用:getUserIncrementByCameraId,参数：cameraId:{},",cameraId);
        UserIncrement entity = userIncrementService.getByCameraId(cameraId);
        log.info("modeling服务调用:getUserIncrementByCameraId,返回:{}",entity);
        return entity;
    }

}
