소스 검색

Merge remote-tracking branch 'origin/dev' into dev

zjy 1 개월 전
부모
커밋
634896c981
24개의 변경된 파일464개의 추가작업 그리고 83개의 파일을 삭제
  1. 1 1
      alien-entity/src/main/java/shop/alien/entity/second/SecondRiskControlRecord.java
  2. 7 10
      alien-entity/src/main/java/shop/alien/entity/second/SecondTradeOperation.java
  3. 9 0
      alien-entity/src/main/java/shop/alien/entity/store/LifeUserDynamics.java
  4. 12 0
      alien-entity/src/main/java/shop/alien/entity/store/LifeUserExpertOrder.java
  5. 10 0
      alien-entity/src/main/java/shop/alien/entity/store/LifeUserExpertWorks.java
  6. 5 0
      alien-entity/src/main/java/shop/alien/entity/store/LifeUserOrder.java
  7. 3 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyThaliVo.java
  8. 12 3
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserExpertVo.java
  9. 2 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserOrderVo.java
  10. 23 9
      alien-entity/src/main/java/shop/alien/mapper/LifeUserExpertMapper.java
  11. 4 0
      alien-entity/src/main/java/shop/alien/mapper/LifeUserOrderMapper.java
  12. 5 1
      alien-entity/src/main/resources/mapper/LifeUserExpertOrderMapper.xml
  13. 10 2
      alien-entity/src/main/resources/mapper/LifeUserOrderMapper.xml
  14. 2 2
      alien-entity/src/main/resources/mapper/ManagementInfoMapper.xml
  15. 9 0
      alien-second/src/main/java/shop/alien/second/platform/PlatformSecondTradeController.java
  16. 2 0
      alien-second/src/main/java/shop/alien/second/service/PlatformSecondTradeService.java
  17. 56 0
      alien-second/src/main/java/shop/alien/second/service/impl/PlatformSecondTradeServiceImpl.java
  18. 54 8
      alien-store/src/main/java/shop/alien/store/controller/LifeUserDynamicsController.java
  19. 48 10
      alien-store/src/main/java/shop/alien/store/controller/LifeUserExpertController.java
  20. 52 29
      alien-store/src/main/java/shop/alien/store/service/LifeUserDynamicsService.java
  21. 7 3
      alien-store/src/main/java/shop/alien/store/service/LifeUserExpertService.java
  22. 6 0
      alien-store/src/main/java/shop/alien/store/service/impl/LifeGroupBuyServiceImpl.java
  23. 70 3
      alien-store/src/main/java/shop/alien/store/service/impl/LifeUserExpertServiceImpl.java
  24. 55 2
      alien-store/src/main/java/shop/alien/store/service/impl/StoreCommentServiceImpl.java

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/second/SecondRiskControlRecord.java

@@ -33,7 +33,7 @@ public class SecondRiskControlRecord extends Model<SecondRiskControlRecord> {
     @ApiModelProperty(value = "规则名称")
     private String ruleName;
 
-    @TableField("rule_type")
+    @TableField("risk_status")
     @ApiModelProperty(value = "风控执行状态 0 未执行,1-已执行 2-已忽略")
     private Integer riskStatus;
 

+ 7 - 10
alien-entity/src/main/java/shop/alien/entity/second/SecondTradeOperation.java

@@ -1,9 +1,6 @@
 package shop.alien.entity.second;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
@@ -41,21 +38,21 @@ public class SecondTradeOperation extends Model<SecondTradeOperation> {
     @ApiModelProperty(value = "删除标记 0:未删除 1:已删除")
     private Integer deleteFlag;
 
-    @TableField("created_time")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
     private Date createdTime;
 
-    @TableField("created_user_id")
     @ApiModelProperty(value = "创建人ID")
+    @TableField(value = "created_user_id", fill = FieldFill.INSERT)
     private Integer createdUserId;
 
-    @TableField("updated_time")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty(value = "修改时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
     private Date updatedTime;
 
-    @TableField("updated_user_id")
     @ApiModelProperty(value = "修改人ID")
+    @TableField(value = "updated_user_id", fill = FieldFill.INSERT_UPDATE)
     private Integer updatedUserId;
 }

+ 9 - 0
alien-entity/src/main/java/shop/alien/entity/store/LifeUserDynamics.java

@@ -118,6 +118,10 @@ public class LifeUserDynamics {
     @TableField("order_gmv")
     private BigDecimal orderGmv;
 
+    @ApiModelProperty(value = "达人id")
+    @TableField("expert_id")
+    private Integer expertId;
+
     @ApiModelProperty(value = "业务id")
     @TableField("business_id")
     private Integer businessId;
@@ -125,4 +129,9 @@ public class LifeUserDynamics {
     @ApiModelProperty(value = "根据动态进入店铺详情浏览数")
     @TableField("store_count")
     private Integer storeCount;
+
+
+    @ApiModelProperty(value = "转发量")
+    @TableField("transfer_count")
+    private Integer transferCount;
 }

+ 12 - 0
alien-entity/src/main/java/shop/alien/entity/store/LifeUserExpertOrder.java

@@ -142,4 +142,16 @@ public class LifeUserExpertOrder extends Model<LifeUserExpertOrder> {
     @ApiModelProperty(value = "支付时间")
     @TableField("pay_time")
     private Date payTime;
+
+    @ApiModelProperty(value = "退款时间")
+    @TableField("refund_time")
+    private Date refundTime;
+
+    @ApiModelProperty(value = "佣金比例 ")
+    @TableField(value = "commission_rate")
+    private Integer commissionRate;
+
+    @ApiModelProperty(value = "预付款比例 ")
+    @TableField(value = "advance_rate")
+    private Integer advanceRate;
 }

+ 10 - 0
alien-entity/src/main/java/shop/alien/entity/store/LifeUserExpertWorks.java

@@ -2,6 +2,8 @@ package shop.alien.entity.store;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+
+import java.math.BigDecimal;
 import java.util.Date;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.FieldFill;
@@ -86,4 +88,12 @@ public class LifeUserExpertWorks extends Model<LifeUserExpertWorks> {
     @TableField(value = "updated_user_id", fill = FieldFill.INSERT_UPDATE)
     private Integer updatedUserId;
 
+    @ApiModelProperty(value = "gmv")
+    @TableField(value = "order_gmv")
+    private BigDecimal orderGmv;
+
+    @ApiModelProperty(value = "动态id")
+    @TableField(value = "dynamics_id")
+    private Integer dynamicsId;
+
 }

+ 5 - 0
alien-entity/src/main/java/shop/alien/entity/store/LifeUserOrder.java

@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -92,4 +93,8 @@ public class LifeUserOrder {
     @ApiModelProperty(value = "核销发送优惠券(0:未发送,1:已发送)")
     @TableField("send_discount_coupon_flag")
     private Integer sendDiscountCouponFlag;
+
+    @ApiModelProperty(value = "默认0 通过gmv链接购买为 1")
+    @TableField("order_gmv")
+    private Integer orderGmv;
 }

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyThaliVo.java

@@ -256,4 +256,7 @@ public class LifeGroupBuyThaliVo {
     @ApiModelProperty(value = "是否收藏")
     private String isCollect;
 
+    @ApiModelProperty(value = "已售数量")
+    private Integer saleNum;
+
 }

+ 12 - 3
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserExpertVo.java

@@ -51,6 +51,9 @@ public class LifeUserExpertVo extends LifeUserExpert {
     @ApiModelProperty(value = "点赞数量")
     private Integer likeNum;
 
+    @ApiModelProperty(value = "评论数量")
+    private Integer commitCountSum;
+
     @ApiModelProperty(value = "平均播放量")
     private Integer averagePlayNum;
 
@@ -63,14 +66,20 @@ public class LifeUserExpertVo extends LifeUserExpert {
     @ApiModelProperty(value = "平均分享量")
     private Integer averageShareCount;
 
+    @ApiModelProperty(value = "分享量")
+    private Integer transferNum;
+
     @ApiModelProperty(value = "总推广金额")
-    private Integer orderMoney;
+    private double orderMoney;
 
     @ApiModelProperty(value = "已打款金额")
-    private Integer accountMoney;
+    private double accountMoney;
 
     @ApiModelProperty(value = "待打款金额")
-    private Integer pendMoney;
+    private double pendMoney;
+
+    @ApiModelProperty(value = "佣金总额")
+    private double commissionSum;
 
     @ApiModelProperty(value = "省")
     private String province;

+ 2 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserOrderVo.java

@@ -77,6 +77,8 @@ public class LifeUserOrderVo {
 
     private Integer collectNum;
 
+    private String storeUserTel;
+
     private String storeTel;
     @ApiModelProperty(value = "团购/代金券优惠金额")
     private String offprice;

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

@@ -30,24 +30,38 @@ public interface LifeUserExpertMapper extends BaseMapper<LifeUserExpert> {
             "    where delete_flag = 0 " +
             "    group by followed_id " +
             "), " +
-            "works as ( " +
-            "    select expert_id, count(id) worksNum, sum(like_count) likeNum, sum(play_count) playNum " +
-            "    from life_user_expert_works " +
+//            "works as ( " +
+//            "    select expert_id, count(id) worksNum, sum(like_count) likeNum, sum(play_count) playNum ,sum(comment_count) commentNum, sum(share_count) shareNum" +
+//            "    from life_user_expert_works " +
+//            "    where delete_flag = 0 " +
+//            "    group by expert_id " +
+//            "), " +
+            "dynamics as ( " +
+            "    select  phone_id,count(id) dynamicsNum, sum(liulan_count) playNum, id,sum(transfer_count) transferNum,sum(dianzan_count) likeNum " +
+            "    from life_user_dynamics " +
             "    where delete_flag = 0 " +
-            "    group by expert_id " +
+            "    group by phone_id " +
             "), " +
+            "comment as ( " +
+            "    select business_id,count( id ) commitCount " +
+            "    from store_comment " +
+            "    where delete_flag = 0 " +
+            "    GROUP BY business_id " +
+            "), " +
+
             "orders as ( " +
-            "    select expert_id, sum(order_money) orderMoney, sum(account_money) accountMoney " +
-            "    from alien.life_user_expert_order " +
+            "    select expert_id,commission_rate, sum(order_money) orderMoney ,sum(account_money) accountMoney  " +
+            "    from life_user_expert_order " +
             "    where delete_flag = 0 " +
             "    group by expert_id " +
             ") " +
-            "select expert.id, expert.expert_code,expert.expert_status, user.user_phone,user.user_name, ifnull(fans.num, 0) fansNum, ifnull(works.worksNum, 0) worksNum, ifnull(works.likeNum, 0) likeNum, ifnull(works.playNum, 0) playNum, " +
-            "       ifnull(orders.orderMoney, 0) orderMoney, ifnull(orders.accountMoney, 0) accountMoney, (ifnull(orders.orderMoney, 0) - ifnull(orders.accountMoney, 0)) pendMoney " +
+            "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),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 " +
             "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)  " +
-            "left join works on works.expert_id = expert.id " +
+            "left join dynamics on concat('user_', dynamics.phone_id)= user.user_phone " +
+            "left join comment on comment.business_id = dynamics.id " +
             "left join orders on orders.expert_id = expert.id " +
             "${ew.customSqlSegment}")
     IPage<LifeUserExpertVo> getUserExpertList(IPage<LifeUserExpertVo> iPage, @Param(Constants.WRAPPER) QueryWrapper<LifeUserExpertVo> wrapper);

+ 4 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeUserOrderMapper.java

@@ -1,6 +1,7 @@
 package shop.alien.mapper;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
@@ -71,4 +72,7 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
      * @return
      */
     List<LifeUserOrderVo> selectRefundList(@Param(Constants.WRAPPER) QueryWrapper<LifeUserOrder> selectWrapper);
+
+    @Select("SELECT count( luo.id ) FROM life_user_order luo LEFT JOIN order_coupon_middle ocm ON luo.id = ocm.order_id WHERE luo.`status` IN ( 0, 1, 2, 7 ) AND luo.delete_flag = 0 AND luo.coupon_type = 2 AND ocm.coupon_id = #{groupId}")
+    Integer countBuyGroup(@Param("groupId") String groupId);
 }

+ 5 - 1
alien-entity/src/main/resources/mapper/LifeUserExpertOrderMapper.xml

@@ -32,12 +32,16 @@
         <result column="end_funds_time" property="endFundsTime" />
         <result column="end_payment_time" property="endPaymentTime" />
         <result column="end_payment_refusal" property="endPaymentRefusal" />
+        <result column="pay_time" property="payTime" />
+        <result column="refund_time" property="refundTime" />
+        <result column="commission_rate" property="commissionRate" />
+        <result column="advance_rate" property="advanceRate" />
 
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, order_id, expert_id, package_id , store_id, order_money, account_money, order_time, complete_time, first_payment_time, final_payment_time, order_play_count, order_gmv, actual_gmv, status, delete_flag, created_time, created_user_id, updated_time, updated_user_id, advance_payment_status, end_funds_button ,reason_refusal,advancePaymentTime,endFundsTime,endPaymentTime,endPaymentRefusal
+        id, order_id, expert_id, package_id , store_id, order_money, account_money, order_time, complete_time, first_payment_time, final_payment_time, order_play_count, order_gmv, actual_gmv, status, delete_flag, created_time, created_user_id, updated_time, updated_user_id, advance_payment_status, end_funds_button ,reason_refusal,advancePaymentTime,endFundsTime,endPaymentTime,endPaymentRefusal,payTime,refundTime,commission_rate,advance_rate
     </sql>
 
 </mapper>

+ 10 - 2
alien-entity/src/main/resources/mapper/LifeUserOrderMapper.xml

@@ -45,7 +45,6 @@
         <result column="type" property="type"/>
         <result column="store_type" property="storeType"/>
         <result column="store_status" property="storeStatus"/>
-
         <result column="business_type" property="businessType"/>
         <result column="collect_num" property="collectNum"/>
         <result column="business_date" property="businessDate"/>
@@ -55,6 +54,7 @@
         <result column="reservation_rules" property="reservationRules"/>
         <result column="original_price" property="originalPrice"/>
         <result column="order_str" property="orderStr"/>
+        <result column="store_user_tel" property="storeUserTel"/>
 
         <collection property="orderCouponMiddleList" ofType="shop.alien.entity.store.vo.OrderCouponMiddleVo">
             <id column="ocmId" property="id" />
@@ -79,13 +79,20 @@
                0 effective_date_type,expiration_date effective_date_value,use_rule use_rules,reservation_rules,applicable_num,1 quota_type,buy_limit quota_value,single_qty
         from life_coupon lc where lc.delete_flag = 0
         )
-        select luo.id,luo.order_no,luo.created_time , luo.price ,luo.final_price,luo.order_str,
+        select luo.id,luo.order_no,luo.created_time , luo.price ,
+        CASE
+        WHEN luo.final_price IS NOT NULL AND luo.final_price != '' THEN
+        FORMAT(CAST(luo.final_price AS DECIMAL(10,2)), 2)
+        ELSE '0.00'
+        END as final_price,
+        luo.order_str,
         luo.pay_method,luo.buy_time,luo.cancel_time,luo.pay_time,luo.finish_time,luo.status order_status,luo.quan_id,luo.refund_time total_refund_time,
         tc.*,
         ldc.nominal_value,ldc.type,
         lu.user_phone,lu.user_name,lu.id user_id,
         ocm.id ocmId,ocm.status,ocm.coupon_code,ocm.refund_time,ocm.refund_reason,ocm.price refundPrice,
         si.id store_id,si.store_name,si.commission_rate,si.store_address,si.store_tel,si.business_status,si.collect_num,si.business_section store_type,si.store_status,
+        su.phone store_user_tel,
         <if test="position != null and position != ''">
             ROUND(
             ST_Distance_Sphere(
@@ -106,6 +113,7 @@
         left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0
         left join store_img simg on simg.id = tc.image_id and simg.delete_flag = 0
         left join store_business_info sbi on sbi.store_id = si.id and sbi.delete_flag = 0
+        left join store_user su on su.store_id = si.id and su.delete_flag = 0
         where luo.id = #{orderId}
         order by luo.created_time desc
     </select>

+ 2 - 2
alien-entity/src/main/resources/mapper/ManagementInfoMapper.xml

@@ -810,8 +810,8 @@
                 AND store.store_name like concat('%',#{storeName},'%')
             </if>
         </where>
-        ORDER BY
-        `order`.created_time DESC
+        GROUP by `order`.`id`
+        ORDER BY `order`.created_time DESC
     </select>
     <select id="getRefundAmount" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
         SELECT

+ 9 - 0
alien-second/src/main/java/shop/alien/second/platform/PlatformSecondTradeController.java

@@ -73,4 +73,13 @@ public class PlatformSecondTradeController {
         return R.data(secondTradeRecordService.getTradeRecordListByRiskId(id));
     }
 
+    @ApiOperation("封禁账号取消交易")
+    @ApiOperationSupport(order = 7)
+    @GetMapping("/bannedAccountCancelTrade")
+    public R<Boolean> bannedAccountCancelTrade(Integer userId) throws Exception {
+        log.info("PlatformSecondTradeController.bannedAccountCancelTrade?userId={}", userId);
+        secondTradeRecordService.bannedAccountCancelTrade(userId);
+        return R.success("操作成功");
+    }
+
 }

+ 2 - 0
alien-second/src/main/java/shop/alien/second/service/PlatformSecondTradeService.java

@@ -25,4 +25,6 @@ public interface PlatformSecondTradeService extends IService<SecondTradeRecord>
     void setTradeFailure(Integer tradeId, String failureReason) throws Exception;
 
     List<SecondTradeRecordVo> getTradeRecordListByRiskId(Integer id) throws Exception;
+
+    void bannedAccountCancelTrade(Integer userId) throws Exception;
 }

+ 56 - 0
alien-second/src/main/java/shop/alien/second/service/impl/PlatformSecondTradeServiceImpl.java

@@ -3,16 +3,19 @@ package shop.alien.second.service.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import shop.alien.entity.second.SecondRiskControlRecord;
 import shop.alien.entity.second.SecondTradeOperation;
 import shop.alien.entity.second.SecondTradeRecord;
@@ -23,6 +26,7 @@ import shop.alien.mapper.second.SecondTradeRecordMapper;
 import shop.alien.second.service.PlatformSecondTradeService;
 import shop.alien.second.service.SecondGoodsService;
 
+import java.time.LocalDate;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
@@ -326,4 +330,56 @@ public class PlatformSecondTradeServiceImpl extends ServiceImpl<SecondTradeRecor
         }
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void bannedAccountCancelTrade(Integer userId) throws Exception {
+        try {
+            // 查询封禁信息
+            LambdaQueryWrapper<SecondRiskControlRecord> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(SecondRiskControlRecord::getUserId, userId);
+            wrapper.eq(SecondRiskControlRecord::getRuleType, 1);
+            wrapper.eq(SecondRiskControlRecord::getRiskStatus, 0);
+            List<SecondRiskControlRecord> list = secondRiskControlRecordMapper.selectList(wrapper);
+            List<String> infoList = list.stream().map(SecondRiskControlRecord::getDetailInfo).collect(Collectors.toList());
+            List<JSONArray> array = infoList.stream().map(JSONArray::parseArray).collect(Collectors.toList());
+            List<Integer> idList = new ArrayList<>();
+            for (JSONArray item : array) {
+                idList.addAll(item.toJavaList(Integer.class));
+            }
+            idList = idList.stream().distinct().collect(Collectors.toList());
+
+            // 查询需要取消的交易信息
+            LambdaQueryWrapper<SecondTradeRecord> wrapper1 = new LambdaQueryWrapper<>();
+            List<Integer> finalIdList = idList;
+            wrapper1.eq(SecondTradeRecord::getTradeStatus, 3)
+                    .and(item -> item.in(SecondTradeRecord::getId, finalIdList)
+                            .or(io -> io.eq(SecondTradeRecord::getSellerId, userId)
+                                    .between(SecondTradeRecord::getTransactionTime, LocalDate.now() + " 00:00:00", LocalDate.now().plusDays(7) + " 23:59:59")));
+//                    .or(item -> item.eq(SecondTradeRecord::getSellerId, userId)
+//                            .between(SecondTradeRecord::getTransactionTime, LocalDate.now() + " 00:00:00", LocalDate.now().plusDays(7) + " 23:59:59"));
+            List<SecondTradeRecord> tradeList = secondTradeRecordMapper.selectList(wrapper1);
+            List<Integer> tradeIds = tradeList.stream().map(SecondTradeRecord::getId).distinct().collect(Collectors.toList());
+
+            if (CollectionUtil.isEmpty(tradeIds)) return;
+
+            // 取消交易
+            LambdaUpdateWrapper<SecondTradeRecord> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.in(SecondTradeRecord::getId, tradeIds);
+            updateWrapper.set(SecondTradeRecord::getTradeStatus, 6);
+            secondTradeRecordMapper.update(null, updateWrapper);
+
+            // 添加交易操作记录
+            for (Integer id : tradeIds) {
+                SecondTradeOperation operation = new SecondTradeOperation();
+                operation.setTradeId(id);
+                operation.setUserId(0);
+                operation.setType(7);
+                secondTradeOperationMapper.insert(operation);
+            }
+        } catch (Exception e) {
+            log.error("PlatformSecondTradeServiceImpl.bannedAccountCancelTrade(): Error Msg={}", e.getMessage());
+            throw new Exception(e);
+        }
+    }
+
 }

+ 54 - 8
alien-store/src/main/java/shop/alien/store/controller/LifeUserDynamicsController.java

@@ -1,5 +1,6 @@
 package shop.alien.store.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -10,10 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
-import shop.alien.entity.store.LifeBrowseRecord;
-import shop.alien.entity.store.LifeUserDynamics;
+import shop.alien.entity.store.*;
 import shop.alien.entity.store.vo.LifePinglunVo;
 import shop.alien.entity.store.vo.LifeUserDynamicsVo;
+import shop.alien.mapper.LifeUserExpertOrderMapper;
+import shop.alien.mapper.LifeUserExpertWorksMapper;
 import shop.alien.store.service.LifeUserDynamicsService;
 import shop.alien.util.common.ListToPage;
 import shop.alien.util.common.safe.*;
@@ -33,6 +35,11 @@ public class LifeUserDynamicsController {
 
     private final LifeUserDynamicsService lifeUserDynamicsService;
 
+    private final LifeUserExpertWorksMapper lifeUserExpertWorksMapper;
+
+    private final LifeUserExpertOrderMapper lifeUserExpertOrderMapper;
+
+
     @Autowired
     private TextModerationUtil textModerationUtil;
 
@@ -106,7 +113,27 @@ public class LifeUserDynamicsController {
                 return R.data(3);
             }
             lifeUserDynamics.setUpdatedTime(new Date());
-            int cnt = lifeUserDynamicsService.addOrUpdateStore(lifeUserDynamics);
+            int cnt = 0;
+            if(lifeUserDynamics.getType().equals(4)){
+                cnt = lifeUserDynamicsService.addOrUpdateStore(lifeUserDynamics);
+                if(cnt > 0){
+                        LifeUserExpertOrder lifeUserExpertOrder = lifeUserExpertOrderMapper.selectById(new LambdaQueryWrapper<LifeUserExpertOrder>()
+                                .eq(LifeUserExpertOrder :: getId, lifeUserDynamics.getBusinessId()));
+                        if(lifeUserExpertOrder !=null){
+                            lifeUserExpertOrder.setStatus(4);
+                            lifeUserExpertOrderMapper.updateById(lifeUserExpertOrder);
+                        }
+                        LifeUserExpertWorks lifeUserExpertWorks = new LifeUserExpertWorks();
+                        lifeUserExpertWorks.setExpertId(lifeUserDynamics.getExpertId());
+                        lifeUserExpertWorks.setOrderId(lifeUserDynamics.getBusinessId());
+                        lifeUserExpertWorks.setWorksUrl(lifeUserDynamics.getImagePath());
+                        lifeUserExpertWorks.setIntroduction(lifeUserDynamics.getContext());
+                        lifeUserExpertWorks.setDynamicsId(lifeUserDynamics.getId());
+                        lifeUserExpertWorksMapper.insert(lifeUserExpertWorks);
+                }
+            }else{
+                cnt = lifeUserDynamicsService.addOrUpdateStore(lifeUserDynamics);
+            }
             if (cnt == 0) {
                 return R.data(1);
             }
@@ -249,15 +276,19 @@ public class LifeUserDynamicsController {
     }
 
 
-    @ApiOperation("GVM推荐用户完成支付")
+    @ApiOperation("GMV用户购买推荐店铺订单")
     @ApiOperationSupport(order = 7)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "dynamicsId", value = "达人动态Id", dataType = "Integer", paramType = "query", required = true),
-            @ApiImplicitParam(name = "finalPrice", value = "最终付款金额", dataType = "String", paramType = "query", required = true)})
+            @ApiImplicitParam(name = "finalPrice", value = "最终付款金额", dataType = "String", paramType = "query", required = true),
+            @ApiImplicitParam(name = "orderId", value = "用户订单id", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "expertId", value = "达人id", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "expertOrderId", value = "达人订单id", dataType = "Integer", paramType = "query", required = true)
+    })
     @GetMapping("/getOrderGmvUser")
-    public R getOrderGmvUser(@RequestParam() Integer dynamicsId, @RequestParam() String finalPrice) {
-        log.info("LifeUserDynamicsController.getOrderGmvUser?dynamicsId={}&finalPrice={}", dynamicsId, finalPrice);
-        return R.data(lifeUserDynamicsService.countGvm(dynamicsId, finalPrice));
+    public R getOrderGmvUser(@RequestParam() Integer dynamicsId, @RequestParam() String finalPrice, @RequestParam() Integer orderId, @RequestParam() Integer expertId, @RequestParam() Integer expertOrderId) {
+        log.info("LifeUserDynamicsController.getOrderGmvUser?dynamicsId={}&finalPrice={}&userId={}&expertId={}expertOrderId", dynamicsId, finalPrice, orderId, expertId, expertOrderId);
+        return R.data(lifeUserDynamicsService.countGvm(dynamicsId, finalPrice, orderId, expertId, expertOrderId));
     }
 
     @ApiOperation("用户通过达人推广进入店铺浏览数")
@@ -268,4 +299,19 @@ public class LifeUserDynamicsController {
         return R.data(lifeUserDynamicsService.addUserStoreBrowseNumber(lifeBrowseRecord));
     }
 
+    /**
+     * 动态被转发次数+1
+     * @param id 动态id
+     * @return 操作结果
+     */
+    @ApiOperation("动态被转发次数+1")
+    @ApiOperationSupport(order = 9)
+    @GetMapping("addTransferCount")
+    public R addTransferCount(String id) {
+        log.info("LifeUserDynamicsController.addTransferCount?id={}", id);
+        if (lifeUserDynamicsService.addTransferCount(id) == 0){
+            return R.fail("操作失败");
+        }
+        return R.success("操作成功");
+    }
 }

+ 48 - 10
alien-store/src/main/java/shop/alien/store/controller/LifeUserExpertController.java

@@ -15,7 +15,6 @@ 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;
 
@@ -35,11 +34,12 @@ public class LifeUserExpertController {
             @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true),
             @ApiImplicitParam(name = "userName", value = "姓名", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "exportCode", value = "达人码", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "userPhone", value = "手机号", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "userId", value = "用户id", dataType = "String", paramType = "query")})
     @GetMapping("/getUserExpertList")
-    public R<IPage<LifeUserExpertVo>> getUserExpertList(Integer page, Integer size, String userName, String expertCode, Integer userId) {
-        log.info("LifeUserExpertController.getUserExpertList?page={},size={},userName={},phone={},userId={}", page, size, userName, expertCode, userId);
-        return R.data(lifeUserExpertService.getUserExpertList(page, size, userName, expertCode, userId));
+    public R<IPage<LifeUserExpertVo>> getUserExpertList(Integer page, Integer size, String userName, String expertCode, Integer userId,String userPhone) {
+        log.info("LifeUserExpertController.getUserExpertList?page={},size={},userName={},phone={},userId={},userPhone{}", page, size, userName, expertCode, userId, userPhone);
+        return R.data(lifeUserExpertService.getUserExpertList(page, size, userName, expertCode, userId, userPhone));
     }
 
     @ApiOperation("订单列表")
@@ -147,15 +147,17 @@ public class LifeUserExpertController {
             @ApiImplicitParam(name = "advancePaymentStatus", value = "预付款审核状态", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "orderCreatedTime", value = "下单开始时间", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "orderEndTime", value = "下单结束时间", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "firstPayTime", value = "支付开始时间", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "endPayTime", value = "支付结束时间", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "name", value = "套餐名称", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "orderNo", value = "订单编号", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "storeName", value = "商家昵称", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "userId", value = "用户id", dataType = "String", paramType = "query")
     })
     @GetMapping("/getAdvancePaymentList")
-    public R<IPage<LifeUserExpertOrderVo>> getAdvancePaymentList( Integer page, Integer size,String realName, String userPhone, String advancePaymentStatus, String orderCreatedTime, String orderEndTime ,String name, Integer userId) {
+    public R<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) {
         log.info("LifeUserExpertController.getViewDetails?userId={}",userId);
-        return R.data(lifeUserExpertService.getAdvancePaymentList(page, size, realName, userPhone, advancePaymentStatus, orderCreatedTime, orderEndTime, name, userId));
+        return R.data(lifeUserExpertService.getAdvancePaymentList(page, size, realName, userPhone, advancePaymentStatus, orderCreatedTime, orderEndTime,  firstPayTime, endPayTime,name, userId));
     }
 
 
@@ -185,8 +187,8 @@ public class LifeUserExpertController {
             @ApiImplicitParam(name = "endFundsButton", value = "申请尾款按钮状态(审核状态)", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "orderCreatedTime", value = "下单开始时间", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "orderEndTime", value = "下单结束时间", dataType = "String", paramType = "query"),
-            @ApiImplicitParam(name = "orderCreatedTime", value = "支付开始时间", dataType = "String", paramType = "query"),
-            @ApiImplicitParam(name = "orderEndTime", value = "支付结束时间", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "firstPayTime", value = "支付开始时间", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "endPayTime", value = "支付结束时间", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "firstCompleteTime", value = "开始完成时间", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "endCompleteTime", value = "结束完成时间", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "createdEndPaymentTime", value = "开始申请时间", dataType = "String", paramType = "query"),
@@ -197,9 +199,9 @@ public class LifeUserExpertController {
             @ApiImplicitParam(name = "userId", value = "用户id", dataType = "String", paramType = "query")
     })
     @GetMapping("/getFinalPaymentList")
-    public R<IPage<LifeUserExpertOrderVo>> getFinalPaymentList( Integer page, Integer size,String realName, String userPhone, String advancePaymentStatus, String orderCreatedTime, String orderEndTime ,String firstCompleteTime,String endCompleteTime,String createdEndPaymentTime,String endEndPaymentTime,String name, Integer userId) {
+    public R<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) {
         log.info("LifeUserExpertController.getViewDetails?userId={}",userId);
-        return R.data(lifeUserExpertService.getFinalPaymentList(page, size, realName, userPhone, advancePaymentStatus, orderCreatedTime, orderEndTime, firstCompleteTime,endCompleteTime,createdEndPaymentTime,endEndPaymentTime,name, userId));
+        return R.data(lifeUserExpertService.getFinalPaymentList(page, size, realName, userPhone, advancePaymentStatus, orderCreatedTime, orderEndTime, firstPayTime, endPayTime,firstCompleteTime,endCompleteTime,createdEndPaymentTime,endEndPaymentTime,name, userId));
     }
 
     @ApiOperation("达人尾款审核接口")
@@ -218,4 +220,40 @@ public class LifeUserExpertController {
         log.info("LifeUserExpertController.getViewDetails?Id={},endPaymentRefusal{},userPhone{},name{},orderNo{},orderMoney{},endFundsButton{}",id,endPaymentRefusal,userPhone,name,orderNo,orderMoney,endFundsButton);
         return R.data(lifeUserExpertService.getFinalPaymentReview(id, endPaymentRefusal, userPhone, name,storeTel,orderNo,orderMoney,endFundsButton));
     }
+
+
+    @ApiOperation("达人订单列表")
+    @ApiOperationSupport(order = 15)
+    @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "realName", value = "真实姓名", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "userPhone", value = "联系电话", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "advancePaymentStatus", value = "预付款审核状态", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "orderCreatedTime", value = "下单开始时间", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "orderEndTime", value = "下单结束时间", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "firstPayTime", value = "支付开始时间", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "endPayTime", value = "支付结束时间", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "name", value = "套餐名称", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "orderNo", value = "订单编号", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "storeName", value = "商家昵称", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "userId", value = "用户id", dataType = "String", paramType = "query")
+    })
+    @GetMapping("/getOrderList")
+    public R<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) {
+        log.info("LifeUserExpertController.getViewDetails?userId={}",userId);
+        return R.data(lifeUserExpertService.getOrderList(page, size, realName, userPhone, advancePaymentStatus, orderCreatedTime, orderEndTime,  firstPayTime, endPayTime,name, userId));
+    }
+
+    @ApiOperation("设置比例")
+    @ApiOperationSupport(order = 16)
+    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "主键id", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "commissionRate", value = "佣金比例", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "advanceRate", value = "预付款比例", dataType = "Integer", paramType = "query")
+    })
+    @GetMapping("/updateProportion")
+    public R<Boolean> updateProportion(Integer id,Integer commissionRate,Integer advanceRate) {
+        log.info("LifeUserExpertController.updateProportion?id={},commissionRate{},advanceRate{}", id,commissionRate,advanceRate);
+        return R.data(lifeUserExpertService.updateProportion(id,commissionRate,advanceRate));
+    }
+
 }

+ 52 - 29
alien-store/src/main/java/shop/alien/store/service/LifeUserDynamicsService.java

@@ -17,7 +17,6 @@ import shop.alien.entity.result.R;
 import shop.alien.entity.store.*;
 import shop.alien.entity.store.vo.LifePinglunVo;
 import shop.alien.entity.store.vo.LifeUserDynamicsVo;
-import shop.alien.entity.store.vo.LifeUserOrderVo;
 import shop.alien.entity.store.vo.StoreCommentVo;
 import shop.alien.mapper.*;
 
@@ -68,6 +67,10 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
 
     private final LifeBrowseRecordMapper lifeBrowseRecordMapper;
 
+    private final LifeUserExpertWorksMapper lifeUserExpertWorksMapper;
+
+    private final LifeUserOrderMapper lifeUserOrderMapper;
+
     @Resource
     LifeBrowseRecordService lifeBrowseRecordService;
 
@@ -592,36 +595,34 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
                 List<String> imagePathList = Arrays.asList(imagePath.split(","));
                 lifeUserDynamicsVo.setImagePathList(imagePathList);
             }
-            //查询动态表中的 gvm和评论数是否满足当前达人订单规定值 都满足修改订单状态为已完成
-            LifeUserExpertOrder lifeUserExpertOrder = lifeUserExpertOrderMapper.selectOne(new LambdaQueryWrapper<LifeUserExpertOrder>().eq(LifeUserExpertOrder::getId, lifeUserDynamicsVo.getBusinessId()));
-            if (lifeUserExpertOrder != null && lifeUserExpertOrder.getStatus() != 2) {
-                  int liulanNum = lifeBrowseRecordMapper.selectCount(new LambdaQueryWrapper<LifeBrowseRecord>().eq(LifeBrowseRecord :: getDynamicsId, id).eq(LifeBrowseRecord :: getOrderId, lifeUserDynamicsVo.getBusinessId()));
-                if (lifeUserDynamicsVo.getOrderGmv().compareTo(lifeUserExpertOrder.getOrderGmv()) >= 0 && liulanNum >= lifeUserExpertOrder.getOrderPlayCount()) {
-                    lifeUserExpertOrder.setStatus(2);
-                    lifeUserExpertOrderMapper.updateById(lifeUserExpertOrder);
-                }
-            }
-
         }
         return lifeUserDynamicsVo;
     }
 
-    public R countGvm(Integer dynamicsId, String finalPrice) {
-        LifeUserDynamics lifeUserDynamics = lifeUserDynamicsMapper.selectOne(new LambdaQueryWrapper<LifeUserDynamics>().eq(LifeUserDynamics::getId, dynamicsId));
-        if (lifeUserDynamics != null) {
-            BigDecimal price = new BigDecimal(finalPrice);
-            lifeUserDynamics.setOrderGmv(lifeUserDynamics.getOrderGmv().add(price));
-            lifeUserDynamicsMapper.updateById(lifeUserDynamics);
-        }
-        LifeUserExpertOrder lifeUserExpertOrder = lifeUserExpertOrderMapper.selectOne(new LambdaQueryWrapper<LifeUserExpertOrder>().eq(LifeUserExpertOrder::getId, lifeUserDynamics.getBusinessId()));
-        if (lifeUserExpertOrder != null && lifeUserExpertOrder.getStatus() != 2) {
-            LifeUserDynamics lifeUserDynamics1 = lifeUserDynamicsMapper.selectOne(new LambdaQueryWrapper<LifeUserDynamics>().eq(LifeUserDynamics::getId, dynamicsId));
-            int liulanNum = lifeBrowseRecordMapper.selectCount(new LambdaQueryWrapper<LifeBrowseRecord>().eq(LifeBrowseRecord :: getDynamicsId, dynamicsId).eq(LifeBrowseRecord :: getOrderId, lifeUserDynamics1.getBusinessId()));
-            if (lifeUserDynamics1.getOrderGmv().compareTo(lifeUserExpertOrder.getOrderGmv()) >= 0 && liulanNum >= lifeUserExpertOrder.getOrderPlayCount()) {
-                lifeUserExpertOrder.setStatus(2);
+    public R countGvm(Integer dynamicsId, String finalPrice, Integer orderId, Integer expertId, Integer expertOrderId) {
+            LambdaQueryWrapper<LifeUserExpertWorks> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.eq(LifeUserExpertWorks :: getExpertId, expertId);
+            LifeUserExpertWorks lifeUserExpertWorks = lifeUserExpertWorksMapper.selectOne(lambdaQueryWrapper);
+            if(lifeUserExpertWorks != null){
+                BigDecimal price = new BigDecimal(finalPrice);
+                lifeUserExpertWorks.setOrderGmv(lifeUserExpertWorks.getOrderGmv().add(price));
+                lifeUserExpertWorksMapper.updateById(lifeUserExpertWorks);
+            }
+
+        LifeUserExpertOrder lifeUserExpertOrder = lifeUserExpertOrderMapper.selectOne(new LambdaQueryWrapper<LifeUserExpertOrder>().eq(LifeUserExpertOrder::getId, expertOrderId));
+        if (lifeUserExpertOrder != null && lifeUserExpertOrder.getStatus() != 5) {
+            LifeUserExpertWorks lifeUserExpertWorks1 = lifeUserExpertWorksMapper.selectOne(new LambdaQueryWrapper<LifeUserExpertWorks>().eq(LifeUserExpertWorks::getOrderId, expertOrderId));
+            int liulanNum = lifeBrowseRecordMapper.selectCount(new LambdaQueryWrapper<LifeBrowseRecord>().eq(LifeBrowseRecord :: getDynamicsId, dynamicsId).eq(LifeBrowseRecord :: getOrderId, expertOrderId));
+            if (lifeUserExpertWorks1.getOrderGmv().compareTo(lifeUserExpertOrder.getOrderGmv()) >= 0 && liulanNum >= lifeUserExpertOrder.getOrderPlayCount()) {
+                lifeUserExpertOrder.setStatus(5);
                 lifeUserExpertOrderMapper.updateById(lifeUserExpertOrder);
             }
         }
+        LambdaQueryWrapper<LifeUserOrder> userOrderLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        userOrderLambdaQueryWrapper.eq(LifeUserOrder :: getId, orderId);
+        LifeUserOrder lifeUserOrder = lifeUserOrderMapper.selectOne(userOrderLambdaQueryWrapper);
+        lifeUserOrder.setOrderGmv(1);
+        lifeUserOrderMapper.updateById(lifeUserOrder);
         return R.success("请求成功");
     }
 
@@ -639,14 +640,36 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
             lifeBrowseRecord.setLiulanDate(sdf.format(new Date()));
             lifeBrowseRecordMapper.insert(lifeBrowseRecord);
-            //查询当前动态浏记录数
+            //查询当前达人动态进入店铺详情浏记录数
             int liulanNum = lifeBrowseRecordMapper.selectCount(new LambdaQueryWrapper<LifeBrowseRecord>().eq(LifeBrowseRecord :: getDynamicsId, lifeBrowseRecord.getDynamicsId())
                     .eq(LifeBrowseRecord :: getOrderId, lifeBrowseRecord.getOrderId()).in(LifeBrowseRecord :: getDeleteFlag, 0, 1));
-            LambdaUpdateWrapper<LifeUserDynamics> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
-            lambdaUpdateWrapper.eq(LifeUserDynamics :: getId, lifeBrowseRecord.getDynamicsId());
-            lambdaUpdateWrapper.set(LifeUserDynamics :: getStoreCount, liulanNum);
-            lifeUserDynamicsMapper.update(null,lambdaUpdateWrapper);
+            LambdaUpdateWrapper<LifeUserExpertWorks> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+            lambdaUpdateWrapper.eq(LifeUserExpertWorks :: getId, lifeBrowseRecord.getDynamicsId());
+            lambdaUpdateWrapper.set(LifeUserExpertWorks :: getPlayCount, liulanNum);
+            lifeUserExpertWorksMapper.update(null,lambdaUpdateWrapper);
+        }
+
+        //查询gvm和进店详情浏览数数是否满足当前达人订单规定值 都满足修改订单状态为已完成
+        LifeUserExpertOrder lifeUserExpertOrder = lifeUserExpertOrderMapper.selectOne(new LambdaQueryWrapper<LifeUserExpertOrder>().eq(LifeUserExpertOrder::getId, lifeBrowseRecord.getOrderId()));
+        if (lifeUserExpertOrder != null && lifeUserExpertOrder.getStatus() != 5) {
+            int liulanNum = lifeBrowseRecordMapper.selectCount(new LambdaQueryWrapper<LifeBrowseRecord>().eq(LifeBrowseRecord :: getDynamicsId, lifeBrowseRecord.getDynamicsId())
+                    .eq(LifeBrowseRecord :: getOrderId, lifeBrowseRecord.getOrderId()));
+            LifeUserExpertWorks lifeUserExpertWorks = lifeUserExpertWorksMapper.selectOne(new LambdaQueryWrapper<LifeUserExpertWorks>().eq(LifeUserExpertWorks :: getDynamicsId, lifeBrowseRecord.getDynamicsId())
+                    .eq(LifeUserExpertWorks :: getOrderId, lifeBrowseRecord.getOrderId()));
+            if(lifeUserExpertWorks != null){
+                if (lifeUserExpertWorks.getOrderGmv().compareTo(lifeUserExpertOrder.getOrderGmv()) >= 0 && liulanNum >= lifeUserExpertOrder.getOrderPlayCount()) {
+                    lifeUserExpertOrder.setStatus(5);
+                    lifeUserExpertOrderMapper.updateById(lifeUserExpertOrder);
+                }
+            }
         }
         return true;
     }
+
+    public int addTransferCount(String id) {
+        LambdaUpdateWrapper<LifeUserDynamics> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+        lambdaUpdateWrapper.eq(LifeUserDynamics::getId, id)
+                .setSql("transfer_count = transfer_count + 1");
+        return lifeUserDynamicsMapper.update(null, lambdaUpdateWrapper);
+    }
 }

+ 7 - 3
alien-store/src/main/java/shop/alien/store/service/LifeUserExpertService.java

@@ -22,7 +22,7 @@ import java.util.Map;
  */
 public interface LifeUserExpertService extends IService<LifeUserExpert> {
 
-    IPage<LifeUserExpertVo> getUserExpertList(int page, int size, String userName, String expertCode, Integer userId);
+    IPage<LifeUserExpertVo> getUserExpertList(int page, int size, String userName, String expertCode, Integer userId,String userPhone);
 
     IPage<LifeUserExpertOrderVo> getExpertOrderList(int page, int size, Integer expertId, String orderNo, String storeName, Integer storeId);
 
@@ -48,11 +48,15 @@ public interface LifeUserExpertService extends IService<LifeUserExpert> {
 
     LifeUserExpertVo getViewDetails(Integer expertId);
 
-    IPage<LifeUserExpertOrderVo> getAdvancePaymentList(Integer page, Integer size,String realName, String userPhone, String advancePaymentStatus, String orderCreatedTime, String orderEndTime ,String name, Integer userId);
+    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);
 
-    IPage<LifeUserExpertOrderVo> getFinalPaymentList(Integer page, Integer size,String realName, String userPhone, String advancePaymentStatus, String orderCreatedTime, String orderEndTime ,String firstCompleteTime,String endCompleteTime,String createdEndPaymentTime,String endEndPaymentTime,String name, Integer userId);
+    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);
 
     Map<String,String> getFinalPaymentReview(Integer id, String endPaymentRefusal, String userPhone, String name, String storeTel, String orderNo, String orderMoney, String endFundsButton);
+
+    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);
 }

+ 6 - 0
alien-store/src/main/java/shop/alien/store/service/impl/LifeGroupBuyServiceImpl.java

@@ -46,6 +46,8 @@ public class LifeGroupBuyServiceImpl extends ServiceImpl<LifeGroupBuyMainMapper,
 
     private final WebAuditMapper webAuditMapper;
 
+    private final LifeUserOrderMapper lifeUserOrderMapper;
+
     @Override
     public boolean saveThali(LifeGroupBuyDto lifeGroupBuyDto) {
         JSONObject currentUserInfo = JwtUtil.getCurrentUserInfo();
@@ -187,6 +189,10 @@ public class LifeGroupBuyServiceImpl extends ServiceImpl<LifeGroupBuyMainMapper,
         }
         lifeGroupBuyThaliVo.setDetails(resultMap);
         getMainImgAndDisableDate(lifeGroupBuyThaliVo);
+
+        //已售数量
+        lifeGroupBuyThaliVo.setSaleNum(lifeUserOrderMapper.countBuyGroup(id));
+
         return lifeGroupBuyThaliVo;
     }
 

+ 70 - 3
alien-store/src/main/java/shop/alien/store/service/impl/LifeUserExpertServiceImpl.java

@@ -51,13 +51,14 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
     private final AliApi aliApi;
 
     @Override
-    public IPage<LifeUserExpertVo> getUserExpertList(int page, int size, String userName, String expertCode, Integer userId) {
+    public IPage<LifeUserExpertVo> getUserExpertList(int page, int size, String userName, String expertCode, Integer userId , String userPhone) {
         QueryWrapper<LifeUserExpertVo> wrapper = new QueryWrapper<>();
         wrapper.eq("expert.delete_flag", 0);
         wrapper.eq("user.delete_flag", 0);
         wrapper.eq(userId != null, "user.id", userId);
         wrapper.like(StringUtils.isNotEmpty(userName), "user.user_name", userName);
         wrapper.like(StringUtils.isNotEmpty(expertCode), "expert.expert_code", expertCode);
+        wrapper.like(StringUtils.isNotEmpty(userPhone), "user.user_phone", userPhone);
         wrapper.orderByDesc("accountMoney");
         return lifeUserExpertMapper.getUserExpertList(new Page<>(page, size), wrapper);
     }
@@ -414,7 +415,7 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
     }
 
     @Override
-    public IPage<LifeUserExpertOrderVo> getAdvancePaymentList(Integer page, Integer size,String realName, String userPhone, String advancePaymentStatus, String orderCreatedTime, String orderEndTime ,String name, Integer userId) {
+    public 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) {
         QueryWrapper<LifeUserExpertVo> wrapper = new QueryWrapper<>();
         wrapper.eq("ccc.delete_flag", 0);
         wrapper.eq("user.delete_flag", 0);
@@ -432,6 +433,12 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
         if (orderEndTime != null && !orderEndTime.isEmpty()) {
             wrapper.lt("ccc.order_time", orderEndTime);
         }
+        if (firstPayTime != null && !firstPayTime.isEmpty()) {
+            wrapper.gt("ccc.pay_time", firstPayTime);
+        }
+        if (endPayTime != null && !endPayTime.isEmpty()) {
+            wrapper.lt("ccc.pay_time", endPayTime);
+        }
         List<LifeUserExpertOrderVo> list=lifeUserExpertOrderMapper.getAdvancePaymentList(wrapper);
 
         for (LifeUserExpertOrderVo lifeUserExpertOrderVo : list) {
@@ -485,6 +492,8 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
                 lifeUserExpertOrder.setAdvancePaymentStatus(advancePaymentStatus);
                 lifeUserExpertOrder.setAdvancePaymentTime(new Date());
                 lifeUserExpertOrder.setReasonRefusal(reasonRefusal);
+                lifeUserExpertOrder.setRefundTime(new Date());
+                lifeUserExpertOrder.setStatus(6);
                 int i=lifeUserExpertOrderMapper.updateById(lifeUserExpertOrder);
                 String text1 = "您订购的达人推广套餐-"+name+",订单金额:"+orderMoney+"元,已经成功发放到您的支付宝账户,请注意查收。";
                 String title1 = "退款到账成功通知";
@@ -500,7 +509,7 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
     }
 
     @Override
-    public IPage<LifeUserExpertOrderVo> getFinalPaymentList(Integer page, Integer size,String realName, String userPhone, String advancePaymentStatus, String orderCreatedTime, String orderEndTime ,String firstCompleteTime,String endCompleteTime,String createdEndPaymentTime,String endEndPaymentTime,String name, Integer userId) {
+    public 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) {
         QueryWrapper<LifeUserExpertVo> wrapper = new QueryWrapper<>();
         wrapper.eq("ccc.delete_flag", 0);
         wrapper.eq("user.delete_flag", 0);
@@ -518,6 +527,12 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
         if (orderEndTime != null && !orderEndTime.isEmpty()) {
             wrapper.lt("ccc.order_time", orderEndTime);
         }
+        if (firstPayTime != null && !firstPayTime.isEmpty()) {
+            wrapper.gt("ccc.pay_time", firstPayTime);
+        }
+        if (endPayTime != null && !endPayTime.isEmpty()) {
+            wrapper.lt("ccc.pay_time", endPayTime);
+        }
         if (firstCompleteTime != null && !firstCompleteTime.isEmpty()){
             wrapper.gt("ccc.complete_time", firstCompleteTime);
         }
@@ -589,4 +604,56 @@ public class LifeUserExpertServiceImpl extends ServiceImpl<LifeUserExpertMapper,
         return map;
     }
 
+    @Override
+    public 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) {
+        QueryWrapper<LifeUserExpertVo> wrapper = new QueryWrapper<>();
+        wrapper.eq("ccc.delete_flag", 0);
+        wrapper.eq("user.delete_flag", 0);
+        wrapper.eq("info.delete_flag",0);
+        wrapper.eq("expert.delete_flag",0);
+        wrapper.eq("package.delete_flag",0);
+        wrapper.like(StringUtils.isNotEmpty(realName), "user.real_name", realName);
+        wrapper.like(StringUtils.isNotEmpty(userPhone), "user.user_phone", userPhone);
+        if (advancePaymentStatus != null && !advancePaymentStatus.isEmpty()){
+            wrapper.eq("ccc.advance_payment_status", advancePaymentStatus);
+        }
+        if (orderCreatedTime != null && !orderCreatedTime.isEmpty()){
+            wrapper.gt("ccc.order_time", orderCreatedTime);
+        }
+        if (orderEndTime != null && !orderEndTime.isEmpty()) {
+            wrapper.lt("ccc.order_time", orderEndTime);
+        }
+        if (firstPayTime != null && !firstPayTime.isEmpty()) {
+            wrapper.gt("ccc.pay_time", firstPayTime);
+        }
+        if (endPayTime != null && !endPayTime.isEmpty()) {
+            wrapper.lt("ccc.pay_time", endPayTime);
+        }
+        List<LifeUserExpertOrderVo> list=lifeUserExpertOrderMapper.getAdvancePaymentList(wrapper);
+
+        for (LifeUserExpertOrderVo lifeUserExpertOrderVo : list) {
+            int advanceRate = lifeUserExpertOrderVo.getAdvanceRate();
+            int commissionRate = lifeUserExpertOrderVo.getCommissionRate();
+            lifeUserExpertOrderVo.setOrderNewGmv(String.valueOf(lifeUserExpertOrderVo.getOrderGmv().setScale(2, BigDecimal.ROUND_HALF_UP)));
+            BigDecimal commissionAmount = lifeUserExpertOrderVo.getOrderMoney().multiply(BigDecimal.valueOf(commissionRate))
+                    .divide(new BigDecimal(100));
+            BigDecimal difference = lifeUserExpertOrderVo.getOrderMoney().subtract(commissionAmount);
+            BigDecimal advanceAmount = difference.multiply(BigDecimal.valueOf(advanceRate))
+                    .divide(new BigDecimal(100));
+            lifeUserExpertOrderVo.setAdvance(advanceAmount);
+            lifeUserExpertOrderVo.setCommission(commissionAmount);
+        }
+        return ListToPage.setPage(list,page, size);
+    }
+
+    @Override
+    public Boolean updateProportion(Integer expertId, Integer commissionRate, Integer advanceRate) {
+        LifeUserExpert lifeUserExpert=new LifeUserExpert();
+        lifeUserExpert.setId(expertId);
+        lifeUserExpert.setCommissionRate(commissionRate);
+        lifeUserExpert.setAdvanceRate(advanceRate);
+        return lifeUserExpertMapper.updateExpert(lifeUserExpert);
+    }
+
+
 }

+ 55 - 2
alien-store/src/main/java/shop/alien/store/service/impl/StoreCommentServiceImpl.java

@@ -23,6 +23,7 @@ import shop.alien.entity.store.vo.*;
 import shop.alien.mapper.*;
 import shop.alien.store.config.WebSocketProcess;
 import shop.alien.store.service.StoreCommentService;
+import shop.alien.store.service.StoreImgService;
 import shop.alien.store.util.FileUploadUtil;
 import shop.alien.util.common.DateUtils;
 import shop.alien.util.common.netease.ImageCheckUtil;
@@ -37,6 +38,7 @@ import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -76,6 +78,8 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
 
     @Autowired
     private TextModerationUtil textModerationUtil;
+    @Autowired
+    private StoreImgService storeImgService;
 
     /**
      * 评论列表
@@ -737,8 +741,57 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
         List<String> collect = commentOrderPage.getRecords().stream().map(LifeUserOrderCommentVo::getGroupBuyImgId).collect(Collectors.toList());
 
         if (ObjectUtils.isNotEmpty(collect)) {
-            List<StoreImg> storeImgList = storeImgMapper.selectList(new QueryWrapper<StoreImg>().in("id", collect));
-            commentOrderPage.getRecords().forEach(i -> i.setGroupBuyImgUrl(storeImgList.stream().filter(j -> j.getId().toString().equals(i.getGroupBuyImgId())).findFirst().map(StoreImg::getImgUrl).orElse(null)));
+            List<StoreImg> storeImgList = storeImgMapper.selectList(new QueryWrapper<StoreImg>().inSql("id", String.join(",", collect)));
+//            commentOrderPage.getRecords().forEach(i ->
+//                    i.setGroupBuyImgUrl(storeImgList.stream().filter(j -> j.getId().toString().equals(i.getGroupBuyImgId()))
+//                            .findFirst().map(StoreImg::getImgUrl).orElse(null)));
+            // 2. 优化分组:id唯一,直接映射为 Map<Integer, StoreImg>(避免List处理)
+            Map<Integer, StoreImg> imgIdToImgMap = storeImgList.stream()
+                    .collect(Collectors.toMap(
+                            StoreImg::getId,  // 键:图片id
+                            Function.identity(),  // 值:图片对象本身
+                            (existing, replacement) -> existing  // 若有重复id(理论上不会),保留第一个
+                    ));
+
+            // 3. 遍历订单评论记录,处理图片URL拼接
+            for (LifeUserOrderCommentVo record : commentOrderPage.getRecords()) {
+                String groupBuyImgId = record.getGroupBuyImgId();
+                // 空指针防护:如果imgId为空,直接设为空字符串
+                if (groupBuyImgId == null || groupBuyImgId.trim().isEmpty()) {
+                    record.setGroupBuyImgUrl("");
+                    continue;
+                }
+
+                // 分割imgId并一次性转换为Integer(避免重复解析)
+                List<Integer> imgIds = Arrays.stream(groupBuyImgId.split(","))
+                        .map(String::trim)  // 处理可能的空格
+                        .filter(idStr -> !idStr.isEmpty())  // 过滤空字符串(如连续逗号导致的)
+                        .map(idStr -> {
+                            try {
+                                return Integer.parseInt(idStr);
+                            } catch (NumberFormatException e) {
+                                // 处理非数字id的异常(如无效id)
+                                return null;
+                            }
+                        })
+                        .filter(Objects::nonNull)  // 过滤转换失败的null
+                        .collect(Collectors.toList());
+
+                // 拼接图片URL(使用StringBuilder高效拼接)
+                StringBuilder imgUrlBuilder = new StringBuilder();
+                for (Integer imgId : imgIds) {
+                    StoreImg storeImg = imgIdToImgMap.get(imgId);
+                    if (storeImg != null && storeImg.getImgUrl() != null) {
+                        if (imgUrlBuilder.length() > 0) {
+                            imgUrlBuilder.append(",");  // 非第一个元素前加逗号
+                        }
+                        imgUrlBuilder.append(storeImg.getImgUrl());
+                    }
+                }
+
+                // 设置最终的图片URL字符串(去掉末尾可能的逗号,这里通过逻辑避免了)
+                record.setGroupBuyImgUrl(imgUrlBuilder.toString());
+            }
         }
         return commentOrderPage;
     }