yujian
2019-10-16 a3e1aec60d2f886b8c48966c889b567719d0c5ea
Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
31个文件已修改
10个文件已添加
1590 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ElmeController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/push/DeviceTokenVIVOMapper.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSale.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/push/DeviceTokenVIVO.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/taobao/dataoke/DaTaoKeDetailV2.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/order/jd/UpdateJDOrderJob.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/log/PushLogHelper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2Mapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/push/DeviceTokenVIVOMapper.xml 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoOrderServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceTokenVIVOServiceImpl.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/VIVOPushServiceImpl.java 236 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/HongBaoOrderService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/HongBaoV2Service.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/DeviceTokenVIVOService.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/VIVOPushService.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/elme/ElmeOrderUtil.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/push/VIVOPushUtil.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/src/main/java/org/yeshi/utils/entity/wx/WXAPPInfo.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/src/main/java/org/yeshi/utils/entity/wx/WXPlaceOrderParams.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/src/main/java/org/yeshi/utils/exception/WXPlaceOrderParamsException.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/src/main/java/org/yeshi/utils/wx/WXPayUtil.java 106 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ElmeController.java
@@ -48,7 +48,7 @@
    @RequestMapping("getOrderList")
    public void getOrderList(AcceptData acceptData, Long uid, int page, String callback, PrintWriter out) {
        List<ElmeUserOrderVO> voList = new ArrayList<>();
        List<ElmeHongBaoOrderMap> list = elmeHongBaoOrderMapService.listByHongBaoUid(uid, page, Constant.PAGE_SIZE);
        List<ElmeHongBaoOrderMap> list = elmeHongBaoOrderMapService.listByHongBaoUid(uid, page, 3);
        if (list != null)
            for (ElmeHongBaoOrderMap map : list)
                voList.add(create(map));
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java
@@ -44,6 +44,7 @@
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.factory.MonitorFactory;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import net.sf.json.JSONObject;
@@ -179,7 +180,7 @@
        ClientTBPid clientTBPid = null;
        String dpid = null;
        if (goods.getMaterialLibType() != null && goods.getMaterialLibType() > 0) {
        if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) {
            dpid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT;
        } else {
            dpid = TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID;
@@ -195,7 +196,7 @@
        boolean specialConvert = false;
        if (goods.getMaterialLibType() != null && goods.getMaterialLibType() == 1) {
        if (TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) {
            specialConvert = true;
        } else
            specialConvert = false;
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java
@@ -18,6 +18,7 @@
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.push.DeviceActive;
import com.yeshi.fanli.entity.push.DeviceTokenOPPO;
import com.yeshi.fanli.entity.push.DeviceTokenVIVO;
import com.yeshi.fanli.entity.push.PushGoods;
import com.yeshi.fanli.entity.push.PushGoodsGroup;
import com.yeshi.fanli.entity.push.PushGoodsRecord;
@@ -29,6 +30,7 @@
import com.yeshi.fanli.service.inter.push.DeviceActiveService;
import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
import com.yeshi.fanli.service.inter.push.DeviceTokenOPPOService;
import com.yeshi.fanli.service.inter.push.DeviceTokenVIVOService;
import com.yeshi.fanli.service.inter.push.IOSPushService;
import com.yeshi.fanli.service.inter.push.PushGoodsGroupService;
import com.yeshi.fanli.service.inter.push.PushGoodsRecordService;
@@ -81,9 +83,12 @@
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource
    private DeviceTokenOPPOService deviceTokenOPPOService;
    @Resource
    private DeviceTokenVIVOService deviceTokenVIVOService;
    @RequestMapping(value = "callback", method = RequestMethod.POST)
    public void callback(AcceptData acceptData, String pushId, PrintWriter out) {
@@ -341,8 +346,6 @@
        }
    }
    @RequestMapping("registerOppo")
    public void registerOppo(AcceptData acceptData, String registerId, Long uid, PrintWriter out) {
        DeviceActive deviceActive = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
@@ -356,4 +359,17 @@
        out.print(JsonUtil.loadTrueResult(""));
    }
    @RequestMapping("registerVivo")
    public void registerVivo(AcceptData acceptData, String regId, Long uid, PrintWriter out) {
        DeviceActive deviceActive = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
        if (deviceActive != null) {
            DeviceTokenVIVO vivo = new DeviceTokenVIVO();
            vivo.setDeviceActiveId(deviceActive.getId());
            vivo.setRegisterId(regId);
            vivo.setUid(uid);
            deviceTokenVIVOService.addDeviceTokenVIVO(vivo);
        }
        out.print(JsonUtil.loadTrueResult(""));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -618,7 +618,7 @@
        // 获取淘客参数
        ClientTBPid clientTBPid = null;
        if (simpleGoods.getMaterialLibType() != null && simpleGoods.getMaterialLibType() == 1) {
        if (TaoBaoUtil.isSpecialGoods(simpleGoods.getMaterialLibType())) {
            String pid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT;
            clientTBPid = new ClientTBPid(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
                    pid.split("_")[2], pid.split("_")[3]);
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java
@@ -47,6 +47,7 @@
import com.yeshi.fanli.service.inter.push.DeviceActiveService;
import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
import com.yeshi.fanli.service.inter.push.DeviceTokenOPPOService;
import com.yeshi.fanli.service.inter.push.DeviceTokenVIVOService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
@@ -129,6 +130,9 @@
    @Resource
    private DeviceTokenOPPOService deviceTokenOPPOService;
    @Resource
    private DeviceTokenVIVOService deviceTokenVIVOService;
    @Resource
    private TaoBaoUnionConfigService taoBaoUnionConfigService;
@@ -262,10 +266,11 @@
                            platformType = 2;
                        }
                        userSystemCouponService.copyLotteryPrize(uuser.getId(), platformType, acceptData.getDevice());
                        // 绑定oppo推送
                        // 绑定oppo,vivo推送
                        DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
                        if (active != null) {
                            deviceTokenOPPOService.bindUid(uuser.getId(), active.getId());
                            deviceTokenVIVOService.bindUid(uuser.getId(), active.getId());
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
@@ -1149,6 +1154,8 @@
            if (deviceActive != null) {
                // 解绑OPPO推送的用户绑定
                deviceTokenOPPOService.unBindUid(uid, deviceActive.getId());
                // 解绑VIVO推送的用户绑定
                deviceTokenVIVOService.unBindUid(uid, deviceActive.getId());
            }
        }
        out.print(JsonUtil.loadTrueResult(""));
@@ -1234,6 +1241,7 @@
                        DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
                        if (active != null) {
                            deviceTokenOPPOService.bindUid(uuser.getId(), active.getId());
                            deviceTokenVIVOService.bindUid(uuser.getId(), active.getId());
                        }
                    }
                });
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -25,6 +25,7 @@
import com.yeshi.fanli.service.inter.push.DeviceActiveService;
import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
import com.yeshi.fanli.service.inter.push.DeviceTokenOPPOService;
import com.yeshi.fanli.service.inter.push.DeviceTokenVIVOService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.user.BindRemindService;
@@ -94,6 +95,9 @@
    private DeviceTokenOPPOService deviceTokenOPPOService;
    @Resource
    private DeviceTokenVIVOService deviceTokenVIVOService;
    @Resource
    private TaoBaoUnionConfigService taoBaoUnionConfigService;
    @Resource
@@ -128,11 +132,9 @@
    @Resource
    private DeviceActiveService deviceActiveService;
    @Resource
    private BindRemindService bindRemindService;
    /**
     * 新版登录 V1.5.3
@@ -147,7 +149,7 @@
     * @param out
     */
    @RequestMapping(value = "login", method = RequestMethod.POST)
    public void login(AcceptData acceptData, int loginType, String vcode, String phone, String code,
    public void login(AcceptData acceptData, int loginType, String vcode, String phone, String code,
            HttpServletRequest request, PrintWriter out) {
        try {
            BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
@@ -194,11 +196,12 @@
                                e.printStackTrace();
                            }
                        }
                        // 绑定oppo推送
                        // 绑定oppo,VIVO推送
                        DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
                        if (active != null) {
                            deviceTokenOPPOService.bindUid(uuser.getId(), active.getId());
                            deviceTokenVIVOService.bindUid(uuser.getId(), active.getId());
                        }
                    }
                });
@@ -221,7 +224,7 @@
                    e1.printStackTrace();
                }
            }
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("登录失败"));
            try {
@@ -232,8 +235,6 @@
        }
    }
    /**
     * 绑定电话号码 V2.0.1 微信登录
     * 
@@ -244,7 +245,8 @@
     */
    @RequestSerializableByKey(key = "'bindPhoneLogin-'+#phone")
    @RequestMapping(value = "bindPhoneLogin")
    public void bindPhoneLogin(AcceptData acceptData,String vcode, String phone, String key, HttpServletRequest request, PrintWriter out) {
    public void bindPhoneLogin(AcceptData acceptData, String vcode, String phone, String key,
            HttpServletRequest request, PrintWriter out) {
        BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
                acceptData.getPackages());
        if (system == null) {
@@ -266,7 +268,7 @@
            out.print(JsonUtil.loadFalseResult("key值不能为空"));
            return;
        }
        phone = phone.replaceAll(" ", "");
        String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_BIND);
@@ -290,7 +292,7 @@
            out.print(JsonUtil.loadFalseResult(1, "绑定失败"));
        }
    }
    /**
     * 绑定电话号码 V2.0.1 微信登录
     * 
@@ -309,5 +311,5 @@
        bindRemindService.addBindPhone(uid);
        out.print(JsonUtil.loadTrueResult("记录成功"));
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2Mapper.java
@@ -127,11 +127,12 @@
     * @param count
     * @return
     */
    List<HongBaoV2> listCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid,@Param("start") long start,
            @Param("count") int count);
    List<HongBaoV2> listCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid,
            @Param("start") long start, @Param("count") int count);
    /**
     * 计算可以结算红包的数量
     *
     * @param type
     * @param uid
     * @return
@@ -206,14 +207,25 @@
     */
    long countByParentUidAndTypeAndState(@Param("uid") Long uid, @Param("typeList") List<Integer> typeList,
            @Param("stateList") List<Integer> stateList);
    /**
     * 根据订单来源类型与交易ID列表查询订单信息
     *
     * @param sourceType
     * @param tradeId
     * @return
     */
    List<HongBaoV2> listBySourceTypeAndTradeIdListAndUid(@Param("sourceType") int sourceType, @Param("uid")long uid, @Param("tradeIdList") List<String> tradeIdList);
    List<HongBaoV2> listBySourceTypeAndTradeIdListAndUid(@Param("sourceType") int sourceType, @Param("uid") long uid,
            @Param("tradeIdList") List<String> tradeIdList);
    /**
     * 根据状态,类型,用户ID检索
     * @param stateList
     * @param typeList
     * @param uid
     * @return
     */
    List<HongBaoV2> listByStateAndTypeAndUid(@Param("stateList") List<Integer> stateList,
            @Param("typeList") List<Integer> typeList, @Param("uid") Long uid,@Param("start") long start,@Param("count")int count);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleMapper.java
@@ -249,5 +249,14 @@
     */
    List<ThreeSale> getSuccessByDate(@Param("bossId")Long bossId,@Param("minTime")Long minTime, @Param("maxTime")Long maxTime);
    
    /**
     * 查询最近的信息(根据下级ID与状态)
     * @param workerId
     * @param state
     * @return
     */
    ThreeSale selectLatestByWorkerIdAndState(@Param("workerId") Long workerId,@Param("state") int state);
    
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/push/DeviceTokenVIVOMapper.java
New file
@@ -0,0 +1,44 @@
package com.yeshi.fanli.dao.mybatis.push;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.push.DeviceTokenVIVO;
public interface DeviceTokenVIVOMapper extends BaseMapper<DeviceTokenVIVO> {
    /**
     * 根据设备激活ID查询
     *
     * @param deviceActiveId
     * @return
     */
    DeviceTokenVIVO selectByDeviceActiveId(Long deviceActiveId);
    /**
     * 设备数量
     *
     * @return
     */
    long countDeviceToken(@Param("versionList") List<Integer> versionList);
    /**
     * 设备列表
     *
     * @param start
     * @param count
     * @return
     */
    List<DeviceTokenVIVO> listDeviceToken(@Param("start") long start, @Param("count") int count,
            @Param("versionList") List<Integer> versionList);
    /**
     * 根据用户ID查询
     *
     * @param uid
     * @return
     */
    List<DeviceTokenVIVO> listByUid(@Param("uid") Long uid, @Param("versionList") List<Integer> verisonList);
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSale.java
@@ -26,6 +26,8 @@
    public static int EXPIRE_NORMAL = 0;// 正常状态
    public static int EXPIRE_OUTOFDATE = 1;// 过期状态
    public static int STATE_SUCCESS = 1;// 成功
    public static int STATE_NOT_SUCCESS = 0;// 尚未成功
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
@@ -35,14 +37,12 @@
    public ThreeSale(Long id) {
        this.id = id;
    }
    public ThreeSale() {
    }
    @Column(name = "boss_id")
    private UserInfo boss;// 邀请者
    @Column(name = "worker_id")
    private UserInfo worker; // 被邀请者
fanli/src/main/java/com/yeshi/fanli/entity/push/DeviceTokenVIVO.java
New file
@@ -0,0 +1,77 @@
package com.yeshi.fanli.entity.push;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * oppo推送
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_uid_devicetoken_vivo")
public class DeviceTokenVIVO {
    @Column(name = "dv_id")
    private Long id;
    @Column(name = "dv_device_id")
    private Long deviceActiveId;// 设备活跃ID
    @Column(name = "dv_register_id")
    private String registerId;
    @Column(name = "dv_uid")
    private Long uid;
    @Column(name = "dv_create_time")
    private Date createTime;
    @Column(name = "dv_update_time")
    private Date updateTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getRegisterId() {
        return registerId;
    }
    public void setRegisterId(String registerId) {
        this.registerId = registerId;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Long getDeviceActiveId() {
        return deviceActiveId;
    }
    public void setDeviceActiveId(Long deviceActiveId) {
        this.deviceActiveId = deviceActiveId;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/taobao/dataoke/DaTaoKeDetailV2.java
@@ -52,6 +52,7 @@
    private BigDecimal couponPrice;// 优惠券金额
    @Field
    private String couponConditions;// 优惠券使用条件
    @Deprecated
    @Field
    private String couponId;// 券ID
    @Field
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java
@@ -173,8 +173,8 @@
     */
    @Scheduled(cron = "0 1 5 * * ? ")
    public void autoAddTLJBuyGoods2() {
        if (!Constant.IS_TASK)
            return;
//        if (!Constant.IS_TASK)
//            return;
        LogHelper.test("自购立减开始选品");
        String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
        // 重试3次
fanli/src/main/java/com/yeshi/fanli/job/order/jd/UpdateJDOrderJob.java
@@ -12,6 +12,7 @@
import com.yeshi.fanli.dto.jd.JDOrderResult;
import com.yeshi.fanli.entity.jd.JDOrder;
import com.yeshi.fanli.exception.jd.JDOrderException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.RedisManager;
@@ -36,6 +37,7 @@
     */
    public void saveJDOrders(List<JDOrder> jdOrderList) {
        for (JDOrder order : jdOrderList) {
            LogHelper.orderInfo("京东订单:" + order.getOrderId());
            if (order.getValidCode() == 15)// 过滤掉代付款状态
                continue;
            try {
@@ -61,6 +63,8 @@
    public void updateSoonOrder() {
        if (!Constant.IS_TASK)
            return;
        LogHelper.orderInfo("开始爬取京东订单");
        long now = System.currentTimeMillis();
        JDOrderResult result = JDApiUtil.getOrderList(1, 200, new Date(now), JDApiUtil.ORDER_TYPE_CREATETIME);
@@ -107,7 +111,7 @@
        if (result != null) {
            jdOrderList.addAll(result.getOrderList());
            while (result != null && result.isHasMore()) {
                result = JDApiUtil.getOrderList(page++, pageSize,date, JDApiUtil.ORDER_TYPE_UPDATETIME);
                result = JDApiUtil.getOrderList(page++, pageSize, date, JDApiUtil.ORDER_TYPE_UPDATETIME);
                if (result != null)
                    jdOrderList.addAll(result.getOrderList());
            }
@@ -137,7 +141,6 @@
        saveJDOrders(orderList);
    }
    /**
     * 更新最近3天的订单(每天早上凌晨0点过10分,早上8点过10分)
     */
fanli/src/main/java/com/yeshi/fanli/log/PushLogHelper.java
@@ -92,6 +92,21 @@
        } catch (IOException e1) {
        }
    }
    public static void vivoError(Throwable e) {
        String date = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy_MM_dd");
        String os = System.getProperty("os.name");
        String filePath = String.format("/usr/local/tomcat8/logs/push/vivo_error_detail_%s.txt", date);
        if (os.toLowerCase().startsWith("win")) {
            filePath = String.format("C:/logs/push/vivo_error_detail_%s.txt", date);
        }
        try {
            saveErrorLog(e, filePath);
        } catch (IOException e1) {
        }
    }
    public static void saveErrorLog(Throwable e, String filePath) throws IOException {
        // 创建文件夹
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml
@@ -87,6 +87,12 @@
        LIMIT 1
    </select>
    
    <select id="selectLatestByWorkerIdAndState" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_threeSale s where worker_id = #{workerId} and state=#{state}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_threeSale where id = #{id,jdbcType=BIGINT}
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2Mapper.xml
@@ -383,8 +383,26 @@
        b
        ON a.hb_id=b.hbId OR a.hb_pid=b.hbId WHERE b.hbId >0
    </select>
    <select id="listByStateAndTypeAndUid" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_hongbao_v2 v where v.hb_uid=#{uid}
        <if test="stateList!=null">
            <foreach collection="stateList" open=" and (" item="state" separator=" or " close=")">
                hb_state=#{state}
            </foreach>
        </if>
        <if test="typeList!=null">
            <foreach collection="typeList" open=" and (" item="type" separator=" or " close=")">
                hb_type=#{type}
            </foreach>
        </if>
        order by hb_create_time asc,hb_id asc
        limit #{start},#{count}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT}
    </delete>
fanli/src/main/java/com/yeshi/fanli/mapping/push/DeviceTokenVIVOMapper.xml
New file
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.push.DeviceTokenVIVOMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.DeviceTokenVIVO">
        <id column="dv_id" property="id" jdbcType="BIGINT" />
        <result column="dv_device_id" property="deviceActiveId"
            jdbcType="BIGINT" />
        <result column="dv_register_id" property="registerId" jdbcType="VARCHAR" />
        <result column="dv_uid" property="uid" jdbcType="BIGINT" />
        <result column="dv_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="dv_update_time" property="updateTime" jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">dv_id,dv_device_id,dv_register_id,dv_uid,dv_create_time,dv_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_uid_devicetoken_vivo where dv_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByDeviceActiveId" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_uid_devicetoken_vivo where dv_device_id = #{0}
    </select>
    <select id="countDeviceToken" resultType="java.lang.Long"
        parameterType="java.lang.Long">
        select
        count(dv_id)
        from yeshi_ec_uid_devicetoken_vivo op left join
        yeshi_ec_device_active a on a.da_id=op.dv_device_id
        <if test="versionList!=null">
            <foreach collection="versionList" open="where (" separator=" or "
                item="ver" close=")">
                da_version_code=#{ver}
            </foreach>
        </if>
    </select>
    <select id="listDeviceToken" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_uid_devicetoken_vivo
        left join
        yeshi_ec_device_active a on a.da_id=dv_device_id
        <if test="versionList!=null">
            <foreach collection="versionList" open="where (" separator=" or "
                item="ver" close=")">
                da_version_code=#{ver}
            </foreach>
        </if>
         limit #{start},#{count}
    </select>
    <select id="listByUid" resultMap="BaseResultMap" parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_uid_devicetoken_vivo
        left join
        yeshi_ec_device_active a on a.da_id=dv_device_id
        where dv_uid=#{uid}
        <if test="versionList!=null">
            <foreach collection="versionList" open="and (" separator=" or "
                item="ver" close=")">
                da_version_code=#{ver}
            </foreach>
        </if>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_uid_devicetoken_vivo where dv_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.push.DeviceTokenVIVO"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_uid_devicetoken_vivo
        (dv_id,dv_device_id,dv_register_id,dv_uid,dv_create_time,dv_update_time)
        values
        (#{id,jdbcType=BIGINT},#{deviceActiveId,jdbcType=BIGINT},#{registerId,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.DeviceTokenVIVO"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_uid_devicetoken_vivo
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">dv_id,</if>
            <if test="deviceActiveId != null">dv_device_id,</if>
            <if test="registerId != null">dv_register_id,</if>
            <if test="uid != null">dv_uid,</if>
            <if test="createTime != null">dv_create_time,</if>
            <if test="updateTime != null">dv_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="deviceActiveId != null">#{deviceActiveId,jdbcType=BIGINT},</if>
            <if test="registerId != null">#{registerId,jdbcType=VARCHAR},</if>
            <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.DeviceTokenVIVO">update
        yeshi_ec_uid_devicetoken_vivo set dv_device_id =
        #{deviceActiveId,jdbcType=BIGINT},dv_register_id =
        #{registerId,jdbcType=VARCHAR},dv_uid =
        #{uid,jdbcType=BIGINT},dv_create_time =
        #{createTime,jdbcType=TIMESTAMP},dv_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where dv_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.DeviceTokenVIVO">
        update yeshi_ec_uid_devicetoken_vivo
        <set>
            <if test="deviceActiveId != null">dv_device_id=#{deviceActiveId,jdbcType=BIGINT},</if>
            <if test="registerId != null">dv_register_id=#{registerId,jdbcType=VARCHAR},</if>
            <if test="uid != null">dv_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="createTime != null">dv_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">dv_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where dv_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoOrderServiceImpl.java
@@ -67,4 +67,9 @@
        return hongBaoOrderMapper.selectByCommonOrderId(commonOrderId);
    }
    @Override
    public HongBaoOrder selectDetailByHongBaoId(Long hongBaoId) {
        return hongBaoOrderMapper.selectByHongBaoId(hongBaoId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/HongBaoV2ServiceImpl.java
@@ -264,7 +264,7 @@
    private void updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type,
            Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException {
        System.out.println(commonOrder.getOrderNo());
        //锁行
        // 锁行
        HongBaoV2 oldHongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBaoOrder.getHongBaoV2().getId());
        if (oldHongBao == null)
            throw new HongBaoException(10, "红包对象不存在");
@@ -943,24 +943,27 @@
                    child.setUrank(boss.getRank());
                    child.setVersion(2);
                    child.setCreateTime(new Date());
                    hongBaoV2Mapper.insertSelective(child);
                    // 添加通知
                    if (notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI) == null) {
                        HongBaoV2 tempHongBao = new HongBaoV2(child.getId());
                        tempHongBao.setUserInfo(child.getUserInfo());
                        tempHongBao.setMoney(child.getMoney());
                        tempHongBao.setBeizhu(hongBao.getUserInfo().getNickName());
                        CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                        tempCommonOrder.setPayment(commonOrder.getPayment());
                        notificationMap.put(HongBaoV2.TYPE_SHARE_YIJI, new HongBaoOrder(tempCommonOrder, tempHongBao));
                    } else {
                        // 增加付款金额与资金
                        HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI);
                        tempHongBaoOrder.getCommonOrder().setPayment(
                                tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                        tempHongBaoOrder.getHongBaoV2()
                                .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(child.getMoney()));
                        notificationMap.put(HongBaoV2.TYPE_SHARE_YIJI, tempHongBaoOrder);
                    if (child.getMoney().compareTo(new BigDecimal(0)) > 0) {
                        hongBaoV2Mapper.insertSelective(child);
                        // 添加通知
                        if (notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI) == null) {
                            HongBaoV2 tempHongBao = new HongBaoV2(child.getId());
                            tempHongBao.setUserInfo(child.getUserInfo());
                            tempHongBao.setMoney(child.getMoney());
                            tempHongBao.setBeizhu(hongBao.getUserInfo().getNickName());
                            CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                            tempCommonOrder.setPayment(commonOrder.getPayment());
                            notificationMap.put(HongBaoV2.TYPE_SHARE_YIJI,
                                    new HongBaoOrder(tempCommonOrder, tempHongBao));
                        } else {
                            // 增加付款金额与资金
                            HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI);
                            tempHongBaoOrder.getCommonOrder().setPayment(
                                    tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                            tempHongBaoOrder.getHongBaoV2()
                                    .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(child.getMoney()));
                            notificationMap.put(HongBaoV2.TYPE_SHARE_YIJI, tempHongBaoOrder);
                        }
                    }
                }
            }
@@ -1100,4 +1103,16 @@
            return null;
        return hongBaoV2Mapper.listBySourceTypeAndTradeIdListAndUid(sourceType, uid, tradeIdList);
    }
    @Override
    public HongBaoV2 getFirstValidHongBaoByTypeAndUid(List<Integer> typeList, Long uid) {
        List<Integer> stateList = new ArrayList<>();
        stateList.add(HongBaoV2.STATE_BUKELINGQU);
        stateList.add(HongBaoV2.STATE_KELINGQU);
        stateList.add(HongBaoV2.STATE_YILINGQU);
        List<HongBaoV2> hongBaoV2List = hongBaoV2Mapper.listByStateAndTypeAndUid(stateList, typeList, uid, 0, 1);
        if (hongBaoV2List != null && hongBaoV2List.size() > 0)
            return hongBaoV2List.get(0);
        return null;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceTokenVIVOServiceImpl.java
New file
@@ -0,0 +1,77 @@
package com.yeshi.fanli.service.impl.push;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.push.DeviceTokenVIVOMapper;
import com.yeshi.fanli.entity.push.DeviceTokenVIVO;
import com.yeshi.fanli.service.inter.push.DeviceTokenVIVOService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class DeviceTokenVIVOServiceImpl implements DeviceTokenVIVOService {
    @Resource
    private DeviceTokenVIVOMapper deviceTokenVIVOMapper;
    @Override
    public void addDeviceTokenVIVO(DeviceTokenVIVO oppo) {
        if (oppo == null || oppo.getDeviceActiveId() == null || StringUtil.isNullOrEmpty(oppo.getRegisterId()))
            return;
        DeviceTokenVIVO oldOppo = deviceTokenVIVOMapper.selectByDeviceActiveId(oppo.getDeviceActiveId());
        if (oldOppo == null) {
            if (oppo.getCreateTime() == null)
                oppo.setCreateTime(new Date());
            deviceTokenVIVOMapper.insertSelective(oppo);
        } else {
            DeviceTokenVIVO update = new DeviceTokenVIVO();
            update.setId(oldOppo.getId());
            update.setRegisterId(oppo.getRegisterId());
            update.setUpdateTime(oppo.getUpdateTime());
            update.setUid(oppo.getUid());
            deviceTokenVIVOMapper.updateByPrimaryKeySelective(update);
        }
    }
    @Override
    public void unBindUid(Long uid, Long deviceActiveId) {
        DeviceTokenVIVO oldOppo = deviceTokenVIVOMapper.selectByDeviceActiveId(deviceActiveId);
        if (oldOppo != null) {
            oldOppo.setUid(null);
            oldOppo.setUpdateTime(new Date());
            deviceTokenVIVOMapper.updateByPrimaryKey(oldOppo);
        }
    }
    @Override
    public void bindUid(Long uid, Long deviceActiveId) {
        DeviceTokenVIVO oldOppo = deviceTokenVIVOMapper.selectByDeviceActiveId(deviceActiveId);
        if (oldOppo != null) {
            DeviceTokenVIVO update = new DeviceTokenVIVO();
            update.setId(oldOppo.getId());
            update.setUid(uid);
            update.setUpdateTime(new Date());
            deviceTokenVIVOMapper.updateByPrimaryKeySelective(update);
        }
    }
    @Override
    public long countDeviceToken(List<Integer> versionList) {
        return deviceTokenVIVOMapper.countDeviceToken(versionList);
    }
    @Override
    public List<DeviceTokenVIVO> listDeviceToken(int page, int pageSize, List<Integer> versionList) {
        return deviceTokenVIVOMapper.listDeviceToken((page - 1) * pageSize, pageSize, versionList);
    }
    @Override
    public List<DeviceTokenVIVO> listByUid(Long uid, List<Integer> verisonList) {
        return deviceTokenVIVOMapper.listByUid(uid, verisonList);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java
@@ -15,7 +15,6 @@
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.bus.user.UserCustomSettings;
import com.yeshi.fanli.entity.bus.user.UserCustomSettings.UserSettingTypeEnum;
import com.yeshi.fanli.entity.push.DeviceTokenHW;
import com.yeshi.fanli.entity.push.DeviceTokenOPPO;
import com.yeshi.fanli.exception.push.PushException;
import com.yeshi.fanli.log.PushLogHelper;
@@ -24,7 +23,6 @@
import com.yeshi.fanli.service.inter.push.OPPOPushService;
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.push.HWPushUtil;
import com.yeshi.fanli.util.push.OPPOPushUtil;
@Service
@@ -42,7 +40,7 @@
    private List<Integer> getVersionCodeList(List<Integer> versionCodeList) {
        List<Integer> versionList = new ArrayList<>();
        if (versionCodeList == null) {// 全推
            List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 49);
            List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51);
            if (appInfoList != null)
                for (AppVersionInfo version : appInfoList) {
                    versionList.add(version.getVersionCode());
@@ -50,7 +48,7 @@
        } else {// 按版本推送
            for (Integer versionCode : versionCodeList) {
                if (versionCode.intValue() >= 49) {// 2.0.1开始支持
                if (versionCode.intValue() >= 51) {// 2.0.1开始支持
                    versionList.add(versionCode);
                }
            }
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
@@ -6,7 +6,6 @@
import org.springframework.stereotype.Service;
import com.yeshi.fanli.controller.admin.PushController;
import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
import com.yeshi.fanli.dao.mybatis.push.PushRecordMapper;
import com.yeshi.fanli.dto.push.PushTypeEnum;
@@ -23,6 +22,7 @@
import com.yeshi.fanli.service.inter.push.OPPOPushService;
import com.yeshi.fanli.service.inter.push.PushRecordService;
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.service.inter.push.VIVOPushService;
import com.yeshi.fanli.service.inter.push.XMPushService;
import com.yeshi.fanli.service.inter.user.SystemZnxService;
import com.yeshi.fanli.util.Constant;
@@ -59,6 +59,9 @@
    @Resource
    private OPPOPushService oPPOPushService;
    @Resource
    private VIVOPushService vIVOPushService;
    @Resource
    private PushRecordMapper pushRecordMapper;
@@ -111,6 +114,13 @@
                if (listAndroid != null)
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                oPPOPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
            }
            // VIVO推送
            if (listAndroid == null || listAndroid.size() > 0) {
                List<Integer> versionCodeList = null;
                if (listAndroid != null)
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                vIVOPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
            }
        }
@@ -169,6 +179,14 @@
                if (listAndroid != null)
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                oPPOPushService.pushUrl(uid, url, title, content, versionCodeList);
            }
            // VIVO推送
            if (listAndroid == null || listAndroid.size() > 0) {
                List<Integer> versionCodeList = null;
                if (listAndroid != null)
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                vIVOPushService.pushUrl(uid, url, title, content, versionCodeList);
            }
        }
@@ -245,6 +263,14 @@
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                oPPOPushService.pushZNX(uId, title, content, versionCodeList);
            }
            // VIVO推送
            if (listAndroid == null || listAndroid.size() > 0) {
                List<Integer> versionCodeList = null;
                if (listAndroid != null)
                    versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
                vIVOPushService.pushZNX(uId, title, content, versionCodeList);
            }
        }
        // 插入推送记录
@@ -300,6 +326,14 @@
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            oPPOPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
        }
        // VIVO推送
        if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            vIVOPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
        }
        // 插入推送记录
@@ -358,6 +392,14 @@
            oPPOPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
        }
        // VIVO推送
        if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            vIVOPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
        }
        // 插入推送记录
        PushRecord pushRecord = new PushRecord();
        pushRecord.setUrl(url);
@@ -411,6 +453,14 @@
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            oPPOPushService.pushWelfareCenter(uid, title, content, versionCodeList);
        }
        // VIVO推送
        if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            vIVOPushService.pushWelfareCenter(uid, title, content, versionCodeList);
        }
        // 插入推送记录
@@ -546,6 +596,14 @@
            oPPOPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
        }
        // VIVO推送
        if (listAndroid == null || listAndroid.size() > 0) {
            List<Integer> versionCodeList = null;
            if (listAndroid != null)
                versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
            vIVOPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
        }
        // 插入推送记录
        PushRecord pushRecord = new PushRecord();
        pushRecord.setTitle(title);
fanli/src/main/java/com/yeshi/fanli/service/impl/push/VIVOPushServiceImpl.java
New file
@@ -0,0 +1,236 @@
package com.yeshi.fanli.service.impl.push;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dto.push.PushTypeEnum;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.bus.user.UserCustomSettings;
import com.yeshi.fanli.entity.bus.user.UserCustomSettings.UserSettingTypeEnum;
import com.yeshi.fanli.entity.push.DeviceTokenVIVO;
import com.yeshi.fanli.exception.push.PushException;
import com.yeshi.fanli.log.PushLogHelper;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.push.DeviceTokenVIVOService;
import com.yeshi.fanli.service.inter.push.VIVOPushService;
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.push.VIVOPushUtil;
@Service
public class VIVOPushServiceImpl implements VIVOPushService {
    @Resource
    private DeviceTokenVIVOService deviceTokenVIVOService;
    @Resource
    private AppVersionService appVersionService;
    @Resource
    private UserCustomSettingsService userCustomSettingsService;
    private List<Integer> getVersionCodeList(List<Integer> versionCodeList) {
        List<Integer> versionList = new ArrayList<>();
        if (versionCodeList == null) {// 全推
            List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51);
            if (appInfoList != null)
                for (AppVersionInfo version : appInfoList) {
                    versionList.add(version.getVersionCode());
                }
        } else {// 按版本推送
            for (Integer versionCode : versionCodeList) {
                if (versionCode.intValue() >= 51) {// 2.0.1开始支持
                    versionList.add(versionCode);
                }
            }
        }
        return versionList;
    }
    @Async("pushExecutor")
    @Override
    public void pushGoods(Long uid, Long auctionId, String title, String content, List<Integer> versionCodeList)
            throws PushException {
        push(PushTypeEnum.goodsdetail, uid, title, content, null, null, auctionId, versionCodeList);
    }
    @Async("pushExecutor")
    @Override
    public void pushUrl(Long uid, String url, String title, String content, List<Integer> versionCodeList)
            throws PushException {
        push(PushTypeEnum.url, uid, title, content, null, url, null, versionCodeList);
    }
    @Async("pushExecutor")
    @Override
    public void pushZNX(Long uid, String title, String content, List<Integer> versionCodeList) throws PushException {
        push(PushTypeEnum.ZNX, uid, title, content, null, null, null, versionCodeList);
    }
    @Async("pushExecutor")
    @Override
    public void pushWEEX(Long uid, String title, String content, String weexUrl, List<Integer> versionCodeList)
            throws PushException {
        push(PushTypeEnum.weex, uid, title, content, weexUrl, null, null, versionCodeList);
    }
    @Async("pushExecutor")
    @Override
    public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<Integer> versionCodeList)
            throws PushException {
        push(PushTypeEnum.baichuan, uid, title, content, null, url, null, versionCodeList);
    }
    @Async("pushExecutor")
    @Override
    public void pushWelfareCenter(Long uid, String title, String content, List<Integer> versionCodeList)
            throws PushException {
        push(PushTypeEnum.welfare, uid, title, content, null, null, null, versionCodeList);
    }
    @Override
    public void pushUserSignInNotification(Long uid, String title, String content, List<Integer> versionCodeList)
            throws PushException {
        push(PushTypeEnum.signin, uid, title, content, null, null, null, versionCodeList);
    }
    private List<DeviceTokenVIVO> filterDeviceToken(List<DeviceTokenVIVO> deviceList, int hour) {
        // 处理消息免打扰
        if (hour >= 20 || hour < 8) {
            Set<Long> uidSets = new HashSet<>();
            for (DeviceTokenVIVO dt : deviceList)
                if (dt.getUid() != null)
                    uidSets.add(dt.getUid());
            List<Long> uidList = new ArrayList<>();
            uidList.addAll(uidSets);
            List<UserCustomSettings> settingList = userCustomSettingsService.listByUidListAndTypeAndState(uidList,
                    UserSettingTypeEnum.cancelNotice.name(), UserCustomSettings.STATE_VALID);
            uidSets.clear();
            if (settingList != null) {
                for (UserCustomSettings seeting : settingList)
                    uidSets.add(seeting.getUserInfo().getId());
            }
            if (uidSets.size() > 0)
                for (int i = 0; i < deviceList.size(); i++) {
                    if (deviceList.get(i).getUid() != null && uidSets.contains(deviceList.get(i).getUid())) {
                        deviceList.remove(i--);
                    }
                }
        }
        return deviceList;
    }
    /**
     * 推送
     *
     * @param type
     * @param uid
     * @param title
     * @param content
     * @param url
     * @param webUrl
     * @param versionCodeList
     */
    private void push(PushTypeEnum type, Long uid, String title, String content, String url, String webUrl,
            Long goodsId, List<Integer> versionCodeList) throws PushException {
        int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
        List<Integer> newVersionList = getVersionCodeList(versionCodeList);
        // 2.0.1后开始推送
        for (int i = 0; i < newVersionList.size(); i++) {
            if (newVersionList.get(i) < 51)
                newVersionList.remove(i--);
        }
        if (uid == null || uid == 0) {
            int pageSize = 200;
            long deviceCount = deviceTokenVIVOService.countDeviceToken(newVersionList);
            int page = (int) (deviceCount % pageSize == 0 ? deviceCount / pageSize : deviceCount / pageSize + 1);
            for (int p = 1; p <= page; p++) {
                List<DeviceTokenVIVO> deviceList = deviceTokenVIVOService.listDeviceToken(p, pageSize, newVersionList);
                deviceList = filterDeviceToken(deviceList, hour);
                List<String> tokenList = new ArrayList<>();
                for (DeviceTokenVIVO token : deviceList)
                    tokenList.add(token.getRegisterId());
                try {
                    if (type == PushTypeEnum.goodsdetail) {// 商品详情
                        if (goodsId == null)
                            throw new PushException(2, "参数不完整");
                        VIVOPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
                    } else if (type == PushTypeEnum.url) {// 链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        VIVOPushUtil.pushUrl(tokenList, title, content, webUrl);
                    } else if (type == PushTypeEnum.ZNX) {// 站内信
                        VIVOPushUtil.pushZNX(tokenList, title, content);
                    } else if (type == PushTypeEnum.weex) {// weex
                        if (StringUtil.isNullOrEmpty(url))
                            throw new PushException(2, "参数不完整");
                        VIVOPushUtil.pushWEEX(tokenList, title, content, url);
                    } else if (type == PushTypeEnum.baichuan) {// 百川链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        VIVOPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
                    } else if (type == PushTypeEnum.welfare) {// 福利中心
                        VIVOPushUtil.pushWelfareCenter(tokenList, title, content);
                    } else if (type == PushTypeEnum.signin) {// 签到
                        VIVOPushUtil.pushUserSignInNotification(tokenList, title, content);
                    }
                } catch (Exception e) {
                    PushLogHelper.hwError(e);
                }
            }
        } else {
            // 单推
            List<DeviceTokenVIVO> deviceList = deviceTokenVIVOService.listByUid(uid, newVersionList);
            List<String> tokenList = new ArrayList<>();
            if (deviceList != null) {
                deviceList = filterDeviceToken(deviceList, hour);
                for (DeviceTokenVIVO token : deviceList)
                    tokenList.add(token.getRegisterId());
            }
            if (tokenList.size() == 0)
                return;
            try {
                if (type == PushTypeEnum.goodsdetail) {// 商品详情
                    if (goodsId == null)
                        throw new PushException(2, "参数不完整");
                    VIVOPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
                } else if (type == PushTypeEnum.url) {// 链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    VIVOPushUtil.pushUrl(tokenList, title, content, webUrl);
                } else if (type == PushTypeEnum.ZNX) {// 站内信
                    VIVOPushUtil.pushZNX(tokenList, title, content);
                } else if (type == PushTypeEnum.weex) {// weex
                    if (StringUtil.isNullOrEmpty(url))
                        throw new PushException(2, "参数不完整");
                    VIVOPushUtil.pushWEEX(tokenList, title, content, url);
                } else if (type == PushTypeEnum.baichuan) {// 百川链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    VIVOPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
                } else if (type == PushTypeEnum.welfare) {// 福利中心
                    VIVOPushUtil.pushWelfareCenter(tokenList, title, content);
                } else if (type == PushTypeEnum.signin) {// 签到
                    VIVOPushUtil.pushUserSignInNotification(tokenList, title, content);
                }
            } catch (Exception e) {
                PushLogHelper.vivoError(e);
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java
@@ -147,6 +147,8 @@
    @Override
    @Transactional
    public UserTaoLiJinOrigin addNewbiesWinMoney(Long uid) throws UserTaoLiJinOriginException{
        if(1>0)
            throw new UserTaoLiJinOriginException(1, "接口已下线");
        if (uid == null) {
            throw new UserTaoLiJinOriginException(1, "参数不能为空");
        }
@@ -198,6 +200,9 @@
            throw new UserTaoLiJinOriginException(1, "参数不能为空");
        }
        
        if(1>0)
            throw new UserTaoLiJinOriginException(1, "接口已下线");
        String key = "";
        if (userRank.getId() == 2) {
            key = "hongbao_rank_silver";
@@ -248,6 +253,9 @@
            throw new UserTaoLiJinOriginException(1, "参数不能为空");
        }
        
        if(1>0)
            throw new UserTaoLiJinOriginException(1, "接口已下线");
        String value = configTaoLiJinService.getValueByKey("hongbao_invite",null);
        if (StringUtil.isNullOrEmpty(value)) {
            throw new UserTaoLiJinOriginException(1, "系统红包不存在");
@@ -287,6 +295,9 @@
            throw new UserTaoLiJinOriginException(1, "用户未登录");
        }
        
        if(1>0)
            throw new UserTaoLiJinOriginException(1, "接口已下线");
        String value = configTaoLiJinService.getValueByKey("hongbao_share",null);
        if (StringUtil.isNullOrEmpty(value)) {
            throw new UserTaoLiJinOriginException(1, "系统红包不存在");
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java
@@ -56,6 +56,7 @@
import com.yeshi.fanli.util.TaoBaoConstant;
import com.yeshi.fanli.util.TokenUtil;
import com.yeshi.fanli.util.factory.CommonGoodsFactory;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.util.taobao.TaoLiJinUtil;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
@@ -69,7 +70,7 @@
    @Resource
    private RedisManager redisManager;
    @Resource
    private ConfigService configService;
@@ -111,13 +112,13 @@
    @Resource
    private ShareHotGoodsService shareHotGoodsService;
    @Resource
    private TokenRecordService tokenRecordService;
    @Resource
    private UserTaoLiJinGiveRecordService userTaoLiJinGiveRecordService;
    @Override
    public UserTaoLiJinRecord selectByPrimaryKey(Long id) {
        return userTaoLiJinRecordMapper.selectByPrimaryKey(id);
@@ -150,7 +151,7 @@
        // 新人红包 自购一元
        BigDecimal perface = new BigDecimal(1);
        if (goods.getMaterialLibType() == null || goods.getMaterialLibType() == 0) {// 非返利库商品
        if (!TaoBaoUtil.isSpecialGoods(goods.getMaterialLibType())) {// 非返利库商品
            String relationId = null;
            try {
                relationId = taoBaoBuyRelationMapService.getRelationId(uid);
@@ -512,25 +513,25 @@
    public UserTaoLiJinRecord getByRightsId(String rightsId) {
        return userTaoLiJinRecordMapper.getByRightsId(rightsId);
    }
    @Override
    public String giveTaolijin(Long uid, BigDecimal amount) throws UserTaoLiJinRecordException{
        if (uid == null || amount == null)
            throw new UserTaoLiJinRecordException(1,"参数不正确");
    public String giveTaolijin(Long uid, BigDecimal amount) throws UserTaoLiJinRecordException {
        if (uid == null || amount == null)
            throw new UserTaoLiJinRecordException(1, "参数不正确");
        String giveMin = configTaoLiJinService.getValueByKey("give_min_amount");
        if (amount.compareTo(new BigDecimal(giveMin)) < 0)
            throw new UserTaoLiJinRecordException(1,"赠送推广红包金额至少" + giveMin + "元");
            throw new UserTaoLiJinRecordException(1, "赠送推广红包金额至少" + giveMin + "元");
        // 用户剩余可以淘礼金验证
        UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid);
        if (userMoneyExtra == null || userMoneyExtra.getTlj() == null)
            throw new UserTaoLiJinRecordException(1, "红包余额不足");
        BigDecimal tlj = userMoneyExtra.getTlj();
        if (amount.compareTo(tlj) > 0)
            throw new UserTaoLiJinRecordException(1, "红包余额不足");
        Date nowDate = new Date();
        // 赠送记录
        UserTaoLiJinGiveRecord giveRecord = new UserTaoLiJinGiveRecord();
@@ -540,7 +541,7 @@
        giveRecord.setGiveTime(nowDate);
        giveRecord.setEndTime(DateUtil.plusDayDate(Constant.GIVE_DAYS, new Date()));
        userTaoLiJinGiveRecordService.insertSelective(giveRecord);
        // 口令记录
        TokenRecord tokenRecord = new TokenRecord();
        tokenRecord.setUid(uid);
@@ -550,27 +551,27 @@
        tokenRecord.setEndTime(DateUtil.plusDayDate(Constant.TOKEN_DAYS, new Date()));
        tokenRecord.setState(0);
        tokenRecordService.insertSelective(tokenRecord);
        // 创建口令
        String token = TokenUtil.createToken(tokenRecord.getId());
        tokenRecord.setToken(token);
        tokenRecordService.updateByPrimaryKeySelective(tokenRecord);
        // 更新余额
        UserMoneyExtra updateExtra = new UserMoneyExtra();
        updateExtra.setUid(uid);
        updateExtra.setTlj(MoneyBigDecimalUtil.sub(tlj, amount));
        updateExtra.setUpdateTime(new Date());
        userMoneyExtraService.updateByPrimaryKeySelective(updateExtra);
        String tips = configTaoLiJinService.getValueByKey("give_taolijin_tips");
        String projectChineseName = Constant.systemCommonConfig.getProjectChineseName();
        while(tips.contains("{APP名称}")) {
        while (tips.contains("{APP名称}")) {
            tips = tips.replace("{APP名称}", projectChineseName);
        }
        tips = tips.replace("{口令}", token).replace("{下载链接}", configService.get("app_down_link"))
                .replace("{面额}", amount.setScale(0).toString());
        tips = tips.replace("{口令}", token).replace("{下载链接}", configService.get("app_down_link")).replace("{面额}",
                amount.setScale(0).toString());
        executor.execute(new Runnable() {
            @Override
            public void run() {
@@ -620,9 +621,8 @@
                }
            }
        });
        return tips;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
@@ -72,7 +72,6 @@
    @Resource
    private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
    @Lazy
    @Resource
    private IntegralGetService integralGetService;
@@ -679,7 +678,7 @@
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
                // 邀请金币
                integralGetService.addInviteLevelOne(boss.getId(), invitee.getId());
            }
@@ -722,4 +721,10 @@
        return threeSaleMapper.listSecondTeam(start, count, uid, state);
    }
    @Override
    public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state) {
        return threeSaleMapper.selectLatestByWorkerIdAndState(workerId, state);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/HongBaoOrderService.java
@@ -53,5 +53,13 @@
     * @return
     */
    public HongBaoOrder selectDetailByCommonOrderId(Long commonOrderId);
    /**
     * 获取详情
     * @param hongBaoId
     * @return
     */
    public HongBaoOrder selectDetailByHongBaoId(Long hongBaoId);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/HongBaoV2Service.java
@@ -155,4 +155,13 @@
     */
    public List<HongBaoV2> listBySourceTypeAndTradeIdListAndUid(int sourceType, long uid, List<String> tradeIdList);
    /**
     * 获取首次有效的红包(根据类型与用户ID)
     *
     * @param typeList
     * @param uid
     * @return
     */
    public HongBaoV2 getFirstValidHongBaoByTypeAndUid(List<Integer> typeList, Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/push/DeviceTokenVIVOService.java
New file
@@ -0,0 +1,62 @@
package com.yeshi.fanli.service.inter.push;
import java.util.List;
import com.yeshi.fanli.entity.push.DeviceTokenVIVO;
/**
 * VIVO的设备绑定
 *
 * @author Administrator
 *
 */
public interface DeviceTokenVIVOService {
    /**
     * 添加VIVO推送设备
     *
     * @param oppo
     */
    public void addDeviceTokenVIVO(DeviceTokenVIVO oppo);
    /**
     * 解绑uid与设备
     *
     * @param uid
     * @param deviceActiveId
     */
    public void unBindUid(Long uid, Long deviceActiveId);
    /**
     * 绑定设备
     *
     * @param uid
     * @param deviceActiveId
     */
    public void bindUid(Long uid, Long deviceActiveId);
    /**
     * 计算所有的设备
     *
     * @return
     */
    public long countDeviceToken(List<Integer> verisonList);
    /**
     * 设备列表
     *
     * @param page
     * @param pageSize
     * @return
     */
    public List<DeviceTokenVIVO> listDeviceToken(int page, int pageSize, List<Integer> verisonList);
    /**
     * 根据用户ID检索
     *
     * @param uid
     * @return
     */
    public List<DeviceTokenVIVO> listByUid(Long uid, List<Integer> verisonList);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/push/VIVOPushService.java
New file
@@ -0,0 +1,94 @@
package com.yeshi.fanli.service.inter.push;
import java.util.List;
import com.yeshi.fanli.exception.push.PushException;
/**
 * 华为推送服务
 *
 * @author Administrator
 *
 */
public interface VIVOPushService {
    /**
     * 推送商品
     *
     * @param uid
     * @param url
     * @param title
     * @param content
     * @throws PushException
     */
    void pushGoods(Long uid, Long auctionId, String title, String content, List<Integer> versionCodeList)
            throws PushException;
    /**
     * 推送链接
     *
     * @param uid
     * @param url
     * @param title
     * @param content
     * @throws PushException
     */
    void pushUrl(Long uid, String url, String title, String content, List<Integer> versionCodeList)
            throws PushException;
    /**
     * 推送站内信
     *
     * @param uId
     * @param title
     * @param content
     * @throws PushException
     */
    void pushZNX(Long uId, String title, String content, List<Integer> versionCodeList) throws PushException;
    /**
     * 适用版本 1.4.8及以后 推送weex页面
     *
     * @param uid
     * @param title
     * @param content
     * @param weexUrl
     * @throws PushException
     */
    void pushWEEX(Long uid, String title, String content, String weexUrl, List<Integer> versionCodeList)
            throws PushException;
    /**
     * 适用版本 1.4.8及以后 推送百川网页
     *
     * @param uid
     * @param title
     * @param content
     * @param url
     * @throws PushException
     */
    void pushBaiChuanUrl(Long uid, String title, String content, String url, List<Integer> versionCodeList)
            throws PushException;
    /**
     * 推送福利中心(版本号:1.5.1后)
     *
     * @param uid
     * @param title
     * @param content
     * @throws PushException
     */
    void pushWelfareCenter(Long uid, String title, String content, List<Integer> versionCodeList) throws PushException;
    /**
     * 推送签到提醒
     *
     * @param uid
     * @param title
     * @param content
     * @param versions
     * @throws PushException
     */
    void pushUserSignInNotification(Long uid, String title, String content,  List<Integer> versionCodeList) throws PushException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java
@@ -252,6 +252,15 @@
     * @return
     */
    public ThreeSale selectByWorkerId(Long workerId);
    /**
     * 查询最近一条数据(根据下级用户ID与状态)
     * @param workerId
     * @param state
     * @return
     */
    public ThreeSale selectLatestByWorkerIdAndState(Long workerId,int state);
    /**
     * 时间段呢 邀请成功信息
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.util;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -744,19 +745,138 @@
                                if (hongBaoV2 != null && hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU
                                        && hongBaoV2.getMoney().compareTo(new BigDecimal(0)) > 0) {
                                    if (hongBaoV2.getType() == HongBaoV2.TYPE_ZIGOU) {// 自购
                                        integralGetService.addRebateOrder(hongBaoV2.getUserInfo().getId());
                                        // 判断是否为该用户的首笔红包
                                        List<Integer> typeList = new ArrayList<>();
                                        typeList.add(HongBaoV2.TYPE_ZIGOU);
                                        HongBaoV2 firstHongBao = hongBaoV2Service.getFirstValidHongBaoByTypeAndUid(
                                                typeList, hongBaoV2.getUserInfo().getId());
                                        if (firstHongBao != null
                                                && firstHongBao.getId().longValue() == hongBaoV2.getId()) {// 自购首单到账
                                            // 查询下级红包
                                            BigDecimal firstLevelMoney = new BigDecimal(0);
                                            BigDecimal secondLevelMoney = new BigDecimal(0);
                                            // 获取改单下面的红包
                                            List<HongBaoV2> hongBaoList = new ArrayList<>();
                                            HongBaoOrder hongBaoOrder = hongBaoOrderService
                                                    .selectDetailByHongBaoId(hongBaoV2.getId());
                                            if (hongBaoOrder != null && hongBaoOrder.getCommonOrder() != null) {// 计算改订单号下面的所有返利金额
                                                CommonOrder commonOrder = hongBaoOrder.getCommonOrder();
                                                List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(
                                                        commonOrder.getSourceType(), commonOrder.getOrderNo());
                                                for (CommonOrder co : list) {
                                                    HongBaoOrder hbo = hongBaoOrderService
                                                            .selectDetailByCommonOrderId(co.getId());
                                                    if (hbo != null && hbo.getHongBaoV2() != null)
                                                        hongBaoList.add(hbo.getHongBaoV2());
                                                }
                                            }
                                            for (HongBaoV2 hb : hongBaoList) {
                                                List<HongBaoV2> children = hongBaoV2Service
                                                        .listChildrenById(hb.getId());
                                                if (children != null)
                                                    for (HongBaoV2 child : children)
                                                        if (child.getType() == HongBaoV2.TYPE_YIJI) {
                                                            firstLevelMoney = firstLevelMoney.add(child.getMoney());
                                                        } else if (child.getType() == HongBaoV2.TYPE_ERJI) {
                                                            secondLevelMoney = secondLevelMoney.add(child.getMoney());
                                                        }
                                            }
                                            // 查询下级的生效时间
                                            ThreeSale threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
                                                    hongBaoV2.getUserInfo().getId(), ThreeSale.STATE_SUCCESS);
                                            if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
                                                    .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
                                                // 成功时间要大于20190910日才开始送金币
                                                if (threeSale.getSucceedTime() > TimeUtil.convertToTimeTemp("20190901",
                                                        "yyyyMMdd")) {
                                                    if (firstLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 一级返利小于0.01
//                                                        integralTaskRecordService.firstRebateOrderRewardBoss(threeSale.getBoss().getId(),
//                                                                hongBaoV2.getUserInfo().getId(), null);
                                                        LogHelper.test("自购-一级用户-" + threeSale.getBoss().getId()
                                                                + "-hongBaoId:" + hongBaoV2.getId());
                                                    }
                                                }
                                            }
                                            // 查询下下级生效时间
                                            if (threeSale != null) {
                                                threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
                                                        threeSale.getBoss().getId(), ThreeSale.STATE_SUCCESS);
                                                if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
                                                        .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
                                                    // 成功时间要大于20190910日才开始送金币
                                                    if (threeSale.getSucceedTime() > TimeUtil
                                                            .convertToTimeTemp("20190901", "yyyyMMdd")) {
                                                        if (secondLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 二级返利小于0.01
//                                                            integralTaskRecordService.firstRebateOrderRewardBossSuper(threeSale.getBoss().getId(),
//                                                                    hongBaoV2.getUserInfo().getId(), null);
                                                            LogHelper.test("自购-二级用户-" + threeSale.getBoss().getId()
                                                                    + "-hongBaoId:" + hongBaoV2.getId());
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    } else if (hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_GOODS) {// 分享赚
                                        integralGetService.addShareOrder(hongBaoV2.getUserInfo().getId());
                                    } else if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI
                                            || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 一级邀请赚
                                        integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
                                    } else if (hongBaoV2.getType() == HongBaoV2.TYPE_ERJI
                                            || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 二级邀请赚
                                        integralGetService.addInviteOrderLevelOne(hongBaoV2.getUserInfo().getId());
                                        // 判断是否为该用户的首笔红包
                                        List<Integer> typeList = new ArrayList<>();
                                        typeList.add(HongBaoV2.TYPE_SHARE_GOODS);
                                        HongBaoV2 firstHongBao = hongBaoV2Service.getFirstValidHongBaoByTypeAndUid(
                                                typeList, hongBaoV2.getUserInfo().getId());
                                        if (firstHongBao != null
                                                && firstHongBao.getId().longValue() == hongBaoV2.getId()) // 分享首笔到账
                                        {
                                            // 查询下级红包
                                            BigDecimal firstLevelMoney = new BigDecimal(0);
                                            // 获取改单下面的红包
                                            List<HongBaoV2> hongBaoList = new ArrayList<>();
                                            HongBaoOrder hongBaoOrder = hongBaoOrderService
                                                    .selectDetailByHongBaoId(hongBaoV2.getId());
                                            if (hongBaoOrder != null && hongBaoOrder.getCommonOrder() != null) {// 计算改订单号下面的所有返利金额
                                                CommonOrder commonOrder = hongBaoOrder.getCommonOrder();
                                                List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(
                                                        commonOrder.getSourceType(), commonOrder.getOrderNo());
                                                for (CommonOrder co : list) {
                                                    HongBaoOrder hbo = hongBaoOrderService
                                                            .selectDetailByCommonOrderId(co.getId());
                                                    if (hbo != null && hbo.getHongBaoV2() != null)
                                                        hongBaoList.add(hbo.getHongBaoV2());
                                                }
                                            }
                                            for (HongBaoV2 hb : hongBaoList) {
                                                List<HongBaoV2> children = hongBaoV2Service
                                                        .listChildrenById(hb.getId());
                                                if (children != null)
                                                    for (HongBaoV2 child : children)
                                                        if (child.getType() == HongBaoV2.TYPE_SHARE_YIJI) {
                                                            firstLevelMoney = firstLevelMoney.add(child.getMoney());
                                                        }
                                            }
                                            ThreeSale threeSale = threeSaleSerivce.selectLatestByWorkerIdAndState(
                                                    hongBaoV2.getUserInfo().getId(), ThreeSale.STATE_SUCCESS);
                                            if (threeSale != null && threeSale.getSucceedTime() != null && threeSale
                                                    .getSucceedTime() < hongBaoV2.getCreateTime().getTime()) {// 邀请成功的时间是否在下单的时间之前
                                                // 成功时间要大于20190910日才开始送金币
                                                if (threeSale.getSucceedTime() > TimeUtil.convertToTimeTemp("20190901",
                                                        "yyyyMMdd")) {
                                                    if (firstLevelMoney.compareTo(new BigDecimal("0.01")) < 0) {// 一级返利小于0.01
//                                                        integralTaskRecordService.firstSharerOrderRewardBoss(threeSale.getBoss().getId(),
//                                                                hongBaoV2.getUserInfo().getId(), null);
                                                        LogHelper.test("分享-一级用户-" + threeSale.getBoss().getId()
                                                                + "-hongBaoId:" + hongBaoV2.getId());
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                HongBaoRecieveCMQManager.getInstance()
                                        .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL, key);
                                // HongBaoRecieveCMQManager.getInstance()
                                // .deleteQueueMsg(HongBaoRecieveCMQManager.QUEUE_INTEGRAL,
                                // key);
                            } catch (Exception e) {
                                try {
                                    LogHelper.errorDetailInfo(e);
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java
@@ -213,7 +213,7 @@
        TaoKeAppInfo app = getRandomApp();
        DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
        Map<String, String> params = new TreeMap<>();
        params.put("version", "v1.0.0");
        params.put("version", "v1.1.0");
        params.put("appKey", app.getAppKey());
        params.put("pageSize", 200 + "");
        // params.put("sort", "1");
@@ -246,7 +246,7 @@
        TaoKeAppInfo app = getRandomApp();
        DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
        Map<String, String> params = new TreeMap<>();
        params.put("version", "v1.0.0");
        params.put("version", "v1.0.1");
        params.put("appKey", app.getAppKey());
        params.put("pageSize", 200 + "");
        if (!StringUtil.isNullOrEmpty(startTime))
@@ -280,7 +280,7 @@
        TaoKeAppInfo app = getRandomApp();
        DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
        Map<String, String> params = new TreeMap<>();
        params.put("version", "v1.0.0");
        params.put("version", "v1.1.0");
        params.put("appKey", app.getAppKey());
        params.put("pageSize", 200 + "");
        if (!StringUtil.isNullOrEmpty(startTime))
@@ -314,7 +314,7 @@
        TaoKeAppInfo app = getRandomApp();
        DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
        Map<String, String> params = new TreeMap<>();
        params.put("version", "v1.0.0");
        params.put("version", "v1.1.0");
        params.put("appKey", app.getAppKey());
        params.put("pageSize", 200 + "");
        if (!StringUtil.isNullOrEmpty(startTime))
@@ -345,7 +345,7 @@
    public static DaTaoKeDetailV2 getGoodsDetail(Long id) {
        TaoKeAppInfo app = getRandomApp();
        Map<String, String> params = new TreeMap<>();
        params.put("version", "v1.0.0");
        params.put("version", "v1.1.0");
        params.put("appKey", app.getAppKey());
        params.put("id", id + "");
        params.put("sign", getSign(params, app.getAppSecret()));
@@ -365,7 +365,7 @@
        TaoKeAppInfo app = getRandomApp();
        DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
        Map<String, String> params = new TreeMap<>();
        params.put("version", "v1.0.0");
        params.put("version", "v2.1.0");
        params.put("appKey", app.getAppKey());
        params.put("pageSize", pageSize + "");
        params.put("pageId", page + "");
@@ -490,7 +490,7 @@
        TaoKeAppInfo app = getRandomApp();
        DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
        Map<String, String> params = new TreeMap<>();
        params.put("version", "v1.0.0");
        params.put("version", "v1.1.0");
        params.put("appKey", app.getAppKey());
        params.put("rankType", type + "");
        if (cid != null)
fanli/src/main/java/com/yeshi/fanli/util/elme/ElmeOrderUtil.java
@@ -86,6 +86,7 @@
            }
            rwb.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }
fanli/src/main/java/com/yeshi/fanli/util/push/VIVOPushUtil.java
@@ -5,6 +5,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import com.vivo.push.sdk.notofication.Message;
import com.vivo.push.sdk.notofication.Result;
@@ -64,7 +65,9 @@
    private static Message.Builder getBaseMessageBuidler(String title, String content,
            Map<String, String> customParams) {
        Message.Builder buidler = new Message.Builder();
        buidler = buidler.title(title).content(content).skipType(4).skipContent("").notifyType(3);
        buidler = buidler.title(title).content(content).skipType(4).skipContent("todo").notifyType(3)
                .requestId(UUID.randomUUID().toString());
        buidler = buidler.clientCustomMap(customParams);
        return buidler;
    }
@@ -114,20 +117,27 @@
            Sender sender = new Sender(APP_SECRET);
            sender.initPool(20, 10);// 设置连接池参数,可选项
            sender.setAuthToken(authToken);// 设置推送的必要参数authToken(调用鉴权方法获得)
            Message saveList = builder.build();// 构建要保存的批量推送消息体
            Result result = sender.saveListPayLoad(saveList);// 发送保存群推消息请求
            String taskId = result.getTaskId();
            Set<String> regIds = new HashSet<>();// 构建批量推送用户群
            for (String regId : regIdList)
                regIds.add(regId);
            TargetMessage targetMessage = new TargetMessage.Builder().regIds(regIds).taskId(taskId).build();// 构建批量推送的消息体
            result = sender.sendToList(targetMessage);// 批量推送给用户
            Message saveList = builder.timeToLive(3600).build();// 构建要保存的批量推送消息体
            Result result = null;
            if (regIdList.size() > 1) {
                result = sender.saveListPayLoad(saveList);// 发送保存群推消息请求
                String taskId = result.getTaskId();
                Set<String> regIds = new HashSet<>();// 构建批量推送用户群
                for (String regId : regIdList)
                    regIds.add(regId);
                TargetMessage targetMessage = new TargetMessage.Builder().requestId(UUID.randomUUID().toString())
                        .regIds(regIds).taskId(taskId).build();// 构建批量推送的消息体
                result = sender.sendToList(targetMessage);// 批量推送给用户
            } else
            {
                result = sender.sendSingle(builder.regId(regIdList.get(0)).timeToLive(3600).build());
            }
            if (result.getResult() == 0)// 成功
            {
                return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java
@@ -1371,7 +1371,7 @@
            return null;
        }
    }
    /**
     * 获取商品的用户分成比例
     * 
@@ -1977,7 +1977,7 @@
                    if (content.contains("var _DATA_Mdskip")) {
                        content = content.replace("<script>", "");
                        content = content.replace("</script>", "");
                        if (content.contains("videoDetail")) {
                            content += ";function getData(){ var json={title:_DATA_Mdskip.item.title,pictUrl:_DATA_Mdskip.item.videoDetail.videoThumbnailURL};   return JSON.stringify(json);}";
                        } else {
@@ -2007,22 +2007,24 @@
        }
        return taoBaoGoodsBrief;
    }
    /**
     * 抖音返利local 获取真实淘宝链接
     * @param url https://s.click.taobao.com/t?e=m%3D2%26s%3DT9DFpHQCT7Rw4vFB6t2Z2ueEDrYVVa64XoO8tOebS+dRAdhuF14FMR8
     *
     * @param url
     *            https://s.click.taobao.com/t?e=m%3D2%26s%
     *            3DT9DFpHQCT7Rw4vFB6t2Z2ueEDrYVVa64XoO8tOebS+dRAdhuF14FMR8
     * @return
     */
    public static String getRealUrl(String url) {
        if (StringUtil.isNullOrEmpty(url))
            return null;
        try {
            HttpClient client = new HttpClient(new MultiThreadedHttpConnectionManager());
            client.getHttpConnectionManager().getParams().setConnectionTimeout(10000);
            client.getParams().setParameter(HttpMethodParams.USER_AGENT,"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"); // 让服务器认为是IE
            client.getParams().setParameter(HttpMethodParams.USER_AGENT,
                    "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"); // 让服务器认为是IE
            GetMethod get = new GetMethod(url);
            get.setFollowRedirects(false); // 禁止自动重定向
            int iGetResultCode = client.executeMethod(get);
@@ -2037,7 +2039,6 @@
        }
        return null;
    }
    /**
     * 淘口令过滤
@@ -2048,10 +2049,10 @@
    public static String filterTaoToken(String token) {
        if (StringUtil.isNullOrEmpty(token))
            return token;
        if (token.contains("¥")||token.contains("€")) {
        if (token.contains("¥") || token.contains("€")) {
            String newToken = "";
            for (int i = 0; i < token.length(); i++) {
                if (token.charAt(i) == '¥'||token.charAt(i) == '€') {
                if (token.charAt(i) == '¥' || token.charAt(i) == '€') {
                    if (!newToken.contains("("))
                        newToken += "(";
                    else
@@ -2063,8 +2064,12 @@
        }
        return token;
    }
    public static boolean isSpecialGoods(Integer materialLibType) {
        if (materialLibType != null && materialLibType == 1)
            return true;
        else
            return false;
    }
}
utils/src/main/java/org/yeshi/utils/entity/wx/WXAPPInfo.java
New file
@@ -0,0 +1,53 @@
package org.yeshi.utils.entity.wx;
public class WXAPPInfo {
    private String appId;
    private String appSecret;
    private String mchId;
    public WXAPPInfo(String appId, String appSecret, String mchId, String mchKey) {
        this.appId = appId;
        this.appSecret = appSecret;
        this.mchId = mchId;
        this.mchKey = mchKey;
    }
    public WXAPPInfo() {
    }
    private String mchKey;
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getAppSecret() {
        return appSecret;
    }
    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }
    public String getMchId() {
        return mchId;
    }
    public void setMchId(String mchId) {
        this.mchId = mchId;
    }
    public String getMchKey() {
        return mchKey;
    }
    public void setMchKey(String mchKey) {
        this.mchKey = mchKey;
    }
}
utils/src/main/java/org/yeshi/utils/entity/wx/WXPlaceOrderParams.java
New file
@@ -0,0 +1,86 @@
package org.yeshi.utils.entity.wx;
import java.math.BigDecimal;
/**
 * 微信支付统一下单参数
 *
 * @author Administrator
 *
 */
public class WXPlaceOrderParams {
    private String orderNo;
    private BigDecimal fee;
    private String openId;
    private String body;
    private String ip;
    private String tradeType;
    private String notifyUrl;
    private WXAPPInfo info;
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    public BigDecimal getFee() {
        return fee;
    }
    public void setFee(BigDecimal fee) {
        this.fee = fee;
    }
    public String getOpenId() {
        return openId;
    }
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    public String getBody() {
        return body;
    }
    public void setBody(String body) {
        this.body = body;
    }
    public String getIp() {
        return ip;
    }
    public void setIp(String ip) {
        this.ip = ip;
    }
    public String getTradeType() {
        return tradeType;
    }
    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }
    public WXAPPInfo getInfo() {
        return info;
    }
    public void setInfo(WXAPPInfo info) {
        this.info = info;
    }
    public String getNotifyUrl() {
        return notifyUrl;
    }
    public void setNotifyUrl(String notifyUrl) {
        this.notifyUrl = notifyUrl;
    }
}
utils/src/main/java/org/yeshi/utils/exception/WXPlaceOrderParamsException.java
New file
@@ -0,0 +1,28 @@
package org.yeshi.utils.exception;
public class WXPlaceOrderParamsException extends Exception {
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public WXPlaceOrderParamsException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public WXPlaceOrderParamsException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
utils/src/main/java/org/yeshi/utils/wx/WXPayUtil.java
@@ -8,6 +8,9 @@
import org.yeshi.utils.HttpUtil;
import org.yeshi.utils.StringUtil;
import org.yeshi.utils.entity.wx.RedPackParams;
import org.yeshi.utils.entity.wx.WXAPPInfo;
import org.yeshi.utils.entity.wx.WXPlaceOrderParams;
import org.yeshi.utils.exception.WXPlaceOrderParamsException;
/**
 * 微信支付帮助类
@@ -42,9 +45,9 @@
        return null;
    }
    /**
     * 发放微信红包
     *
     * @param params
     * @param pwd
     * @param cert
@@ -54,7 +57,7 @@
        // 转化成分
        BigDecimal money = params.getMoney();
        money = money.multiply(new BigDecimal(100)).setScale(0, BigDecimal.ROUND_DOWN);
        Map<String, String> map = new HashMap<>();
        map.put("nonce_str", StringUtil.getRandomCode(32));
        map.put("mch_billno", params.getBillno());
@@ -63,43 +66,46 @@
        map.put("send_name", params.getSendName());
        map.put("re_openid", params.getOpenid());
        map.put("total_amount", money.toString());
        map.put("total_num", params.getTotalNum()+ "");
        map.put("total_num", params.getTotalNum() + "");
        map.put("wishing", params.getWishing());
        map.put("client_ip", params.getClientIp());
        map.put("act_name", params.getActName());
        map.put("remark", params.getRemark());
        if (!StringUtil.isNullOrEmpty(params.getSceneId()))
            map.put("scene_id", params.getSceneId());
        if (!StringUtil.isNullOrEmpty(params.getRiskInfo()))
            map.put("risk_info", params.getRiskInfo());
        map.put("sign", WXUtil.getSignMD5(map, params.getKey()));
        String entity = WXUtil.loadWXMessage(map);
        try {
            String result = HttpUtil.httpsPost("https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack",
                    entity, pwd, cert);
            String result = HttpUtil.httpsPost("https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack", entity,
                    pwd, cert);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 查询红包领取记录
     * @param billno 商户订单号
     * @param mchId  商户号
     *
     * @param billno
     *            商户订单号
     * @param mchId
     *            商户号
     * @param key
     * @param appId Appid
     * @param appId
     *            Appid
     * @param pwd
     * @param cert
     * @return
     */
    public static String getRedPackRecord(String billno, String mchId,  String appId, String key,
            String pwd, InputStream cert) {
    public static String getRedPackRecord(String billno, String mchId, String appId, String key, String pwd,
            InputStream cert) {
        Map<String, String> map = new HashMap<>();
        map.put("mch_billno", billno);
        map.put("mch_id", mchId);
@@ -109,12 +115,78 @@
        map.put("sign", WXUtil.getSignMD5(map, key));
        String entity = WXUtil.loadWXMessage(map);
        try {
            String result = HttpUtil.httpsPost("https://api.mch.weixin.qq.com/mmpaymkttransfers/gethbinfo",
                    entity, pwd, cert);
            String result = HttpUtil.httpsPost("https://api.mch.weixin.qq.com/mmpaymkttransfers/gethbinfo", entity, pwd,
                    cert);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 微信支付统一下单
     *
     * @param params
     * @return
     * @throws WXPlaceOrderParamsException
     */
    public static Map<String, String> produceOrder(WXPlaceOrderParams params) throws WXPlaceOrderParamsException {
        if (params == null)
            throw new WXPlaceOrderParamsException(1, "请传入下单参数");
        if (params.getInfo() == null)
            throw new WXPlaceOrderParamsException(2, "请传入下单应用信息");
        if (StringUtil.isNullOrEmpty(params.getInfo().getAppId()))
            throw new WXPlaceOrderParamsException(201, "请传入下单应用信息-appId");
        if (StringUtil.isNullOrEmpty(params.getInfo().getAppSecret()))
            throw new WXPlaceOrderParamsException(202, "请传入下单应用信息-appSecret");
        if (StringUtil.isNullOrEmpty(params.getInfo().getMchId()))
            throw new WXPlaceOrderParamsException(203, "请传入下单应用信息-mchId");
        if (StringUtil.isNullOrEmpty(params.getInfo().getMchKey()))
            throw new WXPlaceOrderParamsException(204, "请传入下单应用信息-mchKey");
        if (StringUtil.isNullOrEmpty(params.getBody()))
            throw new WXPlaceOrderParamsException(3, "请传入body");
        if (StringUtil.isNullOrEmpty(params.getOrderNo()))
            throw new WXPlaceOrderParamsException(4, "请传入orderNo");
        if (params.getFee() == null)
            throw new WXPlaceOrderParamsException(5, "请传入fee");
        if (StringUtil.isNullOrEmpty(params.getIp()))
            throw new WXPlaceOrderParamsException(6, "请传入ip");
        if (StringUtil.isNullOrEmpty(params.getNotifyUrl()))
            throw new WXPlaceOrderParamsException(7, "请传入notifyUrl");
        if (StringUtil.isNullOrEmpty(params.getTradeType()))
            throw new WXPlaceOrderParamsException(8, "请传入tradeType");
//        if (StringUtil.isNullOrEmpty(params.getOpenId()))
//            throw new WXPlaceOrderParamsException(9, "请传入openId");
        Map<String, String> map = new HashMap<String, String>();
        map.put("appid", params.getInfo().getAppId());
        map.put("mch_id", params.getInfo().getMchId());
        map.put("nonce_str", StringUtil.getRandomCode(32));
        map.put("body", params.getBody());
        map.put("out_trade_no", params.getOrderNo());
        map.put("total_fee", "" + params.getFee().multiply(new BigDecimal(100)).intValue());
        map.put("spbill_create_ip", params.getIp());
        map.put("notify_url", params.getNotifyUrl());
        map.put("trade_type", params.getTradeType());
        if (!StringUtil.isNullOrEmpty(params.getOpenId()))
            map.put("openid", params.getOpenId());
        map.put("sign", WXUtil.getSignMD5(map, params.getInfo().getMchKey()));
        String entity = WXUtil.loadWXMessage(map);
        String result = HttpUtil.post("https://api.mch.weixin.qq.com/pay/unifiedorder", entity);
        System.out.println("统一下单结果:" + result);
        Map<String, String> resultMap = WXUtil.parseXML(result);
        return resultMap;
    }
}