浏览代码

中台达人钱包问题

ldz 1 月之前
父节点
当前提交
585c2adea8

+ 8 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeUserMapper.java

@@ -7,10 +7,12 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.vo.LifeFansVo;
 import shop.alien.entity.store.vo.LifeUserVo;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -72,4 +74,10 @@ public interface LifeUserMapper extends BaseMapper<LifeUser> {
     @Select("SELECT * " +
             "FROM life_user ${ew.customSqlSegment}")
     LifeUserVo getUserById(@Param(Constants.WRAPPER) QueryWrapper<LifeUserVo> queryWrapper);
+
+    //updateUserWallet 添加用户钱包
+    @Update("update life_user set money = IFNULL(money, 0.00) + #{advance} where user_phone = #{userPhone} and delete_flag=0 ")
+    int updateUserWallet(@Param("advance") BigDecimal advance, @Param("userPhone") String userPhone);
+
+
 }

+ 6 - 4
alien-store/src/main/java/shop/alien/store/controller/LifeUserExpertController.java

@@ -15,6 +15,7 @@ import shop.alien.entity.store.vo.LifeUserExpertOrderVo;
 import shop.alien.entity.store.vo.LifeUserExpertVo;
 import shop.alien.store.service.LifeUserExpertService;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -170,12 +171,13 @@ public class LifeUserExpertController {
                         @ApiImplicitParam(name = "storeTel", value = "门店电话", dataType = "String", paramType = "query"),
                         @ApiImplicitParam(name = "orderNo", value = "订单号", dataType = "String", paramType = "query"),
                         @ApiImplicitParam(name = "orderMoney", value = "订单金额", dataType = "String", paramType = "query"),
-                        @ApiImplicitParam(name = "advancePaymentStatus", value = "预付款审核状态", dataType = "String", paramType = "query")
+                        @ApiImplicitParam(name = "advancePaymentStatus", value = "预付款审核状态", dataType = "String", paramType = "query"),
+                        @ApiImplicitParam(name = "advance", value = "预付款", dataType = "BigDecimal", paramType = "query"),
     })
     @GetMapping("/getAdvancePaymentReview")
-    public R <Map<String,String>> getAdvancePaymentReview(Integer id, String reasonRefusal, String userPhone, String name, String storeTel, String orderNo, String orderMoney, String advancePaymentStatus) {
-        log.info("LifeUserExpertController.getViewDetails?Id={},reasonRefusal{},userPhone{},name{},orderNo{},orderMoney{},advancePaymentStatus{}",id,reasonRefusal,userPhone,name,orderNo,orderMoney,advancePaymentStatus);
-        return R.data(lifeUserExpertService.getAdvancePaymentReview(id, reasonRefusal, userPhone, name,storeTel,orderNo,orderMoney,advancePaymentStatus));
+    public R <Map<String,String>> getAdvancePaymentReview(Integer id, String reasonRefusal, String userPhone, String name, String storeTel, String orderNo, String orderMoney, String advancePaymentStatus , BigDecimal advance) {
+        log.info("LifeUserExpertController.getViewDetails?Id={},reasonRefusal{},userPhone{},name{},orderNo{},orderMoney{},advancePaymentStatus{},advance{}",id,reasonRefusal,userPhone,name,orderNo,orderMoney,advancePaymentStatus, advance);
+        return R.data(lifeUserExpertService.getAdvancePaymentReview(id, reasonRefusal, userPhone, name,storeTel,orderNo,orderMoney,advancePaymentStatus,advance));
     }
 
     @ApiOperation("达人尾款列表")

+ 3 - 2
alien-store/src/main/java/shop/alien/store/controller/LifeUserExpertPurchaseController.java

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiOperationSupport;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
+import shop.alien.entity.result.R;
 import shop.alien.entity.store.LifeUserExpertPurchase;
 import shop.alien.store.service.LifeUserExpertPurchaseService;
 
@@ -37,9 +38,9 @@ public class LifeUserExpertPurchaseController {
     @ApiOperation("用户购买达人推广产品记录")
     @ApiOperationSupport(order = 2)
     @PostMapping("/purchaseTalentPromotedProductLog")
-    public Boolean purchaseTalentPromotedProductLog(@RequestBody LifeUserExpertPurchase lifeUserExpertPurchase) {
+    public R purchaseTalentPromotedProductLog(@RequestBody LifeUserExpertPurchase lifeUserExpertPurchase) {
         log.info("LifeUserExpertPurchaseController.purchaseTalentPromotedProduct?lifeUserExpertPurchase={}", lifeUserExpertPurchase);
-        return lifeUserExpertPurchaseService.purchaseTalentPromotedProductLog(lifeUserExpertPurchase);
+        return R.data(lifeUserExpertPurchaseService.purchaseTalentPromotedProductLog(lifeUserExpertPurchase));
     }
 
 }

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/LifeUserExpertPurchaseService.java

@@ -10,6 +10,6 @@ public interface LifeUserExpertPurchaseService extends IService<LifeUserExpertPu
 
     Map<String, Object> purchaseTalentPromotedProduct(LifeUserExpertPurchase lifeUserExpertPurchase);
 
-    Boolean purchaseTalentPromotedProductLog (LifeUserExpertPurchase lifeUserExpertPurchase);
+    int purchaseTalentPromotedProductLog (LifeUserExpertPurchase lifeUserExpertPurchase);
 
 }

+ 2 - 1
alien-store/src/main/java/shop/alien/store/service/LifeUserExpertService.java

@@ -9,6 +9,7 @@ import shop.alien.entity.store.vo.ExpertGoodsTypeVo;
 import shop.alien.entity.store.vo.LifeUserExpertOrderVo;
 import shop.alien.entity.store.vo.LifeUserExpertVo;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -50,7 +51,7 @@ public interface LifeUserExpertService extends IService<LifeUserExpert> {
 
     IPage<LifeUserExpertOrderVo> getAdvancePaymentList(Integer page, Integer size,String realName, String userPhone, String advancePaymentStatus, String orderCreatedTime, String orderEndTime ,String firstPayTime, String endPayTime,String name, Integer userId);
 
-    Map<String,String> getAdvancePaymentReview(Integer id,String reasonRefusal, String userPhone,String name,String storeTel,String orderNo, String orderMoney,String advancePaymentStatus);
+    Map<String,String> getAdvancePaymentReview(Integer id, String reasonRefusal, String userPhone, String name, String storeTel, String orderNo, String orderMoney, String advancePaymentStatus, BigDecimal advance);
 
     IPage<LifeUserExpertOrderVo> getFinalPaymentList(Integer page, Integer size,String realName, String userPhone, String advancePaymentStatus, String orderCreatedTime, String orderEndTime ,String firstPayTime,String endPayTime,String firstCompleteTime,String endCompleteTime,String createdEndPaymentTime,String endEndPaymentTime,String name, Integer userId);
 

+ 2 - 3
alien-store/src/main/java/shop/alien/store/service/impl/LifeUserExpertPurchaseServiceImpl.java

@@ -93,8 +93,7 @@ public class LifeUserExpertPurchaseServiceImpl extends ServiceImpl<LifeUserExper
     }
 
     @Override
-    public Boolean purchaseTalentPromotedProductLog(LifeUserExpertPurchase lifeUserExpertPurchase) {
-        int i=lifeUserExpertPurchaseMapper.insert(lifeUserExpertPurchase);
-        return i>0;
+    public int purchaseTalentPromotedProductLog(LifeUserExpertPurchase lifeUserExpertPurchase) {
+        return lifeUserExpertPurchaseMapper.insert(lifeUserExpertPurchase);
     }
 }

+ 8 - 7
alien-store/src/main/java/shop/alien/store/service/impl/LifeUserExpertServiceImpl.java

@@ -49,6 +49,7 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
     private final LifeUserExpertOrderMapper lifeUserExpertOrderMapper;
     private final LifeNoticeMapper lifeNoticeMapper;
     private final AliApi aliApi;
+    private final LifeUserMapper lifeUserMapper;
 
     @Override
     public IPage<LifeUserExpertVo> getUserExpertList(int page, int size, String userName, String expertCode, Integer userId , String userPhone) {
@@ -457,7 +458,7 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
     }
 
     @Override
-    public Map<String,String> getAdvancePaymentReview(Integer id,String reasonRefusal,String userPhone, String name,String storeTel,String orderNo, String orderMoney,String advancePaymentStatus) {
+    public Map<String,String> getAdvancePaymentReview(Integer id,String reasonRefusal,String userPhone, String name,String storeTel,String orderNo, String orderMoney,String advancePaymentStatus,BigDecimal advance) {
 
         Map<String,String> map = new HashMap<>();
         Integer advancePaymentStatu= Integer.valueOf(advancePaymentStatus);
@@ -475,12 +476,12 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
             String  phone = "user_"+userPhone;
             sendMessage(advancePaymentStatu,phone ,text,title);
             //把预付款添加到用户钱包中
-
-
-
-
-
-
+            int a=lifeUserMapper.updateUserWallet(advance,userPhone);
+            if (a<0){
+                map.put("codeMsg","预付款发放到钱包失败");
+                map.put("status","0");
+                return map;
+            }
             map.put("codeMsg","审核成功");
             map.put("status","0");
             return map;