...
|
...
|
@@ -555,7 +555,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
int result=unionShareUserApplyMapper.updateStatus(new HashSet<Integer>(){{add(req.getId());}},1,2, DateUtil.getCurrentTimeSecond());
|
|
|
if (result > 0) {
|
|
|
// 绑定unionType
|
|
|
relateUnionType(unionShareUserApply.getUid(),req.getId(), unionShareUserApply.getMobile());
|
|
|
relateUnionType(unionShareUserApply.getUid(),req.getId(),unionShareUserApply.getInviterUnionType(), unionShareUserApply.getMobile());
|
|
|
}
|
|
|
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),unionShareUserApply.getUid());
|
|
|
return result;
|
...
|
...
|
@@ -587,7 +587,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
relateUnionType(u.getUid(),u.getId(), u.getMobile());
|
|
|
relateUnionType(u.getUid(),u.getId(),u.getInviterUnionType(), u.getMobile());
|
|
|
} catch (Exception e) {
|
|
|
logger.error("relateUnionType error ,uid is {}",u.getUid());
|
|
|
}
|
...
|
...
|
@@ -598,7 +598,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
}
|
|
|
}
|
|
|
|
|
|
public void relateUnionType(int uid,int applyId, String mobile) {
|
|
|
public void relateUnionType(int uid,int applyId,String inviterUnionType, String mobile) {
|
|
|
logger.info("relateUnionType,uid is {}", uid);
|
|
|
UnionShareUser unionShareUser1 = unionShareUserMapper.selectByUid(uid);
|
|
|
if (null != unionShareUser1) {
|
...
|
...
|
@@ -614,6 +614,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
return;
|
|
|
}
|
|
|
|
|
|
Integer inviterUid=unionShareUserMapper.selectUidByUnionType(inviterUnionType);
|
|
|
|
|
|
//生成unionType
|
|
|
MktMarketingUrl unionDepartmentUrl = buildMktMarketingUrl(uid);
|
|
|
try {
|
...
|
...
|
@@ -636,6 +638,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
unionShareUser.setCreateTime(DateUtil.getCurrentTimeSecond());
|
|
|
unionShareUser.setUpdateTime(unionShareUser.getCreateTime());
|
|
|
unionShareUser.setApplyId(applyId);
|
|
|
unionShareUser.setInviterUid(inviterUid);
|
|
|
int result = unionShareUserMapper.insertSelective(unionShareUser);
|
|
|
if (result > 0) {
|
|
|
logger.info("relateUnionType,begin to send message,uid is {},unionType is {}", uid,unionDepartmentUrl.getUnionType());
|
...
|
...
|
@@ -1277,6 +1280,57 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 预估详细列表
|
|
|
* type(预估收入类型):1-订单收入,2-其他收入
|
|
|
* queryTimeType(预估收入实际):1-昨日,2-本月,3-上月
|
|
|
* */
|
|
|
@Override
|
|
|
public PageResponseBO<UnionShareOrders> queryEstimateDetailList(UnionShareOrderReqBO unionShareOrderReqBO) {
|
|
|
logger.info("UnionShareServiceImpl.queryEstimateDetailList,bo is {}",unionShareOrderReqBO);
|
|
|
//先从缓存获取
|
|
|
PageResponseBO<UnionShareOrders> cacheResult = getFromRedis(ShareOrdersKeyEnum.ESTIMATE_LIST, unionShareOrderReqBO.getUid(),PageResponseBO.class,unionShareOrderReqBO.getType().toString(),unionShareOrderReqBO.getQueryTimeType().toString(), String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
|
|
|
if (cacheResult != null) {
|
|
|
logger.info("UnionShareServiceImpl.queryEstimateDetailList get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
|
|
|
return cacheResult;
|
|
|
}
|
|
|
//获取总数
|
|
|
PageResponseBO<UnionShareOrders> response = new PageResponseBO<>();
|
|
|
|
|
|
//queryTimeType(预估收入实际):1-昨日,2-本月,3-上月
|
|
|
int beginTime = 0;
|
|
|
int endTime = 0;
|
|
|
if (unionShareOrderReqBO.getQueryTimeType() == 1) {
|
|
|
beginTime = DateUtil.getLastDayStartInt(1);
|
|
|
endTime = DateUtil.getLastDayEndInt(1);
|
|
|
}else if (unionShareOrderReqBO.getQueryTimeType() == 2) {
|
|
|
beginTime=DateUtil.getLastMonthStartInt(0);
|
|
|
endTime=DateUtil.getLastMonthEndInt(0);
|
|
|
}else if (unionShareOrderReqBO.getQueryTimeType() == 3) {
|
|
|
beginTime=DateUtil.getLastMonthStartInt(1);
|
|
|
endTime=DateUtil.getLastMonthEndInt(1);
|
|
|
}else {
|
|
|
throw new ServiceException(ServiceError.PARAM_ERROR);
|
|
|
}
|
|
|
Integer count = unionShareOrdersMapper.selectCountByCon(unionShareOrderReqBO.getUid(),unionShareOrderReqBO.getType(),beginTime,endTime);
|
|
|
if (count <= 0){
|
|
|
logger.info("UnionShareServiceImpl.queryEstimateDetailList count is 0");
|
|
|
return response;
|
|
|
}
|
|
|
//分页
|
|
|
int start=unionShareOrderReqBO.getPage()>1?(unionShareOrderReqBO.getPage()-1)*unionShareOrderReqBO.getSize():0;
|
|
|
List<UnionShareOrders> unionShareOrdersList = unionShareOrdersMapper.selectListByCon(unionShareOrderReqBO.getUid(),unionShareOrderReqBO.getType(),beginTime,endTime,start,unionShareOrderReqBO.getSize());
|
|
|
dealShareOrderList(unionShareOrdersList,unionShareOrderReqBO.getType());
|
|
|
response.setSize(unionShareOrderReqBO.getSize());
|
|
|
response.setPage(unionShareOrderReqBO.getPage()>1?unionShareOrderReqBO.getPage():1);
|
|
|
response.setTotal(count);
|
|
|
response.setList(unionShareOrdersList);
|
|
|
//设置缓存
|
|
|
addToRedis(ShareOrdersKeyEnum.ESTIMATE_LIST,unionShareOrderReqBO.getUid(),response,unionShareOrderReqBO.getType().toString(),unionShareOrderReqBO.getQueryTimeType().toString(),
|
|
|
String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 达人排行榜
|
|
|
* @param req
|
|
|
* @return
|
...
|
...
|
@@ -1591,7 +1645,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
if (activityLog.getActivityType() == 3) {
|
|
|
joinResult = joinExtraActivity(activityLog.getOrderUid(), activityLog.getPromoteUid(), activityLog.getActivityId());
|
|
|
} else if (activityLog.getActivityType() == 4) {
|
|
|
int endTime = DateUtil.getLastDayInt(activityLog.getCreateTime(),1);
|
|
|
int endTime = DateUtil.getLastDayStartInt(activityLog.getCreateTime(),1);
|
|
|
List<UnionShareOrders> orders=unionShareOrdersMapper.selectNewPromoteUidOrder(activityLog.getPromoteUid(), endTime);
|
|
|
joinResult = joinNewCpsActivity(activityLog.getPromoteUid(), orders, activityLog.getActivityId());
|
|
|
}
|
...
|
...
|
@@ -1859,9 +1913,9 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
@Override
|
|
|
public void clearActivityCache(int activityId) {
|
|
|
// 清除某活动缓存
|
|
|
String dateStr=DateUtil.getDateStrBySecond(DateUtil.getLastDayInt(0),"yyyyMMdd");
|
|
|
String date1Str=DateUtil.getDateStrBySecond(DateUtil.getLastDayInt(1),"yyyyMMdd");
|
|
|
String date7Str=DateUtil.getDateStrBySecond(DateUtil.getLastDayInt(7),"yyyyMMdd");
|
|
|
String dateStr=DateUtil.getDateStrBySecond(DateUtil.getLastDayStartInt(0),"yyyyMMdd");
|
|
|
String date1Str=DateUtil.getDateStrBySecond(DateUtil.getLastDayStartInt(1),"yyyyMMdd");
|
|
|
String date7Str=DateUtil.getDateStrBySecond(DateUtil.getLastDayStartInt(7),"yyyyMMdd");
|
|
|
redisTemplate.delete(ShareOrdersKeyEnum.ACTIVITY_ING_LIST.getPreKey()+dateStr);
|
|
|
redisTemplate.delete(ShareOrdersKeyEnum.ACTIVITY_ING_LIST.getPreKey()+date1Str);
|
|
|
redisTemplate.delete(ShareOrdersKeyEnum.ACTIVITY_ING_LIST.getPreKey()+date7Str);
|
...
|
...
|
|