作品集裁剪功能

This commit is contained in:
ronger 2021-01-06 16:10:17 +08:00
parent a47b062045
commit fbe909bf4e

View File

@ -12,7 +12,9 @@ import com.rymcu.forest.service.PortfolioService;
import com.rymcu.forest.service.UserService; import com.rymcu.forest.service.UserService;
import com.rymcu.forest.util.UserUtils; import com.rymcu.forest.util.UserUtils;
import com.rymcu.forest.util.Utils; import com.rymcu.forest.util.Utils;
import com.rymcu.forest.web.api.common.UploadController;
import com.rymcu.forest.web.api.exception.BaseApiException; import com.rymcu.forest.web.api.exception.BaseApiException;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -63,6 +65,10 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
@Override @Override
public Portfolio postPortfolio(Portfolio portfolio) throws BaseApiException { public Portfolio postPortfolio(Portfolio portfolio) throws BaseApiException {
User user = UserUtils.getCurrentUserByToken(); User user = UserUtils.getCurrentUserByToken();
if (StringUtils.isNotBlank(portfolio.getHeadImgType())) {
String headImgUrl = UploadController.uploadBase64File(portfolio.getHeadImgUrl(), 0);
portfolio.setHeadImgUrl(headImgUrl);
}
if (portfolio.getIdPortfolio() == null || portfolio.getIdPortfolio() == 0) { if (portfolio.getIdPortfolio() == null || portfolio.getIdPortfolio() == 0) {
portfolio.setPortfolioAuthorId(user.getIdUser()); portfolio.setPortfolioAuthorId(user.getIdUser());
portfolio.setCreatedTime(new Date()); portfolio.setCreatedTime(new Date());