admin
2019-02-18 ed732dea219670c75c4664e522e10c90469a2b33
框架调整
7个文件已删除
14个文件已修改
2个文件已添加
961 ■■■■ 已修改文件
.classpath 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-goods/src/main/java/org/fanli/facade/goods/dto/taoke/TaoKeAppInfo.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-goods/src/main/java/org/fanli/facade/goods/service/usergoods/ShareGoodsService.java 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-goods/src/main/java/org/fanli/facade/goods/utils/RedisGoodsManager.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-goods/src/main/java/org/fanli/facade/goods/utils/taobao/TaoKeGoodsApiUtil.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-order/src/main/java/org/fanli/facade/order/entity/hongbao/HongBaoManage.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-order/src/main/java/org/fanli/facade/order/service/hongbao/HongBaoManageService.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-system/src/main/java/org/fanli/facade/system/util/taobao/TaoBaoHttpUtil.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/test/java/org/fanli/facade/user/entity/account/AccountDetails.java 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-facade-user/src/test/java/org/fanli/facade/user/entity/account/AccountMessage.java 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/job/QualityFactoryJob.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/quality/QualityFactoryServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/quality/TaoKeGoodsServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/recommend/RecommendSectionGoodsServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/taobao/TaoBaoCouponServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/taobao/TaoBaoGoodsBriefServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/usergoods/ShareGoodsServiceImpl.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/usergoods/UserGoodsStorageServiceImpl.java 118 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/usergoods/UserShareGoodsGroupServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/usergoods/UserShareGoodsRecordServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-goods/src/test/java/org/fanli/service/goods/quality/AppVersionTest.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli-service-order/src/main/java/com/fanli/service/order/dao/hongbao/HongBaoManageMapper.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.classpath
New file
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
        <attributes>
            <attribute name="owner.project.facets" value="java"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="bin"/>
</classpath>
.gitignore
New file
@@ -0,0 +1 @@
/bin/
fanli-facade-goods/src/main/java/org/fanli/facade/goods/dto/taoke/TaoKeAppInfo.java
File was deleted
fanli-facade-goods/src/main/java/org/fanli/facade/goods/service/usergoods/ShareGoodsService.java
@@ -5,6 +5,7 @@
import org.fanli.facade.goods.exception.usergoods.ShareGoodsException;
import com.yeshi.fanli.base.entity.goods.TaoBaoGoodsBrief;
import com.yeshi.fanli.base.entity.user.UserInfo;
public interface ShareGoodsService {
@@ -23,7 +24,7 @@
     * @param uid
     * @param auctionId
     */
    public UserShareGoodsHistory addShareGoodsHistory(Long uid, Long auctionId) throws ShareGoodsException;
    public UserShareGoodsHistory addShareGoodsHistory(UserInfo user, Long auctionId) throws ShareGoodsException;
    /**
     * 添加分享
@@ -33,7 +34,7 @@
     * @return
     * @throws ShareGoodsException
     */
    public UserShareGoodsHistory addShareGoodsHistory(Long uid, TaoBaoGoodsBrief goods) throws ShareGoodsException;
    public UserShareGoodsHistory addShareGoodsHistory(UserInfo user, TaoBaoGoodsBrief goods) throws ShareGoodsException;
    /**
     * 获取分享详情
@@ -43,18 +44,19 @@
     * @return
     * @throws ShareGoodsException
     */
    public UserShareGoodsHistory getShareGoodsHistoryDetail(Long uid, Long auctionId) throws ShareGoodsException;
    public UserShareGoodsHistory getShareGoodsHistoryDetail(UserInfo user, Long auctionId) throws ShareGoodsException;
    /**
     * 获取商品的分享转链链接
     * 
     * @param uid
     * @param auctionId
     * @param relationId -渠道ID
     * @return
     * @throws ShareGoodsException
     */
    public TaoBaoLink getTaoBaoLinkForShare(Long uid, Long auctionId) throws ShareGoodsException;
    public TaoBaoLink getTaoBaoLinkForShare(Long uid, Long auctionId,String relationId) throws ShareGoodsException;
    /**
     * 获取商品的购买转链链接
@@ -66,4 +68,26 @@
     */
    public TaoBaoLink getTaoBaoLinkForBuy(Long uid, Long auctionId, int pidType) throws ShareGoodsException;
    /**
     * 用会员运营ID获取商品的分享转链链接
     *
     * @param uid
     * @param auctionId
     * @param pidType
     * @return
     * @throws ShareGoodsException
     */
    public TaoBaoLink getTaoBaoLinkForBuyWithSpecial(Long uid, String specialId, Long auctionId)
            throws ShareGoodsException;
    /**
     * 通过PID设置链接
     * @param uid
     * @param auctionId
     * @param pid
     * @return
     * @throws ShareGoodsException
     */
    public TaoBaoLink getTaoBaoLink(Long uid, Long auctionId, String pid) throws ShareGoodsException ;
}
fanli-facade-goods/src/main/java/org/fanli/facade/goods/utils/RedisGoodsManager.java
@@ -120,6 +120,31 @@
    public void removeCommonString(String key) {
        removeKey(key);
    }
    /**
     * 临时存储淘宝的商品详情
     *
     * @param goods
     */
    public void saveTaoBaoGoodsBriefTemp(TaoBaoGoodsBrief goods) {
        if (goods == null)
            return;
        String key = "taobao-goods-temp-" + goods.getAuctionId();
        if (Constant.IS_OUTNET) {
            // 暂存4个小时的分享
            cacheCommonString(key, JsonUtil.getSimpleGson().toJson(goods), 60 * 60 * 4);
        }
    }
    public TaoBaoGoodsBrief getTaoBaoGoodsTemp(Long auctionId) {
        String key = "taobao-goods-temp-" + auctionId;
        String value = getCommonString(key);
        if (!StringUtil.isNullOrEmpty(value)) {
            return JsonUtil.getSimpleGson().fromJson(value, TaoBaoGoodsBrief.class);
        }
        return null;
    }
    /**
     * 将信息永久保存到Redis
fanli-facade-goods/src/main/java/org/fanli/facade/goods/utils/taobao/TaoKeGoodsApiUtil.java
@@ -1573,6 +1573,38 @@
        return goods;
    }
    /**
     * 会员运营ID转链
     *
     * @param auctionId
     * @param app
     * @return
     */
    public static TaoBaoGoodsBrief specialConvertCoupon(Long auctionId, TaoKeAppInfo app) {
        String pid = app.getPid();
        String[] sts = pid.split("_");
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.coupon.convert");
        map.put("item_id", auctionId + "");
        map.put("adzone_id", sts[3]);
        try {
            JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
            JSONObject resultJSON = json.optJSONObject("tbk_coupon_convert_response").optJSONObject("result")
                    .optJSONObject("results");
            String couponLink = resultJSON.optString("coupon_click_url");
            String itemLink = resultJSON.optString("item_url");
            TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
            goods.setAuctionUrl(itemLink);
            if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_info")))
                goods.setCouponLink(couponLink);
            return goods;
        } catch (TaoKeApiException e) {
            e.printStackTrace();
        }
        return null;
    }
}
class QuanInfo {
fanli-facade-order/src/main/java/org/fanli/facade/order/entity/hongbao/HongBaoManage.java
File was deleted
fanli-facade-order/src/main/java/org/fanli/facade/order/service/hongbao/HongBaoManageService.java
File was deleted
fanli-facade-system/src/main/java/org/fanli/facade/system/util/taobao/TaoBaoHttpUtil.java
@@ -6,7 +6,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Iterator;
@@ -30,9 +29,6 @@
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import com.yeshi.fanli.entity.address.Address;
import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
import net.sf.json.JSONArray;
@@ -104,12 +100,6 @@
    public static String get(String url, boolean isProxy) {
        HttpClient client = new HttpClient();
        GetMethod method = new GetMethod(url);
        if (isProxy) {
            Address address = ProxyUtil.getAddressProxy();
            if (address != null) {
                client.getHostConfiguration().setProxy(address.getIp(), address.getPort());
            }
        }
        try {
            client.executeMethod(method);
            return convertInputStreamToString(method.getResponseBodyAsStream());
@@ -124,12 +114,6 @@
    public static String getAsString(String url, boolean isProxy) {
        HttpClient client = new HttpClient();
        GetMethod method = new GetMethod(url);
        if (isProxy) {
            Address address = ProxyUtil.getAddressProxy();
            if (address != null) {
                client.getHostConfiguration().setProxy(address.getIp(), address.getPort());
            }
        }
        try {
            client.executeMethod(method);
            String response = method.getResponseBodyAsString();
@@ -143,59 +127,8 @@
        return "";
    }
    public static String tbGet(String url, Map<String, String> params, String tbAccount) {
        HttpClient client = new HttpClient();
        Address address = ProxyUtil.getAddressProxy();
        // if(address != null){
        // client.getHostConfiguration().setProxy(address.getIp(),
        // address.getPort());
        // }
        Iterator<String> keys = params.keySet().iterator();
        url += "?";
        while (keys.hasNext()) {
            String key = keys.next();
            try {
                url += String.format("%s=%s&", key, URLEncoder.encode(params.get(key), "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
        GetMethod method = new GetMethod(url);
        try {
            method.setRequestHeader("User-Agent",
                    "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36");
            method.setRequestHeader("Upgrade-Insecure-Requests", "1");
            method.setRequestHeader("Accept",
                    "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            method.setRequestHeader("Accept-Language", "zh-CN,zh;q=0.8");
            method.setRequestHeader("Cache-Control", "max-age=0");
            String taoBaoCookie = TaoBaoOrderUtil.getTaoBaoCookie(tbAccount);
            method.setRequestHeader("cookie", taoBaoCookie);
            // HttpConnectionManagerParams params2 = new
            // HttpConnectionManagerParams();
            // params2.setConnectionTimeout(3500);
            // client.getHttpConnectionManager().setParams(params2);
            client.executeMethod(method);
            // InputStream inputStream = method.getResponseBodyAsStream();
            // String result = convertInputStreamToString(inputStream);
            return method.getResponseBodyAsString();// convertInputStreamToString(method.getResponseBodyAsStream());
        } catch (Exception e) {
            try {
                address = ProxyUtil.getAddressProxy();
                if (address != null) {
                    client.getHostConfiguration().setProxy(address.getIp(), address.getPort());
                }
                client.executeMethod(method);
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
        return "";
    }
    public static String get(String url, Map<String, String> params, boolean proxy) {
        HttpClient client = new HttpClient();
        // client.getHostConfiguration().setProxy("192.168.1.122", 8888);
        try {
            Iterator<String> keys = params.keySet().iterator();
            url += "?";
@@ -277,8 +210,8 @@
        // result = get("http://118.178.179.189/taoke/", params, false);
        // if (StringUtil.isNullOrEmpty(result))
        //https://eco.taobao.com/router/rest
        //http://gw.api.taobao.com/router/rest
        // https://eco.taobao.com/router/rest
        // http://gw.api.taobao.com/router/rest
        String result = get("https://eco.taobao.com/router/rest", params, false);
        return result;
    }
@@ -291,10 +224,6 @@
    public static String get(String url, String charset) {
        HttpClient client = new HttpClient();
        Address address = ProxyUtil.getAddressProxy();
        if (address != null) {
            client.getHostConfiguration().setProxy(address.getIp(), address.getPort());
        }
        GetMethod method = new GetMethod(url);
        try {
            client.executeMethod(method);
@@ -331,10 +260,6 @@
    public static InputStream getImage(String url) {
        HttpClient client = new HttpClient();
        Address address = ProxyUtil.getAddressProxy();
        if (address != null) {
            client.getHostConfiguration().setProxy(address.getIp(), address.getPort());
        }
        GetMethod method = new GetMethod(url);
        try {
            method.setRequestHeader("Content-Type", "image/jpeg");
@@ -350,10 +275,6 @@
    public static String post(String url) {
        HttpClient client = new HttpClient();
        Address address = ProxyUtil.getAddressProxy();
        if (address != null) {
            client.getHostConfiguration().setProxy(address.getIp(), address.getPort());
        }
        PostMethod method = new PostMethod(url);
        method.addRequestHeader("Content-Type", "text/html;charset=UTF-8");
        method.setRequestHeader("Content-Type", "text/html;charset=UTF-8");
@@ -380,10 +301,6 @@
        }
        HttpClient client = new HttpClient();
        Address address = ProxyUtil.getAddressProxy();
        if (address != null) {
            client.getHostConfiguration().setProxy(address.getIp(), address.getPort());
        }
        PostMethod method = new PostMethod(url);
        method.addRequestHeader("Content-Type", "text/html;charset=UTF-8");
        method.setRequestHeader("Content-Type", "text/html;charset=UTF-8");
@@ -444,10 +361,6 @@
    @SuppressWarnings("deprecation")
    public static String post(String url, String entity) {
        HttpClient client = new HttpClient();
        Address address = ProxyUtil.getAddressProxy();
        if (address != null) {
            client.getHostConfiguration().setProxy(address.getIp(), address.getPort());
        }
        PostMethod method = new PostMethod(url);
        method.addRequestHeader("Content-Type", "text/html;charset=UTF-8");
        method.setRequestHeader("Content-Type", "text/html;charset=UTF-8");
@@ -465,17 +378,7 @@
    public static String postInputStream(String url, File file) throws FileNotFoundException {
        HttpClient client = new HttpClient();
        Address address = ProxyUtil.getAddressProxy();
        if (address != null) {
            client.getHostConfiguration().setProxy(address.getIp(), address.getPort());
        }
        PostMethod postMethod = new PostMethod(url);
        /*
         * postMethod.addRequestHeader("Content-Type",
         * "text/html;charset=UTF-8");
         * postMethod.setRequestHeader("Content-Type",
         * "text/html;charset=UTF-8");
         */
        Part[] parts = { new StringPart("filename", file.getName()), new StringPart("filelength", file.length() + ""),
                new StringPart("content-type", "image/jpg"), new FilePart("file", file) };
        postMethod.setRequestEntity(new MultipartRequestEntity(parts, postMethod.getParams()));
fanli-facade-user/src/test/java/org/fanli/facade/user/entity/account/AccountDetails.java
File was deleted
fanli-facade-user/src/test/java/org/fanli/facade/user/entity/account/AccountMessage.java
File was deleted
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/job/QualityFactoryJob.java
@@ -8,8 +8,6 @@
import javax.annotation.Resource;
import net.sf.json.JSONObject;
import org.fanli.facade.goods.dto.taobao.TaoBaoSearchResult;
import org.fanli.facade.goods.entity.label.Label;
import org.fanli.facade.goods.entity.quality.BoutiqueAutoRule;
@@ -17,8 +15,8 @@
import org.fanli.facade.goods.service.label.LabelService;
import org.fanli.facade.goods.service.quality.QualityFactoryService;
import org.fanli.facade.goods.service.taobao.TaoBaoGoodsUpdateService;
import org.fanli.facade.goods.utils.dataoke.TaoKeApiUtil;
import org.fanli.facade.goods.utils.taobao.TaoBaoUtil;
import org.fanli.facade.goods.utils.taobao.TaoKeGoodsApiUtil;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
@@ -30,6 +28,8 @@
import com.yeshi.fanli.base.entity.admin.AdminUser;
import com.yeshi.fanli.base.entity.goods.TaoBaoGoodsBrief;
import com.yeshi.fanli.base.log.LogHelper;
import net.sf.json.JSONObject;
/**
 * 精选商品自动入库
@@ -208,7 +208,7 @@
                filter.setPage(page);
                TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(filter);
                TaoBaoSearchResult result = TaoKeGoodsApiUtil.searchWuLiao(filter);
                LogHelper.test(title + "searchWuLiao 已爬取- " + page + "-页-");
                // 结果为空 时不再请求
@@ -389,7 +389,7 @@
                }
                // 请求官方推荐商品库
                TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, page, pageSize);
                TaoBaoSearchResult result = TaoKeGoodsApiUtil.getMaterialByMaterialId(materialId, page, pageSize);
                // 结果为空 时不再请求
                if (result == null) {
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/quality/QualityFactoryServiceImpl.java
@@ -26,8 +26,8 @@
import org.fanli.facade.goods.service.taobao.TaoBaoGoodsUpdateService;
import org.fanli.facade.goods.service.taobao.TaoBaoUnionConfigService;
import org.fanli.facade.goods.utils.RedisGoodsManager;
import org.fanli.facade.goods.utils.dataoke.TaoKeApiUtil;
import org.fanli.facade.goods.utils.taobao.TaoBaoUtil;
import org.fanli.facade.goods.utils.taobao.TaoKeGoodsApiUtil;
import org.fanli.facade.goods.vo.quality.QualityFactoryVO;
import org.yeshi.utils.StringUtil;
@@ -510,7 +510,7 @@
                    Long auctionId = goods.getAuctionId();
                    try {
                        // 获取详情
                        newGoodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId);
                        newGoodsBrief = TaoKeGoodsApiUtil.searchGoodsDetail(auctionId);
                    } catch (TaobaoGoodsDownException e1) {
                        // 商品下架 移除数据库
                        taoBaoGoodsUpdateService.deleteTaoBaoGoods(auctionId);
@@ -640,7 +640,7 @@
            goodsList.parallelStream().forEach(goods -> {
                // 获取详情
                try {
                    TaoBaoGoodsBrief taoBaoGoodsBrief = TaoKeApiUtil.searchGoodsDetail(goods.getAuctionId());
                    TaoBaoGoodsBrief taoBaoGoodsBrief = TaoKeGoodsApiUtil.searchGoodsDetail(goods.getAuctionId());
                    if (taoBaoGoodsBrief != null) {
                        listGoodsBrief.add(taoBaoGoodsBrief);
                    }
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/quality/TaoKeGoodsServiceImpl.java
@@ -17,8 +17,8 @@
import org.fanli.facade.goods.service.quality.QualityGoodsService;
import org.fanli.facade.goods.service.quality.TaoKeGoodsService;
import org.fanli.facade.goods.service.taobao.TaoBaoShopService;
import org.fanli.facade.goods.utils.dataoke.TaoKeApiUtil;
import org.fanli.facade.goods.utils.taobao.TaoBaoUtil;
import org.fanli.facade.goods.utils.taobao.TaoKeGoodsApiUtil;
import org.fanli.facade.system.service.hongbao.HongBaoManageService;
import org.springframework.cache.annotation.Cacheable;
import org.yeshi.utils.JsonUtil;
@@ -50,7 +50,7 @@
    @Override
    public List<TaoBaoGoodsBrief> listByMaterial(Integer materialId, Integer pageIndex, int pageSize) throws Exception {
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
        TaoBaoSearchResult result = TaoKeGoodsApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
        if (result == null) {
            return null;
@@ -63,7 +63,7 @@
    @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsGoods-'+#materialId +'-'+#pageIndex")
    public JSONObject getBrandsGoods(Integer materialId, int pageIndex, int pageSize) throws Exception {
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
        TaoBaoSearchResult result = TaoKeGoodsApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
        if (result == null) {
            return null;
@@ -78,7 +78,6 @@
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
        Map<String, String> map = manageService.convertMap();
        BigDecimal proportion = manageService.getFanLiRate();
@@ -134,7 +133,7 @@
    @Cacheable(value = "taoKeMaterialCache", key = "'getBrandsShops-'+#materialId +'-'+#pageIndex")
    public JSONObject getBrandsShops(Integer materialId, int pageIndex, int pageSize) throws Exception {
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
        TaoBaoSearchResult result = TaoKeGoodsApiUtil.getMaterialByMaterialId(materialId, pageIndex, pageSize);
        if (result == null) {
            return null;
@@ -190,7 +189,7 @@
    public JSONObject searchWuLiao(SearchFilter sf) {
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
        TaoBaoSearchResult result = TaoKeGoodsApiUtil.searchWuLiao(sf);
        List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
        if (result.getNavList() != null)
@@ -207,7 +206,6 @@
        int fh = sf.getHongbao();
        boolean ft = sf.isTmall();
        Map<String, String> map = manageService.convertMap();
        BigDecimal proportion = manageService.getFanLiRate();
        if (fq == 0 && fh == 0 && !ft) {
@@ -278,7 +276,7 @@
    public List<TaoBaoGoodsBrief> searchWuLiaoList(SearchFilter sf) {
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
        TaoBaoSearchResult result = TaoKeGoodsApiUtil.searchWuLiao(sf);
        if (result == null)
            return null;
@@ -398,7 +396,7 @@
        }
        // 淘宝物料接口查询
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
        TaoBaoSearchResult result = TaoKeGoodsApiUtil.searchWuLiao(sf);
        List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
        if (result.getNavList() != null)
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/recommend/RecommendSectionGoodsServiceImpl.java
@@ -16,15 +16,15 @@
import org.fanli.facade.goods.exception.taobao.TaobaoGoodsDownException;
import org.fanli.facade.goods.service.recommend.RecommendSectionGoodsService;
import org.fanli.facade.goods.service.taobao.TaoBaoGoodsBriefService;
import org.fanli.facade.goods.utils.dataoke.TaoKeApiUtil;
import org.fanli.facade.goods.utils.taobao.TaoKeGoodsApiUtil;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.orm.hibernate4.HibernateCallback;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.dubbo.config.annotation.Service;
import com.yeshi.fanli.base.Constant;
import com.yeshi.fanli.base.entity.goods.TaoBaoGoodsBrief;
import com.yeshi.fanli.goods.dao.recommend.RecommendSectionGoodsDao;
@@ -93,7 +93,7 @@
        taoBaoGoodsBrief = taoBaoGoodsBriefService.getTaoBaoByAuctionId(tbgid);
        if (taoBaoGoodsBrief == null) {
            try {
                taoBaoGoodsBrief = TaoKeApiUtil.searchGoodsDetail(Long.parseLong(tbgid));
                taoBaoGoodsBrief = TaoKeGoodsApiUtil.searchGoodsDetail(Long.parseLong(tbgid));
            } catch (TaobaoGoodsDownException e) {
                e.printStackTrace();
            }
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/taobao/TaoBaoCouponServiceImpl.java
@@ -12,7 +12,7 @@
import org.fanli.facade.goods.service.taobao.TaoBaoCouponService;
import org.fanli.facade.goods.service.taobao.TaoBaoUnionConfigService;
import org.fanli.facade.goods.utils.RedisGoodsManager;
import org.fanli.facade.goods.utils.dataoke.TaoKeApiUtil;
import org.fanli.facade.goods.utils.taobao.TaoKeGoodsApiUtil;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.StringUtil;
@@ -178,7 +178,7 @@
            return list;
        }
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(3756, page, 20);// searchCouple(null,
        TaoBaoSearchResult result = TaoKeGoodsApiUtil.getMaterialByMaterialId(3756, page, 20);// searchCouple(null,
                                                                                            // null,
                                                                                            // page,
                                                                                            // 20);
@@ -198,7 +198,7 @@
    @Cacheable(value = "taoBaoCouponCache", key = "'getTaoBaoCouponListByMeterialId'+#materialId+'-'+#page")
    @Override
    public List<TaoBaoGoodsBrief> getTaoBaoCouponListByMeterialId(int materialId, int page) {
        TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(materialId, page, 20);
        TaoBaoSearchResult result = TaoKeGoodsApiUtil.getMaterialByMaterialId(materialId, page, 20);
        if (result != null)
            return result.getTaoBaoGoodsBriefs();
        return null;
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/taobao/TaoBaoGoodsBriefServiceImpl.java
@@ -8,7 +8,6 @@
import javax.annotation.Resource;
import javax.transaction.Transactional;
import org.fanli.facade.goods.dto.taoke.TaoKeAppInfo;
import org.fanli.facade.goods.entity.clazz.GoodsClass;
import org.fanli.facade.goods.entity.recommend.RecommendSection;
import org.fanli.facade.goods.entity.recommend.RecommendSectionGoods;
@@ -26,8 +25,10 @@
import org.fanli.facade.goods.service.taobao.TaoBaoCouponService;
import org.fanli.facade.goods.service.taobao.TaoBaoGoodsBriefService;
import org.fanli.facade.goods.service.taobao.TaoBaoUnionConfigService;
import org.fanli.facade.goods.utils.dataoke.TaoKeApiUtil;
import org.fanli.facade.goods.utils.taobao.TaoBaoUtil;
import org.fanli.facade.goods.utils.taobao.TaoKeGoodsApiUtil;
import org.fanli.facade.system.dto.taobao.TaoKeAppInfo;
import org.fanli.facade.system.service.hongbao.HongBaoManageService;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
@@ -228,7 +229,7 @@
        SearchFilter filter = new SearchFilter();
        filter.setKey("https://item.taobao.com/item.htm?id=" + taoBaoGoodsBrief.getAuctionId());
        TaoBaoGoodsBrief tb = TaoKeApiUtil.searchGoodsDetail(taoBaoGoodsBrief.getAuctionId());
        TaoBaoGoodsBrief tb = TaoKeGoodsApiUtil.searchGoodsDetail(taoBaoGoodsBrief.getAuctionId());
        if (tb == null) {
            return;
        }
@@ -433,7 +434,7 @@
        taoKeAppInfo.setPid(tbPid.getPid());
        TaoBaoGoodsBrief taoBaoGoodsBrief = null;
        try {
            taoBaoGoodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId, taoKeAppInfo);
            taoBaoGoodsBrief = TaoKeGoodsApiUtil.searchGoodsDetail(auctionId, taoKeAppInfo);
        } catch (TaobaoGoodsDownException e) {
            e.printStackTrace();
        }
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/usergoods/ShareGoodsServiceImpl.java
@@ -11,7 +11,6 @@
import javax.annotation.Resource;
import org.fanli.facade.goods.dto.taoke.TaoKeAppInfo;
import org.fanli.facade.goods.entity.taobao.TBPid;
import org.fanli.facade.goods.entity.taobao.TaoBaoLink;
import org.fanli.facade.goods.entity.taobao.TaoBaoUnionConfig;
@@ -25,14 +24,13 @@
import org.fanli.facade.goods.service.usergoods.UserShareGoodsRecordService;
import org.fanli.facade.goods.utils.ImageUtil;
import org.fanli.facade.goods.utils.RedisGoodsManager;
import org.fanli.facade.goods.utils.dataoke.TaoKeApiUtil;
import org.fanli.facade.goods.utils.taobao.TaoBaoUtil;
import org.fanli.facade.order.service.hongbao.HongBaoManageService;
import org.fanli.facade.goods.utils.taobao.TaoKeGoodsApiUtil;
import org.fanli.facade.system.dto.taobao.TaoKeAppInfo;
import org.fanli.facade.system.service.common.ConfigService;
import org.fanli.facade.system.service.hongbao.HongBaoManageService;
import org.fanli.facade.user.service.UserAccountService;
import org.fanli.facade.user.service.UserInfoService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.stereotype.Service;
import org.yeshi.utils.FileUtil;
import org.yeshi.utils.HttpUtil;
import org.yeshi.utils.JsonUtil;
@@ -51,7 +49,7 @@
import com.yeshi.fanli.goods.dao.usergoods.PidUserMapper;
import com.yeshi.fanli.goods.dao.usergoods.UserShareGoodsHistoryMapper;
@Service(version = "1.0.0")
@Service
public class ShareGoodsServiceImpl implements ShareGoodsService {
    @Resource
@@ -62,12 +60,6 @@
    @Resource
    private UserShareGoodsHistoryMapper userShareGoodsHistoryMapper;
    @Resource
    private HongBaoManageMapper hongBaoManageMapper;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private RedisGoodsManager redisManager;
@@ -105,8 +97,8 @@
    }
    @Override
    public UserShareGoodsHistory addShareGoodsHistory(Long uid, Long auctionId) throws ShareGoodsException {
        TBPid tbPid = tbPidService.getTBPid(uid, PidUser.TYPE_SHARE_GOODS);
    public UserShareGoodsHistory addShareGoodsHistory(UserInfo user, Long auctionId) throws ShareGoodsException {
        TBPid tbPid = tbPidService.getTBPid(user.getId(), PidUser.TYPE_SHARE_GOODS);
        if (tbPid == null) {
            throw new ShareGoodsException(1, "获取PID失败");
        }
@@ -122,7 +114,7 @@
        TaoBaoGoodsBrief goods = null;
        long startTime = System.currentTimeMillis();
        try {
            goods = TaoKeApiUtil.searchGoodsDetail(auctionId, info);
            goods = TaoKeGoodsApiUtil.searchGoodsDetail(auctionId, info);
        } catch (TaobaoGoodsDownException e) {
            throw new ShareGoodsException(3, "商品已下架");
        } finally {
@@ -141,11 +133,11 @@
            goods.setCouponLink(taoBaoLink.getCouponLink());
            goods.setAuctionUrl(taoBaoLink.getClickUrl());
        }
        return addShareGoodsHistory(uid, goods);
        return addShareGoodsHistory(user, goods);
    }
    @Override
    public UserShareGoodsHistory addShareGoodsHistory(Long uid, TaoBaoGoodsBrief goods) throws ShareGoodsException {
    public UserShareGoodsHistory addShareGoodsHistory(UserInfo user, TaoBaoGoodsBrief goods) throws ShareGoodsException {
        if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && StringUtil.isNullOrEmpty(goods.getAuctionUrl())) {
            throw new ShareGoodsException(10, "转链失败");
        }
@@ -161,12 +153,13 @@
        tbLink.setCouponLink(goods.getCouponLink());
        if (!StringUtil.isNullOrEmpty(tbLink.getCouponLink())) {// 通过立即推广方式获取淘口令成功
            String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), tbLink.getCouponLink());
            String quanToken = TaoKeGoodsApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(),
                    tbLink.getCouponLink());
            if (!StringUtil.isNullOrEmpty(quanToken)) {
                tbLink.setTaoToken(quanToken);
            }
        } else if (!StringUtil.isNullOrEmpty(tbLink.getClickUrl())) {
            String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), tbLink.getClickUrl());
            String quanToken = TaoKeGoodsApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), tbLink.getClickUrl());
            if (!StringUtil.isNullOrEmpty(quanToken)) {
                tbLink.setTaoToken(quanToken);
            }
@@ -187,21 +180,21 @@
            imgList = new ArrayList<>();
        }
        history.setPictures(JsonUtil.getGson().toJson(imgList));
        history.setUser(new UserInfo(uid));
        history.setUser(user);
        history.setPostPicture(goods.getPictUrl());
        // 生成二维码信息
        // 包含用户ID与商品ID
        // 新版商品分享
        String url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
                Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
                Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(user.getId() + "", Constant.UIDAESKEY),
                goods.getAuctionId() + "");
        String shortLink = HttpUtil.getShortLink(url);
        if (!StringUtil.isNullOrEmpty(shortLink)) {
            url = shortLink;
        }
        String destPath = FileUtil.getCacheDir() + "/ercode_" + uid + "_" + goods.getAuctionId() + ".jpg";
        String shareImgPath = FileUtil.getCacheDir() + "/share_" + uid + "_" + goods.getAuctionId() + ".png";
        String destPath = FileUtil.getCacheDir() + "/ercode_" + user.getId() + "_" + goods.getAuctionId() + ".jpg";
        String shareImgPath = FileUtil.getCacheDir() + "/share_" + user.getId() + "_" + goods.getAuctionId() + ".png";
        InputStream erCodeInputStream = null;
        try {
@@ -215,13 +208,12 @@
            // throw new ShareGoodsException(4, "生成二维码失败");
            // }
            // 获取到用户的头像
            UserInfo user = userInfoService.selectByPKey(uid);
            InputStream portrait = null;
            if (!StringUtil.isNullOrEmpty(user.getPortrait())) {
                try {
                    portrait = HttpUtil.downLoadImg(user.getPortrait());
                } catch (HttpException e) {
                    String portraitUrl = userAccountService.repairPortrait(uid);
                    String portraitUrl = userAccountService.repairPortrait(user.getId());
                    if (StringUtil.isNullOrEmpty(portraitUrl))
                        throw new ShareGoodsException(11, "获取头像出错");
                    else {
@@ -271,7 +263,7 @@
            }
            FileUploadResult shareImgResult = COSManager.getInstance().uploadInputStream(shareImgInputStream,
                    "sharegoods/share_" + uid + "_" + goods.getAuctionId() + "_" + System.currentTimeMillis() + ".png");
                    "sharegoods/share_" + user.getId() + "_" + goods.getAuctionId() + "_" + System.currentTimeMillis() + ".png");
            if (shareImgResult == null || StringUtil.isNullOrEmpty(shareImgResult.getUrl())) {
                throw new ShareGoodsException(6, "分享图片保存失败");
@@ -282,7 +274,7 @@
            // 查询之前是否存在,存在就替换掉
            UserShareGoodsHistory old = userShareGoodsHistoryMapper.selectByUidAndAuctionId(uid, history.getGoodsId());
            UserShareGoodsHistory old = userShareGoodsHistoryMapper.selectByUidAndAuctionId(user.getId(), history.getGoodsId());
            if (old != null) {
                history.setId(old.getId());
                userShareGoodsHistoryMapper.updateByPrimaryKeySelective(history);
@@ -304,15 +296,15 @@
    }
    @Override
    public UserShareGoodsHistory getShareGoodsHistoryDetail(Long uid, Long auctionId) throws ShareGoodsException {
        UserShareGoodsHistory userShareGoodsHistory = userShareGoodsHistoryMapper.selectByUidAndAuctionId(uid,
    public UserShareGoodsHistory getShareGoodsHistoryDetail(UserInfo user, Long auctionId) throws ShareGoodsException {
        UserShareGoodsHistory userShareGoodsHistory = userShareGoodsHistoryMapper.selectByUidAndAuctionId(user.getId(),
                auctionId);
        if (userShareGoodsHistory == null)
            throw new ShareGoodsException(10, "分享不存在");
        // 淘口令不存在
        if (StringUtil.isNullOrEmpty(userShareGoodsHistory.getTkCode())) {
            TBPid tbPid = tbPidService.getTBPid(uid, PidUser.TYPE_SHARE_GOODS);
            TBPid tbPid = tbPidService.getTBPid(user.getId(), PidUser.TYPE_SHARE_GOODS);
            if (tbPid == null)
                throw new ShareGoodsException(1, "获取PID失败");
@@ -322,7 +314,7 @@
            if (tbLink == null) {
                TaoBaoGoodsBrief goods = null;
                try {
                    goods = TaoKeApiUtil.searchGoodsDetail(auctionId);
                    goods = TaoKeGoodsApiUtil.searchGoodsDetail(auctionId);
                } catch (TaobaoGoodsDownException e) {
                    throw new ShareGoodsException(4, "商品已下架");
                }
@@ -387,7 +379,7 @@
        }
        TaoBaoGoodsBrief goods = null;
        try {
            goods = TaoKeApiUtil.searchGoodsDetail(auctionId, info);
            goods = TaoKeGoodsApiUtil.searchGoodsDetail(auctionId, info);
        } catch (TaobaoGoodsDownException e) {
            throw new ShareGoodsException(4, "商品已下架");
        } finally {
@@ -423,12 +415,13 @@
        tbLink.setCouponLink(goods.getCouponLink());
        if (!StringUtil.isNullOrEmpty(tbLink.getCouponLink())) {// 通过立即推广方式获取淘口令成功
            String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), tbLink.getCouponLink());
            String quanToken = TaoKeGoodsApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(),
                    tbLink.getCouponLink());
            if (!StringUtil.isNullOrEmpty(quanToken)) {
                tbLink.setTaoToken(quanToken);
            }
        } else if (!StringUtil.isNullOrEmpty(tbLink.getClickUrl())) {
            String quanToken = TaoKeApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), tbLink.getClickUrl());
            String quanToken = TaoKeGoodsApiUtil.getTKToken(goods.getPictUrl(), goods.getTitle(), tbLink.getClickUrl());
            if (!StringUtil.isNullOrEmpty(quanToken)) {
                tbLink.setTaoToken(quanToken);
            }
@@ -461,6 +454,7 @@
        return getTaoBaoLink(uid, auctionId, tbPid.getPid());
    }
    @Override
    public TaoBaoLink getTaoBaoLink(Long uid, Long auctionId, String pid) throws ShareGoodsException {
        if (uid == null || uid <= 0) {
@@ -486,10 +480,11 @@
        info.setPid(pid);
        TaoBaoGoodsBrief goods = null;
        try {
            goods = TaoKeApiUtil.searchGoodsDetailForConvert(auctionId, info);
            goods = TaoKeGoodsApiUtil.searchGoodsDetailForConvert(auctionId, info);
        } catch (TaobaoGoodsDownException e) {
            throw new ShareGoodsException(4, "商品已下架");
        } finally {
        }
        if (goods == null) {
            throw new ShareGoodsException(5, "获取商品详情失败");
@@ -523,8 +518,22 @@
            throw new ShareGoodsException(2, "商品ID不能为空");
        }
        return getTaoBaoLink(uid, auctionId, Constant.TAOBAO_SPECIAL_PID_DEFAULT);
    }
        TaoKeAppInfo app = new TaoKeAppInfo();
        app.setAppKey(Constant.TAOBAO_AUTH_APPKEY);
        app.setAppSecret(Constant.TAOBAO_AUTH_APPSECRET);
        app.setPid(Constant.TAOBAO_SPECIAL_PID_DEFAULT);
        TaoBaoGoodsBrief goods = TaoKeGoodsApiUtil.specialConvertCoupon(auctionId, app);
        if (goods == null) {
            throw new ShareGoodsException(1, "");
        }
        TaoBaoLink taoBaoLink = new TaoBaoLink();
        taoBaoLink.setAuctionId(auctionId);
        taoBaoLink.setClickUrl(goods.getAuctionUrl());
        taoBaoLink.setCouponLink(goods.getCouponLink());
        taoBaoLink.setGoods(goods);
        return taoBaoLink;
    }
}
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/usergoods/UserGoodsStorageServiceImpl.java
@@ -9,59 +9,57 @@
import javax.annotation.Resource;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.fanli.facade.goods.entity.usergoods.UserGoodsStorage;
import org.fanli.facade.goods.entity.usergoods.UserShareGoodsRecord.ShareSourceTypeEnum;
import org.fanli.facade.goods.exception.taobao.CommonGoodsException;
import org.fanli.facade.goods.exception.taobao.TaobaoGoodsDownException;
import org.fanli.facade.goods.exception.taoke.TaoKeApiException;
import org.fanli.facade.goods.exception.usergoods.UserGoodsStorageException;
import org.fanli.facade.goods.exception.usergoods.UserShareGoodsRecordException;
import org.fanli.facade.goods.service.taobao.CommonGoodsService;
import org.fanli.facade.goods.service.usergoods.UserGoodsStorageService;
import org.fanli.facade.goods.service.usergoods.UserShareGoodsRecordService;
import org.fanli.facade.goods.utils.RedisGoodsManager;
import org.fanli.facade.goods.utils.dataoke.TaoKeApiUtil;
import org.fanli.facade.goods.utils.factory.CommonGoodsFactory;
import org.fanli.facade.goods.utils.taobao.TaoBaoUtil;
import org.fanli.facade.order.service.hongbao.HongBaoManageService;
import org.fanli.facade.goods.utils.taobao.TaoKeGoodsApiUtil;
import org.fanli.facade.system.exception.TaoKeApiException;
import org.fanli.facade.system.service.common.ConfigService;
import org.fanli.facade.system.service.hongbao.HongBaoManageService;
import org.springframework.core.task.TaskExecutor;
import com.alibaba.dubbo.config.annotation.Service;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.MoneyBigDecimalUtil;
import com.alibaba.dubbo.config.annotation.Service;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.base.entity.goods.CommonGoods;
import com.yeshi.fanli.base.entity.goods.TaoBaoGoodsBrief;
import com.yeshi.fanli.goods.dao.usergoods.UserGoodsStorageMapper;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Service(version = "1.0.0")
public class UserGoodsStorageServiceImpl implements UserGoodsStorageService {
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource
    private RedisGoodsManager redisManager;
    @Resource
    private ConfigService configService;
    @Resource
    private CommonGoodsService commonGoodsService;
    @Resource
    private HongBaoManageService manageService;
    @Resource
    private UserGoodsStorageMapper userGoodsStorageMapper;
    @Resource
    private UserShareGoodsRecordService userShareGoodsRecordService;
    @Resource
    private HongBaoManageService hongBaoManageService;
@@ -105,9 +103,10 @@
    public int deleteBatchByPrimaryKey(List<Long> list) {
        return userGoodsStorageMapper.deleteBatchByPrimaryKey(list);
    }
    /**
     * 根据主键 、uid 批量删除
     *
     * @param list
     * @return
     */
@@ -120,7 +119,7 @@
    public List<UserGoodsStorage> listQueryByUid(long start, int count, Long uid) {
        return userGoodsStorageMapper.listQueryByUid(start, count, uid);
    }
    @Override
    public UserGoodsStorage getByUidAndAuctionId(Long uid, Long auctionId) {
        return userGoodsStorageMapper.getByUidAndAuctionId(uid, auctionId);
@@ -130,7 +129,7 @@
    public long countQueryByUid(Long uid) {
        return userGoodsStorageMapper.countQueryByUid(uid);
    }
    @Override
    public void updateShareState(Long shareId) {
        userGoodsStorageMapper.updateShareState(shareId);
@@ -185,7 +184,8 @@
                userGoodsStorageMapper.updateByPrimaryKeySelective(goodsStorage);
            } else {
                goodsStorage = new UserGoodsStorage();
                goodsStorage.setUid(uid);;
                goodsStorage.setUid(uid);
                ;
                goodsStorage.setState(UserGoodsStorage.STATE_NORMAL);
                goodsStorage.setCommonGoods(commonGoods);
                goodsStorage.setCreateTime(new Date());
@@ -196,18 +196,16 @@
        }
    }
    @Override
    public JSONArray getMyStorage(int page, int pageSize, Long uid) throws UserGoodsStorageException {
        JSONArray  array = new JSONArray();
        List<UserGoodsStorage> listStorage = listQueryByUid(page , pageSize, uid);
        JSONArray array = new JSONArray();
        List<UserGoodsStorage> listStorage = listQueryByUid(page, pageSize, uid);
        if (listStorage == null || listStorage.size() == 0) {
            return array;
        }
        List<Long> listGid = new ArrayList<Long>();
        for (UserGoodsStorage userGoodsStorage : listStorage) {
            CommonGoods commonGoods = userGoodsStorage.getCommonGoods();
@@ -216,11 +214,11 @@
            }
            listGid.add(commonGoods.getGoodsId());
        }
        // API网络接口验证是否在售
        List<TaoBaoGoodsBrief> listTaoKeGoods = null;
        try {
            listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
            listTaoKeGoods = TaoKeGoodsApiUtil.getBatchGoodsInfo(listGid);
        } catch (TaoKeApiException e) {
            e.printStackTrace();
        } catch (TaobaoGoodsDownException e) {
@@ -228,21 +226,21 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        BigDecimal  rate = manageService.getFanLiRate();
        BigDecimal rate = hongBaoManageService.getFanLiRate();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
        for (UserGoodsStorage userGoodsStorage : listStorage) {
            CommonGoods commonGoods = userGoodsStorage.getCommonGoods();
            if (commonGoods == null) {
                continue;
            }
            if (listTaoKeGoods != null && listTaoKeGoods.size() > 0 ) {
                int state = 1;  // 默认停售
            if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) {
                int state = 1; // 默认停售
                Long goodsId = commonGoods.getGoodsId();
                for (TaoBaoGoodsBrief taoKeGoods: listTaoKeGoods) {
                for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) {
                    Long auctionId = taoKeGoods.getAuctionId();
                    if (goodsId == auctionId || goodsId.equals(auctionId)) {
                        state = 0; // 在售
@@ -251,9 +249,9 @@
                }
                commonGoods.setState(state);
            }
            TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(commonGoods);
            // 判断是否已分享
            Integer storageState = userGoodsStorage.getState();
            if (storageState != null && storageState == UserGoodsStorage.STATE_SHARED) {
@@ -262,19 +260,18 @@
                    goodsBrief.setState(2); // 已分享状态 优先显示已下架
                }
            }
            String json = gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, rate.toString(), null));
            JSONObject dataObject = new JSONObject();
            dataObject.put("storageId", userGoodsStorage.getId());
            dataObject.put("goods", json);
            array.add(dataObject);
        }
        return array;
    }
    @Override
    public boolean isExistStorage(Long uid, Long auctionId) {
        boolean state = false;
@@ -286,21 +283,20 @@
        }
        return state;
    }
    @Override
    public JSONObject shareGoods(Long uid, List<Long> listStorageID)
    public JSONObject shareGoods(Long uid, List<Long> listStorageID)
            throws UserGoodsStorageException, UserShareGoodsRecordException {
        List<UserGoodsStorage> listStorage = userGoodsStorageMapper.listQueryByIds(listStorageID);
        if (listStorage == null || listStorage.size() == 0) {
            throw new UserGoodsStorageException(1, "选品库商品不存在");
        }
        List<UserGoodsStorage> listResult = new ArrayList<UserGoodsStorage>();
        // 还原顺序 用于制图
        for (Long sid: listStorageID) {
            for (UserGoodsStorage torage: listStorage) {
        for (Long sid : listStorageID) {
            for (UserGoodsStorage torage : listStorage) {
                Long id = torage.getId();
                if (sid == id || sid.equals(id)) {
                    listResult.add(torage);
@@ -308,27 +304,25 @@
                }
            }
        }
        BigDecimal totalMoney = new BigDecimal(0.00);
        List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
        String rateStr = hongBaoManageService.get("hongbao_goods_proportion");
        for (UserGoodsStorage userGoodsStorage: listResult) {
        BigDecimal rate = hongBaoManageService.getFanLiRate();
        for (UserGoodsStorage userGoodsStorage : listResult) {
            CommonGoods commonGoods = userGoodsStorage.getCommonGoods();
            TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(commonGoods);
            listGoodsBrief.add(goodsBrief);
            BigDecimal money = TaoBaoUtil.getGoodsHongBaoMoney(goodsBrief, new BigDecimal(rateStr));
            BigDecimal money = TaoBaoUtil.getGoodsHongBaoMoney(goodsBrief, rate);
            totalMoney = MoneyBigDecimalUtil.add(totalMoney, money);
        }
        String revenue = listGoodsBrief.size() + "个商品预估分享奖金:¥"+totalMoney;
        Map<String,Object> map = userShareGoodsRecordService.save(uid, ShareSourceTypeEnum.storage,
                null, listGoodsBrief);
        String revenue = listGoodsBrief.size() + "个商品预估分享奖金:¥" + totalMoney;
        Map<String, Object> map = userShareGoodsRecordService.save(uid, ShareSourceTypeEnum.storage, null,
                listGoodsBrief);
        JSONObject data = new JSONObject();
        data.put("revenue", revenue);
        data.put("shareId", map.get("shareId"));
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/usergoods/UserShareGoodsGroupServiceImpl.java
@@ -12,11 +12,11 @@
import org.fanli.facade.goods.service.taobao.CommonGoodsService;
import org.fanli.facade.goods.service.usergoods.UserShareGoodsGroupService;
import org.fanli.facade.order.entity.hongbao.HongBao;
import org.fanli.facade.order.service.hongbao.HongBaoManageService;
import com.alibaba.dubbo.config.annotation.Service;
import org.fanli.facade.system.service.hongbao.HongBaoManageService;
import org.yeshi.utils.DateUtil;
import org.yeshi.utils.MoneyBigDecimalUtil;
import com.alibaba.dubbo.config.annotation.Service;
import com.yeshi.fanli.goods.dao.usergoods.UserShareGoodsGroupMapper;
@Service(version = "1.0.0")
fanli-service-goods/src/main/java/com/yeshi/fanli/goods/service/impl/usergoods/UserShareGoodsRecordServiceImpl.java
@@ -17,7 +17,6 @@
import org.fanli.facade.goods.entity.usergoods.UserShareGoodsRecord.ShareSourceTypeEnum;
import org.fanli.facade.goods.exception.taobao.CommonGoodsException;
import org.fanli.facade.goods.exception.taobao.TaobaoGoodsDownException;
import org.fanli.facade.goods.exception.taoke.TaoKeApiException;
import org.fanli.facade.goods.exception.usergoods.UserShareGoodsRecordException;
import org.fanli.facade.goods.service.taobao.CommonGoodsService;
import org.fanli.facade.goods.service.usergoods.UserGoodsStorageService;
@@ -25,11 +24,12 @@
import org.fanli.facade.goods.service.usergoods.UserShareGoodsRecordService;
import org.fanli.facade.goods.utils.ImageUtil;
import org.fanli.facade.goods.utils.RedisGoodsManager;
import org.fanli.facade.goods.utils.dataoke.TaoKeApiUtil;
import org.fanli.facade.goods.utils.factory.CommonGoodsFactory;
import org.fanli.facade.goods.utils.taobao.TaoBaoUtil;
import org.fanli.facade.order.service.hongbao.HongBaoManageService;
import org.fanli.facade.goods.utils.taobao.TaoKeGoodsApiUtil;
import org.fanli.facade.system.exception.TaoKeApiException;
import org.fanli.facade.system.service.common.ConfigService;
import org.fanli.facade.system.service.hongbao.HongBaoManageService;
import org.fanli.facade.user.service.UserAccountService;
import org.fanli.facade.user.service.UserInfoService;
import org.springframework.core.task.TaskExecutor;
@@ -502,7 +502,7 @@
        // API网络接口验证是否在售
        List<TaoBaoGoodsBrief> listTaoKeGoods = null;
        try {
            listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
            listTaoKeGoods = TaoKeGoodsApiUtil.getBatchGoodsInfo(listGid);
        } catch (TaoKeApiException e) {
            e.printStackTrace();
        } catch (TaobaoGoodsDownException e) {
@@ -587,7 +587,7 @@
            // API网络接口验证是否在售
            List<TaoBaoGoodsBrief> listTaoKeGoods = null;
            try {
                listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
                listTaoKeGoods = TaoKeGoodsApiUtil.getBatchGoodsInfo(listGid);
            } catch (TaoKeApiException e) {
                e.printStackTrace();
            } catch (TaobaoGoodsDownException e) {
fanli-service-goods/src/test/java/org/fanli/service/goods/quality/AppVersionTest.java
File was deleted
fanli-service-order/src/main/java/com/fanli/service/order/dao/hongbao/HongBaoManageMapper.java
File was deleted