|
|
|
@ -31,13 +31,12 @@ import com.service.*;
|
|
|
|
|
import com.utils.PageUtils;
|
|
|
|
|
import com.utils.R;
|
|
|
|
|
import com.alibaba.fastjson.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 在线咨询
|
|
|
|
|
* 后端接口
|
|
|
|
|
* @author
|
|
|
|
|
* @email
|
|
|
|
|
*/
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
|
|
|
|
@Controller
|
|
|
|
|
@RequestMapping("/chat")
|
|
|
|
@ -60,10 +59,9 @@ public class ChatController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private YishengService yishengService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 后端列表
|
|
|
|
|
*/
|
|
|
|
|
* 后端列表
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/page")
|
|
|
|
|
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
|
|
|
|
|
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
|
|
|
|
@ -87,25 +85,24 @@ public class ChatController {
|
|
|
|
|
}
|
|
|
|
|
return R.ok().put("data", page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 后端详情
|
|
|
|
|
*/
|
|
|
|
|
* 后端详情
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/info/{id}")
|
|
|
|
|
public R info(@PathVariable("id") Long id, HttpServletRequest request){
|
|
|
|
|
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
|
|
|
|
ChatEntity chat = chatService.selectById(id);
|
|
|
|
|
if(chat !=null){
|
|
|
|
|
//entity转view
|
|
|
|
|
//entity转view
|
|
|
|
|
ChatView view = new ChatView();
|
|
|
|
|
BeanUtils.copyProperties( chat , view );//把实体数据重构到view中
|
|
|
|
|
|
|
|
|
|
//级联表
|
|
|
|
|
//级联表
|
|
|
|
|
YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId());
|
|
|
|
|
if(yonghu != null){
|
|
|
|
|
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
|
|
|
|
|
view.setYonghuId(yonghu.getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改对应字典表字段
|
|
|
|
|
dictionaryService.dictionaryConvert(view, request);
|
|
|
|
|
return R.ok().put("data", view);
|
|
|
|
@ -114,10 +111,9 @@ public class ChatController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 后端保存
|
|
|
|
|
*/
|
|
|
|
|
* 后端保存
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/save")
|
|
|
|
|
public R save(@RequestBody ChatEntity chat, HttpServletRequest request){
|
|
|
|
|
logger.debug("save方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());
|
|
|
|
@ -146,10 +142,9 @@ public class ChatController {
|
|
|
|
|
return R.error(511,"表中有相同数据");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 后端修改
|
|
|
|
|
*/
|
|
|
|
|
* 后端修改
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/update")
|
|
|
|
|
public R update(@RequestBody ChatEntity chat, HttpServletRequest request){
|
|
|
|
|
logger.debug("update方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());
|
|
|
|
@ -159,6 +154,7 @@ public class ChatController {
|
|
|
|
|
// return R.error(511,"永远不会进入");
|
|
|
|
|
// else if("用户".equals(role))
|
|
|
|
|
// chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
|
|
|
|
|
|
|
|
|
|
//根据字段查询是否有相同数据
|
|
|
|
|
Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>()
|
|
|
|
|
.notIn("id",chat.getId())
|
|
|
|
@ -180,9 +176,10 @@ public class ChatController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除
|
|
|
|
|
*/
|
|
|
|
|
* 删除
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/delete")
|
|
|
|
|
public R delete(@RequestBody Integer[] ids){
|
|
|
|
|
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
|
|
|
|
@ -191,6 +188,7 @@ public class ChatController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量上传
|
|
|
|
|
*/
|
|
|
|
@ -219,20 +217,15 @@ public class ChatController {
|
|
|
|
|
for(List<String> data:dataList){
|
|
|
|
|
//循环
|
|
|
|
|
ChatEntity chatEntity = new ChatEntity();
|
|
|
|
|
// chatEntity.setYonghuId(Integer.valueOf(data.get(0))); //提问用户 要改的
|
|
|
|
|
// chatEntity.setChatIssue(data.get(0)); //问题 要改的
|
|
|
|
|
// chatEntity.setIssueTime(new Date(data.get(0))); //问题时间 要改的
|
|
|
|
|
// chatEntity.setChatReply(data.get(0)); //回复 要改的
|
|
|
|
|
// chatEntity.setReplyTime(new Date(data.get(0))); //回复时间 要改的
|
|
|
|
|
// chatEntity.setZhuangtaiTypes(Integer.valueOf(data.get(0))); //状态 要改的
|
|
|
|
|
// chatEntity.setChatTypes(Integer.valueOf(data.get(0))); //数据类型 要改的
|
|
|
|
|
// chatEntity.setInsertTime(date);//时间
|
|
|
|
|
|
|
|
|
|
chatList.add(chatEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//把要查询是否重复的字段放入map中
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询是否重复
|
|
|
|
|
chatService.insertBatch(chatList);
|
|
|
|
|
return R.ok();
|
|
|
|
@ -248,20 +241,19 @@ public class ChatController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 前端列表
|
|
|
|
|
*/
|
|
|
|
|
* 前端列表
|
|
|
|
|
*/
|
|
|
|
|
@IgnoreAuth
|
|
|
|
|
@RequestMapping("/list")
|
|
|
|
|
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
|
|
|
|
|
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
|
|
|
|
|
|
|
|
|
|
// 没有指定排序字段就默认id倒序
|
|
|
|
|
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
|
|
|
|
|
params.put("orderBy","id");
|
|
|
|
|
}
|
|
|
|
|
PageUtils page = chatService.queryPage(params);
|
|
|
|
|
|
|
|
|
|
//字典表数据转换
|
|
|
|
|
List<ChatView> list =(List<ChatView>)page.getList();
|
|
|
|
|
for(ChatView c:list)
|
|
|
|
@ -269,26 +261,28 @@ public class ChatController {
|
|
|
|
|
return R.ok().put("data", page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 前端详情
|
|
|
|
|
*/
|
|
|
|
|
* 前端详情
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/detail/{id}")
|
|
|
|
|
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
|
|
|
|
|
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
|
|
|
|
ChatEntity chat = chatService.selectById(id);
|
|
|
|
|
if(chat !=null){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//entity转view
|
|
|
|
|
ChatView view = new ChatView();
|
|
|
|
|
BeanUtils.copyProperties( chat , view );//把实体数据重构到view中
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//级联表
|
|
|
|
|
YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId());
|
|
|
|
|
if(yonghu != null){
|
|
|
|
|
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
|
|
|
|
|
view.setYonghuId(yonghu.getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改对应字典表字段
|
|
|
|
|
dictionaryService.dictionaryConvert(view, request);
|
|
|
|
|
return R.ok().put("data", view);
|
|
|
|
@ -298,9 +292,10 @@ public class ChatController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 前端保存
|
|
|
|
|
*/
|
|
|
|
|
* 前端保存
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/add")
|
|
|
|
|
public R add(@RequestBody ChatEntity chat, HttpServletRequest request){
|
|
|
|
|
logger.debug("add方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());
|
|
|
|
|