|
|
|
|
@ -22,6 +22,7 @@ import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.desk.basic.constant.BAModuleConst; |
|
|
|
|
@ -31,10 +32,13 @@ import org.springblade.desk.basic.pojo.vo.CoatingThicknessVO; |
|
|
|
|
import org.springblade.desk.basic.service.ICoatingThicknessService; |
|
|
|
|
import org.springblade.desk.basic.util.ExcelExtUtil; |
|
|
|
|
import org.springblade.desk.basic.wrapper.CoatingThicknessWrapper; |
|
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
@ -179,6 +183,24 @@ public class CoatingThicknessController extends BladeController { |
|
|
|
|
return R.status(service.saveOrUpdateBatch(mergeList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@PostMapping("/submitBatThickness") |
|
|
|
|
@ApiOperationSupport(order = 51) |
|
|
|
|
@Operation(summary = "批量维护厚度", description = "传入CoatingThickness List") |
|
|
|
|
public R submitBatThickness(@Valid @RequestBody CoatingThickness mergeOne) { |
|
|
|
|
|
|
|
|
|
List<Long> ids = mergeOne.getIds(); |
|
|
|
|
if(CollectionUtils.isEmpty(ids)){ |
|
|
|
|
return R.fail("数据为空"); |
|
|
|
|
} |
|
|
|
|
for(Long id : ids){ |
|
|
|
|
CoatingThickness one = service.getById(id); |
|
|
|
|
one.setThickness(mergeOne.getThickness()); |
|
|
|
|
service.updateById(one); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return R.status(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀层厚度对应] 逻辑删除 |
|
|
|
|
*/ |
|
|
|
|
@ -215,8 +237,8 @@ public class CoatingThicknessController extends BladeController { |
|
|
|
|
@Operation(summary = "下载Excel模板", description = "") |
|
|
|
|
public ResponseEntity<org.springframework.core.io.Resource> downloadExcelTemplate() { |
|
|
|
|
return ExcelExtUtil.downloadXlsTemplate( |
|
|
|
|
"Excel/QA/ImportTemplate-CycleTestItem.xls", |
|
|
|
|
"导入模版-周期试验项目.xls"); |
|
|
|
|
"Excel/QA/镀层厚度对应.xls", |
|
|
|
|
"导入模版-镀层厚度对应.xls"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -226,13 +248,25 @@ public class CoatingThicknessController extends BladeController { |
|
|
|
|
@ApiOperationSupport(order = 72) |
|
|
|
|
@Operation(summary = "导入Excel", description = "MultipartFile") |
|
|
|
|
public R importExcel(@RequestParam("file") MultipartFile file) { |
|
|
|
|
R checkR = ExcelExtUtil.importExcelCheck(file); |
|
|
|
|
if (checkR != null) { |
|
|
|
|
return checkR; |
|
|
|
|
} |
|
|
|
|
List<CoatingThickness> importList = ExcelUtil.read( |
|
|
|
|
file, 0, 1, CoatingThickness.class |
|
|
|
|
); |
|
|
|
|
return R.status(service.saveBatch(importList)); |
|
|
|
|
// R checkR = ExcelExtUtil.importExcelCheck(file);
|
|
|
|
|
// if (checkR != null) {
|
|
|
|
|
// return checkR;
|
|
|
|
|
// }
|
|
|
|
|
// List<CoatingThickness> importList = ExcelUtil.read(
|
|
|
|
|
// file, 0, 1, CoatingThickness.class
|
|
|
|
|
// );
|
|
|
|
|
// return R.status(service.saveBatch(importList));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<CoatingThickness> noticeList = new ArrayList<>(); |
|
|
|
|
List<CoatingThicknessExcel> list = ExcelUtil.read(file, CoatingThicknessExcel.class); |
|
|
|
|
list.forEach(noticeExcel -> { |
|
|
|
|
|
|
|
|
|
CoatingThickness notice = BeanUtil.copy(noticeExcel, CoatingThickness.class); |
|
|
|
|
noticeList.add(notice); |
|
|
|
|
}); |
|
|
|
|
return R.data(service.saveBatch(noticeList)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|