| | |
| | | data.put("goods", goods);
|
| | | data.put("shareUsers", listShareUser);
|
| | | data.put("couponUsers", listCouponUser);
|
| | | data.put("detailWebUrl", "http://apph5.yeshitv.com/apppage/goods_img.html?id="+id);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | |
| | | package com.yeshi.fanli.dao.mybatis; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | List<HongBaoV2> listCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid, |
| | | @Param("count") int count); |
| | | |
| | | /** |
| | | * 根据用户ID,订单状态和结算时间统计邀请赚的订单数量 |
| | | * |
| | | * @param uid |
| | | * @param minDate |
| | | * @param maxDate |
| | | * @return |
| | | */ |
| | | Long countInviteOrderCountByUidAndSettleTime(@Param("uid") Long uid, @Param("state") int state, |
| | | @Param("minDate") Date minDate, @Param("maxDate") Date maxDate); |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * 统计用户红包数量 |
| | | * |
| | | * @param uid |
| | | * @param type |
| | | * @param state |
| | |
| | | long selectCountByTypeAndStateAndCreateTime(@Param("uid") Long uid, @Param("type") List<Integer> type, |
| | | @Param("state") List<Integer> state, @Param("minTime") Date minTime, @Param("maxTime") Date maxTime); |
| | | |
| | | |
| | | /** |
| | | * 根据渠道 统计新增用户24小时内产生的订单数量 |
| | | * 根据渠道 统计新增用户24小时内产生的订单数量 |
| | | * |
| | | * @param channel |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> count24HOderByChannel(@Param("channel")String channel, |
| | | @Param("type")Integer type, @Param("years") String years, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | List<Map<String, Object>> count24HOderByChannel(@Param("channel") String channel, @Param("type") Integer type, |
| | | @Param("years") String years, @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | |
| | | /** |
| | | * 根据渠道 统计历史产生的订单数量 |
| | | * 根据渠道 统计历史产生的订单数量 |
| | | * |
| | | * @param channel |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> countHistoryOderByChannel(@Param("channel")String channel, |
| | | @Param("type")Integer type, @Param("years") String years, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | List<Map<String, Object>> countHistoryOderByChannel(@Param("channel") String channel, @Param("type") Integer type, |
| | | @Param("years") String years, @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | @Param("orderState") Integer orderState, @Param("orderNo") String orderNo, |
| | | @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("day") Integer day); |
| | | |
| | | |
| | | /** |
| | | * 统计已到账金额 以及订单数量 |
| | | * |
| | |
| | | * @return |
| | | */ |
| | | |
| | | Map<String, Object> countMoneyGroupOrderNoByUid(@Param("uid") Long uid, @Param("type") Integer type, @Param("orderNo") String orderNo, |
| | | @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("day") Integer day); |
| | | Map<String, Object> countMoneyGroupOrderNoByUid(@Param("uid") Long uid, @Param("type") Integer type, |
| | | @Param("orderNo") String orderNo, @Param("startTime") String startTime, @Param("endTime") String endTime, |
| | | @Param("day") Integer day); |
| | | |
| | | /** |
| | | * 根据用户ID,订单状态和订单结算时间统计订单的数量 |
| | | * |
| | | * @param uid |
| | | * @param state |
| | | * @param minDate |
| | | * @param maxDate |
| | | * @return |
| | | */ |
| | | long countByUidAndOrderStateWithOrderBalanceTime(@Param("uid")Long uid, @Param("state")int state,@Param("minDate") Date minDate,@Param("maxDate") Date maxDate); |
| | | |
| | | /** |
| | | * 根据订单号、订单类型查询商品 |
| | | * |
| | |
| | | @Map("fanli_order_statisticed_msg")
|
| | | private String fanliOrderStatisticedMsg;
|
| | |
|
| | | // 分享订单被统计
|
| | | @Map("share_order_statisticed_title")
|
| | | private String shareOrderStatisticedTitle;
|
| | | @Map("share_order_statisticed_push")
|
| | | private String shareOrderStatisticedPush;
|
| | | @Map("share_order_statisticed_msg")
|
| | | private String shareOrderStatisticedMsg;
|
| | |
|
| | | // 邀请订单被统计
|
| | | @Map("invite_order_statisticed_title")
|
| | | private String inviteOrderStatisticedTitle;
|
| | | @Map("invite_order_statisticed_push")
|
| | | private String inviteOrderStatisticedPush;
|
| | | @Map("invite_order_statisticed_msg")
|
| | | private String inviteOrderStatisticedMsg;
|
| | |
|
| | | // 提成订单被统计
|
| | | @Map("ticheng_order_statisticed_title")
|
| | | private String tichengOrderStatisticedTitle;
|
| | |
| | | private String inviteMoneyRecievePush;
|
| | | @Map("invite_money_recieve_msg")
|
| | | private String inviteMoneyRecieveMsg;
|
| | | |
| | | //分享赚商业收入到账提示
|
| | |
|
| | | // 分享赚商业收入到账提示
|
| | | @Map("share_money_recieve_title")
|
| | | private String shareMoneyRecieveTitle;
|
| | | @Map("share_money_recieve_push")
|
| | | private String shareMoneyRecievePush;
|
| | | @Map("share_money_recieve_msg")
|
| | | private String shareMoneyRecieveMsg;
|
| | | |
| | |
|
| | | // 售后维权订单扣款提示
|
| | |
|
| | |
| | |
|
| | | @Map("weiquan_drawback_fanli_push")
|
| | | private String weiquanDrawbackFanliPush;
|
| | | |
| | | |
| | | //邀请赚维权
|
| | |
|
| | | // 邀请赚维权
|
| | | @Map("weiquan_drawback_invite_title")
|
| | | private String weiquanDrawbackInviteTitle;
|
| | |
|
| | |
| | |
|
| | | @Map("weiquan_drawback_invite_push")
|
| | | private String weiquanDrawbackInvitePush;
|
| | | |
| | | |
| | | //分享赚维权
|
| | |
|
| | | // 分享赚维权
|
| | | @Map("weiquan_drawback_share_title")
|
| | | private String weiquanDrawbackShareTitle;
|
| | |
|
| | |
| | |
|
| | | @Map("extract_success_msg")
|
| | | private String extractSuccessMsg;
|
| | | |
| | | //支付宝账户验证
|
| | |
|
| | | // 支付宝账户验证
|
| | | @Map("alipay_account_valid_title")
|
| | | private String alipayAccountValidTitle;
|
| | | |
| | |
|
| | | @Map("alipay_account_valid_msg")
|
| | | private String alipayAccountValidMsg;
|
| | | |
| | | |
| | |
|
| | | public String getInviteMoneyRecieveTitle() {
|
| | | return inviteMoneyRecieveTitle;
|
| | |
| | | this.orderFanliRecieveTitle = orderFanliRecieveTitle;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | public String getWeiquanDrawbackFanliTitle() {
|
| | | return weiquanDrawbackFanliTitle;
|
| | | }
|
| | |
| | | this.orderFanliRecieveMsg = orderFanliRecieveMsg;
|
| | | }
|
| | |
|
| | |
|
| | | public String getWeiquanDrawbackFanliMsg() {
|
| | | return weiquanDrawbackFanliMsg;
|
| | | }
|
| | |
| | | public void setExtractApplayPush(String extractApplayPush) {
|
| | | this.extractApplayPush = extractApplayPush;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | public String getExtractTransferFailPush() {
|
| | | return extractTransferFailPush;
|
| | |
| | | this.weiquanDrawbackSharePush = weiquanDrawbackSharePush;
|
| | | }
|
| | |
|
| | | public String getShareOrderStatisticedTitle() {
|
| | | return shareOrderStatisticedTitle;
|
| | | }
|
| | |
|
| | | public void setShareOrderStatisticedTitle(String shareOrderStatisticedTitle) {
|
| | | this.shareOrderStatisticedTitle = shareOrderStatisticedTitle;
|
| | | }
|
| | |
|
| | | public String getShareOrderStatisticedPush() {
|
| | | return shareOrderStatisticedPush;
|
| | | }
|
| | |
|
| | | public void setShareOrderStatisticedPush(String shareOrderStatisticedPush) {
|
| | | this.shareOrderStatisticedPush = shareOrderStatisticedPush;
|
| | | }
|
| | |
|
| | | public String getShareOrderStatisticedMsg() {
|
| | | return shareOrderStatisticedMsg;
|
| | | }
|
| | |
|
| | | public void setShareOrderStatisticedMsg(String shareOrderStatisticedMsg) {
|
| | | this.shareOrderStatisticedMsg = shareOrderStatisticedMsg;
|
| | | }
|
| | |
|
| | | public String getInviteOrderStatisticedTitle() {
|
| | | return inviteOrderStatisticedTitle;
|
| | | }
|
| | |
|
| | | public void setInviteOrderStatisticedTitle(String inviteOrderStatisticedTitle) {
|
| | | this.inviteOrderStatisticedTitle = inviteOrderStatisticedTitle;
|
| | | }
|
| | |
|
| | | public String getInviteOrderStatisticedPush() {
|
| | | return inviteOrderStatisticedPush;
|
| | | }
|
| | |
|
| | | public void setInviteOrderStatisticedPush(String inviteOrderStatisticedPush) {
|
| | | this.inviteOrderStatisticedPush = inviteOrderStatisticedPush;
|
| | | }
|
| | |
|
| | | public String getInviteOrderStatisticedMsg() {
|
| | | return inviteOrderStatisticedMsg;
|
| | | }
|
| | |
|
| | | public void setInviteOrderStatisticedMsg(String inviteOrderStatisticedMsg) {
|
| | | this.inviteOrderStatisticedMsg = inviteOrderStatisticedMsg;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_hongbao where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | |
| | | |
| | | <select id="selectCountByTypeAndStateAndCreateTime" resultType="java.lang.Long"> |
| | | SELECT COUNT(h.`id`) FROM yeshi_ec_hongbao h WHERE uid=#{uid} |
| | | <foreach collection="type" item="itemType" open="and (" separator=" or " |
| | | close=")"> |
| | | <foreach collection="type" item="itemType" open="and (" |
| | | separator=" or " close=")"> |
| | | h.`type`=#{itemType} |
| | | </foreach> |
| | | |
| | | |
| | | <foreach collection="state" item="itemState" open="and (" separator=" or " |
| | | close=")"> |
| | | |
| | | |
| | | <foreach collection="state" item="itemState" open="and (" |
| | | separator=" or " close=")"> |
| | | h.`state`=#{itemState} |
| | | </foreach> |
| | | |
| | |
| | | ]]> |
| | | #{maxTime}; |
| | | </select> |
| | | |
| | | |
| | | <select id="count24HOderByChannel" resultType="java.util.HashMap"> |
| | | SELECT COALESCE(SUM(b.money*2),0) AS 'commision', COALESCE(COUNT(b.id),0) AS'countOrder', |
| | | COALESCE(SUM(b.payMoney),0) AS 'payMoney', |
| | | <if test="type == 1"> |
| | | FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'createDate' |
| | | </if> |
| | | <if test="type == 2"> |
| | | FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'createDate' |
| | | </if> |
| | | <if test="type == 3"> |
| | | FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'createDate' |
| | | </if> |
| | | FROM |
| | | ( |
| | | SELECT h.* FROM yeshi_ec_hongbao h |
| | | LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a |
| | | WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a |
| | | ON a.uid=h.`uid` WHERE a.uid IS NOT NULL AND (h.`type`=1 OR h.`type`=20) |
| | | ) b |
| | | LEFT JOIN yeshi_ec_user u ON u.`id`=b.uid |
| | | WHERE <![CDATA[b.createtime<u.`createtime`+1000*60*60*24 ]]> |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}' |
| | | </if> |
| | | <if test="years != null and years != '' "> |
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}' |
| | | </if> |
| | | SELECT COALESCE(SUM(b.money*2),0) AS 'commision', |
| | | COALESCE(COUNT(b.id),0) AS'countOrder', |
| | | COALESCE(SUM(b.payMoney),0) AS 'payMoney', |
| | | <if test="type == 1"> |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') |
| | | FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'createDate' |
| | | </if> |
| | | <if test="type == 2"> |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m') |
| | | FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'createDate' |
| | | </if> |
| | | <if test="type == 3"> |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y') |
| | | </if> |
| | | FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'createDate' |
| | | </if> |
| | | FROM |
| | | ( |
| | | SELECT h.* FROM yeshi_ec_hongbao h |
| | | LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a |
| | | WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a |
| | | ON a.uid=h.`uid` WHERE a.uid IS NOT NULL AND (h.`type`=1 OR h.`type`=20) |
| | | ) b |
| | | LEFT JOIN yeshi_ec_user u ON u.`id`=b.uid |
| | | WHERE <![CDATA[b.createtime<u.`createtime`+1000*60*60*24 ]]> |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> |
| | | '${endTime}' |
| | | </if> |
| | | <if test="years != null and years != '' "> |
| | | AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}' |
| | | </if> |
| | | <if test="type == 1"> |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') |
| | | </if> |
| | | <if test="type == 2"> |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m') |
| | | </if> |
| | | <if test="type == 3"> |
| | | GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y') |
| | | </if> |
| | | ORDER BY u.`createtime` |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="countHistoryOderByChannel" resultType="java.util.HashMap"> |
| | | |
| | | SELECT COALESCE(SUM(h.`money`)*2,0) AS 'commision', COALESCE(COUNT(h.id),0) AS 'countOrder', |
| | | COALESCE(SUM(h.payMoney),0) AS 'payMoney', |
| | | <if test="type == 1"> |
| | | FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS 'createDate' |
| | | </if> |
| | | <if test="type == 2"> |
| | | FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'createDate' |
| | | </if> |
| | | <if test="type == 3"> |
| | | FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'createDate' |
| | | </if> |
| | | FROM yeshi_ec_hongbao h |
| | | LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a |
| | | WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON h.`uid`=a.uid |
| | | WHERE (h.`type`=1 OR h.`type`=20) AND a.uid IS NOT NULL |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}' |
| | | </if> |
| | | <if test="years != null and years != '' "> |
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y') = '${years}' |
| | | </if> |
| | | |
| | | SELECT COALESCE(SUM(h.`money`)*2,0) AS 'commision', |
| | | COALESCE(COUNT(h.id),0) AS 'countOrder', |
| | | COALESCE(SUM(h.payMoney),0) AS 'payMoney', |
| | | <if test="type == 1"> |
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') |
| | | FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS 'createDate' |
| | | </if> |
| | | <if test="type == 2"> |
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m') |
| | | FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'createDate' |
| | | </if> |
| | | <if test="type == 3"> |
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y') |
| | | </if> |
| | | FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'createDate' |
| | | </if> |
| | | FROM yeshi_ec_hongbao h |
| | | LEFT JOIN (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active` a |
| | | WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON |
| | | h.`uid`=a.uid |
| | | WHERE (h.`type`=1 OR h.`type`=20) AND a.uid IS NOT NULL |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> |
| | | '${endTime}' |
| | | </if> |
| | | <if test="years != null and years != '' "> |
| | | AND FROM_UNIXTIME(h.`createtime`/1000,'%Y') = '${years}' |
| | | </if> |
| | | <if test="type == 1"> |
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') |
| | | </if> |
| | | <if test="type == 2"> |
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m') |
| | | </if> |
| | | <if test="type == 3"> |
| | | GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y') |
| | | </if> |
| | | ORDER BY h.`createtime` |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="listCanBalanceHongBaoByType" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | <select id="listCanBalanceHongBaoByType" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_hongbao_v2 h WHERE h.`hb_version`=2 AND |
| | |
| | | <select id="listCanBalanceHongBaoByTypeAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and `version`=2 |
| | | from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and `hb_version`=2 |
| | | |
| | | <foreach collection="types" item="type" open=" and (" |
| | | separator=" or " close=")"> |
| | |
| | | NOW()>=hb_pre_get_time limit |
| | | #{count} |
| | | </select> |
| | | |
| | | <select id="countInviteOrderCountByUidAndSettleTime" resultType="java.lang.Long"> |
| | | SELECT COUNT(h.hb_id) FROM yeshi_ec_hongbao_v2 h LEFT JOIN |
| | | yeshi_ec_hongbao_order ho ON h.`hb_pid`=ho.`ho_hongbao_id` LEFT JOIN |
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE |
| | | h.`hb_uid`=#{uid} and (h.`hb_type`=6 or h.`hb_type`=7 OR |
| | | h.`hb_type`=21 OR h.`hb_type`=22) and co.`co_state`=#{state} and |
| | | co.`co_settle_time` is not null and co.`co_settle_time`>=#{minDate} |
| | | and #{maxDate}>co.`co_settle_time`; |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | |
| | | <id column="co_order_goods_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | |
| | | <resultMap id="BaseDetailResultMap" type="com.yeshi.fanli.entity.order.CommonOrder"> |
| | | <id column="co_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> |
| | |
| | | <id column="co_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="commonOrderGoods" resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap"> |
| | | |
| | | <association property="commonOrderGoods" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap"> |
| | | |
| | | </association> |
| | | </resultMap> |
| | | |
| | |
| | | * from yeshi_ec_common_order where co_order_no=#{orderNo} |
| | | and |
| | | co_source_type=#{orderType} and co_order_by=#{orderBy} |
| | | </select> |
| | | |
| | | <select id="countByUidAndOrderStateWithOrderBalanceTime" |
| | | resultType="java.lang.Long"> |
| | | SELECT COUNT(*) FROM yeshi_ec_common_order co WHERE |
| | | co.`co_state`=#{state} and co.`co_uid`=#{uid} and co.`co_settle_time` |
| | | is not null and co.`co_settle_time`>=#{minDate} and |
| | | #{maxDate}>co.`co_settle_time` |
| | | </select> |
| | | |
| | | |
| | |
| | | DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countMoneyGroupOrderNoByUid" resultType="java.util.Map"> |
| | | SELECT COALESCE(SUM(A.moneys),0)AS totalMoney,COUNT(*) AS totalRow FROM |
| | | (SELECT COALESCE(SUM(th.`hb_money`),0)AS moneys FROM yeshi_ec_common_order tc |
| | | LEFT JOIN |
| | | yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN |
| | | yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} AND th.hb_state = 3 AND (tc.co_state = 1 or tc.co_state = 2) |
| | | <if test="type != null and type == 1"> <!-- 自购订单 --> |
| | | AND (th.hb_type =1 or th.hb_type =2) |
| | | </if> |
| | | <if test="type != null and type == 2"> <!-- 分享订单 --> |
| | | AND (th.`hb_type` = 20 OR th.`hb_type` = 21 OR th.`hb_type` = 22) |
| | | </if> |
| | | <if test="type != null and type == 3"> <!-- 邀请订单 --> |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | </if> |
| | | <if test="orderNo != null"> |
| | | AND tc.co_order_no = #{orderNo} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time <= #{endTime}]]> |
| | | </if> |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | <if test="day != null and day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(tc.`co_create_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day != null and day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF( DATE_FORMAT(NOW(), '%Y%m'), |
| | | DATE_FORMAT(tc.`co_create_time`, '%Y%m')) = 1 |
| | | </if> |
| | | GROUP BY tc.`co_order_no`,tc.co_source_type)A |
| | | SELECT COALESCE(SUM(A.moneys),0)AS totalMoney,COUNT(*) AS totalRow |
| | | FROM |
| | | (SELECT COALESCE(SUM(th.`hb_money`),0)AS moneys FROM yeshi_ec_common_order tc |
| | | LEFT JOIN |
| | | yeshi_ec_hongbao_order tr ON tr.`ho_order_id` = tc.`co_id` |
| | | LEFT JOIN |
| | | yeshi_ec_hongbao_v2 th ON (tr.`ho_hongbao_id` = th.`hb_id` OR |
| | | th.`hb_pid` = tr.`ho_hongbao_id` ) |
| | | WHERE th.`hb_uid` = #{uid} AND th.hb_state = 3 AND (tc.co_state = 1 or |
| | | tc.co_state = 2) |
| | | <if test="type != null and type == 1"> <!-- 自购订单 --> |
| | | AND (th.hb_type =1 or th.hb_type =2) |
| | | </if> |
| | | <if test="type != null and type == 2"> <!-- 分享订单 --> |
| | | AND (th.`hb_type` = 20 OR th.`hb_type` = 21 OR th.`hb_type` = 22) |
| | | </if> |
| | | <if test="type != null and type == 3"> <!-- 邀请订单 --> |
| | | AND (th.`hb_type` = 5 OR th.`hb_type` = 6 OR th.`hb_type` = 7) |
| | | </if> |
| | | <if test="orderNo != null"> |
| | | AND tc.co_order_no = #{orderNo} |
| | | </if> |
| | | <if test="startTime != null"> |
| | | AND <![CDATA[tc.co_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND <![CDATA[tc.co_create_time <= #{endTime}]]> |
| | | </if> |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(tc.`co_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(tc.`co_create_time`) = 1 |
| | | </if> |
| | | <if test="day != null and day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(tc.`co_create_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day != null and day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF( DATE_FORMAT(NOW(), '%Y%m'), |
| | | DATE_FORMAT(tc.`co_create_time`, '%Y%m')) = 1 |
| | | </if> |
| | | GROUP BY tc.`co_order_no`,tc.co_source_type)A |
| | | </select> |
| | | |
| | | <select id="countGroupOrderNoByUid" resultType="java.lang.Long"> |
| | |
| | | parameterType="java.util.List"> |
| | | SELECT COALESCE(SUM(tc.`co_settlement`),0)AS |
| | | totalSettlement,COALESCE(SUM(tc.`co_count`),0)AS |
| | | totalCount,tc.`co_source_type`,tc.`co_order_no`,tg.* |
| | | totalCount,tc.`co_source_type`,tc.`co_order_no`,tg.*,tc.co_id |
| | | FROM |
| | | yeshi_ec_common_order_goods tg |
| | | LEFT JOIN yeshi_ec_common_order tc ON |
| | |
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsGroupService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addHongBao(CommonOrder commonOrder, int type) throws HongBaoException {
|
| | | if (commonOrder == null || commonOrder.getId() == null || commonOrder.getUserInfo() == null)
|
| | | throw new HongBaoException(1, "订单信息不完整");
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
|
| | | if (hongBaoOrder == null) {
|
| | | saveHongBao(commonOrder, type);
|
| | | } else {
|
| | | updateHongBao(hongBaoOrder, commonOrder, type);
|
| | | }
|
| | | public void addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException {
|
| | |
|
| | | if (commonOrderList != null && commonOrderList.size() > 0) {
|
| | | Map<Integer, HongBaoV2> notificationMap = new HashMap<>();
|
| | | for (CommonOrder commonOrder : commonOrderList) {
|
| | | if (commonOrder == null || commonOrder.getId() == null || commonOrder.getUserInfo() == null)
|
| | | throw new HongBaoException(1, "订单信息不完整");
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
|
| | | if (hongBaoOrder == null) {
|
| | | saveHongBao(commonOrder, type, notificationMap);
|
| | | } else {
|
| | | updateHongBao(hongBaoOrder, commonOrder, type);
|
| | | }
|
| | | }
|
| | | /**
|
| | | * 通知用户的返利情况
|
| | | */
|
| | | Iterator<Integer> its = notificationMap.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | Integer t = its.next();
|
| | | HongBaoV2 notify = notificationMap.get(t);
|
| | | String orderId = commonOrderList.get(0).getOrderNo();
|
| | | Long uid = notify.getUserInfo().getId();
|
| | | BigDecimal money = notify.getMoney();
|
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userNotificationService.orderFanliStatisticed(uid, orderId);
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | | userNotificationService.orderShareStatisticed(uid, orderId, money);
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userNotificationService.orderInviteStatisticed(uid, orderId, money);
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | userNotificationService.orderInviteStatisticed(uid, orderId, money);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | |
| | | }
|
| | |
|
| | | @Transactional
|
| | | private void saveHongBao(CommonOrder commonOrder, int type) throws HongBaoException {
|
| | | private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoV2> notificationMap)
|
| | | throws HongBaoException {
|
| | | if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
|
| | | BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime());
|
| | | HongBaoV2 hongBao = new HongBaoV2();
|
| | |
| | | hongBaoOrder.setCreateTime(new Date());
|
| | | hongBaoOrder.setHongBaoV2(hongBao);
|
| | | hongBaoOrderMapper.insertSelective(hongBaoOrder);
|
| | | // 加入通知
|
| | | if (notificationMap.get(type) == null)
|
| | | notificationMap.put(type, hongBao);
|
| | | else {
|
| | | notificationMap.get(type).setMoney(notificationMap.get(type).getMoney().add(hongBao.getMoney()));
|
| | | }
|
| | |
|
| | | UserInfo boss = threeSaleSerivce.getBoss(user.getId());
|
| | | if (boss != null && hongBao.getState() != HongBaoV2.STATE_SHIXIAO) {// 1级BOSS存在且红包未失效
|
| | |
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), firstRate.divide(new BigDecimal(100))));
|
| | | }
|
| | | hongBaoV2Mapper.insertSelective(firstHongbao);
|
| | | // 用户通知
|
| | | if (notificationMap.get(HongBaoV2.TYPE_YIJI) == null)
|
| | | notificationMap.put(HongBaoV2.TYPE_YIJI, firstHongbao);
|
| | | else {
|
| | | notificationMap.get(HongBaoV2.TYPE_YIJI)
|
| | | .setMoney(notificationMap.get(HongBaoV2.TYPE_YIJI).getMoney().add(firstHongbao.getMoney()));
|
| | | }
|
| | |
|
| | | // 插入二级子红包
|
| | | boss = threeSaleSerivce.getBoss(boss.getId());
|
| | |
| | | secondHongbao.setVersion(2);
|
| | | secondHongbao.setState(hongBao.getState());
|
| | | if (hongBao.getState() == HongBaoV2.STATE_KELINGQU) {
|
| | | firstHongbao.setMoney(
|
| | | secondHongbao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), secondRate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | |
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), secondRate.divide(new BigDecimal(100))));
|
| | | }
|
| | | hongBaoV2Mapper.insertSelective(secondHongbao);
|
| | |
|
| | | // 用户通知
|
| | | if (notificationMap.get(HongBaoV2.TYPE_ERJI) == null)
|
| | | notificationMap.put(HongBaoV2.TYPE_ERJI, secondHongbao);
|
| | | else {
|
| | | notificationMap.get(HongBaoV2.TYPE_ERJI).setMoney(
|
| | | notificationMap.get(HongBaoV2.TYPE_ERJI).getMoney().add(secondHongbao.getMoney()));
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | hongBaoOrder.setHongBaoV2(hongBao);
|
| | | hongBaoOrderMapper.insertSelective(hongBaoOrder);
|
| | |
|
| | | if (notificationMap.get(type) == null)
|
| | | notificationMap.put(type, hongBao);
|
| | | else {
|
| | | notificationMap.get(type).setMoney(notificationMap.get(type).getMoney().add(hongBao.getMoney()));
|
| | | }
|
| | |
|
| | | // 修改统计数据
|
| | | Long goodsId = commonOrder.getCommonOrderGoods().getId();
|
| | | // 查询商品
|
| | |
| | | orderStateContent = "已维权";
|
| | |
|
| | | /* 订单维权 判断是否全部维权 */
|
| | | List<TaoBaoWeiQuanOrder> listWQ = |
| | | taoBaoWeiQuanOrderMapper.selectListByOrderIdAndState(order.getOrderNo(), "维权成功");
|
| | | List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(order.getOrderNo(), "维权成功");
|
| | |
|
| | | boolean isPart = false;// 默认失效
|
| | |
|
| | |
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public CommonOrder addTaoBaoOrder(TaoBaoOrder taoBaoOrder, Long uid) throws CommonOrderException {
|
| | | CommonOrder commonOrder = commonOrderMapper.selectByOrderNoAndOrderTypeAndOrderBy(taoBaoOrder.getOrderId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO, taoBaoOrder.getOrderBy());
|
| | | if (commonOrder == null)// 新增
|
| | | {
|
| | | commonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | | CommonOrderGoods goods = new CommonOrderGoods();
|
| | | goods.setGoodsId(taoBaoOrder.getAuctionId() + "");
|
| | | goods.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | // 商品是否已经插入
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper
|
| | | .listByGoodsIdAndGoodsType(goods.getGoodsId(), goods.getGoodsType());
|
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品
|
| | | public List<CommonOrder> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrders, Long uid) throws CommonOrderException {
|
| | | List<CommonOrder> commonOrderList = new ArrayList<>();
|
| | | for (TaoBaoOrder taoBaoOrder : taoBaoOrders) {
|
| | | CommonOrder commonOrder = commonOrderMapper.selectByOrderNoAndOrderTypeAndOrderBy(taoBaoOrder.getOrderId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO, taoBaoOrder.getOrderBy());
|
| | | if (commonOrder == null)// 新增
|
| | | {
|
| | | TaoBaoGoodsBrief taoBaoGoods = null;
|
| | | try {
|
| | | taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId());
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (taoBaoGoods != null) {
|
| | | goods = CommonOrderGoodsFactory.create(taoBaoGoods);
|
| | | }
|
| | | goods.setCreateTime(new Date());
|
| | | goods.setUpdateTime(new Date());
|
| | | commonOrderGoodsMapper.insertSelective(goods);
|
| | | } else
|
| | | goods.setId(commonGoodsList.get(commonGoodsList.size() - 1).getId());
|
| | | commonOrder.setCommonOrderGoods(goods);
|
| | | commonOrder.setUserInfo(new UserInfo(uid));
|
| | | commonOrder.setCreateTime(new Date());
|
| | | commonOrderMapper.insertSelective(commonOrder);
|
| | | |
| | | commonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | | CommonOrderGoods goods = new CommonOrderGoods();
|
| | | goods.setGoodsId(taoBaoOrder.getAuctionId() + "");
|
| | | goods.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | // 商品是否已经插入
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper
|
| | | .listByGoodsIdAndGoodsType(goods.getGoodsId(), goods.getGoodsType());
|
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品
|
| | | {
|
| | | TaoBaoGoodsBrief taoBaoGoods = null;
|
| | | try {
|
| | | taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId());
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (taoBaoGoods != null) {
|
| | | goods = CommonOrderGoodsFactory.create(taoBaoGoods);
|
| | | }
|
| | | goods.setCreateTime(new Date());
|
| | | goods.setUpdateTime(new Date());
|
| | | commonOrderGoodsMapper.insertSelective(goods);
|
| | | } else
|
| | | goods.setId(commonGoodsList.get(commonGoodsList.size() - 1).getId());
|
| | | commonOrder.setCommonOrderGoods(goods);
|
| | | commonOrder.setUserInfo(new UserInfo(uid));
|
| | | commonOrder.setCreateTime(new Date());
|
| | | commonOrderMapper.insertSelective(commonOrder);
|
| | |
|
| | | return commonOrder;
|
| | | } else {// 修改
|
| | | // 已经结算或者已经失效的订单不处理
|
| | | if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_SX)
|
| | | return commonOrder;
|
| | | CommonOrder newCommonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | | CommonOrder updateCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | updateCommonOrder.seteIncome(newCommonOrder.geteIncome());
|
| | | updateCommonOrder.setEstimate(newCommonOrder.getEstimate());
|
| | | updateCommonOrder.setPayment(newCommonOrder.getPayment());
|
| | | updateCommonOrder.setSettlement(newCommonOrder.getSettlement());
|
| | | updateCommonOrder.setSettleTime(newCommonOrder.getSettleTime());
|
| | | updateCommonOrder.setState(newCommonOrder.getState());
|
| | | updateCommonOrder.setUpdateTime(new Date());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(updateCommonOrder);
|
| | | return commonOrderMapper.selectByPrimaryKey(updateCommonOrder.getId());
|
| | | commonOrderList.add(commonOrder);
|
| | | continue;
|
| | | } else {// 修改
|
| | | // 已经结算或者已经失效的订单不处理
|
| | | if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | commonOrderList.add(commonOrder);
|
| | | continue;
|
| | | }
|
| | | CommonOrder newCommonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | | CommonOrder updateCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | updateCommonOrder.seteIncome(newCommonOrder.geteIncome());
|
| | | updateCommonOrder.setEstimate(newCommonOrder.getEstimate());
|
| | | updateCommonOrder.setPayment(newCommonOrder.getPayment());
|
| | | updateCommonOrder.setSettlement(newCommonOrder.getSettlement());
|
| | | updateCommonOrder.setSettleTime(newCommonOrder.getSettleTime());
|
| | | updateCommonOrder.setState(newCommonOrder.getState());
|
| | | updateCommonOrder.setUpdateTime(new Date());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(updateCommonOrder);
|
| | | commonOrderList.add(commonOrderMapper.selectByPrimaryKey(updateCommonOrder.getId()));
|
| | | continue;
|
| | | }
|
| | | }
|
| | | return commonOrderList;
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | String endTime, Integer day) {
|
| | | return commonOrderMapper.countMoneyGroupOrderNoByUid(uid, type, orderNo, startTime, endTime, day);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByUidAndOrderStateWithOrderBalanceTime(Long uid, int state, Date minDate, Date maxDate) {
|
| | |
|
| | | return commonOrderMapper.countByUidAndOrderStateWithOrderBalanceTime(uid, state, minDate, maxDate);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.HashSet;
|
| | |
| | | updateHongBao.setId(hongBao.getId());
|
| | | updateHongBao.setGetTime(new Date());
|
| | | updateHongBao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | updateHongBao.setUpdateTime(new Date());
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | // 添加到红包返利记录集合
|
| | | hbIdList.add(hongBao.getId());
|
| | |
| | | updateHongBao.setId(hb.getId());
|
| | | updateHongBao.setGetTime(new Date());
|
| | | updateHongBao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | updateHongBao.setUpdateTime(new Date());
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | // 添加到红包返利记录集合
|
| | | hbIdList.add(hb.getId());
|
| | |
| | |
|
| | | // 添加新版详情记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createInvite(uid, 0, 0, 0, invitemoney,
|
| | | new Date());
|
| | | // 查询邀请赚的有效订单,失效订单,维权订单
|
| | | Calendar ca = Calendar.getInstance();
|
| | | Date maxDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(ca.get(Calendar.YEAR) + "-" + (ca.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | ca.add(Calendar.MONTH, -1);
|
| | |
|
| | | Date minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(ca.get(Calendar.YEAR) + "-" + (ca.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | long validCount = hongBaoV2Mapper.countInviteOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_JS,
|
| | | minDate, maxDate);
|
| | | long weiQuanCount = hongBaoV2Mapper.countInviteOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_WQ,
|
| | | minDate, maxDate);
|
| | | long invalidCount = hongBaoV2Mapper.countInviteOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_SX,
|
| | | minDate, maxDate);
|
| | |
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createInvite(uid, (int) validCount,
|
| | | (int) weiQuanCount, (int) invalidCount, invitemoney, new Date());
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | |
| | | updateHongBao.setId(hongBao.getId());
|
| | | updateHongBao.setGetTime(new Date());
|
| | | updateHongBao.setState(HongBao.STATE_YILINGQU);
|
| | | updateHongBao.setUpdateTime(new Date());
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | // 添加到红包返利记录集合
|
| | | hbIdList.add(hongBao.getId());
|
| | |
| | |
|
| | | // 添加新版详情记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShare(uid, 0, 0, 0, sharemoney,
|
| | | new Date());
|
| | | // 计算本月的有效订单,失效订单,维权订单
|
| | | Calendar ca = Calendar.getInstance();
|
| | |
|
| | | Date maxDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(ca.get(Calendar.YEAR) + "-" + (ca.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | ca.add(Calendar.MONTH, -1);
|
| | |
|
| | | Date minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(ca.get(Calendar.YEAR) + "-" + (ca.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | long validCount = commonOrderService.countByUidAndOrderStateWithOrderBalanceTime(uid,
|
| | | CommonOrder.STATE_JS, minDate, maxDate);
|
| | | long weiQuanCount = commonOrderService.countByUidAndOrderStateWithOrderBalanceTime(uid,
|
| | | CommonOrder.STATE_WQ, minDate, maxDate);
|
| | | long invalidCount = commonOrderService.countByUidAndOrderStateWithOrderBalanceTime(uid,
|
| | | CommonOrder.STATE_SX, minDate, maxDate);
|
| | |
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShare(uid, (int) validCount,
|
| | | (int) weiQuanCount, (int) invalidCount, sharemoney, new Date());
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | |
| | | orderMapper.updateByPrimaryKeySelective(updateOrder);
|
| | |
|
| | | // 用第一个子订单锁定用户
|
| | | for (TaoBaoOrder taoBaoOrder : orderList) {
|
| | | List<CommonOrder> commonOrderList = null;
|
| | | try {
|
| | | commonOrderList = commonOrderService.addTaoBaoOrder(orderList, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_ZIGOU);
|
| | | } catch (CommonOrderException e) {
|
| | | try {
|
| | | CommonOrder commonOrder = commonOrderService.addTaoBaoOrder(taoBaoOrder, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrder, HongBaoV2.TYPE_ZIGOU);
|
| | | } catch (CommonOrderException e) {
|
| | | e.printStackTrace();
|
| | | } catch (HongBaoException e1) {
|
| | | LogHelper.errorDetailInfo(e, null, "订单号:" + orderId);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
| | | return;
|
| | |
|
| | | // 用第一个子订单锁定用户
|
| | | for (TaoBaoOrder taoBaoOrder : orderList) {
|
| | | try {
|
| | | CommonOrder commonOrder = commonOrderService.addTaoBaoOrder(taoBaoOrder, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrder, HongBaoV2.TYPE_SHARE_GOODS);
|
| | | } catch (CommonOrderException e) {
|
| | | e.printStackTrace();
|
| | | } catch (HongBaoException e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | try {
|
| | | List<CommonOrder> commonOrders = commonOrderService.addTaoBaoOrder(orderList, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrders, HongBaoV2.TYPE_SHARE_GOODS);
|
| | | } catch (CommonOrderException e) {
|
| | | e.printStackTrace();
|
| | | } catch (HongBaoException e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | |
| | | List<HongBaoV2> mainHongBaoList = new ArrayList<>();
|
| | | if (commonOrderList != null)
|
| | | for (CommonOrderVO vo : commonOrderList) {
|
| | | // 修改订单状态为维权
|
| | | CommonOrder co = new CommonOrder(vo.getId());
|
| | | co.setState(CommonOrder.STATE_WQ);
|
| | | co.setUpdateTime(new Date());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(co);
|
| | |
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(vo.getId());
|
| | | mainHongBaoList.add(hongBaoOrder.getHongBaoV2());
|
| | | }
|
| | | if (mainHongBaoList == null || mainHongBaoList.size() == 0)
|
| | | return;
|
| | | for (int i = 0; i < mainHongBaoList.size(); i++) {
|
| | | HongBaoV2 hb = hongBaoV2Mapper.selectByPrimaryKey(mainHongBaoList.get(i).getId());
|
| | | mainHongBaoList.set(i, hb);
|
| | | // 只处理返利订单
|
| | | if (mainHongBaoList.get(i).getType() != HongBaoV2.TYPE_ZIGOU) {
|
| | | if (hb.getType() != HongBaoV2.TYPE_ZIGOU) {
|
| | | mainHongBaoList.remove(i);
|
| | | i--;
|
| | | }
|
| | |
| | | List<HongBaoV2> mainHongBaoList = new ArrayList<>();
|
| | | if (commonOrderList != null)
|
| | | for (CommonOrderVO vo : commonOrderList) {
|
| | | // 更改订单状态
|
| | | CommonOrder co = new CommonOrder(vo.getId());
|
| | | co.setState(CommonOrder.STATE_WQ);
|
| | | co.setUpdateTime(new Date());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(co);
|
| | |
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(vo.getId());
|
| | | mainHongBaoList.add(hongBaoOrder.getHongBaoV2());
|
| | | }
|
| | |
| | | List<HongBaoV2> mainHongBaoList = new ArrayList<>();
|
| | | if (commonOrderList != null)
|
| | | for (CommonOrderVO vo : commonOrderList) {
|
| | | CommonOrder co = commonOrderMapper.selectByPrimaryKey(vo.getId());
|
| | | if (co.getState() != CommonOrder.STATE_WQ) {
|
| | | co = new CommonOrder(vo.getId());
|
| | | co.setState(CommonOrder.STATE_WQ);
|
| | | co.setUpdateTime(new Date());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(co);
|
| | | }
|
| | |
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(vo.getId());
|
| | | mainHongBaoList.add(hongBaoOrder.getHongBaoV2());
|
| | | }
|
| | |
| | |
|
| | | if (mainHongBaoList != null)
|
| | | for (HongBaoV2 hongBao : mainHongBaoList) {
|
| | | HongBaoV2 hb = hongBaoV2Mapper.selectByPrimaryKey(hongBao.getId());
|
| | | hongBao = hb;
|
| | |
|
| | | if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO)
|
| | | continue;
|
| | | // 返利红包不计入
|
| | |
| | |
|
| | | @Override
|
| | | public void newerHongBao(Long uid, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getNewerHongbaoTitle(),
|
| | |
| | |
|
| | | @Override
|
| | | public void orderFanliRecieved(Long uid, String orderId, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getOrderFanliRecieveTitle(), Constant.znxConfig
|
| | |
| | |
|
| | | @Override
|
| | | public void tiChengRecieved(Long uid, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getShareMoneyRecieveTitle(),
|
| | |
| | |
|
| | | @Override
|
| | | public void orderFanliStatisticed(Long uid, String orderId) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getFanliOrderStatisticedTitle(),
|
| | |
| | |
|
| | | @Override
|
| | | public void tiChengStatisticed(Long uid, String orderId, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | | try {
|
| | |
| | |
|
| | | @Override
|
| | | public void weiQuanFanli(Long uid, String orderId, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | // 只发送站内信
|
| | | AccountMessage am = new AccountMessage();
|
| | |
| | |
|
| | | @Override
|
| | | public void weiQuanTiCheng(Long uid, String orderId, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | | AccountMessage am = new AccountMessage();
|
| | |
| | |
|
| | | @Override
|
| | | public void extractApply(Long uid) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getExtractApplayTitle(),
|
| | |
| | |
|
| | | @Override
|
| | | public void extractTransferFail(Long uid, String time) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getExtractTransferFailTitle(),
|
| | |
| | |
|
| | | @Override
|
| | | public void extractWrong(Long uid, Extract extract, String time) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | // 提现失败短信通知
|
| | | // try {
|
| | |
| | |
|
| | | @Override
|
| | | public void extractSuccess(Long uid, Extract extract, String time) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | // 提现成功短信通知
|
| | | // try {
|
| | |
| | |
|
| | | @Override
|
| | | public void alipayAccountValidRight(Long uid, BigDecimal money, String account) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | BindingAccount ba = new BindingAccount();
|
| | | ba.setAccount(account);
|
| | |
| | |
|
| | | @Override
|
| | | public void tiChengInviteRecieved(Long uid, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getInviteMoneyRecieveTitle(),
|
| | |
| | |
|
| | | @Override
|
| | | public void tiChengShareRecieved(Long uid, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getShareMoneyRecieveTitle(),
|
| | |
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderShareStatisticed(Long uid, String orderId, BigDecimal money) {
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getShareOrderStatisticedMsg(), Constant.znxConfig
|
| | | .getShareOrderStatisticedMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()));
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderInviteStatisticed(Long uid, String orderId, BigDecimal money) {
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getInviteOrderStatisticedTitle(), Constant.znxConfig
|
| | | .getInviteOrderStatisticedMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()));
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * 类型
|
| | | * @throws HongBaoException
|
| | | */
|
| | | public void addHongBao(CommonOrder commonOrder, int type) throws HongBaoException;
|
| | | public void addHongBao(List<CommonOrder> commonOrder, int type) throws HongBaoException;
|
| | |
|
| | | /**
|
| | | * 将老版本的红包对象转为新版本的对象
|
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public CommonOrder addTaoBaoOrder(TaoBaoOrder taoBaoOrder, Long uid) throws CommonOrderException;
|
| | | |
| | | public List<CommonOrder> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrder, Long uid) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 根据提条件统计已到账金额
|
| | | * |
| | | * @param uid
|
| | | * @param type
|
| | | * @param orderNo
|
| | |
| | | * @param day
|
| | | * @return
|
| | | */
|
| | | public Map<String, Object> countMoneyGroupOrderNoByUid(Long uid, Integer type, String orderNo, String startTime, |
| | | public Map<String, Object> countMoneyGroupOrderNoByUid(Long uid, Integer type, String orderNo, String startTime,
|
| | | String endTime, Integer day);
|
| | |
|
| | | /**
|
| | | * 根据用户ID,订单状态,结算时间统计订单数量
|
| | | * @param uid
|
| | | * @param state
|
| | | * @param minDate
|
| | | * @param maxDate
|
| | | * @return
|
| | | */
|
| | | long countByUidAndOrderStateWithOrderBalanceTime(Long uid, int state, Date minDate, Date maxDate);
|
| | |
|
| | | }
|
| | |
| | | * @param money
|
| | | */
|
| | | public void tiChengRecieved(Long uid, BigDecimal money);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 邀请提成到账
|
| | | * |
| | | * @param uid
|
| | | * @param money
|
| | | */
|
| | | public void tiChengInviteRecieved(Long uid, BigDecimal money);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 分享提成到账
|
| | | * |
| | | * @param uid
|
| | | * @param money
|
| | | */
|
| | | public void tiChengShareRecieved(Long uid, BigDecimal money);
|
| | |
|
| | |
|
| | | /**
|
| | | * 订单被统计
|
| | |
| | | public void tiChengStatisticed(Long uid, String orderId, BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 分享订单被统计
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | */
|
| | | public void orderShareStatisticed(Long uid, String orderId, BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 邀请订单被统计
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | */
|
| | | public void orderInviteStatisticed(Long uid, String orderId, BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 维权返利订单扣款
|
| | | *
|
| | | * @param uid
|
| | |
| | | public static String GOODS_UPDATE = "goods_update_queue";
|
| | |
|
| | | static {
|
| | |
|
| | | if (Constant.IS_TEST) {
|
| | | QUEUENAME_ORDER = "test-" + QUEUENAME_ORDER;
|
| | | EXTRACT_RESULT = "test-" + EXTRACT_RESULT;
|
| | | PUSH_IOS = "test-" + PUSH_IOS;
|
| | | FANLI_ORDER = "test-" + FANLI_ORDER;
|
| | | FANLI_ORDER_NEW = "test-" + FANLI_ORDER_NEW;
|
| | | FANLI_TICHENG_ORDER = "test-" + FANLI_TICHENG_ORDER;
|
| | | ORDER_WEIQUAN = "test-" + ORDER_WEIQUAN;
|
| | | }
|
| | |
|
| | | QUEUENAME_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | EXTRACT_RESULT += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | PUSH_IOS += "-" + Constant.systemCommonConfig.getProjectName();
|
| | |
| | | }
|
| | | return map;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | public Map<String, HongBaoV2> consumeFanLiMsgNew(int count) {
|
| | | List<Message> list = cmqUtil.recieveMsg(count, FANLI_ORDER_NEW);
|
| | | Map<String, HongBaoV2> map = new HashMap<>();
|
| | |
| | | }
|
| | | return map;
|
| | | }
|
| | | |
| | |
|
| | | public void deleteFanLiMsg(String receiptHandle) {
|
| | | cmqUtil.deleteMsg(FANLI_ORDER, receiptHandle);
|
| | | }
|
| | | |
| | |
|
| | | public void deleteFanLiMsgNew(String receiptHandle) {
|
| | | cmqUtil.deleteMsg(FANLI_ORDER_NEW, receiptHandle);
|
| | | }
|
| | |
| | | "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1");
|
| | | headers.put("Referer", "https://detail.tmall.com/item.htm?id=" + auctionId);
|
| | | String url = String.format("https://hws.m.taobao.com/cache/desc/5.0?id=" + auctionId);
|
| | | LogHelper.test("代理IP:" + ip.getIp() + ":" + ip.getPort());
|
| | | String result = HttpUtil.get(url, headers, ip);
|
| | | LogHelper.test("返回内容:" + result);
|
| | | if (!StringUtil.isNullOrEmpty(result)) {
|
| | | JSONObject data = JSONObject.fromObject(result);
|
| | |
|
| | |
| | | for (int i = 0; i < array.size(); i++) {
|
| | | String itemStr = array.optString(i).replace("<img", "<a").replace("</img>", "<a>");
|
| | | html += itemStr;
|
| | | } |
| | | }
|
| | | Document doc = Jsoup.parse(html);
|
| | | Elements items = doc.getElementsByTag("a");
|
| | | for (int i = 0; i < items.size(); i++) {
|
| | |
| | | img.setPicture("http:" + item.ownText().trim());
|
| | | if (img != null && img.getPicture() != null && img.getPicture().endsWith(".jpg"))
|
| | | imgList.add(img);
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|