Browse Source

Merge branch 'zx_online_tenantAlbum_0331' of http://git.dayaedu.com/yonge/cooleshow into develop-new

zouxuan 5 tháng trước cách đây
mục cha
commit
4ba41fd0b3

+ 0 - 6
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/UserTenantAlbumRecordController.java

@@ -113,10 +113,4 @@ public class UserTenantAlbumRecordController extends BaseController {
 
         return R.from(userTenantAlbumRecordService.info(infoQuery));
     }
-
-    @ApiOperation(value = "获取最近一次购买记录")
-    @GetMapping("/lastRecord")
-    public R<UserTenantAlbumRecordWrapper.LastUserTenantAlbumRecord> last(Long tenantAlbumId) {
-        return R.from(userTenantAlbumRecordService.last(sysUserService.getUserId(),tenantAlbumId));
-    }
 }

+ 9 - 7
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/UserTenantAlbumRecordController.java

@@ -10,6 +10,7 @@ import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
 import com.yonge.cooleshow.biz.dal.entity.UserTenantAlbumRecord;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
+import com.yonge.cooleshow.biz.dal.service.SysUserService;
 import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
 import com.yonge.cooleshow.biz.dal.service.UserTenantAlbumRecordService;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper;
@@ -24,12 +25,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
@@ -50,7 +46,7 @@ public class UserTenantAlbumRecordController {
     private SysUserFeignService sysUserFeignService;
 
     @Autowired
-    private TenantInfoService tenantInfoService;
+    private SysUserService sysUserService;
 
     @Autowired
     private StudentService studentService;
@@ -136,4 +132,10 @@ public class UserTenantAlbumRecordController {
 
         return R.from(userTenantAlbumRecordService.removeById(id));
     }
+
+    @ApiOperation(value = "获取最近一次购买记录")
+    @GetMapping("/lastRecord")
+    public R<UserTenantAlbumRecordWrapper.LastUserTenantAlbumRecord> last() {
+        return R.from(userTenantAlbumRecordService.last(sysUserService.getUserId(),null));
+    }
 }

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

@@ -15,6 +15,7 @@ import com.yonge.cooleshow.biz.dal.mapper.TenantGroupAlbumMapper;
 import com.yonge.cooleshow.biz.dal.mapper.UserTenantAlbumRecordMapper;
 import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantGroupAlbumWrapper;
+import com.yonge.cooleshow.biz.dal.wrapper.UserTenantAlbumRecordWrapper;
 import com.yonge.toolset.base.exception.BizException;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
@@ -223,6 +224,10 @@ public class TenantGroupAlbumServiceImpl extends ServiceImpl<TenantGroupAlbumMap
                     item.setExpireTime(userTenantAlbumRecord.getEndTime());
                 }
                 item.setSort(sortMap.getOrDefault(item.getId(),0L));
+                UserTenantAlbumRecordWrapper.LastUserTenantAlbumRecord albumRecord = userTenantAlbumRecordService.last(query.getUserId(), item.getTenantGroupAlbumId());
+                if (albumRecord != null) {
+                    item.setEndTime(albumRecord.getEndTime());
+                }
             }
         }
 

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

@@ -941,8 +941,10 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
             }
         }
         if (tenantAlbumId != null){
-            TenantAlbum tenantAlbum = tenantAlbumService.getById(tenantAlbumId);
-            lastUserTenantAlbumRecord.setTenantAlbumName(tenantAlbum.getName());
+            if (albumId != null){
+                TenantAlbum tenantAlbum = tenantAlbumService.getById(tenantAlbumId);
+                lastUserTenantAlbumRecord.setTenantAlbumName(tenantAlbum.getName());
+            }
             lastUserTenantAlbumRecord.setEndTime(endTime);
         }
         return lastUserTenantAlbumRecord;

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantGroupAlbumWrapper.java

@@ -295,6 +295,9 @@ public class TenantGroupAlbumWrapper {
         @ApiModelProperty("到期时间")
         private Date expireTime;
 
+        @ApiModelProperty("过期时间")
+        private Date endTime;
+
         public String jsonString() {
             return JSON.toJSONString(this);
         }