提交 ac5c5ba4 作者: 刘明祎-运维用途

Merge branch 'develop'

流水线 #8729 已通过 于阶段
in 2 分 31 秒
...@@ -190,7 +190,7 @@ public interface UserServiceDao { ...@@ -190,7 +190,7 @@ public interface UserServiceDao {
int getYesterdayAddUserCount(); int getYesterdayAddUserCount();
void insertActiveUserCount(ActiveUserCountDO activeUserCountDO); int insertActiveUserCount(ActiveUserCountDO activeUserCountDO);
ActiveUserCountDO getActiveUserCountByDayNum(); ActiveUserCountDO getActiveUserCountByDayNum();
......
...@@ -26,14 +26,20 @@ public class ManagerLogSchedule { ...@@ -26,14 +26,20 @@ public class ManagerLogSchedule {
@Scheduled(cron = "0 0 8 * * ?") @Scheduled(cron = "0 0 8 * * ?")
public void calculateActiveUserCount() { public void calculateActiveUserCount() {
log.info("统计日活量"); log.info("统计日活量");
Integer userActiveCount = userReportService.getUserActiveCount();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -1); calendar.add(Calendar.DAY_OF_MONTH, -1);
//记录到数据库 //记录到数据库
ActiveUserCountVO yxfActiveUserCountVO = new ActiveUserCountVO(); ActiveUserCountVO yxfActiveUserCountVO = new ActiveUserCountVO();
yxfActiveUserCountVO.setActiveDate(calendar.getTime()); yxfActiveUserCountVO.setActiveDate(calendar.getTime());
yxfActiveUserCountVO.setActiveUserCount(userActiveCount); int temp = 0,i=0;
userReportService.insertActiveUserCount(yxfActiveUserCountVO); while(temp == 0 && i <= 5) {
Integer userActiveCount = userReportService.getUserActiveCount();
if(userActiveCount != null) {
yxfActiveUserCountVO.setActiveUserCount(userActiveCount);
temp = userReportService.insertActiveUserCount(yxfActiveUserCountVO);
}
i++;
}
} }
} }
\ No newline at end of file
...@@ -16,7 +16,7 @@ public interface UserReportService { ...@@ -16,7 +16,7 @@ public interface UserReportService {
Integer getUserActiveCount(); Integer getUserActiveCount();
void insertActiveUserCount(ActiveUserCountVO param); int insertActiveUserCount(ActiveUserCountVO param);
ProductReportDTO getJoinStoreNumber(); ProductReportDTO getJoinStoreNumber();
......
...@@ -61,7 +61,13 @@ public class UserReportServiceImpl implements UserReportService { ...@@ -61,7 +61,13 @@ public class UserReportServiceImpl implements UserReportService {
ResultBody resultBody = wxService.getUserPortrait(); ResultBody resultBody = wxService.getUserPortrait();
if (resultBody != null && resultBody.getCode().equals("200")) { if (resultBody != null && resultBody.getCode().equals("200")) {
JSONObject result = JSONObject.parseObject(resultBody.getResult().toString()); JSONObject result = JSONObject.parseObject(resultBody.getResult().toString());
JSONArray jsonArray = JSONArray.parseArray(result.get("list").toString()); JSONArray jsonArray;
//当去微信拿不到日活量时会报空指针就返回null代表没拿到数据,要重新请求
try {
jsonArray = JSONArray.parseArray(result.get("list").toString());
}catch (NullPointerException e) {
return null;
}
JSONObject object = (JSONObject) jsonArray.get(0); JSONObject object = (JSONObject) jsonArray.get(0);
return (Integer) object.get("visit_uv"); return (Integer) object.get("visit_uv");
} }
...@@ -69,9 +75,9 @@ public class UserReportServiceImpl implements UserReportService { ...@@ -69,9 +75,9 @@ public class UserReportServiceImpl implements UserReportService {
} }
@Override @Override
public void insertActiveUserCount(ActiveUserCountVO param) { public int insertActiveUserCount(ActiveUserCountVO param) {
ActiveUserCountDO activeUserCountDO = new ActiveUserCountDO(param); ActiveUserCountDO activeUserCountDO = new ActiveUserCountDO(param);
userServiceDao.insertActiveUserCount(activeUserCountDO); return userServiceDao.insertActiveUserCount(activeUserCountDO);
} }
@Override @Override
......
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
values (#{activeUserCount}, #{activeDate}, NOW()) values (#{activeUserCount}, #{activeDate}, NOW())
</insert> </insert>
<update id="update" parameterType="com.mmc.iuav.user.entity.UserAccountDO"> <update id="update" parameterType="com.mmc.iuav.user.entity.UserAccountDO">
update user_account update user_account
<set> <set>
......
...@@ -18,4 +18,4 @@ patches: ...@@ -18,4 +18,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/cms newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/cms
newTag: 7b01f0ed55237f7a05b8d08c6761cb16d85419db newTag: d84c058d7243ae0e7e3f1e804ed265c4d400b3e1
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论