LiveCodeController.java 1.58 KB
package cn.com.glsx.stoassistant.controller;

import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.stoassistant.request.LiveCodeRequest;
import cn.com.glsx.stoassistant.response.LiveCodeResponse;
import cn.com.glsx.stoassistant.service.LiveCodeService;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 活码管理
 */
@Slf4j
@Api("活码管理")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class LiveCodeController {

    @Autowired
    private LiveCodeService liveCodeService;

    /**
     * 获取群活码(车主扫码分配真实企微群)
     */
    @ServiceMethod(method = "scrm.api.stoassistant.livecode.get", needInSession = NeedInSessionType.YES)
    @ApiOperation("获取群活码")
    public RopResponse<LiveCodeResponse> getLiveCode(LiveCodeRequest request) {
        try {
            if (request == null || request.getReportUuidId() == null || request.getReportUuidId().trim().isEmpty()) {
                return RopResponse.error("AI收车报告唯一ID不能为空");
            }

            LiveCodeResponse response = liveCodeService.getLiveCode(request);
            return RopResponse.success(response);
        } catch (Exception e) {
            log.error("获取群活码失败", e);
            return RopResponse.error(e.getMessage());
        }
    }
}