|
@ -85,22 +85,21 @@ public class HealthEduArticleController extends BaseController {
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* 查询文章列表
|
|
* 查询文章列表
|
|
* @param article 数据文章唯一标示article
|
|
|
|
|
|
* @param id 数据文章唯一标示article
|
|
* @return 列表
|
|
* @return 列表
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "article")
|
|
@RequestMapping(value = "article")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String article(@RequestParam("article") String article) {
|
|
|
|
|
|
public String article(@RequestParam(value = "article",required = true) long id) {
|
|
try {
|
|
try {
|
|
//获取单条文章记录
|
|
//获取单条文章记录
|
|
HealthEduArticlePatient healthEduArticlePatient = healthEduArticlePatientService.findByArticle(article);
|
|
|
|
|
|
HealthEduArticlePatient healthEduArticlePatient = healthEduArticlePatientService.findById(id);
|
|
int isRead = healthEduArticleOpHistoryService.countByUserStatus(getUID(),HealthEduArticleOpHistory.READ_STATUS);
|
|
int isRead = healthEduArticleOpHistoryService.countByUserStatus(getUID(),HealthEduArticleOpHistory.READ_STATUS);
|
|
//插入文章读取状态第一次阅读记录浏览数量
|
|
|
|
|
|
//插入文章读取状态第一次阅读记录浏览数量//暂时更新每次都算一次浏览量
|
|
|
|
healthEduArticleOpHistoryService.saveByStatus(HealthEduArticleOpHistory.READ_STATUS,healthEduArticlePatient.getArticle(),healthEduArticlePatient.getTitle(),getUID());
|
|
if(isRead==0){
|
|
if(isRead==0){
|
|
//更新浏览量
|
|
|
|
healthEduArticleOpHistoryService.saveByStatus(HealthEduArticleOpHistory.READ_STATUS,healthEduArticlePatient.getArticle(),healthEduArticlePatient.getTitle(),getUID());
|
|
|
|
//将文章更新为已读
|
|
//将文章更新为已读
|
|
healthEduArticlePatientService.updateRead(getUID(), article);
|
|
|
|
|
|
healthEduArticlePatientService.updateRead(getUID(), healthEduArticlePatient.getArticle());
|
|
}
|
|
}
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
json.put("id", healthEduArticlePatient.getId());
|
|
json.put("id", healthEduArticlePatient.getId());
|
|
@ -114,7 +113,7 @@ public class HealthEduArticleController extends BaseController {
|
|
json.put("content", healthEduArticlePatient.getContent());
|
|
json.put("content", healthEduArticlePatient.getContent());
|
|
// 添加日期
|
|
// 添加日期
|
|
json.put("czrq", DateUtil.dateToStrLong(healthEduArticlePatient.getCzrq()));
|
|
json.put("czrq", DateUtil.dateToStrLong(healthEduArticlePatient.getCzrq()));
|
|
int readAmount = healthEduArticleOpHistoryService.countReadAmount(article);
|
|
|
|
|
|
int readAmount = healthEduArticleOpHistoryService.countReadAmount(healthEduArticlePatient.getArticle());
|
|
json.put("readAmount",readAmount);
|
|
json.put("readAmount",readAmount);
|
|
return write(200, "查询成功", "data", json);
|
|
return write(200, "查询成功", "data", json);
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|