|
@@ -6,6 +6,7 @@ import com.alibaba.nacos.shaded.com.google.gson.JsonArray;
|
|
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
|
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
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;
|
|
@@ -198,26 +199,26 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
|
|
return new CommonPage<>(list,total,page.getCurrent(),page.getSize());
|
|
return new CommonPage<>(list,total,page.getCurrent(),page.getSize());
|
|
}
|
|
}
|
|
|
|
|
|
- public void enhanceByDevice(List<DmpProductInfo> dmpProductInfo, Map<String,Object> map){
|
|
|
|
- dmpProductInfo.stream()
|
|
|
|
- .filter(s -> map.get("productId").equals(s.getId().toString()))
|
|
|
|
- .findAny()
|
|
|
|
- .ifPresent(s -> {
|
|
|
|
- s.setDeviceCount(Integer.parseInt(map.get("count").toString()));
|
|
|
|
- s.setServiceStatusCount(Integer.parseInt(map.get("serviceCount").toString()));
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void enhanceByDeviceStatus(List<DmpProductInfo> dmpProductInfo, Map<String,Object> map){
|
|
|
|
- dmpProductInfo.stream()
|
|
|
|
- .filter(s -> map.get("productId").equals(s.getId().toString()))
|
|
|
|
- .findAny()
|
|
|
|
- .ifPresent(s -> {
|
|
|
|
- s.setDeviceStatusCount(Integer.parseInt(map.get("deviceCount").toString()));
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
|
|
+// public void enhanceByDevice(List<DmpProductInfo> dmpProductInfo, Map<String,Object> map){
|
|
|
|
+// dmpProductInfo.stream()
|
|
|
|
+// .filter(s -> map.get("productId").equals(s.getId().toString()))
|
|
|
|
+// .findAny()
|
|
|
|
+// .ifPresent(s -> {
|
|
|
|
+// s.setDeviceCount(Integer.parseInt(map.get("count").toString()));
|
|
|
|
+// s.setServiceStatusCount(Integer.parseInt(map.get("serviceCount").toString()));
|
|
|
|
+// });
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// public void enhanceByDeviceStatus(List<DmpProductInfo> dmpProductInfo, Map<String,Object> map){
|
|
|
|
+// dmpProductInfo.stream()
|
|
|
|
+// .filter(s -> map.get("productId").equals(s.getId().toString()))
|
|
|
|
+// .findAny()
|
|
|
|
+// .ifPresent(s -> {
|
|
|
|
+// s.setDeviceStatusCount(Integer.parseInt(map.get("deviceCount").toString()));
|
|
|
|
+// }
|
|
|
|
+// );
|
|
|
|
+// }
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean remove(Integer id) {
|
|
public boolean remove(Integer id) {
|
|
@@ -227,6 +228,20 @@ public class DmpProductInfoServiceImpl extends AbstractCrudService<DmpProductInf
|
|
}
|
|
}
|
|
DmpProductInfo dmpProductInfo = this.getById(id);
|
|
DmpProductInfo dmpProductInfo = this.getById(id);
|
|
Optional.ofNullable(dmpProductInfo).orElseThrow(() -> new BusinessException("产品不存在"));
|
|
Optional.ofNullable(dmpProductInfo).orElseThrow(() -> new BusinessException("产品不存在"));
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<DmpProductAttribute> queryWrapper = Wrappers.lambdaQuery();
|
|
|
|
+ queryWrapper
|
|
|
|
+ .eq(DmpProductAttribute::getProductId,id);
|
|
|
|
+ List<DmpProductAttribute> list = dmpProductAttributeService.list(queryWrapper);
|
|
|
|
+ if(CollectionUtils.isNotEmpty(list)){
|
|
|
|
+ for(int i=0;i<list.size();i++){
|
|
|
|
+ DmpProductAttribute dmpProductAttribute = new DmpProductAttribute();
|
|
|
|
+ dmpProductAttribute.setId(list.get(i).getId());
|
|
|
|
+ dmpProductAttribute.setDeleteFlag(1);
|
|
|
|
+ dmpProductAttributeService.updateById(dmpProductAttribute);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
dmpProductInfo.setDeleteFlag(1);
|
|
dmpProductInfo.setDeleteFlag(1);
|
|
return this.updateById(dmpProductInfo);
|
|
return this.updateById(dmpProductInfo);
|
|
}
|
|
}
|