فهرست منبع

分销/提现

licailing 5 سال پیش
والد
کامیت
b30f62953c
29فایلهای تغییر یافته به همراه900 افزوده شده و 35 حذف شده
  1. 3 0
      src/main/java/com/izouma/jiashanxia/domain/Company.java
  2. 4 0
      src/main/java/com/izouma/jiashanxia/domain/User.java
  3. 9 0
      src/main/java/com/izouma/jiashanxia/dto/GoodsDTO.java
  4. 1 0
      src/main/java/com/izouma/jiashanxia/enums/PayMethod.java
  5. 3 2
      src/main/java/com/izouma/jiashanxia/enums/TransactionType.java
  6. 18 0
      src/main/java/com/izouma/jiashanxia/repo/CompanyRepo.java
  7. 4 0
      src/main/java/com/izouma/jiashanxia/repo/SetMealRepo.java
  8. 2 0
      src/main/java/com/izouma/jiashanxia/repo/UserRepo.java
  9. 58 0
      src/main/java/com/izouma/jiashanxia/service/CompanyService.java
  10. 56 17
      src/main/java/com/izouma/jiashanxia/service/OrderInfoService.java
  11. 26 8
      src/main/java/com/izouma/jiashanxia/service/SetMealService.java
  12. 3 0
      src/main/java/com/izouma/jiashanxia/service/UserService.java
  13. 6 0
      src/main/java/com/izouma/jiashanxia/service/UserSetFlowService.java
  14. 74 1
      src/main/java/com/izouma/jiashanxia/service/WithdrawService.java
  15. 75 0
      src/main/java/com/izouma/jiashanxia/web/CompanyController.java
  16. 11 1
      src/main/java/com/izouma/jiashanxia/web/OrderInfoController.java
  17. 14 0
      src/main/java/com/izouma/jiashanxia/web/SetMealController.java
  18. 6 0
      src/main/java/com/izouma/jiashanxia/web/UserController.java
  19. 18 1
      src/main/java/com/izouma/jiashanxia/web/WithdrawController.java
  20. 1 0
      src/main/resources/genjson/Company.json
  21. 16 0
      src/main/vue/src/router.js
  22. 95 0
      src/main/vue/src/views/CompanyEdit.vue
  23. 180 0
      src/main/vue/src/views/CompanyList.vue
  24. 100 3
      src/main/vue/src/views/UserEdit.vue
  25. 39 0
      src/main/vue/src/views/WithdrawList.vue
  26. 35 0
      src/test/java/com/izouma/jiashanxia/repo/UserSetFlowRepoTest.java
  27. 19 0
      src/test/java/com/izouma/jiashanxia/service/CompanyServiceTest.java
  28. 2 2
      src/test/java/com/izouma/jiashanxia/service/OrderInfoServiceTest.java
  29. 22 0
      src/test/java/com/izouma/jiashanxia/service/UserSetServiceTest.java

+ 3 - 0
src/main/java/com/izouma/jiashanxia/domain/Company.java

@@ -8,6 +8,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import javax.persistence.Entity;
+import java.math.BigDecimal;
 
 
 @Entity
@@ -22,4 +23,6 @@ public class Company extends BaseEntity {
 
     @ApiModelProperty(value = "企业名称")
     private String name;
+
+    private BigDecimal amount;
 }

+ 4 - 0
src/main/java/com/izouma/jiashanxia/domain/User.java

@@ -77,4 +77,8 @@ public class User extends BaseEntity implements Serializable {
 
     @ApiModelProperty(value = "企业id")
     private Long companyId;
+
+    @ApiModelProperty(value = "是否团队创始人")
+    private Boolean  teamFounder;
+
 }

+ 9 - 0
src/main/java/com/izouma/jiashanxia/dto/GoodsDTO.java

@@ -1,5 +1,14 @@
 package com.izouma.jiashanxia.dto;
 
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
 public class GoodsDTO {
     private Long goodsInfoId;
     private Long num;

+ 1 - 0
src/main/java/com/izouma/jiashanxia/enums/PayMethod.java

@@ -2,6 +2,7 @@ package com.izouma.jiashanxia.enums;
 
 public enum PayMethod {
     WEIXIN("微信"),
+    ALI("支付宝"),
     YUE("余额");
     private final String description;
 

+ 3 - 2
src/main/java/com/izouma/jiashanxia/enums/TransactionType.java

@@ -1,8 +1,9 @@
 package com.izouma.jiashanxia.enums;
 
 public enum TransactionType {
-    TIXIAN("提现"),
-    INCOME("推广新会员"),
+    WITHDRAW("提现"),
+    PROMOTE("推广新会员"),
+    EMPLOYEES_PROMOTE("员工推广新会员"),
     REFUND("退款"),
     ;
 

+ 18 - 0
src/main/java/com/izouma/jiashanxia/repo/CompanyRepo.java

@@ -0,0 +1,18 @@
+package com.izouma.jiashanxia.repo;
+
+import com.izouma.jiashanxia.domain.Company;
+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 CompanyRepo extends JpaRepository<Company, Long>, JpaSpecificationExecutor<Company> {
+    @Query("update Company t set t.del = true where t.id = ?1")
+    @Modifying
+    @Transactional
+    void softDelete(Long id);
+
+    Company findByUserId(Long userId);
+}

+ 4 - 0
src/main/java/com/izouma/jiashanxia/repo/SetMealRepo.java

@@ -1,16 +1,20 @@
 package com.izouma.jiashanxia.repo;
 
 import com.izouma.jiashanxia.domain.SetMeal;
+import com.izouma.jiashanxia.enums.SetType;
 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;
+import java.util.List;
 
 public interface SetMealRepo extends JpaRepository<SetMeal, Long>, JpaSpecificationExecutor<SetMeal> {
     @Query("update SetMeal t set t.del = true where t.id = ?1")
     @Modifying
     @Transactional
     void softDelete(Long id);
+
+    List<SetMeal> findAllByType(SetType type);
 }

+ 2 - 0
src/main/java/com/izouma/jiashanxia/repo/UserRepo.java

@@ -25,4 +25,6 @@ public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExe
     User findByPhone(String phone);
 
     List<User> findAllByParent(Long parent);
+
+    List<User> findAllByCompanyId(Long companyId);
 }

+ 58 - 0
src/main/java/com/izouma/jiashanxia/service/CompanyService.java

@@ -0,0 +1,58 @@
+package com.izouma.jiashanxia.service;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.izouma.jiashanxia.domain.Company;
+import com.izouma.jiashanxia.domain.User;
+import com.izouma.jiashanxia.dto.PageQuery;
+import com.izouma.jiashanxia.exception.BusinessException;
+import com.izouma.jiashanxia.repo.CompanyRepo;
+import com.izouma.jiashanxia.repo.UserRepo;
+import com.izouma.jiashanxia.utils.JpaUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+@AllArgsConstructor
+public class CompanyService {
+
+    private CompanyRepo companyRepo;
+    private UserRepo    userRepo;
+
+    public Page<Company> all(PageQuery pageQuery) {
+        return companyRepo.findAll(JpaUtils.toSpecification(pageQuery, Company.class), JpaUtils.toPageRequest(pageQuery));
+    }
+
+    /*
+    添加员工
+    */
+    public void addUser(Long userId, Long companyId) {
+        User user = userRepo.findById(userId).orElseThrow(new BusinessException("无用户"));
+        user.setCompanyId(companyId);
+        userRepo.save(user);
+    }
+
+    /*
+    删除员工
+     */
+    public void removeUser(Long userId, Long companyId) {
+        User user = userRepo.findById(userId).orElseThrow(new BusinessException("无用户"));
+        if (companyId.equals(user.getCompanyId())) {
+            user.setCompanyId(null);
+            userRepo.save(user);
+        }
+    }
+
+    /*
+    员工列表
+     */
+    public List<User> employee(Long userId) {
+        Company company = companyRepo.findByUserId(userId);
+        if (ObjectUtil.isEmpty(company)) {
+            return null;
+        }
+        return userRepo.findAllByCompanyId(company.getId());
+    }
+}

+ 56 - 17
src/main/java/com/izouma/jiashanxia/service/OrderInfoService.java

@@ -24,14 +24,15 @@ import java.util.List;
 @AllArgsConstructor
 public class OrderInfoService {
 
-    private OrderInfoRepo orderInfoRepo;
-    private SetMealRepo setMealRepo;
-    private SetGoodsRepo setGoodsRepo;
-    private UserSetRepo userSetRepo;
-    private UserRepo userRepo;
-    private SysConfigService sysConfigService;
+    private OrderInfoRepo        orderInfoRepo;
+    private SetMealRepo          setMealRepo;
+    private SetGoodsRepo         setGoodsRepo;
+    private UserSetRepo          userSetRepo;
+    private UserRepo             userRepo;
+    private SysConfigService     sysConfigService;
     private CommissionRecordRepo commissionRecordRepo;
-    private UserSetService userSetService;
+    private UserSetService       userSetService;
+    private CompanyRepo          companyRepo;
 
     public Page<OrderInfo> all(PageQuery pageQuery) {
         return orderInfoRepo.findAll(JpaUtils.toSpecification(pageQuery, OrderInfo.class), JpaUtils.toPageRequest(pageQuery));
@@ -40,7 +41,7 @@ public class OrderInfoService {
     /*
     下订单
      */
-    public OrderInfo order(Long userId, Long setInfoId, PayMethod payMethod) {
+    public OrderInfo creatOrder(Long userId, Long setInfoId, PayMethod payMethod) {
         SetMeal setInfo = setMealRepo.findById(setInfoId).orElseThrow(new BusinessException("无套餐"));
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
         String localTime = df.format(LocalDateTime.now());
@@ -75,24 +76,34 @@ public class OrderInfoService {
         Long userId = order.getUserId();
         userSetService.joinUserSet(userId, setGoodsList);
 
+        User user = userRepo.findById(userId).orElseThrow(new BusinessException("无用户"));
+        if (user.getParent() != null) {
+            // 上级分销
+            this.distribution(userId, user.getParent(), transactionId);
+        }
     }
 
     /*
     分销
+    又有团队,员工自己又购买了套餐,企业是否有收益?
+    企业拉员工,员工的上级是否改为企业领导人?
+    如果上级和企业不是一个人,收益如何算?
      */
     public void distribution(Long userId, Long parent, String transactionId) {
-        User user = userRepo.findById(parent).orElseThrow(new BusinessException("无用户"));
+        User parentUser = userRepo.findById(parent).orElseThrow(new BusinessException("无用户"));
         // 判断是否可分享
-        boolean flag = true;
+        boolean flag = false;
         // 是否公司员工
-        if (ObjectUtil.isEmpty(user.getCompanyId())) {
-            flag = false;
+        if (ObjectUtil.isNotEmpty(parentUser.getCompanyId())) {
+            flag = true;
+            // 公司可得分销
+            this.companyDis(parentUser.getCompanyId(), transactionId, userId);
         }
-        if (flag) {
+        if (!flag) {
             // 是否购买了套餐
             List<UserSet> parentSets = userSetRepo.findAllByUserId(parent);
-            if (CollUtil.isEmpty(parentSets)) {
-                flag = false;
+            if (CollUtil.isNotEmpty(parentSets)) {
+                flag = true;
             }
         }
         if (!flag) {
@@ -100,7 +111,8 @@ public class OrderInfoService {
         }
 
         BigDecimal personalAmount = sysConfigService.getBigDecimal("PERSONAL_AMOUNT");
-        user.setAmount(user.getAmount().add(personalAmount));
+        parentUser.setAmount(parentUser.getAmount().add(personalAmount));
+        userRepo.save(parentUser);
 
         // 个人佣金流水
         commissionRecordRepo.save(CommissionRecord.builder()
@@ -108,7 +120,34 @@ public class OrderInfoService {
                 .amount(personalAmount)
                 .payMethod(PayMethod.YUE)
                 .fromUserId(userId)
-                .transactionType(TransactionType.INCOME)
+                .transactionType(TransactionType.PROMOTE)
+                .transactionId(transactionId)
+                .build());
+
+    }
+
+
+    /*
+    公司分销
+     */
+    public void companyDis(Long companyId, String transactionId, Long userId) {
+        Company company = companyRepo.findById(companyId).orElseThrow(new BusinessException("无企业"));
+        // 用户余额
+        User user = userRepo.findById(company.getUserId()).orElseThrow(new BusinessException("无用户"));
+        BigDecimal companyAmount = sysConfigService.getBigDecimal("COMPANY_AMOUNT");
+        user.setAmount(user.getAmount().add(companyAmount));
+        userRepo.save(user);
+        // 公司余额
+        company.setAmount(company.getAmount().add(companyAmount));
+        companyRepo.save(company);
+
+        // 佣金流水
+        commissionRecordRepo.save(CommissionRecord.builder()
+                .userId(company.getUserId())
+                .amount(companyAmount)
+                .payMethod(PayMethod.YUE)
+                .fromUserId(userId)
+                .transactionType(TransactionType.EMPLOYEES_PROMOTE)
                 .transactionId(transactionId)
                 .build());
 

+ 26 - 8
src/main/java/com/izouma/jiashanxia/service/SetMealService.java

@@ -1,19 +1,27 @@
 package com.izouma.jiashanxia.service;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.izouma.jiashanxia.domain.Company;
 import com.izouma.jiashanxia.domain.SetGoods;
 import com.izouma.jiashanxia.domain.SetMeal;
+import com.izouma.jiashanxia.domain.User;
 import com.izouma.jiashanxia.dto.PageQuery;
+import com.izouma.jiashanxia.enums.AuthorityName;
 import com.izouma.jiashanxia.enums.SetType;
 import com.izouma.jiashanxia.exception.BusinessException;
+import com.izouma.jiashanxia.repo.CompanyRepo;
 import com.izouma.jiashanxia.repo.SetGoodsRepo;
 import com.izouma.jiashanxia.repo.SetMealRepo;
+import com.izouma.jiashanxia.repo.UserRepo;
+import com.izouma.jiashanxia.security.Authority;
 import com.izouma.jiashanxia.utils.JpaUtils;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.List;
+import java.util.Set;
 
 
 @Service
@@ -23,7 +31,8 @@ public class SetMealService {
     private SetMealRepo    setMealRepo;
     private SetGoodsRepo   setGoodsRepo;
     private UserSetService userSetService;
-//    private Company
+    private CompanyRepo    companyRepo;
+    private UserRepo       userRepo;
 
     public Page<SetMeal> all(PageQuery pageQuery) {
         return setMealRepo.findAll(JpaUtils.toSpecification(pageQuery, SetMeal.class), JpaUtils.toPageRequest(pageQuery));
@@ -33,6 +42,7 @@ public class SetMealService {
     开通团队套餐
      */
     public void openTeamSet(Long userId, Long setMealId) {
+
         SetMeal set = setMealRepo.findById(setMealId).orElseThrow(new BusinessException("无套餐"));
         if (!SetType.TEAM.equals(set.getType())) {
             throw new BusinessException("不是团队套餐");
@@ -43,14 +53,22 @@ public class SetMealService {
         userSetService.joinUserSet(userId, setGoodsList);
 
         // 新建公司
-        Company.builder()
-                .userId(userId)
-                .name("企业")
-                .build();
+        Company company = companyRepo.findByUserId(userId);
+        if (ObjectUtil.isNotEmpty(company)) {
+            company = companyRepo.save(Company.builder()
+                    .userId(userId)
+                    .name("企业")
+                    .amount(BigDecimal.ZERO)
+                    .build());
+        }
+        User user = userRepo.findById(userId).orElseThrow(new BusinessException("无用户"));
+        // 团队创始人
+        if (!user.getTeamFounder()) {
+            user.setTeamFounder(true);
+            user.setCompanyId(company.getId());
+            userRepo.save(user);
+        }
 
     }
 
-    public void test(Long userId,Long companyId){
-
-    }
 }

+ 3 - 0
src/main/java/com/izouma/jiashanxia/service/UserService.java

@@ -106,6 +106,7 @@ public class UserService {
                     .authorities(Collections.singleton(Authority.builder().name("ROLE_USER").build()))
                     .parent(parent)
                     .amount(BigDecimal.ZERO)
+                    .teamFounder(false)
                     .build();
             userInfo = userRepo.save(userInfo);
             return userInfo;
@@ -149,6 +150,8 @@ public class UserService {
                     .province(wxUserInfo.getProvince())
                     .city(wxUserInfo.getCity())
                     .authorities(Collections.singleton(Authority.builder().name("ROLE_USER").build()))
+                    .amount(BigDecimal.ZERO)
+                    .teamFounder(false)
                     .build();
             user = userRepo.save(user);
 

+ 6 - 0
src/main/java/com/izouma/jiashanxia/service/UserSetFlowService.java

@@ -8,6 +8,8 @@ import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 @AllArgsConstructor
 public class UserSetFlowService {
@@ -17,4 +19,8 @@ public class UserSetFlowService {
     public Page<UserSetFlow> all(PageQuery pageQuery) {
         return userSetFlowRepo.findAll(JpaUtils.toSpecification(pageQuery, UserSetFlow.class), JpaUtils.toPageRequest(pageQuery));
     }
+
+    public List<UserSetFlow> my(Long userId) {
+        return userSetFlowRepo.findAllByUserId(userId);
+    }
 }

+ 74 - 1
src/main/java/com/izouma/jiashanxia/service/WithdrawService.java

@@ -1,20 +1,93 @@
 package com.izouma.jiashanxia.service;
 
+import com.izouma.jiashanxia.domain.CommissionRecord;
+import com.izouma.jiashanxia.domain.User;
 import com.izouma.jiashanxia.domain.Withdraw;
 import com.izouma.jiashanxia.dto.PageQuery;
+import com.izouma.jiashanxia.enums.PayMethod;
+import com.izouma.jiashanxia.enums.TransactionType;
+import com.izouma.jiashanxia.enums.WithdrawStatus;
+import com.izouma.jiashanxia.exception.BusinessException;
+import com.izouma.jiashanxia.repo.CommissionRecordRepo;
+import com.izouma.jiashanxia.repo.UserRepo;
 import com.izouma.jiashanxia.repo.WithdrawRepo;
 import com.izouma.jiashanxia.utils.JpaUtils;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
 @Service
 @AllArgsConstructor
 public class WithdrawService {
 
-    private WithdrawRepo withdrawRepo;
+    private WithdrawRepo         withdrawRepo;
+    private UserRepo             userRepo;
+    private CommissionRecordRepo commissionRecordRepo;
 
     public Page<Withdraw> all(PageQuery pageQuery) {
         return withdrawRepo.findAll(JpaUtils.toSpecification(pageQuery, Withdraw.class), JpaUtils.toPageRequest(pageQuery));
     }
+
+    /*
+    提现申请
+     */
+    public Withdraw apply(Long userId, BigDecimal amount, String realName, String account) {
+        if (BigDecimal.ZERO.compareTo(amount) >= 0) {
+            throw new BusinessException("提现金额小于零");
+        }
+        User user = userRepo.findById(userId).orElseThrow(new BusinessException("无用户"));
+        if (amount.compareTo(user.getAmount()) > 0) {
+            throw new BusinessException("提现金额大于余额");
+        }
+        // 先扣款
+        BigDecimal subtract = user.getAmount().subtract(amount);
+        user.setAmount(subtract);
+        userRepo.save(user);
+
+        // 提现申请
+        return withdrawRepo.save(
+                Withdraw.builder()
+                        .userId(userId)
+                        .realName(realName)
+                        .account(account)
+                        .amount(amount)
+                        .balance(subtract)
+                        .status(WithdrawStatus.PENDING)
+                        .build());
+
+    }
+
+    /*
+    审核
+     */
+    public void audit(Long withdrawId, Boolean pass) {
+        Withdraw withdraw = withdrawRepo.findById(withdrawId).orElseThrow(new BusinessException("无提现记录"));
+        LocalDateTime now = LocalDateTime.now();
+        if (pass) {
+            withdraw.setStatus(WithdrawStatus.SUCCESS);
+            withdraw.setAuditTime(now);
+            // 个人佣金流水
+            commissionRecordRepo.save(CommissionRecord.builder()
+                    .userId(withdraw.getUserId())
+                    .amount(withdraw.getAmount())
+                    .payMethod(PayMethod.YUE)
+                    .transactionType(TransactionType.WITHDRAW)
+                    .transactionId(withdrawId.toString())
+                    .build());
+            withdrawRepo.save(withdraw);
+            return;
+        }
+        withdraw.setStatus(WithdrawStatus.FAIL);
+        withdraw.setAuditTime(now);
+        // 拒绝后加上余额
+        User user = userRepo.findById(withdraw.getUserId()).orElseThrow(new BusinessException("无用户"));
+        user.setAmount(user.getAmount().add(withdraw.getAmount()));
+        userRepo.save(user);
+        withdrawRepo.save(withdraw);
+    }
+
+
 }

+ 75 - 0
src/main/java/com/izouma/jiashanxia/web/CompanyController.java

@@ -0,0 +1,75 @@
+package com.izouma.jiashanxia.web;
+
+import com.izouma.jiashanxia.domain.Company;
+import com.izouma.jiashanxia.domain.User;
+import com.izouma.jiashanxia.service.CompanyService;
+import com.izouma.jiashanxia.dto.PageQuery;
+import com.izouma.jiashanxia.exception.BusinessException;
+import com.izouma.jiashanxia.repo.CompanyRepo;
+import com.izouma.jiashanxia.utils.ObjUtils;
+import com.izouma.jiashanxia.utils.excel.ExcelUtils;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@RestController
+@RequestMapping("/company")
+@AllArgsConstructor
+public class CompanyController extends BaseController {
+    private CompanyService companyService;
+    private CompanyRepo    companyRepo;
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/save")
+    public Company save(@RequestBody Company record) {
+        if (record.getId() != null) {
+            Company orig = companyRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            ObjUtils.merge(orig, record);
+            return companyRepo.save(orig);
+        }
+        return companyRepo.save(record);
+    }
+
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/all")
+    public Page<Company> all(@RequestBody PageQuery pageQuery) {
+        return companyService.all(pageQuery);
+    }
+
+    @GetMapping("/get/{id}")
+    public Company get(@PathVariable Long id) {
+        return companyRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+    }
+
+    @PostMapping("/del/{id}")
+    public void del(@PathVariable Long id) {
+        companyRepo.softDelete(id);
+    }
+
+    @GetMapping("/excel")
+    @ResponseBody
+    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
+        List<Company> data = all(pageQuery).getContent();
+        ExcelUtils.export(response, data);
+    }
+
+    @GetMapping("/allList")
+    public List<Company> allList() {
+        return companyRepo.findAll();
+    }
+
+    @PostMapping("/employee")
+    @ApiOperation("根据用户id员工列表")
+    public List<User> employee(Long userId) {
+        return companyService.employee(userId);
+    }
+
+}
+

+ 11 - 1
src/main/java/com/izouma/jiashanxia/web/OrderInfoController.java

@@ -1,11 +1,15 @@
 package com.izouma.jiashanxia.web;
+
 import com.izouma.jiashanxia.domain.OrderInfo;
+import com.izouma.jiashanxia.enums.PayMethod;
 import com.izouma.jiashanxia.service.OrderInfoService;
 import com.izouma.jiashanxia.dto.PageQuery;
 import com.izouma.jiashanxia.exception.BusinessException;
 import com.izouma.jiashanxia.repo.OrderInfoRepo;
 import com.izouma.jiashanxia.utils.ObjUtils;
+import com.izouma.jiashanxia.utils.SecurityUtils;
 import com.izouma.jiashanxia.utils.excel.ExcelUtils;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -20,7 +24,7 @@ import java.util.List;
 @AllArgsConstructor
 public class OrderInfoController extends BaseController {
     private OrderInfoService orderInfoService;
-    private OrderInfoRepo orderInfoRepo;
+    private OrderInfoRepo    orderInfoRepo;
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
@@ -56,5 +60,11 @@ public class OrderInfoController extends BaseController {
         List<OrderInfo> data = all(pageQuery).getContent();
         ExcelUtils.export(response, data);
     }
+
+    @PostMapping("/creat")
+    @ApiOperation("创建订单")
+    public OrderInfo creat(@RequestParam Long setMealId, @RequestParam PayMethod payMethod) {
+        return orderInfoService.creatOrder(SecurityUtils.getAuthenticatedUser().getId(), setMealId, payMethod);
+    }
 }
 

+ 14 - 0
src/main/java/com/izouma/jiashanxia/web/SetMealController.java

@@ -1,12 +1,14 @@
 package com.izouma.jiashanxia.web;
 
 import com.izouma.jiashanxia.domain.SetMeal;
+import com.izouma.jiashanxia.enums.SetType;
 import com.izouma.jiashanxia.service.SetMealService;
 import com.izouma.jiashanxia.dto.PageQuery;
 import com.izouma.jiashanxia.exception.BusinessException;
 import com.izouma.jiashanxia.repo.SetMealRepo;
 import com.izouma.jiashanxia.utils.ObjUtils;
 import com.izouma.jiashanxia.utils.excel.ExcelUtils;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
@@ -56,5 +58,17 @@ public class SetMealController extends BaseController {
         List<SetMeal> data = all(pageQuery).getContent();
         ExcelUtils.export(response, data);
     }
+
+    @GetMapping("/team")
+    @ApiOperation("团队套餐")
+    public List<SetMeal> team() {
+        return setMealRepo.findAllByType(SetType.TEAM);
+    }
+
+    @PostMapping("/openTeamSet")
+    @ApiOperation("开通团队套餐")
+    public void openTeamSet(Long userId, Long setMealId) {
+        setMealService.openTeamSet(userId, setMealId);
+    }
 }
 

+ 6 - 0
src/main/java/com/izouma/jiashanxia/web/UserController.java

@@ -127,4 +127,10 @@ public class UserController extends BaseController {
         return jwtTokenUtil.generateToken(JwtUserFactory.create(userRepo.findById(userId)
                 .orElseThrow(new BusinessException("用户不存在"))));
     }
+
+    @PostMapping("/employee")
+    @ApiOperation("根据团队id员工列表")
+    public List<User> employee(Long companyId) {
+        return userRepo.findAllByCompanyId(companyId);
+    }
 }

+ 18 - 1
src/main/java/com/izouma/jiashanxia/web/WithdrawController.java

@@ -1,11 +1,14 @@
 package com.izouma.jiashanxia.web;
+
 import com.izouma.jiashanxia.domain.Withdraw;
 import com.izouma.jiashanxia.service.WithdrawService;
 import com.izouma.jiashanxia.dto.PageQuery;
 import com.izouma.jiashanxia.exception.BusinessException;
 import com.izouma.jiashanxia.repo.WithdrawRepo;
 import com.izouma.jiashanxia.utils.ObjUtils;
+import com.izouma.jiashanxia.utils.SecurityUtils;
 import com.izouma.jiashanxia.utils.excel.ExcelUtils;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -13,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.math.BigDecimal;
 import java.util.List;
 
 @RestController
@@ -20,7 +24,7 @@ import java.util.List;
 @AllArgsConstructor
 public class WithdrawController extends BaseController {
     private WithdrawService withdrawService;
-    private WithdrawRepo withdrawRepo;
+    private WithdrawRepo    withdrawRepo;
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
@@ -56,5 +60,18 @@ public class WithdrawController extends BaseController {
         List<Withdraw> data = all(pageQuery).getContent();
         ExcelUtils.export(response, data);
     }
+
+    @PostMapping("/apply")
+    @ApiOperation("提现申请")
+    public Withdraw apply(BigDecimal amount, String realName, String account) {
+        return withdrawService.apply(SecurityUtils.getAuthenticatedUser().getId(), amount, realName, account);
+    }
+
+    @PostMapping("/audit")
+    @ApiOperation("提现审核")
+    public void audit(Long id, Boolean pass) {
+        withdrawService.audit(id, pass);
+    }
+
 }
 

+ 1 - 0
src/main/resources/genjson/Company.json

@@ -0,0 +1 @@
+{"tableName":"Company","className":"Company","remark":"企业信息","genTable":true,"genClass":true,"genList":true,"genForm":true,"genRouter":true,"javaPath":"/Users/qiufangchao/Desktop/project/jiashanxia/src/main/java/com/izouma/jiashanxia","viewPath":"/Users/qiufangchao/Desktop/project/jiashanxia/src/main/vue/src/views","routerPath":"/Users/qiufangchao/Desktop/project/jiashanxia/src/main/vue/src","resourcesPath":"/Users/qiufangchao/Desktop/project/jiashanxia/src/main/resources","dataBaseType":"Mysql","fields":[{"name":"name","modelName":"name","remark":"企业名称","showInList":true,"showInForm":true,"formType":"singleLineText"},{"name":"amount","modelName":"amount","remark":"企业余额","showInList":true,"showInForm":true,"formType":"number"}],"readTable":false,"dataSourceCode":"dataSource","genJson":"","subtables":[],"update":false,"basePackage":"com.izouma.jiashanxia","tablePackage":"com.izouma.jiashanxia.domain.Company"}

+ 16 - 0
src/main/vue/src/router.js

@@ -224,6 +224,22 @@ const router = new Router({
                     meta: {
                         title: '用户套餐流水'
                     }
+                },
+                {
+                    path: '/companyEdit',
+                    name: 'CompanyEdit',
+                    component: () => import(/* webpackChunkName: "companyEdit" */ '@/views/CompanyEdit.vue'),
+                    meta: {
+                        title: '团队信息编辑'
+                    }
+                },
+                {
+                    path: '/companyList',
+                    name: 'CompanyList',
+                    component: () => import(/* webpackChunkName: "companyList" */ '@/views/CompanyList.vue'),
+                    meta: {
+                        title: '团队信息'
+                    }
                 }
                 /**INSERT_LOCATION**/
             ]

+ 95 - 0
src/main/vue/src/views/CompanyEdit.vue

@@ -0,0 +1,95 @@
+<template>
+    <div class="edit-view">
+        <el-form
+            :model="formData"
+            :rules="rules"
+            ref="form"
+            label-width="80px"
+            label-position="right"
+            size="small"
+            style="max-width: 500px;"
+        >
+            <el-form-item prop="name" label="团队名称">
+                <el-input v-model="formData.name"></el-input>
+            </el-form-item>
+            <!--<el-form-item prop="amount" label="团队余额">
+                <el-input-number type="number" v-model="formData.amount"></el-input-number>
+            </el-form-item>-->
+            <el-form-item>
+                <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
+                <el-button @click="onDelete" :loading="saving" type="danger" v-if="formData.id">删除 </el-button>
+                <el-button @click="$router.go(-1)">取消</el-button>
+            </el-form-item>
+        </el-form>
+    </div>
+</template>
+<script>
+export default {
+    name: 'CompanyEdit',
+    created() {
+        if (this.$route.query.id) {
+            this.$http
+                .get('company/get/' + this.$route.query.id)
+                .then(res => {
+                    this.formData = res;
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.$message.error(e.error);
+                });
+        }
+    },
+    data() {
+        return {
+            saving: false,
+            formData: {},
+            rules: {}
+        };
+    },
+    methods: {
+        onSave() {
+            this.$refs.form.validate(valid => {
+                if (valid) {
+                    this.submit();
+                } else {
+                    return false;
+                }
+            });
+        },
+        submit() {
+            let data = { ...this.formData };
+
+            this.saving = true;
+            this.$http
+                .post('/company/save', data, { body: 'json' })
+                .then(res => {
+                    this.saving = false;
+                    this.$message.success('成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.saving = false;
+                    this.$message.error(e.error);
+                });
+        },
+        onDelete() {
+            this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+                .then(() => {
+                    return this.$http.post(`/company/del/${this.formData.id}`);
+                })
+                .then(() => {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    if (e !== 'cancel') {
+                        console.log(e);
+                        this.$message.error(e.error);
+                    }
+                });
+        }
+    }
+};
+</script>
+<style lang="less" scoped></style>

+ 180 - 0
src/main/vue/src/views/CompanyList.vue

@@ -0,0 +1,180 @@
+<template>
+    <div class="list-view">
+        <div class="filters-container">
+            <el-input placeholder="输入关键字" v-model="search" clearable class="filter-item"></el-input>
+            <el-button @click="getData" type="primary" icon="el-icon-search" class="filter-item">搜索 </el-button>
+            <el-button @click="addRow" type="primary" icon="el-icon-plus" class="filter-item">添加 </el-button>
+            <el-button
+                @click="download"
+                type="primary"
+                icon="el-icon-download"
+                :loading="downloading"
+                class="filter-item"
+                >导出EXCEL
+            </el-button>
+        </div>
+        <el-table
+            :data="tableData"
+            row-key="id"
+            ref="table"
+            header-row-class-name="table-header-row"
+            header-cell-class-name="table-header-cell"
+            row-class-name="table-row"
+            cell-class-name="table-cell"
+            :height="tableHeight"
+        >
+            <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
+            <el-table-column prop="id" label="ID" width="100"> </el-table-column>
+            <el-table-column prop="name" label="团队名称"> </el-table-column>
+            <el-table-column prop="amount" label="团队余额"> </el-table-column>
+            <el-table-column label="操作" align="center" fixed="right" min-width="150">
+                <template slot-scope="{ row }">
+                    <el-button @click="showEmployee(row)" type="success" size="mini" plain>员工</el-button>
+                    <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
+                    <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <!-- <div class="multiple-mode-wrapper">
+                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button @click="operation1">批量操作1</el-button>
+                    <el-button @click="operation2">批量操作2</el-button>
+                    <el-button @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div> -->
+            <el-pagination
+                background
+                @size-change="onSizeChange"
+                @current-change="onCurrentChange"
+                :current-page="page"
+                :page-sizes="[10, 20, 30, 40, 50]"
+                :page-size="pageSize"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="totalElements"
+            >
+            </el-pagination>
+
+            <el-dialog :visible.sync="userDialog" width="400px" title="员工列表">
+                <el-table :data="employee">
+                    <el-table-column label="昵称" prop="nickname"></el-table-column>
+                    <el-table-column label="时间" prop="createdAt"></el-table-column>
+                </el-table>
+            </el-dialog>
+        </div>
+    </div>
+</template>
+<script>
+import { mapState } from 'vuex';
+import pageableTable from '@/mixins/pageableTable';
+
+export default {
+    name: 'CompanyList',
+    mixins: [pageableTable],
+    data() {
+        return {
+            multipleMode: false,
+            search: '',
+            url: '/company/all',
+            downloading: false,
+            userDialog: false,
+            employee: []
+        };
+    },
+    computed: {
+        selection() {
+            return this.$refs.table.selection.map(i => i.id);
+        }
+    },
+    methods: {
+        beforeGetData() {
+            return { search: this.search };
+        },
+        toggleMultipleMode(multipleMode) {
+            this.multipleMode = multipleMode;
+            if (!multipleMode) {
+                this.$refs.table.clearSelection();
+            }
+        },
+        addRow() {
+            this.$router.push({
+                path: '/companyEdit',
+                query: {
+                    ...this.$route.query
+                }
+            });
+        },
+        editRow(row) {
+            this.$router.push({
+                path: '/companyEdit',
+                query: {
+                    id: row.id
+                }
+            });
+        },
+        download() {
+            this.downloading = true;
+            this.$axios
+                .get('/company/excel', {
+                    responseType: 'blob',
+                    params: { size: 10000 }
+                })
+                .then(res => {
+                    console.log(res);
+                    this.downloading = false;
+                    const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+                    const link = document.createElement('a');
+                    link.href = downloadUrl;
+                    link.setAttribute('download', res.headers['content-disposition'].split('filename=')[1]);
+                    document.body.appendChild(link);
+                    link.click();
+                    link.remove();
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.downloading = false;
+                    this.$message.error(e.error);
+                });
+        },
+        operation1() {
+            this.$notify({
+                title: '提示',
+                message: this.selection
+            });
+        },
+        operation2() {
+            this.$message('操作2');
+        },
+        deleteRow(row) {
+            this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+                .then(() => {
+                    return this.$http.post(`/company/del/${row.id}`);
+                })
+                .then(() => {
+                    this.$message.success('删除成功');
+                    this.getData();
+                })
+                .catch(e => {
+                    if (e !== 'cancel') {
+                        this.$message.error(e.error);
+                    }
+                });
+        },
+        showEmployee(row) {
+            this.userDialog = true;
+            this.$http
+                .post('/user/employee', {
+                    companyId: row.id
+                })
+                .then(res => {
+                    this.employee = res;
+                })
+                .catch(e => {
+                    console.log(e);
+                });
+        }
+    }
+};
+</script>
+<style lang="less" scoped></style>

+ 100 - 3
src/main/vue/src/views/UserEdit.vue

@@ -26,6 +26,24 @@
             <el-form-item prop="phone" label="手机">
                 <el-input v-model="formData.phone"></el-input>
             </el-form-item>
+            <el-form-item prop="companyId" label="团队">
+                <el-select
+                    v-model="formData.companyId"
+                    placeholder="请选择团队"
+                    style="width: 70%;"
+                    clearable
+                    v-if="!formData.teamFounder"
+                >
+                    <el-option v-for="item in companies" :key="item.id" :value="item.id" :label="item.name">
+                    </el-option>
+                </el-select>
+                <el-button style="margin-left: 20px" @click="showDialog = true" v-if="!formData.teamFounder">
+                    新建团队
+                </el-button>
+                <el-button @click="showEmployee" v-else>
+                    我的团队
+                </el-button>
+            </el-form-item>
             <el-form-item prop="authorities" label="角色">
                 <el-select
                     v-model="formData.authorities"
@@ -46,6 +64,25 @@
                 <el-button @click="$router.go(-1)">取消</el-button>
             </el-form-item>
         </el-form>
+
+        <el-dialog :visible.sync="showDialog" width="400px">
+            <el-form label-width="80px" label-position="right" size="small">
+                <el-form-item prop="setMealId" label="选择套餐">
+                    <el-select v-model="setMealId">
+                        <el-option v-for="item in setMeals" :key="item.id" :value="item.id" :label="item.name" />
+                    </el-select>
+                </el-form-item>
+            </el-form>
+            <div slot="footer">
+                <el-button type="primary" size="mini" @click="addCompany" :loading="saving">创建</el-button>
+            </div>
+        </el-dialog>
+        <el-dialog :visible.sync="userDialog" width="400px" title="员工列表">
+            <el-table :data="employee">
+                <el-table-column label="昵称" prop="nickname"></el-table-column>
+                <el-table-column label="时间" prop="createdAt"></el-table-column>
+            </el-table>
+        </el-dialog>
     </div>
 </template>
 <script>
@@ -70,12 +107,30 @@ export default {
             .catch(e => {
                 console.log(e);
             });
+        this.$http
+            .get('/company/allList')
+            .then(res => {
+                this.companies = res;
+            })
+            .catch(e => {
+                console.log(e);
+            });
+        this.$http
+            .get('/setMeal/team')
+            .then(res => {
+                this.setMeals = res;
+            })
+            .catch(e => {
+                console.log(e);
+            });
     },
     data() {
         return {
             saving: false,
             formData: {
-                avatar: 'https://zhumj.oss-cn-hangzhou.aliyuncs.com/image/user.jpg'
+                avatar: 'https://zhumj.oss-cn-hangzhou.aliyuncs.com/image/user.jpg',
+                teamFounder: false,
+                amount: 0
             },
             rules: {
                 avatar: [
@@ -96,9 +151,16 @@ export default {
                         trigger: 'blur'
                     }
                 ],
-                authorities: [{ required: true, message: '请选择角色', trigger: 'blur' }]
+                authorities: [{ required: true, message: '请选择角色', trigger: 'blur' }],
+                setMealId: [{ required: true, message: '请选择套餐', trigger: 'blur' }]
             },
-            authorities: []
+            authorities: [],
+            companies: [],
+            setMeals: [],
+            setMealId: '',
+            showDialog: false,
+            userDialog: false,
+            employee: []
         };
     },
     methods: {
@@ -166,6 +228,41 @@ export default {
                     }
                 })
                 .catch(() => {});
+        },
+        addCompany() {
+            this.showDialog = true;
+            this.$alert('确认要创建么?', '提醒', { type: 'error' })
+                .then(() => {
+                    return this.$http.post('/setMeal/openTeamSet', {
+                        userId: this.formData.id,
+                        setMealId: this.setMealId
+                    });
+                })
+                .then(() => {
+                    this.$message.success('创建成功');
+                    this.showDialog = false;
+                    this.saving = false;
+                })
+                .catch(e => {
+                    if (e !== 'cancel') {
+                        console.log(e);
+                        this.$message.error(e.error);
+                        this.saving = false;
+                    }
+                });
+        },
+        showEmployee() {
+            this.userDialog = true;
+            this.$http
+                .post('/company/employee', {
+                    userId: this.formData.id
+                })
+                .then(res => {
+                    this.employee = res;
+                })
+                .catch(e => {
+                    console.log(e);
+                });
         }
     }
 };

+ 39 - 0
src/main/vue/src/views/WithdrawList.vue

@@ -34,6 +34,27 @@
             <el-table-column prop="realName" label="真实姓名"> </el-table-column>
             <el-table-column label="操作" align="center" fixed="right" min-width="150">
                 <template slot-scope="{ row }">
+                    <template slot-scope="{ row }">
+                        <el-button
+                            v-if="row.status === 'PENDING'"
+                            :loading="row.loading"
+                            @click="audit(row, true)"
+                            type="primary"
+                            size="mini"
+                            plain
+                        >
+                            通过
+                        </el-button>
+                        <el-button
+                            v-if="row.status === 'PENDING'"
+                            @click="audit(row, false)"
+                            type="danger"
+                            size="mini"
+                            plain
+                        >
+                            拒绝
+                        </el-button>
+                    </template>
                     <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
                     <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
                 </template>
@@ -178,6 +199,24 @@ export default {
                         this.$message.error(e.error);
                     }
                 });
+        },
+        audit(row, pass) {
+            this.$set(row, 'loading', true);
+            this.$http
+                .get('/withdraw/audit', {
+                    id: row.id,
+                    pass: pass
+                })
+                .then(res => {
+                    this.$set(row, 'loading', false);
+                    this.$message.success('OK');
+                    this.getData();
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.$set(row, 'loading', false);
+                    this.$message.error(e.error);
+                });
         }
     }
 };

+ 35 - 0
src/test/java/com/izouma/jiashanxia/repo/UserSetFlowRepoTest.java

@@ -0,0 +1,35 @@
+package com.izouma.jiashanxia.repo;
+
+import com.alibaba.fastjson.JSONObject;
+import com.izouma.jiashanxia.domain.SetGoods;
+import com.izouma.jiashanxia.domain.UserSetFlow;
+import com.izouma.jiashanxia.dto.GoodsDTO;
+import com.izouma.jiashanxia.enums.FlowType;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.List;
+
+@SpringBootTest
+@RunWith(SpringRunner.class)
+public class UserSetFlowRepoTest {
+    @Autowired
+    private UserSetFlowRepo userSetFlowRepo;
+    @Autowired
+    private SetGoodsRepo    setGoodsRepo;
+
+    @Test
+    public void test() {
+        List<SetGoods> setGoodsList = setGoodsRepo.findAllBySetMealId(17L);
+        List<GoodsDTO> goodsDTOS = JSONObject.parseArray(JSONObject.toJSONString(setGoodsList), GoodsDTO.class);
+        String str = JSONObject.toJSONString(goodsDTOS);
+        userSetFlowRepo.save(UserSetFlow.builder()
+                .userId(2L)
+                .type(FlowType.BUY)
+                .content(str)
+                .build());
+    }
+}

+ 19 - 0
src/test/java/com/izouma/jiashanxia/service/CompanyServiceTest.java

@@ -0,0 +1,19 @@
+package com.izouma.jiashanxia.service;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@SpringBootTest
+@RunWith(SpringRunner.class)
+public class CompanyServiceTest {
+    @Autowired
+    private CompanyService companyService;
+
+    @Test
+    public void employee() {
+        companyService.employee(2L);
+    }
+}

+ 2 - 2
src/test/java/com/izouma/jiashanxia/service/OrderInfoServiceTest.java

@@ -16,11 +16,11 @@ public class OrderInfoServiceTest {
 
     @Test
     public void order() {
-        System.out.println(orderInfoService.order(2L, 17L, PayMethod.WEIXIN));
+        System.out.println(orderInfoService.creatOrder(46L, 17L, PayMethod.WEIXIN));
     }
 
     @Test
     public void completed() {
-        orderInfoService.completed(22L, "xxx");
+        orderInfoService.completed(47L, "11000001");
     }
 }

+ 22 - 0
src/test/java/com/izouma/jiashanxia/service/UserSetServiceTest.java

@@ -0,0 +1,22 @@
+package com.izouma.jiashanxia.service;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+
+@SpringBootTest
+@RunWith(SpringRunner.class)
+public class UserSetServiceTest {
+    @Autowired
+    public UserSetService userSetService;
+
+
+    @Test
+    public void test() {
+
+    }
+}