CommonController.java 1.5 KB
  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
package com.lyms.talkonlineweb.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.databind.ser.Serializers;
import com.lyms.talkonlineweb.domain.LymsTkrecord;
import com.lyms.talkonlineweb.result.BaseResponse;
import com.lyms.talkonlineweb.service.LymsTkrecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("com")
public class CommonController {
@Autowired
private LymsTkrecordService lymsTkrecordService;

@GetMapping("endTalk")
public BaseResponse endTalk(LymsTkrecord tkrecord){
BaseResponse baseResponse=new BaseResponse();
tkrecord.setStat(0);
baseResponse.setErrorcode(1);
int updateby=tkrecord.getUpdatedby();
tkrecord.setUpdatedby(null);

List<LymsTkrecord> tLst=lymsTkrecordService.list(Wrappers.query(tkrecord).orderByDesc("createdtime"));
if (tLst.size()>0){
tkrecord=tLst.get(0);
tkrecord.setStat(1);
tkrecord.setUpdatedtime(new Date());
tkrecord.setUpdatedby(updateby);
boolean f=lymsTkrecordService.saveOrUpdate(tkrecord);

baseResponse.setErrorcode(f==true?0:1);
}
return baseResponse;
}
}