Forráskód Böngészése

中台达人订单

ldz 1 hónapja
szülő
commit
b8995db3e9

+ 6 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserExpertOrderVo.java

@@ -30,6 +30,9 @@ public class LifeUserExpertOrderVo extends LifeUserExpertOrder {
     @ApiModelProperty(value = "实际播放量")
     private Integer actualPlayCount;
 
+    @ApiModelProperty(value = "播放量")
+    private Integer playCount;
+
     @ApiModelProperty(value = "状态名称")
     private String statusName;
 
@@ -124,4 +127,7 @@ public class LifeUserExpertOrderVo extends LifeUserExpertOrder {
 
     @ApiModelProperty(value = "尾款金额")
     private BigDecimal endPayment;
+
+    @ApiModelProperty(value = "成交金额")
+    private BigDecimal amount;
 }

+ 1 - 1
alien-entity/src/main/java/shop/alien/mapper/LifeUserExpertMapper.java

@@ -56,7 +56,7 @@ public interface LifeUserExpertMapper extends BaseMapper<LifeUserExpert> {
             "    group by expert_id " +
             ") " +
             "select expert.id, expert.expert_code, expert.promote_type,expert.add_explanation ,expert.expert_status, user.user_phone,user.user_name,user.id_card ,user.real_name,ifnull(fans.num, 0) fansNum, ifnull(dynamics.dynamicsNum, 0) worksNum, ifnull(dynamics.likeNum, 0) likeNum, ifnull(dynamics.transferNum,0) transferNum,ifnull(dynamics.playNum, 0) playNum, " +
-            "       ifnull(orders.orderMoney, 0) orderMoney, ifnull(orders.accountMoney, 0) accountMoney, (ifnull(orders.orderMoney, 0) - ifnull(orders.accountMoney, 0)) pendMoney ,ifnull(orders.orderMoney * orders.commission_rate/100, 0) commissionSum , ifnull(comment.commitCount, 0) commitCountSum " +
+            "       ifnull(orders.orderMoney, 0) orderMoney, ifnull(orders.accountMoney, 0) accountMoney, (ifnull(orders.orderMoney, 0) -ifnull(orders.orderMoney * orders.commission_rate/100, 0)- ifnull(orders.accountMoney, 0)) pendMoney ,ifnull(orders.orderMoney * orders.commission_rate/100, 0) commissionSum , ifnull(comment.commitCount, 0) commitCountSum " +
             "from life_user_expert expert " +
             "join life_user user on user.id = expert.user_id " +
             "left join fans on fans.followed_id = concat('user_', user.user_phone)  " +

+ 22 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeUserExpertOrderMapper.java

@@ -156,4 +156,26 @@ public interface LifeUserExpertOrderMapper extends BaseMapper<LifeUserExpertOrde
             "where package.id = #{id} and orders.delete_flag =0 and package.delete_flag=0 "
     )
     List<LifeUserExpertOrderVo> getStatus(@Param("id") Integer id);
+
+
+
+
+
+
+    @Select("WITH purchase AS (SELECT order_id, expert_order_id, SUM(CASE WHEN STATUS = 1 THEN 1 ELSE 0 END) AS completedOrdersNumber ,SUM(purchase_amount) AS amount  FROM life_user_expert_purchase WHERE delete_flag = 0 GROUP BY order_id) , " +
+            "works AS (SELECT order_id, dynamics_id, SUM(play_count) AS storeVisitViewCount ,sum(real_order_gmv) AS actualGmv ,sum(order_gmv) AS orderGmv FROM life_user_expert_works WHERE delete_flag = 0 GROUP BY order_id) " +
+            "SELECT orders.order_gmv , orders.order_play_count , "+
+            "IFNULL(purchase.completedOrdersNumber, 0) AS completedOrdersNumber ,  IFNULL(purchase.amount, 0) AS amount , " +
+            "IFNULL(works.storeVisitViewCount, 0) AS storeVisitViewCount , IFNULL(works.actualGmv, 0) AS actualGmv ,  IFNULL(works.orderGmv, 0) AS orderNewGmv, " +
+            "dy.liulan_count AS playCount, dy.reality_count AS actualPlayCount " +
+            "FROM life_user_expert_order AS orders " +
+            "LEFT JOIN purchase  ON purchase.expert_order_id = orders.id " +
+            "LEFT JOIN works ON works.order_id = orders.id " +
+            "LEFT JOIN life_user_dynamics dy  ON dy.id = works.dynamics_id  " +
+            "WHERE orders.id= #{id} and orders.delete_flag =0 "
+    )
+    LifeUserExpertOrderVo getDataDetails(@Param("id") Integer id);
+
+
+
 }

+ 1 - 1
alien-store/src/main/java/shop/alien/store/controller/LifePromotionPackageController.java

@@ -99,7 +99,7 @@ public class LifePromotionPackageController {
     @ApiOperation(value = "是否可以修改或者是删除达人套餐")
     @ApiOperationSupport(order = 6)
 //    @ApiImplicitParams(@ApiImplicitParam(name = "达人推广套餐表id", value = "id", dataType = "Integer", paramType = "query", required = true))
-    @PostMapping("/getStatus")
+    @GetMapping("/getStatus")
     public R<Map<String, String>> getStatus(@RequestParam("id") Integer id) {
         log.info("LifePromotionPackageController.getStatus?id={}", id);
         return R.data(promotionPackageService.getStatus(id));

+ 9 - 0
alien-store/src/main/java/shop/alien/store/controller/LifeUserExpertController.java

@@ -256,4 +256,13 @@ public class LifeUserExpertController {
         return R.data(lifeUserExpertService.updateProportion(id,commissionRate,advanceRate));
     }
 
+    @ApiOperation("查看数据明细")
+    @ApiOperationSupport(order = 17)
+    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "订单id", dataType = "Integer", paramType = "query", required = true)})
+    @GetMapping("/getDataDetails")
+    public R<LifeUserExpertOrderVo> getDataDetails( Integer id) {
+        log.info("LifeUserExpertController.getDataDetails?Id={}",id);
+        return R.data(lifeUserExpertService.getDataDetails(id));
+    }
+
 }

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

@@ -59,4 +59,6 @@ public interface LifeUserExpertService extends IService<LifeUserExpert> {
     IPage<LifeUserExpertOrderVo> getOrderList(Integer page, Integer size,String realName, String userPhone, String advancePaymentStatus, String orderCreatedTime, String orderEndTime ,String firstPayTime, String endPayTime,String name, Integer userId);
 
     Boolean updateProportion(Integer expertId, Integer commissionRate, Integer advanceRate);
+
+    LifeUserExpertOrderVo getDataDetails(Integer id);
 }

+ 12 - 0
alien-store/src/main/java/shop/alien/store/service/impl/LifeUserExpertServiceImpl.java

@@ -640,6 +640,7 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
 
         for (LifeUserExpertOrderVo lifeUserExpertOrderVo : list) {
             int advanceRate = lifeUserExpertOrderVo.getAdvanceRate();
+            int endPaymentRate = 100-advanceRate;
             int commissionRate = lifeUserExpertOrderVo.getCommissionRate();
             lifeUserExpertOrderVo.setOrderNewGmv(String.valueOf(lifeUserExpertOrderVo.getOrderGmv().setScale(2, BigDecimal.ROUND_HALF_UP)));
             BigDecimal commissionAmount = lifeUserExpertOrderVo.getOrderMoney().multiply(BigDecimal.valueOf(commissionRate))
@@ -647,8 +648,11 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
             BigDecimal difference = lifeUserExpertOrderVo.getOrderMoney().subtract(commissionAmount);
             BigDecimal advanceAmount = difference.multiply(BigDecimal.valueOf(advanceRate))
                     .divide(new BigDecimal(100));
+            BigDecimal endPayment =lifeUserExpertOrderVo.getOrderMoney().subtract(commissionAmount).subtract(advanceAmount) ;
             lifeUserExpertOrderVo.setAdvance(advanceAmount);
             lifeUserExpertOrderVo.setCommission(commissionAmount);
+            lifeUserExpertOrderVo.setEndPayment(endPayment);
+            lifeUserExpertOrderVo.setEndPaymentRate(endPaymentRate);
         }
         return ListToPage.setPage(list,page, size);
     }
@@ -662,5 +666,13 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
         return lifeUserExpertMapper.updateExpert(lifeUserExpert);
     }
 
+    @Override
+    public LifeUserExpertOrderVo getDataDetails(Integer id) {
+
+
+        return lifeUserExpertOrderMapper.getDataDetails(id);
+
+    }
+
 
 }