提交会话管理相关代码

main
liu 11 months ago
parent 890258e1fc
commit ac2b4d5602

@ -5,6 +5,7 @@ import com.supervision.domain.IrSession;
import com.supervision.domain.IrSessionHistory;
import com.supervision.service.IrSessionService;
import com.supervision.vo.session.FinishSessionVO;
import com.supervision.vo.session.NewSessionReqVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -27,14 +28,9 @@ public class SessionController {
private final IrSessionService irSessionService;
@ApiOperation("创建新的会话")
@GetMapping("createNewSession")
@ApiImplicitParams({
@ApiImplicitParam(name = "caseNumber", value = "案件编号", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "type", value = "播报方式(1语音 2文字)", required = true, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "speed", value = "播放速度(2位,小数后1位,例如:1.0,0.5,1.5,2.0)", required = true, dataType = "String", paramType = "query")
})
public IrSession createNewSession(String caseNumber, Integer type, BigDecimal speed) {
return irSessionService.createNewSession(caseNumber, type, speed);
@PostMapping("createNewSession")
public IrSession createNewSession(@RequestBody NewSessionReqVO newSessionReqVO) {
return irSessionService.createNewSession(newSessionReqVO);
}
@ApiOperation("分页获取会话列表")

@ -5,6 +5,7 @@ import com.supervision.domain.IrSession;
import com.baomidou.mybatisplus.extension.service.IService;
import com.supervision.domain.IrSessionHistory;
import com.supervision.vo.session.FinishSessionVO;
import com.supervision.vo.session.NewSessionReqVO;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
@ -17,7 +18,7 @@ import java.util.List;
*/
public interface IrSessionService extends IService<IrSession> {
IrSession createNewSession(String caseNumber, Integer type, BigDecimal speed);
IrSession createNewSession(NewSessionReqVO newSessionReqVO);
IPage<IrSession> querySessionPage(String sessionName,Integer pageSize, Integer pageNum);

@ -3,17 +3,23 @@ package com.supervision.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.config.domain.UserInfo;
import com.supervision.domain.IrSession;
import com.supervision.domain.IrSessionParam;
import com.supervision.domain.IrSqlParam;
import com.supervision.exception.BusinessException;
import com.supervision.service.IrSessionHistoryService;
import com.supervision.service.IrSessionParamService;
import com.supervision.service.IrSessionService;
import com.supervision.mapper.IrSessionMapper;
import com.supervision.service.IrSqlParamService;
import com.supervision.util.UserUtil;
import com.supervision.vo.session.FinishSessionVO;
import com.supervision.vo.session.NewSessionReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -35,16 +41,53 @@ public class IrSessionServiceImpl extends ServiceImpl<IrSessionMapper, IrSession
private final IrSessionHistoryService irSessionHistoryService;
private final IrSessionParamService irSessionParamService;
@Override
public IrSession createNewSession(String caseNumber, Integer type, BigDecimal speed) {
@Transactional(rollbackFor = Exception.class)
public IrSession createNewSession(NewSessionReqVO newSessionReqVO) {
if (StrUtil.isBlank(newSessionReqVO.getCaseNumber())) {
throw new BusinessException("案件编号不能为空");
}
UserInfo user = UserUtil.getUser();
IrSession irSession = new IrSession();
irSession.setSessionName("案件编号:" + caseNumber);
irSession.setSessionName("案件编号:" + newSessionReqVO.getCaseNumber());
irSession.setSessionState(1);
irSession.setUserId(user.getId());
irSession.setVideoSpeed(speed);
irSession.setBroadcastType(type);
irSession.setVideoSpeed(newSessionReqVO.getSpeed());
irSession.setBroadcastType(newSessionReqVO.getType());
this.save(irSession);
IrSessionParam irSessionParam = new IrSessionParam();
irSessionParam.setSessionId(irSession.getId());
irSessionParam.setParamName("ajid");
irSessionParam.setParamValue(newSessionReqVO.getCaseNumber());
irSessionParam.setParamType("String");
irSessionParamService.save(irSessionParam);
// 保存交易卡号证件号以及用户名信息
if (StrUtil.isNotBlank(newSessionReqVO.getTransactionNumber())) {
IrSessionParam transactionNumberParam = new IrSessionParam();
transactionNumberParam.setSessionId(irSession.getId());
transactionNumberParam.setParamName("khrzjhm");
transactionNumberParam.setParamValue(newSessionReqVO.getCaseNumber());
transactionNumberParam.setParamType("String");
irSessionParamService.save(transactionNumberParam);
}
if (CollUtil.isNotEmpty(newSessionReqVO.getTransactionAccount())) {
IrSessionParam transactionNumberParam = new IrSessionParam();
transactionNumberParam.setSessionId(irSession.getId());
transactionNumberParam.setParamName("jykh");
transactionNumberParam.setParamValue(JSONUtil.toJsonStr(newSessionReqVO.getTransactionAccount()));
transactionNumberParam.setParamType("List");
irSessionParamService.save(transactionNumberParam);
}
if (StrUtil.isNotBlank(newSessionReqVO.getTransactionUsername())) {
IrSessionParam transactionNumberParam = new IrSessionParam();
transactionNumberParam.setSessionId(irSession.getId());
transactionNumberParam.setParamName("suspectName");
transactionNumberParam.setParamValue(newSessionReqVO.getTransactionUsername());
transactionNumberParam.setParamType("String");
irSessionParamService.save(transactionNumberParam);
}
return irSession;
}

@ -0,0 +1,27 @@
package com.supervision.vo.session;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
@ApiModel
public class NewSessionReqVO {
@ApiModelProperty("案件编号")
private String caseNumber;
@ApiModelProperty("播报方式(1语音 2文字)")
private Integer type;
@ApiModelProperty("播放速度(2位,小数后1位,例如:1.0,0.5,1.5,2.0)")
private BigDecimal speed;
@ApiModelProperty("交易用户名")
private String transactionUsername;
@ApiModelProperty("交易卡号")
private List<String> transactionAccount;
@ApiModelProperty("交易证件号码")
private String transactionNumber;
}
Loading…
Cancel
Save