|
@@ -52,22 +52,37 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
|
|
|
if (staffManage != null) {
|
|
|
staffName = staffManage.getStaffName();
|
|
|
}
|
|
|
+
|
|
|
+ String value = SecurityUtils.getUserId() + ":" + staffName;
|
|
|
if (valueList != null && valueList.size() > 0) {
|
|
|
-
|
|
|
- String value = SecurityUtils.getUserId() + ":" + staffName;
|
|
|
|
|
|
if (!valueList.contains(value)) {
|
|
|
|
|
|
valueList.add(value);
|
|
|
+ redisCache.deleteObject(READ_TRAIN + manualId);
|
|
|
redisCache.setCacheList(READ_TRAIN + manualId, valueList);
|
|
|
|
|
|
|
|
|
redisCache.setCacheObject(READ_TRAIN_TIME + manualId + ":" + SecurityUtils.getUserId(), DateUtils.getTime());
|
|
|
+ }else {
|
|
|
+
|
|
|
+
|
|
|
+ redisCache.setCacheObject(READ_TRAIN_TIME + manualId + ":" + SecurityUtils.getUserId(), DateUtils.getTime());
|
|
|
}
|
|
|
+ }else {
|
|
|
+
|
|
|
+ List<String> stringList = new ArrayList<>();
|
|
|
+ stringList.add(value);
|
|
|
+ redisCache.setCacheList(READ_TRAIN + manualId, stringList);
|
|
|
+
|
|
|
+ redisCache.setCacheObject(READ_TRAIN_TIME + manualId + ":" + SecurityUtils.getUserId(), DateUtils.getTime());
|
|
|
}
|
|
|
- return staffTrainManualMapper.selectStaffTrainManualByManualId(manualId);
|
|
|
+ StaffTrainManual staffTrainManual = staffTrainManualMapper.selectStaffTrainManualByManualId(manualId);
|
|
|
+ Long viewCount = staffTrainManual.getViewCount();
|
|
|
+ staffTrainManual.setViewCount(viewCount+1);
|
|
|
+ staffTrainManualMapper.updateStaffTrainManual(staffTrainManual);
|
|
|
+ return staffTrainManual;
|
|
|
}
|
|
|
-
|
|
|
|
|
|
* 查询员工培训手册列表
|
|
|
*
|
|
@@ -132,7 +147,8 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
|
|
|
public AjaxResult getRead(StaffTrainManual staffTrainManual) {
|
|
|
|
|
|
List<Map<String, String>> resultList = new ArrayList<>();
|
|
|
- String searchValue = staffTrainManual.getSearchValue();
|
|
|
+
|
|
|
+ String author = staffTrainManual.getAuthor();
|
|
|
Date searchTime = staffTrainManual.getCreateTime();
|
|
|
Long manualId = staffTrainManual.getManualId();
|
|
|
|
|
@@ -142,16 +158,16 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
|
|
|
for (String value : valueList) {
|
|
|
String[] split = value.split(":");
|
|
|
|
|
|
- String readTime = redisCache.getCacheObject(READ_TRAIN_TIME + ":" + manualId + ":" + split[0]);
|
|
|
+ String readTime = redisCache.getCacheObject(READ_TRAIN_TIME + manualId + ":" + split[0]);
|
|
|
Map<String, String> map = new HashMap<>(2);
|
|
|
- if (StringUtils.isBlank(searchValue) && searchTime == null) {
|
|
|
+ if (StringUtils.isBlank(author) && searchTime == null) {
|
|
|
map.put("name", split[1]);
|
|
|
|
|
|
map.put("time", readTime);
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
|
|
|
- else if (StringUtils.isNotBlank(searchValue)) {
|
|
|
+ else if (StringUtils.isNotBlank(author)) {
|
|
|
|
|
|
if (searchTime != null) {
|
|
|
|
|
@@ -162,14 +178,14 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
|
|
|
LocalDate date = dateTime.toLocalDate();
|
|
|
String formattedDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
|
|
|
- if (searchValue.equals(split[1]) && sdf.format(searchTime).equals(formattedDate)) {
|
|
|
+ if (split[1].contains(author) && sdf.format(searchTime).equals(formattedDate)) {
|
|
|
map.put("name", split[1]);
|
|
|
map.put("time", readTime);
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
- if (searchValue.equals(split[1])) {
|
|
|
+ if (split[1].contains(author)) {
|
|
|
map.put("name", split[1]);
|
|
|
map.put("time", readTime);
|
|
|
resultList.add(map);
|
|
@@ -183,8 +199,8 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
|
|
|
|
|
|
LocalDate date = dateTime.toLocalDate();
|
|
|
String formattedDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
- if (StringUtils.isNotBlank(searchValue)) {
|
|
|
- if (searchValue.equals(split[1]) && sdf.format(searchTime).equals(formattedDate)) {
|
|
|
+ if (StringUtils.isNotBlank(author)) {
|
|
|
+ if (author.equals(split[1]) && sdf.format(searchTime).equals(formattedDate)) {
|
|
|
map.put("name", split[1]);
|
|
|
map.put("time", readTime);
|
|
|
resultList.add(map);
|
|
@@ -196,10 +212,11 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
}
|
|
|
+ }else {
|
|
|
+ map.put("name", split[1]);
|
|
|
+ map.put("time", readTime);
|
|
|
+ resultList.add(map);
|
|
|
}
|
|
|
- map.put("name", split[1]);
|
|
|
- map.put("time", readTime);
|
|
|
- resultList.add(map);
|
|
|
}
|
|
|
}
|
|
|
return AjaxResult.success(resultList);
|