瀏覽代碼

修复查询问题提现记录新增详情功能

ljh 2 年之前
父節點
當前提交
22a8981c96

+ 4 - 0
core/src/main/java/com/mooctest/crowd/domain/domainobject/Balance.java

@@ -2,6 +2,7 @@ package com.mooctest.crowd.domain.domainobject;
 
 import lombok.Data;
 
+import javax.persistence.Column;
 import java.sql.Timestamp;
 import java.util.Date;
 
@@ -15,6 +16,9 @@ public class Balance {
     private String uname;
     private String cttcode;
     private String cttname;
+    private String subname;
+    private String number;
+    private String code;
     public final static int STATE_DEFAULT = 0;  //未提现
     public final static int STATE_COMMIT = 1;  //待审核
     public final static int STATE_AUDIT = 2;  //已审核

+ 12 - 1
core/src/main/java/com/mooctest/crowd/domain/model/BalancePO.java

@@ -39,10 +39,19 @@ public class BalancePO {
     @Column(name = "bal_task_name")
     private String cttname;
 
+    @Column(name="bal_number")
+    private String number;
+
+    @Column(name="bal_subname")
+    private String subname;
+
+    @Column(name = "bal_bc_code")
+    private  String code;
+
     public BalancePO() {
     }
 
-    public BalancePO(long id, long uid, String balvalue, Date baltime, int state,String uname,String cttcode,String cttname) {
+    public BalancePO(long id, long uid, String balvalue, Date baltime, int state,String uname,String cttcode,String cttname,String number,String code) {
         this.id = id;
         this.uid = uid;
         this.state = state;
@@ -51,6 +60,8 @@ public class BalancePO {
         this.uname = uname;
         this.cttcode = cttcode;
         this.cttname = cttname;
+        this.number = number;
+        this.code = code;
     }
 
 //    public static List<BookTestPO> getFakeData() {

+ 29 - 9
core/src/main/java/com/mooctest/crowd/domain/repository/BookTestRepo.java

@@ -32,6 +32,8 @@ public class BookTestRepo {
     private TaskToUserDao taskToUserDao;
     @Autowired
     private UserDao userDao;
+    @Autowired
+    private BankCardDao bankCardDao;
 
     public Page<BookTest> findAllBookTestByPage(Pageable pageable, Map<String, String> extraCondition, String keyword) {
         List<Condition> conditionList = new ArrayList<>();
@@ -134,6 +136,8 @@ public class BookTestRepo {
                         }
                         valueBuilder.append(projectPO.getCode());
                     }
+                }else{
+                    valueBuilder.append("ABCDEFGH");
                 }
             } else if (key.equals("cttcode")) {
                 List<CrowdTestTaskPO> list = crowdTestTaskDao.findByNameLike("%" + keyword + "%");
@@ -146,6 +150,8 @@ public class BookTestRepo {
                         }
                         valueBuilder.append(taskPO.getCode());
                     }
+                }else{
+                    valueBuilder.append("ABCDEFGH");
                 }
             }
             condition = new Condition(key, Condition.IN, valueBuilder.toString());
@@ -180,6 +186,11 @@ public class BookTestRepo {
         }
         return bookTest;
     }
+    public Balance findBalanceById(int id) {
+        BalancePO balancePO = balanceDao.findById(id);
+        Balance balance = Converter.convert(Balance.class, balancePO);
+        return balance;
+    }
 
     public Page<Balance> findAllBookTestByPage(Pageable pageable, Map<String, String> extraCondition) {
         Specifications<BalancePO> where = Specifications.where(Condition.getSpecification(new Condition("uid", Condition.EQ, extraCondition.get("userId"))));
@@ -231,16 +242,25 @@ public class BookTestRepo {
                     UserPO user = userDao.findById(uid).orElse(null);
                     //根据code找项目名字
                     CrowdTestTaskPO task = crowdTestTaskDao.findByCodeAndIsDeleted(cttcode, 0);
+                    //根据id找银行卡号
+                    List<BankCardPO> bankCardPOList  = bankCardDao.findByUserIdAndIsDeleted(uid,0);
                     if (taskToUser != null) {
-                        BalancePO balance = new BalancePO();
-                        balance.setUid(bookTest.getUid());
-                        balance.setUname(user == null ? "-" : user.getName());
-                        balance.setCttcode(taskToUser.getTaskCode());
-                        balance.setCttname(task.getName());
-                        balance.setBalvalue(taskToUser.getQuotedPrice() + "");
-                        balance.setBaltime(new Date());
-                        balance.setState(state);
-                        balanceDao.save(balance);
+                        if (bankCardPOList != null && bankCardPOList.size() > 0) {
+                            for (BankCardPO bankCardPO : bankCardPOList) {
+                                BalancePO balance = new BalancePO();
+                                balance.setNumber(bankCardPO.getNumber());
+                                balance.setCode(bankCardPO.getCode());
+                                balance.setSubname(bankCardPO.getSubName());
+                                balance.setUid(bookTest.getUid());
+                                balance.setUname(user == null ? "-" : user.getName());
+                                balance.setCttcode(taskToUser.getTaskCode());
+                                balance.setCttname(task.getName());
+                                balance.setBalvalue(taskToUser.getQuotedPrice() + "");
+                                balance.setBaltime(new Date());
+                                balance.setState(state);
+                                balanceDao.save(balance);
+                            }
+                        }
                     }
                 }
             }

+ 7 - 0
site/src/main/java/com/mooctest/crowd/site/controller/BookTestController.java

@@ -79,6 +79,13 @@ public class BookTestController extends BaseSearchController{
         return new ResponseVO<>(ServerCode.SUCCESS, bookTestService.getBookDetailed(id));
     }
     /**
+     * 提现记录查看详情功能
+     */
+    @RequestMapping(value = "/balanceDetail/{id}", method = RequestMethod.GET)
+    public ResponseVO<BalanceVO> getBalanceDetailed(@PathVariable("id") int id) {
+        return new ResponseVO<>(ServerCode.SUCCESS, bookTestService.getBalanceDetailed(id));
+    }
+    /**
      * 个人查看提现记录功能
      */
     @RequestMapping(value = "/balDetail", method = RequestMethod.POST)

+ 6 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/BalanceVO.java

@@ -23,6 +23,9 @@ public class BalanceVO implements Serializable {
     private String baltime;
     private String balvalue;
     private String cttname;
+    private String subname;
+    private String number;
+    private String code;
 
     public BalanceVO(Balance balance){
         id = balance.getId();
@@ -31,6 +34,9 @@ public class BalanceVO implements Serializable {
         balvalue = balance.getBalvalue();
         baltime = formatTime(balance.getBaltime());
         state = balance.getState();
+        subname = balance.getSubname();
+        number = balance.getNumber();
+        code = balance.getCode();
         formatStateName(state);
         cttname = balance.getCttname();
     }

+ 2 - 0
site/src/main/java/com/mooctest/crowd/site/service/BookTestService.java

@@ -1,5 +1,6 @@
 package com.mooctest.crowd.site.service;
 
+import com.mooctest.crowd.domain.domainobject.Balance;
 import com.mooctest.crowd.domain.domainobject.BookTest;
 import com.mooctest.crowd.site.data.dto.BalancePageDTO;
 import com.mooctest.crowd.site.data.dto.BookTestPageDTO;
@@ -19,6 +20,7 @@ public interface BookTestService {
     BookTestPageDTO getBookTestPageInfo(Pageable pageable, Map<String, String> extraCondition, String keyword, int deletedStatus);
     BookTestPageDTO getBookProjectTestPageInfo(Pageable pageable, Map<String, String> extraCondition, String keyword, int deletedStatus);
     BookTestVO getBookDetailed(int id);
+    BalanceVO getBalanceDetailed(int id);
     BalancePageDTO getBalDetailed(Pageable pageable, Map<String, String> extraCondition, int deletedStatus);
     BalancePageDTO getBalDetailedBycode(Pageable pageable, Map<String, String> extraCondition, int deletedStatus);
     int updateState(int id);

+ 6 - 0
site/src/main/java/com/mooctest/crowd/site/service/impl/BookTestServiceImpl.java

@@ -56,6 +56,12 @@ public class  BookTestServiceImpl implements BookTestService {
     }
 
     @Override
+    public BalanceVO getBalanceDetailed(int id) {
+        Balance balance = bookTestRepo.findBalanceById(id);
+        return new BalanceVO(balance);
+    }
+
+    @Override
     public BalancePageDTO getBalDetailed(Pageable pageable, Map<String, String> extraCondition, int deletedStatus) {
         BalancePageDTO balancePageDTO = new BalancePageDTO();
         balancePageDTO.setBalancePageDTOPage(bookTestRepo.findAllBookTestByPage(pageable,extraCondition).map(BalanceVO::new));