...
|
...
|
@@ -1254,6 +1254,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
uninoShareIncomeBo.setRankNum(i+1);
|
|
|
// uninoShareIncomeBo.setAmountStr("¥"+df.format(uninoShareIncomeBo.getAmount()));
|
|
|
uninoShareIncomeBo.setAmountStr("¥"+uninoShareIncomeBo.getAmount());
|
|
|
uninoShareIncomeBo.setImage(ImagesHelper.getHeadImageUrl(uninoShareIncomeBo.getImage()));
|
|
|
}
|
|
|
PageResponseBO<UninoShareIncomeBo> pageList = new PageResponseBO<>();
|
|
|
pageList.setList(list);
|
...
|
...
|
@@ -1462,10 +1463,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
logger.info("dealWithWaitActivity end,deal null,activity is {}",activity);
|
|
|
return;
|
|
|
}
|
|
|
int minNum = queryActivityItemMinNum(activity.getId());
|
|
|
// int minNum = queryActivityItemMinNum(activity.getId());
|
|
|
//查询可以参与活动的uid组
|
|
|
logger.info("dealWithWaitActivity,activity is {},selectUidList",activity);
|
|
|
List<UnionShareOrdersUidBo> uids=unionShareOrdersMapper.selectUidList(activity.getStartTime(), activity.getEndTime(), minNum);
|
|
|
List<UnionShareOrdersUidBo> uids=unionShareOrdersMapper.selectUidList(activity.getStartTime(), activity.getEndTime());
|
|
|
logger.info("dealWithWaitActivity,activity is {},selectUidList, uids is {}",activity,uids);
|
|
|
uids.forEach(u->{
|
|
|
joinExtraActivity(u.getOrderUid(), u.getPromoteUid(), activity.getId());
|
...
|
...
|
@@ -1554,12 +1555,17 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
* */
|
|
|
private List<UnionShareOrdersActivityItem> queryActivityItemList(int activityId) {
|
|
|
logger.info("queryActivityItemList,activityId is {}",activityId);
|
|
|
List<UnionShareOrdersActivityItem> items = getFromRedis(ShareOrdersKeyEnum.ACTIVITY,activityId,List.class,"list","0");
|
|
|
if (CollectionUtils.isNotEmpty(items)) {
|
|
|
logger.info("queryActivityItemList,activityId is {},get chache {}",activityId,items);
|
|
|
return items;
|
|
|
List<JSONObject> itemsObj = getFromRedis(ShareOrdersKeyEnum.ACTIVITY,activityId,List.class,"list","0");
|
|
|
if (CollectionUtils.isNotEmpty(itemsObj)) {
|
|
|
logger.info("queryActivityItemList,activityId is {},get chache {}",activityId,itemsObj);
|
|
|
List<UnionShareOrdersActivityItem> cacheItems = new ArrayList<>();
|
|
|
itemsObj.forEach(it->{
|
|
|
String json=JsonUtil.objectToJSON(it);
|
|
|
cacheItems.add(JsonUtil.jsonToObject(json, UnionShareOrdersActivityItem.class));
|
|
|
});
|
|
|
return cacheItems;
|
|
|
}
|
|
|
items = unionShareOrdersActivityItemMapper.selectByActivityId(activityId);
|
|
|
List<UnionShareOrdersActivityItem> items = unionShareOrdersActivityItemMapper.selectByActivityId(activityId);
|
|
|
if (CollectionUtils.isEmpty(items)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
...
|
...
|
@@ -1600,6 +1606,14 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
* */
|
|
|
public boolean joinExtraActivity(int orderUid ,int promoteUid ,int activityId){
|
|
|
logger.info("joinExtraActivity,orderUid is {},promoteUid is {},activityId is {}.",orderUid,promoteUid,activityId);
|
|
|
|
|
|
//查询是否已参加过此活动
|
|
|
if (hasJoinActivity(orderUid, promoteUid, activityId)) {
|
|
|
//存在有效的参与数据,直接返回
|
|
|
logger.info("joinExtraActivity end,hasJoinActivity,orderUid is {},promoteUid is {},activityId is {}.",orderUid,promoteUid,activityId);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
UnionShareOrdersActivity activity = queryActivity(activityId);
|
|
|
if (null == activity || activity.getType() != 3) {
|
|
|
return false;
|
...
|
...
|
@@ -1662,6 +1676,28 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//是否已参加过此活动
|
|
|
private boolean hasJoinActivity(int orderUid ,int promoteUid ,int activityId) {
|
|
|
UnionShareOrders unionShareOrders=queryOrderActivity(orderUid, promoteUid, activityId);
|
|
|
if (unionShareOrders == null) {
|
|
|
return false;
|
|
|
}
|
|
|
if (unionShareOrders.getStatus().equals(ShareOrdersStatusEnum.ACTIVITY_DISCARD.getCode())) {
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
private List<UnionShareOrdersActivityLogs> queryJoinLogs(int orderUid ,int promoteUid ,int activityId) {
|
|
|
UnionShareOrdersActivityLogs req = new UnionShareOrdersActivityLogs();
|
|
|
req.setOrderUid(orderUid);
|
|
|
req.setPromoteUid(promoteUid);
|
|
|
req.setActivityId(activityId);
|
|
|
req.setStatus(1);
|
|
|
List<UnionShareOrdersActivityLogs> list=unionShareOrdersActivityLogsMapper.selectByPrimaryKeySelective(req);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 参加加倍返活动
|
|
|
* */
|
...
|
...
|
@@ -2279,10 +2315,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
logger.info("updateOneMonthData promoteUid is {},date is {}.",promoteUid,date);
|
|
|
Integer dateInt = Integer.valueOf(date);
|
|
|
Calendar time = Calendar.getInstance();
|
|
|
time.setTime(DateUtil.stringToDate(date, "yyyyMM"));
|
|
|
int beginTime=(int) time.getTimeInMillis()/1000;
|
|
|
time.add(Calendar.DAY_OF_MONTH,1);
|
|
|
int endTime=((int) time.getTimeInMillis()/1000)-1;
|
|
|
time.setTime(DateUtil.stringToDate(date+"01 00:00:00", "yyyyMMdd HH:mm:ss"));
|
|
|
int beginTime=(int) (time.getTime().getTime()/1000);
|
|
|
time.add(Calendar.MONTH,1);
|
|
|
int endTime=(int) (time.getTime().getTime()/1000);
|
|
|
UnionShareOrdersMonth unionShareOrdersMonth = getMonthData(promoteUid,dateInt);
|
|
|
//查询cps订单表中此月的预估收益
|
|
|
UnionShareOrdersMonth month=unionShareOrdersMapper.selectMonthData(promoteUid, beginTime, endTime);
|
...
|
...
|
@@ -2297,19 +2333,22 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
logger.info("updateOneMonthData,getUserInfoFromUic, promoteUid is {},date is {}.",promoteUid,date);
|
|
|
UserInfoRspBO userInfoRspBO = userServiceHelper.getUserInfoFromUic(promoteUid);
|
|
|
if (userInfoRspBO != null) {
|
|
|
month.setImage(userInfoRspBO.getHeadIco());
|
|
|
month.setImage(ImagesHelper.getImageUrl(userInfoRspBO.getHeadIco()));
|
|
|
month.setNickname(userInfoRspBO.getNickname());
|
|
|
}
|
|
|
month.setType(1);//类型:1-联盟用户,2-马甲用户
|
|
|
month.setDate(dateInt);
|
|
|
month.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
month.setUid(promoteUid);
|
|
|
if (unionShareOrdersMonth != null) {
|
|
|
//月预估收益更新
|
|
|
month.setId(unionShareOrdersMonth.getId());
|
|
|
logger.info("updateOneMonthData,updateByUidAndMonth, promoteUid is {},date is {},update data is {}.",promoteUid,date,month);
|
|
|
int result=unionShareOrdersMonthMapper.updateByUidAndMonth(month);
|
|
|
if (result > 0) {
|
|
|
return;
|
|
|
if (result == 0) {
|
|
|
logger.info("updateOneMonthData,updateByUidAndMonth fail, promoteUid is {},date is {}");
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
month.setCreateTime(month.getUpdateTime());
|
|
|
logger.info("updateOneMonthData,insertSelective, promoteUid is {},date is {},insert data is {}.",promoteUid,date,month);
|
...
|
...
|
@@ -2320,7 +2359,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
private UnionShareOrdersMonth getMonthData(int promoteUid, int date) {
|
|
|
logger.info("getMonthData promoteUid is {},date is {}.",promoteUid,date);
|
|
|
List<UnionShareOrdersMonth> unionShareOrdersMonth = unionShareOrdersMonthMapper.selectMonthData(date, promoteUid,1);
|
|
|
if (unionShareOrdersMonth == null ) {
|
|
|
if (CollectionUtils.isEmpty(unionShareOrdersMonth)) {
|
|
|
return null;
|
|
|
}
|
|
|
for (int i = 1; i < unionShareOrdersMonth.size(); i++) {
|
...
|
...
|
|