Ver Fonte

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

zwhui há 2 anos atrás
pai
commit
bb030d5aed

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

@@ -73,4 +73,6 @@ public interface UserMapper extends BaseMapper<User> {
 
     @Update("update user set sub_apply_money = sub_apply_money + #{addApplyMoney} where id = #{id} and sub_apply_money = #{subApplyMoney}")
     Integer addDistributeSubMoney(@Param("id") Long id, @Param("subApplyMoney") BigDecimal subApplyMoney, @Param("addApplyMoney") BigDecimal addApplyMoney);
+
+    Integer getNewMaliceUser(DateTime beginOfDay);
 }

+ 163 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/MaliceUserView.java

@@ -0,0 +1,163 @@
+package com.cyksj.model.manage.views;
+
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.DbIgnore;
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: MaliceUserView
+ * 创建者: JavaZou
+ * 创建时间:2024/5/16 16:13
+ */
+@Getter
+@Setter
+@SearchBean(tables = "(select distinct user_id from order_don where status not in ('close','noPayment') and buyer_id is not null group by user_id having count(distinct buyer_id) > 4) o inner join user u on u.id = o.user_id")
+public class MaliceUserView {
+	/**
+	 * id
+	 */
+	@DbField("u.id")
+	private Long id;
+
+	/**
+	 * 名称
+	 */
+	@DbField("u.nickname")
+	private String nickname;
+
+	/**
+	 * 手机号
+	 */
+	@DbField("u.phone")
+	private String phone;
+
+	/**
+	 * 绑定手机号
+	 */
+	@DbIgnore
+	private String bindPhone;
+
+	/**
+	 * 绑定邮箱
+	 */
+	@DbIgnore
+	private String bindEmail;
+
+	/**
+	 * 头像
+	 */
+	@DbField("u.headimgurl")
+	private String headimgurl;
+
+	/**
+	 * 积分
+	 */
+	@DbField("u.points")
+	private BigDecimal points;
+
+	@DbField("u.balance")
+	private BigDecimal balance;
+
+	@DbField("case when u.login_phone != '' then 'phone' when u.email != '' then 'email' when u.open_id != '' then 'wechat' else 'wechat' end")
+	private String register;
+
+	@DbField("u.show_id")
+	private String showId;
+
+	/**
+	 * 登录注册手机号
+	 */
+	@DbField("u.login_phone")
+	private String loginPhone;
+
+	/**
+	 * 登录注册邮箱
+	 */
+	@DbField("u.email")
+	private String email;
+
+	/**
+	 * 活跃抽奖积分
+	 */
+	@DbField("u.active_points")
+	private BigDecimal activePoints;
+
+	@DbField("u.register_env")
+	private String registerEnv;
+
+	@DbField("u.last_time")
+	private Date lastTime;
+
+	@DbField("u.is_black")
+	private Boolean isBlack;
+
+	/**
+	 * 企业微信客服
+	 */
+	@DbIgnore
+	private String corpCustomers;
+
+	/**
+	 * 首单信息
+	 */
+	@DbIgnore
+	private String firstOrderDetail;
+
+	/**
+	 * 有无路由器订单
+	 */
+	@DbIgnore
+	private Boolean isHadRouteOrder;
+
+
+	/**
+	 * 订单金额
+	 */
+	@DbIgnore
+	private BigDecimal orderMoney;
+
+	/**
+	 * 订单数
+	 */
+	@DbIgnore
+	private Integer numOfOrder;
+
+	/**
+	 * 退款金额
+	 */
+	@DbIgnore
+	private BigDecimal refundMoney;
+
+	/**
+	 * 退款率
+	 */
+	@DbIgnore
+	private BigDecimal refundRate;
+
+	/**
+	 * 创建时间
+	 */
+	@DbField("u.created_time")
+	private Date createdTime;
+
+	/**
+	 * 最后更新时间
+	 */
+	@DbField("u.update_time")
+	private Date updateTime;
+
+	@DbField("u.is_google")
+	private Boolean isGoogle;
+
+	/**
+	 * 是否实名
+	 */
+	@DbIgnore
+	private Boolean isCert;
+}

+ 12 - 0
netflix-dao/src/main/resources/mapper/UserMapper.xml

@@ -27,4 +27,16 @@
         where not exists (select user_id,sum(money) from order_don o where o.user_id = s.user_id and o.relation_id != 0 and o.status not in ('close','noPayment','refund') and o.created_time &lt; #{beginOfDay} group by user_id, date_format(o.created_time,'%Y-%m-%d')
         having sum(money) >  #{largeLimit})
     </select>
+
+    <select id="getNewMaliceUser" resultType="java.lang.Integer">
+        select count(distinct o.user_id)
+        from (select user_id
+              from order_don
+              where created_time >= #{beginOfDay}
+                and status not in ('close', 'noPayment')
+                and buyer_id is not null
+              group by user_id
+              having count(distinct buyer_id) > 4) o
+                 inner join user u on u.id = o.user_id
+    </select>
 </mapper>

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

@@ -666,9 +666,6 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
         // 更新体验数据
         redisService.zAdd(key, timestamp, String.valueOf(timestamp));
 
-        // 更新车队评分
-        redisService.zIncrementScore(RedisService.key.CHATGPT_CAR_SCORES.getName(), carId, scoreToAdd);
-
         // 清理旧数据(可选)和重新计算评分(根据需要实现)
         cleanupOldExperiencesAndRecalculateScore(carId, timestamp);
     }
@@ -694,6 +691,9 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
         Double highExperienceScore = (double) redisService.zCount(RedisService.key.CHATGPT_CAR_HIGH_CHAT.getName() + carId, currentTimestamp - (3 * 60 * 60 * 1000), currentTimestamp) * 2;
         Double lowExperienceScore = (double) redisService.zCount(RedisService.key.CHATGPT_CAR_LOW_CHAT.getName() + carId, currentTimestamp - (3 * 60 * 60 * 1000), currentTimestamp);
         double newScore = highExperienceScore + lowExperienceScore;
+        if(carId.contains("T")){
+            newScore = newScore * 0.3D;
+        }
         redisService.zAdd(RedisService.key.CHATGPT_CAR_SCORES.getName(), newScore, carId);
     }
 

+ 6 - 2
netflix-service/src/main/java/com/cyksj/service/mail/impl/CuiQiuMailServiceImpl.java

@@ -55,6 +55,7 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 		params.put("mail_id", ADMIN_MAIL_ID);
 		params.put("start_time", DateUtil.offsetDay(now, -1).toDateStr());
 		params.put("end_time", DateUtil.offsetDay(now, 1).toDateStr());
+		params.put("to", email);
 		params.put("limit", 20);
 
 		HttpRequest post = HttpUtil.createPost(url);
@@ -101,8 +102,11 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 		CuiQiuEmailDetailDto.Content content = cuiQiuEmailDetailDto.getData().getContent();
 
 		String contentBody = content.getBody();
-
-		String code = StrUtil.subWithLength(contentBody, contentBody.indexOf("ADOBE"), 215);
+		String str = "color:#505050; font-family:adobe-clean, Helvetica Neue, Helvetica, Verdana, Arial, sans-serif;";
+		String code = StrUtil.subWithLength(contentBody, contentBody.indexOf(str), 512);
+		if (StrUtil.isNotBlank(code)) {
+			code = code.replace(str, "");
+		}
 		return StringUtil.getVerifyCodePattern(code);
 	}
 }

+ 56 - 0
netflix-service/src/main/java/com/cyksj/service/market/task/impl/BindTaskServiceImpl.java

@@ -451,5 +451,61 @@ public class BindTaskServiceImpl implements BindTaskService {
 			userMapper.updateById(phoneUser);
 			return;
 		}
+
+		if (type == 2) {
+			//是否已注册
+			User changeUser = userMapper.selectOne(Wrappers.lambdaQuery(User.class)
+					.eq(User::getEmail, account).last("limit 1"));
+			if (changeUser != null) {
+				throw BusinessRuntimeException.getInstance("您更换的手机号已注册,无法更换");
+			}
+			//是否已绑定
+			UserBindDetail changeUserBindDetail = userBindDetailMapper.selectOne(Wrappers.lambdaQuery(UserBindDetail.class)
+					.eq(UserBindDetail::getEmail, account).last("limit 1"));
+			if (changeUserBindDetail != null) {
+				throw BusinessRuntimeException.getInstance("您更换的邮箱已被绑定,无法更换");
+			}
+			//校验邮箱
+			checkEmailCode(account, code);
+			String email = user.getEmail();
+			User emailUser = user;
+			Long emailUserId = emailUser.getId();
+			//邮箱用户
+			if (StrUtil.isNotBlank(email)) {
+				UserBindDetail userBindDetail = userBindDetailMapper.selectOne(Wrappers.lambdaQuery(UserBindDetail.class)
+						.eq(UserBindDetail::getEmail, email).last("limit 1"));
+				if (userBindDetail != null) {
+					userBindDetail.setEmail(account);
+					userBindDetail.setEmailUserId(emailUserId);
+					userBindDetailMapper.updateById(userBindDetail);
+				}
+				user.setEmail(account);
+				userMapper.updateById(user);
+				return;
+			}
+			//非邮箱用户
+			UserBindDetail userBindDetail = userBindDetailMapper.selectOne(Wrappers.lambdaQuery(UserBindDetail.class)
+					.and(qr -> qr.eq(UserBindDetail::getUserId, userId)
+							.or().eq(UserBindDetail::getPhoneUserId, userId))
+					.last("limit 1"));
+			if (userBindDetail == null) {
+				throw BusinessRuntimeException.getInstance("你未有绑定其他账号");
+			}
+			if (StrUtil.isEmpty(userBindDetail.getEmail())) {
+				throw BusinessRuntimeException.getInstance("您未绑定邮箱,无法更换");
+			}
+			email = userBindDetail.getEmail();
+			emailUser = userMapper.selectOne(Wrappers.lambdaQuery(User.class)
+					.eq(User::getEmail, email).last("limit 1"));
+			if (emailUser == null) throw BusinessRuntimeException.getInstance("你绑定的邮箱未注册");
+			emailUserId = emailUser.getId();
+			userBindDetail.setEmail(account);
+			userBindDetail.setEmailUserId(emailUserId);
+			userBindDetailMapper.updateById(userBindDetail);
+
+			emailUser.setEmail(account);
+			userMapper.updateById(emailUser);
+			return;
+		}
 	}
 }

+ 4 - 0
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -1003,6 +1003,10 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			updateOrder.setStatus(goodsDon.getType() == 1 && goodsDon.getSecondType() == 2 ? OrderDon.Status.complete : OrderDon.Status.hasPayment);
 			updateGroupsTicket(updateOrder, goodsDon, sku);
 			orderDonMapper.updateById(updateOrder);
+			//余额使用记录
+			if (orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
+				userBenefitsService.recordBalanceBySource(orderDon.getUserId(), orderDon.getBalance().negate(), UserBalanceSourceRecord.Source.payment, orderDon.getId(), goodsDon.getTitle() + UserBalanceSourceRecord.Source.payment.getDesc());
+			}
 			return updateOrder;
 		}
 		//记录订单ip关联

+ 12 - 11
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -639,14 +639,14 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		DateTime now = DateTime.now();
 		DateTime thisZero = DateUtil.beginOfDay(now);
 		String thisDate = thisZero.toDateStr();
-//		Object exists = redisService.get(RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getNameFormat(thisDate, userId));
-//		if (exists != null) {
-//			return null;
-//		}
+		Object exists = redisService.get(RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getNameFormat(thisDate, userId));
+		if (exists != null) {
+			return null;
+		}
 		User u = userMapper.selectById(userId);
 		if (u == null) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
 		if (u.getIsBlack()) {
-//			redisService.setNx(RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getNameFormat(thisDate, userId), userId, RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getTimeout());
+			redisService.setNx(RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getNameFormat(thisDate, userId), userId, RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getTimeout());
 			return null;
 		}
 		List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, u);
@@ -659,10 +659,10 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				.orderBy(RenewalView::getExpiryTime).asc()
 				.onlySelect(RenewalView::getSkuNum, RenewalView::getExpiryTime, RenewalView::getRelationId, RenewalView::getAccount, RenewalView::getGoodsId, RenewalView::getTitle, RenewalView::getLogo, RenewalView::getImg, RenewalView::getGroupId, RenewalView::getSkuId, RenewalView::getSpecVal, RenewalView::getGoodsStatus, RenewalView::getSkuStatus)
 				.build());
-//		if (list.size() > 5) {
-////			redisService.setNx(RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getNameFormat(thisDate, userId), userId, RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getTimeout());
-//			return null;
-//		}
+		if (list.size() > 5) {
+			redisService.setNx(RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getNameFormat(thisDate, userId), userId, RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getTimeout());
+			return null;
+		}
 		//提前7天
 		AtomicInteger day = new AtomicInteger(7);
 		List<RenewalView> expiryTickets = list.stream().filter(ticket -> {
@@ -677,12 +677,13 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				day.set(30);
 			}
 			if (DateUtil.beginOfDay(expiryTime).compareTo(DateUtil.offsetDay(thisZero, day.get())) <= 0) {
+				ticket.setExpiryTimeStr(DateUtil.format(ticket.getExpiryTime(), "yyyy-MM-dd"));
+				ticket.setExpiryTime(null);
 				return true;
 			}
-			ticket.setExpiryTime(null);
 			return false;
 		}).collect(Collectors.toList());
-//		redisService.setNx(RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getNameFormat(thisDate, userId), userId, RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getTimeout());
+		redisService.setNx(RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getNameFormat(thisDate, userId), userId, RedisService.key.TICKET_EXPIRY_NOTIFY_DAY.getTimeout());
 		return expiryTickets;
 	}
 

+ 24 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsUserController.java

@@ -20,6 +20,7 @@ import com.cyksj.mapper.corp.CorpUserFollowRelationMapper;
 import com.cyksj.mapper.manage.cms.CmsUserMapper;
 import com.cyksj.mapper.market.task.UserBindDetailMapper;
 import com.cyksj.model.entity.*;
+import com.cyksj.model.manage.views.MaliceUserView;
 import com.cyksj.model.manage.views.UserView;
 import com.cyksj.model.request.UserBalanceReq;
 import com.cyksj.model.request.UserFuncPropertyReq;
@@ -445,4 +446,27 @@ public class CmsUserController{
         Integer newConsumerCount = userMapper.getLargeNewConsumer(beginOfDay, largeLimit);
         return GatewayResponse.SUCCESS.newBuilder().toResult(newConsumerCount > 0 ? true : false);
     }
+
+    /**
+     * 超过恶意用户列表
+     * 使用五个以上得支付宝
+     */
+    @GetMapping("/get/malice/user")
+    public Result<SearchResult<MaliceUserView>> getMaliceUser() {
+        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
+        SearchResult<MaliceUserView> search = beanSearcher.search(MaliceUserView.class, builder
+                .orderBy(MaliceUserView::getId).asc()
+                .build());
+        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+    }
+
+    /**
+     * 是否有最新恶意用户
+     */
+    @GetMapping("get/malice/user/newUser")
+    public Result<Boolean> getNewMaliceUser() {
+        DateTime beginOfDay = DateUtil.beginOfDay(DateTime.now());
+        Integer newConsumerCount = userMapper.getNewMaliceUser(beginOfDay);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(newConsumerCount > 0 ? true : false);
+    }
 }

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

@@ -138,7 +138,7 @@ public class OrderController {
 
         String ip = ServletUtil.getClientIP(request);
         String address = StringUtil.getNewInternalAddressByIp(ip);
-        if (address.contains("柬埔寨")) {
+        if (address.contains("柬埔寨") || address.contains("缅甸")) {
             throw BusinessRuntimeException.getInstance("用户系统异常");
         }
         payRequest.setIp(ip);