| | |
| | | else
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @RequestMapping(value = "getKouBeiLink")
|
| | | public void getKouBeiLink(AcceptData acceptData, Long uid, String activityId, boolean share, boolean shareImg,
|
| | | String callback, PrintWriter out) {
|
| | |
| | |
|
| | | if (dto != null) {
|
| | | if (share) {// 生成口令
|
| | | String token = TaoKeApiUtil.getTKToken("http://", "口碑",dto.getClick_url() );
|
| | | String token = TaoKeApiUtil.getTKToken("http://", "口碑", dto.getClick_url());
|
| | | dto.setToken(TaoBaoUtil.filterTaoToken(token));
|
| | | }
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(dto), 60 * 60);// 缓存1个小时
|
| | |
| | | public void userProtocolListen(AcceptData acceptData, Long uid, int type, PrintWriter out) {
|
| | | LogHelper.userProtocolListen(String.format("%s#%s#%s", acceptData.getDevice(), uid, type));
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 是否显示广告
|
| | | * @Title: showAd
|
| | | * @Description: |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | @RequestMapping(value = "getShowAd")
|
| | | public void showAd(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | String value = configService.get(ConfigKeyEnum.showSplashAd.getKey());
|
| | | JSONObject data = new JSONObject();
|
| | | if ("0".equalsIgnoreCase(value.trim())) {
|
| | | data.put("show", false);
|
| | | } else {
|
| | | data.put("show", true);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
|
| | | goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
|
| | | goodsDetail.getMoneyInfo().setShareMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods,
|
| | | hongBaoManageService.getShareRate(UserLevelEnum.superVIP),true));
|
| | | hongBaoManageService.getShareRate(UserLevelEnum.superVIP), true));
|
| | | goodsDetail.getMoneyInfo().setRateInfo(goodsDetail.getMoneyInfo().getMaxRateInfo());
|
| | | goodsDetail.getMoneyInfo().setCompositionInfo(goodsDetail.getMoneyInfo().getMaxCompositionInfo());
|
| | | }
|
| | |
| | | shareValid = false;
|
| | | helpLink = configService.get(ConfigKeyEnum.zigoulijianNofanliHelp.getKey());
|
| | |
|
| | | BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE,false);
|
| | | BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE,
|
| | | false);
|
| | |
|
| | | ReduceHongBao reduceHongBao = new ReduceHongBao();
|
| | | reduceHongBao.setLeft(buyGoods.getLeftHongBaoCount());
|
| | |
| | | // 商品链接
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePathJD(), "", id + "");
|
| | | try {
|
| | | extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | } catch (Exception e) {
|
| | | // try {
|
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | // } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | }
|
| | | // }
|
| | |
|
| | | String helpLink = null;
|
| | | extraVO.setFanliValid(true);
|
| | |
| | | // 分享路径
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + "");
|
| | | try {
|
| | | extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | } catch (Exception e) {
|
| | | // try {
|
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | // } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | }
|
| | | // }
|
| | |
|
| | | String helpLink = null;
|
| | | extraVO.setFanliValid(true);
|
| | |
| | | // 分享路径
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + "");
|
| | | try {
|
| | | extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | } catch (Exception e) {
|
| | | // try {
|
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | // } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | }
|
| | | // }
|
| | |
|
| | | String helpLink = null;
|
| | | extraVO.setFanliValid(true);
|
| | |
| | | // 分享路径
|
| | | String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + "");
|
| | | try {
|
| | | extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | }
|
| | | // try {
|
| | | // extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
|
| | | // } catch (Exception e) {
|
| | | extraVO.setH5Url(h5Url);
|
| | | // }
|
| | |
|
| | | String helpLink = null;
|
| | | extraVO.setFanliValid(true);
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (goodsType == Constant.SOURCE_TYPE_SUNING) {
|
| | | //猜你喜欢
|
| | | |
| | | // 猜你喜欢
|
| | |
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(Long.parseLong(id), 10);
|
| | |
| | | String quanUrl = null;
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl()))
|
| | | quanUrl = goods.getCouponInfo().getCouponUrl();
|
| | | String link = SuningApiUtil.convertLink(SuningUtil.getProductUrl(supplierCode, goodsCode),
|
| | | quanUrl, SuningApiUtil.PID_BUY, uid + "");
|
| | | String link = SuningApiUtil.convertLink(SuningUtil.getProductUrl(supplierCode, goodsCode), quanUrl,
|
| | | SuningApiUtil.PID_BUY, uid + "");
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("native", false);
|
| | | data.put("jumpLink", link);
|
| | |
| | | * BigDecimal 返回类型 |
| | | * @throws |
| | | */ |
| | | BigDecimal sumMoneyByTargetUidAndDay(@Param("uid") Long uid, @Param("day") String day); |
| | | BigDecimal sumMoneyByTargetUidAndDayAndType(@Param("uid") Long uid, @Param("day") String day,@Param("type") Integer type); |
| | | |
| | | |
| | | /** |
| | | * 根据日期检索用户ID |
| | |
| | | package com.yeshi.fanli.entity.bus.homemodule;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.springframework.format.annotation.DateTimeFormat;
|
| | |
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_float_ad")
|
| | | public class FloatAD {
|
| | | public class FloatAD implements Serializable{
|
| | |
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | // 每天展示一次
|
| | | public static String MODE_ONCE_DAY = "everyday";
|
| | | // 每次打开首页都展示
|
| | |
| | | private Date createTime;
|
| | | @Column(name = "td_update_time")
|
| | | private Date updateTime;
|
| | | @Column(name = "td_type")
|
| | | private Integer type;
|
| | |
|
| | | public Integer getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(Integer type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | private String day;
|
| | | @Column(name = "tdsu_money")
|
| | | private BigDecimal money;
|
| | | @Column(name = "tdsu_type")
|
| | | private Integer type;
|
| | | @Column(name = "tdsu_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "tdsu_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | |
|
| | | public Integer getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(Integer type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
| | | activityDetailLink("activity_detail_link", "活动详情过渡页"), |
| | | |
| | | // 平台规则 |
| | | platformRule("platform_rule_link", "平台规则"); |
| | | platformRule("platform_rule_link", "平台规则"), |
| | | |
| | | showSplashAd("show_splash_ad","是否显示开屏广告"); |
| | | |
| | | private final String key; |
| | | private final String desc; |
| | |
| | | <result column="td_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="td_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="td_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="td_type" property="type" jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">td_id,td_uid,td_day,td_money,td_state,td_create_time,td_update_time |
| | | </sql> |
| | | <sql id="Base_Column_List">td_id,td_uid,td_day,td_money,td_state,td_create_time,td_update_time,td_type</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | |
| | | from yeshi_ec_team_dividents_record where td_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByUidAndDayForUpdate" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_team_dividents_record where td_uid = |
| | | #{uid} and td_day=#{day} for update |
| | | from yeshi_ec_team_dividents_record where td_uid = #{uid} and |
| | | td_day=#{day} for update |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_team_dividents_record where td_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | yeshi_ec_team_dividents_record where td_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_team_dividents_record |
| | | (td_id,td_uid,td_day,td_money,td_state,td_create_time,td_update_time) |
| | | (td_id,td_uid,td_day,td_money,td_state,td_create_time,td_update_time,td_type) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{day,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{day,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{type,jdbcType=INTEGER})</insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="state != null">td_state,</if> |
| | | <if test="createTime != null">td_create_time,</if> |
| | | <if test="updateTime != null">td_update_time,</if> |
| | | <if test="type != null">td_type,</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="type != null">#{type,jdbcType=INTEGER},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | |
| | | #{money,jdbcType=DECIMAL},td_state = |
| | | #{state,jdbcType=INTEGER},td_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},td_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where td_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | #{updateTime,jdbcType=TIMESTAMP} ,td_type =#{type,jdbcType=INTEGER} |
| | | where td_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsRecord"> |
| | | update yeshi_ec_team_dividents_record |
| | |
| | | <if test="state != null">td_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">td_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">td_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="type !=null">td_type =#{type,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where td_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tdsu_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tdsu_type" property="type" jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">tdsu_id,tdsu_target_uid,tdsu_source_uid,tdsu_day,tdsu_money,tdsu_create_time,tdsu_update_time |
| | | <sql id="Base_Column_List">tdsu_id,tdsu_target_uid,tdsu_source_uid,tdsu_day,tdsu_money,tdsu_create_time,tdsu_update_time,tdsu_type |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_team_dividents_source_user |
| | | (tdsu_id,tdsu_target_uid,tdsu_source_uid,tdsu_day,tdsu_money,tdsu_create_time,tdsu_update_time) |
| | | (tdsu_id,tdsu_target_uid,tdsu_source_uid,tdsu_day,tdsu_money,tdsu_create_time,tdsu_update_time,tdsu_type) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{targetUid,jdbcType=BIGINT},#{sourceUid,jdbcType=BIGINT},#{day,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | (#{id,jdbcType=BIGINT},#{targetUid,jdbcType=BIGINT},#{sourceUid,jdbcType=BIGINT},#{day,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{type,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser" |
| | |
| | | <if test="money != null">tdsu_money,</if> |
| | | <if test="createTime != null">tdsu_create_time,</if> |
| | | <if test="updateTime != null">tdsu_update_time,</if> |
| | | <if test="type != null">tdsu_type,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="type != null">#{type,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | |
| | | #{day,jdbcType=VARCHAR},tdsu_money = |
| | | #{money,jdbcType=DECIMAL},tdsu_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},tdsu_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where tdsu_id = #{id,jdbcType=BIGINT} |
| | | #{updateTime,jdbcType=TIMESTAMP} ,tdsu_type =#{type,jdbcType=INTEGER} |
| | | where tdsu_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceUser"> |
| | |
| | | <if test="money != null">tdsu_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="createTime != null">tdsu_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">tdsu_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="type !=null">tdsu_type =#{type,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where tdsu_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | |
| | | <select id="sumMoneyByTargetUidAndDay" resultType="java.math.BigDecimal"> |
| | | <select id="sumMoneyByTargetUidAndDayAndType" resultType="java.math.BigDecimal"> |
| | | select |
| | | sum(tdsu_money) |
| | | from yeshi_ec_team_dividents_source_user where |
| | | sum(tdsu_money) from yeshi_ec_team_dividents_source_user where |
| | | tdsu_target_uid =#{uid} and tdsu_day=#{day} |
| | | <if test="type!=null"> |
| | | and tdsu_type=#{type} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listTargetUidByDay" resultType="java.lang.Long"> |
| | | SELECT |
| | | DISTINCT(u.`tdsu_target_uid`) FROM |
| | | yeshi_ec_team_dividents_source_user |
| | | u WHERE u.`tdsu_day`=#{day} limit |
| | | #{start},#{count} |
| | | <select id="listTargetUidByDay" resultType="java.lang.Long">SELECT |
| | | DISTINCT(u.`tdsu_target_uid`) FROM yeshi_ec_team_dividents_source_user |
| | | u WHERE u.`tdsu_day`=#{day} limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countTargetUidByDay" resultType="java.lang.Long" |
| | | parameterType="java.lang.String"> |
| | | SELECT count(DISTINCT(u.`tdsu_target_uid`)) FROM |
| | | parameterType="java.lang.String">SELECT count(DISTINCT(u.`tdsu_target_uid`)) FROM |
| | | yeshi_ec_team_dividents_source_user u WHERE u.`tdsu_day`=#{day} |
| | | </select> |
| | | |
| | | |
| | | <select id="listBySourceUidAndDay" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | FROM |
| | | yeshi_ec_team_dividents_source_user WHERE |
| | | FROM yeshi_ec_team_dividents_source_user WHERE |
| | | `tdsu_source_uid`=#{sourceUid} and tdsu_day=#{day} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectBySourceUidAndDayAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | FROM |
| | | yeshi_ec_team_dividents_source_user WHERE |
| | | FROM yeshi_ec_team_dividents_source_user WHERE |
| | | `tdsu_source_uid`=#{sourceUid} and tdsu_day=#{day} and |
| | | tdsu_target_uid=#{targetUid} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal sumMoneyByUidAndDay(Long uid, String day) {
|
| | | BigDecimal money = teamDividentsSourceUserMapper.sumMoneyByTargetUidAndDay(uid, day);
|
| | | public BigDecimal sumMoneyByUidAndDay(Long uid, String day,Integer type) {
|
| | | BigDecimal money = teamDividentsSourceUserMapper.sumMoneyByTargetUidAndDayAndType(uid, day,type);
|
| | | if (money == null)
|
| | | return new BigDecimal(0);
|
| | | return money;
|
| | |
| | | UserLevelChangedMQMsg msg = new UserLevelChangedMQMsg(info.getUid(), oldLevel,
|
| | | UserLevelUtil.getByLevel(info.getProcess()), new Date());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userLevelChanged, msg);
|
| | | //延时10s发送
|
| | | message.setStartDeliverTime(System.currentTimeMillis()+1000*10L);
|
| | | producer.send(message);
|
| | | }
|
| | |
|
| | |
| | | * BigDecimal 返回类型
|
| | | * @throws
|
| | | */
|
| | | public BigDecimal sumMoneyByUidAndDay(Long uid, String day);
|
| | | public BigDecimal sumMoneyByUidAndDay(Long uid, String day,Integer type);
|
| | |
|
| | | /**
|
| | | * 查询目标用户列表
|
| | |
| | | * @throws
|
| | | */
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void addTeamDividents(Long uid, Date preSendTime, BigDecimal money)
|
| | | public void addTeamDividents(Long uid, Date preSendTime, BigDecimal money,int type)
|
| | | throws TeamEincomeRecordException, ParamsException {
|
| | | String day = TimeUtil.getGernalTime(preSendTime.getTime(), "yyyy-MM-dd");
|
| | | TeamEincomeRecord record = TeamEincomeRecordFactory.createTeamDividents(day, uid, money, null);
|
| | | TeamEincomeRecord record = TeamEincomeRecordFactory.createTeamDividents(day, uid, money,type, null);
|
| | | teamEincomeRecordService.addTeamEincomeRecord(record);
|
| | | }
|
| | |
|
| | |
| | | totalList.addAll(list);
|
| | | }
|
| | |
|
| | | Map<Long, BigDecimal> moneyMap = new HashMap<>();
|
| | | Map<String, BigDecimal> moneyMap = new HashMap<>();
|
| | |
|
| | | for (TeamDividentsSourceOrderUserMap order : totalList) {
|
| | | TeamDividentsSourceOrderUserMap map = teamDividentsSourceOrderUserMapService
|
| | | .selectByPrimaryKeyForUpdate(order.getId());
|
| | | if (map != null && map.getState() == TeamDividentsSourceOrderUserMap.STATE_JS) {
|
| | | String key = map.getTargetUid() + "#" + map.getType();
|
| | | // 计算分红对应的资金
|
| | | if (moneyMap.get(map.getTargetUid()) == null)
|
| | | moneyMap.put(map.getTargetUid(), new BigDecimal(0));
|
| | | moneyMap.put(map.getTargetUid(), moneyMap.get(map.getTargetUid()).add(map.getMoney()));
|
| | | if (moneyMap.get(key) == null)
|
| | | moneyMap.put(key, new BigDecimal(0));
|
| | | moneyMap.put(key, moneyMap.get(key).add(map.getMoney()));
|
| | | teamDividentsSourceOrderUserMapService.send(map.getId());
|
| | | }
|
| | | }
|
| | |
|
| | | for (Iterator<Long> its = moneyMap.keySet().iterator(); its.hasNext();) {
|
| | | Long uid = its.next();
|
| | | for (Iterator<String> its = moneyMap.keySet().iterator(); its.hasNext();) {
|
| | | String key = its.next();
|
| | | Long uid = Long.parseLong(key.split("#")[0]);
|
| | | Integer type = Integer.parseInt(key.split("#")[1]);
|
| | | BigDecimal dividents = moneyMap.get(uid).setScale(2, BigDecimal.ROUND_DOWN);
|
| | | // 将资金分配到参与分红的用户
|
| | | TeamDividentsSourceUser teamDividentsSourceUser = new TeamDividentsSourceUser();
|
| | |
| | | teamDividentsSourceUser.setMoney(dividents);
|
| | | teamDividentsSourceUser.setSourceUid(sourceUid);
|
| | | teamDividentsSourceUser.setTargetUid(uid);
|
| | | teamDividentsSourceUser.setType(type);
|
| | | teamDividentsSourceUserService.addTeamDividentsSourceUser(teamDividentsSourceUser);
|
| | | }
|
| | | }
|
| | |
| | | return count == 0;
|
| | | }
|
| | |
|
| | | /**
|
| | | * @throws TeamDividentsDebtException |
| | | * 添加分红记录
|
| | | * @Title: addDividentsRecord
|
| | | * @Description: |
| | | * @param uid -用户ID
|
| | | * @param money -分红金额
|
| | | * @param day -分红日期
|
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void addToTeamEincome(Long uid, Date preSendTime) throws TeamDividentsRecordException,
|
| | | private void addToTeamEincome(Long uid, Date preSendTime, int type) throws TeamDividentsRecordException,
|
| | | TeamDividentsDebtException, UserMoneyDetailException, ParamsException, TeamEincomeRecordException {
|
| | | String day = TimeUtil.getGernalTime(preSendTime.getTime(), "yyyy-MM-dd");
|
| | | BigDecimal money = teamDividentsSourceUserService.sumMoneyByUidAndDay(uid, day);
|
| | | BigDecimal money = teamDividentsSourceUserService.sumMoneyByUidAndDay(uid, day, type);
|
| | | // 查询需要扣除的资金
|
| | | List<TeamDividentsDebt> list = teamDividentsDebtService.listNeedRepayDebt(uid, preSendTime, 1, 1000);
|
| | | for (TeamDividentsDebt debt : list) {
|
| | |
| | | record.setMoney(money);
|
| | | record.setState(TeamDividentsRecord.STATE_VALID);
|
| | | record.setUid(uid);
|
| | | record.setType(type);
|
| | | teamDividentsRecordService.addTeamDividentsRecord(record);
|
| | |
|
| | | // 有分红才显示资金明细
|
| | | if (money.compareTo(new BigDecimal(0)) > 0) {
|
| | | teamEincomeManager.addTeamDividents(uid, preSendTime, money);
|
| | | teamEincomeManager.addTeamDividents(uid, preSendTime, money, type);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * @throws TeamDividentsDebtException |
| | | * 添加分红记录
|
| | | * @Title: addDividentsRecord
|
| | | * @Description: |
| | | * @param uid -用户ID
|
| | | * @param money -分红金额
|
| | | * @param day -分红日期
|
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void addToTeamEincome(Long uid, Date preSendTime) throws TeamDividentsRecordException,
|
| | | TeamDividentsDebtException, UserMoneyDetailException, ParamsException, TeamEincomeRecordException {
|
| | |
|
| | | addToTeamEincome(uid, preSendTime, TeamDividentsSourceOrderUserMap.TYPE_MORE_THAN_2);
|
| | | addToTeamEincome(uid, preSendTime, TeamDividentsSourceOrderUserMap.TYPE_TEAM_DIVIDENTS);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | cg.setRate(new BigDecimal(goods.getCommodityInfo().getRate()));
|
| | | cg.setSellerId(Long.parseLong(goods.getCommodityInfo().getSupplierCode()));
|
| | | cg.setSellerName(goods.getCommodityInfo().getSupplierName());
|
| | | cg.setShopType(CommonGoods.SHOP_TYPE_PDD);
|
| | | cg.setShopType(CommonGoods.SHOP_TYPE_SUNING);
|
| | | cg.setState(CommonGoods.STATE_NORMAL);
|
| | | cg.setTitle(goods.getCommodityInfo().getCommodityName());
|
| | | // 保留字段
|
| | |
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.entity.money.TeamEincomeRecord;
|
| | | import com.yeshi.fanli.entity.order.dividents.TeamDividentsSourceOrderUserMap;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | public class TeamEincomeRecordFactory {
|
| | |
| | | * TeamEincomeRecord 返回类型
|
| | | * @throws
|
| | | */
|
| | | public static TeamEincomeRecord createTeamDividents(String day, Long uid, BigDecimal money, String beiZhu) {
|
| | | public static TeamEincomeRecord createTeamDividents(String day, Long uid, BigDecimal money, int type,
|
| | | String beiZhu) {
|
| | | TeamEincomeRecord record = new TeamEincomeRecord();
|
| | | record.setBeiZhu(beiZhu);
|
| | | record.setCreateTime(new Date());
|
| | |
| | | record.setPreRecieveTime(new Date(TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd")));
|
| | | record.setRecieveTime(null);
|
| | | record.setState(TeamEincomeRecord.STATE_NOT_RECIEVE);
|
| | | record.setType(TeamEincomeRecord.TYPE_TEAM_DIVIDENTS);
|
| | | if (type == TeamDividentsSourceOrderUserMap.TYPE_MORE_THAN_2) {
|
| | | record.setType(TeamEincomeRecord.TYPE_TEAM_SUBSIDY);
|
| | | } else
|
| | | record.setType(TeamEincomeRecord.TYPE_TEAM_DIVIDENTS);
|
| | | record.setUid(uid);
|
| | | return record;
|
| | | }
|
| | |
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | |
| | | // 更新上2级的邀请统计
|
| | | teamUserLevelStatisticService.updateUserLevel(msg.getUid());
|
| | | UserInfo boss = threeSaleSerivce.getBoss(msg.getUid());
|
| | |
| | | if (boss != null) {
|
| | | teamUserLevelStatisticService.initData(boss.getId());
|
| | | }
|
| | | |
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
| | | public static BigDecimal getCanShareMoney(Date createTime, BigDecimal estimate) {
|
| | | if (estimate == null)
|
| | | return null;
|
| | | if (createTime.getTime() < TimeUtil.convertToTimeTemp("2020-05-01", "yyyy-MM-dd")) {
|
| | | if (createTime.getTime() < TimeUtil.convertToTimeTemp("2020-06-01 12:30:00", "yyyy-MM-dd HH:mm:ss")) {
|
| | | return estimate;
|
| | | }
|
| | | BigDecimal rate = new BigDecimal("0.8876");
|
| | | BigDecimal rate = new BigDecimal("0.9101");
|
| | | return MoneyBigDecimalUtil.mul(estimate, rate);
|
| | | }
|
| | |
|