|
|
|
|
@ -3,8 +3,10 @@ |
|
|
|
|
*/ |
|
|
|
|
package org.springblade.desk.basic.controller; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
|
@ -16,6 +18,7 @@ import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.Data; |
|
|
|
|
import lombok.EqualsAndHashCode; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.common.constant.CommonConstant; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.excel.util.ExcelUtil; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
@ -25,12 +28,14 @@ import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.desk.basic.constant.BAModuleConst; |
|
|
|
|
import org.springblade.desk.basic.constant.BaseValue; |
|
|
|
|
import org.springblade.desk.basic.excel.PlatingExcel; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.Plating; |
|
|
|
|
import org.springblade.desk.basic.pojo.vo.PlatingVO; |
|
|
|
|
import org.springblade.desk.basic.service.IPlatingService; |
|
|
|
|
import org.springblade.desk.basic.util.ExcelExtUtil; |
|
|
|
|
import org.springblade.desk.basic.wrapper.PlatingWrapper; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.ReviewDuty; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
@ -55,184 +60,199 @@ import java.util.stream.Collectors; |
|
|
|
|
public class PlatingController extends BladeController { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private IPlatingService service; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 10) |
|
|
|
|
@Operation(summary = "详情", description = "传入Plating Obj") |
|
|
|
|
public R<PlatingVO> detail(Plating plating) { |
|
|
|
|
QueryWrapper<Plating> qw = Condition.getQueryWrapper(plating); |
|
|
|
|
Plating detail = service.getOne(qw); |
|
|
|
|
PlatingVO detailVO = PlatingWrapper.build().entityVO(detail); |
|
|
|
|
service.setVOValue(detailVO); |
|
|
|
|
return R.data(detailVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] list分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 20) |
|
|
|
|
@Operation(summary = "list分页", description = "传入Plating Obj") |
|
|
|
|
public R<IPage<PlatingVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> plating, |
|
|
|
|
Query query) { |
|
|
|
|
private IPlatingService service; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 10) |
|
|
|
|
@Operation(summary = "详情", description = "传入Plating Obj") |
|
|
|
|
public R<PlatingVO> detail(Plating plating) { |
|
|
|
|
QueryWrapper<Plating> qw = Condition.getQueryWrapper(plating); |
|
|
|
|
Plating detail = service.getOne(qw); |
|
|
|
|
PlatingVO detailVO = PlatingWrapper.build().entityVO(detail); |
|
|
|
|
service.setVOValue(detailVO); |
|
|
|
|
return R.data(detailVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] list分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 20) |
|
|
|
|
@Operation(summary = "list分页", description = "传入Plating Obj") |
|
|
|
|
public R<IPage<PlatingVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> plating, |
|
|
|
|
Query query) { |
|
|
|
|
QueryWrapper<Plating> qw = Condition.getQueryWrapper(plating, Plating.class); |
|
|
|
|
IPage<Plating> pages = service.page(Condition.getPage(query), qw); |
|
|
|
|
IPage<PlatingVO> pagesVO = PlatingWrapper.build().pageVO(pages); |
|
|
|
|
pagesVO.getRecords() |
|
|
|
|
.stream() |
|
|
|
|
.peek(service::setVOValue) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] page分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/page") |
|
|
|
|
@ApiOperationSupport(order = 21) |
|
|
|
|
@Operation(summary = "page分页", description = "传入Plating Obj") |
|
|
|
|
public R<IPage<PlatingVO>> page(PlatingVO plating, Query query) { |
|
|
|
|
IPage<PlatingVO> pagesVO = service.selectPlatingPage( |
|
|
|
|
Condition.getPage(query), plating |
|
|
|
|
); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
IPage<Plating> pages = service.page(Condition.getPage(query), qw); |
|
|
|
|
IPage<PlatingVO> pagesVO = PlatingWrapper.build().pageVO(pages); |
|
|
|
|
pagesVO.getRecords() |
|
|
|
|
.stream() |
|
|
|
|
.peek(service::setVOValue) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] page分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/page") |
|
|
|
|
@ApiOperationSupport(order = 21) |
|
|
|
|
@Operation(summary = "page分页", description = "传入Plating Obj") |
|
|
|
|
public R<IPage<PlatingVO>> page(PlatingVO plating, Query query) { |
|
|
|
|
IPage<PlatingVO> pagesVO = service.selectPlatingPage( |
|
|
|
|
Condition.getPage(query), plating |
|
|
|
|
); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] list下拉选择 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/listForSelect") |
|
|
|
|
@ApiOperationSupport(order = 22) |
|
|
|
|
@Operation(summary = "list下拉选择", description = "") |
|
|
|
|
@Operation(summary = "list下拉选择", description = "") |
|
|
|
|
public R<List<PlatingVO>> listForSelect() { |
|
|
|
|
List<Plating> list = service.list(); |
|
|
|
|
List<PlatingVO> listVO = PlatingWrapper.build().listVO(list); |
|
|
|
|
return R.data(listVO); |
|
|
|
|
List<Plating> list = service.list(); |
|
|
|
|
List<PlatingVO> listVO = PlatingWrapper.build().listVO(list); |
|
|
|
|
return R.data(listVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] list下拉选择-周期性试验专用 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/listForSelectCycleTest") |
|
|
|
|
@ApiOperationSupport(order = 22) |
|
|
|
|
@Operation(summary = "list下拉选择-周期性试验专用", description = "") |
|
|
|
|
public R<List<PlatingVO>> listForSelectCycleTest() { |
|
|
|
|
LambdaQueryWrapper<Plating> qw = Wrappers.lambdaQuery(Plating.class) |
|
|
|
|
.eq(Plating::getFlagCycleTest, BaseValue.YES) |
|
|
|
|
.eq(Plating::getIsDeleted, CommonConstant.DELETE_FALSE); |
|
|
|
|
List<Plating> list = service.list(qw); |
|
|
|
|
List<PlatingVO> listVO = PlatingWrapper.build().listVO(list); |
|
|
|
|
return R.data(listVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 新增一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 30) |
|
|
|
|
@Operation(summary = "新增一条", description = "传入Plating Obj") |
|
|
|
|
public R save(@Valid @RequestBody Plating addOne) { |
|
|
|
|
addOne.setId(null); |
|
|
|
|
return R.status(service.save(addOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* [镀种] 新增一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 30) |
|
|
|
|
@Operation(summary = "新增一条", description = "传入Plating Obj") |
|
|
|
|
public R save(@Valid @RequestBody Plating addOne) { |
|
|
|
|
addOne.setId(null); |
|
|
|
|
return R.status(service.save(addOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 新增批量 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/saveBat") |
|
|
|
|
@ApiOperationSupport(order = 31) |
|
|
|
|
@Operation(summary = "新增批量", description = "传入Plating List") |
|
|
|
|
public R saveBat(@Valid @RequestBody List<Plating> addList) { |
|
|
|
|
addList.forEach(one -> { |
|
|
|
|
one.setId(null); |
|
|
|
|
}); |
|
|
|
|
return R.status(service.saveBatch(addList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 40) |
|
|
|
|
@Operation(summary = "修改一条", description = "传入Plating Obj") |
|
|
|
|
public R update(@Valid @RequestBody Plating updateOne) { |
|
|
|
|
return R.status(service.updateById(updateOne)); |
|
|
|
|
} |
|
|
|
|
@PostMapping("/saveBat") |
|
|
|
|
@ApiOperationSupport(order = 31) |
|
|
|
|
@Operation(summary = "新增批量", description = "传入Plating List") |
|
|
|
|
public R saveBat(@Valid @RequestBody List<Plating> addList) { |
|
|
|
|
addList.forEach(one -> { |
|
|
|
|
one.setId(null); |
|
|
|
|
}); |
|
|
|
|
return R.status(service.saveBatch(addList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 40) |
|
|
|
|
@Operation(summary = "修改一条", description = "传入Plating Obj") |
|
|
|
|
public R update(@Valid @RequestBody Plating updateOne) { |
|
|
|
|
return R.status(service.updateById(updateOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 修改批量 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/updateBat") |
|
|
|
|
@ApiOperationSupport(order = 41) |
|
|
|
|
@Operation(summary = "修改批量", description = "传入Plating List") |
|
|
|
|
@Operation(summary = "修改批量", description = "传入Plating List") |
|
|
|
|
public R updateBat(@Valid @RequestBody List<Plating> updateList) { |
|
|
|
|
return R.status(service.updateBatchById(updateList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 新增或修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 50) |
|
|
|
|
@Operation(summary = "新增或修改一条", description = "传入Plating Obj") |
|
|
|
|
public R submit(@Valid @RequestBody Plating mergeOne) { |
|
|
|
|
return R.status(service.saveOrUpdate(mergeOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* [镀种] 新增或修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 50) |
|
|
|
|
@Operation(summary = "新增或修改一条", description = "传入Plating Obj") |
|
|
|
|
public R submit(@Valid @RequestBody Plating mergeOne) { |
|
|
|
|
return R.status(service.saveOrUpdate(mergeOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 新增或修改批量 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submitBat") |
|
|
|
|
@ApiOperationSupport(order = 51) |
|
|
|
|
@Operation(summary = "新增或修改批量", description = "传入Plating List") |
|
|
|
|
public R submitBat(@Valid @RequestBody List<Plating> mergeList) { |
|
|
|
|
return R.status(service.saveOrUpdateBatch(mergeList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 逻辑删除 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
@ApiOperationSupport(order = 61) |
|
|
|
|
@Operation(summary = "逻辑删除", description = "传入ids") |
|
|
|
|
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(service.deleteLogic(Func.toLongList(ids))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 导出Excel |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/exportExcel") |
|
|
|
|
@ApiOperationSupport(order = 70) |
|
|
|
|
@Operation(summary = "导出Excel", description = "传入Plating") |
|
|
|
|
public void exportExcel(@Parameter(hidden = true) @RequestParam Map<String, Object> plating, |
|
|
|
|
BladeUser bladeUser, HttpServletResponse response) { |
|
|
|
|
QueryWrapper<Plating> qw = Condition.getQueryWrapper(plating, Plating.class); |
|
|
|
|
//if (!AuthUtil.isAdministrator()) {
|
|
|
|
|
// queryWrapper.lambda().eq(Plating::getTenantId, bladeUser.getTenantId());
|
|
|
|
|
//}
|
|
|
|
|
//queryWrapper.lambda().eq(PlatingEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
|
|
|
|
List<PlatingExcel> list = service.exportPlating(qw); |
|
|
|
|
ExcelUtil.export(response, "[镀种]数据" + DateUtil.time(), |
|
|
|
|
"[镀种]数据表", list, PlatingExcel.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@PostMapping("/submitBat") |
|
|
|
|
@ApiOperationSupport(order = 51) |
|
|
|
|
@Operation(summary = "新增或修改批量", description = "传入Plating List") |
|
|
|
|
public R submitBat(@Valid @RequestBody List<Plating> mergeList) { |
|
|
|
|
return R.status(service.saveOrUpdateBatch(mergeList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 逻辑删除 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
@ApiOperationSupport(order = 61) |
|
|
|
|
@Operation(summary = "逻辑删除", description = "传入ids") |
|
|
|
|
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(service.deleteLogic(Func.toLongList(ids))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 导出Excel |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/exportExcel") |
|
|
|
|
@ApiOperationSupport(order = 70) |
|
|
|
|
@Operation(summary = "导出Excel", description = "传入Plating") |
|
|
|
|
public void exportExcel(@Parameter(hidden = true) @RequestParam Map<String, Object> plating, |
|
|
|
|
BladeUser bladeUser, HttpServletResponse response) { |
|
|
|
|
QueryWrapper<Plating> qw = Condition.getQueryWrapper(plating, Plating.class); |
|
|
|
|
//if (!AuthUtil.isAdministrator()) {
|
|
|
|
|
// queryWrapper.lambda().eq(Plating::getTenantId, bladeUser.getTenantId());
|
|
|
|
|
//}
|
|
|
|
|
//queryWrapper.lambda().eq(PlatingEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
|
|
|
|
List<PlatingExcel> list = service.exportPlating(qw); |
|
|
|
|
ExcelUtil.export(response, "[镀种]数据" + DateUtil.time(), |
|
|
|
|
"[镀种]数据表", list, PlatingExcel.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 下载Excel模板 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/downloadExcelTemplate") |
|
|
|
|
@ApiOperationSupport(order = 71) |
|
|
|
|
@Operation(summary = "下载Excel模板", description = "") |
|
|
|
|
public ResponseEntity<org.springframework.core.io.Resource> downloadExcelTemplate() { |
|
|
|
|
return ExcelExtUtil.downloadXlsTemplate( |
|
|
|
|
"Excel/QA/ImportTemplate-CycleTestItem.xls", |
|
|
|
|
"导入模版-周期试验项目.xls"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 导入Excel |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/importExcel") |
|
|
|
|
@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<Plating> importList = ExcelUtil.read( |
|
|
|
|
file, 0, 1, Plating.class |
|
|
|
|
); |
|
|
|
|
return R.status(service.saveBatch(importList)); |
|
|
|
|
} |
|
|
|
|
@GetMapping("/downloadExcelTemplate") |
|
|
|
|
@ApiOperationSupport(order = 71) |
|
|
|
|
@Operation(summary = "下载Excel模板", description = "") |
|
|
|
|
public ResponseEntity<org.springframework.core.io.Resource> downloadExcelTemplate() { |
|
|
|
|
return ExcelExtUtil.downloadXlsTemplate( |
|
|
|
|
"Excel/QA/ImportTemplate-CycleTestItem.xls", |
|
|
|
|
"导入模版-周期试验项目.xls"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [镀种] 导入Excel |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/importExcel") |
|
|
|
|
@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<Plating> importList = ExcelUtil.read( |
|
|
|
|
file, 0, 1, Plating.class |
|
|
|
|
); |
|
|
|
|
return R.status(service.saveBatch(importList)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|