| | |
| | | import org.jeecg.modules.demo.copywriting.controller.CopywritingAsyncService; |
| | | import org.jeecg.modules.demo.copywriting.entity.Copywriting; |
| | | import org.jeecg.modules.demo.copywriting.service.ICopywritingService; |
| | | import org.jeecg.modules.demo.mediaList.entity.MediaList; |
| | | import org.jeecg.modules.demo.mediaList.service.IMediaListService; |
| | | import org.jeecg.modules.listener.ExcelDataListener; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | |
| | | public static String getCurrentTimeStr() { |
| | | return LocalDateTime.now().format(DEFAULT_FORMATTER); |
| | | } |
| | | @Autowired |
| | | private IMediaListService mediaListService; |
| | | |
| | | @RequiresPermissions("contract:contract:batchPublish") |
| | | @PostMapping("/batchPublish") |
| | | public Result<String> batchPublish(@RequestParam("contractId") String contractId) { |
| | | public Result<String> batchPublish( |
| | | @RequestParam("contractId") String contractId, |
| | | @RequestParam String[] mediaList) { |
| | | if (contractId.isEmpty()) { |
| | | return Result.error("合同编号不能为空!"); |
| | | } |
| | | String[] arr = new String[]{"14457","28879","20838"}; |
| | | String[] arr; |
| | | if (mediaList == null || mediaList.length == 0) { |
| | | arr = new String[]{"14457","28879","20838"}; |
| | | } else { |
| | | arr = mediaList; |
| | | for (String a : arr) { |
| | | QueryWrapper<MediaList> queryWrapper = new QueryWrapper<MediaList>(); |
| | | queryWrapper.eq("title", a); |
| | | List<MediaList> list = mediaListService.list(queryWrapper); |
| | | if (list.isEmpty()) { |
| | | return Result.error("未找到媒体:" + a); |
| | | } else { |
| | | a = list.get(0).getResourceId(); |
| | | } |
| | | } |
| | | } |
| | | QueryWrapper<Copywriting> wrapper = new QueryWrapper<>(); |
| | | // 手动拼接 LEFT JOIN 和筛选条件 |
| | | wrapper.select("copywriting.*") |
| | |
| | | return Result.error("该合同不存在状态为审核可发稿的文案"); |
| | | } |
| | | for (Copywriting copywriting : copywritingList) { |
| | | kong.unirest.HttpResponse<String> response = Unirest.post("http://8.138.187.158:8082/api/media/send") |
| | | kong.unirest.HttpResponse<String> response = Unirest.post("http://8.138.187.158:80822/api/media/send") |
| | | .field("api_key", "sk_4c8f6a970de896e232909e2959254441") |
| | | .field("resource_id", getRandomElementFromArray(arr)) |
| | | .field("title", copywriting.getTitle()) |