Merge remote-tracking branch 'origin/div' into div
| | |
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackBalance;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.BindRemindService;
|
| | |
| | |
|
| | | @Resource
|
| | | private BindRemindService bindRemindService;
|
| | | |
| | | @Resource
|
| | | private RedPackBalanceService redPackBalanceService;
|
| | | |
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | | private static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | |
| | | data.put("bindPhone", bindPhone);
|
| | | }
|
| | |
|
| | | // 2.0.2 版本
|
| | | if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | RedPackBalance redPackBalance = redPackBalanceService.selectByPrimaryKey(uid);
|
| | | if (redPackBalance != null && redPackBalance.getState() != null && |
| | | redPackBalance.getState() == RedPackBalance.STATE_LOCKED) {
|
| | | data.put("redPackLock", RedPackBalance.STATE_LOCKED);
|
| | | } else {
|
| | | data.put("redPackLock", RedPackBalance.STATE_INIT);
|
| | | }
|
| | | }
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | final UserInfo uuser = userInfo;
|
| | |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | // @RequestMapping(value = "getList", method = RequestMethod.POST)
|
| | | @RequestMapping(value = "getList", method = RequestMethod.POST)
|
| | | public void getList(AcceptData acceptData, Integer page, Long cid, Long uid, PrintWriter out) {
|
| | | if (Constant.IS_TEST) {
|
| | | getListV3(acceptData, page, cid, uid, out);
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | | if (page == null || page < 1) {
|
| | | out.print(JsonUtil.loadFalseResult("页码不正确"));
|
| | | return;
|
| | |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | // @RequestMapping(value = "getShopInfoV2", method = RequestMethod.POST)
|
| | | @RequestMapping(value = "getShopInfoV2", method = RequestMethod.POST)
|
| | | public void getShopInfoV2(AcceptData acceptData, Integer page, Long id, Long uid, PrintWriter out) {
|
| | | |
| | | if (Constant.IS_TEST) {
|
| | | getShopInfoV3(acceptData, page, id, uid, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | if (id == null) {
|
| | | out.print(JsonUtil.loadFalseResult("缺失店铺id"));
|
| | |
| | | * 精选1, 足迹列表2
|
| | | * @param out
|
| | | */
|
| | | // @RequestMapping(value = "getHistoryV2", method = RequestMethod.POST)
|
| | | @RequestMapping(value = "getHistoryV2", method = RequestMethod.POST)
|
| | | public void getHistoryV2(AcceptData acceptData, Integer page, Long uid, Integer type, PrintWriter out) {
|
| | | if (Constant.IS_TEST) {
|
| | | getHistoryV3(acceptData, page, uid, type, out);
|
| | | return;
|
| | | }
|
| | | |
| | | if (type == null) {
|
| | | out.print(JsonUtil.loadFalseResult("类型不正确"));
|
| | | return;
|
| | |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getList", method = RequestMethod.POST)
|
| | | // @RequestMapping(value = "getList", method = RequestMethod.POST)
|
| | | public void getListV3(AcceptData acceptData, Integer page, Long cid, Long uid, PrintWriter out) {
|
| | | if (page == null || page < 1) {
|
| | | out.print(JsonUtil.loadFalseResult("页码不正确"));
|
| | |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getShopInfoV2", method = RequestMethod.POST)
|
| | | // @RequestMapping(value = "getShopInfoV2", method = RequestMethod.POST)
|
| | | public void getShopInfoV3(AcceptData acceptData, Integer page, Long id, Long uid, PrintWriter out) {
|
| | | if (id == null) {
|
| | | out.print(JsonUtil.loadFalseResult("缺失店铺id"));
|
| | |
| | | * 精选1, 足迹列表2
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHistoryV2", method = RequestMethod.POST)
|
| | | // @RequestMapping(value = "getHistoryV2", method = RequestMethod.POST)
|
| | | public void getHistoryV3(AcceptData acceptData, Integer page, Long uid, Integer type, PrintWriter out) {
|
| | | if (type == null) {
|
| | | out.print(JsonUtil.loadFalseResult("类型不正确"));
|
| | |
| | | String couponHelp = configService.get("taobao_coupon_help");
|
| | | data.put("couponHelpUrl", couponHelp);
|
| | |
|
| | | |
| | | // 判断新老用户 显示热门功能按钮滑动
|
| | | UserActiveLog da = null;
|
| | | if (uid != null)
|
| | | da = userActiveLogService.getFirstActiveInfo(uid);
|
| | | // 新人
|
| | | if (da == null || (System.currentTimeMillis() - da.getCreateTime().getTime()) <= 1000 * 60 * 60 * 24 * 15L) {
|
| | | data.put("userTimeType", 0);
|
| | | } else {// 老人
|
| | | data.put("userTimeType", 1);
|
| | | }
|
| | | |
| | | // 是否显示热门功能按钮
|
| | | String platform = acceptData.getPlatform();
|
| | | data.put("hotFuctionLink",
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "红包已被抢光"));
|
| | | return;
|
| | | }
|
| | | winDetail.setLogo(Constant.systemCommonConfig.getDefaultPortrait());
|
| | | winDetail.setLogoLight(Constant.systemCommonConfig.getDefaultPortrait());
|
| | |
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", redPackConfigService.getValueByKey("goods_shop_link_h5"));
|
| | |
| | | winDetail.setTips(redPackConfigService.getValueByKey("new_user_win_tips"));
|
| | |
|
| | | // 2、顶部轮播图
|
| | | List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("index_top");
|
| | | List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("redpack_win_detail_banner");
|
| | | List<SwiperPicture> topPicList = new ArrayList<>();
|
| | | if (oldtopPicList != null && oldtopPicList.size() > 0)
|
| | | topPicList.addAll(oldtopPicList);
|
| | |
| | | return null;
|
| | |
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("uid").is(uid));
|
| | | query.addCriteria(Criteria.where("_id").is(uid.toString()));
|
| | | return mongoTemplate.findOne(query, RedPackWinNewUser.class);
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | @Table("yeshi_ec_red_pack_balance")
|
| | | public class RedPackBalance {
|
| | |
|
| | | // 初始0
|
| | | public final static int STATE_INIT = 0;
|
| | | // 红包功能关闭
|
| | | public final static int STATE_LOCKED = 1;
|
| | | |
| | | // 用户id
|
| | | @Column(name = "rpb_uid")
|
| | | private Long id;
|
| | | // 余额
|
| | | @Column(name = "rpb_money")
|
| | | private BigDecimal money;
|
| | | // 状态
|
| | | @Column(name = "rpb_state")
|
| | | private Integer state;
|
| | |
|
| | | @Column(name = "rpb_create_time")
|
| | | private Date createTime;
|
| | |
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Document(collection = "yeshi_ec_red_pack_win_new_user")
|
| | | @Document(collection = "redpack_win_new_user")
|
| | | public class RedPackWinNewUser {
|
| | | // 用户id
|
| | | @Field("id")
|
| | | @Field("_id")
|
| | | private String uid;
|
| | | // 领取金额
|
| | | @Field("money")
|
| | |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.redpack.RedPackBalance"> |
| | | <id column="rpb_uid" property="id" jdbcType="BIGINT"/> |
| | | <result column="rpb_money" property="money" jdbcType="DECIMAL"/> |
| | | <result column="rpb_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="rpb_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="rpb_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">rpb_uid,rpb_money,rpb_create_time,rpb_update_time</sql> |
| | | <sql id="Base_Column_List">rpb_uid,rpb_money,rpb_state,rpb_create_time,rpb_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_red_pack_balance where rpb_uid = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_red_pack_balance where rpb_uid = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.redpack.RedPackBalance" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_balance (rpb_uid,rpb_money,rpb_create_time,rpb_update_time) values (#{id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_red_pack_balance where rpb_uid = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.redpack.RedPackBalance" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_balance (rpb_uid,rpb_money,rpb_state,rpb_create_time,rpb_update_time) values (#{id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.redpack.RedPackBalance" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_balance |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">rpb_uid,</if> |
| | | <if test="money != null">rpb_money,</if> |
| | | <if test="state != null">rpb_state,</if> |
| | | <if test="createTime != null">rpb_create_time,</if> |
| | | <if test="updateTime != null">rpb_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</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.redpack.RedPackBalance">update yeshi_ec_red_pack_balance set rpb_money = #{money,jdbcType=DECIMAL},rpb_create_time = #{createTime,jdbcType=TIMESTAMP},rpb_update_time = #{updateTime,jdbcType=TIMESTAMP} where rpb_uid = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.redpack.RedPackBalance">update yeshi_ec_red_pack_balance set rpb_money = #{money,jdbcType=DECIMAL},rpb_state = #{state,jdbcType=INTEGER},rpb_create_time = #{createTime,jdbcType=TIMESTAMP},rpb_update_time = #{updateTime,jdbcType=TIMESTAMP} where rpb_uid = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.redpack.RedPackBalance">update yeshi_ec_red_pack_balance |
| | | <set> |
| | | <if test="money != null">rpb_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="state != null">rpb_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">rpb_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">rpb_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where rpb_uid = #{id,jdbcType=BIGINT} |
| | |
| | | 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);
|
| | |
| | | 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);
|
| | |
| | | Date nowTime = new Date();
|
| | | Date firstLoginTime = userInfoExtra.getFirstLoginTime();
|
| | | int days = DateUtil.daysBetween2(firstLoginTime, nowTime);
|
| | | if (days > Constant.RED_PACK_NEW_USER_DAYS)
|
| | | if (days >= Constant.RED_PACK_NEW_USER_DAYS)
|
| | | return null; // 已经超出设置天数
|
| | |
|
| | | RedPackWinNewUser redPackWin = redPackWinNewUserDao.getByUid(uid);
|
| | |
| | |
|
| | | BigDecimal money = null;
|
| | | if (redPackWin == null) { // 第一次
|
| | | if (days == Constant.RED_PACK_NEW_USER_DAYS) { // 最后一天
|
| | | if (days == Constant.RED_PACK_NEW_USER_DAYS - 1) { // 最后一天
|
| | | money = Constant.RED_PACK_NEW_USER_MONEY;
|
| | | } else { // 计算随机奖励
|
| | | double randomNum = Constant.RED_PACK_NEW_USER_MIN + Math.random() * (Constant.RED_PACK_NEW_USER_MAX - Constant.RED_PACK_NEW_USER_MIN);
|
| | |
| | | BigDecimal rate = new BigDecimal(randomNum).setScale(2, BigDecimal.ROUND_DOWN);
|
| | | money = MoneyBigDecimalUtil.mul(Constant.RED_PACK_NEW_USER_MONEY,rate);
|
| | | }
|
| | | } else if (days == Constant.RED_PACK_NEW_USER_DAYS) { // 最后一天
|
| | | } else if (days == Constant.RED_PACK_NEW_USER_DAYS - 1) { // 最后一天
|
| | | money = MoneyBigDecimalUtil.sub(Constant.RED_PACK_NEW_USER_MONEY, redPackWin.getMoney());
|
| | | } else { // 计算剩余随机奖励 10%-25%
|
| | | double randomNum = 10 + Math.random() * (20 - 10);
|
| | |
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.sub(Constant.RED_PACK_NEW_USER_MONEY,redPackWin.getMoney()),rate);
|
| | | }
|
| | |
|
| | | int num = 1;
|
| | | money = money.setScale(2);
|
| | | // 4、增加红包
|
| | | redPackBalanceService.addRedPack(uid, money, RedPackDetailFactory.createNewUserReward(uid, days, money));
|
| | | |
| | | // 插入领取记录
|
| | | int num = 1;
|
| | | if (redPackWin == null) {
|
| | | redPackWin = new RedPackWinNewUser();
|
| | | redPackWin.setNum(1);
|
| | |
| | | redPackWin.setUpdateTime(nowTime);
|
| | | } else {
|
| | | num = redPackWin.getNum() + 1;
|
| | | redPackWin = new RedPackWinNewUser();
|
| | | redPackWin.setUid(uid.toString());
|
| | | redPackWin.setNum(num);
|
| | | redPackWin.setMoney(MoneyBigDecimalUtil.add(money, redPackWin.getMoney()));
|
| | | redPackWin.setUpdateTime(nowTime);
|
| | | }
|
| | | redPackWinNewUserDao.save(redPackWin);
|
| | | |
| | | // 4、增加红包
|
| | | redPackBalanceService.addRedPack(uid, money, RedPackDetailFactory.createNewUserReward(uid,num, money));
|
| | |
|
| | | RedPackWinDetailVO winDetailVO = new RedPackWinDetailVO();
|
| | | winDetailVO.setTitle("新人红包");
|
| | |
| | | private String params;
|
| | | @Expose
|
| | | private Object jumpDetail;
|
| | | |
| | | |
| | |
|
| | | @Expose
|
| | | private String logoLight;
|
| | | @Expose
|
| | | private String logo;
|
| | |
|
| | | public String getTitle() {
|
| | | return title;
|
| | | }
|
| | |
|
| | | public void setTitle(String title) {
|
| | | this.title = title;
|
| | | }
|
| | |
|
| | | public String getBless() {
|
| | | return bless;
|
| | | }
|
| | |
|
| | | public void setBless(String bless) {
|
| | | this.bless = bless;
|
| | | }
|
| | |
|
| | | public String getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(String money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | public String getDesc() {
|
| | | return desc;
|
| | | }
|
| | |
|
| | | public void setDesc(String desc) {
|
| | | this.desc = desc;
|
| | | }
|
| | |
|
| | | public String getTips() {
|
| | | return tips;
|
| | | }
|
| | |
|
| | | public void setTips(String tips) {
|
| | | this.tips = tips;
|
| | | }
|
| | |
|
| | | public String getParams() {
|
| | | return params;
|
| | | }
|
| | |
|
| | | public void setParams(String params) {
|
| | | this.params = params;
|
| | | }
|
| | |
|
| | | public Object getJumpDetail() {
|
| | | return jumpDetail;
|
| | | }
|
| | |
|
| | | public void setJumpDetail(Object jumpDetail) {
|
| | | this.jumpDetail = jumpDetail;
|
| | | }
|
| | | }
|
| | |
|
| | | public String getLogoLight() {
|
| | | return logoLight;
|
| | | }
|
| | |
|
| | | public void setLogoLight(String logoLight) {
|
| | | this.logoLight = logoLight;
|
| | | }
|
| | |
|
| | | public String getLogo() {
|
| | | return logo;
|
| | | }
|
| | |
|
| | | public void setLogo(String logo) {
|
| | | this.logo = logo;
|
| | | }
|
| | | }
|