|
|
|
|
@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.Operation; |
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
|
import jakarta.annotation.Resource; |
|
|
|
|
import jakarta.servlet.http.HttpServletRequest; |
|
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
import jakarta.validation.Valid; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
@ -21,6 +22,7 @@ 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.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
@ -31,6 +33,8 @@ import org.springblade.desk.quality.pojo.entity.IotHardness; |
|
|
|
|
import org.springblade.desk.quality.pojo.vo.IotHardnessVO; |
|
|
|
|
import org.springblade.desk.quality.service.IIotHardnessService; |
|
|
|
|
import org.springblade.desk.quality.wrapper.IotHardnessWrapper; |
|
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
|
import org.springblade.system.pojo.entity.UserInfo; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
@ -55,184 +59,228 @@ import java.util.stream.Collectors; |
|
|
|
|
public class IotHardnessController extends BladeController { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private IIotHardnessService service; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 10) |
|
|
|
|
@Operation(summary = "详情", description = "传入IotHardness Obj") |
|
|
|
|
public R<IotHardnessVO> detail(IotHardness iotHardness) { |
|
|
|
|
QueryWrapper<IotHardness> qw = Condition.getQueryWrapper(iotHardness); |
|
|
|
|
IotHardness detail = service.getOne(qw); |
|
|
|
|
IotHardnessVO detailVO = IotHardnessWrapper.build().entityVO(detail); |
|
|
|
|
service.setVOValue(detailVO); |
|
|
|
|
return R.data(detailVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] list分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 20) |
|
|
|
|
@Operation(summary = "list分页", description = "传入IotHardness Obj") |
|
|
|
|
public R<IPage<IotHardnessVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> iotHardness, |
|
|
|
|
Query query) { |
|
|
|
|
private IIotHardnessService service; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private IUserClient iUserClient; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 10) |
|
|
|
|
@Operation(summary = "详情", description = "传入IotHardness Obj") |
|
|
|
|
public R<IotHardnessVO> detail(IotHardness iotHardness) { |
|
|
|
|
QueryWrapper<IotHardness> qw = Condition.getQueryWrapper(iotHardness); |
|
|
|
|
IotHardness detail = service.getOne(qw); |
|
|
|
|
IotHardnessVO detailVO = IotHardnessWrapper.build().entityVO(detail); |
|
|
|
|
service.setVOValue(detailVO); |
|
|
|
|
return R.data(detailVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] list分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 20) |
|
|
|
|
@Operation(summary = "list分页", description = "传入IotHardness Obj") |
|
|
|
|
public R<IPage<IotHardnessVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> iotHardness, |
|
|
|
|
Query query) { |
|
|
|
|
QueryWrapper<IotHardness> qw = Condition.getQueryWrapper(iotHardness, IotHardness.class); |
|
|
|
|
IPage<IotHardness> pages = service.page(Condition.getPage(query), qw); |
|
|
|
|
IPage<IotHardnessVO> pagesVO = IotHardnessWrapper.build().pageVO(pages); |
|
|
|
|
pagesVO.getRecords() |
|
|
|
|
.stream() |
|
|
|
|
.peek(service::setVOValue) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] page分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/page") |
|
|
|
|
@ApiOperationSupport(order = 21) |
|
|
|
|
@Operation(summary = "page分页", description = "传入IotHardness Obj") |
|
|
|
|
public R<IPage<IotHardnessVO>> page(IotHardnessVO iotHardness, Query query) { |
|
|
|
|
IPage<IotHardnessVO> pagesVO = service.selectIotHardnessPage( |
|
|
|
|
Condition.getPage(query), iotHardness |
|
|
|
|
); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
IPage<IotHardness> pages = service.page(Condition.getPage(query), qw); |
|
|
|
|
IPage<IotHardnessVO> pagesVO = IotHardnessWrapper.build().pageVO(pages); |
|
|
|
|
pagesVO.getRecords() |
|
|
|
|
.stream() |
|
|
|
|
.peek(service::setVOValue) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getDataFirst") |
|
|
|
|
@ApiOperationSupport(order = 20) |
|
|
|
|
@Operation(summary = "获取硬度检测值 getData", description = "传入IotHardness Obj") |
|
|
|
|
public R<List<IotHardness>> getDataFirst(HttpServletRequest request, |
|
|
|
|
@Parameter(hidden = true) @RequestParam Map<String, Object> map) { |
|
|
|
|
// 根据ip关联查询
|
|
|
|
|
|
|
|
|
|
// todo:
|
|
|
|
|
|
|
|
|
|
// BladeUser loginUser = AuthUtil.getUser();
|
|
|
|
|
// Long userId = loginUser.getUserId();
|
|
|
|
|
// R<UserInfo> rUI = iUserClient.userInfo(userId);
|
|
|
|
|
// if (rUI.isSuccess() && rUI.getData() != null) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
QueryWrapper<IotHardness> qw = Condition.getQueryWrapper(map, IotHardness.class); |
|
|
|
|
List<IotHardness> list = service.list(qw); |
|
|
|
|
return R.data(list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/getDataRefresh") |
|
|
|
|
@ApiOperationSupport(order = 20) |
|
|
|
|
@Operation(summary = "获取硬度检测值 getData", description = "传入IotHardness Obj") |
|
|
|
|
public R<List<IotHardness>> getDataRefresh(HttpServletRequest request, |
|
|
|
|
@Parameter(hidden = true) @RequestParam Map<String, Object> map) { |
|
|
|
|
// 根据ip关联查询
|
|
|
|
|
|
|
|
|
|
// todo:
|
|
|
|
|
|
|
|
|
|
// BladeUser loginUser = AuthUtil.getUser();
|
|
|
|
|
// Long userId = loginUser.getUserId();
|
|
|
|
|
// R<UserInfo> rUI = iUserClient.userInfo(userId);
|
|
|
|
|
// if (rUI.isSuccess() && rUI.getData() != null) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
QueryWrapper<IotHardness> qw = Condition.getQueryWrapper(map, IotHardness.class); |
|
|
|
|
List<IotHardness> list = service.list(qw); |
|
|
|
|
return R.data(list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] page分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/page") |
|
|
|
|
@ApiOperationSupport(order = 21) |
|
|
|
|
@Operation(summary = "page分页", description = "传入IotHardness Obj") |
|
|
|
|
public R<IPage<IotHardnessVO>> page(IotHardnessVO iotHardness, Query query) { |
|
|
|
|
IPage<IotHardnessVO> pagesVO = service.selectIotHardnessPage( |
|
|
|
|
Condition.getPage(query), iotHardness |
|
|
|
|
); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] list下拉选择 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/listForSelect") |
|
|
|
|
@ApiOperationSupport(order = 22) |
|
|
|
|
@Operation(summary = "list下拉选择", description = "") |
|
|
|
|
@Operation(summary = "list下拉选择", description = "") |
|
|
|
|
public R<List<IotHardnessVO>> listForSelect() { |
|
|
|
|
List<IotHardness> list = service.list(); |
|
|
|
|
List<IotHardnessVO> listVO = IotHardnessWrapper.build().listVO(list); |
|
|
|
|
return R.data(listVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 新增一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 30) |
|
|
|
|
@Operation(summary = "新增一条", description = "传入IotHardness Obj") |
|
|
|
|
public R save(@Valid @RequestBody IotHardness addOne) { |
|
|
|
|
addOne.setId(null); |
|
|
|
|
return R.status(service.save(addOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
List<IotHardness> list = service.list(); |
|
|
|
|
List<IotHardnessVO> listVO = IotHardnessWrapper.build().listVO(list); |
|
|
|
|
return R.data(listVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 新增一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 30) |
|
|
|
|
@Operation(summary = "新增一条", description = "传入IotHardness Obj") |
|
|
|
|
public R save(@Valid @RequestBody IotHardness addOne) { |
|
|
|
|
addOne.setId(null); |
|
|
|
|
return R.status(service.save(addOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 新增批量 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/saveBat") |
|
|
|
|
@ApiOperationSupport(order = 31) |
|
|
|
|
@Operation(summary = "新增批量", description = "传入IotHardness List") |
|
|
|
|
public R saveBat(@Valid @RequestBody List<IotHardness> addList) { |
|
|
|
|
addList.forEach(one -> { |
|
|
|
|
one.setId(null); |
|
|
|
|
}); |
|
|
|
|
return R.status(service.saveBatch(addList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 40) |
|
|
|
|
@Operation(summary = "修改一条", description = "传入IotHardness Obj") |
|
|
|
|
public R update(@Valid @RequestBody IotHardness updateOne) { |
|
|
|
|
return R.status(service.updateById(updateOne)); |
|
|
|
|
} |
|
|
|
|
@PostMapping("/saveBat") |
|
|
|
|
@ApiOperationSupport(order = 31) |
|
|
|
|
@Operation(summary = "新增批量", description = "传入IotHardness List") |
|
|
|
|
public R saveBat(@Valid @RequestBody List<IotHardness> addList) { |
|
|
|
|
addList.forEach(one -> { |
|
|
|
|
one.setId(null); |
|
|
|
|
}); |
|
|
|
|
return R.status(service.saveBatch(addList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 40) |
|
|
|
|
@Operation(summary = "修改一条", description = "传入IotHardness Obj") |
|
|
|
|
public R update(@Valid @RequestBody IotHardness updateOne) { |
|
|
|
|
return R.status(service.updateById(updateOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 修改批量 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/updateBat") |
|
|
|
|
@ApiOperationSupport(order = 41) |
|
|
|
|
@Operation(summary = "修改批量", description = "传入IotHardness List") |
|
|
|
|
@Operation(summary = "修改批量", description = "传入IotHardness List") |
|
|
|
|
public R updateBat(@Valid @RequestBody List<IotHardness> updateList) { |
|
|
|
|
return R.status(service.updateBatchById(updateList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 新增或修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 50) |
|
|
|
|
@Operation(summary = "新增或修改一条", description = "传入IotHardness Obj") |
|
|
|
|
public R submit(@Valid @RequestBody IotHardness mergeOne) { |
|
|
|
|
return R.status(service.saveOrUpdate(mergeOne)); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 新增或修改一条 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 50) |
|
|
|
|
@Operation(summary = "新增或修改一条", description = "传入IotHardness Obj") |
|
|
|
|
public R submit(@Valid @RequestBody IotHardness mergeOne) { |
|
|
|
|
return R.status(service.saveOrUpdate(mergeOne)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 新增或修改批量 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submitBat") |
|
|
|
|
@ApiOperationSupport(order = 51) |
|
|
|
|
@Operation(summary = "新增或修改批量", description = "传入IotHardness List") |
|
|
|
|
public R submitBat(@Valid @RequestBody List<IotHardness> mergeList) { |
|
|
|
|
return R.status(service.saveOrUpdateBatch(mergeList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 逻辑删除 |
|
|
|
|
*/ |
|
|
|
|
@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))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 导出Excel |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/exportExcel") |
|
|
|
|
@ApiOperationSupport(order = 70) |
|
|
|
|
@Operation(summary = "导出Excel", description = "传入IotHardness") |
|
|
|
|
public void exportExcel(@Parameter(hidden = true) @RequestParam Map<String, Object> iotHardness, |
|
|
|
|
BladeUser bladeUser, HttpServletResponse response) { |
|
|
|
|
QueryWrapper<IotHardness> qw = Condition.getQueryWrapper(iotHardness, IotHardness.class); |
|
|
|
|
//if (!AuthUtil.isAdministrator()) {
|
|
|
|
|
// queryWrapper.lambda().eq(IotHardness::getTenantId, bladeUser.getTenantId());
|
|
|
|
|
//}
|
|
|
|
|
//queryWrapper.lambda().eq(IotHardnessEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
|
|
|
|
List<IotHardnessExcel> list = service.exportIotHardness(qw); |
|
|
|
|
ExcelUtil.export(response, "[IOT硬度]数据" + DateUtil.time(), |
|
|
|
|
"[IOT硬度]数据表", list, IotHardnessExcel.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@PostMapping("/submitBat") |
|
|
|
|
@ApiOperationSupport(order = 51) |
|
|
|
|
@Operation(summary = "新增或修改批量", description = "传入IotHardness List") |
|
|
|
|
public R submitBat(@Valid @RequestBody List<IotHardness> mergeList) { |
|
|
|
|
return R.status(service.saveOrUpdateBatch(mergeList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 逻辑删除 |
|
|
|
|
*/ |
|
|
|
|
@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))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 导出Excel |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/exportExcel") |
|
|
|
|
@ApiOperationSupport(order = 70) |
|
|
|
|
@Operation(summary = "导出Excel", description = "传入IotHardness") |
|
|
|
|
public void exportExcel(@Parameter(hidden = true) @RequestParam Map<String, Object> iotHardness, |
|
|
|
|
BladeUser bladeUser, HttpServletResponse response) { |
|
|
|
|
QueryWrapper<IotHardness> qw = Condition.getQueryWrapper(iotHardness, IotHardness.class); |
|
|
|
|
//if (!AuthUtil.isAdministrator()) {
|
|
|
|
|
// queryWrapper.lambda().eq(IotHardness::getTenantId, bladeUser.getTenantId());
|
|
|
|
|
//}
|
|
|
|
|
//queryWrapper.lambda().eq(IotHardnessEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
|
|
|
|
List<IotHardnessExcel> list = service.exportIotHardness(qw); |
|
|
|
|
ExcelUtil.export(response, "[IOT硬度]数据" + DateUtil.time(), |
|
|
|
|
"[IOT硬度]数据表", list, IotHardnessExcel.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 下载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"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 导入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<IotHardness> importList = ExcelUtil.read( |
|
|
|
|
file, 0, 1, IotHardness.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"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [IOT硬度] 导入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<IotHardness> importList = ExcelUtil.read( |
|
|
|
|
file, 0, 1, IotHardness.class |
|
|
|
|
); |
|
|
|
|
return R.status(service.saveBatch(importList)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|