فهرست منبع

Merge branch 'master' into pre

# Conflicts:
#	netflix-common/src/main/java/com/cyksj/common/util/StringUtil.java
#	netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java
zoujiajian 2 سال پیش
والد
کامیت
98b1dac087

+ 25 - 0
netflix-common/src/main/java/com/cyksj/common/util/StringUtil.java

@@ -2,8 +2,10 @@ package com.cyksj.common.util;
 
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
+import com.cyksj.dto.ArkIpAddressDto;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -50,6 +52,8 @@ public final class StringUtil {
 
 	private static final String baseStr = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
 
+	private static final String PAID_IP_APP_CODE_AUTH = "APPCODE ce891b0008634139a493d477c064ff19";
+
 	/**
 	 * provate constructor
 	 */
@@ -590,4 +594,25 @@ public final class StringUtil {
 		}
 		return result;
 	}
+
+	/**
+	 * 付费ip地址查询
+	 */
+	public static String paidIpAddress(String ip) {
+		cn.hutool.http.HttpResponse execute = HttpUtil.createGet(String.format("https://ipaddr.market.alicloudapi.com/ip_addr_search/v1?IP_ADDR=%s", ip))
+				.header("Authorization", PAID_IP_APP_CODE_AUTH)
+				.header("Content-Type", "application/x-www-form-urlencoded; charset=utf-8")
+				.execute();
+
+		try {
+			ArkIpAddressDto arkIpAddressDto = Jsons.parseObject(execute.body(), ArkIpAddressDto.class);
+			ArkIpAddressDto.Entity.InputIpAddress inputIpAddress = arkIpAddressDto.getEntity().getInputIpAddress();
+			return new StringBuilder()
+					.append(inputIpAddress.getNation())
+					.append(inputIpAddress.getProvince())
+					.append(inputIpAddress.getCity()).toString();
+		} catch (Exception e) {
+		}
+		return "unknown";
+	}
 }

+ 89 - 0
netflix-common/src/main/java/com/cyksj/dto/ArkIpAddressDto.java

@@ -0,0 +1,89 @@
+package com.cyksj.dto;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 项目名: yhlxj
+ * 文件名: ArkIpAddressDto
+ * 创建者: JavaZou
+ * 创建时间:2024/6/21 11:15
+ */
+@Getter
+@Setter
+public class ArkIpAddressDto {
+	private String inputString;
+	private String inputIpAddress;
+	private String callerIpAddress;
+	private String status;
+	private Entity entity;
+
+	@Getter
+	@Setter
+	public static class Entity {
+		private InputIpAddress inputIpAddress;
+		private CallerIpAddress callerIpAddress;
+
+		/**
+		 * ip信息
+		 */
+		@Getter
+		@Setter
+		public static class InputIpAddress {
+			@JsonProperty("IP_ADDRESS")
+			private String ipAddress;
+			@JsonProperty("GLOBAL")
+			private String global;
+			@JsonProperty("NATION")
+			private String nation;
+			@JsonProperty("NATION_NAME_EN")
+			private String nationNameEn;
+			@JsonProperty("NATION_NAME_EN_ABBR")
+			private String nationNameEnAbbr;
+			@JsonProperty("PROVINCE")
+			private String province;
+			@JsonProperty("CITY")
+			private String city;
+			@JsonProperty("DISTRICT")
+			private String district;
+			@JsonProperty("ISP")
+			private String isp;
+			@JsonProperty("ADCODE")
+			private String adcode;
+			@JsonProperty("GPS")
+			private String gps;
+			@JsonProperty("STATUS")
+			private String status;
+		}
+
+		@Getter
+		@Setter
+		public static class CallerIpAddress {
+			@JsonProperty("IP_ADDRESS")
+			private String ipAddress;
+			@JsonProperty("GLOBAL")
+			private String global;
+			@JsonProperty("NATION")
+			private String nation;
+			@JsonProperty("NATION_NAME_EN")
+			private String nationNameEn;
+			@JsonProperty("NATION_NAME_EN_ABBR")
+			private String nationNameEnAbbr;
+			@JsonProperty("PROVINCE")
+			private String province;
+			@JsonProperty("CITY")
+			private String city;
+			@JsonProperty("DISTRICT")
+			private String district;
+			@JsonProperty("ISP")
+			private String isp;
+			@JsonProperty("ADCODE")
+			private String adcode;
+			@JsonProperty("GPS")
+			private String gps;
+			@JsonProperty("STATUS")
+			private String status;
+		}
+	}
+}

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/mapper/GroupsRelationMapper.java

@@ -72,4 +72,6 @@ public interface GroupsRelationMapper extends BaseMapper<GroupsRelation> {
 	List<RenewalView> getUserHasPayGoods(@Param("list") List<Long> userIds, @Param("now") DateTime now);
 
 	Long getExperienceTicket(@Param("userId") Long userId, @Param("skuId") Long skuId);
+
+	Long selectGoodsDonQaByGoodsId(Long goodsId);
 }

+ 13 - 0
netflix-dao/src/main/java/com/cyksj/mapper/OrderDonExceptionUserRecordMapper.java

@@ -0,0 +1,13 @@
+package com.cyksj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cyksj.model.entity.OrderDonExceptionUserRecord;
+
+/**
+ * 项目名: yhlxj
+ * 文件名: OrderDonExceptionUserRecordMapper
+ * 创建者: JavaZou
+ * 创建时间:2024/6/21 11:36
+ */
+public interface OrderDonExceptionUserRecordMapper extends BaseMapper<OrderDonExceptionUserRecord> {
+}

+ 24 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/OrderDonExceptionUserRecord.java

@@ -0,0 +1,24 @@
+package com.cyksj.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 项目名: yhlxj
+ * 文件名: OrderDonExceptionUserRecord
+ * 创建者: JavaZou
+ * 创建时间:2024/6/21 11:34
+ */
+@Getter
+@Setter
+public class OrderDonExceptionUserRecord extends BaseEntity{
+	private Long orderId;
+
+	private Long userId;
+
+	private String ip;
+
+	private String buyerId;
+
+	private String address;
+}

+ 9 - 0
netflix-dao/src/main/resources/mapper/GroupRelationMapper.xml

@@ -354,4 +354,13 @@
                  inner join groups_trips gt on gt.id = gr.groups_id
         where gt.sku_id = #{skuId} limit 1
     </select>
+
+    <select id="selectGoodsDonQaByGoodsId" resultType="java.lang.Long">
+        select count(1)
+        from (select question_id from goods_don_qa_relate where goods_id = #{goodsId} and deleted is true) s
+                 inner join goods_don_qa qa on qa.id = s.question_id
+        where qa.type = 2
+          and qa.status is true
+          and qa.deleted is true
+    </select>
 </mapper>

+ 16 - 12
netflix-service/src/main/java/com/cyksj/service/chatgpt/impl/ChatGptAccountServiceImpl.java

@@ -257,18 +257,23 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
             ChatgptUser chatgptUser = getChatgptCarUser(userId, relationId, groupsRelation, goodsDonSku);
 
             String DOMAIN = "https://chat.galaxydvd.com";
-            try {
-                SysConfig sysConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, "mirror_gpt_domain"));
-                if (sysConfig != null) {
-                    String sysValue = sysConfig.getSysValue();
-                    if (JSONUtil.isJsonArray(sysValue)) {
-                        List<String> domainList = JSONUtil.parseArray(sysValue).toList(String.class);
-                        DOMAIN = domainList.get(RandomUtil.randomInt(domainList.size()));
+            if(goodsDonSku.getId() == 444){
+                DOMAIN = "https://car.galaxydvd.com";
+            }else {
+                try {
+                    SysConfig sysConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, "mirror_gpt_domain"));
+                    if (sysConfig != null) {
+                        String sysValue = sysConfig.getSysValue();
+                        if (JSONUtil.isJsonArray(sysValue)) {
+                            List<String> domainList = JSONUtil.parseArray(sysValue).toList(String.class);
+                            DOMAIN = domainList.get(RandomUtil.randomInt(domainList.size()));
+                        }
                     }
+                }catch (Exception e){
+                    log.error("随机抽取域名错误. msg:{}", StringUtil.getErrorText(e));
                 }
-            }catch (Exception e){
-                log.error("随机抽取域名错误. msg:{}", StringUtil.getErrorText(e));
             }
+
             log.info("domain:{},用户:{},所在车次:{},座位id:{},在{}获取跳转GPT镜像的登录url", DOMAIN, userId, groupsTrips.getId(), relationId, DateTime.now());
             return DOMAIN + "/auth/logintoken?carid=" + carId + "&usertoken=" + chatgptUser.getUserToken();
         } else {
@@ -482,9 +487,8 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
         chatgptUserConversationRecord.setUserToken(userToken);
         chatgptUserConversationRecord.setCarId(chatgptSession.getCarId());
         chatgptUserConversationRecord.setCarName(chatgptSession.getCarName());
-        if (StringUtils.isBlank(conversationRequest.getConversation_id())) {
-            chatgptUserConversationRecord.setMessageId(conversationRequest.getMessages().get(0).getId());
-        } else {
+
+        if (StringUtils.isNotBlank(conversationRequest.getConversation_id())) {
             chatgptUserConversationRecord.setConversationId(conversationRequest.getConversation_id());
         }
 

+ 1 - 9
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpCustomerAcquisitionLinkServiceImpl.java

@@ -78,15 +78,7 @@ public class CorpCustomerAcquisitionLinkServiceImpl extends ServiceImpl<CorpCust
         wxCpLinkUpd.setLinkId(corpCustomerAcquisitionLink.getLinkId());
         wxCpLinkUpd.setSkipVerify(corpCustomerAcquisitionLink.getSkipVerify());
         Range range = new Range();
-        String userList;
-        if (corpCustomerAcquisitionLink.getIsDuty()) {
-            if (corpCustomerAcquisitionLink.getChooseDutyUsers() == null) {
-                corpCustomerAcquisitionLink.setChooseDutyUsers(corpCustomerAcquisitionLink.getUserList());
-            }
-            userList = corpCustomerAcquisitionLink.getChooseDutyUsers();
-        } else {
-            userList = corpCustomerAcquisitionLink.getUserList();
-        }
+        String userList = corpCustomerAcquisitionLink.getUserList();
         //值班客服
         List<String> followIds = sysCorpServiceRelateService.getFollowIdsByRelateIds(Jsons.parseList(userList, Integer.class));
         range.setUserList(followIds);

+ 39 - 12
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -313,6 +313,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 
 	private final GroupsRelationNetflixService groupsRelationNetflixService;
 
+	private final OrderDonExceptionUserRecordMapper orderDonExceptionUserRecordMapper;
+
 	private final List<String> noChekGoodsTemp = List.of("Apple One", "Youtube", "Spotify");
 
 	@Transactional(rollbackFor = Throwable.class)
@@ -1125,6 +1127,30 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			return;
 		}
 
+		//是否是河南濮阳ip 直接退款mj
+		if (orderDon.getGoodsId() == 26) {
+			OrderDonLocationRelate orderDonLocationRelate = orderDonLocationRelateMapper.selectOne(Wrappers.lambdaQuery(OrderDonLocationRelate.class)
+					.eq(OrderDonLocationRelate::getOrderId, orderDon.getId())
+					.last("limit 1"));
+			if (orderDonLocationRelate != null) {
+				String address = StringUtil.paidIpAddress(orderDonLocationRelate.getIp());
+				if (address.contains("濮阳")) {
+					log.info("该支付账号id:{} 河南濮阳ip 直接退款mj", buyerId);
+					notifyRefundOrder(orderDon, goodsDon, sku);
+					//记录
+					OrderDonExceptionUserRecord exceptionUserRecord = new OrderDonExceptionUserRecord();
+					exceptionUserRecord.setOrderId(orderDon.getId());
+					exceptionUserRecord.setUserId(orderDon.getUserId());
+					exceptionUserRecord.setBuyerId(orderDon.getBuyerId());
+					exceptionUserRecord.setIp(orderDonLocationRelate.getIp());
+					exceptionUserRecord.setAddress(address);
+					orderDonExceptionUserRecordMapper.insert(exceptionUserRecord);
+					return;
+				}
+			}
+		}
+
+
 //		if (orderDon.getOrderType() == 1 && StrUtil.isNotEmpty(buyerId)) {
 //			//近一个月同一买家id 只能购买一次 多人
 //			if (orderDon.getGoodsId() == 26l && sku.getNum() != 1) {
@@ -1631,18 +1657,19 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 							points = newReturnMoney.multiply(BigDecimal.valueOf(distributePointsExchangeMoney.getPoints())).divide(distributePointsExchangeMoney.getMoney(), 2, RoundingMode.HALF_DOWN);
 							distributeWaitingSendPoints.setPoints(points);
 						} else {
-							DistributeExtraRebateConfig distributeExtraRebateConfig = distributeExtraRebateService.getRandomExtraRebate();
-							if (distributeExtraRebateConfig != null) {
-								BigDecimal multiple = distributeExtraRebateConfig.getMultiple();
-								if (multiple.compareTo(BigDecimal.ONE) > 0) {
-									//最终奖励
-									BigDecimal finalPoints = points.multiply(multiple);
-									distributeWaitingSendPoints.setPoints(finalPoints);
-
-									distributeWaitingSendPoints.setExtraMultiple(multiple);
-									distributeWaitingSendPoints.setExtraRebate(finalPoints.subtract(points));
-								}
-							}
+							//额外返利 去除
+//							DistributeExtraRebateConfig distributeExtraRebateConfig = distributeExtraRebateService.getRandomExtraRebate();
+//							if (distributeExtraRebateConfig != null) {
+//								BigDecimal multiple = distributeExtraRebateConfig.getMultiple();
+//								if (multiple.compareTo(BigDecimal.ONE) > 0) {
+//									//最终奖励
+//									BigDecimal finalPoints = points.multiply(multiple);
+//									distributeWaitingSendPoints.setPoints(finalPoints);
+//
+//									distributeWaitingSendPoints.setExtraMultiple(multiple);
+//									distributeWaitingSendPoints.setExtraRebate(finalPoints.subtract(points));
+//								}
+//							}
 						}
 					}
 					distributeWaitingSendPointsMapper.insert(distributeWaitingSendPoints);

+ 3 - 5
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -291,10 +291,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				Integer codeNum = getUserCodeNumBySkuId(ticket.getUserId(), ticket.getSkuId(), isHasVerifyCode);
 				ticket.setCodeNum(codeNum);
 			}
-			Integer qa = goodsDonQaRelateMapper.selectCount(Wrappers.lambdaQuery(GoodsDonQaRelate.class)
-					.eq(GoodsDonQaRelate::getGoodsId, ticket.getGoodsId())
-					.eq(GoodsDonQaRelate::getDeleted, 1));
-			ticket.setQa(qa > 0 ? true : false);
+			Long qaId = groupsRelationMapper.selectGoodsDonQaByGoodsId(ticket.getGoodsId());
+			ticket.setQa(qaId > 0 ? true : false);
 		});
 		userLoginRecordService.saveUserLoginDayRecord(userId);
 		return list;
@@ -760,7 +758,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 					return urlPref + code;
 				}
 			}
-			if (type != null && type == 1) {
+			if (type != null && type == 1 && StrUtil.isEmpty(code)) {
 				throw BusinessRuntimeException.getInstance("查询失败,请检查是否发送了登陆码..");
 			}
 		}