|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
package org.springblade.desk.oem.controller; |
|
|
|
|
|
|
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
|
@ -23,7 +24,6 @@ import org.springblade.desk.oem.service.IOemStandardProcessService; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.core.io.Resource; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
@ -73,7 +73,7 @@ public class OemStandardProcessController { |
|
|
|
|
wrapper.ne(OemStandardProcessEntity::getId, oemStandardProcessEntity.getId()); |
|
|
|
|
} |
|
|
|
|
List<OemStandardProcessEntity> list = oemStandardProcessService.list(wrapper); |
|
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
|
return R.fail("数据已存在"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -91,6 +91,7 @@ public class OemStandardProcessController { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 外协标准工序代码 下载模板 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/download-excel-template") |
|
|
|
|
@ -101,6 +102,7 @@ public class OemStandardProcessController { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 外协标准工序代码 导入Excel |
|
|
|
|
* |
|
|
|
|
* @param file |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@ -120,10 +122,10 @@ public class OemStandardProcessController { |
|
|
|
|
if (StringUtils.isEmpty(row.getProcessName())) { |
|
|
|
|
return R.fail(rowNum + "行工序未填写"); |
|
|
|
|
} |
|
|
|
|
if(StringUtils.isEmpty(row.getStandardProcessCode())){ |
|
|
|
|
if (StringUtils.isEmpty(row.getStandardProcessCode())) { |
|
|
|
|
return R.fail(rowNum + "行标准工序代码未填写"); |
|
|
|
|
} |
|
|
|
|
String uniqueStr = StringUtils.joinWith("|", row.getProcessName(), row.getPlate(), row.getPlateThickness(), row.getPartName()); |
|
|
|
|
String uniqueStr = StringUtils.joinWith("|", String.valueOf(row.getProcessName()), String.valueOf(row.getPlate()), String.valueOf(row.getPlateThickness()), String.valueOf(row.getPartName())); |
|
|
|
|
if (!uniqueSet.add(uniqueStr)) { |
|
|
|
|
return R.fail(rowNum + "行在Excel中重复"); |
|
|
|
|
} |
|
|
|
|
@ -131,8 +133,25 @@ public class OemStandardProcessController { |
|
|
|
|
if (processSet == null) { |
|
|
|
|
return R.fail(rowNum + "行错误,系统无此工序"); |
|
|
|
|
} |
|
|
|
|
OemStandardProcessEntity exist = oemStandardProcessService.getOne(new LambdaQueryWrapper<OemStandardProcessEntity>().eq(OemStandardProcessEntity::getProcessId, processSet.getId()).eq(OemStandardProcessEntity::getPlate, row.getPlate()).eq(OemStandardProcessEntity::getPlateThickness, row.getPlateThickness()).eq(OemStandardProcessEntity::getPartName, row.getPartName())); |
|
|
|
|
if (exist != null) { |
|
|
|
|
LambdaQueryWrapper<OemStandardProcessEntity> qw = new LambdaQueryWrapper<>(); |
|
|
|
|
qw.eq(OemStandardProcessEntity::getProcessId, processSet.getId()); |
|
|
|
|
if (StringUtils.isEmpty(row.getPlate())) { |
|
|
|
|
qw.isNull(OemStandardProcessEntity::getPlate); |
|
|
|
|
} else { |
|
|
|
|
qw.eq(OemStandardProcessEntity::getPlate, row.getPlate()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isEmpty(row.getPlateThickness())) { |
|
|
|
|
qw.isNull(OemStandardProcessEntity::getPlateThickness); |
|
|
|
|
} else { |
|
|
|
|
qw.eq(OemStandardProcessEntity::getPlateThickness, row.getPlateThickness()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isEmpty(row.getPartName())) { |
|
|
|
|
qw.isNull(OemStandardProcessEntity::getPartName); |
|
|
|
|
} else { |
|
|
|
|
qw.eq(OemStandardProcessEntity::getPartName, row.getPartName()); |
|
|
|
|
} |
|
|
|
|
List<OemStandardProcessEntity> exist = oemStandardProcessService.list(qw); |
|
|
|
|
if (CollectionUtils.isNotEmpty(exist)) { |
|
|
|
|
return R.fail(rowNum + "行错误,数据已存在"); |
|
|
|
|
} |
|
|
|
|
OemStandardProcessEntity entity = new OemStandardProcessEntity(); |
|
|
|
|
|