Przeglądaj źródła

Merge branch 'master' into pre

zoujiajian 2 lat temu
rodzic
commit
e331fd10c1

+ 4 - 0
netflix-dao/src/main/java/com/cyksj/mapper/corp/CorpUserTagMapper.java

@@ -7,8 +7,10 @@ import com.cyksj.model.excel.CorpUserTagExcelData;
 import com.cyksj.model.views.CorpUserIntentionView;
 import com.cyksj.model.views.CorpUserView;
 import com.cyksj.model.views.UserIntentionPieView;
+import com.cyksj.model.views.UserOrderDetailView;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 
 
@@ -30,4 +32,6 @@ public interface CorpUserTagMapper extends BaseMapper<CorpUserTag> {
 	Page<CorpUserIntentionView> getCorpUserIntentionView(@Param("page") Page<CorpUserIntentionView> page, @Param("userId") Long userId, @Param("nickname") String nickname, @Param("tagIdStr") String tagId, @Param("thisDate") String date, @Param("intention") Integer intention);
 
 	List<CorpUserTag> selectIntentionUserTag(@Param("externalUserId") String externalUserId, @Param("groupName") String groupName);
+
+	UserOrderDetailView getFansUserToMonthOrdersDetai(@Param("tagIdStr") String tagIdStr, @Param("thisDate") String thisDate, @Param("st") Date st, @Param("et") Date et);
 }

+ 20 - 0
netflix-dao/src/main/resources/mapper/CorpUserTagMapper.xml

@@ -133,4 +133,24 @@
         where ct.group_name = #{groupName}
         and cufr.corp_user_id = #{externalUserId}
     </select>
+
+    <select id="getFansUserToMonthOrdersDetai" resultType="com.cyksj.model.views.UserOrderDetailView">
+        select count(distinct o.user_id) as numOfUser,count(1) as numOfOrder,
+        cast(sum(o.money)/100 as decimal(10,2)) as orderMoney,
+        count(if(goods_id = 15,1,NULL)) as numOfEpOrder,
+        cast(sum(if(goods_id = 15,o.money,0))/100 as decimal(10,2)) as epOrderMoney
+        from (select cu.user_id
+        from (select distinct cu.*
+        from (select DISTINCT relation_id from corp_user_tag where tag_id = #{tagIdStr}) ct
+        inner join corp_user_follow_relation cufr on cufr.id = ct.relation_id
+        inner join corp_user_auth ca on ca.external_userid = cufr.corp_user_id
+        inner join corp_user cu on cu.id = ca.corp_user_id and cu.user_id != 0
+        <if test="thisDate != null">
+            where date_format(cu.created_time,'%Y-%m-%d') = #{thisDate}
+        </if>
+        ) cu) cu
+        left join order_don o on o.user_id = cu.user_id
+        where o.status not in ('close','noPayment','refund')
+        and o.created_time between #{st} and #{et}
+    </select>
 </mapper>

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/corp/CorpTagService.java

@@ -52,4 +52,6 @@ public interface CorpTagService {
 	Page<UserOrderDetailView> getTagUserPastRecord(Integer start, Integer limit, String tagIdStr, String startTime, String endTime, String consumeStTime, String consumeEtTime);
 
 	UserOrderDetailView tagUserHeadData(String tagIdStr, String startTime, String endTime, String consumeStTime, String consumeEtTime);
+
+	UserOrderDetailView getFansUserToMonthOrdersDetail(String tagId, String date);
 }

+ 10 - 0
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpTagServiceImpl.java

@@ -1,6 +1,8 @@
 package com.cyksj.service.corp.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -460,4 +462,12 @@ public class CorpTagServiceImpl implements CorpTagService {
 		headView.setOrderRate(headView.getNumOfUser() == 0 ? BigDecimal.ZERO : BigDecimal.valueOf(headView.getNumOfEpOrder()).divide(BigDecimal.valueOf(headView.getNumOfUser()), 2, RoundingMode.HALF_DOWN));
 		return headView;
 	}
+
+	@Override
+	public UserOrderDetailView getFansUserToMonthOrdersDetail(String tagId, String date) {
+		DateTime monthBegin = DateUtil.beginOfMonth(DateTime.now());
+		DateTime nextMonth = DateUtil.offsetMonth(monthBegin, 1);
+		UserOrderDetailView detailView = corpUserTagMapper.getFansUserToMonthOrdersDetai(tagId, date, monthBegin, nextMonth);
+		return detailView;
+	}
 }

+ 4 - 1
netflix-service/src/main/java/com/cyksj/service/mail/impl/CuiQiuMailServiceImpl.java

@@ -129,8 +129,11 @@ public class CuiQiuMailServiceImpl implements CuiQiuMailService {
 		if (goodsId == 1) {
 			if (type != null && type == 1) {
 				String pre = "NetflixSans-Regular, Helvetica, Roboto, Segoe UI, sans-serif; font-weight";
-				if (body.contains("輸入此代碼登入") || body.contains("输入此代码登录")) {
+				if (body.contains("輸入此代碼登入") || body.contains("输入此代码登录") || body.contains("Enter this code to sign in")) {
 					code = StrUtil.subAfter(body, pre, false);
+					if (StrUtil.isEmpty(code)) {
+						code = StrUtil.subAfter(body, "Enter this code to sign in", true);
+					}
 				}
 				if (StrUtil.isEmpty(code)) {
 					throw BusinessRuntimeException.getInstance("查询失败,请检查是否发送了登陆码..");

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

@@ -1017,6 +1017,18 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		//订单金额为0 且订单为已完成 更新虚物车票
 		if (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0) {
 			OrderDon updateOrder = orderDonMapper.selectById(orderDon.getId());
+			//mj镜像续费订单
+			if(orderDon.getOrderType() == 2 && orderDon.getGoodsId() == 26){
+				GroupsRelation groupsRelation = groupsRelationMapper.selectById(orderDon.getRelationId());
+				if(groupsRelation != null){
+					Date expiryTime = groupsRelation.getExpiryTime();
+
+					//mj续费订单当天过期直接加次数
+					if (expiryTime != null && DateUtil.isSameDay(new Date(), expiryTime)) {
+						mjRenewOrder(orderDon);
+					}
+				}
+			}
 			updateOrder.setStatus(goodsDon.getType() == 1 && goodsDon.getSecondType() == 2 ? OrderDon.Status.complete : OrderDon.Status.hasPayment);
 			updateGroupsTicket(updateOrder, goodsDon, sku);
 			orderDonMapper.updateById(updateOrder);
@@ -2429,6 +2441,20 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		if (orderDon.getIsNoLogin()) {
 			orderDon.setStatus(OrderDon.Status.hasPayment);
 		}
+
+		//mj镜像续费订单
+		if(orderDon.getOrderType() == 2 && orderDon.getGoodsId() == 26){
+			GroupsRelation groupsRelation = groupsRelationMapper.selectById(orderDon.getRelationId());
+			if(groupsRelation != null){
+				Date expiryTime = groupsRelation.getExpiryTime();
+
+				//mj续费订单当天过期直接加次数
+				if (expiryTime != null && DateUtil.isSameDay(new Date(), expiryTime)) {
+					mjRenewOrder(orderDon);
+				}
+			}
+		}
+
 		Long goodsId = goodsDon.getId();
 		if (!orderDon.getIsNoLogin() && sku != null) {
 			//更新座位信息
@@ -2440,6 +2466,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			//客服续费订单
 			handleServiceRenewOrder(orderDon);
 		}
+
 		this.updateById(orderDon);
 
 		//调整指定规格车队下次可 停用车位数的时间
@@ -2556,6 +2583,21 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			}
 		}
 	}
+	private void mjRenewOrder(OrderDon orderDon){
+		if (orderDon.getOrderType() == 2 && orderDon.getGoodsId() == 26) {
+			GoodsDonSku goodsDonSku = goodsDonSkuMapper.selectById(orderDon.getSkuId());
+			if (goodsDonSku.getIsMirror()){
+					midjourneyUserMapper.update(null, Wrappers.lambdaUpdate(MidjourneyUser.class)
+							.set(MidjourneyUser::getMjFastNum, goodsDonSku.getMjFastNum())
+							.set(MidjourneyUser::getMjRelaxNum, goodsDonSku.getMjRelaxNum())
+							.eq(MidjourneyUser::getRelationId, orderDon.getRelationId()));
+					MidjourneyUser midjourneyUser = midjourneyUserMapper.selectOne(Wrappers.lambdaQuery(MidjourneyUser.class).eq(MidjourneyUser::getRelationId, orderDon.getRelationId()));
+					log.info("恢复midjourney镜像使用次数: {}", midjourneyUser.getId());
+					redisService.del(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + midjourneyUser.getId());
+					redisService.del(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + midjourneyUser.getId());
+			}
+		}
+	}
 
 	private void deductGiftCardCash(Long userId, Long gcId, BigDecimal deductCash, BigDecimal gcRemainCash, List<GiftCardOrderUseRecord> gcUseRecords, Boolean isUsed) {
 		Boolean is_update = giftCardUserRecordService.update(null, Wrappers.lambdaUpdate(GiftCardUserRecord.class)

+ 4 - 1
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -767,11 +767,14 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		//奈飞
 		if (goodsId == 1) {
 			if (type != null && type == 1) {
-				if (body.contains("輸入此代碼登入") || body.contains("输入此代码登录")) {
+				if (body.contains("輸入此代碼登入") || body.contains("输入此代码登录") || body.contains("Enter this code to sign in")) {
 					code = StrUtil.subBetween(body, "輸入此代碼登入", "請在裝置上輸入上");
 					if (StrUtil.isEmpty(code)) {
 						code = StrUtil.subAfter(body, "输入此代码登录", true);
 					}
+					if (StrUtil.isEmpty(code)) {
+						code = StrUtil.subAfter(body, "Enter this code to sign in", true);
+					}
 				}
 				if (StrUtil.isEmpty(code)) {
 					throw BusinessRuntimeException.getInstance("查询失败,请检查是否发送了登陆码..");

+ 11 - 8
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupsRelationNetflixServiceImpl.java

@@ -155,14 +155,17 @@ public class GroupsRelationNetflixServiceImpl implements GroupsRelationNetflixSe
 	 */
 	@Override
 	public void timingSetNetflix(Integer num, String nickname, String account, String password, Date expiryTime) {
-		String key = RedisService.key.NETFLIX_SET_LIMIT_TIME.getName();
-		if (!redisService.setNx(key, 1L, 30L)) {
-			jobManager.addJob(30001, () -> {
-				timingSetNetflix(num, nickname, account, password, expiryTime);
-			});
-		} else {
-			setNetflixSeatNum(num, nickname, account, password, expiryTime, null);
-			log.info("当前时间:{}开始调用设置奈飞座位信息接口", DateTime.now());
+		try {
+			String key = RedisService.key.NETFLIX_SET_LIMIT_TIME.getName();
+			if (!redisService.setNx(key, 1L, 30L)) {
+				jobManager.addJob(30001, () -> {
+					timingSetNetflix(num, nickname, account, password, expiryTime);
+				});
+			} else {
+				setNetflixSeatNum(num, nickname, account, password, expiryTime, null);
+				log.info("当前时间:{}开始调用设置奈飞座位信息接口", DateTime.now());
+			}
+		} catch (Exception e) {
 		}
 	}
 }

+ 9 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpTagController.java

@@ -206,4 +206,13 @@ public class CorpTagController {
 		Page<CorpTagUserOrderDataView> page = corpTagService.getTagUserTimeOrderData(start, limit, tagIdStr, toDate, startTime, endTime);
 		return GatewayResponse.SUCCESS.newBuilder().toResult(page);
 	}
+
+	/**
+	 * 当日标签用户 本月下单情况
+	 */
+	@GetMapping("/get/fans/toMonth/orders")
+	public Result<UserOrderDetailView> getFansUserToMonthOrdersDetail(String tagId, String date) {
+		UserOrderDetailView userOrderDetailView = corpTagService.getFansUserToMonthOrdersDetail(tagId, date);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(userOrderDetailView);
+	}
 }