|
@@ -14,7 +14,7 @@ import com.fdkk.sxz.entity.ComponentModelUploadEntity;
|
|
import com.fdkk.sxz.entity.custuom.CustomComponentClassifyEntity;
|
|
import com.fdkk.sxz.entity.custuom.CustomComponentClassifyEntity;
|
|
import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
|
|
import com.fdkk.sxz.entity.custuom.CustomComponentEntity;
|
|
import com.fdkk.sxz.exception.BusinessException;
|
|
import com.fdkk.sxz.exception.BusinessException;
|
|
-import com.fdkk.sxz.util.OkHttpUtils;
|
|
|
|
|
|
+import com.fdkk.sxz.other.mq.TopicRabbitConfig;
|
|
import com.fdkk.sxz.util.SnowFlakeUUidUtils;
|
|
import com.fdkk.sxz.util.SnowFlakeUUidUtils;
|
|
import com.fdkk.sxz.util.UploadToOssUtil;
|
|
import com.fdkk.sxz.util.UploadToOssUtil;
|
|
import com.fdkk.sxz.vo.request.RequestCustom;
|
|
import com.fdkk.sxz.vo.request.RequestCustom;
|
|
@@ -28,6 +28,7 @@ import com.fdkk.sxz.webApi.service.custom.ICustomComponentClassifyService;
|
|
import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
|
|
import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
@@ -36,7 +37,6 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
-import java.util.Date;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -65,6 +65,9 @@ public class CustomComponentServiceImpl extends BaseServiceImpl<ICustomComponent
|
|
@Value("${build.url}")
|
|
@Value("${build.url}")
|
|
private String buildUrl;
|
|
private String buildUrl;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private RabbitTemplate rabbitTemplate; //使用RabbitTemplate,这提供了接收/发送等等方
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public PageInfo<CustomComponentEntity> listByPage(RequestCustomComponent param) {
|
|
public PageInfo<CustomComponentEntity> listByPage(RequestCustomComponent param) {
|
|
LambdaQueryWrapper<CustomComponentEntity> wrapper = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<CustomComponentEntity> wrapper = Wrappers.lambdaQuery();
|
|
@@ -74,7 +77,15 @@ public class CustomComponentServiceImpl extends BaseServiceImpl<ICustomComponent
|
|
if (ObjectUtil.isNotNull(param.getUserId())) {
|
|
if (ObjectUtil.isNotNull(param.getUserId())) {
|
|
wrapper.eq(CustomComponentEntity::getUserId, param.getUserId());
|
|
wrapper.eq(CustomComponentEntity::getUserId, param.getUserId());
|
|
}
|
|
}
|
|
- param.setOrderBy("create_time");
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getUserId())) {
|
|
|
|
+ wrapper.eq(CustomComponentEntity::getUserId, param.getUserId());
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getPartsId())) {
|
|
|
|
+ wrapper.eq(CustomComponentEntity::getComponentTypeId, param.getPartsId());
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getIsShow())) {
|
|
|
|
+ wrapper.eq(CustomComponentEntity::getIsShow, param.getIsShow());
|
|
|
|
+ }
|
|
param.setSortBy("desc");
|
|
param.setSortBy("desc");
|
|
return super.listByPage(param, wrapper);
|
|
return super.listByPage(param, wrapper);
|
|
}
|
|
}
|
|
@@ -127,8 +138,6 @@ public class CustomComponentServiceImpl extends BaseServiceImpl<ICustomComponent
|
|
public Result updatePartsDetailExamine(RequestRenovationPartsDetailManager param) throws IOException {
|
|
public Result updatePartsDetailExamine(RequestRenovationPartsDetailManager param) throws IOException {
|
|
CustomComponentEntity componentEntity = findById(param.getId());
|
|
CustomComponentEntity componentEntity = findById(param.getId());
|
|
if (ObjectUtil.isNotNull(componentEntity)) {
|
|
if (ObjectUtil.isNotNull(componentEntity)) {
|
|
- componentEntity.setExamine(param.getExamine());
|
|
|
|
- componentEntity.setExamineTime(new Date());
|
|
|
|
ComponentModelUploadEntity modelUploadEntity = componentModelUploadService.findByPartsDetailId(componentEntity.getId());
|
|
ComponentModelUploadEntity modelUploadEntity = componentModelUploadService.findByPartsDetailId(componentEntity.getId());
|
|
if (ObjectUtil.isNotNull(modelUploadEntity)) {
|
|
if (ObjectUtil.isNotNull(modelUploadEntity)) {
|
|
//入库前先提交模型到模型库,失败返回提示
|
|
//入库前先提交模型到模型库,失败返回提示
|
|
@@ -147,14 +156,9 @@ public class CustomComponentServiceImpl extends BaseServiceImpl<ICustomComponent
|
|
version + "/SyncData.json");
|
|
version + "/SyncData.json");
|
|
CustomComponentServiceImpl.log.info("上传完成SyncData.jsn:" + version);
|
|
CustomComponentServiceImpl.log.info("上传完成SyncData.jsn:" + version);
|
|
jsonObject.put("version", version);
|
|
jsonObject.put("version", version);
|
|
- synchronized (componentEntity.getId()) {
|
|
|
|
- String resultData = OkHttpUtils.httpPostJson(buildUrl + "syncmodel", jsonObject.toJSONString());
|
|
|
|
- JSONObject resultJson = JSONObject.parseObject(resultData);
|
|
|
|
- if ("error".equals(resultJson.getString("state"))) {
|
|
|
|
- CustomComponentServiceImpl.log.info("更新模型库,syncmodel接口失败:" + resultData);
|
|
|
|
- throw new BusinessException("更新模型库,syncmodel接口失败:" + resultData);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ String message = param.getId() + ":;" + "3" + ":;" + jsonObject.toString();
|
|
|
|
+ rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.SYNCMODEL, message);
|
|
|
|
+
|
|
}
|
|
}
|
|
return Result.success(updateById(componentEntity));
|
|
return Result.success(updateById(componentEntity));
|
|
}
|
|
}
|