| | |
| | | } else { |
| | | SemanticWord copy = new SemanticWord(); |
| | | BeanUtils.copyProperties(copy, importParam); |
| | | if (copy.getChanger() == null || copy.getChanger().isEmpty()) { |
| | | return Result.error("文案编辑不能为空!"); |
| | | } |
| | | copy.setContractId(importParam.getContractId()); |
| | | copy.setBrand(data.getBrand()); |
| | | copy.setCategoryOne(data.getCategory()); |
| | | copy.setWord(data.getSemanticQuestion()); |
| | | copy.setOutWord(data.getLeakWord()); |
| | | QueryWrapper qw = new QueryWrapper<SysUser>(); |
| | | qw.eq("realName", data.getCreator()); |
| | | Page result = (Page) sysUserService.queryPageList(req, qw, 2, 1).getResult(); |
| | | if (result.getTotal() != 1) { |
| | | return Result.error("未查询到用户:" + data.getCreator()); |
| | | } |
| | | String userId = ((SysUser)(result).getRecords().get(0)).getId(); |
| | | copy.setChanger(userId); |
| | | // QueryWrapper qw = new QueryWrapper<SysUser>(); |
| | | // qw.eq("realName", data.getCreator()); |
| | | // Page result = (Page) sysUserService.queryPageList(req, qw, 2, 1).getResult(); |
| | | // if (result.getTotal() != 1) { |
| | | // return Result.error("未查询到用户:" + data.getCreator()); |
| | | // } |
| | | // String userId = ((SysUser)(result).getRecords().get(0)).getId(); |
| | | // copy.setChanger(userId); |
| | | semanticWords.add(copy); |
| | | } |
| | | } |
| | |
| | | @RequiresPermissions("contract:contract:batchGenerateCopy") |
| | | @RequestMapping(value = "/batchGenerateCopy", method = RequestMethod.POST) |
| | | public Result<?> batchGenerateCopy(@RequestBody ContractParam cp) { |
| | | if (cp.getCsId() == null){ |
| | | cp.setCsId("2020795745607319553"); |
| | | } |
| | | if (cp.getContractId().isEmpty()) { |
| | | return Result.error("文案编号不能为空"); |
| | | } else if (cp.getFileName().isEmpty()) { |
| | |
| | | return Result.error("该合同不存在语义词"); |
| | | } else { |
| | | // 调用异步方法执行实际生成逻辑 |
| | | copywritingAsyncService.asyncBatchGenerateCopy( |
| | | cp.getContractId(), list, cp.getFileName(), cp.getYoushang(), |
| | | cp.getBenchmarkUrl(),cp.getAuditor(), cp.getAuditorName() |
| | | ); |
| | | copywritingAsyncService.asyncBatchGenerateCopy(list, cp); |
| | | // 立即返回响应,不等待生成完成 |
| | | return Result.OK("开始生成,任务已提交至后台处理"); |
| | | } |