Просмотр исходного кода

Merge branch 'dev' of xiongzhu/raex_back into master

lidongze 3 лет назад
Родитель
Сommit
cfa2aa1bb5

+ 21 - 0
src/main/java/com/izouma/nineth/domain/UserDetail.java

@@ -51,4 +51,25 @@ public class UserDetail extends BaseEntityNoID {
     @ApiModelProperty("个人签名")
     private String autograph;
 
+    @ApiModelProperty("nft数量")
+    private Long nftCount;
+
+    @ApiModelProperty("建筑总量")
+    private Long buildCount;
+
+    @ApiModelProperty("地块总量")
+    private Long plotCount;
+
+    @ApiModelProperty("粉丝数量")
+    private Long fansCount;
+
+    @ApiModelProperty("灵气总量")
+    private Long reikiCount;
+
+    @ApiModelProperty("勋章总量")
+    private Long medalCount;
+
+    @ApiModelProperty("个人热力值")
+    private Long personalheatCount;
+
 }

+ 38 - 0
src/main/java/com/izouma/nineth/repo/UserDetailRepo.java

@@ -0,0 +1,38 @@
+package com.izouma.nineth.repo;
+
+import com.izouma.nineth.domain.UserDetail;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+
+import javax.transaction.Transactional;
+
+public interface UserDetailRepo extends JpaRepository<UserDetail, Long>, JpaSpecificationExecutor<UserDetail> {
+    @Query("update UserDetail t set t.del = true where t.userId = ?1")
+    @Modifying
+    @Transactional
+    void softDelete(Long id);
+
+
+    @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL'")
+    Long findNftCountById(Long id);
+
+    @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%房产%' or a.name like '%建筑%'")
+    Long findBuildCountById(Long id);
+
+    @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%土地%'")
+    Long findPlotCountById(Long id);
+
+    @Query("select u.followers from User u where u.id = ?1")
+    Long findFansCountById(Long id);
+
+    @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%绿洲灵气%'")
+    Long findReikiCountById(Long id);
+
+    @Query("select count(a) from Asset a where a.userId = ?1 and a.status = 'NORMAL' and a.name like '%勋章%'")
+    Long findMedalCountById(Long id);
+
+    @Query("select sum(c.likes) from Collection c where c.ownerId = ?1")
+    Long findPersonalHeatCountById(Long id);
+}

+ 6 - 10
src/main/java/com/izouma/nineth/service/UserDetailService.java

@@ -3,6 +3,7 @@ package com.izouma.nineth.service;
 import com.izouma.nineth.domain.UserDetail;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.repo.AssetRepo;
+import com.izouma.nineth.repo.UserDetailRepo;
 import com.izouma.nineth.utils.JpaUtils;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
@@ -14,15 +15,10 @@ import java.util.Map;
 @AllArgsConstructor
 public class UserDetailService {
 
-//    private UserDetailRepo userDetailRepo;
-//    private AssetRepo assetRepo;
-//
-//    public Page<UserDetail> all(PageQuery pageQuery) {
-//        return userDetailRepo.findAll(JpaUtils.toSpecification(pageQuery, UserDetail.class), JpaUtils.toPageRequest(pageQuery));
-//    }
+    private UserDetailRepo userDetailRepo;
+    private AssetRepo assetRepo;
 
-//    public Map<String,Long> userHoldCount(Long userId) {
-//        //查询绿洲元宇宙建筑
-//        Long count = assetRepo.findDiscount()
-//    }
+    public Page<UserDetail> all(PageQuery pageQuery) {
+        return userDetailRepo.findAll(JpaUtils.toSpecification(pageQuery, UserDetail.class), JpaUtils.toPageRequest(pageQuery));
+    }
 }

+ 58 - 47
src/main/java/com/izouma/nineth/web/UserDetailController.java

@@ -5,6 +5,7 @@ import com.izouma.nineth.service.ContentAuditService;
 import com.izouma.nineth.service.UserDetailService;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.UserDetailRepo;
 import com.izouma.nineth.utils.ObjUtils;
 import com.izouma.nineth.utils.SecurityUtils;
 import com.izouma.nineth.utils.excel.ExcelUtils;
@@ -24,52 +25,62 @@ import java.util.List;
 @RequestMapping("/userDetail")
 @AllArgsConstructor
 public class UserDetailController extends BaseController {
-//    private UserDetailService userDetailService;
-//    private UserDetailRepo userDetailRepo;
-//    private ContentAuditService contentAuditService;
-//
-//    //@PreAuthorize("hasRole('ADMIN')")
-//    @PostMapping("/save")
-//    public UserDetail save(@RequestBody UserDetail record) {
-//        Long currentUserId = SecurityUtils.getAuthenticatedUser().getId();
-//        if (currentUserId != record.getUserId()) {
-//            throw new BusinessException("当前修改用户与登录用户不一致");
-//        }
-//        if (StringUtils.isNotBlank(record.getAutograph())) {
-//            if (!contentAuditService.auditText(record.getAutograph())) {
-//                throw new BusinessException("简介包含非法内容");
-//            }
-//        }
-//        if (record.getUserId() != null) {
-//            UserDetail orig = userDetailRepo.findById(record.getUserId()).orElseThrow(new BusinessException("无记录"));
-//            ObjUtils.merge(orig, record);
-//            return userDetailRepo.save(orig);
-//        }
-//        return userDetailRepo.save(record);
-//    }
-//
-//
-//    //@PreAuthorize("hasRole('ADMIN')")
-//    @PostMapping("/all")
-//    public Page<UserDetail> all(@RequestBody PageQuery pageQuery) {
-//        return userDetailService.all(pageQuery);
-//    }
-//
-//    @GetMapping("/get/{id}")
-//    public UserDetail get(@PathVariable Long id) {
-//        return userDetailRepo.findById(id).orElseThrow(new BusinessException("无记录"));
-//    }
-//
-//    @PostMapping("/del/{id}")
-//    public void del(@PathVariable Long id) {
-//        userDetailRepo.softDelete(id);
-//    }
-//
-//    @GetMapping("/excel")
-//    @ResponseBody
-//    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
-//        List<UserDetail> data = all(pageQuery).getContent();
-//        ExcelUtils.export(response, data);
-//    }
+    private UserDetailService userDetailService;
+    private UserDetailRepo userDetailRepo;
+    private ContentAuditService contentAuditService;
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/save")
+    public UserDetail save(@RequestBody UserDetail record) {
+        Long currentUserId = SecurityUtils.getAuthenticatedUser().getId();
+        if (currentUserId != record.getUserId()) {
+            throw new BusinessException("当前修改用户与登录用户不一致");
+        }
+        if (StringUtils.isNotBlank(record.getAutograph())) {
+            if (!contentAuditService.auditText(record.getAutograph())) {
+                throw new BusinessException("简介包含非法内容");
+            }
+        }
+        if (record.getUserId() != null) {
+            UserDetail orig = userDetailRepo.findById(record.getUserId()).orElseThrow(new BusinessException("无记录"));
+            ObjUtils.merge(orig, record);
+            return userDetailRepo.save(orig);
+        }
+        return userDetailRepo.save(record);
+    }
+
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/all")
+    public Page<UserDetail> all(@RequestBody PageQuery pageQuery) {
+        return userDetailService.all(pageQuery);
+    }
+
+    @GetMapping("/get/{id}")
+    public UserDetail get(@PathVariable Long id) {
+        UserDetail userDetail =  userDetailRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+        userDetail.setNftCount(userDetailRepo.findNftCountById(id));
+        userDetail.setBuildCount(userDetailRepo.findBuildCountById(id));
+        userDetail.setPlotCount(userDetailRepo.findPlotCountById(id));
+        userDetail.setFansCount(userDetailRepo.findFansCountById(id));
+        userDetail.setReikiCount(userDetailRepo.findReikiCountById(id));
+        userDetail.setMedalCount(userDetailRepo.findMedalCountById(id));
+        userDetail.setPersonalheatCount(userDetailRepo.findPersonalHeatCountById(id));
+
+        return userDetail;
+
+    }
+
+    @PostMapping("/del/{id}")
+    public void del(@PathVariable Long id) {
+        userDetailRepo.softDelete(id);
+    }
+
+    @GetMapping("/excel")
+    @ResponseBody
+    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
+        List<UserDetail> data = all(pageQuery).getContent();
+        ExcelUtils.export(response, data);
+    }
 }
 

BIN
src/main/resources/static/img/bg.png


BIN
src/main/resources/static/img/box.png


BIN
src/main/resources/static/img/box1.png


BIN
src/main/resources/static/img/box2.png


BIN
src/main/resources/static/img/box3.png


+ 49 - 7
src/main/resources/static/pc.html

@@ -20,31 +20,73 @@
       }
 
       body {
+        display: flex;
+        align-items: center;
+        justify-content: flex-end;
+        background-repeat: no-repeat;
+        background-size: cover;
+        background-position: center;
+      }
+
+      .phone-box {
+        width: 50%;
         display: flex;
         align-items: center;
         justify-content: center;
       }
 
       .phone {
-        width: 500px;
-        height: calc(100% - 1px);
         margin: 0;
         padding: 0;
+        height: 90vh;
+        flex-shrink: 0;
+        position: relative;
       }
 
-      .phone iframe {
-        width: 100%;
+      .phone .bg {
+        width: auto;
         height: 100%;
+        display: block;
+        position: relative;
+        z-index: 1;
+      }
+
+      .phone .bg-color {
+        background-color: #000;
+        width: 90%;
+        height: 100%;
+        position: absolute;
+        top: 2%;
+        left: 5%;
+        z-index: 0;
+        overflow: hidden;
+        border-radius: 30px;
+      }
+
+      .phone iframe {
         border: none;
         outline: none;
         display: block;
+        position: absolute;
+        top: 50%;
+        left: 50%;
+        transform: translate(-50%, -50%);
+        width: 90%;
+        height: 90%;
+        z-index: 2;
+        border-radius: 20px;
+        overflow: hidden;
       }
     </style>
   </head>
 
-  <body>
-    <div class="phone">
-      <iframe src="https://www.raex.vip/9th/home" frameborder="0"></iframe>
+  <body style="background-image: url(img/bg.png)">
+    <div class="phone-box">
+      <div class="phone">
+        <img src="img/box.png" alt="" class="bg" />
+        <div class="bg-color"></div>
+        <iframe src="https://www.raex.vip/9th/home" frameborder="0"></iframe>
+      </div>
     </div>
   </body>
 </html>