| | |
| | | package com.smartor.controller; |
| | | package com.ruoyi.web.controller.smartor; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | 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.github.pagehelper.ISelect; |
| | | 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.smartor.domain.IvrTask; |
| | | import com.smartor.service.IIvrTaskService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | 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.RSAPublicKeyExample; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.service.IIvrTaskService; |
| | | import com.smartor.service.IIvrTaskSingleService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 语音任务Controller |
| | | * |
| | | * 随访任务Controller |
| | | * |
| | | * @author smartor |
| | | * @date 2023-03-24 |
| | | */ |
| | | @Slf4j |
| | | @Api(description = "随访任务") |
| | | @RestController |
| | | @RequestMapping("/smartor/ivrtask") |
| | | public class IvrTaskController extends BaseController |
| | | { |
| | | public class IvrTaskController extends BaseController { |
| | | @Autowired |
| | | private IIvrTaskService ivrTaskService; |
| | | |
| | | @Autowired |
| | | private IIvrTaskSingleService iIvrTaskCallService; |
| | | |
| | | @Value("${pub_key}") |
| | | private String pub_key; |
| | | |
| | | @Value("${pri_key}") |
| | | private String pri_key; |
| | | |
| | | /** |
| | | * 查询语音任务列表 |
| | | */ |
| | | @ApiOperation("查询任务列表") |
| | | @PreAuthorize("@ss.hasPermi('smartor:ivrtask:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(IvrTask ivrTask) |
| | | { |
| | | startPage(); |
| | | @PostMapping("/list") |
| | | public TableDataInfo list(@RequestBody IvrTask ivrTask) { |
| | | PageUtils.startPageByPost(ivrTask.getPageNum(), ivrTask.getPageSize()); |
| | | List<IvrTask> list = ivrTaskService.selectIvrTaskList(ivrTask); |
| | | return getDataTable(list); |
| | | List<IvrTaskVO> ivrTaskVOS = DtoConversionUtils.sourceToTarget(list, IvrTaskVO.class); |
| | | |
| | | if (CollectionUtils.isNotEmpty(ivrTaskVOS)) { |
| | | for (IvrTaskVO ivrTaskVO : ivrTaskVOS) { |
| | | IvrTaskSingle ivrTaskcall = new IvrTaskSingle(); |
| | | ivrTaskcall.setTaskid(ivrTaskVO.getTaskid()); |
| | | List<IvrTaskSingle> ivrTaskcalls = iIvrTaskCallService.selectIvrTaskcallList(ivrTaskcall); |
| | | if (CollectionUtils.isNotEmpty(ivrTaskcalls)) { |
| | | //已发送 |
| | | long yfs = ivrTaskcalls.stream().filter(ivrTaskcall1 -> ivrTaskcall1.getSendstate() != null && ivrTaskcall1.getSendstate() == 3L).collect(Collectors.toList()).stream().count(); |
| | | //未发送 |
| | | long wfs = ivrTaskcalls.stream().filter(ivrTaskcall1 -> ivrTaskcall1.getSendstate() != null && ivrTaskcall1.getSendstate() == 2L).collect(Collectors.toList()).stream().count(); |
| | | ivrTaskVO.setYfs(yfs); |
| | | ivrTaskVO.setWfs(wfs); |
| | | } |
| | | } |
| | | //获取total |
| | | long total = PageUtils.count(new ISelect() { |
| | | @Override |
| | | public void doSelect() { |
| | | ivrTask.setPageNum(null); |
| | | ivrTask.setPageSize(null); |
| | | ivrTaskService.selectIvrTaskList(ivrTask); |
| | | } |
| | | }); |
| | | |
| | | return getDataTable2(total, ivrTaskVOS); |
| | | } |
| | | |
| | | return getDataTable2(0, ivrTaskVOS); |
| | | } |
| | | |
| | | /** |
| | | * 导出语音任务列表 |
| | | * 导出任务列表 |
| | | */ |
| | | @ApiOperation("导出任务列表") |
| | | @PreAuthorize("@ss.hasPermi('smartor:ivrtask:export')") |
| | | @Log(title = "语音任务", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, IvrTask ivrTask) |
| | | { |
| | | public void export(HttpServletResponse response, IvrTask ivrTask) { |
| | | List<IvrTask> list = ivrTaskService.selectIvrTaskList(ivrTask); |
| | | ExcelUtil<IvrTask> util = new ExcelUtil<IvrTask>(IvrTask.class); |
| | | util.exportExcel(response, list, "语音任务数据"); |
| | | } |
| | | |
| | | /** |
| | | * 获取语音任务详细信息 |
| | | * 获取任务详细信息 |
| | | */ |
| | | @ApiOperation("获取任务详细信息") |
| | | @PreAuthorize("@ss.hasPermi('smartor:ivrtask:query')") |
| | | @GetMapping(value = "/{taskid}") |
| | | public AjaxResult getInfo(@PathVariable("taskid") Long taskid) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable("taskid") Long taskid) { |
| | | return success(ivrTaskService.selectIvrTaskByTaskid(taskid)); |
| | | } |
| | | |
| | | /** |
| | | * 新增语音任务 |
| | | * 新增任务 |
| | | */ |
| | | @ApiOperation("新增任务") |
| | | @PreAuthorize("@ss.hasPermi('smartor:ivrtask:add')") |
| | | @Log(title = "语音任务", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody IvrTask ivrTask) |
| | | { |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody IvrTask ivrTask) { |
| | | return toAjax(ivrTaskService.insertIvrTask(ivrTask)); |
| | | } |
| | | |
| | | /** |
| | | * 修改语音任务 |
| | | */ |
| | | @ApiOperation("修改任务") |
| | | @PreAuthorize("@ss.hasPermi('smartor:ivrtask:edit')") |
| | | @Log(title = "语音任务", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody IvrTask ivrTask) |
| | | { |
| | | @Log(title = "任务", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | public AjaxResult edit(@RequestBody IvrTask ivrTask) { |
| | | return toAjax(ivrTaskService.updateIvrTask(ivrTask)); |
| | | } |
| | | |
| | | // /** |
| | | // * 删除语音任务 |
| | | // */ |
| | | // @ApiOperation("删除任务") |
| | | // @PreAuthorize("@ss.hasPermi('smartor:ivrtask:remove')") |
| | | // @Log(title = "语音任务", businessType = BusinessType.DELETE) |
| | | // @GetMapping("/remove/{taskids}") |
| | | // public AjaxResult remove(@PathVariable Long[] taskids) { |
| | | // return toAjax(ivrTaskService.deleteIvrTaskByTaskids(taskids)); |
| | | // } |
| | | // |
| | | |
| | | /** |
| | | * 删除语音任务 |
| | | * 删除任务(包括它对应的患者信息) |
| | | */ |
| | | @ApiOperation("删除任务(包括它对应的患者信息)") |
| | | @PreAuthorize("@ss.hasPermi('smartor:ivrtask:remove')") |
| | | @Log(title = "语音任务", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{taskids}") |
| | | public AjaxResult remove(@PathVariable Long[] taskids) |
| | | { |
| | | return toAjax(ivrTaskService.deleteIvrTaskByTaskids(taskids)); |
| | | @GetMapping("/remove/{removeTask}") |
| | | public AjaxResult removeTask(@PathVariable Long taskId) { |
| | | return toAjax(ivrTaskService.deleteIvrTaskByTaskid(taskId)); |
| | | } |
| | | |
| | | /** |
| | | * 通过任务ID和患者ID获取单个人的题目信息 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation("通过任务ID和患者ID获取单个人的题目信息") |
| | | @PostMapping("/getScriptInfoByCondition") |
| | | public TableDataInfo getScriptInfoByCondition(@RequestBody IvrTaskScriptQues ivrTaskScriptQues) { |
| | | RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); |
| | | Long tid = Long.valueOf(rsaPublicKeyExample.decryptedData(ivrTaskScriptQues.getParam1(), pri_key)); |
| | | Long pid = Long.valueOf(rsaPublicKeyExample.decryptedData(ivrTaskScriptQues.getParam2(), pri_key)); |
| | | log.info("tid和pid的值为:{},{}", tid, pid); |
| | | return getDataTable(ivrTaskService.getScriptInfoByCondition(tid, pid)); |
| | | } |
| | | |
| | | } |