修改bug

上级 a3036d4d
流水线 #8728 已通过 于阶段
in 2 分 32 秒
......@@ -190,7 +190,7 @@ public interface UserServiceDao {
int getYesterdayAddUserCount();
void insertActiveUserCount(ActiveUserCountDO activeUserCountDO);
int insertActiveUserCount(ActiveUserCountDO activeUserCountDO);
ActiveUserCountDO getActiveUserCountByDayNum();
......
......@@ -26,14 +26,20 @@ public class ManagerLogSchedule {
@Scheduled(cron = "0 0 8 * * ?")
public void calculateActiveUserCount() {
log.info("统计日活量");
Integer userActiveCount = userReportService.getUserActiveCount();
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -1);
//记录到数据库
ActiveUserCountVO yxfActiveUserCountVO = new ActiveUserCountVO();
yxfActiveUserCountVO.setActiveDate(calendar.getTime());
int temp = 0,i=0;
while(temp == 0 && i <= 5) {
Integer userActiveCount = userReportService.getUserActiveCount();
if(userActiveCount != null) {
yxfActiveUserCountVO.setActiveUserCount(userActiveCount);
userReportService.insertActiveUserCount(yxfActiveUserCountVO);
temp = userReportService.insertActiveUserCount(yxfActiveUserCountVO);
}
i++;
}
}
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ public interface UserReportService {
Integer getUserActiveCount();
void insertActiveUserCount(ActiveUserCountVO param);
int insertActiveUserCount(ActiveUserCountVO param);
ProductReportDTO getJoinStoreNumber();
......
......@@ -61,7 +61,13 @@ public class UserReportServiceImpl implements UserReportService {
ResultBody resultBody = wxService.getUserPortrait();
if (resultBody != null && resultBody.getCode().equals("200")) {
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);
return (Integer) object.get("visit_uv");
}
......@@ -69,9 +75,9 @@ public class UserReportServiceImpl implements UserReportService {
}
@Override
public void insertActiveUserCount(ActiveUserCountVO param) {
public int insertActiveUserCount(ActiveUserCountVO param) {
ActiveUserCountDO activeUserCountDO = new ActiveUserCountDO(param);
userServiceDao.insertActiveUserCount(activeUserCountDO);
return userServiceDao.insertActiveUserCount(activeUserCountDO);
}
@Override
......
......@@ -95,6 +95,7 @@
values (#{activeUserCount}, #{activeDate}, NOW())
</insert>
<update id="update" parameterType="com.mmc.iuav.user.entity.UserAccountDO">
update user_account
<set>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论