|
@@ -2,18 +2,21 @@ package org.springblade.business.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import org.apache.poi.hssf.usermodel.HSSFDataFormatter;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.springblade.business.entity.DatumPoint;
|
|
|
import org.springblade.business.mapper.DatumPointMapper;
|
|
|
import org.springblade.business.utils.ExcelUtil;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.StringPool;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
+import org.springblade.manager.feign.FormulaClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import java.io.InputStream;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -22,12 +25,46 @@ import java.util.*;
|
|
|
* @description TODO
|
|
|
*/
|
|
|
@Service
|
|
|
+@AllArgsConstructor
|
|
|
public class DatumPointService extends BaseServiceImpl<DatumPointMapper, DatumPoint> {
|
|
|
+ private final FormulaClient formulaClient;
|
|
|
+ public R<Object> site(Long contractId,Long pkId,String key) throws FileNotFoundException {
|
|
|
+ Map<String,Object> result = new HashMap<>();
|
|
|
+ if(Func.isNotEmpty(contractId)&&Func.isNotEmpty(pkId)&&Func.isNotEmpty(key)) {
|
|
|
+ /*获取定位配置信息,取第一个
|
|
|
+ * {站点名称:{key_x:xxx,key_y:xxx,key_h:xxx}}
|
|
|
+ * */
|
|
|
+ key = key.replaceAll("__[\\d_]+", "");
|
|
|
+ String keys = this.formulaClient.dPoint(pkId, key);
|
|
|
+ if (Func.isNotBlank(keys)) {
|
|
|
+ String[] ka = keys.split(StringPool.COMMA);
|
|
|
+ LambdaQueryWrapper<DatumPoint> wrapper;
|
|
|
+ if (ka.length == 1) {
|
|
|
+ wrapper = Wrappers.<DatumPoint>lambdaQuery().eq(DatumPoint::getContractId, contractId).eq(DatumPoint::getType, 0);
|
|
|
+ } else {
|
|
|
+ wrapper = Wrappers.<DatumPoint>lambdaQuery().eq(DatumPoint::getContractId, contractId).eq(DatumPoint::getType, 1);
|
|
|
+ }
|
|
|
+ List<DatumPoint> data = this.list(wrapper);
|
|
|
+ String finalKey = key;
|
|
|
+ if (Func.isNotEmpty(data)) {
|
|
|
+ if (ka.length == 1) {
|
|
|
+ data.forEach(e -> {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put(finalKey +"__"+ka[0], e.getH());
|
|
|
+ result.put(e.getName(), map);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ data.forEach(e -> {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put(finalKey+"__"+ka[0], e.getX());
|
|
|
+ map.put(finalKey+"__"+ka[1], e.getY());
|
|
|
+ result.put(e.getName(), map);
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- public R<Object> site(Long contractId,String pkId,String key){
|
|
|
- Map<String,String> result = new HashMap<>();
|
|
|
-
|
|
|
- LambdaQueryWrapper<DatumPoint> wrapper = Wrappers.<DatumPoint>lambdaQuery().eq(DatumPoint::getContractId,contractId).eq(DatumPoint::getType,1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return R.data(result);
|
|
|
}
|
|
|
|