BatchMomentController.java 3.71 KB
package cn.com.glsx.entmicro.controller.wechatcloudcontrol;

import cn.com.glsx.entmicro.request.wechatcloudcontrol.batchmoment.BatchMomentCreateRopRequest;
import cn.com.glsx.entmicro.request.wechatcloudcontrol.batchmoment.BatchMomentQueryRopRequest;
import cn.com.glsx.entmicro.request.wechatcloudcontrol.batchmoment.BatchMomentStaffRecordQueryRopRequest;
import cn.com.glsx.entmicro.response.wechatcloudcontrol.batchmoment.BatchMomentRopResponse;
import cn.com.glsx.entmicro.response.wechatcloudcontrol.batchmoment.BatchMomentStaffRecordRopResponse;
import cn.com.glsx.entmicro.service.wechatcloudcontrol.BatchMomentService;
import cn.com.glsx.entmicro.utils.Pagination;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
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;

/**
 * @Author yelq
 * @Version 1.0
 * @Description: 朋友圈群发
 * @Date 2022/9/16 17:11
 */
@Slf4j
@Api("朋友圈群发任务")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class BatchMomentController {

    @Autowired
    private BatchMomentService batchMomentService;

    @ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmoment.save")
    @ApiOperation("朋友圈群发任务创建")
    public RopResponse<Boolean> batchMomentSave(BatchMomentCreateRopRequest request) {
        try {
            return RopResponse.success(batchMomentService.batchMomentSave(request));
        } catch (RpcServiceException e) {
            log.info("=======BatchMomentController_batchMomentSave_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmoment.condition.page")
    @ApiOperation("朋友圈群发任务多条件分页查询")
    public RopResponse<Pagination<BatchMomentRopResponse>> batchMomentConditionPage(BatchMomentQueryRopRequest request) {
        try {
            return RopResponse.success(batchMomentService.batchMomentConditionPage(request));
        } catch (RpcServiceException e) {
            log.info("=======BatchMomentController_batchMomentConditionPage_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmoment.record.page")
    @ApiOperation("发送记录分页查询")
    public RopResponse<Pagination<BatchMomentStaffRecordRopResponse>> batchMomentStaffRecordPage(BatchMomentStaffRecordQueryRopRequest request) {
        try {
            return RopResponse.success(batchMomentService.batchMomentStaffRecordPage(request));
        } catch (RpcServiceException e) {
            log.info("=======BatchMomentController_batchMomentStaffRecordPage_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmoment.send.stop")
    @ApiOperation("朋友圈停止发送")
    public RopResponse<Boolean> stopBatchMomentSend(BatchMomentStaffRecordQueryRopRequest request) {
        try {
            return RopResponse.success(batchMomentService.stopBatchMomentSend(request));
        } catch (RpcServiceException e) {
            log.info("=======BatchMomentController_stopBatchMomentSend_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }
}