admin
2019-11-12 6c930b8374bf5b991bc423f02ed22420e78b85ff
Merge remote-tracking branch 'origin/div' into div
15个文件已修改
1个文件已添加
346 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/RedPackAdminController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BanLiShopController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ConfigControllerV2.java 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/FloatAD.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/FloatADMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/shop/BanLiShopGoodsMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/shop/BanLiShopGoodsSetsMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/shop/BanLiShopGoodsSetsPayMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackBalanceServiceImpl.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackExchangeServiceImpl.java 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackGiveRecordServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackBalanceService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/FloatADTypeEnumHandler.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/RedPackAdminController.java
@@ -17,6 +17,7 @@
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.common.AdminUser;
import com.yeshi.fanli.entity.redpack.RedPackExchange;
import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
import com.yeshi.fanli.exception.redpack.RedPackExchangeException;
import com.yeshi.fanli.service.AdminUserService;
import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
@@ -118,7 +119,13 @@
            return;
        }
        Long uid = exchange.getUid();
        BigDecimal balance = redPackBalanceService.getBalance(uid);
        BigDecimal balance;
        try {
            balance = redPackBalanceService.getBalance(uid);
        } catch (RedPackBalanceException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该用户红包功能已被封禁"));
            return;
        }
        UserInfo userInfo = userInfoService.selectByPKey(uid);
        
        JSONObject data = new JSONObject();
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BanLiShopController.java
@@ -183,7 +183,12 @@
                    pay.setName(getPayName(pay.getPayType()));
                }
            }
        BigDecimal money = redPackBalanceService.getBalance(uid);
        BigDecimal money = new BigDecimal(0);
        try {
            money = redPackBalanceService.getBalance(uid);
        } catch (RedPackBalanceException e) {
            e.printStackTrace();
        }
        JSONObject data = new JSONObject();
        data.put("goods", goods);
        data.put("hongBaoBalance", money);
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ConfigControllerV2.java
@@ -14,6 +14,7 @@
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
import com.yeshi.fanli.entity.bus.homemodule.FloatAD.FloatADTypeEnum;
import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
import com.yeshi.fanli.entity.common.JumpDetailV2;
@@ -156,36 +157,40 @@
            uid = null;
        // 活动弹框
        List<FloatAD> listAD = null;
        if (redPackWinNewUserService.verifyHasReward(uid)) {
            listAD = floatADService.getValidByPosition(FloatAD.POSITION_INDEX);
        } else {
            listAD = floatADService.getValidCommonByPosition(FloatAD.POSITION_INDEX);
        }
        List<FloatAD> listAD = new ArrayList<FloatAD>();
        List<FloatImgDetailVO> listVO = new ArrayList<FloatImgDetailVO>();
        if (listAD != null && !listAD.isEmpty()) {
            for (FloatAD floatAD : listAD) {
                JumpDetailV2 jumpDetail = floatAD.getJumpDetail();
                if (jumpDetail != null) {
                    jumpDetail = jumpDetailV2Service.selectByPrimaryKey(jumpDetail.getId());
                    if (jumpDetail != null) {
                        jumpDetail.setNeedLogin(floatAD.isJumpNeedLogin());
                    }
                }
                FloatImgDetailVO floatImgVO = new FloatImgDetailVO();
                floatImgVO.setId(floatAD.getId().toString());
                floatImgVO.setImg(floatAD.getPicture());
                floatImgVO.setParams(floatAD.getParams());
                floatImgVO.setJumpDetail(jumpDetail);
                floatImgVO.setShowTime(floatAD.getShowMode());
                floatImgVO.setAccountLogin(floatAD.isJumpNeedLogin());
                if (floatAD.getPlaySound() != null)
                    floatImgVO.setPlaySound(floatAD.getPlaySound());// 默认都播放音效
                else
                    floatImgVO.setPlaySound(false);
                listVO.add(floatImgVO);
        List<FloatAD> list = floatADService.getValidByPosition(FloatAD.POSITION_INDEX);
        if (list != null && !list.isEmpty())
            listAD.addAll(list);
        for (int i = 0; i < listAD.size(); i++) {
            FloatAD floatAD = listAD.get(i);
            FloatADTypeEnum typeEnum = floatAD.getTypeEnum();
            if (typeEnum == FloatADTypeEnum.newUserRedPack && !redPackWinNewUserService.verifyHasReward(uid)) {
                listAD.remove(i);
                i--;
            }
            JumpDetailV2 jumpDetail = floatAD.getJumpDetail();
            if (jumpDetail != null) {
                jumpDetail = jumpDetailV2Service.selectByPrimaryKey(jumpDetail.getId());
                if (jumpDetail != null) {
                    jumpDetail.setNeedLogin(floatAD.isJumpNeedLogin());
                }
            }
            FloatImgDetailVO floatImgVO = new FloatImgDetailVO();
            floatImgVO.setId(floatAD.getId().toString());
            floatImgVO.setImg(floatAD.getPicture());
            floatImgVO.setParams(floatAD.getParams());
            floatImgVO.setJumpDetail(jumpDetail);
            floatImgVO.setShowTime(floatAD.getShowMode());
            floatImgVO.setAccountLogin(floatAD.isJumpNeedLogin());
            if (floatAD.getPlaySound() != null)
                floatImgVO.setPlaySound(floatAD.getPlaySound());// 默认都播放音效
            else
                floatImgVO.setPlaySound(false);
            listVO.add(floatImgVO);
        }
        JSONObject data = new JSONObject();
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java
@@ -34,6 +34,7 @@
import com.yeshi.fanli.entity.redpack.RedPackExchange;
import com.yeshi.fanli.entity.redpack.RedPackWinInvite;
import com.yeshi.fanli.entity.redpack.RedPackWinInvite.RedPackWinInviteTypeEnum;
import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
import com.yeshi.fanli.exception.redpack.RedPackExchangeException;
import com.yeshi.fanli.exception.redpack.RedPackGiveRecordException;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
@@ -117,7 +118,14 @@
        BigDecimal yesterdayUse = zero;
        BigDecimal thisMonthUse = zero;
        BigDecimal lastMonthUse = zero;
        BigDecimal balance = redPackBalanceService.getBalance(uid);
        BigDecimal balance = null;
        try {
            balance = redPackBalanceService.getBalance(uid);
        } catch (RedPackBalanceException e) {
            out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
            return;
        }
        if (balance == null) {
            balance = zero;
        } else {
@@ -383,7 +391,12 @@
        }
        JSONObject data = new JSONObject();
        data.put("balance", redPackBalanceService.getBalance(uid));
        try {
            data.put("balance", redPackBalanceService.getBalance(uid));
        } catch (RedPackBalanceException e) {
            out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
            return;
        }
        data.put("ruleLink", redPackConfigService.getValueByKey("invite_reward_rule_link"));
        data.put("shareLink", UserInviteUtil.getShareUrl(uid));
fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/FloatAD.java
@@ -28,6 +28,21 @@
    public static String POSITION_INDEX = "index";
    // 展示位置 - 消息中心
    public static String POSITION_MSGCENTER = "msgCenter";
    public enum FloatADTypeEnum {
        activity("活动"), newUserRedPack("新人红包");
        private final String desc;
        private FloatADTypeEnum(String desc) {
            this.desc = desc;
        }
        public String getDesc() {
            return desc;
        }
    }
        
    
    @Column(name = "fa_id")
@@ -84,6 +99,9 @@
    @Column(name = "fa_type")
    private Integer type;
    @Column(name = "fa_type_enum")
    private FloatADTypeEnum typeEnum;
    // 启用状态
    @Column(name = "fa_state")
    private Integer state;
@@ -104,6 +122,8 @@
    // 结束时间
    private String endTime_str;
    
    // 结束时间
    private String typeName;
    
    
    public Long getId() {
@@ -249,5 +269,21 @@
    public void setPlaySound(Boolean playSound) {
        this.playSound = playSound;
    }
    public FloatADTypeEnum getTypeEnum() {
        return typeEnum;
    }
    public void setTypeEnum(FloatADTypeEnum typeEnum) {
        this.typeEnum = typeEnum;
    }
    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
    
}
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/FloatADMapper.xml
@@ -19,13 +19,14 @@
        <result column="fa_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="fa_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="fa_play_sound" property="playSound" jdbcType="BOOLEAN" />
        <result column="fa_type_enum" property="typeEnum" typeHandler="com.yeshi.fanli.util.mybatishandler.FloatADTypeEnumHandler"/>
        <association property="jumpDetail" column="fa_jumpid"
            javaType="com.yeshi.fanli.entity.common.JumpDetailV2">
            <id column="fa_jumpid" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time,fa_play_sound
    <sql id="Base_Column_List">fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time,fa_play_sound,fa_type_enum
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
@@ -38,9 +39,9 @@
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_float_ad
        (fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time,fa_id,fa_play_sound)
        (fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time,fa_id,fa_play_sound,fa_type_enum)
        values
        (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{showMode,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpNeedLogin,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{position,jdbcType=VARCHAR},#{order,jdbcType=INTEGER},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{playSound,jdbcType=BOOLEAN})
        (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{showMode,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpNeedLogin,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{position,jdbcType=VARCHAR},#{order,jdbcType=INTEGER},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{playSound,jdbcType=BOOLEAN},#{typeEnum,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD"
        useGeneratedKeys="true" keyProperty="id">
@@ -62,6 +63,7 @@
            <if test="createTime != null">fa_create_time,</if>
            <if test="updateTime != null">fa_update_time,</if>
            <if test="playSound != null">fa_play_sound,</if>
            <if test="typeEnum != null">fa_type_enum,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -80,7 +82,8 @@
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="playSound != null">#{playSound,jdbcType=BOOLEAN}</if>
            <if test="playSound != null">#{playSound,jdbcType=BOOLEAN},</if>
            <if test="typeEnum != null">#{typeEnum,jdbcType=VARCHAR}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD">update
@@ -97,7 +100,8 @@
        = #{state,jdbcType=INTEGER},fa_create_time =
        #{createTime,jdbcType=TIMESTAMP},fa_update_time =
        #{updateTime,jdbcType=TIMESTAMP} ,fa_play_sound
        =#{playSound,jdbcType=BOOLEAN} where fa_id = #{id,jdbcType=BIGINT}
        =#{playSound,jdbcType=BOOLEAN},fa_type_enum
        =#{typeEnum,jdbcType=VARCHAR} where fa_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD">
        update yeshi_ec_float_ad
@@ -118,6 +122,7 @@
            <if test="createTime != null">fa_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">fa_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="playSound !=null">fa_play_sound =#{playSound,jdbcType=BOOLEAN},</if>
            <if test="typeEnum !=null">fa_type_enum =#{typeEnum,jdbcType=VARCHAR},</if>
        </set>
        where fa_id = #{id,jdbcType=BIGINT}
    </update>
fanli/src/main/java/com/yeshi/fanli/mapping/shop/BanLiShopGoodsMapper.xml
@@ -58,12 +58,18 @@
    <select id="listGoods" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_shop_goods where sg_title like '${key}%'
        from yeshi_ec_shop_goods where 1=1
        <if test="key != null and key != ''">
            and sg_title like '%${key}%'
        </if>
        <if test="state!=null">and sg_state=#{state}</if>
        order by sg_weight desc limit #{start},#{count}
    </select>
    <select id="countGoods" resultType="java.lang.Long">
        select count(*) from yeshi_ec_shop_goods where sg_title like '${key}%'
        select count(*) from yeshi_ec_shop_goods where 1=1
        <if test="key != null and key != ''">
            and sg_title like '%${key}%'
        </if>
        <if test="state!=null">and sg_state=#{state}</if>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
fanli/src/main/java/com/yeshi/fanli/mapping/shop/BanLiShopGoodsSetsMapper.xml
@@ -87,7 +87,7 @@
    
    <select id="listQuery" resultMap="BaseResultMap">
        select    <include refid="Base_Column_List" /> from yeshi_ec_shop_goods_set 
        where sgs_name like '${key}%'
        where 1=1 <if test="key != null and key != ''">AND sgs_name like '%${key}%'</if>
            <if test="goodsId != null">AND sgs_goods_id = #{goodsId}</if>
        order by sgs_weight desc 
        limit #{start},#{count}
@@ -95,7 +95,8 @@
    <select id="countQuery" resultType="java.lang.Long">
        select count(sgs_id) from yeshi_ec_shop_goods_set 
        where sgs_name like '${key}%' <if test="goodsId != null">AND sgs_goods_id = #{goodsId}</if>
        where 1=1 <if test="key != null and key != ''">AND sgs_name like '%${key}%'</if>
             <if test="goodsId != null">AND sgs_goods_id = #{goodsId}</if>
    </select>
    
    
fanli/src/main/java/com/yeshi/fanli/mapping/shop/BanLiShopGoodsSetsPayMapper.xml
@@ -45,7 +45,7 @@
    
    <select id="listQuery" resultMap="BaseResultMap">
        select    <include refid="Base_Column_List" /> from yeshi_ec_shop_goods_set_pay 
        where sp_tag like '${key}%'
        where 1=1
        <if test="payType != null">
            and sp_pay_type=#{payType}
        </if>
@@ -58,7 +58,7 @@
    <select id="countQuery" resultType="java.lang.Long">
        select count(sp_id) from yeshi_ec_shop_goods_set_pay 
        where sp_tag like '${key}%'
        where 1=1
        <if test="payType != null">
            and sp_pay_type=#{payType}
        </if>
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java
@@ -16,6 +16,7 @@
import com.yeshi.fanli.dao.mybatis.homemodule.FloatADMapper;
import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
import com.yeshi.fanli.entity.bus.homemodule.FloatAD.FloatADTypeEnum;
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.exception.homemodule.FloatADException;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
@@ -221,6 +222,11 @@
        
        for (FloatAD floatAD : listQuery) {
            
            FloatADTypeEnum typeEnum = floatAD.getTypeEnum();
            if (typeEnum != null) {
                floatAD.setTypeName(typeEnum.getDesc());
            }
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
            Date startTime = floatAD.getStartTime();
            if (startTime == null) {
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackBalanceServiceImpl.java
@@ -29,34 +29,29 @@
        return redPackBalanceMapper.selectByPrimaryKey(uid);
    }
    private void verify(RedPackBalance redPackBalance) throws RedPackBalanceException{
        if (redPackBalance == null)
            return;
        if (redPackBalance.getState() != null && redPackBalance.getState() == RedPackBalance.STATE_LOCKED)
            throw new RedPackBalanceException(1, "红包已封禁,感谢使用");
    }
    @Override
    public BigDecimal getBalance(Long uid) {
    public BigDecimal getBalance(Long uid) throws RedPackBalanceException{
        if (uid == null || uid == 0)
            return new BigDecimal(0);
        
        RedPackBalance redPackBalance = redPackBalanceMapper.selectByPrimaryKey(uid);
        if (redPackBalance != null)
            return redPackBalance.getMoney();
        if (redPackBalance != null) {
            // 验证
            verify(redPackBalance);
            return redPackBalance.getMoney();
        }
        return new BigDecimal(0);
    }
    @Override
    public void addRedPack(Long uid, BigDecimal money) {
        if (uid == null || uid == 0 || money == null)
            return;
        RedPackBalance redPackBalance = redPackBalanceMapper.selectForUpdate(uid);
        if (redPackBalance == null) {
            redPackBalance = new RedPackBalance();
            redPackBalance.setId(uid);
            redPackBalance.setMoney(money);
            redPackBalance.setState(RedPackBalance.STATE_INIT);
            redPackBalance.setCreateTime(new Date());
            redPackBalance.setUpdateTime(new Date());
            redPackBalanceMapper.insertSelective(redPackBalance);
        } else {
            redPackBalanceMapper.addRedPack(uid, money);
        }
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -76,6 +71,8 @@
            redPackBalance.setUpdateTime(new Date());
            redPackBalanceMapper.insertSelective(redPackBalance);
        } else {
            // 验证
            verify(redPackBalance);
            redPackBalanceMapper.addRedPack(uid, money);
        }
    }
@@ -95,6 +92,9 @@
        if (balance.getMoney().compareTo(money) < 0)
            throw new RedPackBalanceException(2, "红包余额不足");
        // 验证
        verify(balance);
        // 减少红包
        redPackBalanceMapper.subRedPack(uid, money);
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackExchangeServiceImpl.java
@@ -18,10 +18,10 @@
import com.yeshi.fanli.entity.common.AdminUser;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
import com.yeshi.fanli.entity.redpack.RedPackBalance;
import com.yeshi.fanli.entity.redpack.RedPackDetail;
import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
import com.yeshi.fanli.entity.redpack.RedPackExchange;
import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
import com.yeshi.fanli.exception.redpack.RedPackExchangeException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.money.UserMoneyService;
@@ -90,20 +90,18 @@
        String extractBanlenMin = redPackConfigService.getValueByKey("extract_banlen_min");
    
        RedPackBalance balance = redPackBalanceService.selectByPrimaryKey(uid);
        if (balance == null)
        BigDecimal balance = null;
        try {
            balance = redPackBalanceService.getBalance(uid);
        } catch (RedPackBalanceException e1) {
            throw new RedPackExchangeException(1, e1.getMsg());
        }
        if (balance == null || balance.compareTo(new BigDecimal(extractBanlenMin)) < 0)
            throw new RedPackExchangeException(1, "余额不足" + extractBanlenMin + "元");
        
        if (balance.getState() != null && balance.getState() == RedPackBalance.STATE_LOCKED)
            throw new RedPackExchangeException(1, "红包已封禁,感谢使用");
        BigDecimal balanceMoney = balance.getMoney();
        if (balanceMoney == null || balanceMoney.compareTo(new BigDecimal(extractBanlenMin)) < 0)
            throw new RedPackExchangeException(1, "余额不足" + extractBanlenMin + "元");
        if (balanceMoney.compareTo(amount) < 0)
        if (balance.compareTo(amount) < 0)
            throw new RedPackExchangeException(1, "提现余额不足");
        
        String moneyMin = redPackConfigService.getValueByKey("extract_money_min");
        String moneyMax = redPackConfigService.getValueByKey("extract_money_max");
@@ -171,16 +169,20 @@
            throw new RedPackExchangeException(1,"更新提现明细出错");
        }
        
        //消息
        SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
        String beizu = "红包提现成功后请到“我的-账户余额”中查看";
        MsgRedPackExchangeContentDTO dto = new MsgRedPackExchangeContentDTO();
        dto.setTitle("红包提现");
        dto.setTime(sd.format(record.getCreateTime()));
        dto.setHandle("人工审核" + sd.format(new Date()));
        dto.setMoney("¥" + record.getMoney().setScale(2));
        dto.setBalance("¥" + redPackBalanceService.getBalance(record.getUid()));
        userMoneyMsgNotificationService.redPackMsg(record.getUid(), MsgTypeMoneyTypeEnum.redPackExchangePass, new Gson().toJson(dto), beizu);
        try {
            //消息
            SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
            String beizu = "红包提现成功后请到“我的-账户余额”中查看";
            MsgRedPackExchangeContentDTO dto = new MsgRedPackExchangeContentDTO();
            dto.setTitle("红包提现");
            dto.setTime(sd.format(record.getCreateTime()));
            dto.setHandle("人工审核" + sd.format(new Date()));
            dto.setMoney("¥" + record.getMoney().setScale(2));
            dto.setBalance("¥" + redPackBalanceService.getBalance(record.getUid()));
            userMoneyMsgNotificationService.redPackMsg(record.getUid(), MsgTypeMoneyTypeEnum.redPackExchangePass, new Gson().toJson(dto), beizu);
        } catch (RedPackBalanceException e) {
            throw new RedPackExchangeException(1, e.getMsg());
        }
    }
    
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackGiveRecordServiceImpl.java
@@ -17,10 +17,10 @@
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
import com.yeshi.fanli.entity.bus.user.TokenRecord;
import com.yeshi.fanli.entity.bus.user.TokenRecord.TokenTypeEnum;
import com.yeshi.fanli.entity.redpack.RedPackBalance;
import com.yeshi.fanli.entity.redpack.RedPackDetail;
import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
import com.yeshi.fanli.entity.redpack.RedPackGiveRecord;
import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
import com.yeshi.fanli.exception.redpack.RedPackGiveRecordException;
import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
@@ -111,16 +111,15 @@
        if (amount.compareTo(new BigDecimal(giveMin)) < 0 || amount.compareTo(new BigDecimal(giveMax)) > 0)
            throw new RedPackGiveRecordException(1, "赠送金额至少" + giveMin + "元至多" + giveMax + "元");
        
        RedPackBalance balance = redPackBalanceService.selectByPrimaryKey(uid);
        if (balance == null)
        BigDecimal balance = null;
        try {
            balance = redPackBalanceService.getBalance(uid);
        } catch (RedPackBalanceException e1) {
            throw new RedPackGiveRecordException(1, e1.getMsg());
        }
        if (balance == null || amount.compareTo(balance) > 0)
            throw new RedPackGiveRecordException(1, "余额不足");
        if (balance.getState() != null && balance.getState() == RedPackBalance.STATE_LOCKED)
            throw new RedPackGiveRecordException(1, "红包已封禁,感谢使用");
        if (balance.getMoney() == null || amount.compareTo(balance.getMoney()) > 0)
            throw new RedPackGiveRecordException(1, "余额不足");
        Date nowDate = new Date();
        // 赠送记录
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackBalanceService.java
@@ -20,14 +20,8 @@
     * @param uid
     * @return
     */
    public BigDecimal getBalance(Long uid);
    public BigDecimal getBalance(Long uid) throws RedPackBalanceException;
    /**
     *     添加红包
     * @param uid
     * @param money
     */
    public void addRedPack(Long uid, BigDecimal money);
    
    /**
     *     添加红包
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -772,7 +772,7 @@
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备       注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/img/tlj/icon_tlj.png",
                    dto.getTitle(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
@@ -1312,13 +1312,13 @@
            if (!StringUtil.isNullOrEmpty(dto.getExplain())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getExplain() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("原因", COLOR_TITLE), contentList));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("原        因", COLOR_TITLE), contentList));
            }
            if (dto.getTotal() != null) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getTotal(), COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("可则算额", COLOR_TITLE), contentList));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("可折算额", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getNum())) {
@@ -1330,13 +1330,13 @@
            if (!StringUtil.isNullOrEmpty(dto.getSource())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getSource(), COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
                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));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setIcon(icon);
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/FloatADTypeEnumHandler.java
New file
@@ -0,0 +1,53 @@
package com.yeshi.fanli.util.mybatishandler;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import com.yeshi.fanli.entity.bus.homemodule.FloatAD.FloatADTypeEnum;
public class FloatADTypeEnumHandler extends BaseTypeHandler<FloatADTypeEnum> {
    @Override
    public FloatADTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return FloatADTypeEnum.valueOf(key);
        }
    }
    @Override
    public FloatADTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return FloatADTypeEnum.valueOf(key);
        }
    }
    @Override
    public FloatADTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return FloatADTypeEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, FloatADTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}