yuanliang 1 년 전
부모
커밋
0ea0a28e9c

+ 7 - 10
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImUserFriendServiceImpl.java

@@ -50,6 +50,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -246,20 +247,16 @@ public class ImUserFriendServiceImpl extends ServiceImpl<ImUserFriendDao, ImUser
         if (ClientEnum.STUDENT.getCode().equals(friendClientType)) {
             StudentVo detail = studentDao.detail(userId);
             if (detail != null && StringUtils.isNotEmpty(detail.getSubjectId())) {
-                String subjectId = detail.getSubjectId();
-                List<Subject> subject = subjectService.findBySubjectByIdList(subjectId);
-                if (!subject.isEmpty()) {
-                    result.setFriendSubjectName(subject.get(0).getName());
-                }
+                List<Subject> subject = subjectService.findBySubjectByIdList(detail.getSubjectId());
+                String subjectName = subject.stream().map(Subject::getName).collect(Collectors.joining("、"));
+                result.setFriendSubjectName(subjectName);
             }
         } else if (ClientEnum.TEACHER.getCode().equals(friendClientType)) {
             TeacherVo detail = teacherDao.detail(userId);
             if (detail != null && StringUtils.isNotEmpty(detail.getSubjectId())) {
-                String subjectId = detail.getSubjectId();
-                List<Subject> subject = subjectService.findBySubjectByIdList(subjectId);
-                if (!subject.isEmpty()) {
-                    result.setFriendSubjectName(subject.get(0).getName());
-                }
+                List<Subject> subject = subjectService.findBySubjectByIdList(detail.getSubjectId());
+                String subjectName = subject.stream().map(Subject::getName).collect(Collectors.joining("、"));
+                result.setFriendSubjectName(subjectName);
             }
         }
         VipCardRecordWrapper.UserVip userVip = vipCardRecordService.UserVipInfo(userId, ClientEnum.valueOf(friendClientType));

+ 5 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VipCardRecordServiceImpl.java

@@ -630,10 +630,11 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC
         Date minStartTime = collect.stream().map(VipCardRecord::getStartTime).min(Comparator.naturalOrder()).get();
         // 如果扣减的数量超过1天,则提示扣减数量不足
         if (deductedStartDate.before(minStartTime)) {
-            double day = (minStartTime.getTime() - deductedStartDate.getTime()) * 1.0D / (24 * 60 * 60 * 1000);
-            if (day > 1.0D) {
+            deductedStartDate = minStartTime;
+//            double day = (minStartTime.getTime() - deductedStartDate.getTime()) * 1.0D / (24 * 60 * 60 * 1000);
+//            if (day > 1.0D) {
 //                throw new BizException("剩余扣减数量不足");
-            }
+//            }
         }
 
         // 重新计算会员时间,每一条记录置换成一条新的记录,时间区间重新计算
@@ -654,7 +655,7 @@ public class VipCardRecordServiceImpl extends ServiceImpl<VipCardRecordDao, VipC
 
             Long addId = null;
             // 扣减到当前时间区间
-            if (deductedStartDate.after(startTime) && deductedStartDate.before(endTime)) {
+            if ((deductedStartDate.after(startTime) || deductedStartDate.equals(startTime)) && deductedStartDate.before(endTime)) {
                 VipCardRecord addRecord = JSON.parseObject(JSON.toJSONString(vipCardRecord), VipCardRecord.class);
                 addRecord.setId(null);
                 addRecord.setDisplayFlag(false);