Toggle navigation
Toggle navigation
This project
Loading...
Sign in
YOHOBUY
/
yohobuy-union
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
mingdan.ge
6 years ago
Commit
a8b759d9a9ae6a1df4848d9f56b3dfa649b3e881
1 parent
17c3e730
cps7
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
515 additions
and
38 deletions
common/src/main/java/com/yoho/unions/common/enums/ShareOrdersKeyEnum.java
common/src/main/java/com/yoho/unions/helper/UserServiceHelper.java
common/src/main/resources/META-INF/spring/spring-interceptor-config.xml
dal/src/main/java/com/yoho/unions/dal/UnionShareOrdersMapper.java
dal/src/main/java/com/yoho/unions/dal/UnionShareOrdersMonthMapper.java
dal/src/main/java/com/yoho/unions/dal/UnionShareUserInviteMapper.java
dal/src/main/java/com/yoho/unions/dal/model/UnionShareUserInvite.java
dal/src/main/resources/META-INF/mybatis/UnionShareOrdersMapper.xml
dal/src/main/resources/META-INF/mybatis/UnionShareOrdersMonthMapper.xml
dal/src/main/resources/META-INF/mybatis/UnionShareUserInviteMapper.xml
server/src/main/java/com/yoho/unions/server/restapi/UnionShareRest.java
server/src/main/java/com/yoho/unions/server/service/IUnionShareService.java
server/src/main/java/com/yoho/unions/server/service/impl/UnionShareServiceImpl.java
web/src/main/resources/databases.yml
web/src/main/webapp/META-INF/autoconf/databases.yml
common/src/main/java/com/yoho/unions/common/enums/ShareOrdersKeyEnum.java
View file @
a8b759d
...
...
@@ -8,7 +8,8 @@ import org.slf4j.helpers.MessageFormatter;
public
enum
ShareOrdersKeyEnum
{
ORDER_LIST
(
"yh:union:share:orderList:"
,
"type:{}:tab:{}:status:{}:page:{}:limit:{}"
,
600
,
"订单列表"
),
ESTIMATE_LIST
(
"yh:union:share:EstimateList:"
,
"type:{}:timeType:{}:page:{}:limit:{}"
,
600
,
"预估收益详细列表"
),
ESTIMATE_LIST
(
"yh:union:share:estimateList:"
,
"type:{}:timeType:{}:page:{}:limit:{}"
,
600
,
"预估收益详细列表"
),
INVITE_LIST
(
"yh:union:share:inviteList:"
,
"page:{}:limit:{}"
,
600
,
"拉新注册有赚列表"
),
ORDER_INFO
(
"yh:union:share:orderInfo:"
,
"key:{}:orderCode:{}"
,
600
,
"订单详情"
),
ACTIVITY_ORDER
(
"yh:union:share:activityOrder:"
,
"key:{}"
,
600
,
"订单详情"
),
USER_SETTLEMENT
(
"yh:union:share:userSettlement:"
,
"type:{}"
,
600
,
"用户提现未提现总计"
),
...
...
common/src/main/java/com/yoho/unions/helper/UserServiceHelper.java
View file @
a8b759d
...
...
@@ -15,14 +15,15 @@ import com.yoho.service.model.response.UserInfoRspBO;
import
com.yoho.service.model.union.request.UnionUicUserReqBO
;
import
com.yoho.unions.common.redis.RedisValueCache
;
import
com.yoho.unions.vo.ApiResponse
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
/**
...
...
@@ -123,4 +124,24 @@ public class UserServiceHelper {
}
return
userInfo
;
}
public
List
<
UserInfoRspBO
>
getUserInfoListFromUic
(
Set
<
Integer
>
uidSet
)
throws
ServiceException
{
if
(
CollectionUtils
.
isEmpty
(
uidSet
))
{
log
.
warn
(
"getUserInfoFromUic: param uids is null."
);
throw
new
ServiceException
(
ServiceError
.
UID_IS_NULL
);
}
String
uids
=
StringUtils
.
join
(
uidSet
,
','
);
try
{
UnionUicUserReqBO
uicUserReqBO
=
new
UnionUicUserReqBO
();
uicUserReqBO
.
setUids
(
uids
);
uicUserReqBO
.
setChannel
(
1
);
List
<
UserInfoRspBO
>
userInfo
=
serviceCaller
.
asyncCall
(
"uic.getUserInfoListByYohoUid"
,
uicUserReqBO
,
List
.
class
).
get
(
100
);
log
.
info
(
"getUserInfoFromUic: end call uic.getUserInfo, uids is {}, userInfo is {}"
,
uids
,
userInfo
);
return
userInfo
;
}
catch
(
Exception
e
)
{
log
.
warn
(
"get user info from uic failed, uids is {}"
,
uids
);
return
new
ArrayList
<>();
}
}
}
...
...
common/src/main/resources/META-INF/spring/spring-interceptor-config.xml
View file @
a8b759d
...
...
@@ -80,6 +80,7 @@
<value>
/UnionShareRest/addSettlement
</value>
<value>
/UnionShareRest/queryUnionShareOrder
</value>
<value>
/UnionShareRest/queryUnionTypeByUid
</value>
<value>
/UnionShareRest/queryShareTotal
</value>
<value>
/UnionShareRest/queryBannerInfoByUid
</value>
<value>
/UnionShareRest/queryRecentlyOrderLimitTen
</value>
<value>
/UnionShareRest/queryOderDetail
</value>
...
...
@@ -105,6 +106,7 @@
<value>
/UnionShareRest/resetApply
</value>
<value>
/UnionShareRest/queryActivityOrder
</value>
<value>
/UnionShareRest/queryEstimateDetailList
</value>
<value>
/UnionShareRest/queryInviteList
</value>
<value>
/UnionShareRest/queryRank
</value>
<value>
/UnionShareRest/updateMonthData
</value>
<value>
/UnionShareRest/addVirtual
</value>
...
...
dal/src/main/java/com/yoho/unions/dal/UnionShareOrdersMapper.java
View file @
a8b759d
...
...
@@ -6,6 +6,7 @@ import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import
com.yoho.service.model.union.response.UnionShareStatisticsRspBO
;
import
com.yoho.unions.dal.model.UnionShareOrders
;
import
com.yoho.unions.dal.model.UnionShareOrdersMonth
;
import
com.yoho.unions.dal.model.UnionShareUserInvite
;
import
org.apache.ibatis.annotations.MapKey
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -38,6 +39,7 @@ public interface UnionShareOrdersMapper {
List
<
UnionShareOrdersUidBo
>
selectUidSettlementList
(
@Param
(
"beginTime"
)
int
beginTime
,
@Param
(
"endTime"
)
int
endTime
);
List
<
UnionShareOrders
>
selectListByOrderUidForActivity
(
@Param
(
"beginTime"
)
int
beginTime
,
@Param
(
"endTime"
)
int
endTime
,
@Param
(
"orderUid"
)
Integer
orderUid
,
@Param
(
"promoteUid"
)
Integer
promoteUid
);
UnionShareUserInvite
selectUserInviteTotal
(
@Param
(
"beginTime"
)
int
beginTime
,
@Param
(
"endTime"
)
int
endTime
,
@Param
(
"orderUid"
)
Integer
orderUid
,
@Param
(
"promoteUid"
)
Integer
promoteUid
);
int
selectCountByCondition
(
@Param
(
"promoteUid"
)
int
promoteUid
,
@Param
(
"status"
)
String
status
);
UnionShareOrders
selectActivityOrderByUid
(
@Param
(
"activityId"
)
Integer
activityId
,
@Param
(
"orderUid"
)
Integer
orderUid
,
@Param
(
"promoteUid"
)
Integer
promoteUid
);
...
...
dal/src/main/java/com/yoho/unions/dal/UnionShareOrdersMonthMapper.java
View file @
a8b759d
...
...
@@ -26,6 +26,7 @@ public interface UnionShareOrdersMonthMapper {
BigDecimal
selectAmountByUid
(
@Param
(
"date"
)
Integer
date
,
@Param
(
"promoteUid"
)
Integer
promoteUid
,
@Param
(
"type"
)
Integer
type
);
int
updateByUidAndMonth
(
UnionShareOrdersMonth
record
);
int
updateImageByUid
(
UnionShareOrdersMonth
record
);
int
updateByPrimaryKeySelective
(
UnionShareOrdersMonth
record
);
...
...
dal/src/main/java/com/yoho/unions/dal/UnionShareUserInviteMapper.java
0 → 100644
View file @
a8b759d
package
com
.
yoho
.
unions
.
dal
;
import
com.yoho.unions.dal.model.UnionShareUserInvite
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
UnionShareUserInviteMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
UnionShareUserInvite
record
);
int
insertSelective
(
UnionShareUserInvite
record
);
UnionShareUserInvite
selectByPrimaryKey
(
Integer
id
);
int
selectCountByInviterUid
(
Integer
inviterUid
);
List
<
UnionShareUserInvite
>
selectListByInviterUid
(
@Param
(
"inviterUid"
)
Integer
inviterUid
,
@Param
(
"offset"
)
int
offset
,
@Param
(
"rows"
)
int
rows
);
UnionShareUserInvite
selectByUid
(
Integer
inviterUid
);
int
updateByPrimaryKeySelective
(
UnionShareUserInvite
record
);
int
updateByPrimaryKey
(
UnionShareUserInvite
record
);
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/unions/dal/model/UnionShareUserInvite.java
0 → 100644
View file @
a8b759d
package
com
.
yoho
.
unions
.
dal
.
model
;
import
java.math.BigDecimal
;
public
class
UnionShareUserInvite
{
private
Integer
id
;
private
Integer
inviterUid
;
private
Integer
uid
;
private
String
name
;
private
Integer
date
;
private
Integer
orderNum
;
private
BigDecimal
orderAmount
;
private
Integer
createTime
;
private
Integer
updateTime
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getInviterUid
()
{
return
inviterUid
;
}
public
void
setInviterUid
(
Integer
inviterUid
)
{
this
.
inviterUid
=
inviterUid
;
}
public
Integer
getUid
()
{
return
uid
;
}
public
void
setUid
(
Integer
uid
)
{
this
.
uid
=
uid
;
}
public
Integer
getDate
()
{
return
date
;
}
public
void
setDate
(
Integer
date
)
{
this
.
date
=
date
;
}
public
Integer
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
Integer
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
public
BigDecimal
getOrderAmount
()
{
return
orderAmount
;
}
public
void
setOrderAmount
(
BigDecimal
orderAmount
)
{
this
.
orderAmount
=
orderAmount
;
}
public
Integer
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Integer
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Integer
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Integer
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
\ No newline at end of file
...
...
dal/src/main/resources/META-INF/mybatis/UnionShareOrdersMapper.xml
View file @
a8b759d
...
...
@@ -427,6 +427,17 @@
and order_time
<
#{endTime}
</if>
</select>
<select
id=
"selectUserInviteTotal"
resultType=
"com.yoho.unions.dal.model.UnionShareUserInvite"
>
select count(order_code) as orderNum,sum(last_order_amount) as orderAmount
from union_share_orders where order_code is not null and status in (10,20,30,40)
and order_uid = #{orderUid} and promote_uid = #{promoteUid}
<if
test=
"beginTime != 0"
>
and order_time
>
= #{beginTime}
</if>
<if
test=
"endTime != 0"
>
and order_time
<
=#{endTime}
</if>
</select>
<select
id=
"selectMonthData"
resultType=
"com.yoho.unions.dal.model.UnionShareOrdersMonth"
>
select sum(amount) as amount,sum(extra_amount) as extraAmount,sum(order_amount) as orderAmount,count(order_code) as orderNum
from union_share_orders
...
...
dal/src/main/resources/META-INF/mybatis/UnionShareOrdersMonthMapper.xml
View file @
a8b759d
...
...
@@ -201,6 +201,25 @@
where uid = #{uid,jdbcType=INTEGER} and type = #{type,jdbcType=INTEGER} and date = #{date,jdbcType=INTEGER}
</update>
<update
id=
"updateImageByUid"
parameterType=
"com.yoho.unions.dal.model.UnionShareOrdersMonth"
>
update union_share_orders_month
<set
>
<if
test=
"nickname != null"
>
nickname = #{nickname,jdbcType=VARCHAR},
</if>
<if
test=
"image != null"
>
image = #{image,jdbcType=INTEGER},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=INTEGER},
</if>
</set>
where uid = #{uid,jdbcType=INTEGER}
<if
test=
"date != null"
>
and date = #{date,jdbcType=INTEGER}
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.yoho.unions.dal.model.UnionShareOrdersMonth"
>
update union_share_orders_month
<set
>
...
...
dal/src/main/resources/META-INF/mybatis/UnionShareUserInviteMapper.xml
0 → 100644
View file @
a8b759d
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.yoho.unions.dal.UnionShareUserInviteMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yoho.unions.dal.model.UnionShareUserInvite"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"inviter_uid"
property=
"inviterUid"
jdbcType=
"INTEGER"
/>
<result
column=
"uid"
property=
"uid"
jdbcType=
"INTEGER"
/>
<result
column=
"date"
property=
"date"
jdbcType=
"INTEGER"
/>
<result
column=
"order_num"
property=
"orderNum"
jdbcType=
"INTEGER"
/>
<result
column=
"order_amount"
property=
"orderAmount"
jdbcType=
"DECIMAL"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"INTEGER"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, inviter_uid, uid, date, order_num, order_amount, create_time, update_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from union_share_user_invite
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"selectCountByInviterUid"
resultType=
"java.lang.Integer"
>
select count(id)
from union_share_user_invite
where inviter_uid = #{inviterUid,jdbcType=INTEGER}
</select>
<select
id=
"selectListByInviterUid"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from union_share_user_invite
where inviter_uid = #{inviterUid,jdbcType=INTEGER}
order by date desc
limit #{offset},#{rows}
</select>
<select
id=
"selectByUid"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from union_share_user_invite
where uid = #{uid,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from union_share_user_invite
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.yoho.unions.dal.model.UnionShareUserInvite"
>
insert into union_share_user_invite (id, inviter_uid, uid,
date, order_num, order_amount,
create_time, update_time)
values (#{id,jdbcType=INTEGER}, #{inviterUid,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER},
#{date,jdbcType=INTEGER}, #{orderNum,jdbcType=INTEGER}, #{orderAmount,jdbcType=DECIMAL},
#{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.yoho.unions.dal.model.UnionShareUserInvite"
>
insert into union_share_user_invite
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"inviterUid != null"
>
inviter_uid,
</if>
<if
test=
"uid != null"
>
uid,
</if>
<if
test=
"date != null"
>
date,
</if>
<if
test=
"orderNum != null"
>
order_num,
</if>
<if
test=
"orderAmount != null"
>
order_amount,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"inviterUid != null"
>
#{inviterUid,jdbcType=INTEGER},
</if>
<if
test=
"uid != null"
>
#{uid,jdbcType=INTEGER},
</if>
<if
test=
"date != null"
>
#{date,jdbcType=INTEGER},
</if>
<if
test=
"orderNum != null"
>
#{orderNum,jdbcType=INTEGER},
</if>
<if
test=
"orderAmount != null"
>
#{orderAmount,jdbcType=DECIMAL},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=INTEGER},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.yoho.unions.dal.model.UnionShareUserInvite"
>
update union_share_user_invite
<set
>
<if
test=
"inviterUid != null"
>
inviter_uid = #{inviterUid,jdbcType=INTEGER},
</if>
<if
test=
"uid != null"
>
uid = #{uid,jdbcType=INTEGER},
</if>
<if
test=
"date != null"
>
date = #{date,jdbcType=INTEGER},
</if>
<if
test=
"orderNum != null"
>
order_num = #{orderNum,jdbcType=INTEGER},
</if>
<if
test=
"orderAmount != null"
>
order_amount = #{orderAmount,jdbcType=DECIMAL},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=INTEGER},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.yoho.unions.dal.model.UnionShareUserInvite"
>
update union_share_user_invite
set inviter_uid = #{inviterUid,jdbcType=INTEGER},
uid = #{uid,jdbcType=INTEGER},
date = #{date,jdbcType=INTEGER},
order_num = #{orderNum,jdbcType=INTEGER},
order_amount = #{orderAmount,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
...
...
server/src/main/java/com/yoho/unions/server/restapi/UnionShareRest.java
View file @
a8b759d
...
...
@@ -94,6 +94,18 @@ public class UnionShareRest {
UnionShareUserBo
unionShareUser
=
unionShareService
.
queryUnionTypeByUid
(
uid
);
return
new
UnionResponse
(
200
,
"queryUnionTypeByUid success"
,
unionShareUser
);
}
/**
* 获取用户分享统计数据
* @param uid
* @return
*/
@RequestMapping
(
"/queryShareTotal"
)
@ResponseBody
public
UnionResponse
queryShareTotal
(
@RequestBody
int
uid
){
log
.
info
(
"UnionShareRest.queryShareTotal uid is {}"
,
uid
);
UnionShareCountBo
unionShareUser
=
unionShareService
.
queryShareTotal
(
uid
);
return
new
UnionResponse
(
200
,
"queryShareTotal success"
,
unionShareUser
);
}
/**
* 获取app个人中心有赚用户的banner数据
...
...
@@ -355,6 +367,19 @@ public class UnionShareRest {
PageResponseBO
<
UnionShareOrders
>
unionShareOrdersList
=
unionShareService
.
queryEstimateDetailList
(
unionShareOrderReqBO
);
return
new
UnionResponse
(
200
,
"queryEstimateDetailList success"
,
unionShareOrdersList
);
}
/**
* 拉新注册有赚列表
* */
@RequestMapping
(
"/queryInviteList"
)
@ResponseBody
public
UnionResponse
queryInviteList
(
@RequestBody
UnionShareUserInviteReq
req
){
log
.
info
(
"UnionShareRest.queryInviteList req is {}"
,
req
);
if
(
req
==
null
){
return
new
UnionResponse
(
409
,
"queryInviteList params error"
);
}
PageResponseBO
<
UnionShareUserInviteBo
>
unionShareOrdersList
=
unionShareService
.
queryInviteList
(
req
);
return
new
UnionResponse
(
200
,
"queryInviteList success"
,
unionShareOrdersList
);
}
/**
* 达人排行
...
...
server/src/main/java/com/yoho/unions/server/service/IUnionShareService.java
View file @
a8b759d
...
...
@@ -60,6 +60,8 @@ public interface IUnionShareService {
*/
UnionShareUserBo
queryUnionTypeByUid
(
int
uid
);
UnionShareCountBo
queryShareTotal
(
int
uid
);
UnionShareBannerBo
queryUnionShareBannerInfo
(
int
uid
);
/**
...
...
@@ -160,6 +162,8 @@ public interface IUnionShareService {
* */
PageResponseBO
<
UnionShareOrders
>
queryEstimateDetailList
(
UnionShareOrderReqBO
unionShareOrderReqBO
);
PageResponseBO
<
UnionShareUserInviteBo
>
queryInviteList
(
UnionShareUserInviteReq
req
);
/**
* 达人排行榜
* @param bo
...
...
server/src/main/java/com/yoho/unions/server/service/impl/UnionShareServiceImpl.java
View file @
a8b759d
...
...
@@ -22,6 +22,8 @@ import javax.annotation.Resource;
import
com.yoho.service.model.union.bo.*
;
import
com.yoho.service.model.union.request.*
;
import
com.yoho.service.model.union.response.*
;
import
com.yoho.unions.dal.*
;
import
com.yoho.unions.dal.model.*
;
import
com.yoho.unions.helper.SendMessageHelper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -61,33 +63,6 @@ import com.yoho.unions.common.utils.RandomUtil;
import
com.yoho.unions.common.utils.StringHideUtils
;
import
com.yoho.unions.convert.BeanConvert
;
import
com.yoho.unions.convert.Convert
;
import
com.yoho.unions.dal.IMktMarketingUrlDAO
;
import
com.yoho.unions.dal.UnionShareBigDataClickMapper
;
import
com.yoho.unions.dal.UnionShareMessageMapper
;
import
com.yoho.unions.dal.UnionShareOrdersActivityItemMapper
;
import
com.yoho.unions.dal.UnionShareOrdersActivityLogsMapper
;
import
com.yoho.unions.dal.UnionShareOrdersActivityMapper
;
import
com.yoho.unions.dal.UnionShareOrdersMapper
;
import
com.yoho.unions.dal.UnionShareOrdersMonthMapper
;
import
com.yoho.unions.dal.UnionShareOrdersProductMapper
;
import
com.yoho.unions.dal.UnionShareSettlementMapper
;
import
com.yoho.unions.dal.UnionShareUserApplyMapper
;
import
com.yoho.unions.dal.UnionShareUserBankMapper
;
import
com.yoho.unions.dal.UnionShareUserMapper
;
import
com.yoho.unions.dal.model.MktMarketingUrl
;
import
com.yoho.unions.dal.model.UnionShareBigDataClick
;
import
com.yoho.unions.dal.model.UnionShareMessage
;
import
com.yoho.unions.dal.model.UnionShareOrders
;
import
com.yoho.unions.dal.model.UnionShareOrdersActivity
;
import
com.yoho.unions.dal.model.UnionShareOrdersActivityItem
;
import
com.yoho.unions.dal.model.UnionShareOrdersActivityLogs
;
import
com.yoho.unions.dal.model.UnionShareOrdersListBO
;
import
com.yoho.unions.dal.model.UnionShareOrdersMonth
;
import
com.yoho.unions.dal.model.UnionShareOrdersProduct
;
import
com.yoho.unions.dal.model.UnionShareSettlement
;
import
com.yoho.unions.dal.model.UnionShareUser
;
import
com.yoho.unions.dal.model.UnionShareUserApply
;
import
com.yoho.unions.dal.model.UnionShareUserBank
;
import
com.yoho.unions.helper.UserServiceHelper
;
import
com.yoho.unions.server.service.IUnionShareService
;
import
com.yoho.unions.utils.DateUtils
;
...
...
@@ -134,6 +109,9 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
@Autowired
SendMessageHelper
sendMessageHelper
;
@Autowired
UnionShareUserInviteMapper
unionShareUserInviteMapper
;
@Resource
RedisValueCache
redisValueCache
;
@Resource
...
...
@@ -641,6 +619,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
unionShareUser
.
setInviterUid
(
inviterUid
);
int
result
=
unionShareUserMapper
.
insertSelective
(
unionShareUser
);
if
(
result
>
0
)
{
//todo 更新邀请拉新数据及缓存
updateInviterHistory
(
inviterUid
,
unionShareUser1
,
true
);
logger
.
info
(
"relateUnionType,begin to send message,uid is {},unionType is {}"
,
uid
,
unionDepartmentUrl
.
getUnionType
());
////发送联盟用户申请成功公众号消息
sendMessageHelper
.
sendMessage
(
uid
,
4
,
unionShareUser
.
getCreateTime
(),
null
);
...
...
@@ -649,6 +629,55 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
}
//todo 更新邀请拉新数据及缓存
private
void
updateInviterHistory
(
Integer
inviterUid
,
UnionShareUser
unionShareUser
,
boolean
isNew
)
{
if
(
inviterUid
==
null
||
unionShareUser
==
null
||!
inviterUid
.
equals
(
unionShareUser
.
getInviterUid
()))
{
return
;
}
if
(
isNew
)
{
//新用户创建数据即可
UnionShareUserInvite
newObj
=
new
UnionShareUserInvite
();
newObj
.
setInviterUid
(
inviterUid
);
newObj
.
setUid
(
unionShareUser
.
getUid
());
newObj
.
setDate
(
unionShareUser
.
getCreateTime
());
newObj
.
setCreateTime
(
DateUtil
.
getCurrentTimeSecond
());
newObj
.
setUpdateTime
(
newObj
.
getCreateTime
());
unionShareUserInviteMapper
.
insertSelective
(
newObj
);
//清邀请缓存
redisHashCache
.
delete
(
ShareOrdersKeyEnum
.
INVITE_LIST
.
getPreKey
(),
inviterUid
);
return
;
}
//老用户更新粉丝注册有赚7天内订单统计数据
int
startTime
=
DateUtil
.
getLastDayStartInt
(
unionShareUser
.
getCreateTime
(),
0
);
int
endTime
=
DateUtil
.
getLastDayEndInt
(
unionShareUser
.
getCreateTime
(),-
6
);
UnionShareUserInvite
updateObj
=
unionShareOrdersMapper
.
selectUserInviteTotal
(
startTime
,
endTime
,
unionShareUser
.
getUid
(),
inviterUid
);
if
(
updateObj
==
null
)
{
updateObj
=
new
UnionShareUserInvite
();
}
UnionShareUserInvite
unionShareUserInvite
=
unionShareUserInviteMapper
.
selectByUid
(
unionShareUser
.
getUid
());
if
(
unionShareUserInvite
==
null
)
{
updateObj
.
setInviterUid
(
inviterUid
);
updateObj
.
setUid
(
unionShareUser
.
getUid
());
// updateObj.setDate(Integer.valueOf(DateUtil.getDateStrBySecond(unionShareUser.getCreateTime(), "yyyyMMdd")));
updateObj
.
setDate
(
unionShareUser
.
getCreateTime
());
updateObj
.
setCreateTime
(
DateUtil
.
getCurrentTimeSecond
());
updateObj
.
setUpdateTime
(
updateObj
.
getCreateTime
());
unionShareUserInviteMapper
.
insertSelective
(
updateObj
);
}
else
{
updateObj
.
setId
(
unionShareUserInvite
.
getId
());
updateObj
.
setUpdateTime
(
DateUtil
.
getCurrentTimeSecond
());
if
(
updateObj
.
getOrderAmount
()
==
null
)
{
updateObj
.
setOrderAmount
(
new
BigDecimal
(
0
));
updateObj
.
setOrderNum
(
0
);
}
unionShareUserInviteMapper
.
updateByPrimaryKeySelective
(
updateObj
);
}
//清邀请缓存
redisHashCache
.
delete
(
ShareOrdersKeyEnum
.
INVITE_LIST
.
getPreKey
(),
inviterUid
);
}
public
MktMarketingUrl
buildMktMarketingUrl
(
int
uid
)
{
logger
.
info
(
"buildMktMarketingUrl,uid is {}"
,
uid
);
MktMarketingUrl
mktMarketingUrl
=
new
MktMarketingUrl
();
...
...
@@ -719,6 +748,24 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
@Override
public
UnionShareCountBo
queryShareTotal
(
int
uid
)
{
//先从缓存获取
String
key
=
"shareTotal"
;
UnionShareCountBo
cacheResult
=
getFromRedis
(
ShareOrdersKeyEnum
.
UNION_TYPE
,
uid
,
UnionShareCountBo
.
class
,
key
);
if
(
cacheResult
!=
null
)
{
logger
.
info
(
"UnionShareServiceImpl.queryShareTotal get redis cache ,uid is {},cacheResult is {}"
,
uid
,
cacheResult
);
return
cacheResult
;
}
UnionShareCountBo
bo
=
new
UnionShareCountBo
();
int
inviteNum
=
unionShareUserInviteMapper
.
selectCountByInviterUid
(
uid
);
bo
.
setInviteNum
(
inviteNum
);
bo
.
setFans
(
0
);
//todo 需要从大数据获取,等待
//设置缓存
addToRedis
(
ShareOrdersKeyEnum
.
UNION_TYPE
,
uid
,
bo
,
key
);
return
bo
;
}
@Override
public
UnionShareBannerBo
queryUnionShareBannerInfo
(
int
uid
)
{
String
key
=
"banner"
;
UnionShareBannerBo
cacheResult
=
getFromRedis
(
ShareOrdersKeyEnum
.
UNION_TYPE
,
uid
,
UnionShareBannerBo
.
class
,
key
);
...
...
@@ -1330,6 +1377,60 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
return
response
;
}
@Override
public
PageResponseBO
<
UnionShareUserInviteBo
>
queryInviteList
(
UnionShareUserInviteReq
req
)
{
logger
.
info
(
"UnionShareServiceImpl.queryInviteList,req is {}"
,
req
);
//先从缓存获取
PageResponseBO
<
UnionShareUserInviteBo
>
cacheResult
=
getFromRedis
(
ShareOrdersKeyEnum
.
INVITE_LIST
,
req
.
getInviterUid
(),
PageResponseBO
.
class
,
String
.
valueOf
(
req
.
getPage
()),
String
.
valueOf
(
req
.
getSize
()));
if
(
cacheResult
!=
null
)
{
logger
.
info
(
"UnionShareServiceImpl.queryInviteList get redis cache ,uid is {},cacheResult is {}"
,
req
.
getInviterUid
(),
cacheResult
);
return
cacheResult
;
}
//获取总数
PageResponseBO
<
UnionShareUserInviteBo
>
response
=
new
PageResponseBO
<>();
//queryTimeType(预估收入实际):1-昨日,2-本月,3-上月
Integer
count
=
unionShareUserInviteMapper
.
selectCountByInviterUid
(
req
.
getInviterUid
());
if
(
count
<=
0
){
logger
.
info
(
"UnionShareServiceImpl.queryInviteList count is 0"
);
return
response
;
}
//分页
response
.
setSize
(
req
.
getSize
());
response
.
setPage
(
req
.
getPage
()>
1
?
req
.
getPage
():
1
);
response
.
setTotal
(
count
);
int
start
=
req
.
getPage
()>
1
?(
req
.
getPage
()-
1
)*
req
.
getSize
():
0
;
List
<
UnionShareUserInvite
>
unionShareUserInvites
=
unionShareUserInviteMapper
.
selectListByInviterUid
(
req
.
getInviterUid
(),
start
,
req
.
getSize
());
if
(
CollectionUtils
.
isEmpty
(
unionShareUserInvites
))
{
return
response
;
}
List
<
UnionShareUserInviteBo
>
bos
=
new
ArrayList
<>();
Set
<
Integer
>
uidSet
=
unionShareUserInvites
.
stream
().
map
(
a
->
a
.
getUid
()).
collect
(
Collectors
.
toSet
());
List
<
UserInfoRspBO
>
userInfoRspBO
=
userServiceHelper
.
getUserInfoListFromUic
(
uidSet
);
Map
<
Integer
,
UserInfoRspBO
>
userInfoMap
;
if
(
CollectionUtils
.
isNotEmpty
(
userInfoRspBO
))
{
userInfoMap
=
userInfoRspBO
.
stream
().
collect
(
Collectors
.
toMap
(
UserInfoRspBO:
:
getUid
,
u
->
u
,
(
existingValue
,
newValue
)
->
existingValue
));
}
else
{
userInfoMap
=
new
HashMap
<>();
}
unionShareUserInvites
.
forEach
(
i
->{
UnionShareUserInviteBo
bo
=
new
UnionShareUserInviteBo
();
BeanUtils
.
copyProperties
(
i
,
bo
);
bo
.
setDateStr
(
DateUtil
.
getDateStrBySecond
(
i
.
getDate
(),
DateUtil
.
DATE_FORMAT
));
DecimalFormat
df
=
new
DecimalFormat
(
"0.00"
);
bo
.
setOrderAmountStr
(
"¥"
+
df
.
format
(
i
.
getOrderAmount
()));
if
(
userInfoMap
.
containsKey
(
bo
.
getUid
()))
{
bo
.
setName
(
userInfoMap
.
get
(
bo
.
getUid
()).
getNickname
());
}
bos
.
add
(
bo
);
});
response
.
setList
(
bos
);
//设置缓存
addToRedis
(
ShareOrdersKeyEnum
.
INVITE_LIST
,
req
.
getInviterUid
(),
response
,
String
.
valueOf
(
req
.
getPage
()),
String
.
valueOf
(
req
.
getSize
()));
return
response
;
}
/**
* 达人排行榜
* @param req
...
...
@@ -1516,7 +1617,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
int
result
=
unionShareOrdersMapper
.
updateStatusById
(
unionShareOrders
.
getId
(),
unionShareOrders
.
getStatus
(),
bo
.
getStatus
(),
DateUtil
.
getCurrentTimeSecond
());
if
(
result
==
0
)
{
logger
.
info
(
"saveOrUpdateOrder
enter
,update nothing,req is {}"
,
bo
);
logger
.
info
(
"saveOrUpdateOrder ,update nothing,req is {}"
,
bo
);
//没有更新到数据,应该有并发更新事件,查询新的再试一下
unionShareOrders
=
unionShareOrdersMapper
.
selectByCode
(
bo
.
getOrderCode
());
if
(
null
==
unionShareOrders
)
{
...
...
@@ -1532,7 +1633,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
result
=
unionShareOrdersMapper
.
updateStatusById
(
unionShareOrders
.
getId
(),
unionShareOrders
.
getStatus
(),
bo
.
getStatus
(),
DateUtil
.
getCurrentTimeSecond
());
}
logger
.
info
(
"saveOrUpdateOrder ,req is {},unionShareOrders is {},update result is {}."
,
bo
,
unionShareOrders
,
result
);
if
(
result
>
0
&&
(
unionShareOrders
.
getExtraActivityId
()
!=
null
||
unionShareOrders
.
getExtraActivityId
()
!=
null
))
{
if
(
result
==
0
){
logger
.
info
(
"saveOrUpdateOrder end,update nothing again,req is {}"
,
bo
);
return
;
}
if
(
unionShareOrders
.
getExtraActivityId
()
!=
null
||
unionShareOrders
.
getExtraActivityId
()
!=
null
)
{
if
(
ShareOrdersStatusEnum
.
isFailOrder
(
bo
.
getStatus
()))
{
//订单不可参与活动,重新处理该单参与的满单返
if
(
unionShareOrders
.
getExtraActivityId
()
!=
null
&&
unionShareOrders
.
getExtraActivityId
()
>
0
)
{
...
...
@@ -1554,13 +1660,18 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
}
if
(
result
>
0
&&
unionShareOrders
.
getActivityId
()
!=
null
&&
ShareOrdersStatusEnum
.
isFailOrder
(
bo
.
getStatus
())){
if
(
unionShareOrders
.
getActivityId
()
!=
null
&&
ShareOrdersStatusEnum
.
isFailOrder
(
bo
.
getStatus
())){
//该订单参加了加倍返活动,需要把加倍返日志作废
UnionShareOrdersActivityLogs
activityLog
=
getLogsByOrderId
(
unionShareOrders
.
getId
());
if
(
activityLog
!=
null
)
{
invalidActivityLog
(
activityLog
.
getId
(),
DateUtil
.
getCurrentTimeSecond
());
}
}
//更新下单人被拉新数据
if
(
ShareOrdersStatusEnum
.
isFailOrder
(
bo
.
getStatus
())){
updateOrderInviterInfo
(
unionShareOrders
.
getOrderUid
(),
unionShareOrders
.
getPromoteUid
());
}
//清缓存
clearShareOrderRedis
(
bo
.
getPromoteUid
());
}
...
...
@@ -2240,9 +2351,21 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
logger
.
info
(
"insertOrder product error,orderCode is {},product is {}"
,
bo
.
getOrderCode
(),
p
);
}
});
//更新下单人被拉新数据
updateOrderInviterInfo
(
bo
.
getOrderUid
(),
bo
.
getPromoteUid
());
logger
.
info
(
"insertOrder end,req is {}"
,
bo
);
}
//更新下单人被拉新数据
private
void
updateOrderInviterInfo
(
int
orderUid
,
int
promoteUid
)
{
UnionShareUser
unionShareUser
=
unionShareUserMapper
.
selectByUid
(
orderUid
);
if
(
unionShareUser
==
null
||
promoteUid
!=
unionShareUser
.
getInviterUid
())
{
//无拉新关系
return
;
}
updateInviterHistory
(
promoteUid
,
unionShareUser
,
false
);
}
private
boolean
checkParam
(
ShareOrderBo
bo
)
{
if
(
bo
==
null
)
{
return
false
;
...
...
@@ -2887,16 +3010,18 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
return
;
}
logger
.
info
(
"updateOneMonthData,getUserInfoFromUic, promoteUid is {},date is {}."
,
promoteUid
,
date
);
month
.
setType
(
1
);
//类型:1-联盟用户,2-马甲用户
month
.
setUpdateTime
(
DateUtil
.
getCurrentTimeSecond
());
month
.
setUid
(
promoteUid
);
month
.
setAlias
(
Integer
.
toString
(
promoteUid
));
UserInfoRspBO
userInfoRspBO
=
userServiceHelper
.
getUserInfoFromUic
(
promoteUid
);
if
(
userInfoRspBO
!=
null
)
{
month
.
setImage
(
ImagesHelper
.
getImageUrl
(
userInfoRspBO
.
getHeadIco
()));
month
.
setNickname
(
userInfoRspBO
.
getNickname
());
//更新用户头像昵称
unionShareOrdersMonthMapper
.
updateImageByUid
(
month
);
}
month
.
setType
(
1
);
//类型:1-联盟用户,2-马甲用户
month
.
setDate
(
dateInt
);
month
.
setUpdateTime
(
DateUtil
.
getCurrentTimeSecond
());
month
.
setUid
(
promoteUid
);
month
.
setAlias
(
Integer
.
toString
(
promoteUid
));
if
(
unionShareOrdersMonth
!=
null
)
{
//月预估收益更新
month
.
setId
(
unionShareOrdersMonth
.
getId
());
...
...
web/src/main/resources/databases.yml
View file @
a8b759d
...
...
@@ -82,7 +82,8 @@ datasources:
-
com.yoho.unions.dal.UnionShareOrdersActivityItemMapper
-
com.yoho.unions.dal.UnionShareOrdersMonthMapper
-
com.yoho.unions.dal.UnionShareMessageMapper
-
com.yoho.unions.dal.UnionShareUserInviteMapper
bigdata_yh_unions
:
...
...
web/src/main/webapp/META-INF/autoconf/databases.yml
View file @
a8b759d
...
...
@@ -74,6 +74,7 @@ datasources:
-
com.yoho.unions.dal.UnionShareOrdersActivityItemMapper
-
com.yoho.unions.dal.UnionShareOrdersMonthMapper
-
com.yoho.unions.dal.UnionShareMessageMapper
-
com.yoho.unions.dal.UnionShareUserInviteMapper
bigdata_yh_unions
:
servers
:
...
...
Please
register
or
login
to post a comment