前端保存
(@RequestBody ChatEntity chat, HttpServletRequest request)
| 147 | * 前端保存 |
| 148 | */ |
| 149 | @RequestMapping("/add") |
| 150 | public R add(@RequestBody ChatEntity chat, HttpServletRequest request){ |
| 151 | chat.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); |
| 152 | //ValidatorUtils.validateEntity(chat); |
| 153 | chat.setUserid((Long)request.getSession().getAttribute("userId")); |
| 154 | if(StringUtils.isNotBlank(chat.getAsk())) { |
| 155 | chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", request.getSession().getAttribute("userId"))); |
| 156 | chat.setUserid((Long)request.getSession().getAttribute("userId")); |
| 157 | chat.setIsreply(1); |
| 158 | } |
| 159 | if(StringUtils.isNotBlank(chat.getReply())) { |
| 160 | chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", chat.getUserid())); |
| 161 | chat.setAdminid((Long)request.getSession().getAttribute("userId")); |
| 162 | } |
| 163 | |
| 164 | chatService.insert(chat); |
| 165 | return R.ok(); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * 修改 |
no test coverage detected