DracMessageInfoController.java 5.03 KB
package cn.com.glsx.entmicro.controller.message;

import cn.com.glsx.entmicro.model.response.ExportDracImResponse;
import cn.com.glsx.entmicro.model.response.message.DracMesCusrCollectionResponse;
import cn.com.glsx.entmicro.model.response.message.DracMessageInfoResponse;
import cn.com.glsx.entmicro.request.message.*;
import cn.com.glsx.entmicro.service.message.DracMessageInfoService;
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;

/**
 * @BelongsProject: scrm_v2.11.0_20221010_1
 * @BelongsPackage: cn.com.glsx.entmicro.controller.message
 * @Author: zhouhb
 * @CreateTime: 2022-11-23  16:59
 * @Description: 营销短信服务
 * @Version: 1.0
 */
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
@Api("营销短信服务")
@Slf4j
public class DracMessageInfoController {

    @Autowired
    private DracMessageInfoService dracMessageInfoService;

    /**
     * 保存短信营销配置
     *
     * @param dracMessageCreateRequest 入参
     * @return
     */
    @ServiceMethod(method = "entmicro.api.message.createMessageInfo", needInSession = NeedInSessionType.YES)
    @ApiOperation("保存短信营销配置")
    public RopResponse<ExportDracImResponse> createMessageInfo(DracMessageCreateRequest dracMessageCreateRequest) {
        try {
            return RopResponse.success(dracMessageInfoService.createMessageInfo(dracMessageCreateRequest));
        } catch (RpcServiceException e) {
            log.info("=======DracMessageInfoController__invoke__createMessageInfo__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 查询短信营销列表
     *
     * @param dracMessagePageListRequest 入参
     * @return
     */
    @ServiceMethod(method = "entmicro.api.message.findAllByPage", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询短信营销列表")
    public RopResponse<Pagination<DracMessageInfoResponse>> findAllByPage(DracMessagePageListRequest dracMessagePageListRequest) {
        try {
            return RopResponse.success(dracMessageInfoService.findAllByPage(dracMessagePageListRequest));
        } catch (RpcServiceException e) {
            log.info("=======DracMessageInfoController__invoke__findAllByPage__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 查询短信营销客户列表
     *
     * @param dracMessagePageCusListRequest 入参
     * @return
     */
    @ServiceMethod(method = "entmicro.api.message.findAllCustomerByPage", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询短信营销客户列表")
    public RopResponse<Pagination<DracMesCusrCollectionResponse>> findAllCustomerByPage(DracMessagePageCusListRequest dracMessagePageCusListRequest) {
        try {
            return RopResponse.success(dracMessageInfoService.findAllCustomerByPage(dracMessagePageCusListRequest));
        } catch (RpcServiceException e) {
            log.info("=======DracMessageInfoController__invoke__findAllCustomerByPage__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 删除营销
     *
     * @param dracMessageUpdateStatusRequest 入参
     * @return
     */
    @ServiceMethod(method = "entmicro.api.message.updateMessageInfoStatus", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询短信营销客户列表")
    public RopResponse<Boolean> updateMessageInfoStatus(DracMessageUpdateStatusRequest dracMessageUpdateStatusRequest) {
        try {
            return RopResponse.success(dracMessageInfoService.updateMessageInfoStatus(dracMessageUpdateStatusRequest));
        } catch (RpcServiceException e) {
            log.info("=======DracMessageInfoController__invoke__updateMessageInfoStatus__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 查询短信营销
     *
     * @param dracMessageDetailRequest 入参
     * @return
     */
    @ServiceMethod(method = "entmicro.api.message.findDetailById", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询短信营销")
    public RopResponse<DracMessageInfoResponse> findDetailById(DracMessageDetailRequest dracMessageDetailRequest) {
        try {
            return RopResponse.success(dracMessageInfoService.findDetailById(dracMessageDetailRequest));
        } catch (RpcServiceException e) {
            log.info("=======DracMessageInfoController__invoke__findDetailById__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }
}