yujian
2019-08-23 89e89fe2b2a1578a94b2e2c8ee81efbfbbf85f08
兑换邀请码调整
8个文件已修改
108 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemCoupon.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/SystemCouponMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeRecordServiceImpl.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralExchangeService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java
@@ -465,8 +465,11 @@
    @RequestMapping(value = "exchangeInviteCode", method = RequestMethod.POST)
    public void exchangeInviteCode(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
        try {
            integralExchangeService.exchangeInviteCode(uid, id);
            out.print(JsonUtil.loadTrueResult("邀请码激活成功"));
            String inviteCode = integralExchangeService.exchangeInviteCode(uid, id);
            JSONObject data = new JSONObject();
            data.put("msg", "兑换成功,金币已消耗 ");
            data.put("inviteCode", inviteCode);
            out.print(JsonUtil.loadTrueResult(data));
        } catch (IntegralExchangeException e) {
            out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
        }
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemCoupon.java
@@ -66,10 +66,14 @@
    @Column(name = "sc_amount")
    private String amount;
    // 有效期天-剩余激活时间
    @Column(name = "sc_activate_day")
    private Integer activateDay;
    // 有效期天数
    @Column(name = "sc_expiry_day")
    private Integer expiryDay;
    // 规则
    @Column(name = "sc_rule")
    private String rule;
@@ -221,5 +225,12 @@
    public void setRuleLink(String ruleLink) {
        this.ruleLink = ruleLink;
    }
    public Integer getActivateDay() {
        return activateDay;
    }
    public void setActivateDay(Integer activateDay) {
        this.activateDay = activateDay;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/SystemCouponMapper.xml
@@ -15,6 +15,7 @@
    <result column="sc_percent" property="percent" jdbcType="DECIMAL"/>
    <result column="sc_amount" property="amount" jdbcType="VARCHAR"/>
    <result column="sc_expiry_day" property="expiryDay" jdbcType="INTEGER"/>
    <result column="sc_activate_day" property="activateDay" jdbcType="INTEGER"/>
    <result column="sc_rule" property="rule" jdbcType="VARCHAR"/>
    <result column="sc_remark" property="remark" jdbcType="VARCHAR"/>
    <result column="sc_rule_link" property="ruleLink" jdbcType="VARCHAR"/>
@@ -22,12 +23,12 @@
    <result column="sc_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="sc_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">sc_id,sc_name,sc_picture,sc_picture_invalid,sc_effect,sc_type,sc_percent,sc_amount,sc_expiry_day,sc_rule,sc_remark,sc_rule_link,sc_state,sc_create_time,sc_update_time</sql>
  <sql id="Base_Column_List">sc_id,sc_name,sc_picture,sc_picture_invalid,sc_effect,sc_type,sc_percent,sc_amount,sc_expiry_day,sc_activate_day,sc_rule,sc_remark,sc_rule_link,sc_state,sc_create_time,sc_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_system_coupon where sc_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_system_coupon where sc_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.system.SystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_coupon (sc_id,sc_name,sc_picture,sc_picture_invalid,sc_effect,sc_type,sc_percent,sc_amount,sc_expiry_day,sc_rule,sc_remark,sc_rule_link,sc_state,sc_create_time,sc_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{pictureInvalid,jdbcType=VARCHAR},#{effect,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR},#{percent,jdbcType=DECIMAL},#{amount,jdbcType=VARCHAR},#{expiryDay,jdbcType=INTEGER},#{rule,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{ruleLink,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.system.SystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_coupon (sc_id,sc_name,sc_picture,sc_picture_invalid,sc_effect,sc_type,sc_percent,sc_amount,sc_expiry_day,sc_activate_day,sc_rule,sc_remark,sc_rule_link,sc_state,sc_create_time,sc_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{pictureInvalid,jdbcType=VARCHAR},#{effect,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR},#{percent,jdbcType=DECIMAL},#{amount,jdbcType=VARCHAR},#{expiryDay,jdbcType=INTEGER},#{activateDay,jdbcType=INTEGER},#{rule,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{ruleLink,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.system.SystemCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_coupon
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">sc_id,</if>
@@ -39,6 +40,7 @@
      <if test="percent != null">sc_percent,</if>
      <if test="amount != null">sc_amount,</if>
      <if test="expiryDay != null">sc_expiry_day,</if>
      <if test="activateDay != null">sc_activate_day,</if>
      <if test="rule != null">sc_rule,</if>
      <if test="remark != null">sc_remark,</if>
      <if test="ruleLink != null">sc_rule_link,</if>
@@ -56,6 +58,7 @@
      <if test="percent != null">#{percent,jdbcType=DECIMAL},</if>
      <if test="amount != null">#{amount,jdbcType=VARCHAR},</if>
      <if test="expiryDay != null">#{expiryDay,jdbcType=INTEGER},</if>
      <if test="activateDay != null">#{activateDay,jdbcType=INTEGER},</if>
      <if test="rule != null">#{rule,jdbcType=VARCHAR},</if>
      <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
      <if test="ruleLink != null">#{ruleLink,jdbcType=VARCHAR},</if>
@@ -64,7 +67,7 @@
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.system.SystemCoupon">update yeshi_ec_system_coupon set sc_name = #{name,jdbcType=VARCHAR},sc_picture = #{picture,jdbcType=VARCHAR},sc_picture_invalid = #{pictureInvalid,jdbcType=VARCHAR},sc_effect = #{effect,jdbcType=VARCHAR},sc_type = #{type,jdbcType=VARCHAR},sc_percent = #{percent,jdbcType=DECIMAL},sc_amount = #{amount,jdbcType=VARCHAR},sc_expiry_day = #{expiryDay,jdbcType=INTEGER},sc_rule = #{rule,jdbcType=VARCHAR},sc_remark = #{remark,jdbcType=VARCHAR},sc_rule_link = #{ruleLink,jdbcType=VARCHAR},sc_state = #{state,jdbcType=INTEGER},sc_create_time = #{createTime,jdbcType=TIMESTAMP},sc_update_time = #{updateTime,jdbcType=TIMESTAMP} where sc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.system.SystemCoupon">update yeshi_ec_system_coupon set sc_name = #{name,jdbcType=VARCHAR},sc_picture = #{picture,jdbcType=VARCHAR},sc_picture_invalid = #{pictureInvalid,jdbcType=VARCHAR},sc_effect = #{effect,jdbcType=VARCHAR},sc_type = #{type,jdbcType=VARCHAR},sc_percent = #{percent,jdbcType=DECIMAL},sc_amount = #{amount,jdbcType=VARCHAR},sc_expiry_day = #{expiryDay,jdbcType=INTEGER},sc_activate_day = #{activateDay,jdbcType=INTEGER},sc_rule = #{rule,jdbcType=VARCHAR},sc_remark = #{remark,jdbcType=VARCHAR},sc_rule_link = #{ruleLink,jdbcType=VARCHAR},sc_state = #{state,jdbcType=INTEGER},sc_create_time = #{createTime,jdbcType=TIMESTAMP},sc_update_time = #{updateTime,jdbcType=TIMESTAMP} where sc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.system.SystemCoupon">update yeshi_ec_system_coupon
    <set>
      <if test="name != null">sc_name=#{name,jdbcType=VARCHAR},</if>
@@ -75,6 +78,7 @@
      <if test="percent != null">sc_percent=#{percent,jdbcType=DECIMAL},</if>
      <if test="amount != null">sc_amount=#{amount,jdbcType=VARCHAR},</if>
      <if test="expiryDay != null">sc_expiry_day=#{expiryDay,jdbcType=INTEGER},</if>
      <if test="activateDay != null">sc_activate_day=#{activateDay,jdbcType=INTEGER},</if>
      <if test="rule != null">sc_rule=#{rule,jdbcType=VARCHAR},</if>
      <if test="remark != null">sc_remark=#{remark,jdbcType=VARCHAR},</if>
      <if test="ruleLink != null">sc_rule_link=#{ruleLink,jdbcType=VARCHAR},</if>
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeRecordServiceImpl.java
@@ -75,10 +75,20 @@
            }
            
            // 邀请码激活卡,兑换项,如果当前用户已经激活了邀请功能,则不需要显示该兑换项。
            if (type == ExchangeTypeEnum.inviteCodeActivate && hasCode) {
                listValid.remove(i);
                i --;
                continue;
            if (type == ExchangeTypeEnum.inviteCodeActivate) {
                if (hasCode) {
                    listValid.remove(i);
                    i --;
                    continue;
                }
                // 兑换一次之后隐藏
                long num = integralExchangeRecordMapper.countRecordByUid(id, uid, null);
                if  (num >= 1) {
                    listValid.remove(i);
                    i --;
                    continue;
                }
            }
            
            // 邀请码发布卡,兑换项,如果当前用户未激活邀请功能,则不需要显示该兑换项。
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeServiceImpl.java
@@ -367,7 +367,7 @@
    
    
    @Override
    public void exchangeInviteCode(Long uid, Long id) throws IntegralExchangeException {
    public String exchangeInviteCode(Long uid, Long id) throws IntegralExchangeException {
        if (uid == null || uid <= 0)
            throw new IntegralExchangeException(1, "用户未登录");
@@ -401,7 +401,6 @@
                throw new IntegralExchangeException(1, "兑换失败,该用户邀请码不存在");
            
            String inviteCode = inviteExtra.getInviteCode();
            userInfoExtraService.activateInviteCode(uid, inviteExtra.getInviteCode());
            
            // 剩余金币
            int surplus = goldCoinHas.intValue() - goldCoin.intValue();
@@ -442,11 +441,11 @@
                    userOtherMsgNotificationService.exchangeMsg(uid, beizu, msgOther);
                }
            });
            return inviteCode;
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
            throw new IntegralExchangeException(1, "兑换失败");
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -228,9 +228,16 @@
            stateActivated = 0;
        }
        Integer expiryDay = null;
        if (stateActivated == 0)
            expiryDay = coupon.getActivateDay();
        if (expiryDay == null || expiryDay == 0)
            expiryDay = coupon.getExpiryDay();
        // 结束日期
        // 今天在内  减去一天
        String endDay = DateUtil.plusDay(coupon.getExpiryDay() - 1, new Date());
        String endDay = DateUtil.plusDay(expiryDay - 1, new Date());
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Date endTime = format.parse(endDay);
@@ -1662,9 +1669,18 @@
        } else if (couponType == CouponTypeEnum.welfareFreeCoupon.name() && threeSaleSerivce.countSuccessFirstTeam(uid) <= 0) {
            stateActivated = 0;  // 无下级队员 --待激活
        } 
        Integer expiryDay = null;
        if (stateActivated == 0)
            expiryDay = coupon.getActivateDay();
        if (expiryDay == null || expiryDay == 0)
            expiryDay = coupon.getExpiryDay();
        //  计算结束日期:今天在内  减去一天
        String endDay = DateUtil.plusDay(coupon.getExpiryDay() - 1, new Date());
        String endDay = DateUtil.plusDay(expiryDay - 1, new Date());
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Date endTime = format.parse(endDay);
@@ -1791,6 +1807,8 @@
                give = false;
            }
            
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
            if (UserSystemCoupon.STATE_CAN_USE == state) {
                Map<String, Object> jumpLink = new HashMap<String, Object>();
                if (CouponTypeEnum.freeCouponGive == type) {
@@ -1847,7 +1865,6 @@
                        }
                    } 
                } 
            } else if (give && UserSystemCoupon.STATE_END_USE == state) {
                userCouponVO.setCouponRule(systemCoupon.getRemark());
                if (CouponTypeEnum.freeCouponGive == type) {
@@ -1857,8 +1874,24 @@
                if (CouponTypeEnum.rebatePercentCoupon == type) {
                    userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
                }
            }else if (give && UserSystemCoupon.STATE_OVERDUE == state) {
                userCouponVO.setCouponRule(systemCoupon.getRemark());
                Date useTime = userCouponVO.getUseTime();
                if (useTime != null) {
                    Map<String, Object> remainDays = new HashMap<String, Object>();
                    remainDays.put("content", "于" + sdf.format(useTime) + "成功赠送");
                    remainDays.put("fontColor", "#999999");
                    userCouponVO.setRemainDays(remainDays);
                }
            }else if (UserSystemCoupon.STATE_OVERDUE == state) {
                if (endTime != null) {
                    Map<String, Object> remainDays = new HashMap<String, Object>();
                    remainDays.put("content", "于" + sdf.format(endTime) + "过期");
                    remainDays.put("fontColor", "#999999");
                    userCouponVO.setRemainDays(remainDays);
                }
                if(give)
                    userCouponVO.setCouponRule(systemCoupon.getRemark());
            }
            userCouponVO.setJumpBtn(jumpBtn);
        }
fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralExchangeService.java
@@ -53,7 +53,7 @@
     * @return
     * @throws IntegralExchangeException
     */
    public void exchangeInviteCode(Long uid, Long id) throws IntegralExchangeException;
    public String exchangeInviteCode(Long uid, Long id) throws IntegralExchangeException;
    
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -627,7 +627,9 @@
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getLeftDay() + "", COLOR_HIGHLIGHT_CONTENT));
                
                if (msg.getType() == MsgTypeOtherTypeEnum.couponMianDan) {
                if (msg.getType() == MsgTypeOtherTypeEnum.couponReward) {
                    contentList.add(new ClientTextStyleVO("天(未使用将会过期)", COLOR_CONTENT));
                } else if (msg.getType() == MsgTypeOtherTypeEnum.couponMianDan) {
                    contentList.add(new ClientTextStyleVO("天(未使用将会过期)", COLOR_CONTENT));
                } else {
                    contentList.add(new ClientTextStyleVO("天", COLOR_CONTENT));