ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/HeLibraryController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
smartor/src/main/java/com/smartor/domain/HtmlContentVO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
smartor/src/main/java/com/smartor/service/impl/CommonTaskServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
@@ -21,6 +21,7 @@ import com.ruoyi.common.enums.PhotoEnum; import com.ruoyi.common.enums.RadioEnum; import com.ruoyi.common.enums.VadioEnum; import com.smartor.domain.HtmlContentVO; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.converter.PicturesManager; import org.apache.poi.hwpf.converter.WordToHtmlConverter; @@ -32,10 +33,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.Constants; @@ -224,6 +222,26 @@ } } /** * @param HtmlContentVO * @return */ @GetMapping("/common/htmlContent") public AjaxResult htmlContent(@RequestBody HtmlContentVO htmlContentVO) { // è·åæä»¶çåå§åç§° String fileName = htmlContentVO.getFileName(); // å°æä»¶ä¿åå°æå®ç®å½ File outputFile = new File(RuoYiConfig.getUploadPath() + "/show/" + fileName.split("\\.", 2)[0] + fileName); try (BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile))) { writer.write(htmlContentVO.getContent()); } catch (IOException e) { e.printStackTrace(); } return AjaxResult.success(); } public static void convertDocToHtml(String docFilePath, String outputHtmlFilePath) throws TransformerException, IOException, ParserConfigurationException { InputStream inputStream = new FileInputStream(docFilePath); ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/HeLibraryController.java
@@ -1,32 +1,24 @@ package com.ruoyi.web.controller.smartor; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.utils.poi.ExcelUtil; import com.smartor.domain.HeLibrary; import com.smartor.domain.HeLibraryVO; import com.smartor.domain.IvrLibaTemplateVO; import com.smartor.service.IHeLibraryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.ObjectUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 宣æèµæåºController smartor/src/main/java/com/smartor/domain/HtmlContentVO.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,31 @@ package com.smartor.domain; import com.ruoyi.common.core.domain.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * 宣æå类对象 he_category * * @author smartor * @date 2023-03-04 */ @Data @ApiModel(value = "HtmlContentVO", description = "坿æ¬å 容") public class HtmlContentVO extends BaseEntity { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "å 容") private String content; @ApiModelProperty(value = "æä»¶å") private String fileName; } smartor/src/main/java/com/smartor/service/impl/CommonTaskServiceImpl.java
@@ -54,7 +54,7 @@ return wjSend(sendTaskVO); } else if (sendTaskVO.getTaskType() == 3) { //宣æ xjSend(sendTaskVO); } return null; } @@ -202,6 +202,78 @@ return 1; } public int xjSend(SendTaskVO sendTaskVO) { ServiceTask serviceTask1 = iServiceTaskService.selectServiceTaskByTaskid(sendTaskVO.getTaskId()); if (sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 3 || sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 4) { //任塿åæç»æ¢ ServiceTask serviceTask = new ServiceTask(); serviceTask.setTaskid(sendTaskVO.getTaskId()); serviceTask.setStopState(serviceTask1.getStopState() + 1); serviceTask.setSendState(sendTaskVO.getSendState()); iServiceTaskService.updateServiceTask(serviceTask); return 0; } //夿åéç¶ææ¯å¦ä¸ºç©º if (StringUtils.isEmpty(sendTaskVO.getSendType())) { sendTaskVO.setSendType(serviceTask1.getSendType().toString()); } //夿任塿¯å¦æ¯ç«å³åé if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("2")) { String content = sendMQContent(sendTaskVO, serviceTask1.getTemplateid().toString(), serviceTask1.getPreachform(), serviceTask1.getStopState(), null); //ç«å³åé redisCache.setCacheObject(content, content, 1, TimeUnit.SECONDS); //å°ä»»å¡ç¶æä¿®æ¹ææ§è¡ä¸ ServiceTask serviceTask = new ServiceTask(); serviceTask.setTaskid(serviceTask1.getTaskid()); serviceTask.setSendState(2); iServiceTaskService.updateServiceTask(serviceTask); } else if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("1") || StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("3")) { //æ¶é´æ®µåé ObjectMapper objectMapper = new ObjectMapper(); if (StringUtils.isNotEmpty(serviceTask1.getSendTimeSlot())) { List<TaskSendTimeVO> taskSendTimeVOList = null; try { taskSendTimeVOList = objectMapper.readValue(serviceTask1.getSendTimeSlot(), new TypeReference<List<TaskSendTimeVO>>() { }); } catch (JsonProcessingException e) { log.error("JsonProcessingExceptionæ¥éäºï¼{}", e.getMessage()); } for (TaskSendTimeVO taskSendTimeVO : taskSendTimeVOList) { //å»SendTimeslotä¸ï¼è·åææçæ¶é´æ®µ List<TaskSendTimeVO> list = new ArrayList<>(); list.add(taskSendTimeVO); //è·åå¼å§åéæ¶é´ String begantime = taskSendTimeVO.getBegantime(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //è®°å½ç®åå°åéæ¶é´ç毫ç§å¼ ï¼åéæ¶é´ç毫ç§å¼ - å½åæ¶é´ç毫ç§å¼ï¼ Long milliseconds = 1000L; try { Date date = sdf.parse(begantime); milliseconds = date.getTime() - System.currentTimeMillis(); System.out.println("æ¥ææ¯«ç§æ°ï¼" + milliseconds); } catch (Exception e) { e.printStackTrace(); } SendTaskVO sendTaskVO1 = DtoConversionUtils.sourceToTarget(sendTaskVO, SendTaskVO.class); sendTaskVO1.setSendType("1"); String content = sendMQContent(sendTaskVO1, serviceTask1.getTemplateid().toString(), serviceTask1.getPreachform(), serviceTask1.getStopState(), list); redisCache.setCacheObject(content, content, milliseconds / 1000, TimeUnit.SECONDS); } //å°ä»»å¡ç¶æä¿®æ¹ææ§è¡ä¸ ServiceTask serviceTask = new ServiceTask(); serviceTask.setTaskid(serviceTask1.getTaskid()); serviceTask.setSendState(2); iServiceTaskService.updateServiceTask(serviceTask); } } return 1; } /** * MQä»»å¡å建å 容 *