|
@@ -59,7 +59,6 @@ public class TableInfoServiceImpl extends BaseServiceImpl<TableInfoMapper, Table
|
|
* 替换动态表中的阿里云地址
|
|
* 替换动态表中的阿里云地址
|
|
*/
|
|
*/
|
|
@Scheduled(cron = "0 0 * * * ?")
|
|
@Scheduled(cron = "0 0 * * * ?")
|
|
- @Transactional
|
|
|
|
public void aliyunUrlReplace() {
|
|
public void aliyunUrlReplace() {
|
|
System.out.println("执行阿里云地址替换-----------------------------开始");
|
|
System.out.println("执行阿里云地址替换-----------------------------开始");
|
|
|
|
|
|
@@ -71,22 +70,27 @@ public class TableInfoServiceImpl extends BaseServiceImpl<TableInfoMapper, Table
|
|
List<TableInfo> tableInfos = baseMapper.selectListByAliyunUrlState();
|
|
List<TableInfo> tableInfos = baseMapper.selectListByAliyunUrlState();
|
|
if(CollectionUtil.isNotEmpty(tableInfos)){
|
|
if(CollectionUtil.isNotEmpty(tableInfos)){
|
|
for (TableInfo tableInfo : tableInfos) {
|
|
for (TableInfo tableInfo : tableInfos) {
|
|
- //获取字段
|
|
|
|
- List<WbsFormElement> wbsFormElements = wbsFormElementMapper.selectList(new QueryWrapper<WbsFormElement>().lambda().eq(WbsFormElement::getFId, tableInfo.getId()));
|
|
|
|
|
|
|
|
- if (CollectionUtil.isNotEmpty(wbsFormElements)) {
|
|
|
|
- List<String> fields = wbsFormElements.stream().map(WbsFormElement::getEKey).collect(Collectors.toList());
|
|
|
|
- //存在字段
|
|
|
|
- List<String> countTableFields = baseMapper.countTableFields(tableInfo.getTabEnName(), fields, aliyunUrlOne);
|
|
|
|
- if (CollectionUtil.isNotEmpty(countTableFields)) {
|
|
|
|
- //替换
|
|
|
|
- baseMapper.updateALiYunUrl(tableInfo.getTabEnName(), aliyunUrlOne, correctUrl, countTableFields);
|
|
|
|
- }
|
|
|
|
- //排查第二种类型的阿里云地址
|
|
|
|
- List<String> fieldsTwo = baseMapper.countTableFields(tableInfo.getTabEnName(), fields, aliyunUrlTwo);
|
|
|
|
- if(CollectionUtil.isNotEmpty(fieldsTwo)){
|
|
|
|
- //替换
|
|
|
|
- baseMapper.updateALiYunUrl(tableInfo.getTabEnName(), aliyunUrlTwo, correctUrl, fieldsTwo);
|
|
|
|
|
|
+ //判断表是否存在
|
|
|
|
+ int exist = baseMapper.tableIsExist(tableInfo.getTabEnName());
|
|
|
|
+ if(exist > 0){
|
|
|
|
+ //获取字段
|
|
|
|
+ List<WbsFormElement> wbsFormElements = wbsFormElementMapper.selectList(new QueryWrapper<WbsFormElement>().lambda().eq(WbsFormElement::getFId, tableInfo.getId()));
|
|
|
|
+
|
|
|
|
+ if (CollectionUtil.isNotEmpty(wbsFormElements)) {
|
|
|
|
+ List<String> fields = wbsFormElements.stream().map(WbsFormElement::getEKey).collect(Collectors.toList());
|
|
|
|
+ //存在字段
|
|
|
|
+ List<String> countTableFields = baseMapper.countTableFields(tableInfo.getTabEnName(), fields, aliyunUrlOne);
|
|
|
|
+ if (CollectionUtil.isNotEmpty(countTableFields)) {
|
|
|
|
+ //替换
|
|
|
|
+ baseMapper.updateALiYunUrl(tableInfo.getTabEnName(), aliyunUrlOne, correctUrl, countTableFields);
|
|
|
|
+ }
|
|
|
|
+ //排查第二种类型的阿里云地址
|
|
|
|
+ List<String> fieldsTwo = baseMapper.countTableFields(tableInfo.getTabEnName(), fields, aliyunUrlTwo);
|
|
|
|
+ if(CollectionUtil.isNotEmpty(fieldsTwo)){
|
|
|
|
+ //替换
|
|
|
|
+ baseMapper.updateALiYunUrl(tableInfo.getTabEnName(), aliyunUrlTwo, correctUrl, fieldsTwo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|