MerchantMissionController.java 5.54 KB
package cn.com.glsx.stoassistant.controller;

import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.stoassistant.model.response.mission.PlatformMerchantMissionInfoResponse;
import cn.com.glsx.stoassistant.model.response.mission.PlatformMerchantStaffMissionDetailResponse;
import cn.com.glsx.stoassistant.model.response.mission.StaffMissionDateResponse;
import cn.com.glsx.stoassistant.request.activity.ActivityMissionInfoRopRequest;
import cn.com.glsx.stoassistant.request.mission.StaffMissionListRopRequest;
import cn.com.glsx.stoassistant.request.mission.StaffMissionRopRequest;
import cn.com.glsx.stoassistant.request.userInfo.MerchantUserFollowInfoRopRequest;
import cn.com.glsx.stoassistant.service.MerchantMissionService;
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;

import java.util.List;

/**
 * @BelongsProject: 20221031
 * @BelongsPackage: cn.com.glsx.stoassistant.controller
 * @Author: 11
 * @CreateTime: 2022-10-18  09:51
 * @Description: TODO
 * @Version: 1.0
 */
@Slf4j
@Api("任务中心门店助手接口")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class MerchantMissionController {

    @Autowired
    private MerchantMissionService merchantMissionService;

    /**
     * 查询任务,链接跳转
     *
     * @param staffMissionRopRequest 入参
     * @return
     */
    @ServiceMethod(method = "stoassistant.api.mission.getMissionById", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询任务,链接跳转")
    public RopResponse<PlatformMerchantStaffMissionDetailResponse> getMissionById(StaffMissionRopRequest staffMissionRopRequest) {
        try {
            PlatformMerchantStaffMissionDetailResponse response = merchantMissionService.getMissionById(staffMissionRopRequest);
            return RopResponse.success(response);
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffPersonalController__invoke__getMissionById__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 查询任务,分享任务
     *
     * @param staffMissionRopRequest 入参
     * @return
     */
    @ServiceMethod(method = "stoassistant.api.mission.getMissionByIdAndNoSession", needInSession = NeedInSessionType.NO)
    @ApiOperation("查询任务,链接跳转")
    public RopResponse<PlatformMerchantStaffMissionDetailResponse> getMissionByIdAndNoSession(StaffMissionRopRequest staffMissionRopRequest) {
        try {
            PlatformMerchantStaffMissionDetailResponse response = merchantMissionService.getMissionByIdAndNoSession(staffMissionRopRequest);
            return RopResponse.success(response);
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffPersonalController__invoke__getMissionByIdAndNoSession__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 查询活动
     *
     * @param staffMissionRopRequest 入参
     * @return
     */
    @ServiceMethod(method = "stoassistant.api.mission.findStaffMissionList", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询活动")
    public RopResponse<List<StaffMissionDateResponse>> findStaffMissionList(StaffMissionListRopRequest staffMissionRopRequest) {
        try {
            List<StaffMissionDateResponse> response = merchantMissionService.findStaffMissionList(staffMissionRopRequest);
            return RopResponse.success(response);
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffPersonalController__invoke__findStaffMissionList__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 保存用户跟进线索
     *
     * @param request 入参
     * @return
     */
    @ServiceMethod(method = "stoassistant.api.mission.saveMerchantUserFollowInfo", needInSession = NeedInSessionType.YES)
    @ApiOperation("保存用户跟进线索")
    public RopResponse<Boolean> saveMerchantUserFollowInfo(MerchantUserFollowInfoRopRequest request) {
        try {
            merchantMissionService.saveMerchantUserFollowInfo(request);
            return RopResponse.success(true);
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffPersonalController__invoke__saveMerchantUserFollowInfo__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 根据活动id查询任务详情
     *
     * @param activityIdRequest 入参
     * @return
     */
    @ServiceMethod(method = "stoassistant.api.mission.findMissionByActiviyId", needInSession = NeedInSessionType.YES)
    @ApiOperation("根据活动id查询任务详情")
    public RopResponse<PlatformMerchantMissionInfoResponse> findMissionByActiviyId(ActivityMissionInfoRopRequest activityIdRequest) {
        try {
            return RopResponse.success(merchantMissionService.findMissionByActiviyId(activityIdRequest));
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffPersonalController__invoke__findMissionByActiviyId__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }
}