Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wangjiahao 2022-08-02 17:20:16 +08:00
commit 43369ea3c5
6 changed files with 34 additions and 15 deletions

View File

@ -142,7 +142,7 @@ public class ApiProvider extends Provider {
switch (apiDefinition.getMethod()) {
case "GET":
response = HttpClientUtil.get(apiDefinition.getUrl(), httpClientConfig);
response = HttpClientUtil.get(apiDefinition.getUrl().trim(), httpClientConfig);
break;
case "POST":
if (apiDefinitionRequest.getBody().get("type") == null) {
@ -318,27 +318,31 @@ public class ApiProvider extends Provider {
}
static void mergeValue(JSONObject field, ApiDefinition apiDefinition, JSONObject item) {
JSONArray array = field.getJSONArray("value");
if (array != null && item.getString("value") != null && array.size() < apiDefinition.getPreviewNum()) {
array.add(item.getJSONArray("value").get(0).toString());
field.put("value", array);
}
if(CollectionUtils.isNotEmpty(field.getJSONArray("children"))&& CollectionUtils.isNotEmpty(item.getJSONArray("children"))){
JSONArray objectChildren = field.getJSONArray("children");
JSONArray jsonArrayChildren = new JSONArray();
JSONArray fieldChildren = field.getJSONArray("children");
JSONArray itemChildren = item.getJSONArray("children");
for (Object objectChild : objectChildren) {
JSONObject jsonObject = JSONObject.parseObject(objectChild.toString());
JSONArray fieldArrayChildren = new JSONArray();
for (Object fieldChild : fieldChildren) {
JSONObject jsonObject = JSONObject.parseObject(fieldChild.toString());
JSONObject find = null;
for (Object itemChild : itemChildren) {
JSONObject itemObject = JSONObject.parseObject(itemChild.toString());
if(jsonObject.getString("jsonPath").equals(itemObject.getString("jsonPath"))){
mergeValue(jsonObject, apiDefinition, itemObject);
jsonArrayChildren.add(jsonObject);
find = itemObject;
}
}
if(find != null){
mergeValue(jsonObject, apiDefinition, find);
}
fieldArrayChildren.add(jsonObject);
}
field.put("children", jsonArrayChildren);
field.put("children", fieldArrayChildren);
}
}

View File

@ -135,6 +135,13 @@ public class DriverService {
deDriverDetails.setVersion(version);
deDriverDetails.setFileName(filename);
deDriverDetails.setDriverClass(String.join(",", jdbcList));
DeDriverDetailsExample deDriverDetailsExample = new DeDriverDetailsExample();
deDriverDetailsExample.createCriteria().andDeDriverIdEqualTo(driverId).andFileNameEqualTo(filename);
if(CollectionUtil.isNotEmpty(deDriverDetailsMapper.selectByExample(deDriverDetailsExample))){
throw new Exception("A file with the same name already exists" + filename);
}
deDriverDetailsMapper.insert(deDriverDetails);
SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.UPLOADFILE, SysLogConstants.SOURCE_TYPE.DRIVER_FILE, deDriverDetails.getId(), driverId, null, null);
DeLogUtils.save(sysLogDTO);

View File

@ -149,8 +149,13 @@ export default {
type: 'warning'
}).then(() => {
removeMap(param).then(res => {
this.$emit('refresh-tree')
this.$success(this.$t('commons.delete_success'))
this.$store.dispatch('map/setGeo', {
key: param.code,
value: null
}).then(() => {
this.$emit('refresh-tree')
this.$success(this.$t('commons.delete_success'))
})
})
}).catch(() => {
this.$info(this.$t('commons.delete_cancel'))

View File

@ -131,7 +131,7 @@ export default {
},
data() {
return {
formInline: { pCode: '' },
formInline: { pCode: '', fileName: '' },
loading: false,
rules: {
pCode: [
@ -227,7 +227,7 @@ export default {
return true
},
uploadMapFile(file) {
this.formInline.fileName = file.file.name
this.$set(this.formInline, 'fileName', file.file.name)
this.formInline.file = file.file
},
removeFile() {

View File

@ -932,7 +932,6 @@ export default {
return;
}
this.$refs.apiItem.validate((valid) => {
console.log(valid)
if (valid) {
const data = JSON.parse(JSON.stringify(this.apiItem));
this.loading = true;

View File

@ -316,7 +316,11 @@ export default {
this.form = JSON.parse(JSON.stringify(row))
this.originConfiguration = this.form.configuration
if (row.type === 'api') {
this.originConfiguration = JSON.parse(JSON.stringify(this.form.apiConfiguration))
this.originConfiguration.forEach(item => {
delete item.status
})
this.originConfiguration = JSON.stringify(this.originConfiguration)
} else {
this.form.configuration = JSON.parse(this.form.configuration)
}