admin
2019-09-27 7657068124e591b3b3345e47c90b2b0ff9f0e774
京东返利比例调整
1个文件已修改
2个文件已添加
119 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgOtherSystemGiveDTO.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgOtherSystemGiveDTOFactory.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/jd/JDUtil.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgOtherSystemGiveDTO.java
New file
@@ -0,0 +1,65 @@
package com.yeshi.fanli.dto.msg;
/**
 * 系统赠送
 *
 * @author Administrator
 *
 */
public class MsgOtherSystemGiveDTO {
    private String name;// 赠送名称
    private Integer count;// 赠送数量
    private String reason;// 赠送原因
    private Integer orderType;// 订单类型
    private String orderId;// 订单号
    private String desc;// 说明
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getCount() {
        return count;
    }
    public void setCount(Integer count) {
        this.count = count;
    }
    public String getReason() {
        return reason;
    }
    public void setReason(String reason) {
        this.reason = reason;
    }
    public Integer getOrderType() {
        return orderType;
    }
    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgOtherSystemGiveDTOFactory.java
New file
@@ -0,0 +1,23 @@
package com.yeshi.fanli.util.factory.msg;
import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
import com.yeshi.fanli.util.StringUtil;
public class MsgOtherSystemGiveDTOFactory {
    // 奖励券
    public static MsgOtherSystemGiveDTO createRewardCouponGive(int count, String desc, String name, String orderId,
            int orderType, String reason) {
        if (StringUtil.isNullOrEmpty(name))
            return null;
        MsgOtherSystemGiveDTO dto = new MsgOtherSystemGiveDTO();
        dto.setCount(count);
        dto.setDesc(desc);
        dto.setName(name);
        dto.setOrderId(orderId);
        dto.setOrderType(orderType);
        dto.setReason(reason);
        return dto;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/jd/JDUtil.java
@@ -43,9 +43,8 @@
public class JDUtil {
    public static final String TM_PHONE_URL = "https://item.m.jd.com/product/%s.html";
    public void test() {
        Map<String, String> systemParams = new HashMap<>();
        systemParams.put("method", "");
@@ -386,9 +385,9 @@
                                new BigDecimal("0.01")),
                        MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
            }
        }
        return BigDecimalUtil.getWithNoZera(money);
        // 返利比例为原来的90%
        return BigDecimalUtil.getWithNoZera(MoneyBigDecimalUtil.mul(money, new BigDecimal("0.9")));
    }
    /**
@@ -566,7 +565,7 @@
            if (engine instanceof Invocable) {
                Invocable in = (Invocable) engine;
                Object goodsId = in.invokeFunction("getGoodsId", url);
                if (goodsId!=null)
                if (goodsId != null)
                    return goodsId.toString().trim();
            }
        } catch (Exception e) {
@@ -574,10 +573,10 @@
        }
        return null;
    }
    /**
     * 查询天猫商品图片、标题
     *
     * @param auctionId
     * @return
     */
@@ -591,26 +590,26 @@
                for (int i = 0; i < elements.size(); i++) {
                    String content = elements.get(i).toString();
                    if (content.contains("window._itemOnly")) {
                        System.out.println("存在");
                        System.out.println("存在");
                        content = content.replace("<script>", "");
                        content = content.replace("</script>", "");
                        int indexOf = content.indexOf("window._isLogin");
                        content = content.substring(0,indexOf);
                        content = content.substring(0, indexOf);
                        int indexItem = content.indexOf("\"item\":");
                        content = content.substring(indexItem,content.length() - 1);
                        content = content.substring(indexItem, content.length() - 1);
                        content = content.replace("\"item\":", "var item =");
                        content = content.replace("});", "").trim();
                        content+=";function getData() {return item;}";
                        content += ";function getData() {return item;}";
                        ScriptEngineManager manager = new ScriptEngineManager();
                        ScriptEngine engine = manager.getEngineByName("javascript");
                        engine.eval(content);
                        if (engine instanceof Invocable) {
                            Invocable in = (Invocable) engine;
                            JSONObject json = JSONObject.fromObject(in.invokeFunction("getData"));
                            jdGoods = new JDGoods();
                            jdGoods.setSkuName(json.getString("skuName"));
                            JSONObject jsonImage = json.getJSONObject("image");
@@ -619,7 +618,7 @@
                                jdGoods.setPicUrl("http://m.360buyimg.com/mobilecms/s750x750_" + picUrl);
                            }
                        }
                        break;
                    }
                }