liusheng
2024-10-30 f55c563e2a0b52e4569ce6b5f81632cac598f7fe
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java
@@ -9,7 +9,9 @@
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.common.SendService;
import com.smartor.domain.*;
import com.smartor.service.IServiceSubtaskService;
import com.smartor.service.IServiceTaskService;
@@ -23,6 +25,8 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;
import java.util.stream.Collectors;
@@ -49,11 +53,27 @@
    @Value("${pri_key}")
    private String pri_key;
    @Autowired
    private RSAPublicKeyExample rsaPublicKeyExample;
    @Autowired
    private SendService sendService;
    @PostMapping("/test")
    public TableDataInfo test(@RequestBody SendMagParam sendMagParam) {
        try {
            Boolean aBoolean = sendService.sendMsg(sendMagParam);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 查询语音任务列表
     */
    @ApiOperation("查询任务列表")
    @PreAuthorize("@ss.hasPermi('smartor:ServiceTask:list')")
    //@PreAuthorize("@ss.hasPermi('smartor:ServiceTask:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody ServiceTask serviceTask) {
        PageUtils.startPageByPost(serviceTask.getPageNum(), serviceTask.getPageSize());
@@ -62,9 +82,11 @@
        if (CollectionUtils.isNotEmpty(serviceTaskVOS)) {
            for (ServiceTaskVO ServiceTaskVO : serviceTaskVOS) {
                ServiceSubtask ServiceTaskcall = new ServiceSubtask();
                ServiceTaskcall.setTaskid(ServiceTaskVO.getTaskid());
                List<ServiceSubtask> ServiceTaskcalls = iServiceTaskCallService.selectServiceSubtaskList(ServiceTaskcall);
                ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
                serviceSubtaskVO.setTaskid(ServiceTaskVO.getTaskid());
                serviceSubtaskVO.setStartOutHospTime(serviceTask.getStartOutHospTime());
                serviceSubtaskVO.setEndOutHospTime(serviceTask.getEndOutHospTime());
                List<ServiceSubtask> ServiceTaskcalls = iServiceTaskCallService.selectServiceSubtaskList(serviceSubtaskVO);
                if (CollectionUtils.isNotEmpty(ServiceTaskcalls)) {
                    //已发送
                    long yfs = ServiceTaskcalls.stream().filter(serviceTaskcall1 -> serviceTaskcall1.getSendstate() != null && serviceTaskcall1.getSendstate() == 3L).collect(Collectors.toList()).stream().count();
@@ -94,7 +116,7 @@
     * 导出任务列表
     */
    @ApiOperation("导出任务列表")
    @PreAuthorize("@ss.hasPermi('smartor:ServiceTask:export')")
    //@PreAuthorize("@ss.hasPermi('smartor:ServiceTask:export')")
    @Log(title = "语音任务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ServiceTask ServiceTask) {
@@ -107,7 +129,7 @@
     * 获取任务详细信息
     */
    @ApiOperation("获取任务详细信息")
    @PreAuthorize("@ss.hasPermi('smartor:ServiceTask:query')")
    //@PreAuthorize("@ss.hasPermi('smartor:ServiceTask:query')")
    @GetMapping(value = "/{taskid}")
    public AjaxResult getInfo(@PathVariable("taskid") Long taskid) {
        return success(serviceTaskService.selectServiceTaskByTaskid(taskid));
@@ -117,7 +139,7 @@
     * 新增任务
     */
    @ApiOperation("新增任务")
    @PreAuthorize("@ss.hasPermi('smartor:ServiceTask:add')")
    //@PreAuthorize("@ss.hasPermi('smartor:ServiceTask:add')")
    @Log(title = "语音任务", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ServiceTask ServiceTask) {
@@ -128,7 +150,7 @@
     * 修改语音任务
     */
    @ApiOperation("修改任务")
    @PreAuthorize("@ss.hasPermi('smartor:ServiceTask:edit')")
    //@PreAuthorize("@ss.hasPermi('smartor:ServiceTask:edit')")
    @Log(title = "任务", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody ServiceTask ServiceTask) {
@@ -139,7 +161,7 @@
//     * 删除语音任务
//     */
//    @ApiOperation("删除任务")
//    @PreAuthorize("@ss.hasPermi('smartor:ServiceTask:remove')")
//    //@PreAuthorize("@ss.hasPermi('smartor:ServiceTask:remove')")
//    @Log(title = "语音任务", businessType = BusinessType.DELETE)
//    @GetMapping("/remove/{taskids}")
//    public AjaxResult remove(@PathVariable Long[] taskids) {
@@ -151,11 +173,15 @@
     * 删除任务(包括它对应的患者信息)
     */
    @ApiOperation("删除任务(包括它对应的患者信息)")
    @PreAuthorize("@ss.hasPermi('smartor:ServiceTask:remove')")
    //@PreAuthorize("@ss.hasPermi('smartor:ServiceTask:remove')")
    @Log(title = "语音任务", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{removeTask}")
    public AjaxResult removeTask(@PathVariable Long taskId) {
        return toAjax(serviceTaskService.deleteServiceTaskByTaskid(taskId));
    @GetMapping("/remove/{taskId}")
    public AjaxResult removeTask(@PathVariable("taskId") String taskId) {
        if (StringUtils.isEmpty(taskId)) {
            AjaxResult.error("入参不能为空");
        }
        Long tid = Long.valueOf(taskId);
        return toAjax(serviceTaskService.deleteServiceTaskByTaskid(tid));
    }
    /**
@@ -165,12 +191,19 @@
     */
    @ApiOperation("通过任务ID和患者ID获取单个人的题目信息")
    @PostMapping("/getScriptInfoByCondition")
    public TableDataInfo getScriptInfoByCondition(@RequestBody ServiceTaskScriptQues serviceTaskScriptQues) {
        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
        Long tid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceTaskScriptQues.getParam1(), pri_key));
        Long pid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceTaskScriptQues.getParam2(), pri_key));
    public AjaxResult getScriptInfoByCondition(@RequestBody ServiceTaskScriptQues serviceTaskScriptQues) {
        Long tid = null;
        Long pid = null;
        log.info("getScriptInfoByCondition入参为:{}", serviceTaskScriptQues);
        try {
            tid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceTaskScriptQues.getParam1(), pri_key));
            pid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceTaskScriptQues.getParam2(), pri_key));
        } catch (Exception e) {
            log.error("getScriptInfoByCondition报错了:{}", e.getMessage());
        }
        log.info("tid和pid的值为:{},{}", tid, pid);
        return getDataTable(serviceTaskService.getScriptInfoByCondition(tid, pid));
        return success(serviceTaskService.getScriptInfoByCondition(tid, pid, true));
    }
}