Explorar o código

Merge branch 'abroad_073' into abroad_pre

zoujiajian %!s(int64=2) %!d(string=hai) anos
pai
achega
89fe5d1ddb

+ 6 - 16
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -31,23 +31,15 @@ public interface Constant {
 	 */
 	String DEFAULT_HEAD_IMG = "https://cdn.sxfoundation.com/picture/f6ee11101c4f5f0bc48d88aca7a5dbfd-1666945673391.png";
 
-	/**
-	 * 普通奖池积分配置key
-	 */
-	String LOTTERY_POINTS_LIMIT = "lottery_points_limit";
 
-	/**
-	 * 特定奖池平台配置key
-	 */
-	String LOTTERY_SPECIFIC_GOODS = "lottery_specific_goods";
+	String AI_RENEW_MSG = "海外用户ID:%s续费了 %s %s 账号为:%s,请及时处理【银河录像局】";
 
 	/**
-	 * 特定订单有效时间
+	 * 通知手机号
 	 */
-	String LOTTERY_SPECIFIC_ORDER_EFFECTIVE_TIME = "lottery_specific_order_effective_time";
-
-	String CORP_POPULARIZE_CUSTOMER = "corp_popularize_customer";
+	String SERVICE_PHONE = "18658194165";
 
+	String PAY_MSG = "海外用户ID:%s购买了 %s %s 请及时处理【银河录像局】";
 	/**
 	 * 固定客服key
 	 */
@@ -58,10 +50,8 @@ public interface Constant {
 	 */
 	String EQUIPMENT_DISTRIBUTE_KEY = "equipment_distribute_key";
 
-	/**
-	 * 百度渠道 优惠券id
-	 */
-	String BAIDU_POPULARIZE_COUPON_IDS = "baidu_popularize_coupon_ids";
+	//PS AI,POE会员
+	List<Long> DOWN_GOODS_PAY = List.of(33l, 35l);
 
 	/**
 	 * 系统主账号商户配置key

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

@@ -19,4 +19,6 @@ public interface GoodsDonSkuMapper  extends BaseMapper<GoodsDonSku> {
 	List<Long> getSpecificSkuIdsByGoodsId(@Param("goodsId") Long goodsId, @Param("num") Integer num, @Param("months") Integer months);
 
 	GoodsDonSku checkAndReturnMinPriceUserOwnsSku(@Param("goodsId") Long goodsId, @Param("dsUserId") Long dsUserId);
+
+	List<Long> selectSingleSkuIdsByGoodsId(Long goodsId);
 }

+ 0 - 2
netflix-dao/src/main/java/com/cyksj/model/entity/GroupsRelation.java

@@ -72,8 +72,6 @@ public class GroupsRelation extends BaseEntity {
      */
     private String verifyCode;
 
-    private Long yhsId;
-
     /**
      * 获取权益时的订单id
      */

+ 4 - 0
netflix-dao/src/main/resources/mapper/GoodsDonSkuMapper.xml

@@ -36,4 +36,8 @@
             or JSON_CONTAINS(user_owns, '${dsUserId}')
         </if>) order by price limit 1
     </select>
+
+    <select id="selectSingleSkuIdsByGoodsId" resultType="java.lang.Long">
+        select id from goods_don_sku where goods_id = #{goodsId} and num = 1
+    </select>
 </mapper>

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

@@ -9,12 +9,14 @@ import cn.hutool.extra.servlet.ServletUtil;
 import cn.hutool.http.Header;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.cyksj.common.EnvCommonService;
 import com.cyksj.common.constant.Constant;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.i18n.I18nMessageUtil;
 import com.cyksj.common.snowflake.Sequence;
 import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
 import com.cyksj.common.util.Jsons;
+import com.cyksj.common.util.SmsUtil;
 import com.cyksj.common.util.StringUtil;
 import com.cyksj.dto.RedisKey;
 import com.cyksj.enums.GatewayApiCode;
@@ -150,6 +152,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 
 	private final OrderDonLocationRelateMapper orderDonLocationRelateMapper;
 
+	private final EnvCommonService envCommonService;
+
 	@Transactional(rollbackFor = Throwable.class)
 	@Override
 	public OrderDon submit(OrderPayRequest payRequest) throws Exception {
@@ -629,9 +633,13 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 
 	public void updateCarParkAndSendMsg(GoodsDon goodsDon, GoodsDonSku sku, OrderDon order) {
 		if (goodsDon.getType() == 1) {
-			log.info("虚物订单orderNo:{}开始更新车票信息", order.getOrderNo());
 			//修改车位状态
 			GroupsRelation relation = groupsRelationMapper.selectById(order.getRelationId());
+			if (relation == null) {
+				log.info("无需更新车票信息");
+				return;
+			}
+			log.info("虚物订单orderNo:{}开始更新车票信息", order.getOrderNo());
 			if (order.getIsDp()) {
 				//是否已经发送优惠加购车票
 				OrderDiscountPlusPurchaseSkuRelation purchaseSkuRelation = orderDiscountPlusPurchaseSkuRelationMapper.selectOne(Wrappers.lambdaQuery(OrderDiscountPlusPurchaseSkuRelation.class)
@@ -643,21 +651,26 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 						try {
 							List<Long> plusSkuIds = Jsons.parseList(plusSkuIdsStr, Long.class);
 							//发送优惠加购 规格车票
-							List<Long> dis_relation_ids = new ArrayList<>();
-							plusSkuIds.forEach(plus_skuId -> {
+							List<Long> dis_relation_ids = null;
+							List<Long> plus_order_ids = null;
+							Address address = null;
+							for (Long plus_skuId : plusSkuIds) {
 								GoodsDonSku plus_sku = goodsDonSkuMapper.selectById(plus_skuId);
 								if (plus_sku == null) {
 									log.error("订单id:{}优惠加购规格已被删除 skuId:{},车票未发送", order.getId(), plus_skuId);
-									return;
+									continue;
+								}
+								if (dis_relation_ids == null) {
+									dis_relation_ids = new ArrayList<>();
 								}
 								GroupsRelation relationNoOrder = exchangeCodeService.getRelationNoOrder(plus_sku, order.getUserId());
 								dis_relation_ids.add(relationNoOrder.getId());
-							});
+							}
 							//保存订单关联优惠加购车票
 							orderDiscountPlusPurchaseSkuRelationMapper.update(null, Wrappers.lambdaUpdate(OrderDiscountPlusPurchaseSkuRelation.class)
-									.set(OrderDiscountPlusPurchaseSkuRelation::getRelationIds, dis_relation_ids.toString())
-									.eq(OrderDiscountPlusPurchaseSkuRelation::getOrderId, order.getId())
-									.isNull(OrderDiscountPlusPurchaseSkuRelation::getRelationIds));
+									.set(CollUtil.isNotEmpty(dis_relation_ids), OrderDiscountPlusPurchaseSkuRelation::getRelationIds, Jsons.toJson(dis_relation_ids))
+									.set(CollUtil.isNotEmpty(plus_order_ids), OrderDiscountPlusPurchaseSkuRelation::getPlusOrderIds, Jsons.toJson(plus_order_ids))
+									.eq(OrderDiscountPlusPurchaseSkuRelation::getOrderId, order.getId()));
 						} catch (Exception e) {
 						}
 					}
@@ -677,7 +690,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
 			if (GroupsRelation.Status.locking.equals(relation.getStatus()) || GroupsRelation.Status.validity.equals(relation.getStatus()) || GroupsRelation.Status.outside.equals(relation.getStatus())) {
 				log.info("订单号orderNo:{}开始修改车位:{}状态", order.getOrderNo(), relation.getId());
-				if (relation.getStatus() != GroupsRelation.Status.outside) {
+				if (relation.getNum() > groupsTrips.getNum()) {
+					relation.setStatus(GroupsRelation.Status.outside);
+				} else {
 					relation.setStatus(GroupsRelation.Status.validity);
 				}
 				//续费后,下一次续费意愿状态为false
@@ -696,16 +711,24 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 					if (donSku.getDays() != null && donSku.getDays() > 0) {
 						newDate = DateUtil.offsetDay(expiryTime, donSku.getDays() * order.getNum());
 					} else {
-						newDate = DateUtil.offset(expiryTime, DateField.MONTH, donSku.getMonths() * order.getNum());
+						//奈飞月付 按30天计算
+						if (sku.getId() == 4) {
+							newDate = DateUtil.offsetDay(expiryTime, 30 * order.getNum());
+						} else {
+							newDate = DateUtil.offset(expiryTime, DateField.MONTH, donSku.getMonths() * order.getNum());
+						}
 					}
 					relation.setExpiryTime(newDate);
 					relation.setStartTime(relation.getStartTime() == null ? new Date() : null);
 				} else if (GroupsTrips.Status.waiting.equals(groupsTrips.getStatus())) {
 					log.info("车位groupsId:{}未发车,修改订单号orderNo:{}订单为已付款状态:{}", groupsTrips.getId(), order.getOrderNo());
 					order.setStatus(OrderDon.Status.hasPayment);
+					if (goodsDon.getSpecialType() != null && goodsDon.getSpecialType() == GoodsDon.SpecialType.courseware) {
+						order.setStatus(OrderDon.Status.complete);
+					}
 				}
-				//下架POE会员车队
-				if (order.getGoodsId() != null && order.getGoodsId().equals(35l)) {
+				//下架POE会员车队 || GPT Plus独立规格 下架
+				if (order.getGoodsId() != null && Constant.DOWN_GOODS_PAY.contains(order.getGoodsId()) || goodsDonSkuMapper.selectSingleSkuIdsByGoodsId(Constant.AI_goodsIds.get(0)).contains(groupsTrips.getSkuId())) {
 					if (groupsTrips.getAccountId() != null && groupsTrips.getStatus() == GroupsTrips.Status.validity) {
 						groupsTrips.setStatus(GroupsTrips.Status.down);
 						groupsMapper.updateById(groupsTrips);
@@ -713,6 +736,30 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				}
 				//TODO 如未发车逻辑
 				groupsRelationMapper.updateById(relation);
+				Account account = null;
+				if (envCommonService.isPrdEnv() && order.getOrderType() == 2) {
+					//ChatGPT plus 独立和Midjourney 独立有人续费了发短信
+					if (Constant.AI_goodsIds.contains(order.getGoodsId()) && sku.getNum() == 1) {
+						try {
+							String accountStr = StrUtil.EMPTY;
+							account = accountMapper.selectById(groupsTrips.getAccountId());
+							if (account != null) {
+								accountStr = account.getAccount();
+							}
+							String renew_msg = String.format(Constant.AI_RENEW_MSG, order.getUserId(), goodsDon.getTitle(), sku.getSpecVal(), accountStr);
+							SmsUtil.sendLuoKey2Msg(Constant.SERVICE_PHONE, renew_msg);
+						} catch (Exception e) {
+						}
+					}
+				}
+				//GPT 代充 发送短信通知
+				if (envCommonService.isPrdEnv() && order.getGoodsId() == 40l) {
+					try {
+						String pay_msg = String.format(Constant.PAY_MSG, order.getUserId(), goodsDon.getTitle(), sku.getSpecVal());
+						SmsUtil.sendLuoKey2Msg(Constant.SERVICE_PHONE, pay_msg);
+					} catch (Exception e) {
+					}
+				}
 			}
 		}
 	}

+ 7 - 3
netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java

@@ -146,7 +146,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 	@Override
 	public User webLogin(LoginReq loginReq) throws Exception {
 		LambdaQueryWrapper<User> wrapper = Wrappers.lambdaQuery(User.class).last("limit 1");
-		if (loginReq.getType() == null || loginReq.getType() < 1 && loginReq.getType() > 3) {
+		if (loginReq.getType() == null || loginReq.getType() < 1 || loginReq.getType() > 3) {
 			throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("sys_error"));
 		}
 		if (loginReq.getType() == 1) {
@@ -233,8 +233,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 						.setCallbackType(callbackType);
 				redisService.set(RedisService.key.ORDER_DON_POST_DATA_USER_KEY.getName() + user.getId(), Jsons.toJson(orderDonPostDataDto));
 			}
-			//发放新用户福利
-			final Long fUid = user.getId();
 			final String login_email = user.getEmail();
 			final String login_phone = user.getLoginPhone();
 			UserBindDetail bindDetail = userBindDetailMapper.selectOne(Wrappers.lambdaQuery(UserBindDetail.class)
@@ -254,6 +252,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 		if (StrUtil.isEmpty(user.getShowId())) {
 			user.setShowId(getUserShowId(user.getId()));
 		}
+		Optional.ofNullable(user.getIsBlack())
+				.ifPresent(black -> {
+					if (black) {
+						throw BusinessRuntimeException.getInstance("user_black_error");
+					}
+				});
 		return user;
 	}
 

+ 1 - 1
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -140,7 +140,7 @@ public class GoodsDonController {
             GoodsFrontListView views = beanSearcher.searchFirst(GoodsFrontListView.class, MapUtils.builder().field(GoodsFrontListView::getId, id)
                     .build());
             if (views == null) {
-                throw BusinessRuntimeException.getInstance("商品已下架..");
+                throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("sys_error"));
             }
 
             views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));

+ 4 - 3
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -175,10 +175,11 @@ public class GroupRelationController {
                 .field(GroupsRelationView::getId, relationId).build());
         if (groupsRelationView == null) {
             log.info("userId:{}查看relationId:{}车票不存在", userId, relationId);
-            throw BusinessRuntimeException.getInstance("该车票已不存在");
+            throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("sys_error"));
+        }
+        if (groupsRelationView.getAccountId() == null){
+            throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("account_not_set"));
         }
-        if (groupsRelationView.getAccountId() == null) throw BusinessRuntimeException.getInstance("该车队未配置账号");
-        if (groupRelationFrontService == null) throw BusinessRuntimeException.getInstance("车票已不存在");
         TicketPwdViewRecord viewRecord = new TicketPwdViewRecord();
         viewRecord.setUserId(userId);
         viewRecord.setRelationId(relationId);

+ 0 - 75
netflix-web/src/main/java/com/cyksj/web/controller/user/AddressController.java

@@ -1,75 +0,0 @@
-package com.cyksj.web.controller.user;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.cyksj.common.exception.BusinessRuntimeException;
-import com.cyksj.dto.Result;
-import com.cyksj.enums.GatewayResponse;
-import com.cyksj.model.entity.Address;
-import com.cyksj.service.user.AddressService;
-import com.cyksj.web.util.StpUserUtil;
-import lombok.RequiredArgsConstructor;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * @author chan
- * @date 2022/10/13 3:07 PM
- */
-@RestController
-@RequestMapping("/applets/address")
-@RequiredArgsConstructor
-public class AddressController {
-
-    private final AddressService addressService;
-
-    @GetMapping("/get")
-    public Result<List<Address>> get(){
-        long userId = StpUserUtil.getLoginIdAsLong();
-        List<Address> addressList = addressService.list(Wrappers.lambdaQuery(Address.class).eq(Address::getUserId, userId));
-        return GatewayResponse.SUCCESS.newBuilder().toResult(addressList);
-    }
-
-    @Transactional(rollbackFor = Throwable.class)
-    @PostMapping("/post")
-    public Result<Address> save(@RequestBody Address address){
-        long userId = StpUserUtil.getLoginIdAsLong();
-        int count = addressService.count(Wrappers.lambdaQuery(Address.class).eq(Address::getUserId, userId));
-        if (count >= 20) {
-            throw new BusinessRuntimeException("收货地址最多可添加20条, 请清理后再添加.");
-        }
-        if (count == 0) {
-            // 当前新增的地址是唯一一个地址时 无论用户是否设为默认地址 都设为默认地址
-            address.setIsDefault(true);
-        }
-
-        if(address.getIsDefault() != null && address.getIsDefault() ){
-            addressService.update(Wrappers.lambdaUpdate(Address.class).eq(Address::getUserId,userId).set(Address::getIsDefault,false));
-        }
-        address.setUserId(userId);
-        addressService.save(address);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(address);
-    }
-
-    @Transactional(rollbackFor = Throwable.class)
-    @PutMapping("/update")
-    public Result<Address> update(@RequestBody Address address){
-
-        long userId = StpUserUtil.getLoginIdAsLong();
-        if(address.getIsDefault() != null && address.getIsDefault() ){
-            addressService.update(Wrappers.lambdaUpdate(Address.class).eq(Address::getUserId,userId).set(Address::getIsDefault,false));
-        }
-
-        addressService.updateById(address);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(address);
-    }
-
-    @DeleteMapping("/delete/{id}")
-    public Result<String> delete(@PathVariable Long id){
-        addressService.removeById(id);
-        return GatewayResponse.SUCCESS.newBuilder().toResult();
-    }
-
-
-}

+ 0 - 9
netflix-web/src/main/java/com/cyksj/web/controller/user/AuthorizationController.java

@@ -121,15 +121,6 @@ public class AuthorizationController {
         if (email == null || !Validator.isEmail(email)) {
             throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("email_format_error"));
         }
-        if (envCommonService.isPrdEnv()) {
-            //首次注册只能gmail邮箱
-            if (!email.contains("@gmail")) {
-                User user = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getEmail, email).last("limit 1"));
-                if (user == null) {
-                    throw BusinessRuntimeException.getInstance("暂只支持使用谷歌邮箱注册");
-                }
-            }
-        }
         String code = mailService.sendLoginCodeEmailToPeople(digit, email);
         if (code == null) {
             throw BusinessRuntimeException.getInstance(I18nMessageUtil.getI18nMsg("verify_code_send_error"));