|
@@ -155,8 +155,10 @@ public class TechnologyServiceImpl extends ServiceImpl<TechnologyMapper, Technol
|
|
|
|
|
|
this.save(technologyDto);
|
|
|
List<ApplicableProducts> productList = technologyDto.getProductList();
|
|
|
- for (ApplicableProducts applicableProducts : productList) {
|
|
|
- applicableProducts.setTechnologyId(technologyDto.getId());
|
|
|
+ if (ObjectUtil.isNotEmpty(productList)) {
|
|
|
+ for (ApplicableProducts applicableProducts : productList) {
|
|
|
+ applicableProducts.setTechnologyId(technologyDto.getId());
|
|
|
+ }
|
|
|
}
|
|
|
applicableProductsService.saveBatch(productList);
|
|
|
|
|
@@ -177,7 +179,7 @@ public class TechnologyServiceImpl extends ServiceImpl<TechnologyMapper, Technol
|
|
|
processRoute = null;
|
|
|
}
|
|
|
|
|
|
- this.update(q->q.eq(Technology::getId,technologyDto.getId()).set(Technology::getProcessRoute,processRoute));
|
|
|
+ this.update(q -> q.eq(Technology::getId, technologyDto.getId()).set(Technology::getProcessRoute, processRoute));
|
|
|
}
|
|
|
|
|
|
@DSTransactional
|
|
@@ -208,19 +210,19 @@ public class TechnologyServiceImpl extends ServiceImpl<TechnologyMapper, Technol
|
|
|
processRoute = null;
|
|
|
}
|
|
|
|
|
|
- this.update(q->q.eq(Technology::getId,technologyDto.getId()).set(Technology::getProcessRoute,processRoute));
|
|
|
+ this.update(q -> q.eq(Technology::getId, technologyDto.getId()).set(Technology::getProcessRoute, processRoute));
|
|
|
}
|
|
|
|
|
|
|
|
|
* 修改工艺适用产品
|
|
|
*/
|
|
|
@Override
|
|
|
- public void editProduct(TechnologyDto dto){
|
|
|
+ public void editProduct(TechnologyDto dto) {
|
|
|
Long technologyId = dto.getId();
|
|
|
- Assert.notEmpty(technologyId,"工艺id不能为空");
|
|
|
+ Assert.notEmpty(technologyId, "工艺id不能为空");
|
|
|
List<ApplicableProducts> productList = dto.getProductList();
|
|
|
- productList.forEach(item->item.setTechnologyId(technologyId));
|
|
|
- applicableProductsService.editLinked(productList,ApplicableProducts::getTechnologyId, technologyId);
|
|
|
+ productList.forEach(item -> item.setTechnologyId(technologyId));
|
|
|
+ applicableProductsService.editLinked(productList, ApplicableProducts::getTechnologyId, technologyId);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -228,7 +230,7 @@ public class TechnologyServiceImpl extends ServiceImpl<TechnologyMapper, Technol
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<Long> recursionTechnologyProcessLine(List<TechnologyProcessLine> technologyProcessLines, List<Long> sourceProcessesIds){
|
|
|
+ private List<Long> recursionTechnologyProcessLine(List<TechnologyProcessLine> technologyProcessLines, List<Long> sourceProcessesIds) {
|
|
|
List<Long> processIds = new ArrayList<>();
|
|
|
|
|
|
List<Long> targetProcessesIds = technologyProcessLines.stream()
|
|
@@ -236,15 +238,15 @@ public class TechnologyServiceImpl extends ServiceImpl<TechnologyMapper, Technol
|
|
|
.map(TechnologyProcessLine::getTargetProcessesId)
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
- if(ObjectUtil.isNotEmpty(targetProcessesIds)){
|
|
|
+ if (ObjectUtil.isNotEmpty(targetProcessesIds)) {
|
|
|
|
|
|
List<Long> collect = targetProcessesIds.stream().filter(item -> !Objects.equals(item, 99L)).collect(Collectors.toList());
|
|
|
- if(ObjectUtil.isNotEmpty(collect)){
|
|
|
+ if (ObjectUtil.isNotEmpty(collect)) {
|
|
|
processIds.addAll(collect);
|
|
|
}
|
|
|
|
|
|
|
|
|
- processIds.addAll(recursionTechnologyProcessLine(technologyProcessLines, targetProcessesIds));
|
|
|
+ processIds.addAll(recursionTechnologyProcessLine(technologyProcessLines, targetProcessesIds));
|
|
|
|
|
|
}
|
|
|
|