Răsfoiți Sursa

Merge remote-tracking branch 'origin/master'

lyx 2 luni în urmă
părinte
comite
4cb41cef77
30 a modificat fișierele cu 519 adăugiri și 186 ștergeri
  1. 71 0
      alien-entity/src/main/java/shop/alien/entity/store/AiIntelligentAssistant.java
  2. 7 2
      alien-entity/src/main/java/shop/alien/entity/store/StoreCustomerService.java
  3. 0 5
      alien-entity/src/main/java/shop/alien/entity/store/vo/ActivityInviteInfoVo.java
  4. 1 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/TagsMainVo.java
  5. 1 1
      alien-entity/src/main/java/shop/alien/mapper/ActivityInviteLogMapper.java
  6. 0 1
      alien-entity/src/main/java/shop/alien/mapper/ActivitySignInConfigMapper.java
  7. 0 3
      alien-entity/src/main/java/shop/alien/mapper/ActivitySignRewardMapper.java
  8. 19 0
      alien-entity/src/main/java/shop/alien/mapper/AiIntelligentAssistantMapper.java
  9. 2 1
      alien-entity/src/main/java/shop/alien/mapper/LifeDiscountCouponStoreFriendMapper.java
  10. 2 1
      alien-entity/src/main/java/shop/alien/mapper/LifeUserDynamicsMapper.java
  11. 13 15
      alien-entity/src/main/java/shop/alien/mapper/TagsMainMapper.java
  12. 36 0
      alien-entity/src/main/resources/mapper/AiIntelligentAssistantMapper.xml
  13. 27 19
      alien-second/src/main/java/shop/alien/second/service/impl/SecondGoodsServiceImpl.java
  14. 0 1
      alien-store/src/main/java/shop/alien/store/controller/ActivityConfigController.java
  15. 0 5
      alien-store/src/main/java/shop/alien/store/controller/ActivityInviteConfigController.java
  16. 3 3
      alien-store/src/main/java/shop/alien/store/controller/LifeDiscountCouponStoreFriendController.java
  17. 2 5
      alien-store/src/main/java/shop/alien/store/controller/PlatformLifeUserController.java
  18. 5 4
      alien-store/src/main/java/shop/alien/store/controller/StoreCommentController.java
  19. 78 0
      alien-store/src/main/java/shop/alien/store/controller/StoreCustomerServiceController.java
  20. 0 1
      alien-store/src/main/java/shop/alien/store/service/ActivityConfigService.java
  21. 0 2
      alien-store/src/main/java/shop/alien/store/service/ActivityInviteConfigService.java
  22. 1 1
      alien-store/src/main/java/shop/alien/store/service/LifeDiscountCouponStoreFriendService.java
  23. 1 1
      alien-store/src/main/java/shop/alien/store/service/StoreCommentService.java
  24. 17 0
      alien-store/src/main/java/shop/alien/store/service/StoreCustomerServiceService.java
  25. 0 6
      alien-store/src/main/java/shop/alien/store/service/impl/ActivityInviteConfigServiceImpl.java
  26. 1 1
      alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponServiceImpl.java
  27. 132 105
      alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponStoreFriendServiceImpl.java
  28. 13 1
      alien-store/src/main/java/shop/alien/store/service/impl/StoreCommentServiceImpl.java
  29. 82 0
      alien-store/src/main/java/shop/alien/store/service/impl/StoreCustomerServiceServiceImpl.java
  30. 5 2
      alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

+ 71 - 0
alien-entity/src/main/java/shop/alien/entity/store/AiIntelligentAssistant.java

@@ -0,0 +1,71 @@
+package shop.alien.entity.store;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * AI 智能助手表
+ *
+ * @author qxy
+ * @since 2025-09-23
+ */
+@Data
+@JsonInclude
+@TableName("ai_intelligent_assistant")
+@ApiModel(value = "AiIntelligentAssistant对象", description = "AI智能助手")
+public class AiIntelligentAssistant {
+
+    @ApiModelProperty(value = "主键")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "内容")
+    @TableField("context")
+    private String context;
+
+    @ApiModelProperty(value = "类型(0空数据/1输入的问题/2ai回答/3固定问题)")
+    @TableField("type")
+    private Integer type;
+
+    @ApiModelProperty(value = "回复id")
+    @TableField("reply_id")
+    private Integer replyId;
+
+    @ApiModelProperty(value = "回复时间")
+    @TableField("reply_date")
+    private Date replyDate;
+
+    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
+    @TableField("delete_flag")
+    @TableLogic
+    private Integer deleteFlag;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createdTime;
+
+    @ApiModelProperty(value = "创建人ID")
+    @TableField("created_user_id")
+    private Integer createdUserId;
+
+    @ApiModelProperty(value = "修改时间")
+    @TableField(value = "updated_time", fill = FieldFill.UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updatedTime;
+
+    @ApiModelProperty(value = "修改人ID")
+    @TableField("updated_user_id")
+    private Integer updatedUserId;
+
+    @ApiModelProperty(value = "用户ID")
+    @TableField("user_id")
+    private Integer userId;
+
+}

+ 7 - 2
alien-entity/src/main/java/shop/alien/entity/store/StoreCustomerService.java

@@ -2,8 +2,8 @@ package shop.alien.entity.store;
 
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonInclude;
-import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -21,7 +21,6 @@ import java.util.Date;
 @Data
 @JsonInclude
 @TableName("store_customer_service")
-@ApiModel(value = "StoreBusinessInfo对象", description = "门店营业时间")
 public class StoreCustomerService extends Model<StoreCustomerService> {
 
     private static final long serialVersionUID = 1L;
@@ -30,6 +29,10 @@ public class StoreCustomerService extends Model<StoreCustomerService> {
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
+    @ApiModelProperty(value = "类型(1/商家/2用户)")
+    @TableField("type")
+    private Integer type;
+
     @ApiModelProperty(value = "问题")
     @TableField("question")
     private String question;
@@ -49,6 +52,7 @@ public class StoreCustomerService extends Model<StoreCustomerService> {
 
     @ApiModelProperty(value = "创建时间")
     @TableField("created_time")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date createdTime;
 
     @ApiModelProperty(value = "创建人ID")
@@ -57,6 +61,7 @@ public class StoreCustomerService extends Model<StoreCustomerService> {
 
     @ApiModelProperty(value = "修改时间")
     @TableField("updated_time")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date updatedTime;
 
     @ApiModelProperty(value = "修改人ID")

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

@@ -4,11 +4,6 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import shop.alien.entity.store.ActivityPeriod;
-import shop.alien.entity.store.ActivitySignInConfig;
-import shop.alien.entity.store.ActivitySignInReward;
-
-import java.util.List;
 
 /**
  * @author zhangchen

+ 1 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/TagsMainVo.java

@@ -19,4 +19,5 @@ public class TagsMainVo extends TagsMain {
     private Integer evaluateNumber;
 
 
+
 }

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

@@ -16,6 +16,6 @@ import shop.alien.entity.store.vo.ActivityInviteLogVo;
 @Mapper
 public interface ActivityInviteLogMapper extends BaseMapper<ActivityInviteLog> {
 
-    @Select("select ail.*, lu.user_image  from activity_invite_log ail left join life_user lu on lu.id  = ail.invited_user_id ")
+    @Select("select ail.*, lu.user_image  from activity_invite_log ail left join life_user lu on lu.id  = ail.invited_user_id ${ew.customSqlSegment}")
     IPage<ActivityInviteLogVo> getInviteActivityLogList(IPage<ActivityInviteLog> iPage, @Param(Constants.WRAPPER) QueryWrapper<ActivityInviteLog> wrapper);
 }

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

@@ -3,7 +3,6 @@ package shop.alien.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 import shop.alien.entity.store.ActivitySignInConfig;
-import shop.alien.entity.store.LifeClassManage;
 
 /**
  * 签到活动配置mapper

+ 0 - 3
alien-entity/src/main/java/shop/alien/mapper/ActivitySignRewardMapper.java

@@ -5,10 +5,7 @@ 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 shop.alien.entity.store.ActivitySignInConfig;
 import shop.alien.entity.store.ActivitySignInReward;
-import shop.alien.entity.store.vo.ActivityPeriodVo;
-import shop.alien.entity.store.vo.LifeFansVo;
 
 import java.util.List;
 /**

+ 19 - 0
alien-entity/src/main/java/shop/alien/mapper/AiIntelligentAssistantMapper.java

@@ -0,0 +1,19 @@
+package shop.alien.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import shop.alien.entity.store.AiIntelligentAssistant;
+
+import java.util.List;
+
+
+@Mapper
+public interface AiIntelligentAssistantMapper extends BaseMapper<AiIntelligentAssistant> {
+
+
+    void insertList(List<AiIntelligentAssistant> list);
+}
+
+
+
+

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

@@ -35,7 +35,7 @@ public interface LifeDiscountCouponStoreFriendMapper extends BaseMapper<LifeDisc
             "${ew.customSqlSegment}")
     IPage<LifeDiscountCouponVo> selectPage(IPage<LifeDiscountCouponStoreFriendVo> iPage, @Param(Constants.WRAPPER) QueryWrapper<LifeDiscountCouponStoreFriendVo> friendLifeDiscountCouponQueryWrapper);
 
-    @Select("select ldcsf.created_time endDate,ldc.nominal_value nominalValue,ldc.minimum_spending_amount minimumSpendingAmount,su.head_img imgUrl,\n" +
+    @Select("select ldcsf.created_time endDate,ldc.nominal_value nominalValue,ldc.minimum_spending_amount minimumSpendingAmount,img.img_url imgUrl,\n" +
             "si.store_name storeName,\n" +
             "ldc.name couponName,\n" +
             "ldcsf.single_qty couponNum\n" +
@@ -45,6 +45,7 @@ public interface LifeDiscountCouponStoreFriendMapper extends BaseMapper<LifeDisc
             "left join store_info si\n" +
             "on si.id = ldc.store_id and si.delete_flag = 0\n" +
             "left join store_user su on si.id = su.store_id\n" +
+            "left join store_img img on si.id = img.store_id and img.img_type = 1 and img.delete_flag = 0\n" +
             "${ew.customSqlSegment}")
     List<LifeDiscountCouponFriendRuleVo> getReceivedSendFriendCouponList(@Param(Constants.WRAPPER) QueryWrapper<LifeDiscountCouponFriendRuleVo> lifeDiscountCouponFriendRuleVoQueryWrapper);
 }

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

@@ -46,6 +46,7 @@ public interface LifeUserDynamicsMapper extends BaseMapper<LifeUserDynamics> {
     @Select("select lud.*,'1' isLike\n" +
             "from life_user_dynamics lud \n" +
             "where lud.delete_flag = 0 \n" +
-            "and lud.id in (select llr.huifu_id from life_like_record llr where llr.dianzan_id = #{phoneId} and llr.delete_flag = 0)")
+            "and lud.id in (select llr.huifu_id from life_like_record llr where llr.dianzan_id = #{phoneId} and llr.delete_flag = 0) \n"+
+            "and lud.phone_id not in (select lb.blocked_phone_id  from life_blacklist lb where lb.blocker_phone_id = #{phoneId} and lb.delete_flag = 0)")
     List<LifeUserDynamicsVo> selectDianZanList(String phoneId);
 }

+ 13 - 15
alien-entity/src/main/java/shop/alien/mapper/TagsMainMapper.java

@@ -40,23 +40,21 @@ public interface TagsMainMapper extends BaseMapper<TagsMain> {
     })
     int insertBatchTagsMain(List<TagsMain> tagsMainList);
 
-    @Select("\tSELECT\n" +
-            "\tmain.id,\n" +
-            "\tmain.tag_name,\n" +
-            "\tmain.store_id,\n" +
-            "\tmain.tag_type,\n" +
-            "\tCOUNT(main.id) AS evaluateNumber\n" +
+    @Select("SELECT\n" +
+            "    main.id,\n" +
+            "    main.tag_name,\n" +
+            "    main.store_id,\n" +
+            "    main.tag_type,\n" +
+            "    COUNT(DISTINCT synonym.comment_id) AS evaluateNumber\n" +
             "FROM\n" +
-            "\ttags_main main \n" +
-            "\tLEFT JOIN tags_synonym synonym ON main.id = synonym.main_tag_id \n" +
-            "\tAND synonym.tag_type = 0 \n" +
+            "    tags_main main\n" +
+            "    LEFT JOIN tags_synonym synonym \n" +
+            "        ON main.id = synonym.main_tag_id\n" +
+            "        AND synonym.delete_flag = 0  \n" +
             "WHERE\n" +
-            "\tmain.store_id = 685 \n" +
-            "\tAND main.delete_flag = 0\n" +
-            "\tAND synonym.delete_flag = 0\n" +
+            "    main.store_id = #{storeId} \n" +
+            "    AND main.delete_flag = 0\n" +
             "GROUP BY\n" +
-            "\tmain.id\t\n" +
-            "ORDER BY\n" +
-            "\tmain.id;")
+            "    main.id")
     List<TagsMainVo> getStoreEvaluateTags(int storeId);
 }

+ 36 - 0
alien-entity/src/main/resources/mapper/AiIntelligentAssistantMapper.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="shop.alien.mapper.AiIntelligentAssistantMapper">
+
+    <insert id="insertList">
+        INSERT INTO ai_intelligent_assistant (
+        context,
+        type,
+        reply_id,
+        reply_date,
+        delete_flag,
+        created_time,
+        created_user_id,
+        updated_time,
+        updated_user_id,
+        user_id
+        ) VALUES
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.context},
+            #{item.type},
+            #{item.replyId},
+            #{item.replyDate},
+            #{item.deleteFlag},
+            #{item.createdTime},
+            #{item.createdUserId},
+            #{item.updatedTime},
+            #{item.updatedUserId},
+            #{item.userId}
+            )
+        </foreach>
+    </insert>
+
+</mapper>

+ 27 - 19
alien-second/src/main/java/shop/alien/second/service/impl/SecondGoodsServiceImpl.java

@@ -596,7 +596,7 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
         // 审核失败。直接返回
         if (!imageAuditResult) {
             // 图片审核不通过,记录操作历史
-//            recordGoodsOperation(goods);
+            recordGoodsOperation(goods,"图片审核失败");
             return;
         }
 
@@ -605,7 +605,7 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
         // 审核失败。直接返回
         if (!textAuditResult) {
             // 文本审核不通过,记录操作历史
-//            recordGoodsOperation(goods);
+            recordGoodsOperation(goods,"文本审核失败");
             return;
         }
         // 视频审核
@@ -704,9 +704,10 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
         if ("high".equals(textCheckResult.getRiskLevel())) {
             // 文本审核不通过或存在高风险
             goods.setGoodsStatus(SecondGoodsStatusEnum.REVIEW_FAILED.getCode()); // 审核失败
-            goods.setFailedReason("文本审核不通过:" + (textCheckResult.getRiskWords() != null ? textCheckResult.getRiskWords() : "存在高风险内容"));
+            String failReason = "文本审核不通过:" + (textCheckResult.getRiskWords() != null ? textCheckResult.getRiskWords() : "存在高风险内容");
+            goods.setFailedReason(failReason);
             // 插入审核记录
-            createGoodsAudit(goods, textCheckResult.getRiskWords(), Constants.AuditStatus.FAILED);
+            createGoodsAudit(goods, failReason, Constants.AuditStatus.FAILED);
             // 发送审核失败消息
             sendFailedMsg(goods);
             return false;
@@ -738,9 +739,10 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
                 if ("high".equals(response.getRiskLevel())) {
                     // 图片审核不通过或存在高风险
                     goods.setGoodsStatus(SecondGoodsStatusEnum.REVIEW_FAILED.getCode()); // 审核失败
-                    goods.setFailedReason("图片审核不通过:图片中包含" + (response.getDescriptions() != null ? response.getDescriptions() : "高风险内容"));
+                    String failReason = "图片审核不通过:图片中包含" + (response.getDescriptions() != null ? response.getDescriptions() : "高风险内容");
+                    goods.setFailedReason(failReason);
                     // 插入审核记录
-                    createGoodsAudit(goods, response.getDescriptions(), Constants.AuditStatus.FAILED);
+                    createGoodsAudit(goods, failReason, Constants.AuditStatus.FAILED);
                     // 发送审核失败消息
                     sendFailedMsg(goods);
                     return false;
@@ -887,17 +889,17 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
      * 创建商品审核记录
      *
      * @param goods 商品
-     * @param riskWords 文本审核结果
+     * @param failReason 审核结果
      */
-    private void createGoodsAudit(SecondGoods goods, String riskWords,Integer goodsStatus) {
+    private void createGoodsAudit(SecondGoods goods, String failReason,Integer goodsStatus) {
         // 保存审核结果
         secondGoodsMapper.updateById(goods);
         // 插入审核记录
         SecondGoodsAudit auditRecord = new SecondGoodsAudit();
         auditRecord.setGoodsId(goods.getId());
-        auditRecord.setGoodsStatus(goodsStatus); // 审核失败
+        auditRecord.setGoodsStatus(goodsStatus); // 审核状态
         if (Constants.AuditStatus.FAILED.equals(goodsStatus)) {
-            auditRecord.setFailedReason("文本审核不通过:" + (riskWords != null ? riskWords : "存在高风险内容"));
+            auditRecord.setFailedReason(failReason);
         }
         auditRecord.setCreatedUserId(goods.getUserId());
         auditRecord.setUpdatedUserId(goods.getUserId());
@@ -973,14 +975,18 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
     }
 
     private void sendNotice(String receiverId, LifeNotice lifeNotice) {
-        WebSocketVo webSocketVo = new WebSocketVo();
-        webSocketVo.setSenderId("system");
-        webSocketVo.setReceiverId(receiverId);
-        webSocketVo.setCategory("notice");
-        webSocketVo.setNoticeType("1");
-        webSocketVo.setIsRead(0);
-        webSocketVo.setText(JSONObject.from(lifeNotice).toJSONString());
-        alienStoreFeign.sendMsgToClientByPhoneId(receiverId, JSONObject.from(webSocketVo).toJSONString());
+        try {
+            WebSocketVo webSocketVo = new WebSocketVo();
+            webSocketVo.setSenderId("system");
+            webSocketVo.setReceiverId(receiverId);
+            webSocketVo.setCategory("notice");
+            webSocketVo.setNoticeType("1");
+            webSocketVo.setIsRead(0);
+            webSocketVo.setText(JSONObject.from(lifeNotice).toJSONString());
+            alienStoreFeign.sendMsgToClientByPhoneId(receiverId, JSONObject.from(webSocketVo).toJSONString());
+        } catch (Exception e) {
+            log.error("发送消息通知失败,receiverId: {}", receiverId, e);
+        }
     }
 
     /**
@@ -1507,7 +1513,9 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
                 
                 // 更新审核记录
                 createGoodsAudit(goods, failedReason, Constants.AuditStatus.FAILED);
-                
+
+                // 记录操作历史
+                recordGoodsOperation(goods, "视频审核失败");
                 // 发送审核失败消息
                 sendFailedMsg(goods);
             }

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

@@ -12,7 +12,6 @@ import shop.alien.entity.store.vo.ActivityConfigVo;
 import shop.alien.entity.store.vo.ActivityPeriodVo;
 import shop.alien.store.service.ActivityConfigService;
 
-import java.util.Date;
 import java.util.List;
 
 @Api(tags = {"二期-签到活动"})

+ 0 - 5
alien-store/src/main/java/shop/alien/store/controller/ActivityInviteConfigController.java

@@ -8,14 +8,9 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.ActivityInviteConfig;
-import shop.alien.entity.store.ActivityInviteLog;
-import shop.alien.entity.store.ActivitySignInConfig;
 import shop.alien.entity.store.vo.*;
-import shop.alien.store.service.ActivityConfigService;
 import shop.alien.store.service.ActivityInviteConfigService;
 
-import java.util.List;
-
 @Api(tags = {"二期-邀请活动"})
 @Slf4j
 @CrossOrigin

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

@@ -175,8 +175,8 @@ public class LifeDiscountCouponStoreFriendController {
             ,@ApiImplicitParam(name = "friendStoreUserId", value = "我赠好友", dataType = "String", paramType = "query", required = false)
     })
     @GetMapping("/getReceivedSendFriendCouponList")
-    private R<List<LifeDiscountCouponFriendRuleVo>> getReceivedSendFriendCouponList(@RequestParam(value = "storeUserId",required = false) String storeUserId, @RequestParam(value = "friendStoreUserId",required = false)String friendStoreUserId) {
-        log.info("LifeDiscountCouponStoreFriendController.getReceivedSendFriendCouponList?storeId={},friendStoreUserId={}", storeUserId,friendStoreUserId);
-        return R.data(lifeDiscountCouponStoreFriendService.getReceivedSendFriendCouponList(storeUserId,friendStoreUserId));
+    private R<List<LifeDiscountCouponFriendRuleVo>> getReceivedSendFriendCouponList(@RequestParam(value = "storeUserId",required = false) String storeUserId, @RequestParam(value = "friendStoreUserId",required = false)String friendStoreUserId, @RequestParam(value = "storeName",required = false)String storeName) {
+        log.info("LifeDiscountCouponStoreFriendController.getReceivedSendFriendCouponList?storeId={},friendStoreUserId={},storeName={}", storeUserId,friendStoreUserId,storeName);
+        return R.data(lifeDiscountCouponStoreFriendService.getReceivedSendFriendCouponList(storeUserId,friendStoreUserId,storeName));
     }
 }

+ 2 - 5
alien-store/src/main/java/shop/alien/store/controller/PlatformLifeUserController.java

@@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.vo.LifeUserVo;
@@ -30,7 +27,7 @@ public class PlatformLifeUserController {
             @ApiImplicitParam(name = "realName", value = "姓名", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "userPhone", value = "手机号码", dataType = "String", paramType = "query")})
     @GetMapping("/getUserList")
-    public R<IPage<LifeUserVo>> getUserList(Integer page, Integer size, String realName, String userPhone) {
+    public R<IPage<LifeUserVo>> getUserList(@RequestParam("page") Integer page, @RequestParam("size") Integer size, String realName, String userPhone) {
         log.info("PlatformLifeUserController.getUserList?page={},size={},name={},phone={}", page, size, realName, userPhone);
         IPage<LifeUserVo> userList = platformLifeUserService.getUserList(page, size, realName, userPhone);
         return R.data(userList);

+ 5 - 4
alien-store/src/main/java/shop/alien/store/controller/StoreCommentController.java

@@ -43,12 +43,13 @@ public class StoreCommentController {
             @ApiImplicitParam(name = "commentLevel", value = "评论等级(0:全部, 1:好评, 2:中评, 3:差评)", dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "days", value = "查询时间, 多少天前", dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "phoneId", value = "消息标识", dataType = "String", paramType = "query"),
-            @ApiImplicitParam(name = "userType", value = "评论的用户类型(0:商家, 其他:用户)", dataType = "String", paramType = "query")
+            @ApiImplicitParam(name = "userType", value = "评论的用户类型(0:商家, 其他:用户)", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "tagId", value = "标签id)", dataType = "Integer", paramType = "query")
     })
     @GetMapping("/getList")
-    public R<IPage<StoreCommentVo>> getList(Integer pageNum, Integer pageSize, Integer businessId, Integer businessType, Integer storeId, Integer replyStatus, Integer commentLevel, Integer days, String phoneId, Integer userType) {
-        log.info("StoreCommentController.getList?pageNum={}&pageSize={}&businessId={}&businessType={}&storeId={}&replyStatus={}&commentLevel={}&days={}&phoneId={}&userType={}", pageNum, pageSize, businessId, businessType, storeId, replyStatus, commentLevel, days, phoneId, userType);
-        return R.data(storeCommentService.getList(pageNum, pageSize, businessId, businessType, storeId, replyStatus, commentLevel, days, phoneId, userType));
+    public R<IPage<StoreCommentVo>> getList(Integer pageNum, Integer pageSize, Integer businessId, Integer businessType, Integer storeId, Integer replyStatus, Integer commentLevel, Integer days, String phoneId, Integer userType, Integer tagId) {
+        log.info("StoreCommentController.getList?pageNum={}&pageSize={}&businessId={}&businessType={}&storeId={}&replyStatus={}&commentLevel={}&days={}&phoneId={}&userType={}&tagId={}", pageNum, pageSize, businessId, businessType, storeId, replyStatus, commentLevel, days, phoneId, userType, tagId);
+        return R.data(storeCommentService.getList(pageNum, pageSize, businessId, businessType, storeId, replyStatus, commentLevel, days, phoneId, userType, tagId));
     }
 
     @ApiOperation("获取最新一条评论/评价")

+ 78 - 0
alien-store/src/main/java/shop/alien/store/controller/StoreCustomerServiceController.java

@@ -1,13 +1,17 @@
 package shop.alien.store.controller;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.*;
 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.AiIntelligentAssistant;
 import shop.alien.entity.store.StoreCustomerService;
 import shop.alien.store.service.StoreCustomerServiceService;
 
+import java.util.List;
+
 /**
  * <p>
  * 智能客服
@@ -39,4 +43,78 @@ public class StoreCustomerServiceController {
         return R.data(result);
     }
 
+    @ApiOperation("获取随机问题")
+    @ApiOperationSupport(order = 2)
+    @ApiImplicitParams({@ApiImplicitParam(name = "type", value = "类型(1/商家/2用户)", dataType = "String", paramType = "query", required = true)
+    , @ApiImplicitParam(name = "limit", value = "数量", dataType = "Integer", paramType = "query", required = true)})
+    @GetMapping("/getRandList")
+    public R<List<StoreCustomerService>> getRandList(@RequestParam String type, @RequestParam Integer limit) {
+        List<StoreCustomerService> result = storeCustomerServiceService.getRandList(type,limit);
+        return R.data(result);
+    }
+
+    @ApiOperation("删除问题")
+    @ApiOperationSupport(order = 3)
+    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true)
+            })
+    @GetMapping("/delStoreCustomerService")
+    public R delStoreCustomerService(@RequestParam String id) {
+        storeCustomerServiceService.delStoreCustomerService(id);
+        return R.data("删除成功");
+    }
+
+    @ApiOperation("中台-问题列表")
+    @ApiOperationSupport(order = 4)
+    @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "页数", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "size", value = "页容", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "question", value = "问题", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "type", value = "类型(1/商家/2用户)", dataType = "String", paramType = "query", required = false),
+    })
+    @GetMapping("/getStoreCustomerServicePage")
+    private R<IPage<StoreCustomerService>> getStoreCustomerServicePage(@RequestParam(value = "page", defaultValue = "1") int page,
+                                                       @RequestParam(value = "size", defaultValue = "10") int size,
+                                                       @RequestParam(value = "question", required = false) String question,
+                                                       @RequestParam(value = "type", required = false) String type) {
+        log.info("StoreCustomerServiceController.getStoreCustomerServicePage?page={},size={},question={},type={}", page, size, question, type);
+        return R.data(storeCustomerServiceService.getStoreCustomerServicePage(page, size, question, type));
+    }
+
+    @ApiOperation("中台-保存问题")
+    @ApiOperationSupport(order = 5)
+    @PostMapping("/saveStoreCustomerService")
+    public R<StoreCustomerService> saveStoreCustomerService(@RequestBody StoreCustomerService storeCustomerService) {
+        log.info("StoreCustomerServiceController.saveStoreCustomerService?storeCustomerService={}", storeCustomerService.toString());
+        StoreCustomerService saved = storeCustomerServiceService.saveStoreCustomerService(storeCustomerService);
+        return R.data(saved);
+    }
+
+    @ApiOperation("id查询问题")
+    @ApiOperationSupport(order = 6)
+    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true)
+    })
+    @GetMapping("/getById")
+    public R<StoreCustomerService> getById(@RequestParam String id) {
+        log.info("StoreCustomerServiceController.getById?id={}", id);
+        StoreCustomerService saved = storeCustomerServiceService.getById(id);
+        return R.data(saved);
+    }
+
+    @ApiOperation("保存聊天")
+    @ApiOperationSupport(order = 5)
+    @PostMapping("/saveAiIntelligentAssistant")
+    public R<List<AiIntelligentAssistant>> saveAiIntelligentAssistant(@RequestBody List<AiIntelligentAssistant> aiIntelligentAssistants) {
+        log.info("StoreCustomerServiceController.saveAiIntelligentAssistant?aiIntelligentAssistants={}", aiIntelligentAssistants.toString());
+        List<AiIntelligentAssistant> saved = storeCustomerServiceService.saveAiIntelligentAssistant(aiIntelligentAssistants);
+        return R.data(saved);
+    }
+
+    @ApiOperation("查询聊天记录")
+    @ApiOperationSupport(order = 2)
+    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户id)", dataType = "String", paramType = "query", required = true)
+            , @ApiImplicitParam(name = "time", value = "时间", dataType = "String", paramType = "query", required = true)})
+    @GetMapping("/selectAiIntelligentAssistant")
+    public R<List<AiIntelligentAssistant>> selectAiIntelligentAssistant(@RequestParam String userId, @RequestParam String time) {
+        List<AiIntelligentAssistant> result = storeCustomerServiceService.selectAiIntelligentAssistant(userId,time);
+        return R.data(result);
+    }
 }

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

@@ -7,7 +7,6 @@ import shop.alien.entity.store.ActivitySignInReward;
 import shop.alien.entity.store.vo.ActivityConfigVo;
 import shop.alien.entity.store.vo.ActivityPeriodVo;
 
-import java.util.Date;
 import java.util.List;
 
 /**

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

@@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import shop.alien.entity.store.*;
 import shop.alien.entity.store.vo.*;
 
-import java.util.List;
-
 /**
  * @author zhangchen
  * @version 1.0

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

@@ -59,5 +59,5 @@ public interface LifeDiscountCouponStoreFriendService extends IService<LifeDisco
 
     LifeDiscountCouponFriendRuleVo getRuleById(String id);
 
-    List<LifeDiscountCouponFriendRuleVo> getReceivedSendFriendCouponList(String storeUserId, String friendStoreUserId);
+    List<LifeDiscountCouponFriendRuleVo> getReceivedSendFriendCouponList(String storeUserId, String friendStoreUserId,String storeName);
 }

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

@@ -33,7 +33,7 @@ public interface StoreCommentService extends IService<StoreComment> {
      * @param userType     评论的用户类型(0:商家, 其他:用户)
      * @return IPage<StoreComment>
      */
-    IPage<StoreCommentVo> getList(Integer pageNum, Integer pageSize, Integer businessId, Integer businessType, Integer storeId, Integer replyStatus, Integer commentLevel, Integer days, String phoneId, Integer userType);
+    IPage<StoreCommentVo> getList(Integer pageNum, Integer pageSize, Integer businessId, Integer businessType, Integer storeId, Integer replyStatus, Integer commentLevel, Integer days, String phoneId, Integer userType, Integer tagId);
 
     /**
      * 获取最新一条评论/评价

+ 17 - 0
alien-store/src/main/java/shop/alien/store/service/StoreCustomerServiceService.java

@@ -1,8 +1,12 @@
 package shop.alien.store.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import shop.alien.entity.store.AiIntelligentAssistant;
 import shop.alien.entity.store.StoreCustomerService;
 
+import java.util.List;
+
 /**
  * <p>
  * 门店客服 服务类
@@ -15,4 +19,17 @@ public interface StoreCustomerServiceService extends IService<StoreCustomerServi
 
     StoreCustomerService getByQuestion(String question);
 
+    StoreCustomerService saveStoreCustomerService(StoreCustomerService storeCustomerService);
+
+    void delStoreCustomerService(String id);
+
+    IPage<StoreCustomerService> getStoreCustomerServicePage(int page, int size, String question, String type);
+
+    StoreCustomerService getById(String id);
+
+    List<StoreCustomerService> getRandList(String type,Integer limit);
+
+    List<AiIntelligentAssistant> saveAiIntelligentAssistant(List<AiIntelligentAssistant> aiIntelligentAssistants);
+
+    List<AiIntelligentAssistant> selectAiIntelligentAssistant(String userId,String time);
 }

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

@@ -12,7 +12,6 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import shop.alien.entity.store.*;
-import shop.alien.entity.store.vo.ActivityConfigVo;
 import shop.alien.entity.store.vo.ActivityInviteConfigVo;
 import shop.alien.entity.store.vo.ActivityInviteInfoVo;
 import shop.alien.entity.store.vo.ActivityInviteLogVo;
@@ -22,11 +21,7 @@ import shop.alien.mapper.LifeUserMapper;
 import shop.alien.store.service.ActivityInviteConfigService;
 import shop.alien.util.common.RandomCreateUtil;
 
-import java.text.SimpleDateFormat;
 import java.time.Instant;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
 
@@ -200,7 +195,6 @@ public class ActivityInviteConfigServiceImpl extends ServiceImpl<ActivityInviteC
 
         IPage<ActivityInviteLog> iPage = new Page<>(pageNum, pageSize);
         QueryWrapper<ActivityInviteLog> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(ActivityInviteLog::getDeleteFlag, 0);
         if(userId != null) {
             queryWrapper.lambda().eq(ActivityInviteLog::getInviteUserId, userId);
         }

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

@@ -737,7 +737,7 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
                 lifeDiscountCouponLambdaQueryWrapper.le(LifeDiscountCoupon::getBeginGetDate, getPureDate(now));
                 //结束时间大于当前时间
                 lifeDiscountCouponLambdaQueryWrapper.ge(LifeDiscountCoupon::getEndGetDate, getPureDate(now));
-                lifeDiscountCouponLambdaQueryWrapper.ge(LifeDiscountCoupon::getSingleQty, 0);
+                lifeDiscountCouponLambdaQueryWrapper.gt(LifeDiscountCoupon::getSingleQty, 0);
 
                 //不要已暂停关闭领取的
                 lifeDiscountCouponLambdaQueryWrapper.eq(LifeDiscountCoupon::getGetStatus, 1);

+ 132 - 105
alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponStoreFriendServiceImpl.java

@@ -25,6 +25,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -209,122 +210,147 @@ public class LifeDiscountCouponStoreFriendServiceImpl extends ServiceImpl<LifeDi
     @Override
     public List<LifeDiscountCouponStoreFriendVo> issueFriendCoupon(LifeDiscountCouponStoreFriendDto lifeDiscountCouponStoreFriendDto) {
 
+        // 用于存储最终成功发放的优惠券信息的列表
+        List<LifeDiscountCouponStoreFriendVo> result = new ArrayList<>();
+
         //判断该订单是否已经发放过好友店铺优惠券
         LifeUserOrder lifeUserOrder = lifeUserOrderMapper.selectById(lifeDiscountCouponStoreFriendDto.getOrderId());
         if (lifeUserOrder.getSendDiscountCouponFlag() == 1) {
             throw new RuntimeException("已发放优惠券");
         }
+
+        //送券规则
+        List<Integer> couponList = new ArrayList<>();
+        LambdaQueryWrapper<LifeDiscountCouponFriendRule> ruleLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        ruleLambdaQueryWrapper.eq(LifeDiscountCouponFriendRule::getStoreId, lifeUserOrder.getStoreId())
+                .ge(LifeDiscountCouponFriendRule::getMoneyLow, lifeUserOrder.getFinalPrice())
+                .le(LifeDiscountCouponFriendRule::getMoneyHigh, lifeUserOrder.getFinalPrice())
+                .eq(LifeDiscountCouponFriendRule::getDeleteFlag, 0);
+        List<LifeDiscountCouponFriendRule> lifeDiscountCouponFriendRules = lifeDiscountCouponFriendRuleMapper.selectList(ruleLambdaQueryWrapper);
+        if (ObjectUtils.isNotEmpty(lifeDiscountCouponFriendRules)) {
+            LambdaQueryWrapper<LifeDiscountCouponFriendRuleDetail> detailLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            detailLambdaQueryWrapper.in(LifeDiscountCouponFriendRuleDetail::getRuleId, lifeDiscountCouponFriendRules.stream().map(LifeDiscountCouponFriendRule::getId).collect(Collectors.toList()));
+            List<LifeDiscountCouponFriendRuleDetail> lifeDiscountCouponFriendRuleDetails = lifeDiscountCouponFriendRuleDetailMapper.selectList(detailLambdaQueryWrapper);
+            couponList = lifeDiscountCouponFriendRuleDetails.stream().map(LifeDiscountCouponFriendRuleDetail::getCouponId).collect(Collectors.toList());
+        }
+
+
         lifeUserOrder.setSendDiscountCouponFlag(1);
         lifeUserOrderMapper.updateById(lifeUserOrder);
 
-        // 用于存储最终成功发放的优惠券信息的列表
-        List<LifeDiscountCouponStoreFriendVo> result = new ArrayList<>();
-
-        // 获取当前消费用户的ID
-        int userId = Integer.parseInt(lifeUserOrder.getUserId());
-        LifeUser lifeUser = lifeUserMapper.selectById(userId);
-        // 从传入的DTO对象中获取店铺ID
-        StoreUser storeUser =
-                storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getStoreId, lifeUserOrder.getStoreId()));
-        Integer storeUserId = storeUser.getId();
-        Integer storeId = storeUser.getStoreId();
-        StoreInfo storeInfo = storeInfoMapper.selectById(storeUser.getStoreId());
-
-        // 根据店铺ID从数据库中查询该店铺为好友设定的所有优惠券信息
-        List<LifeDiscountCouponStoreFriend> lifeDiscountCouponStoreFriends = lifeDiscountCouponStoreFriendMapper.selectList(
-                // 使用LambdaQueryWrapper构建查询条件,筛选出店铺ID等于指定店铺ID的优惠券记录,并且发布状态为已发布
-                new LambdaQueryWrapper<LifeDiscountCouponStoreFriend>().eq(LifeDiscountCouponStoreFriend::getStoreUserId, storeId)
-                        .eq(LifeDiscountCouponStoreFriend::getReleaseType, 1));
-
-        // 获取当前日期,用于后续判断优惠券是否在有效期内
-        LocalDate currentDate = LocalDate.now();
-        if (!lifeDiscountCouponStoreFriends.isEmpty()) {
-            // 遍历该店铺为好友设定的所有优惠券信息
-            for (LifeDiscountCouponStoreFriend coupon : lifeDiscountCouponStoreFriends) {
-                // 创建一个Lambda查询包装器,用于构建查询优惠券的条件
-                LambdaQueryWrapper<LifeDiscountCoupon> queryWrapper = new LambdaQueryWrapper<>();
-                // 设置查询条件:优惠券的领取状态为可领取
-                queryWrapper.eq(LifeDiscountCoupon::getGetStatus, DiscountCouponEnum.CAN_GET.getValue());
-                // 设置查询条件:优惠券的ID等于当前遍历到的优惠券ID
-                queryWrapper.eq(LifeDiscountCoupon::getId, coupon.getCouponId());
-                // 设置查询条件:优惠券的结束日期大于等于当前日期,即优惠券在有效期内
-                queryWrapper.ge(LifeDiscountCoupon::getValidDate, currentDate);
-                // 设置查询条件:优惠券还有库存
-                queryWrapper.gt(LifeDiscountCoupon::getSingleQty, 0);
-
-                // 根据上述查询条件从数据库中查询符合条件的优惠券信息
-                LifeDiscountCoupon lifeDiscountCoupon = lifeDiscountCouponMapper.selectOne(queryWrapper);
-
-                // 如果查询到符合条件的优惠券,说明该优惠券可领
-                if (lifeDiscountCoupon != null) {
-                    // 设定本次领取优惠券的数量,这里固定为1张
-                    Integer receiveQuantity = 1;
-
-                    // 循环领取优惠券,根据设定的领取数量进行多次领取操作
-                    for (int i = 0; i < receiveQuantity; i++) {
-                        // 创建一个新的用户优惠券记录对象
-                        LifeDiscountCouponUser lifeDiscountCouponUser = new LifeDiscountCouponUser();
-                        // 设置该优惠券记录的优惠券ID
-                        lifeDiscountCouponUser.setCouponId(coupon.getCouponId());
-                        // 设置该优惠券记录的用户ID为当前用户ID
-                        lifeDiscountCouponUser.setUserId(userId);
-                        // 设置该优惠券的领取时间为当前时间
-                        lifeDiscountCouponUser.setReceiveTime(new Date());
-                        // 设置该优惠券的过期时间为优惠券本身的结束日期
-                        lifeDiscountCouponUser.setExpirationTime(lifeDiscountCoupon.getValidDate());
-                        // 设置该优惠券的状态为待使用
-                        lifeDiscountCouponUser.setStatus(Integer.parseInt(DiscountCouponEnum.WAITING_USED.getValue()));
-                        // 将该用户优惠券记录插入到数据库中
-                        lifeDiscountCouponUserMapper.insert(lifeDiscountCouponUser);
+        //有符合规则的优惠券
+        if (ObjectUtils.isNotEmpty(couponList) && !couponList.isEmpty()) {
+            // 获取当前消费用户的ID
+            int userId = Integer.parseInt(lifeUserOrder.getUserId());
+            LifeUser lifeUser = lifeUserMapper.selectById(userId);
+            // 从传入的DTO对象中获取店铺ID
+            StoreUser storeUser =
+                    storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getStoreId, lifeUserOrder.getStoreId()));
+            Integer storeUserId = storeUser.getId();
+            Integer storeId = storeUser.getStoreId();
+            StoreInfo storeInfo = storeInfoMapper.selectById(storeUser.getStoreId());
+
+            // 根据店铺ID从数据库中查询该店铺为好友设定的所有优惠券信息
+            List<LifeDiscountCouponStoreFriend> lifeDiscountCouponStoreFriends = lifeDiscountCouponStoreFriendMapper.selectList(
+                    // 使用LambdaQueryWrapper构建查询条件,筛选出店铺ID等于指定店铺ID的优惠券记录,并且发布状态为已发布
+                    new LambdaQueryWrapper<LifeDiscountCouponStoreFriend>().eq(LifeDiscountCouponStoreFriend::getStoreUserId, storeId)
+                            .eq(LifeDiscountCouponStoreFriend::getReleaseType, 1)
+                            .in(LifeDiscountCouponStoreFriend::getCouponId, couponList));
+
+            // 获取当前日期,用于后续判断优惠券是否在有效期内
+            LocalDate currentDate = LocalDate.now();
+            if (!lifeDiscountCouponStoreFriends.isEmpty()) {
+                // 遍历该店铺为好友设定的所有优惠券信息
+                for (LifeDiscountCouponStoreFriend coupon : lifeDiscountCouponStoreFriends) {
+                    // 创建一个Lambda查询包装器,用于构建查询优惠券的条件
+                    LambdaQueryWrapper<LifeDiscountCoupon> queryWrapper = new LambdaQueryWrapper<>();
+                    // 设置查询条件:优惠券的领取状态为可领取
+                    queryWrapper.eq(LifeDiscountCoupon::getGetStatus, DiscountCouponEnum.CAN_GET.getValue());
+                    // 设置查询条件:优惠券的ID等于当前遍历到的优惠券ID
+                    queryWrapper.eq(LifeDiscountCoupon::getId, coupon.getCouponId());
+                    // 设置查询条件:优惠券的结束日期大于等于当前日期,即优惠券在有效期内
+                    queryWrapper.ge(LifeDiscountCoupon::getValidDate, currentDate);
+                    // 设置查询条件:优惠券还有库存
+                    queryWrapper.gt(LifeDiscountCoupon::getSingleQty, 0);
+
+                    // 根据上述查询条件从数据库中查询符合条件的优惠券信息
+                    LifeDiscountCoupon lifeDiscountCoupon = lifeDiscountCouponMapper.selectOne(queryWrapper);
+
+                    // 如果查询到符合条件的优惠券,说明该优惠券可领
+                    if (lifeDiscountCoupon != null) {
+                        // 设定本次领取优惠券的数量,这里固定为1张
+                        Integer receiveQuantity = 1;
+
+                        // 循环领取优惠券,根据设定的领取数量进行多次领取操作
+                        for (int i = 0; i < receiveQuantity; i++) {
+                            // 创建一个新的用户优惠券记录对象
+                            LifeDiscountCouponUser lifeDiscountCouponUser = new LifeDiscountCouponUser();
+                            // 设置该优惠券记录的优惠券ID
+                            lifeDiscountCouponUser.setCouponId(coupon.getCouponId());
+                            // 设置该优惠券记录的用户ID为当前用户ID
+                            lifeDiscountCouponUser.setUserId(userId);
+                            // 设置该优惠券的领取时间为当前时间
+                            lifeDiscountCouponUser.setReceiveTime(new Date());
+                            // 设置该优惠券的过期时间为优惠券本身的结束日期
+                            lifeDiscountCouponUser.setExpirationTime(lifeDiscountCoupon.getValidDate());
+                            // 设置该优惠券的状态为待使用
+                            lifeDiscountCouponUser.setStatus(Integer.parseInt(DiscountCouponEnum.WAITING_USED.getValue()));
+                            // 将该用户优惠券记录插入到数据库中
+                            lifeDiscountCouponUserMapper.insert(lifeDiscountCouponUser);
+                        }
+
+                        // 削减该优惠券的库存,根据领取数量减少库存
+                        coupon.setSingleQty(coupon.getSingleQty() - receiveQuantity);
+                        // 更新数据库中该优惠券的库存信息
+                        lifeDiscountCouponStoreFriendMapper.updateById(coupon);
+
+                        // 创建一个用于存储优惠券信息的VO对象
+                        LifeDiscountCouponStoreFriendVo lifeDiscountCouponStoreFriendVo = new LifeDiscountCouponStoreFriendVo();
+                        // 将优惠券信息复制到VO对象中
+                        BeanUtils.copyProperties(coupon, lifeDiscountCouponStoreFriendVo);
+                        // 将该VO对象添加到最终结果列表中
+                        result.add(lifeDiscountCouponStoreFriendVo);
                     }
-
-                    // 削减该优惠券的库存,根据领取数量减少库存
-                    coupon.setSingleQty(coupon.getSingleQty() - receiveQuantity);
-                    // 更新数据库中该优惠券的库存信息
-                    lifeDiscountCouponStoreFriendMapper.updateById(coupon);
-
-                    // 创建一个用于存储优惠券信息的VO对象
-                    LifeDiscountCouponStoreFriendVo lifeDiscountCouponStoreFriendVo = new LifeDiscountCouponStoreFriendVo();
-                    // 将优惠券信息复制到VO对象中
-                    BeanUtils.copyProperties(coupon, lifeDiscountCouponStoreFriendVo);
-                    // 将该VO对象添加到最终结果列表中
-                    result.add(lifeDiscountCouponStoreFriendVo);
                 }
-            }
 
-            //存储发放日志
-            LifeDiscountCouponStoreFriendSendRecord lifeDiscountCouponStoreFriendSendRecord = new LifeDiscountCouponStoreFriendSendRecord();
-            //存入门店id
-            lifeDiscountCouponStoreFriendSendRecord.setStoreId(Integer.parseInt(lifeUserOrder.getStoreId()));
-            //存入接收人id
-            lifeDiscountCouponStoreFriendSendRecord.setUserId(userId);
-            //存入发放人id
-            lifeDiscountCouponStoreFriendSendRecord.setStoreUserId(storeUserId);
-            //存入订单id
-            lifeDiscountCouponStoreFriendSendRecord.setOrderId(Integer.parseInt(lifeUserOrder.getId()));
-            //存入优惠券ids
-            String[] couponIds = result.stream()
-                    .map(LifeDiscountCouponStoreFriendVo::getCouponId)
-                    .map(String::valueOf)  // 将 Integer 转换为 String
-                    .toArray(String[]::new);
-
-            String join = String.join(",", couponIds);
-            lifeDiscountCouponStoreFriendSendRecord.setDiscountCouponIds(join);
-            lifeDiscountCouponStoreFriendSendRecordMapper.insert(lifeDiscountCouponStoreFriendSendRecord);
-
-            //发送公告消息
-            LifeNotice lifeNotice = new LifeNotice();
-            //存入发送人
-            lifeNotice.setSenderId("system");
-            //存入接收人
-            lifeNotice.setReceiverId("user_" + lifeUser.getUserPhone());
-            //存入信息
-            lifeNotice.setContext(storeInfo.getStoreName() + " 赠送了您他的好友店铺优惠券,快去我的券包查看吧~");
-            //存入类型
-            lifeNotice.setNoticeType(1);
-            lifeNoticeMapper.insert(lifeNotice);
+                //存储发放日志
+                LifeDiscountCouponStoreFriendSendRecord lifeDiscountCouponStoreFriendSendRecord = new LifeDiscountCouponStoreFriendSendRecord();
+                //存入门店id
+                lifeDiscountCouponStoreFriendSendRecord.setStoreId(Integer.parseInt(lifeUserOrder.getStoreId()));
+                //存入接收人id
+                lifeDiscountCouponStoreFriendSendRecord.setUserId(userId);
+                //存入发放人id
+                lifeDiscountCouponStoreFriendSendRecord.setStoreUserId(storeUserId);
+                //存入订单id
+                lifeDiscountCouponStoreFriendSendRecord.setOrderId(Integer.parseInt(lifeUserOrder.getId()));
+                //存入优惠券ids
+                String[] couponIds = result.stream()
+                        .map(LifeDiscountCouponStoreFriendVo::getCouponId)
+                        .map(String::valueOf)  // 将 Integer 转换为 String
+                        .toArray(String[]::new);
+
+                String join = String.join(",", couponIds);
+                lifeDiscountCouponStoreFriendSendRecord.setDiscountCouponIds(join);
+                lifeDiscountCouponStoreFriendSendRecordMapper.insert(lifeDiscountCouponStoreFriendSendRecord);
+
+                //发送公告消息
+                LifeNotice lifeNotice = new LifeNotice();
+                //存入发送人
+                lifeNotice.setSenderId("system");
+                //存入接收人
+                lifeNotice.setReceiverId("user_" + lifeUser.getUserPhone());
+                //存入信息
+                lifeNotice.setContext(storeInfo.getStoreName() + " 赠送了您他的好友店铺优惠券,快去我的券包查看吧~");
+                //存入类型
+                lifeNotice.setNoticeType(1);
+                lifeNoticeMapper.insert(lifeNotice);
 
+            }
         }
+
+
+
+
         // 返回成功发放的优惠券信息列表
         return result;
     }
@@ -435,10 +461,11 @@ public class LifeDiscountCouponStoreFriendServiceImpl extends ServiceImpl<LifeDi
     }
 
     @Override
-    public List<LifeDiscountCouponFriendRuleVo> getReceivedSendFriendCouponList(String storeUserId, String friendStoreUserId) {
+    public List<LifeDiscountCouponFriendRuleVo> getReceivedSendFriendCouponList(String storeUserId, String friendStoreUserId,String storeName) {
         QueryWrapper<LifeDiscountCouponFriendRuleVo> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq(StringUtils.isNotEmpty(storeUserId),"ldcsf.store_user_id", storeUserId)
-                .eq(StringUtils.isNotEmpty(friendStoreUserId),"ldcsf.friend_store_user_id", friendStoreUserId);
+                .eq(StringUtils.isNotEmpty(friendStoreUserId),"ldcsf.friend_store_user_id", friendStoreUserId)
+                .like(StringUtils.isNotEmpty(storeName),"si.store_name", storeName);
         return lifeDiscountCouponStoreFriendMapper.getReceivedSendFriendCouponList(queryWrapper);
     }
 }

+ 13 - 1
alien-store/src/main/java/shop/alien/store/service/impl/StoreCommentServiceImpl.java

@@ -72,6 +72,8 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
 
     private final WebSocketProcess webSocketProcess;
 
+    private final TagsSynonymMapper tagsSynonymMapper;
+
     @Autowired
     private TextModerationUtil textModerationUtil;
 
@@ -91,7 +93,7 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
      * @return IPage<StoreComment>
      */
     @Override
-    public IPage<StoreCommentVo> getList(Integer pageNum, Integer pageSize, Integer businessId, Integer businessType, Integer storeId, Integer replyStatus, Integer commentLevel, Integer days, String phoneId, Integer userType) {
+    public IPage<StoreCommentVo> getList(Integer pageNum, Integer pageSize, Integer businessId, Integer businessType, Integer storeId, Integer replyStatus, Integer commentLevel, Integer days, String phoneId, Integer userType, Integer tagId) {
         IPage<StoreCommentVo> storeCommentIPage = new Page<>(pageNum, pageSize);
         QueryWrapper<StoreCommentVo> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq(null != businessId, "a.business_id", businessId);
@@ -142,6 +144,16 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
             queryWrapper.notIn("a.id",businessIds);
         }
 
+        //根据标签id查询表签字表拿到评论ids
+        if(tagId !=null){
+            List<TagsSynonym> tagsSynonymList = tagsSynonymMapper.selectList(new LambdaQueryWrapper<TagsSynonym>().eq(TagsSynonym::getMainTagId,tagId));
+            if(CollectionUtils.isNotEmpty(tagsSynonymList)){
+                List<Integer> commentIdList = tagsSynonymList.stream().filter(synonym -> synonym != null)
+                        .map(TagsSynonym::getCommentId).filter(commentId -> commentId != null).collect(Collectors.toList());
+                queryWrapper.in("a.id",commentIdList);
+            }
+        }
+
         //先查询父级评论
         queryWrapper.isNull(businessType != 1, "a.reply_id").eq("a.delete_flag", 0).orderByDesc("a.created_time");
         IPage<StoreCommentVo> page = storeCommentMapper.getCommentPage(storeCommentIPage, queryWrapper);

+ 82 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreCustomerServiceServiceImpl.java

@@ -1,13 +1,21 @@
 package shop.alien.store.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.RequiredArgsConstructor;
+import shop.alien.entity.store.AiIntelligentAssistant;
 import shop.alien.entity.store.StoreCustomerService;
+import shop.alien.mapper.AiIntelligentAssistantMapper;
 import shop.alien.mapper.StoreCustomerServiceMapper;
 import shop.alien.store.service.StoreCustomerServiceService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -24,10 +32,84 @@ public class StoreCustomerServiceServiceImpl extends ServiceImpl<StoreCustomerSe
 
     private final StoreCustomerServiceMapper storeCustomerServiceMapper;
 
+    private final AiIntelligentAssistantMapper aiIntelligentAssistantMapper;
+
     @Override
     public StoreCustomerService getByQuestion(String question) {
         LambdaQueryWrapper<StoreCustomerService> lambdaQueryWrapper = new LambdaQueryWrapper<>();
         List<StoreCustomerService> list = storeCustomerServiceMapper.selectList(lambdaQueryWrapper);
         return list.stream().filter(item -> item.getQuestion().contains(question)).findFirst().orElse(null);
     }
+
+    @Override
+    public StoreCustomerService saveStoreCustomerService(StoreCustomerService storeCustomerService) {
+        storeCustomerService.setUpdatedTime(new Date());
+        if (ObjectUtils.isNotEmpty(storeCustomerService.getId())) {
+            storeCustomerServiceMapper.updateById(storeCustomerService);
+        } else {
+            storeCustomerService.setCreatedTime(new Date());
+            storeCustomerServiceMapper.insert(storeCustomerService);
+        }
+        return storeCustomerService;
+    }
+
+    @Override
+    public void delStoreCustomerService(String id) {
+        storeCustomerServiceMapper.deleteById(id);
+    }
+
+    @Override
+    public IPage<StoreCustomerService> getStoreCustomerServicePage(int page, int size, String question, String type) {
+        LambdaQueryWrapper<StoreCustomerService> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.like(StringUtils.isNotEmpty(question), StoreCustomerService::getQuestion, question)
+                .eq(StringUtils.isNotEmpty(type), StoreCustomerService::getType, type)
+                .eq(StoreCustomerService::getDeleteFlag, 0)
+                .orderByDesc(StoreCustomerService::getCreatedTime);
+        IPage<StoreCustomerService> storeCustomerServiceIPage = new Page<>(page, size);
+        IPage<StoreCustomerService> selectPage = storeCustomerServiceMapper.selectPage(storeCustomerServiceIPage, lambdaQueryWrapper);
+        return selectPage;
+    }
+
+    @Override
+    public StoreCustomerService getById(String id) {
+        return storeCustomerServiceMapper.selectById(id);
+    }
+
+    @Override
+    public List<StoreCustomerService> getRandList(String type, Integer limit) {
+        LambdaQueryWrapper<StoreCustomerService> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(StoreCustomerService::getType, type)
+                .eq(StoreCustomerService::getDeleteFlag, 0)
+                .last("order by rand() LIMIT " + limit);
+        return storeCustomerServiceMapper.selectList(lambdaQueryWrapper);
+    }
+
+    @Override
+    public List<AiIntelligentAssistant> saveAiIntelligentAssistant(List<AiIntelligentAssistant> aiIntelligentAssistants) {
+        for (AiIntelligentAssistant aiIntelligentAssistant : aiIntelligentAssistants) {
+            aiIntelligentAssistant.setCreatedTime(new Date());
+            aiIntelligentAssistant.setUpdatedTime(new Date());
+        }
+        aiIntelligentAssistantMapper.insertList(aiIntelligentAssistants);
+        return aiIntelligentAssistants;
+    }
+
+    @Override
+    public List<AiIntelligentAssistant> selectAiIntelligentAssistant(String userId,String time) {
+        LambdaQueryWrapper<AiIntelligentAssistant> last = new LambdaQueryWrapper<AiIntelligentAssistant>()
+                .lt(AiIntelligentAssistant::getCreatedTime, time)
+                .eq(AiIntelligentAssistant::getDeleteFlag, 0)
+                .eq(AiIntelligentAssistant::getType, 0).eq(AiIntelligentAssistant::getUserId, userId).orderByDesc(AiIntelligentAssistant::getCreatedTime).last("limit 1");
+        AiIntelligentAssistant aiIntelligentAssistant = aiIntelligentAssistantMapper.selectOne(last);
+        if (ObjectUtils.isNotEmpty(aiIntelligentAssistant)) {
+            LambdaQueryWrapper<AiIntelligentAssistant> queryWrapper = new LambdaQueryWrapper<AiIntelligentAssistant>()
+                    .ge(AiIntelligentAssistant::getCreatedTime, aiIntelligentAssistant.getCreatedTime())
+                    .lt(AiIntelligentAssistant::getCreatedTime, time)
+                    .eq(AiIntelligentAssistant::getDeleteFlag, 0)
+                    .eq(AiIntelligentAssistant::getUserId, userId)
+                    .orderByAsc(AiIntelligentAssistant::getCreatedTime);
+            return aiIntelligentAssistantMapper.selectList(queryWrapper);
+        }
+        return new ArrayList<>();
+    }
 }

+ 5 - 2
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -1235,11 +1235,14 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         lifeNotice.setTitle("店铺审核通知");
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String createDate = simpleDateFormat.format(storeInfo.getCreatedTime());
+
+        com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
         if (2 == approvalStatus) {
-            lifeNotice.setContext("您在"+createDate+"提交的入驻店铺申请,审核失败。失败原因:"+reason+"。");
+            jsonObject.put("message", "您在"+createDate+"提交的入驻店铺申请,审核失败。失败原因:"+reason+"。");
         } else {
-            lifeNotice.setContext("您在"+createDate+"提交的入驻店铺申请,已通过审核,欢迎您的加入。");
+            jsonObject.put("message", "您在"+createDate+"提交的入驻店铺申请,已通过审核,欢迎您的加入。");
         }
+        lifeNotice.setContext(jsonObject.toJSONString());
         lifeNotice.setNoticeType(1); // 系统通知
         lifeNotice.setIsRead(0);
         lifeNoticeMapper.insert(lifeNotice);