liusheng
2024-05-28 500130efe30180fe635ba4482e097e848d37c7e3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package com.ruoyi.web.controller.smartor;
 
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.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.IvrTaskSingle;
import com.smartor.domain.IvrTaskSingleVO;
import com.smartor.domain.PhoneCallBackVO;
import com.smartor.domain.SendTaskVO;
import com.smartor.domain.robot.back.RobotAIDialogBack;
import com.smartor.domain.robot.back.RobotCallBack;
import com.smartor.service.IIvrTaskSingleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * 单一任务(随访)Controller
 *
 * @author ruoyi
 * @date 2024-02-02
 */
@Slf4j
@Api(description = "单一任务(随访宣教)")
@RestController
@RequestMapping("/smartor/tasksingle")
public class IvrTaskSingleController extends BaseController {
    @Autowired
    private IIvrTaskSingleService ivrTaskcallService;
 
    /**
     * 查询患者随访信息
     */
    @ApiOperation("查询患者随访信息")
    @PreAuthorize("@ss.hasPermi('system:taskcall:list')")
    @PostMapping("/patItem")
    public TableDataInfo patItem(@RequestBody IvrTaskSingle ivrTaskcall) {
        PageUtils.startPageByPost(ivrTaskcall.getPageNum(), ivrTaskcall.getPageSize());
        return getDataTable(ivrTaskcallService.patItem(ivrTaskcall));
    }
 
    /**
     * 导出单一任务(随访宣教)列表
     */
    @PreAuthorize("@ss.hasPermi('system:taskcall:export')")
    @Log(title = "单一任务(随访宣教)", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, IvrTaskSingle ivrTaskcall) {
        List<IvrTaskSingle> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall);
        ExcelUtil<IvrTaskSingle> util = new ExcelUtil<IvrTaskSingle>(IvrTaskSingle.class);
        util.exportExcel(response, list, "单一任务(随访)数据");
    }
 
    /**
     * 获取单一任务(随访)详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:taskcall:query')")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(ivrTaskcallService.selectIvrTaskcallById(id));
    }
 
    /**
     * 新增或修改删除单一任务
     */
    @ApiOperation("新增或修改删除单一任务")
    @PreAuthorize("@ss.hasPermi('system:task:add')")
    @Log(title = "单一任务(随访)", businessType = BusinessType.INSERT)
    @PostMapping("/insertOrUpdateTask")
    public AjaxResult insertOrUpdateHeTask(@RequestBody IvrTaskSingleVO ivrTaskcallVO) {
 
        LoginUser loginUser = getLoginUser();
        SysUser user = loginUser.getUser();
        ivrTaskcallVO.setCreateBy(user.getNickName());
        return toAjax(ivrTaskcallService.insertOrUpdateTask(ivrTaskcallVO));
    }
 
    /**
     * 根据条件查询任务信息
     */
    @ApiOperation("根据条件查询任务信息")
    @PostMapping("/queryTaskByCondition")
    public AjaxResult queryTaskByCondition(@RequestBody IvrTaskSingleVO ivrTaskcallVO) {
        //根据入参查询信息
        IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskSingle.class);
        IvrTaskSingleVO ivrTaskSingleVO = ivrTaskcallService.queryTaskByCondition(ivrTaskcall);
        return success(ivrTaskSingleVO);
    }
 
    /**
     * 任务的发送执行、暂停、终止
     */
    @ApiOperation("任务的发送执行、暂停、终止")
    @PostMapping("/taskSend")
    public AjaxResult heTaskSend(@RequestBody SendTaskVO sendTaskVO) {
        return toAjax(ivrTaskcallService.heTaskSend(sendTaskVO));
    }
 
    /**
     * 电话回调任务(上海)
     */
    @ApiOperation("电话回调任务")
    @PostMapping("/phoneCallBack")
    public AjaxResult phoneCallBack(@RequestBody PhoneCallBackVO phoneCallBackVO) {
//        log.error("电话回调任务成功了不?{}", phoneCallBackVO);
        ivrTaskcallService.phoneCallBack(phoneCallBackVO);
        return success();
    }
 
}