package cn.pluss.platform.dto;

import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.entity.MerchantImage;
import cn.pluss.platform.util.StringUtil;
import io.swagger.annotations.ApiModelProperty;

/**
 * @author yuchen
 * 
 * @Description 
 */
public class ImgDTO {
	
	@ApiModelProperty(value="图片路径")
	 private String imgUrl; 
	
	@ApiModelProperty(value="图片类型")
	 private String phoneType; 
	 
	 @ApiModelProperty(value="当前用户userId")
	 private String userId;
	 
	public String getImgUrl() {
		return imgUrl;
	}
	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}
	public String getPhoneType(){
		return phoneType;
	}
	public void setPhoneType(String phoneType) {
		this.phoneType = phoneType;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	public Result<MerchantImage> convertImgDTO(){
		if(StringUtil.isEmpty(imgUrl)) {
    		return ResultGenerator.genFailResult("照片url不能为空");
    	}
    	if(StringUtil.isEmpty(phoneType)) {
    		return ResultGenerator.genFailResult("照片类型不能为空");
    	}
    	MerchantImage merchantImage=new MerchantImage();
    	merchantImage.setPhotoType(phoneType);
    	merchantImage.setPicUrl(imgUrl);
    	merchantImage.setPhotoUrl(StringUtil.genRandomNum(10));
		return ResultGenerator.genSuccessResult(merchantImage);
	}
	 

}

