|
|
@@ -4,18 +4,25 @@ import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
+import com.sckw.core.model.constant.NumberConstant;
|
|
|
import com.sckw.core.model.page.PageRes;
|
|
|
+import com.sckw.core.web.response.PhpResult;
|
|
|
import com.sckw.slope.detection.dao.mysql.KwsDictMapper;
|
|
|
import com.sckw.slope.detection.model.dto.HeaderData;
|
|
|
+import com.sckw.slope.detection.model.dto.SystemDict;
|
|
|
import com.sckw.slope.detection.model.vo.QueryDictTypePageReqVo;
|
|
|
+import com.sckw.slope.detection.service.api.DetectionApiService;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Base64;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author lfdc
|
|
|
@@ -26,6 +33,12 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class CommonService {
|
|
|
|
|
|
+ @Value("${OkHttpClit.url}")
|
|
|
+ String url;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ DetectionApiService detectionApiService;
|
|
|
+
|
|
|
@Autowired
|
|
|
KwsDictMapper dictMapper;
|
|
|
|
|
|
@@ -40,6 +53,15 @@ public class CommonService {
|
|
|
}
|
|
|
String message = new String(Base64.getDecoder().decode(uInfo));
|
|
|
HeaderData headerData = JSONObject.parseObject(message, HeaderData.class);
|
|
|
+ if (headerData.getMountainId().isBlank()) {
|
|
|
+ throw new BusinessException("矿山id不能为空");
|
|
|
+ }
|
|
|
+ if (headerData.getCompanyId().isBlank()) {
|
|
|
+ throw new BusinessException("企业id不能为空");
|
|
|
+ }
|
|
|
+ if (headerData.getCompanyName().isBlank()) {
|
|
|
+ throw new BusinessException("企业名称不能为空");
|
|
|
+ }
|
|
|
return headerData;
|
|
|
}
|
|
|
|
|
|
@@ -49,4 +71,19 @@ public class CommonService {
|
|
|
PageInfo<QueryDictTypePageReqVo> info = new PageInfo<>();
|
|
|
return PageRes.build(info, list);
|
|
|
}
|
|
|
+
|
|
|
+ public Map<String,SystemDict> getDictList(Map<String, Object> mapBody, Map<String, String> mapPara) {
|
|
|
+ PhpResult result = detectionApiService.toSaasGetDict(url,
|
|
|
+ "/common/getDict", mapBody
|
|
|
+ , mapPara);
|
|
|
+ Map<String, SystemDict> map = new HashMap(NumberConstant.SIXTEEN);
|
|
|
+ if (result.isStatus()) {
|
|
|
+ HashMap hashMap = JSONObject.parseObject(JSONObject.toJSONString(result.getData()), HashMap.class);
|
|
|
+ for (Object value : hashMap.values()) {
|
|
|
+ SystemDict systemDict = JSONObject.parseObject(value.toString(), SystemDict.class);
|
|
|
+ map.put(systemDict.getValue(), systemDict);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|