| | |
| | | package cc.mrbird.febs.ai.controller.productQuestion; |
| | | |
| | | import cc.mrbird.febs.ai.entity.AiProductQuestion; |
| | | import cc.mrbird.febs.ai.entity.AiProductQuestionItem; |
| | | import cc.mrbird.febs.ai.entity.AiProductQuestionJob; |
| | | import cc.mrbird.febs.ai.req.AiProductQuestionAiDto; |
| | | import cc.mrbird.febs.ai.service.AiProductQuestionService; |
| | | import cc.mrbird.febs.common.annotation.ControllerEndpoint; |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.utils.excl.ExcelSheetPO; |
| | | import cc.mrbird.febs.common.utils.excl.ExcelUtil; |
| | | import cc.mrbird.febs.common.utils.excl.ExcelVersion; |
| | | import cc.mrbird.febs.common.utils.excl.ResponseHeadUtil; |
| | | import cc.mrbird.febs.mall.dto.DeliverGoodsDto; |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.mall.entity.MallOrderItem; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("list") |
| | | public FebsResponse list(AiProductQuestion dto, QueryRequest request) { |
| | | String companyId = getCurrentUserCompanyId(); |
| | | dto.setCompanyId(companyId); |
| | | |
| | | Map<String, Object> data = getDataTable(aiProductQuestionService.listInPage(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | @GetMapping("jobList") |
| | | public FebsResponse jobList(AiProductQuestionJob dto, QueryRequest request) { |
| | | String companyId = getCurrentUserCompanyId(); |
| | | dto.setCompanyId(companyId); |
| | | |
| | | Map<String, Object> data = getDataTable(aiProductQuestionService.listJobInPage(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | |
| | | @ControllerEndpoint(operation = "新增", exceptionMessage = "操作失败") |
| | | public FebsResponse add(@RequestBody @Valid AiProductQuestion dto) { |
| | | |
| | | String companyId = getCurrentUserCompanyId(); |
| | | dto.setCompanyId(companyId); |
| | | return aiProductQuestionService.add(dto); |
| | | } |
| | | |
| | |
| | | @ControllerEndpoint(operation = "AI生成题目", exceptionMessage = "操作失败") |
| | | public FebsResponse aiAdd(@RequestBody @Valid AiProductQuestionAiDto dto) { |
| | | |
| | | return aiProductQuestionService.aiAdd(dto); |
| | | // String companyId = getCurrentUserCompanyId(); |
| | | // dto.setCompanyId(companyId); |
| | | // return aiProductQuestionService.aiAdd(dto); |
| | | String companyId = getCurrentUserCompanyId(); |
| | | dto.setCompanyId(companyId); |
| | | return aiProductQuestionService.aiAddV2(dto); |
| | | } |
| | | |
| | | @PostMapping("update") |
| | |
| | | public FebsResponse update(@RequestBody @Valid AiProductQuestion dto) { |
| | | |
| | | return aiProductQuestionService.update(dto); |
| | | } |
| | | |
| | | @PostMapping(value = "stateUpdate/{type}/{ids}") |
| | | @ControllerEndpoint(operation = "更新", exceptionMessage = "操作失败") |
| | | public FebsResponse stateUpdate(@PathVariable("ids") String ids, @PathVariable("type") Integer type) { |
| | | return aiProductQuestionService.stateUpdate(ids, type); |
| | | } |
| | | |
| | | @PostMapping(value = "productQuestionDelete/{ids}") |
| | | @ControllerEndpoint(operation = "删除", exceptionMessage = "操作失败") |
| | | public FebsResponse productQuestionDelete(@PathVariable("ids") String ids) { |
| | | return aiProductQuestionService.productQuestionDelete(ids); |
| | | } |
| | | |
| | | @GetMapping("delete/{id}") |
| | |
| | | @GetMapping(value = "/questionTree") |
| | | public FebsResponse questionTree() { |
| | | |
| | | return new FebsResponse().success().data(aiProductQuestionService.questionTree()); |
| | | |
| | | String companyId = getCurrentUserCompanyId(); |
| | | return new FebsResponse().success().data(aiProductQuestionService.questionTree(companyId)); |
| | | } |
| | | |
| | | @GetMapping("exportProductQuestion") |
| | | @ControllerEndpoint(operation = "导出", exceptionMessage = "操作失败") |
| | | public FebsResponse exportProductQuestion(AiProductQuestion dto, HttpServletResponse response) throws IOException { |
| | | aiProductQuestionService.exportProductQuestion(dto, response); |
| | | return null; |
| | | } |
| | | @PostMapping(value = "/importProductQuestion") |
| | | @ControllerEndpoint(operation = "导入", exceptionMessage = "操作失败") |
| | | public FebsResponse importDeliver(@RequestBody MultipartFile file){ |
| | | return aiProductQuestionService.importDeliver(file); |
| | | } |
| | | } |