Browse Source

Merge branch 'master' of http://git.izouma.com/xiongzhu/9th

xuqiang 4 years ago
parent
commit
eb18aba107

+ 3 - 0
src/main/java/com/izouma/nineth/domain/Order.java

@@ -145,4 +145,7 @@ public class Order extends BaseEntity {
     private boolean hide;
     private boolean hide;
 
 
     private Long couponId;
     private Long couponId;
+
+    private Long invitor;
+
 }
 }

+ 5 - 0
src/main/java/com/izouma/nineth/domain/User.java

@@ -22,6 +22,7 @@ import javax.persistence.*;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 import javax.validation.constraints.Size;
 import java.io.Serializable;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.HashSet;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.Set;
 
 
@@ -106,4 +107,8 @@ public class User extends BaseEntity implements Serializable {
     private String tradeCode;
     private String tradeCode;
 
 
     private boolean admin;
     private boolean admin;
+
+    @ApiModelProperty("分成比例")
+    @Column(precision = 10, scale = 2)
+    private BigDecimal shareRatio;
 }
 }

+ 2 - 1
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -68,7 +68,7 @@ public class OrderService {
     }
     }
 
 
     @Transactional
     @Transactional
-    public Order create(Long userId, Long collectionId, int qty, Long addressId, Long userCouponId) {
+    public Order create(Long userId, Long collectionId, int qty, Long addressId, Long userCouponId, Long invitor) {
         if (qty <= 0) throw new BusinessException("数量必须大于0");
         if (qty <= 0) throw new BusinessException("数量必须大于0");
         User user = userRepo.findByIdAndDelFalse(userId).orElseThrow(new BusinessException("用户不存在"));
         User user = userRepo.findByIdAndDelFalse(userId).orElseThrow(new BusinessException("用户不存在"));
         Collection collection = collectionRepo.findById(collectionId).orElseThrow(new BusinessException("藏品不存在"));
         Collection collection = collectionRepo.findById(collectionId).orElseThrow(new BusinessException("藏品不存在"));
@@ -135,6 +135,7 @@ public class OrderService {
                 .status(OrderStatus.NOT_PAID)
                 .status(OrderStatus.NOT_PAID)
                 .assetId(collection.getAssetId())
                 .assetId(collection.getAssetId())
                 .couponId(userCouponId)
                 .couponId(userCouponId)
+                .invitor(invitor)
                 .build();
                 .build();
         if (coupon != null) {
         if (coupon != null) {
             coupon.setUsed(true);
             coupon.setUsed(true);

+ 2 - 0
src/main/java/com/izouma/nineth/service/UserService.java

@@ -59,6 +59,7 @@ public class UserService {
     private FollowService    followService;
     private FollowService    followService;
     private FollowRepo       followRepo;
     private FollowRepo       followRepo;
     private IdentityAuthRepo identityAuthRepo;
     private IdentityAuthRepo identityAuthRepo;
+    private SysConfigService sysConfigService;
 
 
     @CacheEvict(value = "user", key = "#user.username")
     @CacheEvict(value = "user", key = "#user.username")
     public User update(User user) {
     public User update(User user) {
@@ -102,6 +103,7 @@ public class UserService {
         }
         }
         User user = new User();
         User user = new User();
         BeanUtils.copyProperties(userRegister, user);
         BeanUtils.copyProperties(userRegister, user);
+        user.setShareRatio(sysConfigService.getBigDecimal("share_ratio"));
         user.setAuthStatus(AuthStatus.NOT_AUTH);
         user.setAuthStatus(AuthStatus.NOT_AUTH);
         if (StringUtils.isNotBlank(userRegister.getPassword())) {
         if (StringUtils.isNotBlank(userRegister.getPassword())) {
             user.setPassword(new BCryptPasswordEncoder().encode(userRegister.getPassword()));
             user.setPassword(new BCryptPasswordEncoder().encode(userRegister.getPassword()));

+ 5 - 2
src/main/java/com/izouma/nineth/web/OrderController.java

@@ -73,9 +73,12 @@ public class OrderController extends BaseController {
     }
     }
 
 
     @PostMapping("/create")
     @PostMapping("/create")
-    public Order create(@RequestParam Long collectionId, @RequestParam int qty, @RequestParam(required = false) Long addressId, @RequestParam(required = false) Long couponId) {
+    public Order create(@RequestParam Long collectionId, @RequestParam int qty,
+                        @RequestParam(required = false) Long addressId,
+                        @RequestParam(required = false) Long couponId,
+                        @RequestParam(required = false) Long invitor) {
         return orderService.create(SecurityUtils.getAuthenticatedUser().getId(),
         return orderService.create(SecurityUtils.getAuthenticatedUser().getId(),
-                collectionId, qty, addressId, couponId);
+                collectionId, qty, addressId, couponId, invitor);
     }
     }
 
 
     @PostMapping("/hide")
     @PostMapping("/hide")

+ 16 - 23
src/main/nine-space/src/views/asset/Detail.vue

@@ -185,31 +185,18 @@
                 }}</van-button>
                 }}</van-button>
             </div>
             </div>
         </div>
         </div>
-        <!-- <div > -->
-        <!-- <div class="goods">
-            <div style="padding-left: 16px" class="page-title">交易历史</div>
-            <div class="content" v-for="item in list" :key="item.id">
-                <div class="init">
-                    <div style="width: 100%">
-                        <div class="text1">{{ item.fromUser || '保密' }}</div>
-                        <div class="text2">
-                            <div class="text3">{{ item.operation }}{{ item.price }}</div>
-                            <div class="text4">{{ item.createdAt }}</div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div> -->
         <van-collapse v-model="activeName" accordion>
         <van-collapse v-model="activeName" accordion>
             <van-collapse-item class="activeName" title="交易记录" name="1">
             <van-collapse-item class="activeName" title="交易记录" name="1">
                 <div v-if="list.length > 0">
                 <div v-if="list.length > 0">
                     <div class="content" v-for="item in list" :key="item.id">
                     <div class="content" v-for="item in list" :key="item.id">
-                        <!-- <img class="img" :src="list.avatar" alt="" /> -->
+                        <img v-if="list.minterAvatar" class="img" :src="list.minterAvatar" alt="" />
                         <div class="init">
                         <div class="init">
                             <div style="width: 100%">
                             <div style="width: 100%">
                                 <div class="text1">{{ item.fromUser || '保密' }}</div>
                                 <div class="text1">{{ item.fromUser || '保密' }}</div>
                                 <div class="text2">
                                 <div class="text2">
-                                    <div class="text3">{{ item.operation }}{{ item.price }}</div>
+                                    <div class="text3">
+                                        {{ item.operation }}<span v-if="item.price">{{ item.price }}</span>
+                                    </div>
                                     <div class="text4">{{ item.createdAt }}</div>
                                     <div class="text4">{{ item.createdAt }}</div>
                                 </div>
                                 </div>
                             </div>
                             </div>
@@ -221,7 +208,7 @@
         </van-collapse>
         </van-collapse>
         <!-- </div> -->
         <!-- </div> -->
 
 
-        <driver />
+        <!-- <driver /> -->
         <!-- 其他三个 -->
         <!-- 其他三个 -->
         <van-popup v-model:show="show">
         <van-popup v-model:show="show">
             <div class="title2">
             <div class="title2">
@@ -635,7 +622,13 @@ export default {
     background: #181818 !important;
     background: #181818 !important;
     padding: 0 !important;
     padding: 0 !important;
 }
 }
+/deep/ .van-collapse {
+    border: 0 !important;
+}
 .activeName {
 .activeName {
+    /deep/ .van-collapse {
+        border: 0 !important;
+    }
     /deep/ .van-cell__title {
     /deep/ .van-cell__title {
         font-size: @font2;
         font-size: @font2;
         font-family: PingFangSC-Medium, PingFang SC;
         font-family: PingFangSC-Medium, PingFang SC;
@@ -662,8 +655,8 @@ export default {
     height: 68px;
     height: 68px;
     border-radius: 12px;
     border-radius: 12px;
     .img {
     .img {
-        width: 40px;
-        height: 40px;
+        width: 32px;
+        height: 32px;
         border-radius: 50%;
         border-radius: 50%;
         margin-right: 10px;
         margin-right: 10px;
     }
     }
@@ -673,7 +666,7 @@ export default {
         justify-content: space-between;
         justify-content: space-between;
         width: 100%;
         width: 100%;
         .text1 {
         .text1 {
-            font-size: 14px;
+            font-size: @font1;
             font-weight: bold;
             font-weight: bold;
             color: #ffffff;
             color: #ffffff;
             line-height: 24px;
             line-height: 24px;
@@ -684,13 +677,13 @@ export default {
             justify-content: space-between;
             justify-content: space-between;
             width: 100%;
             width: 100%;
             .text3 {
             .text3 {
-                font-size: 14px;
+                font-size: @font1;
                 font-weight: 400;
                 font-weight: 400;
                 color: @text3;
                 color: @text3;
                 line-height: 24px;
                 line-height: 24px;
             }
             }
             .text4 {
             .text4 {
-                font-size: 14px;
+                font-size: @font1;
                 font-weight: 400;
                 font-weight: 400;
                 color: @text3;
                 color: @text3;
                 line-height: 24px;
                 line-height: 24px;

+ 7 - 7
src/main/nine-space/src/views/product/Detail.vue

@@ -205,7 +205,7 @@
             <van-collapse-item class="activeName" title="交易记录" name="1">
             <van-collapse-item class="activeName" title="交易记录" name="1">
                 <div v-if="list.length > 0">
                 <div v-if="list.length > 0">
                     <div class="content" v-for="item in list" :key="item.id">
                     <div class="content" v-for="item in list" :key="item.id">
-                        <!-- <img class="img" :src="list.avatar" alt="" /> -->
+                        <img v-if="list.minterAvatar" class="img" :src="list.minterAvatar" alt="" />
                         <div class="init">
                         <div class="init">
                             <div style="width: 100%">
                             <div style="width: 100%">
                                 <div class="text1">{{ item.fromUser || '保密' }}</div>
                                 <div class="text1">{{ item.fromUser || '保密' }}</div>
@@ -221,7 +221,7 @@
             </van-collapse-item>
             </van-collapse-item>
         </van-collapse>
         </van-collapse>
 
 
-        <driver />
+        <!-- <driver /> -->
 
 
         <post ref="post" :info="info" noButton />
         <post ref="post" :info="info" noButton />
     </div>
     </div>
@@ -714,8 +714,8 @@ span {
     height: 68px;
     height: 68px;
     border-radius: 12px;
     border-radius: 12px;
     .img {
     .img {
-        width: 40px;
-        height: 40px;
+        width: 32px;
+        height: 32px;
         border-radius: 50%;
         border-radius: 50%;
         margin-right: 10px;
         margin-right: 10px;
     }
     }
@@ -725,7 +725,7 @@ span {
         justify-content: space-between;
         justify-content: space-between;
         width: 100%;
         width: 100%;
         .text1 {
         .text1 {
-            font-size: 14px;
+            font-size: @font1;
             font-weight: bold;
             font-weight: bold;
             color: #ffffff;
             color: #ffffff;
             line-height: 24px;
             line-height: 24px;
@@ -736,13 +736,13 @@ span {
             justify-content: space-between;
             justify-content: space-between;
             width: 100%;
             width: 100%;
             .text3 {
             .text3 {
-                font-size: 14px;
+                font-size: @font1;
                 font-weight: 400;
                 font-weight: 400;
                 color: @text3;
                 color: @text3;
                 line-height: 24px;
                 line-height: 24px;
             }
             }
             .text4 {
             .text4 {
-                font-size: 14px;
+                font-size: @font1;
                 font-weight: 400;
                 font-weight: 400;
                 color: @text3;
                 color: @text3;
                 line-height: 24px;
                 line-height: 24px;

+ 4 - 1
src/main/vue/src/views/UserEdit.vue

@@ -17,7 +17,7 @@
                     :model="formData"
                     :model="formData"
                     :rules="rules"
                     :rules="rules"
                     ref="form"
                     ref="form"
-                    label-width="80px"
+                    label-width="90px"
                     label-position="right"
                     label-position="right"
                     style="max-width: 500px"
                     style="max-width: 500px"
                 >
                 >
@@ -54,6 +54,9 @@
                             </el-option>
                             </el-option>
                         </el-select>
                         </el-select>
                     </el-form-item>
                     </el-form-item>
+                    <el-form-item prop="shareRatio" label="分成比例(%)">
+                        <el-input-number :min="0" :max="99" v-model="formData.shareRatio"></el-input-number>
+                    </el-form-item>
                     <el-form-item>
                     <el-form-item>
                         <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
                         <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
                         <el-button @click="del" :disabled="saving" type="danger" v-if="formData.id && formData.id !== 1"
                         <el-button @click="del" :disabled="saving" type="danger" v-if="formData.id && formData.id !== 1"

+ 1 - 1
src/test/java/com/izouma/nineth/service/OrderServiceTest.java

@@ -14,7 +14,7 @@ public class OrderServiceTest extends ApplicationTests {
 
 
     @Test
     @Test
     public void create() throws EncoderException, WxPayException {
     public void create() throws EncoderException, WxPayException {
-        Order order = orderService.create(1110L, 1777L, 1, null, 1896L);
+        Order order = orderService.create(1110L, 1777L, 1, null, 1896L, null);
         assert order.getStatus() == OrderStatus.FINISH;
         assert order.getStatus() == OrderStatus.FINISH;
     }
     }