| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import java.util.List; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.IvrTaskcallMapper; |
| | | import com.smartor.mapper.PatTaskRelevanceMapper; |
| | | import com.smartor.service.IIvrTaskcallService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.smartor.mapper.IvrTaskcallMapper; |
| | | import com.smartor.domain.IvrTaskcall; |
| | | import com.smartor.service.IIvrTaskcallService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 语音任务呼叫Service业务层处理 |
| | | * |
| | | * @author smartor |
| | | * @date 2023-03-24 |
| | | * 单一任务(随访)Service业务层处理 |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-02-02 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class IvrTaskcallServiceImpl implements IIvrTaskcallService |
| | | { |
| | | public class IvrTaskcallServiceImpl implements IIvrTaskcallService { |
| | | @Autowired |
| | | private IvrTaskcallMapper ivrTaskcallMapper; |
| | | |
| | | @Autowired |
| | | private PatTaskRelevanceMapper patTaskRelevanceMapper; |
| | | |
| | | /** |
| | | * 查询语音任务呼叫 |
| | | * |
| | | * @param callid 语音任务呼叫主键 |
| | | * @return 语音任务呼叫 |
| | | * 查询单一任务(随访) |
| | | * |
| | | * @param id 单一任务(随访)主键 |
| | | * @return 单一任务(随访) |
| | | */ |
| | | @Override |
| | | public IvrTaskcall selectIvrTaskcallByCallid(Long callid) |
| | | { |
| | | return ivrTaskcallMapper.selectIvrTaskcallByCallid(callid); |
| | | public IvrTaskcall selectIvrTaskcallById(Long id) { |
| | | return ivrTaskcallMapper.selectIvrTaskcallById(id); |
| | | } |
| | | |
| | | /** |
| | | * 查询语音任务呼叫列表 |
| | | * |
| | | * @param ivrTaskcall 语音任务呼叫 |
| | | * @return 语音任务呼叫 |
| | | * 查询单一任务(随访)列表 |
| | | * |
| | | * @param ivrTaskcall 单一任务(随访) |
| | | * @return 单一任务(随访) |
| | | */ |
| | | @Override |
| | | public List<IvrTaskcall> selectIvrTaskcallList(IvrTaskcall ivrTaskcall) |
| | | { |
| | | public List<IvrTaskcall> selectIvrTaskcallList(IvrTaskcall ivrTaskcall) { |
| | | return ivrTaskcallMapper.selectIvrTaskcallList(ivrTaskcall); |
| | | } |
| | | |
| | | /** |
| | | * 新增语音任务呼叫 |
| | | * |
| | | * @param ivrTaskcall 语音任务呼叫 |
| | | * 新增单一任务(随访) |
| | | * |
| | | * @param ivrTaskcall 单一任务(随访) |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertIvrTaskcall(IvrTaskcall ivrTaskcall) |
| | | { |
| | | public int insertIvrTaskcall(IvrTaskcall ivrTaskcall) { |
| | | ivrTaskcall.setCreateTime(DateUtils.getNowDate()); |
| | | return ivrTaskcallMapper.insertIvrTaskcall(ivrTaskcall); |
| | | } |
| | | |
| | | /** |
| | | * 修改语音任务呼叫 |
| | | * |
| | | * @param ivrTaskcall 语音任务呼叫 |
| | | * 修改单一任务(随访) |
| | | * |
| | | * @param ivrTaskcall 单一任务(随访) |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateIvrTaskcall(IvrTaskcall ivrTaskcall) |
| | | { |
| | | public int updateIvrTaskcall(IvrTaskcall ivrTaskcall) { |
| | | ivrTaskcall.setUpdateTime(DateUtils.getNowDate()); |
| | | return ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除语音任务呼叫 |
| | | * |
| | | * @param callids 需要删除的语音任务呼叫主键 |
| | | * 批量删除单一任务(随访) |
| | | * |
| | | * @param ids 需要删除的单一任务(随访)主键 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteIvrTaskcallByCallids(Long[] callids) |
| | | { |
| | | return ivrTaskcallMapper.deleteIvrTaskcallByCallids(callids); |
| | | public int deleteIvrTaskcallByIds(Long[] ids) { |
| | | Integer i = 0; |
| | | for (Long id : ids) { |
| | | i = ivrTaskcallMapper.deleteIvrTaskcallById(id); |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * 删除语音任务呼叫信息 |
| | | * |
| | | * @param callid 语音任务呼叫主键 |
| | | * 单一任务 |
| | | * |
| | | * @param ivrTaskcallVO 单一任务 |
| | | * @return 结果 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public int deleteIvrTaskcallByCallid(Long callid) |
| | | { |
| | | return ivrTaskcallMapper.deleteIvrTaskcallByCallid(callid); |
| | | public int insertOrUpdateTask(IvrTaskcallVO ivrTaskcallVO) { |
| | | if (ObjectUtils.isEmpty(ivrTaskcallVO)) { |
| | | log.info("宣教任务入参为空,请检查入参"); |
| | | throw new BaseException("宣教任务入参为空,请检查入参"); |
| | | } |
| | | Integer integer = 0; |
| | | if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 1) { |
| | | //新增 |
| | | if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getPatTaskRelevances())) { |
| | | for (PatTaskRelevance patTaskRelevance : ivrTaskcallVO.getPatTaskRelevances()) { |
| | | //将任务信息新增到宣教任务表中 |
| | | IvrTaskcall ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskcall.class); |
| | | ivrTaskcall.setSendname(patTaskRelevance.getName()); |
| | | ivrTaskcall.setAge(patTaskRelevance.getAge()); |
| | | ivrTaskcall.setSfzh(patTaskRelevance.getSfzh()); |
| | | ivrTaskcall.setPhone(patTaskRelevance.getPhone()); |
| | | ivrTaskcall.setAddr(patTaskRelevance.getAddr()); |
| | | ivrTaskcall.setCreateTime(DateUtils.getNowDate()); |
| | | ivrTaskcall.setTextParam(new Gson().toJson(ivrTaskcallVO.getTextParam())); |
| | | ivrTaskcallMapper.insertIvrTaskcall(ivrTaskcall); |
| | | integer = ivrTaskcall.getId().intValue(); |
| | | } |
| | | } |
| | | |
| | | } else if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 2) { |
| | | if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getPatTaskRelevances())) { |
| | | for (PatTaskRelevance patTaskRelevance : ivrTaskcallVO.getPatTaskRelevances()) { |
| | | IvrTaskcall ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskcall.class); |
| | | ivrTaskcall.setSendname(patTaskRelevance.getName()); |
| | | ivrTaskcall.setAge(patTaskRelevance.getAge()); |
| | | ivrTaskcall.setSfzh(patTaskRelevance.getSfzh()); |
| | | ivrTaskcall.setPhone(patTaskRelevance.getPhone()); |
| | | ivrTaskcall.setAddr(patTaskRelevance.getAddr()); |
| | | ivrTaskcall.setCreateTime(DateUtils.getNowDate()); |
| | | ivrTaskcall.setTextParam(new Gson().toJson(ivrTaskcallVO.getTextParam())); |
| | | |
| | | ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall); |
| | | integer = ivrTaskcall.getId().intValue(); |
| | | } |
| | | } |
| | | |
| | | } else if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 3) { |
| | | ivrTaskcallMapper.deleteIvrTaskcallById(ivrTaskcallVO.getId()); |
| | | |
| | | integer = ivrTaskcallVO.getId().intValue(); |
| | | } |
| | | return integer; |
| | | } |
| | | |
| | | } |