...
|
...
|
@@ -3,21 +3,27 @@ package com.yoho.ufo.service.impl; |
|
|
import java.util.List;
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONException;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Sets;
|
|
|
import com.yoho.core.common.utils.DateUtil;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.ufo.dal.UfoProductDetailsMapper;
|
|
|
import com.yoho.ufo.dal.UfoProductPoolDetailMapper;
|
|
|
import com.yoho.ufo.dal.UfoProductPoolMapper;
|
|
|
import com.yoho.ufo.exception.PlatformException;
|
|
|
import com.yoho.ufo.model.ChannelSkuCompareRspBo;
|
|
|
import com.yoho.ufo.model.goodsmanage.ProductDetails;
|
|
|
import com.yoho.ufo.model.goodsmanage.ProductPool;
|
|
|
import com.yoho.ufo.model.goodsmanage.ProductPoolDetails;
|
|
|
import com.yoho.ufo.service.IBusinessExportService;
|
|
|
import com.yoho.ufo.service.IProductPoolDetailsService;
|
|
|
import com.yoho.ufo.util.OrikaUtils;
|
|
|
import com.yohobuy.ufo.model.common.PageModel;
|
...
|
...
|
@@ -32,7 +38,7 @@ import com.yohobuy.ufo.model.request.productpool.ProductPoolDetailsResponseBo; |
|
|
* @date 2018/9/14
|
|
|
*/
|
|
|
@Service
|
|
|
public class ProductPoolDetailsServiceImpl implements IProductPoolDetailsService {
|
|
|
public class ProductPoolDetailsServiceImpl implements IProductPoolDetailsService, IBusinessExportService {
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(ProductPoolDetailsServiceImpl.class);
|
|
|
|
...
|
...
|
@@ -101,6 +107,32 @@ public class ProductPoolDetailsServiceImpl implements IProductPoolDetailsService |
|
|
return ufoProductPoolDetailMapper.updateProductOrderBy(requestBo.getPoolId(), requestBo.getProductId(), requestBo.getOrderBy());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Class getDataClass() {
|
|
|
return ProductDetails.class;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<? extends Object> batchExport(String confStr) {
|
|
|
try {
|
|
|
Integer poolId = null;
|
|
|
if(StringUtils.isNotEmpty(confStr)) {
|
|
|
poolId = JSONObject.parseObject(confStr, Integer.class);
|
|
|
}
|
|
|
int total = ufoProductDetailsMapper.selectAllCountByPoolId(poolId);
|
|
|
if (total == 0) {
|
|
|
throw new ServiceException(400, "没有要导出的数据");
|
|
|
}
|
|
|
return ufoProductDetailsMapper.selectAllByPoolId(poolId);
|
|
|
} catch (JSONException e) {
|
|
|
LOGGER.warn("parse confStr error: confStr {}, e {}", confStr, e);
|
|
|
throw new ServiceException(400, "传入数据格式错误");
|
|
|
} catch (com.yoho.error.exception.ServiceException e) {
|
|
|
LOGGER.warn("make url error params is confStr {}, e {}", confStr, e);
|
|
|
throw new ServiceException(e.getCode(), e.getErrorMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void checkParam(ProductPoolDetailsRequestBo requestBo) throws PlatformException{
|
|
|
Integer poolId = requestBo.getPoolId();
|
|
|
Integer productId = requestBo.getProductId();
|
...
|
...
|
|