|
@@ -1,7 +1,5 @@
|
|
|
package com.gis.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.bean.BeanUtil;
|
|
|
-import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -10,33 +8,21 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.gis.common.constant.ConfigConstant;
|
|
|
-import com.gis.common.constant.ErrorEnum;
|
|
|
-import com.gis.common.constant.RedisConstant;
|
|
|
-import com.gis.common.constant.SomeDataConstant;
|
|
|
import com.gis.common.constant.*;
|
|
|
import com.gis.common.exception.BaseRuntimeException;
|
|
|
import com.gis.common.httpclient.FdkkClient;
|
|
|
import com.gis.common.mq.RabbitMqProducerUtil;
|
|
|
import com.gis.common.util.*;
|
|
|
import com.gis.domain.dto.*;
|
|
|
-import com.gis.domain.entity.*;
|
|
|
import com.gis.domain.entity.FodderEntity;
|
|
|
import com.gis.domain.entity.ScenePanoEntity;
|
|
|
import com.gis.domain.entity.WorkEntity;
|
|
|
import com.gis.domain.entity.WorkHotsFodderEntity;
|
|
|
import com.gis.domain.vo.ReportWorkVo;
|
|
|
-import com.gis.domain.vo.WorkNavigationVo;
|
|
|
-import com.gis.domain.vo.WorkVo;
|
|
|
import com.gis.mapper.*;
|
|
|
import com.gis.oss.util.FileAndOssUtil;
|
|
|
import com.gis.oss.util.FileUtils;
|
|
|
import com.gis.oss.util.QrCodeUtils;
|
|
|
-import com.gis.service.*;
|
|
|
-import com.gis.util.UserRequest;
|
|
|
import com.gis.service.FodderService;
|
|
|
import com.gis.service.ScenePanoService;
|
|
|
import com.gis.service.WorkHotsFodderService;
|
|
@@ -61,6 +47,7 @@ import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -136,6 +123,11 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
@Value("${queue.relics-update-name-queue:#{null}}")
|
|
|
String relicsUpdateNameQueue;
|
|
|
|
|
|
+ @Override
|
|
|
+ public IBaseStrMapper<WorkEntity, String> getBaseMapper() {
|
|
|
+ return this.entityMapper;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Result search(AgePageDto param, boolean isAdmin) {
|
|
@@ -144,10 +136,10 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
if (isAdmin){
|
|
|
userNameForToken = null;
|
|
|
}
|
|
|
- List<WorkEntity> search = entityMapper.search(param, userNameForToken);
|
|
|
+ List<WorkEntity> search = entityMapper.search(param, userNameForToken,isAdmin);
|
|
|
|
|
|
- // 2023-01-30 记录登录用户-数据统计使用
|
|
|
- if (StrUtil.isNotBlank(userNameForToken)){
|
|
|
+ // 2023-01-30 记录登录用户-数据统计使用
|
|
|
+ if (StrUtil.isNotBlank(userNameForToken)) {
|
|
|
userRecord(userNameForToken);
|
|
|
}
|
|
|
|
|
@@ -157,13 +149,14 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
|
|
|
/**
|
|
|
* 2022-12-20 记录用户登录-数据统计使用
|
|
|
+ *
|
|
|
* @param userName
|
|
|
*/
|
|
|
private void userRecord(String userName) {
|
|
|
String baseKey = RedisConstant.REPORT_USER + LocalDate.now();
|
|
|
- String key = baseKey + "_" + userName;
|
|
|
+ String key = baseKey + "_" + userName;
|
|
|
log.info("该用户:{} redis key:{}", userName, key);
|
|
|
- if (redisUtil.hasKey(key)){
|
|
|
+ if (redisUtil.hasKey(key)) {
|
|
|
log.info("该用户当天已登录,不需要统计");
|
|
|
return;
|
|
|
}
|
|
@@ -233,8 +226,6 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
JSONObject jsonObject = JSONObject.parseObject(content);
|
|
|
jsonObject.put("id", id + "");
|
|
|
|
|
@@ -278,9 +269,8 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Test
|
|
|
- public void test1(){
|
|
|
+ public void test1() {
|
|
|
LocalDate now = LocalDate.now();
|
|
|
log.info("now : {}", now);
|
|
|
log.info("now-m : {}", now.minusMonths(3));
|
|
@@ -347,9 +337,9 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
public boolean getUserWorkCountBySceneCodes(List<String> sceneCodes) {
|
|
|
for (String sceneCode : sceneCodes) {
|
|
|
String format = StrUtil.format("SELECT count(1) FROM tb_work WHERE is_delete=0 and status={} and user_id = '{}' and find_in_set('{}' , scene_codes ) ",
|
|
|
- 1, userRequest.getUserNameForToken(),sceneCode);
|
|
|
+ 1, userRequest.getUserNameForToken(), sceneCode);
|
|
|
Integer count = entityMapper.getCountStr(format);
|
|
|
- if (count > 0){
|
|
|
+ if (count > 0) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
@@ -470,11 +460,11 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
} catch (InterruptedException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- String userNameForToken = null;//getUserNameForToken();
|
|
|
- if (!userNameForToken.equals(entity.getUserId())&&ObjectUtil.isEmpty(entity.getNum())) {
|
|
|
+ String userNameForToken = getUserNameForToken();
|
|
|
+ if (!userNameForToken.equals(entity.getUserId()) && ObjectUtil.isEmpty(entity.getNum())) {
|
|
|
return Result.failure(ErrorEnum.FAILURE_SYS_3011.code(), "当前无操作权限");
|
|
|
- } else if (ObjectUtil.isNotEmpty(entity.getType())&&entity.getType().equalsIgnoreCase("pro")){
|
|
|
- JSONObject cameraList =fdkkClient.getCameraListByToken(null,"3,4,5");
|
|
|
+ } else if (ObjectUtil.isNotEmpty(entity.getType()) && entity.getType().equalsIgnoreCase("pro")) {
|
|
|
+ JSONObject cameraList = fdkkClient.getCameraListByToken(getToken(), "3,4,5");
|
|
|
List<String> snCodes = new ArrayList<>();
|
|
|
if (cameraList.getInteger("code") == 0) {
|
|
|
JSONArray data = cameraList.getJSONObject("data").getJSONArray("snCodes");
|
|
@@ -556,6 +546,7 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
|
|
|
/**
|
|
|
* 更新 tour.xml
|
|
|
+ *
|
|
|
* @param someDataToJson
|
|
|
* @param id
|
|
|
*/
|
|
@@ -872,6 +863,7 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 场景码字符串转list
|
|
|
* @param param
|
|
@@ -1365,8 +1357,8 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
|
|
|
@Override
|
|
|
public Result<WorkEntity> searchSceneWorkList(AgePageDto param) {
|
|
|
- String token = null;//getToken();
|
|
|
- JSONObject cameraList =fdkkClient.getCameraListByToken(token,"3,4,5");
|
|
|
+ String token = getToken();
|
|
|
+ JSONObject cameraList = fdkkClient.getCameraListByToken(token, "3,4,5");
|
|
|
List<String> snCodes = new ArrayList<>();
|
|
|
if (cameraList.getInteger("code") == 0) {
|
|
|
JSONArray data = cameraList.getJSONObject("data").getJSONArray("snCodes");
|
|
@@ -1378,7 +1370,7 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
}
|
|
|
//startPage(param);
|
|
|
param.setSnCodes(snCodes);
|
|
|
- List<WorkEntity> search = entityMapper.search(param, "");
|
|
|
+ List<WorkEntity> search = entityMapper.search(param, "", false);
|
|
|
|
|
|
return Result.success(new PageInfo<>(search));
|
|
|
}
|
|
@@ -1387,4 +1379,23 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implemen
|
|
|
public WorkEntity findByIdOrNum(String id) {
|
|
|
return entityMapper.findByIdOrNum(id);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getWorkSceneBySn(String snCode) {
|
|
|
+ List<WorkEntity> list = entityMapper.getWorkSceneBySn(snCode);
|
|
|
+ List<RelicsSceneInitQueueDTO> res = list.stream().map(workEntity -> {
|
|
|
+ RelicsSceneInitQueueDTO sceneInitQueueDTO = new RelicsSceneInitQueueDTO();
|
|
|
+ sceneInitQueueDTO.setSceneCode(workEntity.getNum());
|
|
|
+ sceneInitQueueDTO.setLocation(workEntity.getLocation());
|
|
|
+ sceneInitQueueDTO.setSceneSource(workEntity.getSceneSource());
|
|
|
+ sceneInitQueueDTO.setAlgorithmTime(workEntity.getAlgorithmTime());
|
|
|
+ sceneInitQueueDTO.setCreateTime(workEntity.getCreateTime());
|
|
|
+ sceneInitQueueDTO.setPhoneNum(workEntity.getUserId());
|
|
|
+ sceneInitQueueDTO.setStatus(workEntity.getCalcStatus());
|
|
|
+ sceneInitQueueDTO.setSceneName(workEntity.getName());
|
|
|
+ sceneInitQueueDTO.setSnCode(workEntity.getSnCode());
|
|
|
+ return sceneInitQueueDTO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return Result.success(res);
|
|
|
+ }
|
|
|
}
|