|
|
|
|
@ -3,50 +3,51 @@ |
|
|
|
|
*/ |
|
|
|
|
package org.springblade.desk.basic.controller; |
|
|
|
|
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
|
import jakarta.annotation.Resource; |
|
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
import jakarta.validation.Valid; |
|
|
|
|
|
|
|
|
|
import lombok.Data; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.Data; |
|
|
|
|
import lombok.EqualsAndHashCode; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.secure.annotation.IsAdmin; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.excel.util.ExcelUtil; |
|
|
|
|
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.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import org.springblade.desk.basic.util.ExcelExtUtil; |
|
|
|
|
import org.springblade.desk.basic.constant.BAModuleConst; |
|
|
|
|
import org.springblade.desk.basic.excel.OemExcel; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.Oem; |
|
|
|
|
import org.springblade.desk.basic.pojo.vo.OemVO; |
|
|
|
|
import org.springblade.desk.basic.excel.OemExcel; |
|
|
|
|
import org.springblade.desk.basic.wrapper.OemWrapper; |
|
|
|
|
import org.springblade.desk.basic.service.IOemService; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.excel.util.ExcelUtil; |
|
|
|
|
import org.springblade.core.tool.constant.BladeConstant; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import org.springblade.desk.basic.util.ExcelExtUtil; |
|
|
|
|
import org.springblade.desk.basic.wrapper.OemWrapper; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 控制器 |
|
|
|
|
* mes v1: bs_oem_customer |
|
|
|
|
* |
|
|
|
|
* @author Tom Shuo |
|
|
|
|
* @since 2026-01-04 |
|
|
|
|
*/ |
|
|
|
|
@RestController |
|
|
|
|
@RequestMapping("/Oem") |
|
|
|
|
@RequestMapping(BAModuleConst.CONTROLLER_PREFIX + "/Oem") |
|
|
|
|
@Data |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
@EqualsAndHashCode(callSuper = true) |
|
|
|
|
@ -55,184 +56,184 @@ import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
public class OemController extends BladeController { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private IOemService service; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 10) |
|
|
|
|
@Operation(summary = "详情", description = "传入Oem Obj") |
|
|
|
|
public R<OemVO> detail(Oem oem) { |
|
|
|
|
QueryWrapper<Oem> qw = Condition.getQueryWrapper(oem); |
|
|
|
|
Oem detail = service.getOne(qw); |
|
|
|
|
OemVO detailVO = OemWrapper.build().entityVO(detail); |
|
|
|
|
service.setVOValue(detailVO); |
|
|
|
|
return R.data(detailVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] list分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 20) |
|
|
|
|
@Operation(summary = "list分页", description = "传入Oem Obj") |
|
|
|
|
public R<IPage<OemVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> oem, |
|
|
|
|
Query query) { |
|
|
|
|
private IOemService service; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 10) |
|
|
|
|
@Operation(summary = "详情", description = "传入Oem Obj") |
|
|
|
|
public R<OemVO> detail(Oem oem) { |
|
|
|
|
QueryWrapper<Oem> qw = Condition.getQueryWrapper(oem); |
|
|
|
|
Oem detail = service.getOne(qw); |
|
|
|
|
OemVO detailVO = OemWrapper.build().entityVO(detail); |
|
|
|
|
service.setVOValue(detailVO); |
|
|
|
|
return R.data(detailVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] list分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 20) |
|
|
|
|
@Operation(summary = "list分页", description = "传入Oem Obj") |
|
|
|
|
public R<IPage<OemVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> oem, |
|
|
|
|
Query query) { |
|
|
|
|
QueryWrapper<Oem> qw = Condition.getQueryWrapper(oem, Oem.class); |
|
|
|
|
IPage<Oem> pages = service.page(Condition.getPage(query), qw); |
|
|
|
|
IPage<OemVO> pagesVO = OemWrapper.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 = "传入Oem Obj") |
|
|
|
|
public R<IPage<OemVO>> page(OemVO oem, Query query) { |
|
|
|
|
IPage<OemVO> pagesVO = service.selectOemPage( |
|
|
|
|
Condition.getPage(query), oem |
|
|
|
|
); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
IPage<Oem> pages = service.page(Condition.getPage(query), qw); |
|
|
|
|
IPage<OemVO> pagesVO = OemWrapper.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 = "传入Oem Obj") |
|
|
|
|
public R<IPage<OemVO>> page(OemVO oem, Query query) { |
|
|
|
|
IPage<OemVO> pagesVO = service.selectOemPage( |
|
|
|
|
Condition.getPage(query), oem |
|
|
|
|
); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] list下拉选择 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/listForSelect") |
|
|
|
|
@ApiOperationSupport(order = 22) |
|
|
|
|
@Operation(summary = "list下拉选择", description = "") |
|
|
|
|
@Operation(summary = "list下拉选择", description = "") |
|
|
|
|
public R<List<OemVO>> listForSelect() { |
|
|
|
|
List<Oem> list = service.list(); |
|
|
|
|
List<OemVO> listVO = OemWrapper.build().listVO(list); |
|
|
|
|
return R.data(listVO); |
|
|
|
|
List<Oem> list = service.list(); |
|
|
|
|
List<OemVO> listVO = OemWrapper.build().listVO(list); |
|
|
|
|
return R.data(listVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 新增一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 30) |
|
|
|
|
@Operation(summary = "新增一条", description = "传入Oem Obj") |
|
|
|
|
public R save(@Valid @RequestBody Oem addOne) { |
|
|
|
|
addOne.setId(null); |
|
|
|
|
return R.status(service.save(addOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 新增一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 30) |
|
|
|
|
@Operation(summary = "新增一条", description = "传入Oem Obj") |
|
|
|
|
public R save(@Valid @RequestBody Oem addOne) { |
|
|
|
|
addOne.setId(null); |
|
|
|
|
return R.status(service.save(addOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 新增批量 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/saveBat") |
|
|
|
|
@ApiOperationSupport(order = 31) |
|
|
|
|
@Operation(summary = "新增批量", description = "传入Oem List") |
|
|
|
|
public R saveBat(@Valid @RequestBody List<Oem> addList) { |
|
|
|
|
addList.forEach(one -> { |
|
|
|
|
one.setId(null); |
|
|
|
|
}); |
|
|
|
|
return R.status(service.saveBatch(addList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 40) |
|
|
|
|
@Operation(summary = "修改一条", description = "传入Oem Obj") |
|
|
|
|
public R update(@Valid @RequestBody Oem updateOne) { |
|
|
|
|
return R.status(service.updateById(updateOne)); |
|
|
|
|
} |
|
|
|
|
@PostMapping("/saveBat") |
|
|
|
|
@ApiOperationSupport(order = 31) |
|
|
|
|
@Operation(summary = "新增批量", description = "传入Oem List") |
|
|
|
|
public R saveBat(@Valid @RequestBody List<Oem> addList) { |
|
|
|
|
addList.forEach(one -> { |
|
|
|
|
one.setId(null); |
|
|
|
|
}); |
|
|
|
|
return R.status(service.saveBatch(addList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 40) |
|
|
|
|
@Operation(summary = "修改一条", description = "传入Oem Obj") |
|
|
|
|
public R update(@Valid @RequestBody Oem updateOne) { |
|
|
|
|
return R.status(service.updateById(updateOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 修改批量 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/updateBat") |
|
|
|
|
@ApiOperationSupport(order = 41) |
|
|
|
|
@Operation(summary = "修改批量", description = "传入Oem List") |
|
|
|
|
@Operation(summary = "修改批量", description = "传入Oem List") |
|
|
|
|
public R updateBat(@Valid @RequestBody List<Oem> updateList) { |
|
|
|
|
return R.status(service.updateBatchById(updateList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 新增或修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 50) |
|
|
|
|
@Operation(summary = "新增或修改一条", description = "传入Oem Obj") |
|
|
|
|
public R submit(@Valid @RequestBody Oem mergeOne) { |
|
|
|
|
return R.status(service.saveOrUpdate(mergeOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 新增或修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 50) |
|
|
|
|
@Operation(summary = "新增或修改一条", description = "传入Oem Obj") |
|
|
|
|
public R submit(@Valid @RequestBody Oem mergeOne) { |
|
|
|
|
return R.status(service.saveOrUpdate(mergeOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [外协厂家] 新增或修改批量 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submitBat") |
|
|
|
|
@ApiOperationSupport(order = 51) |
|
|
|
|
@Operation(summary = "新增或修改批量", description = "传入Oem List") |
|
|
|
|
public R submitBat(@Valid @RequestBody List<Oem> 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 = "传入Oem") |
|
|
|
|
public void exportExcel(@Parameter(hidden = true) @RequestParam Map<String, Object> oem, |
|
|
|
|
BladeUser bladeUser, HttpServletResponse response) { |
|
|
|
|
QueryWrapper<Oem> qw = Condition.getQueryWrapper(oem, Oem.class); |
|
|
|
|
//if (!AuthUtil.isAdministrator()) {
|
|
|
|
|
// queryWrapper.lambda().eq(Oem::getTenantId, bladeUser.getTenantId());
|
|
|
|
|
//}
|
|
|
|
|
//queryWrapper.lambda().eq(OemEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
|
|
|
|
List<OemExcel> list = service.exportOem(qw); |
|
|
|
|
ExcelUtil.export(response, "[外协厂家]数据" + org.springblade.core.tool.utils.DateUtil.time(), |
|
|
|
|
"[外协厂家]数据表", list, OemExcel.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@PostMapping("/submitBat") |
|
|
|
|
@ApiOperationSupport(order = 51) |
|
|
|
|
@Operation(summary = "新增或修改批量", description = "传入Oem List") |
|
|
|
|
public R submitBat(@Valid @RequestBody List<Oem> 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 = "传入Oem") |
|
|
|
|
public void exportExcel(@Parameter(hidden = true) @RequestParam Map<String, Object> oem, |
|
|
|
|
BladeUser bladeUser, HttpServletResponse response) { |
|
|
|
|
QueryWrapper<Oem> qw = Condition.getQueryWrapper(oem, Oem.class); |
|
|
|
|
//if (!AuthUtil.isAdministrator()) {
|
|
|
|
|
// queryWrapper.lambda().eq(Oem::getTenantId, bladeUser.getTenantId());
|
|
|
|
|
//}
|
|
|
|
|
//queryWrapper.lambda().eq(OemEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
|
|
|
|
List<OemExcel> list = service.exportOem(qw); |
|
|
|
|
ExcelUtil.export(response, "[外协厂家]数据" + DateUtil.time(), |
|
|
|
|
"[外协厂家]数据表", list, OemExcel.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<Oem> importList = ExcelUtil.read( |
|
|
|
|
file, 0, 1, Oem.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<Oem> importList = ExcelUtil.read( |
|
|
|
|
file, 0, 1, Oem.class |
|
|
|
|
); |
|
|
|
|
return R.status(service.saveBatch(importList)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|