2
0

fix: stat traffic

This commit is contained in:
caiyuchao
2024-12-24 19:02:50 +08:00
parent 8f086f8d7e
commit 6fa0ff1354
5 changed files with 13 additions and 9 deletions

View File

@@ -40,7 +40,7 @@ public class JacksonConfig {
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter)); javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter));
builder.modules(javaTimeModule); builder.modules(javaTimeModule);
builder.timeZone(TimeZone.getDefault()); builder.timeZone(TimeZone.getDefault());
log.info("初始化 jackson 配置"); log.info("init jackson config");
}; };
} }

View File

@@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.web.controller.BaseController; import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult; import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo; import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.user.domain.UOrder; import org.wfc.user.domain.UOrder;
import org.wfc.user.service.IUOrderService; import org.wfc.user.service.IUOrderService;
@@ -54,7 +53,6 @@ public class UOrderController extends BaseController {
@PostMapping @PostMapping
public AjaxResult add(@RequestBody UOrder uOrder) { public AjaxResult add(@RequestBody UOrder uOrder) {
uOrder.setUserId(SecurityUtils.getUserId());
return toAjax(uOrderService.saveOrder(uOrder)); return toAjax(uOrderService.saveOrder(uOrder));
} }

View File

@@ -1,5 +1,6 @@
package org.wfc.user.service.impl; package org.wfc.user.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
@@ -74,9 +75,11 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
.map(UAccount::getUserId) .map(UAccount::getUserId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<UClient> clients = clientMapper.selectList(Wrappers.<UClient>lambdaQuery().in(UClient::getUserId, userIds)); if (CollUtil.isNotEmpty(userIds)) {
for (UClient client : clients) { List<UClient> clients = clientMapper.selectList(Wrappers.<UClient>lambdaQuery().in(UClient::getUserId, userIds));
omadaAuthorizedClientApi.cancelAuthClient(client.getSiteId(), client.getClientMac()); for (UClient client : clients) {
omadaAuthorizedClientApi.cancelAuthClient(client.getSiteId(), client.getClientMac());
}
} }
} }

View File

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.omada.api.hotspot.OmadaAuthorizedClientApi; import org.wfc.omada.api.hotspot.OmadaAuthorizedClientApi;
import org.wfc.user.domain.UAccount; import org.wfc.user.domain.UAccount;
import org.wfc.user.domain.UClient; import org.wfc.user.domain.UClient;
@@ -131,6 +132,7 @@ public class UOrderServiceImpl extends ServiceImpl<UOrderMapper, UOrder> impleme
@Override @Override
public boolean saveOrder(UOrder order) { public boolean saveOrder(UOrder order) {
order.setUserId(SecurityUtils.getUserId());
order.setStatus(OrderStatusEnum.UNPAID.getCode()); order.setStatus(OrderStatusEnum.UNPAID.getCode());
this.save(order); this.save(order);
// 支付成功回调 // 支付成功回调

View File

@@ -26,17 +26,18 @@
WHERE WHERE
cdr.del_flag = 0 cdr.del_flag = 0
AND cdr.last_seen_time != ifnull( ch.end_time, 0 ) AND cdr.last_seen_time != ifnull( ch.end_time, 0 )
<if test="userId != null and userId != ''">AND cdr.user_id = #{userId} <if test="userId != null and userId != ''">
AND cdr.user_id = #{userId}
</if> </if>
GROUP BY GROUP BY
cdr.user_id cdr.user_id
) t ) t
<where> <where>
<if test="endTime != null"> <if test="endTime != null">
t.last_seen_time &lt;= #{endTime} AND t.end_time &lt;= #{endTime}
</if> </if>
<if test="startTime != null"> <if test="startTime != null">
t.start_time >= #{startTime} AND t.start_time >= #{startTime}
</if> </if>
</where> </where>
</select> </select>