|
@@ -29,6 +29,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -107,8 +108,32 @@ public class BaseAppInfoServiceImpl extends AbstractCrudService<BaseAppInfoMappe
|
|
|
IPage<BaseAppInfo> page = new Page<>(appInfoRequest.getCurrent(), appInfoRequest.getSize());
|
|
|
QueryWrapper<BaseAppInfo> queryWrapper = Wrappers.query();
|
|
|
queryWrapper.eq(StringUtils.isNotBlank(appInfoRequest.getDeviceId()),"device_id",appInfoRequest.getDeviceId())
|
|
|
- .inSql("id","SELECT MAX(id) AS id FROM base_app_info GROUP BY device_id");
|
|
|
+ .inSql("id","SELECT MAX(id) AS id FROM base_app_info GROUP BY device_id")
|
|
|
+ .orderByDesc("id");
|
|
|
page = this.page(page,queryWrapper);
|
|
|
+ if (page.getSize()>0){
|
|
|
+ for (int i = 0; i < page.getSize(); i++) {
|
|
|
+ if (page.getRecords().get(i).getCheckStatus().equals(1)){
|
|
|
+ LocalDateTime endTime = LocalDateTime.now();
|
|
|
+ long seconds = ChronoUnit.SECONDS.between(page.getRecords().get(i).getUpdateTime(), endTime);
|
|
|
+ if (seconds>10){
|
|
|
+ page.getRecords().get(i).setDeviceStatus(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return new CommonPage<>(page.getRecords(),page.getTotal(),page.getCurrent(),page.getSize());
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void selfCheck(String baseAppInfo){
|
|
|
+ JSONObject eventVO = JSONObject.parseObject(baseAppInfo);
|
|
|
+ BaseAppInfo baseAppInfo1 = new BaseAppInfo();
|
|
|
+ Integer id = Integer.valueOf(eventVO.get("id").toString());
|
|
|
+ baseAppInfo1.setId(id);
|
|
|
+ baseAppInfo1.setCheckStatus(1);
|
|
|
+ baseAppInfo1.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ baseAppInfo1.setUpdateTime(LocalDateTime.now());
|
|
|
+ this.updateById(baseAppInfo1);
|
|
|
+ }
|
|
|
}
|