Merge remote-tracking branch 'origin/div' into div
| | |
| | | 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;
|
| | |
| | | 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();
|
| | |
| | | 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);
|
| | |
| | |
|
| | | 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;
|
| | |
| | | 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();
|
| | |
| | | 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;
|
| | |
| | | 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 {
|
| | |
| | | }
|
| | |
|
| | | 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));
|
| | |
|
| | |
| | | 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")
|
| | |
| | | @Column(name = "fa_type")
|
| | | private Integer type;
|
| | |
|
| | | @Column(name = "fa_type_enum")
|
| | | private FloatADTypeEnum typeEnum;
|
| | | |
| | | // 启用状态
|
| | | @Column(name = "fa_state")
|
| | | private Integer state;
|
| | |
| | | // 结束时间
|
| | | private String endTime_str;
|
| | |
|
| | | // 结束时间
|
| | | private String typeName;
|
| | |
|
| | |
|
| | | public Long getId() {
|
| | |
| | | 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;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <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">
|
| | |
| | | </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">
|
| | |
| | | <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=",">
|
| | |
| | | <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
|
| | |
| | | = #{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
|
| | |
| | | <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>
|
| | |
| | | <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 |
| | |
| | |
|
| | | <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}
|
| | |
| | |
|
| | | <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>
|
| | |
|
| | |
|
| | |
| | |
|
| | | <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>
|
| | |
| | |
|
| | | <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>
|
| | |
| | |
|
| | | 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;
|
| | |
| | |
|
| | | 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) {
|
| | |
| | | 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)
|
| | |
| | | redPackBalance.setUpdateTime(new Date());
|
| | | redPackBalanceMapper.insertSelective(redPackBalance);
|
| | | } else {
|
| | | // 验证
|
| | | verify(redPackBalance);
|
| | | redPackBalanceMapper.addRedPack(uid, money);
|
| | | }
|
| | | }
|
| | |
| | | if (balance.getMoney().compareTo(money) < 0)
|
| | | throw new RedPackBalanceException(2, "红包余额不足");
|
| | |
|
| | | // 验证
|
| | | verify(balance);
|
| | | |
| | | // 减少红包
|
| | | redPackBalanceMapper.subRedPack(uid, money);
|
| | | }
|
| | |
| | | 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;
|
| | |
| | |
|
| | | 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");
|
| | |
| | | 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());
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
| | | 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;
|
| | |
| | | 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();
|
| | | // 赠送记录
|
| | |
| | | * @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);
|
| | |
|
| | | /**
|
| | | * 添加红包
|
| | |
| | | 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(),
|
| | |
| | | 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())) {
|
| | |
| | | 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);
|
New file |
| | |
| | | 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());
|
| | | }
|
| | |
|
| | | }
|