浏览代码

增加支持多井曲线显示的接口

chenwen 1 年之前
父节点
当前提交
4e0be27326

+ 17 - 0
src/main/java/com/hb/proj/base/service/WellParamService.java

@@ -134,6 +134,23 @@ public class WellParamService {
 	}
 	
 	
+	/**
+	 * 查询指定井的某些参数的显示单位
+	 * @param wellIds
+	 * @param paramCodes
+	 * @return
+	 */
+	public List<WellParamPO>  loadMultiParamDisUnit(Set<String> wellIds,Set<String> paramCodes){
+		if(wellIds==null||wellIds.size()==0 || paramCodes==null || paramCodes.size()==0) {
+			return null;
+		}
+		String ids="'"+StringUtils.join(wellIds,"','")+"'";
+		String pcs="'"+StringUtils.join(paramCodes,"','")+"'";
+		String sql="select well_id,param_code,display_unit from tzl_well_param where del_if=false and well_id in ("+ids+")  and param_code in ("+pcs+")";
+		return dao.queryForList(sql,WellParamPO.class);
+	}
+	
+	
 	/**
 	 * 查询多个井的参数设置
 	 * @param wellIds

+ 30 - 0
src/main/java/com/hb/proj/data/controller/MultiSortController.java

@@ -23,6 +23,7 @@ import com.hb.proj.model.WellParamPO;
 import com.hb.proj.utils.RespVO;
 import com.hb.proj.utils.RespVOBuilder;
 import com.hb.xframework.dao.util.PageModel;
+import com.hb.xframework.util.MapUtils;
 
 import jakarta.validation.constraints.NotBlank;
 
@@ -134,5 +135,34 @@ public class MultiSortController {
 		return RespVOBuilder.ok(wpService.loadSortParamDisUnit(wids, paramCode));
 	}
 	
+	/**
+	 * 查询多井多参数的显示单位
+	 * @param wellIds
+	 * @param paramCodes
+	 * @return
+	 */
+	@RequestMapping("/loadMultiParamUnit")
+	public RespVO<Object> loadMultiParamUnit(@NotBlank(message = "缺少井站记录号") String wellIds,
+			@NotBlank(message = "缺少参数编码") String paramCodes){
+		Set<String> wids=new HashSet<>(Arrays.asList(StringUtils.split(wellIds,",")));
+		Set<String> pms=new HashSet<>(Arrays.asList(StringUtils.split(paramCodes,",")));
+		
+		List<WellParamPO>  wps=wpService.loadMultiParamDisUnit(wids, pms);
+		
+		if(wps==null||wps.size()==0) {
+			return RespVOBuilder.error("未找到数据");
+		}
+		Map<String,Map<String,Object>> rtn=new HashMap<>();
+		for(WellParamPO wp : wps) {
+			if(!rtn.containsKey(wp.getWellId())) {
+				rtn.put(wp.getWellId(),MapUtils.build(wp.getParamCode(),wp.getDisplayUnit()));
+			}
+			else {
+				rtn.get(wp.getWellId()).put(wp.getParamCode(),wp.getDisplayUnit());
+			}
+			
+		}
+		return RespVOBuilder.ok(rtn);
+	}
 	
 }