|
|
|
|
@ -9,9 +9,12 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
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.HttpServletResponse; |
|
|
|
|
import jakarta.validation.Valid; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.Data; |
|
|
|
|
import lombok.EqualsAndHashCode; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.excel.util.ExcelUtil; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
@ -23,7 +26,9 @@ import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.desk.quality.excel.gen.InspectionTaskGenExcel; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.InspectionTask; |
|
|
|
|
import org.springblade.desk.quality.pojo.request.InspectionTaskStart; |
|
|
|
|
import org.springblade.desk.quality.pojo.vo.gen.InspectionTaskGenVO; |
|
|
|
|
import org.springblade.desk.quality.service.InspectionTaskService; |
|
|
|
|
import org.springblade.desk.quality.service.gen.IInspectionTaskGenService; |
|
|
|
|
import org.springblade.desk.quality.wrapper.gen.InspectionTaskGenWrapper; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
@ -38,102 +43,116 @@ import java.util.Map; |
|
|
|
|
* @since 2025-11-14 |
|
|
|
|
*/ |
|
|
|
|
@RestController |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
@Data |
|
|
|
|
@EqualsAndHashCode(callSuper = true) |
|
|
|
|
@RequestMapping("/inspectionTask") |
|
|
|
|
@Tag(name = "[检验任务]", description = "[检验任务]接口") |
|
|
|
|
public class InspectionTaskController extends BladeController { |
|
|
|
|
|
|
|
|
|
private final IInspectionTaskGenService inspectionTaskGenService; |
|
|
|
|
@Resource |
|
|
|
|
private IInspectionTaskGenService inspectionTaskGenService; |
|
|
|
|
@Resource |
|
|
|
|
private InspectionTaskService service; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [检验任务] 详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@Operation(summary = "详情", description = "传入inspectionTask") |
|
|
|
|
public R<InspectionTaskGenVO> detail(InspectionTask inspectionTask) { |
|
|
|
|
InspectionTask detail = inspectionTaskGenService.getOne(Condition.getQueryWrapper(inspectionTask)); |
|
|
|
|
return R.data(InspectionTaskGenWrapper.build().entityVO(detail)); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* [检验任务] 详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@Operation(summary = "详情", description = "传入inspectionTask") |
|
|
|
|
public R<InspectionTaskGenVO> detail(InspectionTask inspectionTask) { |
|
|
|
|
InspectionTask detail = inspectionTaskGenService.getOne(Condition.getQueryWrapper(inspectionTask)); |
|
|
|
|
return R.data(InspectionTaskGenWrapper.build().entityVO(detail)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [检验任务] 分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
|
@Operation(summary = "分页", description = "传入inspectionTask") |
|
|
|
|
public R<IPage<InspectionTaskGenVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> inspectionTask, Query query) { |
|
|
|
|
IPage<InspectionTask> pages = inspectionTaskGenService.page(Condition.getPage(query), Condition.getQueryWrapper(inspectionTask, InspectionTask.class)); |
|
|
|
|
return R.data(InspectionTaskGenWrapper.build().pageVO(pages)); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* [检验任务] 分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
|
@Operation(summary = "分页", description = "传入inspectionTask") |
|
|
|
|
public R<IPage<InspectionTaskGenVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> inspectionTask, Query query) { |
|
|
|
|
IPage<InspectionTask> pages = inspectionTaskGenService.page(Condition.getPage(query), Condition.getQueryWrapper(inspectionTask, InspectionTask.class)); |
|
|
|
|
return R.data(InspectionTaskGenWrapper.build().pageVO(pages)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [检验任务] 自定义分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/page") |
|
|
|
|
@ApiOperationSupport(order = 3) |
|
|
|
|
@Operation(summary = "分页", description = "传入inspectionTask") |
|
|
|
|
public R<IPage<InspectionTaskGenVO>> page(InspectionTaskGenVO inspectionTask, Query query) { |
|
|
|
|
IPage<InspectionTaskGenVO> pages = inspectionTaskGenService.selectInspectionTaskPage(Condition.getPage(query), inspectionTask); |
|
|
|
|
return R.data(pages); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* [检验任务] 自定义分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/page") |
|
|
|
|
@ApiOperationSupport(order = 3) |
|
|
|
|
@Operation(summary = "分页", description = "传入inspectionTask") |
|
|
|
|
public R<IPage<InspectionTaskGenVO>> page(InspectionTaskGenVO inspectionTask, Query query) { |
|
|
|
|
IPage<InspectionTaskGenVO> pages = inspectionTaskGenService.selectInspectionTaskPage(Condition.getPage(query), inspectionTask); |
|
|
|
|
return R.data(pages); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [检验任务] 新增 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@Operation(summary = "新增", description = "传入inspectionTask") |
|
|
|
|
public R save(@Valid @RequestBody InspectionTask inspectionTask) { |
|
|
|
|
return R.status(inspectionTaskGenService.save(inspectionTask)); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* [检验任务] 新增 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@Operation(summary = "新增", description = "传入inspectionTask") |
|
|
|
|
public R save(@Valid @RequestBody InspectionTask inspectionTask) { |
|
|
|
|
return R.status(inspectionTaskGenService.save(inspectionTask)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [检验任务] 修改 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@Operation(summary = "修改", description = "传入inspectionTask") |
|
|
|
|
public R update(@Valid @RequestBody InspectionTask inspectionTask) { |
|
|
|
|
return R.status(inspectionTaskGenService.updateById(inspectionTask)); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* [检验任务] 修改 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@Operation(summary = "修改", description = "传入inspectionTask") |
|
|
|
|
public R update(@Valid @RequestBody InspectionTask inspectionTask) { |
|
|
|
|
return R.status(inspectionTaskGenService.updateById(inspectionTask)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [检验任务] 新增或修改 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
|
@Operation(summary = "新增或修改", description = "传入inspectionTask") |
|
|
|
|
public R submit(@Valid @RequestBody InspectionTask inspectionTask) { |
|
|
|
|
return R.status(inspectionTaskGenService.saveOrUpdate(inspectionTask)); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* [检验任务] 新增或修改 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
|
@Operation(summary = "新增或修改", description = "传入inspectionTask") |
|
|
|
|
public R submit(@Valid @RequestBody InspectionTask inspectionTask) { |
|
|
|
|
return R.status(inspectionTaskGenService.saveOrUpdate(inspectionTask)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [检验任务] 删除 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
@ApiOperationSupport(order = 7) |
|
|
|
|
@Operation(summary = "逻辑删除", description = "传入ids") |
|
|
|
|
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(inspectionTaskGenService.deleteLogic(Func.toLongList(ids))); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* [检验任务] 删除 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
@ApiOperationSupport(order = 7) |
|
|
|
|
@Operation(summary = "逻辑删除", description = "传入ids") |
|
|
|
|
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(inspectionTaskGenService.deleteLogic(Func.toLongList(ids))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 导出数据 |
|
|
|
|
*/ |
|
|
|
|
@IsAdmin |
|
|
|
|
@GetMapping("/export-inspectionTask") |
|
|
|
|
@ApiOperationSupport(order = 8) |
|
|
|
|
@Operation(summary = "导出数据", description = "传入inspectionTask") |
|
|
|
|
public void exportInspectionTask(@Parameter(hidden = true) @RequestParam Map<String, Object> inspectionTask, BladeUser bladeUser, HttpServletResponse response) { |
|
|
|
|
QueryWrapper<InspectionTask> queryWrapper = Condition.getQueryWrapper(inspectionTask, InspectionTask.class); |
|
|
|
|
//if (!AuthUtil.isAdministrator()) {
|
|
|
|
|
// queryWrapper.lambda().eq(InspectionTask::getTenantId, bladeUser.getTenantId());
|
|
|
|
|
//}
|
|
|
|
|
//queryWrapper.lambda().eq(InspectionTaskEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
|
|
|
|
List<InspectionTaskGenExcel> list = inspectionTaskGenService.exportInspectionTask(queryWrapper); |
|
|
|
|
ExcelUtil.export(response, "[检验任务]数据" + DateUtil.time(), "[检验任务]数据表", list, InspectionTaskGenExcel.class); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 导出数据 |
|
|
|
|
*/ |
|
|
|
|
@IsAdmin |
|
|
|
|
@GetMapping("/export-inspectionTask") |
|
|
|
|
@ApiOperationSupport(order = 8) |
|
|
|
|
@Operation(summary = "导出数据", description = "传入inspectionTask") |
|
|
|
|
public void exportInspectionTask(@Parameter(hidden = true) @RequestParam Map<String, Object> inspectionTask, BladeUser bladeUser, HttpServletResponse response) { |
|
|
|
|
QueryWrapper<InspectionTask> queryWrapper = Condition.getQueryWrapper(inspectionTask, InspectionTask.class); |
|
|
|
|
//if (!AuthUtil.isAdministrator()) {
|
|
|
|
|
// queryWrapper.lambda().eq(InspectionTask::getTenantId, bladeUser.getTenantId());
|
|
|
|
|
//}
|
|
|
|
|
//queryWrapper.lambda().eq(InspectionTaskEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
|
|
|
|
List<InspectionTaskGenExcel> list = inspectionTaskGenService.exportInspectionTask(queryWrapper); |
|
|
|
|
ExcelUtil.export(response, "[检验任务]数据" + DateUtil.time(), "[检验任务]数据表", list, InspectionTaskGenExcel.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* todo:调用时机待定。 |
|
|
|
|
* 工序开始,新增[检验任务] |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/start") |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@Operation(summary = "", description = "传入inspectionTask") |
|
|
|
|
public R save(@Valid @RequestBody InspectionTaskStart start) { |
|
|
|
|
return service.start(start); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|