Просмотр исходного кода

Merge branch 'master' into pre

# Conflicts:
#	netflix-dao/src/main/resources/mapper/YhShopMapper.xml
#	netflix-service/src/main/java/com/cyksj/service/mange/RefreshCacheService.java
#	netflix-service/src/main/java/com/cyksj/service/mange/impl/RefreshCacheServiceImpl.java
#	netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopGoodsController.java
zoujiajian 2 лет назад
Родитель
Сommit
4f6305aef5
17 измененных файлов с 189 добавлено и 107 удалено
  1. 27 0
      netflix-dao/src/main/java/com/cyksj/model/views/ChatgptConversionLimitView.java
  2. 1 1
      netflix-dao/src/main/resources/mapper/YhShopMapper.xml
  3. 7 0
      netflix-service/src/main/java/com/cyksj/redis/RedisService.java
  4. 3 1
      netflix-service/src/main/java/com/cyksj/service/chatgpt/impl/ChatGptAccountServiceImpl.java
  5. 16 58
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpEventActionServiceImpl.java
  6. 12 1
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpMsgBulkTaskServiceImpl.java
  7. 1 0
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpUserServiceImpl.java
  8. 2 2
      netflix-service/src/main/java/com/cyksj/service/mange/RefreshCacheService.java
  9. 5 6
      netflix-service/src/main/java/com/cyksj/service/mange/impl/RefreshCacheServiceImpl.java
  10. 1 1
      netflix-service/src/main/java/com/cyksj/service/user/impl/UserBindRelationServiceImpl.java
  11. 1 5
      netflix-service/src/main/java/com/cyksj/service/wechat/impl/WeChatServiceImpl.java
  12. 83 0
      netflix-service/src/main/java/com/cyksj/task/CorpChatScheduler.java
  13. 5 2
      netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java
  14. 7 1
      netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java
  15. 2 4
      netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopGoodsController.java
  16. 16 21
      netflix-web/src/main/java/com/cyksj/web/controller/mirror/MirrorController.java
  17. 0 4
      netflix-web/src/main/java/com/cyksj/web/controller/payment/OrderController.java

+ 27 - 0
netflix-dao/src/main/java/com/cyksj/model/views/ChatgptConversionLimitView.java

@@ -0,0 +1,27 @@
+package com.cyksj.model.views;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+/**
+ * @author chan
+ * @date 2024/4/28 14:11
+ */
+@Data
+public class ChatgptConversionLimitView {
+
+    //"{\"detail\":{\"message\":\"您的账号已达到GPT-4的使用上限。您现在可以继续使用默认模型,或者重试在\",\"code\":\"model_cap_exceeded\",\"clears_in\":2687}}";
+
+    private Detail detail;
+
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    @Data
+    public static class Detail{
+
+        private String message;
+
+        private String code;
+
+        private Long clears_in;
+    }
+}

+ 1 - 1
netflix-dao/src/main/resources/mapper/YhShopMapper.xml

@@ -63,7 +63,7 @@
     </select>
 
     <select id="getYhShopSkuSysStatusDownInfo" resultType="com.cyksj.model.dto.YhShopSkuDownInfo">
-        select any_value(g.title) as title, group_concat(sku.spec_val SEPARATOR '') as specVal
+        select any_value(g.title) as title, group_concat(distinct sku.spec_val SEPARATOR '') as specVal
         from (select goods_id, sku_id
               from yh_shop_sku_sys_take_down_record
               where user_id = #{userId}

+ 7 - 0
netflix-service/src/main/java/com/cyksj/redis/RedisService.java

@@ -809,6 +809,13 @@ public class RedisService {
         USER_DISTRIBUTE_ADD_KEY("user_distribute_add_key:%s", "分销用户新增key", 30l),
 
         CORP_CUSTOMER_ACQUISTION_CLICKID("corp:customer:post:%s","巨量投放,获客链接 跳转存储点击id",60*60*24),
+
+        CORP_CUSTOMER_ACQUISTION_START_CHAT("corp:customer:post:start_chat","获客链接 发起回话存储点击id",60*60*24),
+
+        CORP_CUSTOMER_ACQUISTION_START_CHAT_COUNT("corp:customer:post:start_chat:count:%s","获客链接 发起回话回传计数",60*60*24),
+
+        CORP_CUSTOMER_ACQUISTION_START_CHAT_SET("corp:customer:post:start_chat_set","获客链接 发起回话待回传set",60*60*24),
+
         //获客链接 到企业微信内将平台标识与unionId 对应
         CORP_CUSTOMER_ACQUISTION_UNIONID_CLICKID("corp:customer:unionId:%s","unionid 对应的clickId",60*60*24),
 

+ 3 - 1
netflix-service/src/main/java/com/cyksj/service/chatgpt/impl/ChatGptAccountServiceImpl.java

@@ -254,7 +254,9 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
     public String getCarLoginUrlWithToken(String userToken, String carId) {
         ChatgptUser chatgptUser = getCarChatGptUserWithToken(userToken);
         if (chatgptUser != null) {
-            return CAR_GPT_DOMAIN + "/auth/logintoken?carid=" + carId + "&usertoken=" + chatgptUser.getUserToken();
+            String DOMAIN = "https://chat.galaxydvd.com";
+            log.info("domain:{},渠道用户:{},在{}获取跳转GPT镜像的登录url", DOMAIN, userToken, DateTime.now());
+            return DOMAIN + "/auth/logintoken?carid=" + carId + "&usertoken=" + chatgptUser.getUserToken();
         } else {
             throw BusinessRuntimeException.getInstance("服务出了点问题");
         }

+ 16 - 58
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpEventActionServiceImpl.java

@@ -575,69 +575,21 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
 		//外部联系人id
 		String externalUserId = message.getExternalUserId();
 		log.info("监听微信客户:{}发起会话事件", externalUserId);
-		try {
-			//等待3s
-			Thread.sleep(3000);
-		} catch (InterruptedException e) {
-		}
+
 		//获客链接id
 		String linkId = message.getLinkId();
-		CorpUserAuth corpUserAuth = corpUserAuthMapper.selectOne(Wrappers.lambdaQuery(CorpUserAuth.class)
-				.eq(CorpUserAuth::getExternalUserid, externalUserId).last("limit 1"));
-		String unionId = null;
-		if (corpUserAuth != null) {
-			CorpUser corpUser = corpUserMapper.selectById(corpUserAuth.getCorpUserId());
-			if (corpUser != null) {
-				unionId = corpUser.getUnionid();
+		CorpCustomerAcquisitionLink corpCustomerAcquisitionLink = corpCustomerAcquisitionLinkMapper.selectOne(Wrappers.lambdaQuery(CorpCustomerAcquisitionLink.class).eq(CorpCustomerAcquisitionLink::getLinkId, linkId));
+
+		if(corpCustomerAcquisitionLink != null){
+			//记录发起对话事件
+			CorpCustomerAcquisitionLinkPopularize corpCustomerAcquisitionLinkPopularize = corpCustomerAcquisitionLinkPopularizeMapper.selectOne(Wrappers.lambdaQuery(CorpCustomerAcquisitionLinkPopularize.class)
+					.eq(CorpCustomerAcquisitionLinkPopularize::getIsChat, 1)
+					.eq(CorpCustomerAcquisitionLinkPopularize::getCustomerAcquistionLinkId, corpCustomerAcquisitionLink.getId()).last("limit 1"));
+			if (corpCustomerAcquisitionLinkPopularize != null) {
+				redisService.sSet(RedisService.key.CORP_CUSTOMER_ACQUISTION_START_CHAT_SET.getEnvName(), externalUserId);
 			}
 		}
-		if (StrUtil.isEmpty(unionId)) {
-			return null;
-		}
-		CorpCustomerAcquisitionLinkPopularize corpCustomerAcquisitionLinkPopularize = corpCustomerAcquisitionLinkPopularizeMapper.selectOne(Wrappers.lambdaQuery(CorpCustomerAcquisitionLinkPopularize.class)
-				.eq(CorpCustomerAcquisitionLinkPopularize::getIsChat, 1)
-				.eq(CorpCustomerAcquisitionLinkPopularize::getCustomerAcquistionLinkId, linkId).last("limit 1"));
-		if (corpCustomerAcquisitionLinkPopularize != null) {
-			//callback
-			String callback = null;
-			String params = redisService.getStr(String.format(RedisService.key.CORP_CUSTOMER_ACQUISTION_UNIONID_CLICKID.getName(), unionId));
-			if (StringUtils.isNotBlank(params)) {
-				JSONObject paramsObj = JSONUtil.parseObj(params);
-				callback = paramsObj.getStr("callback");
-			}
-			//如果需要延后主动回传的做持久化.
-			if (StrUtil.isNotBlank(callback)) {
-				log.info("开始回传客户:{}发起会话事件", externalUserId);
-				//如果为加粉则直接回传
-				if (corpCustomerAcquisitionLinkPopularize.getType() == 1) {
-					//如果需要延后主动回传的做持久化.
-					if (!corpCustomerAcquisitionLinkPopularize.getDelayedPost()) {
-						postData(callback, corpCustomerAcquisitionLinkPopularize.getEvent());
-					}
-				} else {
-					//深度转化 前置加粉事件回传.
-					if (StringUtils.isNotBlank(corpCustomerAcquisitionLinkPopularize.getAddEvent())) {
-						postData(callback, corpCustomerAcquisitionLinkPopularize.getAddEvent());
-					}
-				}
-				// 是否延后回传都记录,只看是否直接回传.
-				CorpCustomerAcquistionCallback corpCustomerAcquistionCallback =
-						corpCustomerAcquistionCallbackMapper.selectOne(Wrappers.lambdaQuery(CorpCustomerAcquistionCallback.class).eq(CorpCustomerAcquistionCallback::getCallback, callback).eq(CorpCustomerAcquistionCallback::getUnionId, unionId));
-				if (corpCustomerAcquistionCallback == null) {
-					corpCustomerAcquistionCallback = new CorpCustomerAcquistionCallback();
-				}
-				corpCustomerAcquistionCallback.setCallback(callback);
-				corpCustomerAcquistionCallback.setEvent(corpCustomerAcquisitionLinkPopularize.getEvent());
-				corpCustomerAcquistionCallback.setUnionId(unionId);
-				corpCustomerAcquistionCallback.setStatus(!corpCustomerAcquisitionLinkPopularize.getDelayedPost());
-				if (corpCustomerAcquistionCallback.getId() != null) {
-					corpCustomerAcquistionCallbackMapper.updateById(corpCustomerAcquistionCallback);
-				} else {
-					corpCustomerAcquistionCallbackMapper.insert(corpCustomerAcquistionCallback);
-				}
 
-			}
-		}
 		return null;
 	}
 
@@ -1229,6 +1181,12 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
 							corpCustomerAcquistionCallbackMapper.insert(corpCustomerAcquistionCallback);
 						}
 					}
+
+					//是否为对话 回传
+					if (corpCustomerAcquisitionLinkPopularize.getIsChat()) {
+						jsonObject.putOpt("event", corpCustomerAcquisitionLinkPopularize.getAddEvent());
+						redisService.hset(RedisService.key.CORP_CUSTOMER_ACQUISTION_START_CHAT.getEnvName(), unionId, jsonObject.toString(), RedisService.key.CORP_CUSTOMER_ACQUISTION_START_CHAT.getTimeout());
+					}
 				}
 			}
 		}

+ 12 - 1
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpMsgBulkTaskServiceImpl.java

@@ -93,6 +93,8 @@ public class CorpMsgBulkTaskServiceImpl extends ServiceImpl<CorpMsgBulkTaskMappe
 		if (corpMsgBulkTask.getWxCorpId() == null) corpMsgBulkTask.setWxCorpId(2l);
 		if (CollUtil.isNotEmpty(corpMsgBulkTask.getAttachments())) {
 			corpMsgBulkTask.setAttachmentsStr(Jsons.toJson(corpMsgBulkTask.getAttachments()));
+		} else {
+			corpMsgBulkTask.setAttachmentsStr(null);
 		}
 		setCorn(corpMsgBulkTask);
 		if (corpMsgBulkTask.getId() != null) {
@@ -247,7 +249,10 @@ public class CorpMsgBulkTaskServiceImpl extends ServiceImpl<CorpMsgBulkTaskMappe
 		//获取对应标签的客户
 		WxCorpApp wxCorpApp = wxCorpAppMapper.selectById(corpMsgBulkTask.getWxCorpId());
 		Assert.notNull(wxCorpApp, "企业微信未配置");
-		List<String> tagIds = Jsons.parseList(corpMsgBulkTask.getChooseTagStr(), String.class);
+		List<String> tagIds = null;
+		if (StrUtil.isNotBlank(corpMsgBulkTask.getChooseTagStr())) {
+			tagIds = Jsons.parseList(corpMsgBulkTask.getChooseTagStr(), String.class);
+		}
 		//客服集合
 		List<String> service_follow_ids = null;
 		SysConfig serviceConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
@@ -458,6 +463,12 @@ public class CorpMsgBulkTaskServiceImpl extends ServiceImpl<CorpMsgBulkTaskMappe
 		List<CorpMsgBulkTaskTagRelation> relations = corpMsgBulkTaskTagRelationMapper.selectList(Wrappers.lambdaQuery(CorpMsgBulkTaskTagRelation.class)
 				.eq(CorpMsgBulkTaskTagRelation::getTaskId, taskId));
 		String chooseTagStr = corpMsgBulkTask.getChooseTagStr();
+		if (corpMsgBulkTask.getSendScope() == 2 && StrUtil.isEmpty(chooseTagStr)) {
+			throw BusinessRuntimeException.getInstance("请选择对应的标签");
+		}
+		if (StrUtil.isEmpty(chooseTagStr)) {
+			return;
+		}
 		List<String> corpTagIds = Jsons.parseList(chooseTagStr, String.class);
 		if (CollUtil.isNotEmpty(relations)) {
 			//清除删除的关系

+ 1 - 0
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpUserServiceImpl.java

@@ -111,6 +111,7 @@ public class CorpUserServiceImpl implements CorpUserService {
 			view.setTicketViews(tkCollect);
 			List<CorpWxOrderDonView> orderDonViews = beanSearcher.searchAll(CorpWxOrderDonView.class, MapUtils.builder()
 					.field(CorpWxOrderDonView::getUserId, userIdList).op(Operator.InList)
+					.orderBy(CorpWxOrderDonView::getId).desc()
 					.build());
 			view.setOrderDonViews(orderDonViews);
 		}

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/mange/RefreshCacheService.java

@@ -23,11 +23,11 @@ public interface RefreshCacheService {
 	 */
 	void refreshGoodsSkuSubsidyPageCache();
 
+	void refreshShopUserIdCacheByYshId(Long yhsId);
+
 
 	/**
 	 * 清除用户店铺缓存
 	 */
 	void refreshUserShopMangeCache(String customId);
-
-	void refreshShopUserIdCacheByYshId(Long yhsId);
 }

+ 5 - 6
netflix-service/src/main/java/com/cyksj/service/mange/impl/RefreshCacheServiceImpl.java

@@ -39,16 +39,15 @@ public class RefreshCacheServiceImpl implements RefreshCacheService {
 	}
 
 	@Override
-	public void refreshUserShopMangeCache(String customId) {
-		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + customId + "*");
+	public void refreshShopUserIdCacheByYshId(Long yhsId) {
+		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + "*";
+		Set<String> keys = redisService.keys(yhShopCacheKey);
 		redisService.del(keys.toArray(String[]::new));
 	}
 
-
 	@Override
-	public void refreshShopUserIdCacheByYshId(Long yhsId) {
-		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + "*";
-		Set<String> keys = redisService.keys(yhShopCacheKey);
+	public void refreshUserShopMangeCache(String customId) {
+		Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + customId + "*");
 		redisService.del(keys.toArray(String[]::new));
 	}
 }

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/user/impl/UserBindRelationServiceImpl.java

@@ -38,7 +38,7 @@ public class UserBindRelationServiceImpl implements UserBindRelationService {
 
 		UserBindDetail userBindDetail;
 		//微信用户
-		if (StrUtil.isNotEmpty(user.getOpenId())) {
+		if (StrUtil.isNotBlank(user.getUnionid()) || StrUtil.isNotEmpty(user.getOpenId())) {
 			userIds.add(userId);
 			userBindDetail = userBindDetailMapper.selectOne(Wrappers.lambdaQuery(UserBindDetail.class)
 					.eq(UserBindDetail::getUserId, userId).last("limit 1"));

+ 1 - 5
netflix-service/src/main/java/com/cyksj/service/wechat/impl/WeChatServiceImpl.java

@@ -684,11 +684,7 @@ public class WeChatServiceImpl implements WeChatService {
             log.info("获取学生信息失败:{}", re.getStr("errmsg"));
             throw BusinessRuntimeException.getInstance("获取认证信息失败");
         }
-        Boolean isStudent = re.getBool("is_student");
-        if (isStudent == null || !isStudent) {
-            throw BusinessRuntimeException.getInstance("仅支持大学生用户认证");
-        }
-        Integer bindStatus = re.getInt("bind_status");
+        Integer bindStatus = Optional.ofNullable(re.getInt("bind_status")).orElse(1);
         //绑定状态:
         //1-未绑定
         //2-审核中

+ 83 - 0
netflix-service/src/main/java/com/cyksj/task/CorpChatScheduler.java

@@ -0,0 +1,83 @@
+package com.cyksj.task;
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.cyksj.common.util.StringUtil;
+import com.cyksj.mapper.corp.CorpUserAuthMapper;
+import com.cyksj.mapper.corp.CorpUserMapper;
+import com.cyksj.model.entity.CorpUser;
+import com.cyksj.model.entity.CorpUserAuth;
+import com.cyksj.model.entity.OrderDonPost;
+import com.cyksj.redis.RedisService;
+import com.cyksj.service.corp.WxCorpOps;
+import com.cyksj.service.corp.msg.CorpEventActionService;
+import com.cyksj.service.order.OrderDonPostService;
+import com.ejlchina.searcher.BeanSearcher;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * @author chan
+ * @date 2024-04-29 12:14
+ */
+@Component
+@Slf4j
+@RequiredArgsConstructor
+public class CorpChatScheduler {
+
+	private final CorpUserMapper corpUserMapper;
+
+	private final CorpUserAuthMapper corpUserAuthMapper;
+
+	private final RedisService redisService;
+
+	private final OrderDonPostService orderDonPostService;
+
+	/**
+	 * 客服业绩数据统计
+	 */
+    @Scheduled(cron = "5 0/2 * * * ?")
+	public void chatPost() {
+		Set<Object> chatRecord = redisService.sGet(RedisService.key.CORP_CUSTOMER_ACQUISTION_START_CHAT_SET.getEnvName());
+		log.info("发起对话回传. size: {}", chatRecord.size());
+		chatRecord.forEach((key) -> {
+			log.info("发起对话回传. key: {}", key);
+			CorpUserAuth corpUserAuth = corpUserAuthMapper.selectOne(Wrappers.lambdaQuery(CorpUserAuth.class)
+					.eq(CorpUserAuth::getExternalUserid, key).last("limit 1"));
+			String unionId = null;
+			if (corpUserAuth != null) {
+				CorpUser corpUser = corpUserMapper.selectById(corpUserAuth.getCorpUserId());
+				if (corpUser != null) {
+					unionId = corpUser.getUnionid();
+				}
+			}
+			log.info("发起对话回传. unionId: {}", unionId);
+			if (StrUtil.isNotBlank(unionId)) {
+				String json = StringUtil.getString(redisService.hget(RedisService.key.CORP_CUSTOMER_ACQUISTION_START_CHAT.getEnvName(), unionId));
+				if (StringUtil.isNotBlank(json)) {
+					JSONObject jsonObject = JSONUtil.parseObj(json);
+					String callback = jsonObject.getStr("callback");
+					try {
+						orderDonPostService.post(OrderDonPost.Type.OE.getType(), callback, Optional.ofNullable(jsonObject.getStr("event")).orElse("customer_effective"));
+						redisService.setRemove(RedisService.key.CORP_CUSTOMER_ACQUISTION_START_CHAT_SET.getEnvName(), key);
+						log.info("发起对话回传成功. {}", key);
+					} catch (Exception e) {
+						log.error("发起对话回传失败. {}", e.getMessage());
+					}
+				}
+			}else {
+				Long count = redisService.incr(RedisService.key.CORP_CUSTOMER_ACQUISTION_START_CHAT_COUNT.getNameFormat(key), 1L);
+				if(count > 3){
+					redisService.setRemove(RedisService.key.CORP_CUSTOMER_ACQUISTION_START_CHAT_SET.getEnvName(), key);
+				}
+			}
+		});
+	}
+}

+ 5 - 2
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -273,8 +273,11 @@ public class GroupRelationController {
                 .between(DoubleVerifyClickRecord::getCreatedTime, DateUtil.beginOfMonth(now), DateUtil.endOfMonth(now)));
         //获取双重验证码
         Boolean isHasVerifyCode = StrUtil.isNotBlank(groupsRelationView.getVerifyCode()) ? true : false;
-        Integer num = groupRelationFrontService.getUserCodeNumBySkuId(userId, groupsRelationView.getSkuId(), isHasVerifyCode);
-        if (count >= num) throw BusinessRuntimeException.getInstance("获取双重验证码次数上限");
+        //出去亚马逊 获取限制
+        if (groupsRelationView.getGoodsId() != 6) {
+            Integer num = groupRelationFrontService.getUserCodeNumBySkuId(userId, groupsRelationView.getSkuId(), isHasVerifyCode);
+            if (count >= num) throw BusinessRuntimeException.getInstance("获取双重验证码次数上限");
+        }
         //一分钟内 只能一人获取
         boolean b = redisService.setNx(RedisService.key.DOUBLE_VERIFY_CODE_VIEW_MINUTES_KEY.getName() + groupsRelationView.getTripsAccount(), relationId, RedisService.key.DOUBLE_VERIFY_CODE_VIEW_MINUTES_KEY.getTimeout());
         if (!b) {

+ 7 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java

@@ -111,7 +111,7 @@ public class CmsOrderController {
 
 	@GetMapping("/get")
 	@SaCheckPermission("order:view")
-	public Result<SearchResult<OrderDonBackView>> get(Long channelId, String account, String showId, Long acId, String nickname, String register, Boolean isGoogle) {
+	public Result<SearchResult<OrderDonBackView>> get(Long channelId, String account, String showId, Long acId, String nickname, String register, Boolean isGoogle, Boolean isSubsidy) {
 		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
 		if (channelId != null) {
 			List<Long> popularizeIds = channelPopularizeMapper.getPopularizeIdByChannelId(channelId);
@@ -155,6 +155,12 @@ public class CmsOrderController {
 			}
 			conditionSql += " limit 1)";
 		}
+		if (isSubsidy != null) {
+			if (StrUtil.isNotEmpty(conditionSql)) {
+				conditionSql += " and ";
+			}
+			conditionSql += " exists (select 1 from order_don_subsidy_relate ocr where ocr.order_id = o.id limit 1)";
+		}
 		if (StrUtil.isNotBlank(conditionSql)) {
 			builder.put("condition", conditionSql);
 		}

+ 2 - 4
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopGoodsController.java

@@ -87,10 +87,8 @@ public class YhShopGoodsController {
 		long userId = StpYhShopManageUser.getLoginIdAsLong();
 		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
 				.eq(YhShop::getUserId, userId).last("limit 1"));
-		List<YhShopGoodsSku> list = yhShopGoodsSkuService.list(Wrappers.lambdaQuery(YhShopGoodsSku.class)
-				.eq(YhShopGoodsSku::getUserId, userId)
-				.eq(YhShopGoodsSku::getGoodsId, goodsId)
-				.eq(YhShopGoodsSku::getDeleted, true));
+		List<YhShopGoodsView.YhShopGoodsSkuView> list = beanSearcher.searchAll(YhShopGoodsView.YhShopGoodsSkuView.class, MapUtils.builder().put("uid", String.format("and ysgs.user_id = %s", userId))
+				.field(YhShopGoodsView.YhShopGoodsSkuView::getGoodsId, goodsId).build());
 		list.forEach(sku -> {
 			YhShopGoodsRateView.YhShopGoodsSkuRateView yhShopGoodsSkuRateView = beanSearcher.searchFirst(YhShopGoodsRateView.YhShopGoodsSkuRateView.class, MapUtils.builder().field(YhShopGoodsRateView.YhShopGoodsSkuRateView::getSkuId, sku.getSkuId()).build());
 			if (sku.getPrice().compareTo(yhShopGoodsSkuRateView.getMaxPrice()) > 0 || sku.getPrice().compareTo(yhShopGoodsSkuRateView.getMinPrice()) < 0) {

+ 16 - 21
netflix-web/src/main/java/com/cyksj/web/controller/mirror/MirrorController.java

@@ -1,5 +1,6 @@
 package com.cyksj.web.controller.mirror;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.json.JSONObject;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
@@ -13,6 +14,7 @@ import com.cyksj.model.response.ConversationLimitResponse;
 import com.cyksj.model.views.ChatGptUserConversationRecordHistoryView;
 import com.cyksj.model.views.ChatGptUserView;
 import com.cyksj.model.views.ChatgptCarInfoView;
+import com.cyksj.model.views.ChatgptConversionLimitView;
 import com.cyksj.service.chatgpt.ChatGptAccountService;
 import com.cyksj.web.util.StpUserUtil;
 import com.ejlchina.searcher.BeanSearcher;
@@ -31,6 +33,7 @@ import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.LocalDateTime;
+import java.util.Date;
 import java.util.Set;
 
 /**
@@ -126,7 +129,7 @@ public class MirrorController {
      * 会话限制
      */
     @RequestMapping("/gpt/conversation/limit")
-    public void conversationLimit(@RequestParam(value = "isCar", defaultValue = "false") Boolean isCar, @RequestBody ConversationRequest conversationRequest) {
+    public ChatgptConversionLimitView conversationLimit(@RequestParam(value = "isCar", defaultValue = "false") Boolean isCar, @RequestBody ConversationRequest conversationRequest) {
         //1.从request获取请求头Authorization 并取 值内 'Bearer ' 后的值为usertoken
         String authorization = request.getHeader("Authorization");
         String carid = request.getHeader("Carid");
@@ -143,34 +146,26 @@ public class MirrorController {
             //text-davinci-002-render-sha 3.5
             ConversationLimitResponse conversationLimitResponse = chatGptAccountService.conversationLimit(userToken, conversationRequest.getModel(), conversationRequest.getCarId(), user, isCar);
 
-            OutputStream out = null;
-            String messgae = "";
             if (conversationLimitResponse.isLimited()) {
-                response.setStatus(429);
-                String json = "{\"detail\":{\"message\":\"您的账号已达到GPT-4的使用上限。您现在可以继续使用默认模型,或者重试在\",\"code\":\"model_cap_exceeded\",\"clears_in\":2687}}";
-                JSONObject res = new JSONObject(json);
-                res.putOpt("clears_in", conversationLimitResponse.getNextAvailableTime() / 1000);
-                messgae = res.toString();
+                response.setStatus(400);
+                //String json = "{\"detail\":{\"message\":\"您的账号已达到GPT-4的使用上限。您现在可以继续使用默认模型,或者重试在\",\"code\":\"model_cap_exceeded\",\"clears_in\":2687}}";
+                ChatgptConversionLimitView chatgptConversionLimitView = new ChatgptConversionLimitView();
+                ChatgptConversionLimitView.Detail detail = new ChatgptConversionLimitView.Detail();
+                detail.setMessage("您目前的套餐已达到GPT-4的使用上限。您可以继续使用3.5,预计 " + DateUtil.format(new Date(conversationLimitResponse.getNextAvailableTime()), "yyyy-MM-dd HH:mm:ss") + " 恢复");
+                chatgptConversionLimitView.setDetail(detail);
+                return chatgptConversionLimitView;
             } else {
                 response.setStatus(200);
+                //记录提问时间,车次,标题和模型
+                TASK_EXECUTOR.execute(() -> {
+                    chatGptAccountService.saveConversationRecord(userToken, conversationRequest);
+                });
             }
             //5.获取 conversationRequest 中的model 字段,判断是否为 gpt-4 如果为gpt-4 执行 查看是否达到限制方法
             //6.如果达到限制,返回状态码 429 并返回文本 xxx
-            try {
-                out = response.getOutputStream();
-                IoKit.write(messgae, out);
-            } catch (Throwable e) {
-                log.error("conversationLimit write response error", e);
-            } finally {
-                IoKit.close(out);
-            }
         }
 
-        //记录提问时间,车次,标题和模型
-        TASK_EXECUTOR.execute(() -> {
-            chatGptAccountService.saveConversationRecord(userToken, conversationRequest);
-        });
-        response.setStatus(200);
+        return new ChatgptConversionLimitView();
     }
 
 

+ 0 - 4
netflix-web/src/main/java/com/cyksj/web/controller/payment/OrderController.java

@@ -36,7 +36,6 @@ import com.cyksj.model.views.OrderCommentView;
 import com.cyksj.service.order.OrderDonService;
 import com.cyksj.service.paypal.PayPalService;
 import com.cyksj.service.paypal.PaypalPayConfigService;
-import com.cyksj.service.shop.YhShopFrontService;
 import com.cyksj.service.stripe.StripePayConfigService;
 import com.cyksj.service.stripe.StripeService;
 import com.cyksj.service.user.UserBindRelationService;
@@ -120,9 +119,6 @@ public class OrderController {
     @Autowired
     private StripeService stripeService;
 
-    @Autowired
-    private YhShopFrontService yhShopFrontService;
-
     /**
      * 支付
      * @author chan