Merge remote-tracking branch 'origin/div' into div
Conflicts:
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgMoneyDetail.java
fanli/src/main/java/com/yeshi/fanli/entity/money/UserMoneyDetail.java
fanli/src/main/java/com/yeshi/fanli/service/inter/money/msg/UserMoneyMsgNotificationService.java
| | |
| | | /target/
|
| | | /.settings/
|
| | | druid.properties
|
| | | .classpath
|
| | | .project
|
| | | Constant.java |
| | | /error.log |
| | | /.gitignore |
| | |
| | | KEY = Constant.systemCommonConfig.getSignKey();
|
| | | }
|
| | |
|
| | | @Around(EDP)
|
| | | // @Around(EDP)
|
| | | public Object testAround(ProceedingJoinPoint joinPoint) throws IOException {
|
| | | Object[] args = joinPoint.getArgs();
|
| | | PrintWriter out = null;
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord; |
| | | |
| | | public interface ExtractWeiXinRecordMapper extends BaseMapper<ExtractWeiXinRecord> { |
| | | |
| | | } |
| | |
| | | @Table("yeshi_ec_msg_money")
|
| | | public class MsgMoneyDetail {
|
| | | public enum MsgTypeMoneyTypeEnum {
|
| | | share("分享奖金"), invite("邀请奖金"), fanli("返利到账"), extract("提现"), extractValid("提现账号验证"), shareWeiQuan(
|
| | | "分享奖金扣除"), inviteWeiQuan("邀请奖金扣除"), fanliWeiQuan("返利扣除"), orderReward("返利奖励"), systemEqualize("系统补齐"),fanliElme("返利到账");
|
| | | |
| | | share("分享奖金"), invite("邀请奖金"), fanli("返利到账"), extract("提现"), extractAutoWX("自动提现"), extractValid("提现账号验证"), shareWeiQuan(
|
| | | "分享奖金扣除"), inviteWeiQuan("邀请奖金扣除"), fanliWeiQuan("返利扣除"), orderReward("返利奖励"), systemEqualize("系统补齐"),fanliElme("返利到账"); |
| | | private final String desc;
|
| | |
|
| | | private MsgTypeMoneyTypeEnum(String desc) {
|
| | |
| | | private BigDecimal balance;// 账户余额
|
| | | @Column(name = "mm_state_desc")
|
| | | private String stateDesc;// 状态说明
|
| | | @Column(name = "mm_desc")
|
| | | private String desc;// 说明
|
| | | @Column(name = "mm_beizhu")
|
| | | private String beiZhu;// 备注
|
| | | @Column(name = "mm_create_time")
|
| | |
| | | this.orderType = orderType;
|
| | | }
|
| | |
|
| | | public String getDesc() {
|
| | | return desc;
|
| | | }
|
| | |
|
| | | public void setDesc(String desc) {
|
| | | this.desc = desc;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | | /**
|
| | | * 微信自动提现记录
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_extract_weixin_record")
|
| | | public class ExtractWeiXinRecord {
|
| | |
|
| | | public static int TYPE_MANUAL = 1;// 手动 |
| | | public static int TYPE_AUTO = 2; // 自动
|
| | | |
| | | public static String SENDING = "SENDING";// 发放中 |
| | | public static String SENT = "SENT"; // 已发放待领取 |
| | | public static String FAILED = "FAILED"; // 发放失败 |
| | | public static String RECEIVED = "RECEIVED"; // 已领取
|
| | | public static String RFUND_ING = "RFUND_ING"; // 退款中 |
| | | public static String REFUND = "REFUND"; // 已退款
|
| | | |
| | | @Column(name = "aer_id")
|
| | | private Long id;
|
| | |
|
| | | // 用户id
|
| | | @Column(name = "aer_uid")
|
| | | private Long uid;
|
| | | |
| | | // openId
|
| | | @Column(name = "aer_open_id")
|
| | | private String openId;
|
| | |
|
| | | // unionId
|
| | | @Column(name = "aer_union_id")
|
| | | private String unionId;
|
| | | |
| | | // 交易金额
|
| | | @Column(name = "aer_money")
|
| | | private BigDecimal money;
|
| | | |
| | | // 交易订单号
|
| | | @Expose
|
| | | @Column(name = "aer_billno")
|
| | | private String billno;
|
| | | |
| | | // 红包订单-微信
|
| | | @Column(name = "aer_detailno")
|
| | | private String detailno;
|
| | |
|
| | | // 红包状态-微信
|
| | | @Column(name = "aer_status")
|
| | | private String status;
|
| | | |
| | | // 发出时间-微信
|
| | | @Column(name = "aer_send_time")
|
| | | private Date sendTime;
|
| | | |
| | | // 接收时间-微信
|
| | | @Column(name = "aer_rcv_time")
|
| | | private Date rcvTime;
|
| | | |
| | | // 发放类型-微信
|
| | | @Column(name = "aer_send_type")
|
| | | private String sendType;
|
| | | |
| | | // 红包类型-微信
|
| | | @Column(name = "aer_hb_type")
|
| | | private String hbType;
|
| | | |
| | | // 红包个数-微信
|
| | | @Column(name = "aer_total_num")
|
| | | private Integer totalNum;
|
| | | |
| | | // 发送方式:1手动 2自动
|
| | | @Column(name = "aer_type")
|
| | | private Integer type;
|
| | | |
| | | @Column(name = "aer_create_time")
|
| | | private Date createTime;
|
| | | |
| | | @Column(name = "aer_update_time")
|
| | | private Date updateTime;
|
| | | |
| | | |
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public String getOpenId() {
|
| | | return openId;
|
| | | }
|
| | |
|
| | | public void setOpenId(String openId) {
|
| | | this.openId = openId;
|
| | | }
|
| | |
|
| | | public String getUnionId() {
|
| | | return unionId;
|
| | | }
|
| | |
|
| | | public void setUnionId(String unionId) {
|
| | | this.unionId = unionId;
|
| | | }
|
| | |
|
| | | public BigDecimal getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(BigDecimal money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | public String getBillno() {
|
| | | return billno;
|
| | | }
|
| | |
|
| | | public void setBillno(String billno) {
|
| | | this.billno = billno;
|
| | | }
|
| | |
|
| | | public String getDetailno() {
|
| | | return detailno;
|
| | | }
|
| | |
|
| | | public void setDetailno(String detailno) {
|
| | | this.detailno = detailno;
|
| | | }
|
| | |
|
| | | public String getStatus() {
|
| | | return status;
|
| | | }
|
| | |
|
| | | public void setStatus(String status) {
|
| | | this.status = status;
|
| | | }
|
| | |
|
| | | public Date getSendTime() {
|
| | | return sendTime;
|
| | | }
|
| | |
|
| | | public void setSendTime(Date sendTime) {
|
| | | this.sendTime = sendTime;
|
| | | }
|
| | |
|
| | | public Date getRcvTime() {
|
| | | return rcvTime;
|
| | | }
|
| | |
|
| | | public void setRcvTime(Date rcvTime) {
|
| | | this.rcvTime = rcvTime;
|
| | | }
|
| | |
|
| | | 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 String getSendType() {
|
| | | return sendType;
|
| | | }
|
| | |
|
| | | public void setSendType(String sendType) {
|
| | | this.sendType = sendType;
|
| | | }
|
| | |
|
| | | public String getHbType() {
|
| | | return hbType;
|
| | | }
|
| | |
|
| | | public void setHbType(String hbType) {
|
| | | this.hbType = hbType;
|
| | | }
|
| | |
|
| | | public Integer getTotalNum() {
|
| | | return totalNum;
|
| | | }
|
| | |
|
| | | public void setTotalNum(Integer totalNum) {
|
| | | this.totalNum = totalNum;
|
| | | }
|
| | |
|
| | | public Integer getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(Integer type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Column(name = "uie_auto_extract")
|
| | | private Boolean autoExtract;
|
| | |
|
| | | //微信自动提现关闭日期
|
| | | @Column(name = "uie_close_time_extract")
|
| | | private Date closeTimeExtract;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "uie_create_time")
|
| | |
| | | this.autoExtract = autoExtract;
|
| | | }
|
| | |
|
| | | public Date getCloseTimeExtract() {
|
| | | return closeTimeExtract;
|
| | | }
|
| | |
|
| | | public void setCloseTimeExtract(Date closeTimeExtract) {
|
| | | this.closeTimeExtract = closeTimeExtract;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), weiQuan("售后订单扣款", "http://img.flqapp.com/resource/money_detail/icon_fanli.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), systemEqualize("系统补齐", "http://img.flqapp.com/resource/money_detail/icon_system.png", ""), scoreConvert("金币兑换", "http://img.flqapp.com/resource/money_detail/icon_score.png",
|
| | | ""), hongbao("官方红包", "http://img.flqapp.com/resource/money_detail/icon_hongbao.png", ""), hongbaoDeduct("红包退款", "http://img.flqapp.com/resource/money_detail/icon_hongbao.png",
|
| | | ""), buyScore("购买积分", "http://img.flqapp.com/resource/money_detail/icon_score.png", ""), extract("提现", "http://img.flqapp.com/resource/money_detail/icon_extract.png",
|
| | | ""), extractVerify("提现验证", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""), extractReject("提现被拒", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""),orderReward("返利奖励金","http://img.flqapp.com/resource/money_detail/icon_order_reward.png",""),repeatStatistic("重复统计返利/奖金扣除","http://img.flqapp.com/resource/money_detail/icon_fanli.png",""),
|
| | | elmeFanli("饿了么返利到账","http://img.flqapp.com/resource/money_detail/icon_fanli.png","")
|
| | | ;
|
| | | ""), extractVerify("提现验证", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""), extractReject("提现被拒", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""),orderReward("返利奖励金","http://img.flqapp.com/resource/money_detail/icon_order_reward.png",""),repeatStatistic("重复统计返利/奖金扣除","http://img.flqapp.com/resource/money_detail/icon_fanli.png",""), |
| | | elmeFanli("饿了么返利到账","http://img.flqapp.com/resource/money_detail/icon_fanli.png",""),
|
| | | |
| | | extractAutoWX("自动提现", "http://img.flqapp.com/resource/money_detail/icon_extract.png", "");
|
| | | |
| | | private final String desc;
|
| | | private final String picture;
|
| | | private final String helpUrl;
|
New file |
| | |
| | | <?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.ExtractWeiXinRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord"> |
| | | <id column="aer_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="aer_uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="aer_open_id" property="openId" jdbcType="VARCHAR"/> |
| | | <result column="aer_union_id" property="unionId" jdbcType="VARCHAR"/> |
| | | <result column="aer_money" property="money" jdbcType="DECIMAL"/> |
| | | <result column="aer_billno" property="billno" jdbcType="VARCHAR"/> |
| | | <result column="aer_detailno" property="detailno" jdbcType="VARCHAR"/> |
| | | <result column="aer_status" property="status" jdbcType="VARCHAR"/> |
| | | <result column="aer_send_time" property="sendTime" jdbcType="TIMESTAMP"/> |
| | | <result column="aer_rcv_time" property="rcvTime" jdbcType="TIMESTAMP"/> |
| | | <result column="aer_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="aer_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">aer_id,aer_uid,aer_open_id,aer_union_id,aer_money,aer_billno,aer_detailno,aer_status,aer_send_time,aer_rcv_time,aer_create_time,aer_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_extract_weixin_record where aer_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_extract_weixin_record where aer_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_extract_weixin_record (aer_id,aer_uid,aer_open_id,aer_union_id,aer_money,aer_billno,aer_detailno,aer_status,aer_send_time,aer_rcv_time,aer_create_time,aer_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{openId,jdbcType=VARCHAR},#{unionId,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{billno,jdbcType=VARCHAR},#{detailno,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR},#{sendTime,jdbcType=TIMESTAMP},#{rcvTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_extract_weixin_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">aer_id,</if> |
| | | <if test="uid != null">aer_uid,</if> |
| | | <if test="openId != null">aer_open_id,</if> |
| | | <if test="unionId != null">aer_union_id,</if> |
| | | <if test="money != null">aer_money,</if> |
| | | <if test="billno != null">aer_billno,</if> |
| | | <if test="detailno != null">aer_detailno,</if> |
| | | <if test="status != null">aer_status,</if> |
| | | <if test="sendTime != null">aer_send_time,</if> |
| | | <if test="rcvTime != null">aer_rcv_time,</if> |
| | | <if test="createTime != null">aer_create_time,</if> |
| | | <if test="updateTime != null">aer_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="openId != null">#{openId,jdbcType=VARCHAR},</if> |
| | | <if test="unionId != null">#{unionId,jdbcType=VARCHAR},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="billno != null">#{billno,jdbcType=VARCHAR},</if> |
| | | <if test="detailno != null">#{detailno,jdbcType=VARCHAR},</if> |
| | | <if test="status != null">#{status,jdbcType=VARCHAR},</if> |
| | | <if test="sendTime != null">#{sendTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="rcvTime != null">#{rcvTime,jdbcType=TIMESTAMP},</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.bus.user.ExtractWeiXinRecord">update yeshi_ec_extract_weixin_record set aer_uid = #{uid,jdbcType=BIGINT},aer_open_id = #{openId,jdbcType=VARCHAR},aer_union_id = #{unionId,jdbcType=VARCHAR},aer_money = #{money,jdbcType=DECIMAL},aer_billno = #{billno,jdbcType=VARCHAR},aer_detailno = #{detailno,jdbcType=VARCHAR},aer_status = #{status,jdbcType=VARCHAR},aer_send_time = #{sendTime,jdbcType=TIMESTAMP},aer_rcv_time = #{rcvTime,jdbcType=TIMESTAMP},aer_create_time = #{createTime,jdbcType=TIMESTAMP},aer_update_time = #{updateTime,jdbcType=TIMESTAMP} where aer_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord">update yeshi_ec_extract_weixin_record |
| | | <set> |
| | | <if test="uid != null">aer_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="openId != null">aer_open_id=#{openId,jdbcType=VARCHAR},</if> |
| | | <if test="unionId != null">aer_union_id=#{unionId,jdbcType=VARCHAR},</if> |
| | | <if test="money != null">aer_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="billno != null">aer_billno=#{billno,jdbcType=VARCHAR},</if> |
| | | <if test="detailno != null">aer_detailno=#{detailno,jdbcType=VARCHAR},</if> |
| | | <if test="status != null">aer_status=#{status,jdbcType=VARCHAR},</if> |
| | | <if test="sendTime != null">aer_send_time=#{sendTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="rcvTime != null">aer_rcv_time=#{rcvTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">aer_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">aer_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where aer_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | <result column="mm_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="mm_read" property="read" jdbcType="BOOLEAN" /> |
| | | <result column="mm_order_type" property="orderType" jdbcType="INTEGER" /> |
| | | <result column="mm_desc" property="desc" jdbcType="VARCHAR" /> |
| | | <association property="user" column="mm_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="mm_uid" property="id" jdbcType="BIGINT" /> |
| | |
| | | <association property="alipayAccountValid" column="mm_source_id_alipayvalid" |
| | | select="com.yeshi.fanli.dao.mybatis.AlipayAccountValidNormalHistoryMapper.selectByPrimaryKey" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">mm_id,mm_uid,mm_type,mm_order_count,mm_goods_count,mm_order_id,mm_source_id,mm_money,mm_balance,mm_state_desc,mm_beizhu,mm_create_time,mm_update_time,mm_read,mm_order_type |
| | | <sql id="Base_Column_List">mm_id,mm_uid,mm_type,mm_order_count,mm_goods_count,mm_order_id,mm_source_id,mm_money,mm_balance,mm_state_desc,mm_beizhu,mm_create_time,mm_update_time,mm_read,mm_order_type,mm_desc |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_money |
| | | (mm_id,mm_uid,mm_type,mm_order_count,mm_goods_count,mm_order_id,mm_source_id,mm_money,mm_balance,mm_state_desc,mm_beizhu,mm_create_time,mm_update_time,mm_read,mm_order_type) |
| | | (mm_id,mm_uid,mm_type,mm_order_count,mm_goods_count,mm_order_id,mm_source_id,mm_money,mm_balance,mm_state_desc,mm_beizhu,mm_create_time,mm_update_time,mm_read,mm_order_type,mm_desc) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{msgType,jdbcType=VARCHAR},#{orderCount,jdbcType=INTEGER},#{goodsCount,jdbcType=INTEGER},#{orderId,jdbcType=VARCHAR},#{extract.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{balance,jdbcType=DECIMAL},#{stateDesc,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{read,jdbcType=BOOLEAN},#{orderType,jdbcType=INTEGER}) |
| | | (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{msgType,jdbcType=VARCHAR},#{orderCount,jdbcType=INTEGER},#{goodsCount,jdbcType=INTEGER},#{orderId,jdbcType=VARCHAR},#{extract.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{balance,jdbcType=DECIMAL},#{stateDesc,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{read,jdbcType=BOOLEAN},#{orderType,jdbcType=INTEGER},#{desc,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="updateTime != null">mm_update_time,</if> |
| | | <if test="read != null">mm_read,</if> |
| | | <if test="orderType != null">mm_order_type,</if> |
| | | <if test="desc != null">mm_desc,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="read != null">#{read,jdbcType=BOOLEAN},</if> |
| | | <if test="orderType != null">#{orderType,jdbcType=INTEGER}</if> |
| | | <if test="desc != null">#{desc,jdbcType=VARCHAR},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail">update |
| | |
| | | #{beiZhu,jdbcType=VARCHAR},mm_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},mm_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP},mm_read = #{read,jdbcType=BOOLEAN} |
| | | ,mm_order_type =#{orderType,jdbcType=INTEGER} where mm_id = |
| | | ,mm_order_type =#{orderType,jdbcType=INTEGER}, |
| | | mm_desc = #{desc,jdbcType=VARCHAR} where mm_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail"> |
| | |
| | | <if test="updateTime != null">mm_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="read != null">mm_read=#{read,jdbcType=BOOLEAN},</if> |
| | | <if test="orderType !=null">mm_order_type =#{orderType,jdbcType=INTEGER},</if> |
| | | <if test="desc != null">mm_desc=#{desc,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where mm_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
|
| | | <result column="uie_auto_extract" property="autoExtract"
|
| | | jdbcType="BOOLEAN" />
|
| | | <result column="uie_close_time_extract" property="closeTimeExtract" jdbcType="TIMESTAMP" />
|
| | |
|
| | | <association property="userInfo" column="uie_uid"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
|
| | |
| | | <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
|
| | | <result column="uie_auto_extract" property="autoExtract"
|
| | | jdbcType="BOOLEAN" />
|
| | | |
| | | <result column="uie_close_time_extract" property="closeTimeExtract" jdbcType="TIMESTAMP" />
|
| | | |
| | | <association property="userInfo" column="uie_uid"
|
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" />
|
| | |
|
| | |
| | | <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
|
| | | <result column="uie_auto_extract" property="autoExtract"
|
| | | jdbcType="BOOLEAN" />
|
| | | |
| | | <result column="uie_close_time_extract" property="closeTimeExtract" jdbcType="TIMESTAMP" />
|
| | | |
| | | <association property="userInfo" column="uie_uid"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
|
| | | <id column="uie_uid" property="id" jdbcType="BIGINT" />
|
| | |
| | |
|
| | |
|
| | |
|
| | | <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract
|
| | | <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract,uie_close_time_extract
|
| | | </sql>
|
| | |
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into
|
| | | yeshi_ec_user_info_extra
|
| | | (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract)
|
| | | (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract,uie_close_time_extract)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{couponNews,jdbcType=INTEGER},#{synchNavbar,jdbcType=VARCHAR},#{firstLoginTime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{weiXin,jdbcType=VARCHAR},#{goldCoin,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{autoExtract,jdbcType=BOOLEAN})
|
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{couponNews,jdbcType=INTEGER},#{synchNavbar,jdbcType=VARCHAR},#{firstLoginTime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{weiXin,jdbcType=VARCHAR},#{goldCoin,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{autoExtract,jdbcType=BOOLEAN},#{closeTimeExtract,jdbcType=TIMESTAMP})
|
| | | </insert>
|
| | |
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra"
|
| | |
| | | <if test="createTime != null">uie_create_time,</if>
|
| | | <if test="updateTime != null">uie_update_time,</if>
|
| | | <if test="autoExtract != null">uie_auto_extract,</if>
|
| | | <if test="closeTimeExtract != null">uie_close_time_extract,</if>
|
| | | </trim>
|
| | | values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="autoExtract != null">#{autoExtract,jdbcType=BOOLEAN},</if>
|
| | | <if test="closeTimeExtract != null">#{closeTimeExtract,jdbcType=TIMESTAMP},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update
|
| | |
| | | #{goldCoin,jdbcType=INTEGER},uie_create_time =
|
| | | #{createTime,jdbcType=TIMESTAMP},uie_update_time =
|
| | | #{updateTime,jdbcType=TIMESTAMP},uie_auto_extract =
|
| | | #{autoExtract,jdbcType=BOOLEAN} where uie_id = #{id,jdbcType=BIGINT}
|
| | | #{autoExtract,jdbcType=BOOLEAN},uie_close_time_extract =
|
| | | #{closeTimeExtract,jdbcType=TIMESTAMP} where uie_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
|
| | | update yeshi_ec_user_info_extra
|
| | |
| | | </if>
|
| | | <if test="couponNews != null">uie_coupon_news=#{couponNews,jdbcType=INTEGER},</if>
|
| | | <if test="synchNavbar != null">uie_synch_navbar=#{synchNavbar,jdbcType=VARCHAR},</if>
|
| | | <if test="firstLoginTime != null">uie_first_login_time=#{firstLoginTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="firstLoginTime != null">uie_first_login_time=#{firstLoginTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="sex != null">uie_sex=#{sex,jdbcType=INTEGER},</if>
|
| | | <if test="weiXin != null">uie_weixin=#{weiXin,jdbcType=VARCHAR},</if>
|
| | | <if test="goldCoin != null">uie_gold_coin=#{goldCoin,jdbcType=INTEGER},</if>
|
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="autoExtract != null">uie_auto_extract=#{autoExtract,jdbcType=BOOLEAN},</if>
|
| | | <if test="closeTimeExtract != null">uie_close_time_extract=#{closeTimeExtract,jdbcType=TIMESTAMP},</if>
|
| | | </set>
|
| | | where uie_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | |
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="autoExtract != null">uie_auto_extract=#{autoExtract,jdbcType=BOOLEAN},</if>
|
| | | <if test="closeTimeExtract != null">uie_close_time_extract=#{closeTimeExtract,jdbcType=TIMESTAMP},</if>
|
| | | </set>
|
| | | where uie_uid = #{userInfo.id,jdbcType=BIGINT}
|
| | | </update>
|
| | |
| | | package com.yeshi.fanli.service.impl.money.extract;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.dom4j.Document;
|
| | | import org.dom4j.DocumentException;
|
| | | import org.dom4j.DocumentHelper;
|
| | | import org.dom4j.Element;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.entity.wx.RedPackParams;
|
| | | import org.yeshi.utils.wx.WXPayUtil;
|
| | |
|
| | | import com.alipay.api.AlipayApiException;
|
| | | import com.alipay.api.AlipayClient;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.PayInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory;
|
| | |
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractRecordService;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractWeiXinRecordService;
|
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.OrderUserStatisticService;
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderUserStatisticService orderUserStatisticService;
|
| | | |
| | | @Resource
|
| | | private ExtractWeiXinRecordService extractWeiXinRecordService;
|
| | | |
| | |
|
| | | @Transactional
|
| | | public Integer addExtract(Extract extract) {
|
| | |
| | | else
|
| | | return money;
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void autoExtract(UserInfo user) {
|
| | | if (user == null || user.getWxOpenId() == null || user.getWxUnionId() == null ||
|
| | | user.getState() != UserInfo.STATE_NORMAL)
|
| | | return;
|
| | | |
| | | Date date = new Date();
|
| | | BigDecimal money = new BigDecimal(Constant.AUTO_EXTRACT_MONEY);
|
| | | |
| | | // 1、插入记录
|
| | | ExtractWeiXinRecord extractRecord = new ExtractWeiXinRecord();
|
| | | extractRecord.setUid(user.getId());
|
| | | extractRecord.setOpenId(user.getWxOpenId());
|
| | | extractRecord.setUnionId(user.getWxUnionId() );
|
| | | extractRecord.setMoney(money);
|
| | | extractRecord.setCreateTime(date);
|
| | | extractRecord.setUpdateTime(date);
|
| | | extractWeiXinRecordService.insertSelective(extractRecord);
|
| | | |
| | | // 交易号
|
| | | Long recordId = extractRecord.getId();
|
| | | String billno = "BanLiExtract" + recordId;
|
| | | |
| | | // 更新记录
|
| | | ExtractWeiXinRecord updeteRecord = null;
|
| | | |
| | | String mchId = "1520950211";
|
| | | String appId = "wx5c0d167c6e3ad726";
|
| | | String key = "XYJkJ2018FAfaodCCx899mLl138rfGVd";
|
| | | |
| | | // 2、发放微信红包
|
| | | RedPackParams redPackParams = new RedPackParams();
|
| | | redPackParams.setBillno(billno);
|
| | | redPackParams.setMchId(mchId);
|
| | | redPackParams.setWxappId(appId);
|
| | | redPackParams.setSendName("板栗快省");
|
| | | redPackParams.setOpenid(user.getWxOpenId());
|
| | | redPackParams.setMoney(money);
|
| | | redPackParams.setTotalNum(1);
|
| | | redPackParams.setWishing("账户中剩余余额请在本App内完成提现");
|
| | | redPackParams.setClientIp("106.80.118.163");
|
| | | redPackParams.setActName("自动提现");
|
| | | redPackParams.setKey(key);
|
| | | redPackParams.setRemark("微信自动提现");
|
| | | //redPackParams.setSceneId(null);
|
| | | //redPackParams.setRiskInfo(null);
|
| | | |
| | | |
| | | // 发生红包状态
|
| | | boolean stateRedPack = false;
|
| | | |
| | | String pwd = "1520950211";
|
| | | InputStream cert = ExtractServiceImpl.class.getClassLoader().getResourceAsStream("certificate/apiclient_cert.p12"); // 读取.p12文件
|
| | | // 执行发放红包
|
| | | try {
|
| | | String result = WXPayUtil.redPackToOpenId(redPackParams, pwd, cert);
|
| | | if (!StringUtil.isNullOrEmpty(result)) {
|
| | | stateRedPack = parseSendResult(result);
|
| | | }
|
| | | |
| | | if (!stateRedPack) {
|
| | | String redPackRecord = WXPayUtil.getRedPackRecord(billno, mchId, appId, key, pwd, cert);
|
| | | if (!StringUtil.isNullOrEmpty(redPackRecord)) {
|
| | | updeteRecord = parseDTO(redPackRecord);
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | String redPackRecord = WXPayUtil.getRedPackRecord(billno, mchId, appId, key, pwd, cert);
|
| | | if (!StringUtil.isNullOrEmpty(redPackRecord)) {
|
| | | updeteRecord = parseDTO(redPackRecord);
|
| | | }
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | try {
|
| | | cert.close();
|
| | | } catch (IOException e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | |
| | | // 更新信息
|
| | | if (updeteRecord == null) {
|
| | | updeteRecord = new ExtractWeiXinRecord();
|
| | | } else {
|
| | | stateRedPack = true;
|
| | | }
|
| | | |
| | | updeteRecord.setId(recordId);
|
| | | updeteRecord.setStatus(ExtractWeiXinRecord.SENDING);
|
| | | updeteRecord.setBillno(billno);
|
| | | extractWeiXinRecordService.updateByPrimaryKeySelective(updeteRecord);
|
| | | |
| | | // 红包发放失败
|
| | | if (!stateRedPack) |
| | | return; |
| | | |
| | | // 3、加入资金明细
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extractAutoWX.name() + ":" + recordId));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.extractAutoWX.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.extractAutoWX);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(user);
|
| | | try {
|
| | | userMoneyDetailService.addUserMoneyDetail(detail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | |
| | | // 4、发送消息通知
|
| | | String desc = "为保障你的账户余额安全,自动提现金额将不会高于5元";
|
| | | String beizu = "账户中剩余余额请在本App内完成提现";
|
| | | userMoneyMsgNotificationService.extractAuto(extractRecord, "未领取-提现中", desc, beizu);
|
| | | }
|
| | |
|
| | | |
| | | private boolean parseSendResult(String result) {
|
| | | try {
|
| | | Document document = DocumentHelper.parseText(result);
|
| | | // 获取根节点元素对象
|
| | | Element root = document.getRootElement();
|
| | | Element returnCode = root.element("return_code");
|
| | | |
| | | if (!"SUCCESS".equalsIgnoreCase(returnCode.getText())) {
|
| | | Element returnMsg = root.element("return_msg");
|
| | | System.out.println(returnMsg.getText()); |
| | | return false;
|
| | | } |
| | | |
| | | Element resultCode = root.element("result_code");
|
| | | if (!"SUCCESS".equalsIgnoreCase(resultCode.getText())) {
|
| | | Element errCode = root.element("err_code");
|
| | | Element errCodeDes = root.element("err_code_des");
|
| | | System.out.println(errCode.getText() + ":" + errCodeDes.getText()); |
| | | return false;
|
| | | }
|
| | | return true;
|
| | | } catch (DocumentException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | return false;
|
| | | }
|
| | | |
| | | |
| | | private ExtractWeiXinRecord parseDTO(String result) {
|
| | | try {
|
| | | |
| | | Document document = DocumentHelper.parseText(result);
|
| | | // 获取根节点元素对象
|
| | | Element root = document.getRootElement();
|
| | | Element returnCode = root.element("return_code");
|
| | | |
| | | if (!"SUCCESS".equalsIgnoreCase(returnCode.getText())) {
|
| | | Element returnMsg = root.element("return_msg");
|
| | | System.out.println(returnMsg.getText()); |
| | | return null;
|
| | | } |
| | | |
| | | Element resultCode = root.element("result_code");
|
| | | if (!"SUCCESS".equalsIgnoreCase(resultCode.getText())) {
|
| | | Element errCode = root.element("err_code");
|
| | | Element errCodeDes = root.element("err_code_des");
|
| | | System.out.println(errCode.getText() + ":" + errCodeDes.getText()); |
| | | }
|
| | | |
| | | ExtractWeiXinRecord resultRecord = new ExtractWeiXinRecord();
|
| | | resultRecord.setBillno(root.element("result_code").getText());
|
| | | resultRecord.setDetailno(root.element("detail_id").getText());
|
| | | resultRecord.setStatus(root.element("status").getText());
|
| | | resultRecord.setSendType(root.element("send_type").getText());
|
| | | resultRecord.setHbType(root.element("result_code").getText());
|
| | | |
| | | String totalNum = root.element("total_num").getText();
|
| | | resultRecord.setTotalNum(Integer.parseInt(totalNum));
|
| | | |
| | | String sendTime = root.element("send_time").getText();
|
| | | resultRecord.setSendTime(new Date(TimeUtil.convertDateToTemp2(sendTime)));
|
| | | |
| | | Element element = root.element("hblist");
|
| | | Iterator<?> iterator = element.elementIterator();
|
| | | while (iterator.hasNext()) {
|
| | | Element childElement = (Element)iterator.next();
|
| | | Element rcvTime = childElement.element("rcv_time");
|
| | | resultRecord.setRcvTime(new Date(TimeUtil.convertDateToTemp2(rcvTime.getText())));
|
| | | break;
|
| | | } |
| | | return resultRecord;
|
| | | |
| | | } catch (DocumentException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | | public void downAutoOpenIdFile() {
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.money.extract;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.ExtractWeiXinRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractWeiXinRecordService;
|
| | |
|
| | | @Service
|
| | | public class ExtractWeiXinRecordServiceImpl implements ExtractWeiXinRecordService {
|
| | | |
| | | @Resource
|
| | | private ExtractWeiXinRecordMapper extractWeiXinRecordMapper;
|
| | |
|
| | | |
| | | @Override
|
| | | public void insertSelective(ExtractWeiXinRecord record) {
|
| | | extractWeiXinRecordMapper.insertSelective(record);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void updateByPrimaryKeySelective(ExtractWeiXinRecord record) {
|
| | | extractWeiXinRecordMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dto.push.PushContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord;
|
| | | import com.yeshi.fanli.entity.config.push.PushMsgFactory;
|
| | | import com.yeshi.fanli.exception.msg.MsgMoneyDetailException;
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Async
|
| | | @Override
|
| | | public void extractAuto(ExtractWeiXinRecord extractRecord, String stateDesc, String desc, String beiZhu) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractAutoMsg(extractRecord, stateDesc, desc, beiZhu);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public void extractFail(Extract extract, String stateDesc) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractFailMsg(extract, extract.getUserInfo().getId(),
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.exception.ExtractException;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | |
| | | * @return
|
| | | */
|
| | | public BigDecimal sumVerifyingMoney(Long uid);
|
| | |
|
| | | |
| | | /**
|
| | | * 自动提现-微信
|
| | | * @param user
|
| | | */
|
| | | public void autoExtract(UserInfo user);
|
| | |
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.money.extract;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord;
|
| | |
|
| | | public interface ExtractWeiXinRecordService {
|
| | |
|
| | | public void insertSelective(ExtractWeiXinRecord record);
|
| | |
|
| | | public void updateByPrimaryKeySelective(ExtractWeiXinRecord record);
|
| | | |
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord;
|
| | |
|
| | | /**
|
| | | * 用户资金消息通知
|
| | |
| | |
|
| | | /**
|
| | | * 饿了么返利到账
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | |
| | | */
|
| | | public void elmeFanli(Long uid, String orderId, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | /*
|
| | | * 自动提现消息-微信
|
| | | * |
| | | * @param extractRecord
|
| | | * |
| | | * @param stateDesc
|
| | | * |
| | | * @param desc
|
| | | * |
| | | * @param beiZhu
|
| | | */
|
| | | public void extractAuto(ExtractWeiXinRecord extractRecord, String stateDesc, String desc, String beiZhu);
|
| | |
|
| | | }
|
| | |
| | | public static final int TOKEN_DAYS = 1;
|
| | | // 赠送有效期-天
|
| | | public static final int GIVE_DAYS = 1;
|
| | | |
| | | |
| | | // 微信自动提现金额
|
| | | public static final int AUTO_EXTRACT_MONEY = 1;
|
| | |
|
| | | public static WXGZConfig wxGZConfig;
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 自动提现
|
| | | * |
| | | * @param extract
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgMoneyDetail createExtractAutoMsg(ExtractWeiXinRecord extractRecord, String stateDesc, |
| | | String desc, String beiZhu) {
|
| | | if (extractRecord == null)
|
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setUser(new UserInfo(extractRecord.getUid()));
|
| | | detail.setRead(false);
|
| | | detail.setMoney(extractRecord.getMoney());
|
| | | detail.setMsgType(MsgTypeMoneyTypeEnum.extractAutoWX);
|
| | | detail.setExtract(new Extract(extractRecord.getId()));
|
| | | detail.setStateDesc(stateDesc);
|
| | | detail.setDesc(desc);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 提现失败消息
|
| | | *
|
| | | * @param extract
|
| | |
| | | return new UserMsgVO("http://img.flqapp.com/resource/money_detail/icon_system.png",
|
| | | msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
|
| | | items);
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.extractAutoWX) { // 微信自动提现
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("自动提现微信红包成功推送", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("类别", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getStateDesc(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(filterMoney(msg.getMoney()) + "元", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getDesc(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("说明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/money_detail/icon_system.png",
|
| | | msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
|
| | | items);
|
| | | }
|
| | |
|
| | | return null;
|
| | |
| | | if (content.contains("var _DATA_Mdskip")) {
|
| | | content = content.replace("<script>", "");
|
| | | content = content.replace("</script>", "");
|
| | | content += ";function getData(){ var json={title:_DATA_Mdskip.item.title,pictUrl:_DATA_Mdskip.item.videoDetail.videoThumbnailURL}; return JSON.stringify(json);}";
|
| | | |
| | | 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 {
|
| | | content += ";function getData(){ var json={title:_DATA_Mdskip.item.title,pictUrl:_DATA_Mdskip.item.videos[0].videoThumbnailURL}; return JSON.stringify(json);}";
|
| | | }
|
| | |
|
| | | ScriptEngineManager manager = new ScriptEngineManager();
|
| | | ScriptEngine engine = manager.getEngineByName("javascript");
|
New file |
| | |
| | | package org.fanli.http;
|
| | |
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.net.HttpURLConnection;
|
| | | import java.net.URL;
|
| | | import java.net.URLDecoder;
|
| | | import java.net.URLEncoder;
|
| | |
|
| | | import org.apache.http.HttpHeaders;
|
| | | import org.junit.Test;
|
| | |
|
| | | public class GetRedirectUrl {
|
| | | @Test
|
| | | public void test_getRedirectUrl() throws Exception {
|
| | | // String
|
| | | // url="http://www.baidu.com/link?url=ByBJLpHsj5nXx6DESXbmMjIrU5W4Eh0yg5wCQpe3kCQMlJK_RJBmdEYGm0DDTCoTDGaz7rH80gxjvtvoqJuYxK";
|
| | | String url = "http://cu.manmanbuy.com/goto_261499.aspx";
|
| | | String expectUrl = "http://www.zhihu.com/question/20583607/answer/16597802";
|
| | | /**
|
| | | * 0、淘宝客链接跳转淘宝链接
|
| | | */
|
| | | // 递归;
|
| | | String tu = getRedirectUrl(url);
|
| | | ;
|
| | | System.out.println("tu链接" + tu);
|
| | | // 解密tu参数链接
|
| | | // System.out.println(tu.substring(tu.indexOf("tu=")+3));
|
| | | String jiemiUrl2 = unescape(tu.substring(tu.indexOf("tu=") + 3));
|
| | | System.out.println("tu参数解密链接" + jiemiUrl2);
|
| | | String jiemiUrl = "https://s.click.taobao.com/t?e=m%3D2%26s%3DshhycMgyX5YcQipKwQzePOeEDrYVVa64K7Vc7tFgwiHjf2vlNIV67gtlG6lwPBS0UkCu4LW4fHWggE%2B81xYdaYgwvAJKzKRhR0QUH89hs6odoD3G8jExAxAqvUhwaPOiypAbhWWbtazmAClNJkpsCzHrKHhQWCLYttvJ9Z4G1Zg%3D&pvid=10_183.135.6.227_21727_1512373605774&sc=c2Z10Xw&ref=&et=nQZarJKAELgKLFmnQOOdGhGI9MyeD0rm";
|
| | | // String jiemiUrl =
|
| | | // "https://s.click.taobao.com/t?e=m%3D2%26s%3DshhycMgyX5YcQipKwQzePOeEDrYVVa64K7Vc7tFgwiHjf2vlNIV67gtlG6lwPBS0UkCu4LW4fHWggE%2B81xYdaYgwvAJKzKRhR0QUH89hs6odoD3G8jExAxAqvUhwaPOiypAbhWWbtazmAClNJkpsCzHrKHhQWCLYttvJ9Z4G1Zg%3D&pvid=10_183.135.6.227_21727_1512373605774&sc=c2Z10Xw&ref=&et=XDdI5IoTDHiv%2FPC6VebP6npa%2BXvuZjy1";
|
| | | // // 请求获取(tu参数链接);
|
| | | System.out.println("淘宝链接:" + getBaseUrl(jiemiUrl2, tu));
|
| | | |
| | | /**
|
| | | * 1、普通的跳转获取(递归函数)
|
| | | */
|
| | | |
| | | // System.out.println("递归链接:"+getRedirectUrl(url));
|
| | | /**
|
| | | * 2、不递归获取
|
| | | */
|
| | | // System.out.println("非递归链接:"+getUrl(url));
|
| | | |
| | | /**
|
| | | * 加密、解密
|
| | | */
|
| | | // String path1 =
|
| | | // "https%3a%2f%2fs.click.taobao.com%2ft%3fe%3dm%253D2%2526s%253DshhycMgyX5YcQipKwQzePOeEDrYVVa64K7Vc7tFgwiHjf2vlNIV67gtlG6lwPBS0UkCu4LW4fHWggE%252B81xYdaYgwvAJKzKRhR0QUH89hs6odoD3G8jExAxAqvUhwaPOiypAbhWWbtazmAClNJkpsCzHrKHhQWCLYttvJ9Z4G1Zg%253D%26pvid%3d10_183.135.6.227_21727_1512373605774%26sc%3dc2Z10Xw%26ref%3d%26et%3dXDdI5IoTDHiv%252FPC6VebP6npa%252BXvuZjy1";
|
| | | //
|
| | | // String path2 =
|
| | | // "https://s.click.taobao.com/t?e=m%3D2%26s%3DshhycMgyX5YcQipKwQzePOeEDrYVVa64K7Vc7tFgwiHjf2vlNIV67gtlG6lwPBS0UkCu4LW4fHWggE%2B81xYdaYgwvAJKzKRhR0QUH89hs6odoD3G8jExAxAqvUhwaPOiypAbhWWbtazmAClNJkpsCzHrKHhQWCLYttvJ9Z4G1Zg%3D&pvid=10_183.135.6.227_21727_1512373605774&sc=c2Z10Xw&ref=&et=XDdI5IoTDHiv%2FPC6VebP6npa%2BXvuZjy1";
|
| | | // System.out.println("解密后:" + unescape(path1));
|
| | | // System.out.println("正确值:" + path2);
|
| | | }
|
| | | |
| | | /**
|
| | | * 递归获取重定向地址
|
| | | * |
| | | * @param path
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | |
| | | private String getRedirectUrl(String needRedirectUrl) throws Exception {
|
| | | |
| | | HttpURLConnection conn = (HttpURLConnection) new URL(needRedirectUrl).openConnection();
|
| | | conn.setInstanceFollowRedirects(false);
|
| | | // conn.setConnectTimeout(8000);
|
| | | /**
|
| | | * 递归找到最终的url(包含location)
|
| | | */
|
| | | if (conn.getHeaderField("location") == null)
|
| | | return needRedirectUrl;
|
| | | else
|
| | | return getRedirectUrl(conn.getHeaderField("location"));
|
| | | // }
|
| | | |
| | | /**
|
| | | * 方法二
|
| | | */
|
| | | // //创建一个http请求
|
| | | // HttpClient client = new HttpClient();
|
| | | // //用header的请求方式,减少返回值和一些非必要获取的信息
|
| | | // HttpMethod method = new HeadMethod(url);
|
| | | // HttpParams params = client.getParams();
|
| | | // params.setParameter(AllClientPNames.HANDLE_REDIRECTS, false);
|
| | | // client.executeMethod(method);
|
| | | // //获取链接
|
| | | // url = method.getURI().getURI();
|
| | | // //释放链接(重要)
|
| | | // method.releaseConnection();
|
| | | }
|
| | | |
| | | /**
|
| | | * 不递归获取跳转链接
|
| | | * |
| | | * @author Yien
|
| | | * @when 2017年12月5日 下午4:09:47
|
| | | *
|
| | | *
|
| | | * @param path
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | |
| | | private String getUrl(String path) throws Exception {
|
| | | |
| | | URL url = new URL(path);
|
| | | HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
| | | conn.getResponseCode();
|
| | | conn.setInstanceFollowRedirects(true);
|
| | | String realUrl = conn.getURL().toString();
|
| | | conn.disconnect();
|
| | | // System.out.println(realUrl);
|
| | | return realUrl;
|
| | | }
|
| | | |
| | | /**
|
| | | * 淘宝客链接最后跳转淘宝链接
|
| | | * |
| | | * @author Yien
|
| | | * @when 2017年12月5日 下午4:03:40
|
| | | *
|
| | | *
|
| | | * @param path
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public String getBaseUrl(String redirectUrl, String tu) throws Exception {
|
| | | HttpURLConnection conn = (HttpURLConnection) new URL(redirectUrl).openConnection();
|
| | | conn.setInstanceFollowRedirects(false);
|
| | | // conn.setConnectTimeout(8000);
|
| | | /**
|
| | | * tu为包含location的最终url
|
| | | */
|
| | | // String tu =
|
| | | // "https://s.click.taobao.com/t_js?tu=https%3A%2F%2Fs.click.taobao.com%2Ft%3Fe%3Dm%253D2%2526s%253DshhycMgyX5YcQipKwQzePOeEDrYVVa64K7Vc7tFgwiHjf2vlNIV67gtlG6lwPBS0UkCu4LW4fHWggE%252B81xYdaYgwvAJKzKRhR0QUH89hs6odoD3G8jExAxAqvUhwaPOiypAbhWWbtazmAClNJkpsCzHrKHhQWCLYttvJ9Z4G1Zg%253D%26pvid%3D10_183.135.6.227_21727_1512373605774%26sc%3Dc2Z10Xw%26ref%3D%26et%3DXDdI5IoTDHiv%252FPC6VebP6npa%252BXvuZjy1";
|
| | | /**
|
| | | * 设置请求行
|
| | | */
|
| | | conn.setRequestProperty(HttpHeaders.REFERER, tu);
|
| | | // System.out.println(conn.getURL());
|
| | | return getRedirectUrl(conn.getHeaderField("Location"));
|
| | | |
| | | }
|
| | | |
| | | /**
|
| | | * URL解密
|
| | | * |
| | | * @author Yien
|
| | | * @when 2017年12月5日 下午4:26:51
|
| | | *
|
| | | *
|
| | | * @param str
|
| | | * @return
|
| | | */
|
| | | |
| | | public String unescape(String str) {
|
| | | |
| | | try {
|
| | | // 将application/x-www-from-urlencoded字符串转换成普通字符串
|
| | | return URLDecoder.decode(str, "GBK");
|
| | | |
| | | } catch (UnsupportedEncodingException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | return null;
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | /**
|
| | | * Url加密
|
| | | * |
| | | * @author Yien
|
| | | * @when 2017年12月5日 下午4:27:04
|
| | | *
|
| | | *
|
| | | * @param str
|
| | | * @return
|
| | | */
|
| | | public String escape(String str) {
|
| | | |
| | | try {
|
| | | // 将普通字符创转换成application/x-www-from-urlencoded字符串
|
| | | return URLEncoder.encode(str, "GBK");
|
| | | |
| | | } catch (UnsupportedEncodingException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | return null;
|
| | | }
|
| | | |
| | | }
|
| | | }
|
New file |
| | |
| | | package org.fanli.http;
|
| | |
|
| | | import java.net.URLDecoder;
|
| | |
|
| | | import org.apache.commons.httpclient.HttpClient;
|
| | | import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
|
| | | import org.apache.commons.httpclient.methods.GetMethod;
|
| | | import org.apache.commons.httpclient.params.HttpMethodParams;
|
| | |
|
| | | public class GetUrl {
|
| | |
|
| | | public static void main(String[] args) {
|
| | | String urlStr = "https://s.click.taobao.com/t?e=m%3D2%26s%3DT9DFpHQCT7Rw4vFB6t2Z2ueEDrYVVa64XoO8tOebS+dRAdhuF14FMR8PbBytQEje1aH1Hk3GeOiJjPfjWNBTvGChS8XTLgqFsyp3PHGafE9hz7ZCEfUCBSQYRxDRWsrMAV6zoU7+jzw6Wck6eaoQ6c0Q9fK1X0AuhLjO8JFSuq5qGmoLahT+Zz+Fa8QW0pMbTc7jC1Dcr3S4/ApvI96NZkEtjKTgb9sQVVYTniU5e5UcTNWtqRPezzPihM1enhJMVFzNXDvVTOYkiM0JmU9fSqK5FrSzWxEyPXsNY/sDjpw%3D&union_lens=lensId:0b0130fe_0bf6_16d5df25895_5125&xId=5txrpEx2YVvmhganW7raNMxAtFzGZyc3E72r5XE9ewJTxYx9HdVExRGtktqdlYc3fJWaixqcyyV0dBfQb8MgXT&union_lens=lensId:0b08107f_0c5e_16d5df25896_b064&utm_campaign=client_share&app=aweme&utm_medium=ios&tt_from=copy&utm_source=copy";
|
| | | HttpClient client;
|
| | | 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
|
| | |
|
| | | GetMethod get = new GetMethod(urlStr);
|
| | |
|
| | | get.setFollowRedirects(false); // 禁止自动重定向
|
| | |
|
| | | try {
|
| | | int iGetResultCode = client.executeMethod(get);
|
| | | String location = get.getResponseHeader("location").getValue(); // 打印地址
|
| | | GetMethod get2 = new GetMethod(URLDecoder.decode(location.split("tu=")[1]));
|
| | | get2.addRequestHeader("Referer", location);
|
| | | get2.setFollowRedirects(false); // 禁止自动重定向
|
| | | int iGetResultCode2 = client.executeMethod(get2);
|
| | | String realUrl = get2.getResponseHeader("location").getValue(); // 打印地址
|
| | | System.out.println("REAL URL: " + realUrl);
|
| | | GetMethod get3 = new GetMethod(realUrl);
|
| | | int iGetResultCode3 = client.executeMethod(get3);
|
| | | String responseBody = get3.getResponseBodyAsString();
|
| | | // System.out.println("Response Body: "+responseBody);
|
| | | System.out.println(responseBody.substring(responseBody.indexOf("sellerRate=" + "") + 12,
|
| | | responseBody.indexOf("&", responseBody.indexOf("sellerRate="))));
|
| | |
|
| | | } catch (Exception ex) {
|
| | | ex.printStackTrace();
|
| | | } finally {
|
| | | get.releaseConnection();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package org.fanli.wx;
|
| | |
|
| | | import org.junit.Test;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | |
|
| | | public class Test_WXPay {
|
| | | |
| | | @Test
|
| | | public void redPack() {
|
| | | ExtractService service = BeanUtil.getBean(ExtractService.class);
|
| | | |
| | | UserInfo userInfo = new UserInfo();
|
| | | userInfo.setId(437032L);
|
| | | userInfo.setWxOpenId("o7AX10amYIt9zyQ0J3L8Qbxy2ud8");
|
| | | userInfo.setWxUnionId("oUqEAtNrehAym_lJ-xE7aZhyB-5Y");
|
| | | service.autoExtract(userInfo);
|
| | | }
|
| | | }
|
New file |
| | |
| | | package org.yeshi.utils.entity.wx;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | public class RedPackParams {
|
| | | // 生成签名key值
|
| | | private String key;
|
| | | // 商户订单号
|
| | | private String billno;
|
| | | // 商户号
|
| | | private String mchId;
|
| | | // 商户号 公众账号appid
|
| | | private String wxappId;
|
| | | // 商户名称
|
| | | private String sendName;
|
| | | // 用户openid
|
| | | private String openid;
|
| | | // 付款金额 (元)
|
| | | private BigDecimal money;
|
| | | // 红包发放总人数
|
| | | private int totalNum;
|
| | | // 红包祝福语
|
| | | private String wishing;
|
| | | // 备注
|
| | | private String remark;
|
| | | // Ip地址
|
| | | private String clientIp;
|
| | | // 活动名称
|
| | | private String actName;
|
| | |
|
| | | // 场景id--非必填
|
| | | private String sceneId;
|
| | | // 活动信息--非必填
|
| | | private String riskInfo;
|
| | |
|
| | | |
| | | |
| | | public String getBillno() {
|
| | | return billno;
|
| | | }
|
| | |
|
| | | public void setBillno(String billno) {
|
| | | this.billno = billno;
|
| | | }
|
| | |
|
| | | public String getMchId() {
|
| | | return mchId;
|
| | | }
|
| | |
|
| | | public void setMchId(String mchId) {
|
| | | this.mchId = mchId;
|
| | | }
|
| | |
|
| | | public String getWxappId() {
|
| | | return wxappId;
|
| | | }
|
| | |
|
| | | public void setWxappId(String wxappId) {
|
| | | this.wxappId = wxappId;
|
| | | }
|
| | |
|
| | | public String getSendName() {
|
| | | return sendName;
|
| | | }
|
| | |
|
| | | public void setSendName(String sendName) {
|
| | | this.sendName = sendName;
|
| | | }
|
| | |
|
| | | public String getOpenid() {
|
| | | return openid;
|
| | | }
|
| | |
|
| | | public void setOpenid(String openid) {
|
| | | this.openid = openid;
|
| | | }
|
| | |
|
| | | public BigDecimal getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(BigDecimal money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | public int getTotalNum() {
|
| | | return totalNum;
|
| | | }
|
| | |
|
| | | public void setTotalNum(int totalNum) {
|
| | | this.totalNum = totalNum;
|
| | | }
|
| | |
|
| | | public String getWishing() {
|
| | | return wishing;
|
| | | }
|
| | |
|
| | | public void setWishing(String wishing) {
|
| | | this.wishing = wishing;
|
| | | }
|
| | |
|
| | | public String getClientIp() {
|
| | | return clientIp;
|
| | | }
|
| | |
|
| | | public void setClientIp(String clientIp) {
|
| | | this.clientIp = clientIp;
|
| | | }
|
| | |
|
| | | public String getActName() {
|
| | | return actName;
|
| | | }
|
| | |
|
| | | public void setActName(String actName) {
|
| | | this.actName = actName;
|
| | | }
|
| | |
|
| | | public String getSceneId() {
|
| | | return sceneId;
|
| | | }
|
| | |
|
| | | public void setSceneId(String sceneId) {
|
| | | this.sceneId = sceneId;
|
| | | }
|
| | |
|
| | | public String getRiskInfo() {
|
| | | return riskInfo;
|
| | | }
|
| | |
|
| | | public void setRiskInfo(String riskInfo) {
|
| | | this.riskInfo = riskInfo;
|
| | | }
|
| | |
|
| | | public String getKey() {
|
| | | return key;
|
| | | }
|
| | |
|
| | | public void setKey(String key) {
|
| | | this.key = key;
|
| | | }
|
| | |
|
| | | public String getRemark() {
|
| | | return remark;
|
| | | }
|
| | |
|
| | | public void setRemark(String remark) {
|
| | | this.remark = remark;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.StringUtil;
|
| | | import org.yeshi.utils.entity.wx.RedPackParams;
|
| | |
|
| | | /**
|
| | | * 微信支付帮助类
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 发放微信红包
|
| | | * @param params
|
| | | * @param pwd
|
| | | * @param cert
|
| | | * @return
|
| | | */
|
| | | public static String redPackToOpenId(RedPackParams params, String pwd, InputStream cert) {
|
| | | // 转化成分
|
| | | 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());
|
| | | map.put("mch_id", params.getMchId());
|
| | | map.put("wxappid", params.getWxappId());
|
| | | 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("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);
|
| | | return result;
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 查询红包领取记录
|
| | | * @param billno 商户订单号
|
| | | * @param mchId 商户号
|
| | | * @param key
|
| | | * @param appId Appid
|
| | | * @param pwd
|
| | | * @param cert
|
| | | * @return
|
| | | */
|
| | | 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);
|
| | | map.put("wxappid", appId);
|
| | | map.put("bill_type", "MCHT");
|
| | | map.put("nonce_str", StringUtil.getRandomCode(32));
|
| | | 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);
|
| | | return result;
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | | }
|