Przeglądaj źródła

表单查询同步标记--代码冲突导致代码丢失补回

LHB 1 miesiąc temu
rodzic
commit
e8bf3444ca

+ 19 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -52,6 +52,7 @@ import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.core.tool.utils.*;
@@ -73,6 +74,7 @@ import org.springblade.websocket.feign.WebSocketClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ByteArrayResource;
 import org.springframework.core.io.Resource;
+import org.springframework.dao.DataAccessException;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.http.ContentDisposition;
 import org.springframework.http.HttpHeaders;
@@ -633,7 +635,23 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 //        if(info!=null){
 //            resultTabs.forEach(tab->tab.setFileName(info.getName()));
 //        }
-
+        //同步标识
+        if (CollectionUtil.isNotEmpty(resultTabs) && SecureUtil.isAdministrator()) {
+            List<Long> collect1 = resultTabs.stream().map(WbsTreeContract::getPKeyId).collect(Collectors.toList());
+            List<Long> longs = null;
+            try {
+                longs = jdbcTemplate.queryForList("select p_key_id from m_wbs_tree_contract_extend where is_sync = 1 and is_deleted = 0 and p_key_id in (" + StringUtils.join(collect1, ",") + ")", Long.class);
+            } catch (DataAccessException e) {
+                //TODO 暂时忽略异常,避免表不存在报错
+                e.printStackTrace();
+            }
+            if (CollectionUtil.isNotEmpty(longs)) {
+                List<Long> finalLongs = longs;
+                resultTabs.forEach(f -> {
+                    f.setIsSync(finalLongs.contains(f.getPKeyId()) && f.getIsBussShow() != 2 ? 1 : 0);
+                });
+            }
+        }
         if (Optional.ofNullable(wbsTreeContract.getIsUseSort()).orElse(0) == 0) {
             //表单排序
             if (resultTabs.size() > 0) {