|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.fdkk.sxz.base.impl.BaseServiceImpl;
|
|
import com.fdkk.sxz.base.impl.BaseServiceImpl;
|
|
|
|
+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.entity.custuom.CustomProductEntity;
|
|
import com.fdkk.sxz.entity.custuom.CustomProductEntity;
|
|
import com.fdkk.sxz.vo.request.RequestCustom;
|
|
import com.fdkk.sxz.vo.request.RequestCustom;
|
|
@@ -19,6 +20,7 @@ import com.fdkk.sxz.vo.response.ResponseCustomComponent;
|
|
import com.fdkk.sxz.vo.response.ResponseCustomProduct;
|
|
import com.fdkk.sxz.vo.response.ResponseCustomProduct;
|
|
import com.fdkk.sxz.vo.response.ResponseRenovationPartsDetail;
|
|
import com.fdkk.sxz.vo.response.ResponseRenovationPartsDetail;
|
|
import com.fdkk.sxz.webApi.mapper.custom.ICustomProductMapper;
|
|
import com.fdkk.sxz.webApi.mapper.custom.ICustomProductMapper;
|
|
|
|
+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.fdkk.sxz.webApi.service.custom.ICustomProductService;
|
|
import com.fdkk.sxz.webApi.service.custom.ICustomProductService;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -48,51 +50,63 @@ public class CustomProductServiceImpl extends BaseServiceImpl<ICustomProductMapp
|
|
@Autowired
|
|
@Autowired
|
|
private ICustomComponentService customComponentService;
|
|
private ICustomComponentService customComponentService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICustomComponentClassifyService componentClassifyService;
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public PageInfo<CustomProductEntity> listByPage(RequestCustomProduct param) {
|
|
public PageInfo<CustomProductEntity> listByPage(RequestCustomProduct param) {
|
|
- LambdaQueryWrapper<CustomProductEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
|
- if (ObjectUtil.isNotNull(param.getName())&&StrUtil.isNotEmpty(param.getName())){
|
|
|
|
- wrapper.like(CustomProductEntity::getName,param.getName());
|
|
|
|
|
|
+ LambdaQueryWrapper<CustomProductEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getName()) && StrUtil.isNotEmpty(param.getName())) {
|
|
|
|
+ wrapper.like(CustomProductEntity::getName, param.getName());
|
|
}
|
|
}
|
|
- if (ObjectUtil.isNotNull(param.getUserId())){
|
|
|
|
- wrapper.eq(CustomProductEntity::getUserId,param.getUserId());
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getUserId())) {
|
|
|
|
+ wrapper.eq(CustomProductEntity::getUserId, param.getUserId());
|
|
}
|
|
}
|
|
param.setOrderBy("create_time");
|
|
param.setOrderBy("create_time");
|
|
param.setSortBy("desc");
|
|
param.setSortBy("desc");
|
|
- return listByPage(param,wrapper);
|
|
|
|
|
|
+ return listByPage(param, wrapper);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<ResponseCustomProduct> findProductByParentId(RequestCustom param) {
|
|
public List<ResponseCustomProduct> findProductByParentId(RequestCustom param) {
|
|
- LambdaQueryWrapper<CustomProductEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
|
- if (ObjectUtil.isNotNull(param.getParentId())){
|
|
|
|
- wrapper.eq(CustomProductEntity::getParentId,param.getParentId());
|
|
|
|
- }
|
|
|
|
- wrapper.eq(CustomProductEntity::getIsShow,1);
|
|
|
|
- List<CustomProductEntity> list= this.list(wrapper);
|
|
|
|
- List<ResponseCustomProduct> bList = list.stream().map(a ->{
|
|
|
|
|
|
+ LambdaQueryWrapper<CustomProductEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getParentId())) {
|
|
|
|
+ wrapper.eq(CustomProductEntity::getParentId, param.getParentId());
|
|
|
|
+ }
|
|
|
|
+ wrapper.eq(CustomProductEntity::getIsShow, 1);
|
|
|
|
+ wrapper.eq(CustomProductEntity::getExamine, 1);
|
|
|
|
+ List<CustomProductEntity> list = this.list(wrapper);
|
|
|
|
+ List<ResponseCustomProduct> bList = list.stream().map(a -> {
|
|
//在此转把A转换为B
|
|
//在此转把A转换为B
|
|
ResponseCustomProduct responseCustomProduct = new ResponseCustomProduct();
|
|
ResponseCustomProduct responseCustomProduct = new ResponseCustomProduct();
|
|
BeanUtils.copyProperties(a, responseCustomProduct);
|
|
BeanUtils.copyProperties(a, responseCustomProduct);
|
|
responseCustomProduct.setType("product");
|
|
responseCustomProduct.setType("product");
|
|
//组装配件
|
|
//组装配件
|
|
- if (StrUtil.isNotEmpty(a.getComponentTypeIds())){
|
|
|
|
- List<ResponseCustomComponent> responseCustomComponents= new ArrayList<>();
|
|
|
|
- JSONArray components=JSONArray.parseArray(a.getComponentTypeIds());
|
|
|
|
|
|
+ if (StrUtil.isNotEmpty(a.getComponentTypeIds())) {
|
|
|
|
+ List<ResponseCustomComponent> responseCustomComponents = new ArrayList<>();
|
|
|
|
+ JSONArray components = JSONArray.parseArray(a.getComponentTypeIds());
|
|
//获取每个配件加入集合
|
|
//获取每个配件加入集合
|
|
- components.forEach(c->{
|
|
|
|
- Long id=Long.valueOf((String) c);
|
|
|
|
- CustomComponentEntity componentEntity= customComponentService.findById(id);
|
|
|
|
|
|
+ components.forEach(c -> {
|
|
|
|
+ Long id = Long.valueOf((String) c);
|
|
|
|
+ CustomComponentEntity componentEntity = customComponentService.findById(id);
|
|
if (ObjectUtil.isNotNull(componentEntity)) {
|
|
if (ObjectUtil.isNotNull(componentEntity)) {
|
|
ResponseCustomComponent responseCustomComponent = new ResponseCustomComponent();
|
|
ResponseCustomComponent responseCustomComponent = new ResponseCustomComponent();
|
|
BeanUtils.copyProperties(componentEntity, responseCustomComponent);
|
|
BeanUtils.copyProperties(componentEntity, responseCustomComponent);
|
|
- JSONObject origin=new JSONObject();
|
|
|
|
- origin.put("x",componentEntity.getX());
|
|
|
|
- origin.put("y",componentEntity.getY());
|
|
|
|
- origin.put("z",componentEntity.getZ());
|
|
|
|
|
|
+ JSONObject origin = new JSONObject();
|
|
|
|
+ origin.put("x", componentEntity.getX());
|
|
|
|
+ origin.put("y", componentEntity.getY());
|
|
|
|
+ origin.put("z", componentEntity.getZ());
|
|
responseCustomComponent.setOrigin(origin);
|
|
responseCustomComponent.setOrigin(origin);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (ObjectUtil.isNotNull(componentEntity.getComponentTypeId())) {
|
|
|
|
+ CustomComponentClassifyEntity componentClassifyEntity = componentClassifyService.findById(componentEntity.getComponentTypeId());
|
|
|
|
+ if (ObjectUtil.isNotNull(componentClassifyEntity)) {
|
|
|
|
+ responseCustomComponent.setComponentTypeName(componentClassifyEntity.getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
responseCustomComponents.add(responseCustomComponent);
|
|
responseCustomComponents.add(responseCustomComponent);
|
|
}
|
|
}
|
|
});
|
|
});
|