|
@@ -1,20 +1,53 @@
|
|
|
package com.fdkankan.site.config;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.fdkankan.site.entity.ProjectBim;
|
|
|
+import com.fdkankan.site.httpClient.bim.BimFaceVO;
|
|
|
+import com.fdkankan.site.httpClient.bim.BusinessStatus;
|
|
|
+import com.fdkankan.site.httpClient.client.BimClient;
|
|
|
import com.fdkankan.site.service.IProjectBimService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Component
|
|
|
+@Slf4j
|
|
|
public class InitBimConfig {
|
|
|
|
|
|
@Autowired
|
|
|
IProjectBimService projectBimService;
|
|
|
+ @Resource
|
|
|
+ BimClient bimClient;
|
|
|
|
|
|
@PostConstruct
|
|
|
public void initBim(){
|
|
|
-
|
|
|
+ LambdaQueryWrapper<ProjectBim> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(ProjectBim::getBimStatus, BusinessStatus.UPLOAD.getInfo());
|
|
|
+ List<ProjectBim> list = projectBimService.list(wrapper);
|
|
|
+ log.info("-----------项目启动初始化数据中中上传中的BIM数量:{}----------",list.size());
|
|
|
+ for (ProjectBim bim : list) {
|
|
|
+ JSONObject jsonObject = bimClient.fileInfoById(bim.getBimServiceId());
|
|
|
+ if(jsonObject.getInteger("code") !=200){
|
|
|
+ bim.setBimStatus("ERROR");
|
|
|
+ }else {
|
|
|
+ BimFaceVO faceVO = JSONObject.parseObject(jsonObject.getString("data"),BimFaceVO.class);
|
|
|
+ if(StringUtils.isNotBlank(faceVO.getCallType())){
|
|
|
+ bim.setBimStatus(faceVO.getCallType());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(faceVO.getOssUrl())){
|
|
|
+ bim.setBimOssFilePath(faceVO.getOssUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bim.setUpdateTime(null);
|
|
|
+ projectBimService.updateById(bim);
|
|
|
+ log.info("------初始化BIM---{}",bim);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|