parent
9d302e22e7
commit
8f6a3ec4e4
53 changed files with 4789 additions and 28340 deletions
@ -1,9 +0,0 @@ |
||||
package com.hisense.hiatmp.server_api.service; |
||||
|
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public interface AuthService { |
||||
|
||||
public String encrypt(String input); |
||||
} |
||||
@ -1,24 +0,0 @@ |
||||
package com.hisense.hiatmp.server_api.service; |
||||
|
||||
import com.hisense.hiatmp.model.common.ThtDangerItems; |
||||
import com.hisense.hiatmp.model.dmr.Point; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.nio.file.Path; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service |
||||
public interface HighDangerService { |
||||
|
||||
List<Map<String, String>> getHighDangerStatusNum(String nuserid); |
||||
|
||||
Double getPointDistance(Point point1,Point point2); |
||||
|
||||
Map<String, Double> sortByValue(Map<String, Double> unsortedMap); |
||||
|
||||
List<ThtDangerItems> listWithTree(); |
||||
|
||||
List<Path> saveMultipartFiles(List<MultipartFile> multipartFiles); |
||||
} |
||||
@ -1,10 +0,0 @@ |
||||
package com.hisense.hiatmp.server_api.service; |
||||
|
||||
import com.hisense.hiatmp.model.common.Operator; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public interface OperatorService { |
||||
|
||||
public Operator getOperatorById(String nuserid); |
||||
} |
||||
@ -1,32 +0,0 @@ |
||||
package com.hisense.hiatmp.server_api.service.impl; |
||||
|
||||
import com.hisense.hiatmp.server_api.service.AuthService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.security.MessageDigest; |
||||
import java.security.NoSuchAlgorithmException; |
||||
|
||||
@Service |
||||
public class AuthServiceImpl implements AuthService { |
||||
@Override |
||||
public String encrypt(String input) { |
||||
try { |
||||
MessageDigest digest = MessageDigest.getInstance("SHA-512"); |
||||
byte[] hash = digest.digest(input.getBytes()); |
||||
|
||||
StringBuilder hexString = new StringBuilder(); |
||||
for (byte b : hash) { |
||||
String hex = Integer.toHexString(0xff & b); |
||||
if (hex.length() == 1) { |
||||
hexString.append('0'); |
||||
} |
||||
hexString.append(hex); |
||||
} |
||||
|
||||
return hexString.toString(); |
||||
} catch (NoSuchAlgorithmException e) { |
||||
e.printStackTrace(); |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
@ -1,144 +0,0 @@ |
||||
package com.hisense.hiatmp.server_api.service.impl; |
||||
|
||||
import com.hisense.hiatmp.server_api.mapper.HighDangerMapper; |
||||
import com.hisense.hiatmp.server_api.service.HighDangerService; |
||||
import com.hisense.hiatmp.model.common.ThtDangerItems; |
||||
import com.hisense.hiatmp.model.dmr.Point; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.io.File; |
||||
import java.nio.file.Path; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.*; |
||||
import java.util.stream.Collectors; |
||||
|
||||
@Service |
||||
public class HighDangerBaseServiceImpl implements HighDangerService { |
||||
|
||||
@Value("${file.path.local}") |
||||
private String fileLocalPath; |
||||
|
||||
private static SimpleDateFormat sfFile = new SimpleDateFormat("yyyyMMddHHmmss"); |
||||
|
||||
@Autowired |
||||
private HighDangerMapper highDangerMapper; |
||||
|
||||
|
||||
@Override |
||||
public List<Map<String, String>> getHighDangerStatusNum(String nuserid) { |
||||
|
||||
return Collections.emptyList(); |
||||
} |
||||
|
||||
// 两点之间的距离
|
||||
@Override |
||||
public Double getPointDistance(Point point1, Point point2) { |
||||
|
||||
double dx = point2.getX() - point1.getX(); |
||||
double dy = point2.getY() - point1.getY(); |
||||
return Math.sqrt(dx * dx + dy * dy); |
||||
} |
||||
|
||||
|
||||
// 实现按照 Map 值排序的方法
|
||||
public Map<String, Double> sortByValue(Map<String, Double> unsortedMap) { |
||||
// 将 Map 转换为 List,然后排序
|
||||
List<Map.Entry<String, Double>> list = new LinkedList<>(unsortedMap.entrySet()); |
||||
|
||||
// 使用 Collections.sort() 方法,传入比较器 Comparator
|
||||
Collections.sort(list, new Comparator<Map.Entry<String, Double>>() { |
||||
public int compare(Map.Entry<String, Double> o1, Map.Entry<String, Double> o2) { |
||||
return Double.compare(o1.getValue(), o2.getValue()); |
||||
} |
||||
}); |
||||
|
||||
// 将排序后的键值对重新放入一个新的 LinkedHashMap 中
|
||||
// 保留了插入顺序,也可以使用 TreeMap 等其他类型的 Map
|
||||
Map<String, Double> sortedMap = new LinkedHashMap<>(); |
||||
for (Map.Entry<String, Double> entry : list) { |
||||
sortedMap.put(entry.getKey(), entry.getValue()); |
||||
} |
||||
|
||||
return sortedMap; |
||||
} |
||||
|
||||
/* |
||||
递归查找 |
||||
*/ |
||||
@Override |
||||
public List<ThtDangerItems> listWithTree(){ |
||||
|
||||
List<ThtDangerItems> dangerItems = highDangerMapper.getDangerItems(); |
||||
List<ThtDangerItems> dangerItemResult = dangerItems.stream().map(items -> { |
||||
ThtDangerItems dangerItemVO = new ThtDangerItems(); |
||||
BeanUtils.copyProperties(items, dangerItemVO); |
||||
return dangerItemVO; |
||||
}).collect(Collectors.toList()); |
||||
|
||||
List<ThtDangerItems> list = dangerItemResult.stream().filter(items -> |
||||
items.getParentid()==null || items.getParentid().isEmpty() |
||||
).map((menu)->{ |
||||
menu.setChildren(getChildrenData(menu,dangerItemResult)); |
||||
return menu; |
||||
}).collect(Collectors.toList()); |
||||
return list; |
||||
} |
||||
|
||||
|
||||
|
||||
private List<ThtDangerItems> getChildrenData(ThtDangerItems root, List<ThtDangerItems> all) { |
||||
List<ThtDangerItems> children = all.stream().filter(items -> |
||||
root.getId().equals(items.getParentid()) |
||||
).map(item -> { |
||||
item.setChildren(getChildrenData(item,all)); |
||||
return item; |
||||
}).collect(Collectors.toList()); |
||||
return children; |
||||
} |
||||
|
||||
// 保存图片
|
||||
@Override |
||||
public List<Path> saveMultipartFiles(List<MultipartFile> multipartFiles) { |
||||
ArrayList<Path> paths = new ArrayList<>(); |
||||
if(multipartFiles!= null &&!multipartFiles.isEmpty()){ |
||||
for (MultipartFile multipartFile : multipartFiles) { |
||||
// 保存图片
|
||||
try { |
||||
boolean add = paths.add(handleFileSave(fileLocalPath, multipartFile)); |
||||
if(add){ |
||||
continue; |
||||
}else{ |
||||
throw new RuntimeException("图片保存失败"); |
||||
} |
||||
} catch (Exception e) { |
||||
throw new RuntimeException(e); |
||||
} |
||||
} |
||||
} |
||||
return paths; |
||||
} |
||||
|
||||
public static Path handleFileSave(String localPath, MultipartFile file) throws Exception { |
||||
|
||||
// 处理传来的文件
|
||||
String name = file.getOriginalFilename(); |
||||
String saveName = "file-" + sfFile.format(new Date()) + UUID.randomUUID().toString().substring(0, 4) + name.substring(name.lastIndexOf(".")); |
||||
File saveFile = new File(localPath + saveName); |
||||
file.transferTo(saveFile); |
||||
|
||||
return saveFile.toPath(); |
||||
|
||||
// 判断文件是否是图片类型
|
||||
// Path path = saveFile.toPath();
|
||||
// String type = Files.probeContentType(path);
|
||||
// if (Files.probeContentType(saveFile.toPath()) != null) {
|
||||
// return new FileSaveDTO(name, saveName, Files.probeContentType(saveFile.toPath()).startsWith("image/"));
|
||||
// } else {
|
||||
// return new FileSaveDTO(name, saveName, false);
|
||||
// }
|
||||
} |
||||
} |
||||
@ -1,19 +0,0 @@ |
||||
package com.hisense.hiatmp.server_api.service.impl; |
||||
|
||||
import com.hisense.hiatmp.server_api.mapper.OperatorMapper; |
||||
import com.hisense.hiatmp.server_api.service.OperatorService; |
||||
import com.hisense.hiatmp.model.common.Operator; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public class OperatorServiceImpl implements OperatorService { |
||||
|
||||
@Autowired |
||||
OperatorMapper operatorMapper; |
||||
|
||||
@Override |
||||
public Operator getOperatorById(String nuserid) { |
||||
return operatorMapper.getOperatorById(nuserid); |
||||
} |
||||
} |
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,79 @@ |
||||
package com.hisense.hiatmp.model.common; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import lombok.Data; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
@Data |
||||
public class HighDangerRoad implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
/** |
||||
* nid |
||||
*/ |
||||
private String nid; |
||||
|
||||
/** |
||||
* business_id |
||||
*/ |
||||
private String businessId; |
||||
|
||||
/** |
||||
* name |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* area |
||||
*/ |
||||
private String area; |
||||
|
||||
/** |
||||
* status |
||||
*/ |
||||
private String status; |
||||
|
||||
/** |
||||
* operator |
||||
*/ |
||||
private String operator; |
||||
|
||||
/** |
||||
* pc_start_time |
||||
*/ |
||||
private String pcStartTime; |
||||
|
||||
/** |
||||
* pc_end_time |
||||
*/ |
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date pcEndTime; |
||||
|
||||
/** |
||||
* pc_count |
||||
*/ |
||||
private String pcCount; |
||||
|
||||
|
||||
// 临期时间
|
||||
private Long deadline; |
||||
|
||||
// 临期状态
|
||||
private String deadlineStatus; |
||||
|
||||
private String deadlineType; |
||||
|
||||
private String address; |
||||
// 路段坐标
|
||||
private String coordinate; |
||||
|
||||
// 地址类型
|
||||
private String coordinateType; |
||||
|
||||
} |
||||
@ -1,17 +0,0 @@ |
||||
package com.hisense.hiatmp.model.common; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
@Data |
||||
public class SectionDTO implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
private String sectionName; |
||||
private String upCrossingCode; |
||||
private String downCrossingCode; |
||||
// private String description;
|
||||
|
||||
} |
||||
@ -0,0 +1,19 @@ |
||||
package com.hisense.hiatmp.model.common; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
@Data |
||||
public class SectionOrCrossAdd implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
private String businessId; |
||||
|
||||
private String address; |
||||
|
||||
private String coordinate; |
||||
|
||||
private String addType; |
||||
} |
||||
@ -0,0 +1,24 @@ |
||||
package com.hisense.hiatmp.model.common; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
@Data |
||||
public class SectionVO implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
private String sectionCode; |
||||
private String businessId; |
||||
private String roadCode; |
||||
private String sectionName; |
||||
private Float width; |
||||
private Float length; |
||||
private String area_code; |
||||
private String position; |
||||
// private String upCrossingCode;
|
||||
// private String downCrossingCode;
|
||||
// private String description;
|
||||
|
||||
} |
||||
@ -0,0 +1,87 @@ |
||||
package com.hisense.hiatmp.model.common; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @description tht_hidden_danger_road_info |
||||
* @author BEJSON |
||||
* @date 2024-07-14 |
||||
*/ |
||||
@Data |
||||
public class ThtHiddenDangerRoadInfo implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
/** |
||||
* nid |
||||
*/ |
||||
private String nid; |
||||
|
||||
/** |
||||
* business_id |
||||
*/ |
||||
private String businessId; |
||||
|
||||
/** |
||||
* big_category |
||||
*/ |
||||
private String bigCategory; |
||||
|
||||
/** |
||||
* small_category |
||||
*/ |
||||
private String smallCategory; |
||||
|
||||
/** |
||||
* hd_term |
||||
*/ |
||||
private String hdTerm; |
||||
|
||||
/** |
||||
* hd_desc |
||||
*/ |
||||
private String hdDesc; |
||||
|
||||
/** |
||||
* pc_count |
||||
*/ |
||||
private String pcCount; |
||||
|
||||
/** |
||||
* zl_unit |
||||
*/ |
||||
private String zlUnit; |
||||
|
||||
/** |
||||
* zl_measure |
||||
*/ |
||||
private String zlMeasure; |
||||
|
||||
/** |
||||
* wc_time |
||||
*/ |
||||
private Date wcTime; |
||||
|
||||
/** |
||||
* last_mod_date |
||||
*/ |
||||
private Date lastModDate; |
||||
|
||||
/** |
||||
* hd_pic |
||||
*/ |
||||
private String hdPic; |
||||
|
||||
/** |
||||
* hd_info |
||||
*/ |
||||
private String hdInfo; |
||||
|
||||
public ThtHiddenDangerRoadInfo() {} |
||||
} |
||||
@ -0,0 +1,46 @@ |
||||
package com.hisense.hiatmp.model.common; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
@Data |
||||
public class ThtHiddenDataCollectConfigExtra implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
|
||||
private String nid; |
||||
|
||||
|
||||
private String itemid; |
||||
|
||||
|
||||
private int order; |
||||
|
||||
|
||||
private String type; |
||||
|
||||
|
||||
private String name; |
||||
|
||||
|
||||
private String standar; |
||||
|
||||
|
||||
private String unit; |
||||
|
||||
|
||||
private String businessId; |
||||
|
||||
|
||||
private String scenesId; |
||||
|
||||
|
||||
private String pcCount; |
||||
|
||||
public ThtHiddenDataCollectConfigExtra() {} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue