package com.crm.manager.controller;

import com.crm.manager.service.*;
import com.crm.rely.backend.core.constant.Constants;
import com.crm.rely.backend.core.constant.PrefixEnum;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.dto.custom.CustomGetEmailDto;
import com.crm.rely.backend.core.dto.market.MarketEmailStatusNumberDto;
import com.crm.rely.backend.core.dto.market.promo.code.email.MarketPromoCodeEmailListDto;
import com.crm.rely.backend.core.dto.market.promo.code.email.record.MarketPromoCodeEmailRecordListDto;
import com.crm.rely.backend.core.dto.market.upload.email.MarketUploadEmailListDto;
import com.crm.rely.backend.core.dto.system.email.template.SysEmailTemplateSearchDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.custom.info.CustomSearchGetEmailEntity;
import com.crm.rely.backend.core.entity.custom.info.InfoEntity;
import com.crm.rely.backend.core.entity.market.email.upload.MarketUploadEmailSearchPageEntity;
import com.crm.rely.backend.core.entity.market.email.upload.detail.MarketUploadEmailDetailSearchGetEmailEntity;
import com.crm.rely.backend.core.entity.market.promo.code.email.MarketPromoCodeEmailAddEntity;
import com.crm.rely.backend.core.entity.market.promo.code.email.MarketPromoCodeEmailSearchPageEntity;
import com.crm.rely.backend.core.entity.market.promo.code.email.record.MarketPromoCodeEmailRecordSearchPageEntity;
import com.crm.rely.backend.core.entity.market.promo.code.email.record.MarketPromoCodeEmailRecordSendEntity;
import com.crm.rely.backend.core.entity.market.promo.code.email.record.MarketPromoCodeEmailRecordStatusNumberEntity;
import com.crm.rely.backend.core.entity.market.promo.code.email.record.MarketPromoCodeRecordSupplementSendEntity;
import com.crm.rely.backend.core.entity.system.email.template.SysEmailTemplateSearchEntity;
import com.crm.rely.backend.core.pojo.table.MarketPromoCodeEmailTable;
import com.crm.rely.backend.exception.ControllerException;
import com.crm.rely.backend.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 *
 *
 * @author houn
 */
@RestController
@RequestMapping("/common")
public class CommonController {

    @Autowired
    private CommonService commonService;


    @PostMapping("/upload")
    public BaseResultDto upload(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {

        commonService.validated(file);
        String path = commonService.uploadFile(file);
        return BaseResultDto.success(Constants.SUCCESS, path);
    }
}
