Переглянути джерело

Merge branch 'master' into dev

# Conflicts:
#	netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuSpec.java
#	netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java
#	netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java
#	netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgAuditController.java
#	netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgFollowController.java
zoujiajian 2 роки тому
батько
коміт
fd979de6d6
30 змінених файлів з 722 додано та 107 видалено
  1. 7 0
      netflix-common/src/main/java/com/cyksj/common/constant/Constant.java
  2. 22 0
      netflix-common/src/main/java/com/cyksj/common/util/StringUtil.java
  3. 17 0
      netflix-dao/src/main/java/com/cyksj/mapper/EquipmentActivityReduceMapper.java
  4. 3 0
      netflix-dao/src/main/java/com/cyksj/mapper/UserMapper.java
  5. 2 0
      netflix-dao/src/main/java/com/cyksj/mapper/manage/statistics/StatisticsExportMapper.java
  6. 47 0
      netflix-dao/src/main/java/com/cyksj/model/entity/EquipmentActivityReduce.java
  7. 6 0
      netflix-dao/src/main/java/com/cyksj/model/excel/ExcelMonthlyDistributeOrderData.java
  8. 3 0
      netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuSpec.java
  9. 1 1
      netflix-dao/src/main/java/com/cyksj/model/manage/views/UserView.java
  10. 5 0
      netflix-dao/src/main/java/com/cyksj/model/request/OrderPayRequest.java
  11. 2 2
      netflix-dao/src/main/java/com/cyksj/model/views/DistributeOrdersDetailView.java
  12. 7 2
      netflix-dao/src/main/java/com/cyksj/model/views/RegisterDistributeOrdersDetailView.java
  13. 65 0
      netflix-dao/src/main/java/com/cyksj/model/views/UserCommonDistributeView.java
  14. 16 0
      netflix-dao/src/main/resources/mapper/EquipmentActivityReduceMapper.xml
  15. 6 0
      netflix-dao/src/main/resources/mapper/OrderDonMapper.xml
  16. 14 0
      netflix-dao/src/main/resources/mapper/StatisticsExportMapper.xml
  17. 11 0
      netflix-dao/src/main/resources/mapper/UserMapper.xml
  18. 15 0
      netflix-service/src/main/java/com/cyksj/service/coupon/EquipmentActivityReduceService.java
  19. 52 0
      netflix-service/src/main/java/com/cyksj/service/coupon/impl/EquipmentActivityReduceServiceImpl.java
  20. 7 0
      netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java
  21. 93 28
      netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java
  22. 201 61
      netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java
  23. 29 0
      netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsUserController.java
  24. 2 5
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgAuditController.java
  25. 4 6
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgFollowController.java
  26. 2 0
      netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/WxCorpController.java
  27. 51 0
      netflix-web/src/main/java/com/cyksj/web/controller/manage/coupon/CouponController.java
  28. 27 1
      netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributeController.java
  29. 4 0
      netflix-web/src/main/java/com/cyksj/web/controller/payment/OrderController.java
  30. 1 1
      netflix-web/src/main/java/com/cyksj/web/controller/user/AuthorizationController.java

+ 7 - 0
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -1,5 +1,6 @@
 package com.cyksj.common.constant;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /*
@@ -257,4 +258,10 @@ public interface Constant {
 	 * 系统周末值班客服变更通知手机号
 	 */
 	String DUTY_SERVICE_CHANGE_NOTIFY_PHONE = "17681947535";
+
+	BigDecimal FIVE_HUNDRED = BigDecimal.valueOf(50000);
+
+	BigDecimal THOUSAND = BigDecimal.valueOf(100000);
+
+	BigDecimal TWO_THOUSAND = BigDecimal.valueOf(200000);
 }

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

@@ -499,4 +499,26 @@ public final class StringUtil {
 
 		return "unknown";
 	}
+
+	public static String getInternalAddressByIP(String ip) {
+		if (StrUtil.isBlank(ip)) {
+			return "unknown";
+		}
+		try {
+			String url = String.format("http://whois.pconline.com.cn/ipJson.jsp?ip=%s" + "&json=true", ip);
+			HttpResponse<String> send = J11HttpC
+					.custom().ofGet().url(url)
+					.send(HttpResponse.BodyHandlers.ofString());
+			String rspStr = send.body();
+			if (StrUtil.isEmpty(rspStr)) {
+				return "unknown";
+			}
+			JSONObject obj = JSONUtil.parseObj(rspStr);
+			String addr = obj.getStr("addr");
+			return addr;
+		} catch (Exception e) {
+		}
+
+		return "unknown";
+	}
 }

+ 17 - 0
netflix-dao/src/main/java/com/cyksj/mapper/EquipmentActivityReduceMapper.java

@@ -0,0 +1,17 @@
+package com.cyksj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cyksj.model.entity.EquipmentActivityReduce;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: EquipmentActivityReduceMapper
+ * 创建者: JavaZou
+ * 创建时间:2024/1/30 11:00
+ */
+public interface EquipmentActivityReduceMapper extends BaseMapper<EquipmentActivityReduce> {
+	Integer checkRepeatTimeDuration(@Param("id") Long id, @Param("st") Date st, @Param("et") Date et);
+}

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

@@ -1,5 +1,6 @@
 package com.cyksj.mapper;
 
+import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.cyksj.model.entity.User;
 import org.apache.ibatis.annotations.Param;
@@ -64,4 +65,6 @@ public interface UserMapper extends BaseMapper<User> {
     Integer subYhsMoney(@Param("shopUserId") Long shopUserId, @Param("subMoney") BigDecimal subMoney);
 
 	Integer selectUnBindUserNum();
+
+    Integer getLargeNewConsumer(@Param("beginOfDay") DateTime beginOfDay, @Param("largeLimit") String largeLimit);
 }

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/mapper/manage/statistics/StatisticsExportMapper.java

@@ -74,4 +74,6 @@ public interface StatisticsExportMapper{
 	List<NatureOrderDataDto> getGroupsOrderData(@Param("startDate") String startDate, @Param("endDate") String endDate);
 
 	List<MonthlyUserOrderDetailDto> getMonthlyUserOrderDetail(@Param("thisMonth") DateTime thisMonth, @Param("nextMonth") DateTime nextMonth);
+
+	Map<String, Long> getEpOrderNumsGroupSource(@Param("startDate") String startDate, @Param("endDate") String endDate);
 }

+ 47 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/EquipmentActivityReduce.java

@@ -0,0 +1,47 @@
+package com.cyksj.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: EquipmentActivityReduce
+ * 创建者: JavaZou
+ * 创建时间:2024/1/30 10:57
+ */
+@Getter
+@Setter
+public class EquipmentActivityReduce extends BaseEntity{
+
+	private String name;
+
+	/**
+	 * 满500满减多少
+	 */
+	private BigDecimal f;
+
+	/**
+	 * 满1000满减多少
+	 */
+	private BigDecimal q;
+
+	/**
+	 * 满2000满减多少
+	 */
+	private BigDecimal tq;
+
+	/**
+	 * 活动开始时间
+	 */
+	private Date st;
+
+	/**
+	 * 活动结束时间
+	 */
+	private Date et;
+
+	private Boolean deleted;
+}

+ 6 - 0
netflix-dao/src/main/java/com/cyksj/model/excel/ExcelMonthlyDistributeOrderData.java

@@ -63,6 +63,9 @@ public class ExcelMonthlyDistributeOrderData {
 	@ExcelProperty({"下单率","自然流量渠道","自然渠道下单人数"})
 	private Integer natureUserSourceOrderNum;
 
+	@ExcelProperty({"下单率","自然流量渠道","自然渠道设备下单数"})
+	private Integer natureUserSourceEpOrderNum;
+
 	@ExcelProperty({"下单率","自然流量渠道","下单率"})
 	private String natureUserSourceOrderRate;
 
@@ -72,6 +75,9 @@ public class ExcelMonthlyDistributeOrderData {
 	@ExcelProperty({"下单率","分销渠道","分销渠道下单人数"})
 	private Integer channelUserSourceOrderNum;
 
+	@ExcelProperty({"下单率","分销渠道","分销渠道设备下单数"})
+	private Integer channelUserSourceEpOrderNum;
+
 	@ExcelProperty({"下单率","分销渠道","下单率"})
 	private String channelUserSourceOrderRate;
 }

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSkuSpec.java

@@ -37,6 +37,9 @@ public class ReqGoodsSkuSpec {
 
         private String benefitsList;
 
+        /**
+         * 原价
+         */
         private BigDecimal benefitsPrice;
     }
 }

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/manage/views/UserView.java

@@ -15,7 +15,7 @@ import java.util.Date;
  */
 @Getter
 @Setter
-@SearchBean(tables = "user u left join user_distribute_shared us on us.user_id = u.id"
+@SearchBean(tables = " :fu: user u :fu_on: left join user_distribute_shared us on us.user_id = u.id"
 		, where = ":otherConditionSql:")
 public class UserView {
 

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/request/OrderPayRequest.java

@@ -155,4 +155,9 @@ public class OrderPayRequest {
     private String ip;
 
     private String location;
+
+    /**
+     * 是否设备满减活动优惠
+     */
+    private Boolean isAcReduce;
 }

+ 2 - 2
netflix-dao/src/main/java/com/cyksj/model/views/DistributeOrdersDetailView.java

@@ -18,8 +18,8 @@ import java.util.Date;
  */
 @Getter
 @Setter
-@SearchBean(tables = "distribute_waiting_send_points dp left join order_don od on od.id = dp.order_id" +
-		" left join user u on u.id = dp.user_id" +
+@SearchBean(tables = "distribute_waiting_send_points dp inner join order_don od on od.id = dp.order_id" +
+		" inner join user u on u.id = dp.user_id" +
 		" left join goods_don gd on gd.id = od.goods_id")
 public class DistributeOrdersDetailView {
 	@DbField("u.nickname")

+ 7 - 2
netflix-dao/src/main/java/com/cyksj/model/views/RegisterDistributeOrdersDetailView.java

@@ -18,8 +18,7 @@ import java.util.Date;
  */
 @Getter
 @Setter
-@SearchBean(tables = "order_don od left join goods_don gd on gd.id = od.goods_id",
-		where = "od.is_fixed_distribute is true")
+@SearchBean(tables = "order_don od left join goods_don gd on gd.id = od.goods_id")
 public class RegisterDistributeOrdersDetailView {
 
 	@DbField("od.created_time")
@@ -48,4 +47,10 @@ public class RegisterDistributeOrdersDetailView {
 
 	@DbIgnore
 	private String specVal;
+
+	@DbField("od.is_distribute")
+	private Boolean isDistribute;
+
+	@DbField("od.is_fixed_distribute")
+	private Boolean isFixedDistribute;
 }

+ 65 - 0
netflix-dao/src/main/java/com/cyksj/model/views/UserCommonDistributeView.java

@@ -0,0 +1,65 @@
+package com.cyksj.model.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;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: UserCommonDistributeView
+ * 创建者: JavaZou
+ * 创建时间:2024/1/31 17:35
+ */
+@Getter
+@Setter
+@SearchBean(tables = "(select id,nickname from user where 1 = 1 :condition:) u left join user_distribute_shared us on u.id = us.shared_id" +
+		" left join user_distribute ud on ud.user_id = u.id and ud.deleted is true" +
+		" left join order_don od on od.user_id = us.user_id and od.is_distribute = 1 and od.status not in ('noPayment', 'close') :time:"
+		, where = "ud.id is null",
+		groupBy = "u.id,u.nickname")
+public class UserCommonDistributeView {
+
+	@DbField("u.id")
+	private Long userId;
+
+	@DbField("u.nickname")
+	private String nickname;
+
+	@DbField("count(od.id)")
+	private Integer orders;
+
+	/**
+	 * 分销人数
+	 * 其中拉新用户购买一单又退款,且无后续下单动作的不算分销用户,不统计在此字段内
+	 */
+	@DbField("count(DISTINCT CASE WHEN od.status != 'refund' THEN us.user_id ELSE null END)")
+	private Integer distributeUserNum;
+
+	/**
+	 * 邀请人数
+	 */
+	@DbField("count(DISTINCT us.user_id)")
+	private Integer inviteNum;
+
+	/**
+	 * 分销订单金额(无需产生积分)
+	 */
+	@DbField("(ifnull(sum(if(od.is_dp and od.ori_money != 0,od.ori_money,od.money)),0) - ifnull(sum(od.refund_money),0))")
+	private BigDecimal distributeOrdersMoney;
+
+	/**
+	 * 分销消费占比
+	 */
+	@DbField("ifnull(cast(count(DISTINCT CASE WHEN od.status != 'refund' THEN us.user_id ELSE null END)/count(DISTINCT us.user_id) as decimal(10,2)),0)")
+	private BigDecimal distributeConsumerRate;
+
+	/**
+	 * 销量最高的产品
+	 */
+	@DbIgnore
+	private String goodsTitle;
+}

+ 16 - 0
netflix-dao/src/main/resources/mapper/EquipmentActivityReduceMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.cyksj.mapper.EquipmentActivityReduceMapper">
+
+    <select id="checkRepeatTimeDuration" resultType="java.lang.Integer">
+        select count(*) from equipment_activity_reduce where
+        <if test="id != null">
+            id != #{id} and
+        </if>
+        deleted is true and ((st >= #{st} and st &lt; #{et} or et
+        >= #{st} and et &lt; #{et}) or (#{st} >= st and #{st} &lt; et or
+        #{et} >= st and #{et} &lt; et))
+        limit 1
+    </select>
+</mapper>

+ 6 - 0
netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

@@ -335,6 +335,9 @@
         and o.status not in ('close', 'noPayment')
         and o.money > 0
         and o.money > ifnull(o.refund_money,0)
+        <if test="startTime != null">
+            and o.created_time >= #{startTime}
+        </if>
     </select>
 
     <select id="getTagUserDataPage" resultType="com.cyksj.model.views.UserOrderDetailView">
@@ -356,6 +359,9 @@
         and o.status not in ('close', 'noPayment')
         and o.money > 0
         and o.money > ifnull(o.refund_money,0)
+        <if test="startTime != null">
+            and o.created_time >= #{startTime}
+        </if>
         group by date_format(o.created_time,'%Y-%m-%d')
         order by date_format(o.created_time,'%Y-%m-%d') desc
     </select>

+ 14 - 0
netflix-dao/src/main/resources/mapper/StatisticsExportMapper.xml

@@ -505,4 +505,18 @@
           and o.created_time BETWEEN #{thisMonth} and #{nextMonth}
           and u.created_time BETWEEN #{thisMonth} and #{nextMonth}
     </select>
+
+    <select id="getEpOrderNumsGroupSource" resultType="java.util.Map">
+        select count(if(is_distribute = 0,1,NULL)) naturalEpOrders,count(if(is_distribute = 1,1,NULL)) distributeOrders
+        from order_don
+        where status not in ('close', 'noPayment', 'refund')
+        and goods_id = 15
+        <if test="startDate != null">
+            and created_time >= #{startDate}
+        </if>
+        <if test="endDate != null">
+            and created_time &lt; #{endDate}
+        </if>
+        group by DATE_FORMAT(created_time, '%Y-%m')
+    </select>
 </mapper>

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

@@ -16,4 +16,15 @@
                             from `user_bind_detail`) s on s.user_id = u.id
         where s.id is null
     </select>
+
+    <select id="getLargeNewConsumer" resultType="java.lang.Integer">
+        select count(s.user_id)
+        from (select user_id
+              from order_don o
+              where o.relation_id != 0 and o.status not in ('close','noPayment','refund') and created_time >= #{beginOfDay}
+              group by user_id
+              having sum(money) > #{largeLimit}) s
+        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>
 </mapper>

+ 15 - 0
netflix-service/src/main/java/com/cyksj/service/coupon/EquipmentActivityReduceService.java

@@ -0,0 +1,15 @@
+package com.cyksj.service.coupon;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.cyksj.model.entity.EquipmentActivityReduce;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: EquipmentActivityReduceService
+ * 创建者: JavaZou
+ * 创建时间:2024/1/30 11:04
+ */
+public interface EquipmentActivityReduceService extends IService<EquipmentActivityReduce> {
+
+	void saveOrUpdateEquipmentAcReduceConfig(EquipmentActivityReduce equipmentActivityReduce);
+}

+ 52 - 0
netflix-service/src/main/java/com/cyksj/service/coupon/impl/EquipmentActivityReduceServiceImpl.java

@@ -0,0 +1,52 @@
+package com.cyksj.service.coupon.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.mapper.EquipmentActivityReduceMapper;
+import com.cyksj.model.entity.EquipmentActivityReduce;
+import com.cyksj.service.coupon.EquipmentActivityReduceService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: EquipmentActivityReduceServiceImpl
+ * 创建者: JavaZou
+ * 创建时间:2024/1/30 11:05
+ */
+@Service
+@RequiredArgsConstructor
+public class EquipmentActivityReduceServiceImpl extends ServiceImpl<EquipmentActivityReduceMapper,EquipmentActivityReduce> implements EquipmentActivityReduceService {
+	private final EquipmentActivityReduceMapper equipmentActivityReduceMapper;
+
+	@Override
+	public void saveOrUpdateEquipmentAcReduceConfig(EquipmentActivityReduce equipmentActivityReduce) {
+		checkParams(equipmentActivityReduce);
+		this.saveOrUpdate(equipmentActivityReduce);
+	}
+
+	public void checkParams(EquipmentActivityReduce equipmentActivityReduce) {
+		String name = equipmentActivityReduce.getName();
+		BigDecimal f = equipmentActivityReduce.getF();
+		BigDecimal q = equipmentActivityReduce.getQ();
+		BigDecimal tq = equipmentActivityReduce.getTq();
+		Date st = equipmentActivityReduce.getSt();
+		Date et = equipmentActivityReduce.getEt();
+		if (ObjectUtil.hasEmpty(name, f, q, tq, st, et)) {
+			throw BusinessRuntimeException.getInstance("请补充必填项..");
+		}
+		BigDecimal zero = BigDecimal.ZERO;
+		if (f.compareTo(zero) < 0 || q.compareTo(zero) < 0 || tq.compareTo(zero) < 0) {
+			throw BusinessRuntimeException.getInstance("满减金额不可小于0");
+		}
+
+		Integer count = equipmentActivityReduceMapper.checkRepeatTimeDuration(equipmentActivityReduce.getId(), st, et);
+		if (count > 0) {
+			throw BusinessRuntimeException.getInstance("存在活动时间重叠的记录..");
+		}
+	}
+}

+ 7 - 0
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java

@@ -735,6 +735,13 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		excelMonthlyDistributeOrderData.setChannelUserSourceNum(channelUserSourceNum);
 		excelMonthlyDistributeOrderData.setChannelUserSourceOrderNum(channelUserSourceOrderNum);
 		excelMonthlyDistributeOrderData.setChannelUserSourceOrderRate(channelUserSourceOrderRate);
+
+		Map<String, Long> epOrderSourceMap = statisticsExportMapper.getEpOrderNumsGroupSource(startDate, endDate);
+
+		Integer naturalEpOrders = Integer.parseInt(epOrderSourceMap.get("naturalEpOrders").toString());
+		Integer distributeOrders = Integer.parseInt(epOrderSourceMap.get("distributeOrders").toString());
+		excelMonthlyDistributeOrderData.setNatureUserSourceEpOrderNum(naturalEpOrders);
+		excelMonthlyDistributeOrderData.setChannelUserSourceEpOrderNum(distributeOrders);
 		excelSheetDataList.add(new ExcelSheetAndData("每月用户分销数据", List.of(excelMonthlyDistributeOrderData), ExcelMonthlyDistributeOrderData.class, 2));
 	}
 

+ 93 - 28
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -255,6 +255,12 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 
 	private final UserPayOrderBlockMapper userPayOrderBlockMapper;
 
+	private final UserDistributeSharedWhiteMapper userDistributeSharedWhiteMapper;
+
+	private final UserDistributeSharedRelateUnbindMapper userDistributeSharedRelateUnbindMapper;
+
+	private final EquipmentActivityReduceMapper equipmentActivityReduceMapper;
+
 	private final InformationClickUserRecordMapper informationClickUserRecordMapper;
 
 	private final List<String> noChekGoodsTemp = List.of("Apple One", "Youtube", "Spotify");
@@ -427,14 +433,6 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		if (payRequest.getPopularizeId() != null) {
 			orderDon.setPopularizeId(payRequest.getPopularizeId());
 		}
-		if (sku != null) {
-			//扣除使用优惠券、余额的订单金额
-			deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds());
-		}
-
-		if (isSpecificPrice && (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0 || orderDon.getMoney().compareTo(specificPrice) != 0)) {
-			throw BusinessRuntimeException.getInstance("专属价格不支持使用其他优惠");
-		}
 
 		orderDon.setSkuId(payRequest.getSkuId());
 		orderDon.setRelationId(relationId);
@@ -462,6 +460,14 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				throw BusinessRuntimeException.getInstance("车位与车队规格不一致");
 			}
 		}
+		if (sku != null) {
+			//扣除使用优惠券、余额的订单金额
+			deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds(), payRequest.getIsAcReduce());
+		}
+
+		if (isSpecificPrice && (orderDon.getMoney().compareTo(BigDecimal.ZERO) == 0 || orderDon.getMoney().compareTo(specificPrice) != 0)) {
+			throw BusinessRuntimeException.getInstance("专属价格不支持使用其他优惠");
+		}
 		orderDon.setPayDesc(goodsDon.getPayDesc());
 		StringBuilder payTitle = new StringBuilder();
 		payTitle.append(goodsDon.getTitle());
@@ -822,7 +828,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				}
 				//返还余额
 				if (orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
-					userBenefitsService.addUserBalance(orderDon.getUserId(), orderDon.getBalance(), null, null, null, null, false);
+					userBenefitsService.addUserBalance(orderDon.getUserId(), orderDon.getBalance(), UserBalanceSourceRecord.Source.close, orderDon.getYhsId());
 				}
 
 				//是否是礼品卡 现金支付订单
@@ -963,7 +969,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		}
 		orderDon.setRealMoney(orderDon.getMoney());
 		//扣除使用优惠券、余额的订单金额
-		deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds());
+		deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds(), false);
 		this.saveOrUpdate(orderDon);
 		if (orderDon.getStatus() == OrderDon.Status.noPayment) {
 			jobManager.addJob(EXPIRY_TIME, () -> {
@@ -2033,7 +2039,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 	/**
 	 * 使用优惠营销 订单金额抵扣
 	 */
-	public void deductOrderMoney(OrderDon orderDon, CouponUser couponUser, BigDecimal balance, User user, BigDecimal skuMoney, Integer goodsType, BigDecimal gcCash, List<Long> gcpIds) {
+	public void deductOrderMoney(OrderDon orderDon, CouponUser couponUser, BigDecimal balance, User user, BigDecimal skuMoney, Integer goodsType, BigDecimal gcCash, List<Long> gcpIds, Boolean isAcReduce) {
 		if (gcCash != null && gcCash.compareTo(BigDecimal.ZERO) > 0 && couponUser != null) {
 			throw BusinessRuntimeException.getInstance("现金卡不能与其他优惠叠加使用");
 		}
@@ -2083,6 +2089,13 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			}
 			return;
 		}
+		//针对设备 满减活动优惠 不支持使用优惠券等优惠
+		if (isAcReduce != null && isAcReduce && orderDon.getGoodsId() == 15) {
+			epOrderDonActivityReduce(orderDon);
+			//存在余额
+			deductBalancePayOrderMoney(orderDon, balance, user);
+			return;
+		}
 		//存在优惠券
 		if (couponUser != null) {
 			Long couponId = couponUser.getCouponId();
@@ -2163,23 +2176,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		}
 
 		//存在余额
-		if (balance != null && balance.compareTo(BigDecimal.ZERO) > 0) {
-			BigDecimal money = orderDon.getMoney();
-			//去掉余额 多出的部分
-			BigDecimal subBalance = balance;
-			orderDon.setMoney(money.subtract(subBalance));
-			if (balance.compareTo(money) >= 0) {
-				orderDon.setMoney(BigDecimal.ZERO);
-				orderDon.setBalance(money);
-				subBalance = money;
-				orderDon.setType(OrderDon.Type.BALANCE);
-			}
-			BigDecimal userBalance = user.getBalance();
-			//扣除余额 是否成功
-			Integer success = userMapper.deductBalance(user.getId(), subBalance, userBalance);
-			if (success != 1) throw BusinessRuntimeException.getInstance("您的余额不足!");
-			orderDon.setBalance(subBalance);
-		}
+		deductBalancePayOrderMoney(orderDon, balance, user);
 	}
 
 	/**
@@ -2593,6 +2590,20 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				if (userDistribute != null) {
 					//直接去除
 					if (!userDistributeShared.getIsBind()) {
+						UserDistributeSharedRelateUnbind userDistributeSharedRelateUnbind = userDistributeSharedRelateUnbindMapper.selectOne(Wrappers.lambdaQuery(UserDistributeSharedRelateUnbind.class)
+								.eq(UserDistributeSharedRelateUnbind::getUserId, userId)
+								.eq(UserDistributeSharedRelateUnbind::getIsUnbind, 1)
+								.last("limit 1"));
+						if (userDistributeSharedRelateUnbind != null) {
+							//是否是渠道用户白名单
+							UserDistributeSharedWhite userDistributeSharedWhite = userDistributeSharedWhiteMapper.selectOne(Wrappers.lambdaQuery(UserDistributeSharedWhite.class)
+									.eq(UserDistributeSharedWhite::getUserId, userDistributeShared.getSharedId())
+									.last("limit 1"));
+							if (userDistributeSharedWhite != null) {
+								orderDon.setIsFixedDistribute(true);
+								return;
+							}
+						}
 						orderDon.setIsDistribute(false);
 					} else {
 						//45天内是否下单成功 ==>改为30天
@@ -2722,4 +2733,58 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		orderRefundService.refundRecord(orderDon, orderRefundReq.getRefundMoney(), orderRefundReq.getOperator(), goodsDon, sku, outNo, orderDon.getType().getType());
 		return;
 	}
+
+	public void epOrderDonActivityReduce(OrderDon orderDon) {
+		if (orderDon.getMoney().compareTo(Constant.FIVE_HUNDRED) < 0) {
+			return;
+		}
+		DateTime now = DateTime.now();
+		EquipmentActivityReduce equipmentActivityReduce = equipmentActivityReduceMapper.selectOne(Wrappers.lambdaQuery(EquipmentActivityReduce.class)
+				.le(EquipmentActivityReduce::getSt, now)
+				.gt(EquipmentActivityReduce::getEt, now)
+				.eq(EquipmentActivityReduce::getDeleted, true)
+				.last("limit 1"));
+		if (equipmentActivityReduce == null) {
+			return;
+		}
+		BigDecimal money = orderDon.getMoney();
+		BigDecimal acReduceMoney = BigDecimal.ZERO;
+		if (money.compareTo(Constant.FIVE_HUNDRED) >= 0 && money.compareTo(Constant.THOUSAND) < 0) {
+			//500-1000
+			acReduceMoney = equipmentActivityReduce.getF();
+			log.info("活动设备订单号:{}达到500元资格,满减金额:{}", orderDon.getOrderNo(), acReduceMoney.divide(BigDecimal.valueOf(100)));
+		} else if (money.compareTo(Constant.THOUSAND) >= 0 && money.compareTo(Constant.TWO_THOUSAND) < 0) {
+			//1000-2000
+			acReduceMoney = equipmentActivityReduce.getQ();
+			log.info("活动设备订单号:{}达到1000元资格,满减金额:{}", orderDon.getOrderNo(), acReduceMoney.divide(BigDecimal.valueOf(100)));
+		} else if (money.compareTo(Constant.TWO_THOUSAND) >= 0) {
+			//2000
+			acReduceMoney = equipmentActivityReduce.getTq();
+			log.info("活动设备订单号:{}达到2000元资格,满减金额:{}", orderDon.getOrderNo(), acReduceMoney.divide(BigDecimal.valueOf(100)));
+		}
+		orderDon.setMoney(orderDon.getMoney().subtract(acReduceMoney));
+		orderDon.setCouponMoney(acReduceMoney);
+	}
+
+	public void deductBalancePayOrderMoney(OrderDon orderDon, BigDecimal balance, User user) {
+		//存在余额
+		if (balance != null && balance.compareTo(BigDecimal.ZERO) > 0) {
+			BigDecimal money = orderDon.getMoney();
+			//去掉余额 多出的部分
+			BigDecimal subBalance = balance;
+			orderDon.setMoney(money.subtract(subBalance));
+			if (balance.compareTo(money) >= 0) {
+				orderDon.setMoney(BigDecimal.ZERO);
+				orderDon.setBalance(money);
+				subBalance = money;
+				orderDon.setType(OrderDon.Type.BALANCE);
+			}
+			BigDecimal userBalance = user.getBalance();
+			//扣除余额 是否成功
+			Integer success = userMapper.deductBalance(user.getId(), subBalance, userBalance);
+			if (success != 1) throw BusinessRuntimeException.getInstance("您的余额不足!");
+			orderDon.setBalance(subBalance);
+			userBenefitsService.recordBalanceBySource(user.getId(), BigDecimal.valueOf(-subBalance.longValue()), UserBalanceSourceRecord.Source.payment);
+		}
+	}
 }

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

@@ -13,6 +13,7 @@ import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.util.Jsons;
 import com.cyksj.common.util.StringUtil;
 import com.cyksj.dto.Result;
+import com.cyksj.dto.UserSharedDto;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.GoodsDonSkuMapper;
 import com.cyksj.mapper.OrderDonMapper;
@@ -25,6 +26,7 @@ import com.cyksj.redis.RedisService;
 import com.cyksj.service.goods.GoodsDonFrontService;
 import com.cyksj.service.home.ClickRecordFrontService;
 import com.cyksj.service.shop.YhShopFrontService;
+import com.cyksj.service.user.UserService;
 import com.cyksj.web.util.StpUserUtil;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
@@ -39,6 +41,8 @@ import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -70,6 +74,8 @@ public class GoodsDonController {
 
 	private final YhShopFrontService yhShopFrontService;
 
+	private final UserService userService;
+
 	private final GoodsDonFrontService goodsDonFrontService;
 
 	/**
@@ -212,6 +218,7 @@ public class GoodsDonController {
      * 官网首页 平台列表
      */
     @GetMapping("/get/list")
+    @Deprecated
     public Result<? extends Object> getGoodsList(String customId) {
 	    if (StrUtil.isNotBlank(customId)) {
 		    Result<List<YhShopGoodsFrontView>> shopGoods = getShopGoods(yhShopFrontService.getYhsIdByCustomId(customId));
@@ -246,7 +253,7 @@ public class GoodsDonController {
 		    data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
 
 		    //设置特定价格
-		    setSpecificPrice(data, fUid);
+		    setSpecificPrice(data, fUid, null);
 	    });
 	    return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
     }
@@ -290,7 +297,7 @@ public class GoodsDonController {
 		    data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
 
 		    //设置特定价格
-		    setSpecificPrice(data, fUid);
+		    setSpecificPrice(data, fUid, null);
 	    });
 	    return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
     }
@@ -329,16 +336,20 @@ public class GoodsDonController {
 	 * 获取商品详情
 	 */
 	@GetMapping("/get/{id}")
-	public Result<? extends Object> getDetail(@PathVariable Long id, String customId) {
+	public Result<? extends Object> getDetail(@PathVariable Long id, String customId, String dsCode) {
 		if (StrUtil.isNotBlank(customId) && id != 15) {
 			Result<YhShopGoodsFrontView> yhShopGoodsDetail = getGoodsDetailByYhsId(yhShopFrontService.getYhsIdByCustomId(customId), id);
 			return yhShopGoodsDetail;
 		}
 		String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "goods_detail:" + id;
+		List<Long> filter_goodsIds = getFilterGoodsIds();
+		//存在过滤平台 商品详情不返回
+		if (CollUtil.isNotEmpty(filter_goodsIds) && filter_goodsIds.contains(id)) {
+			return GatewayResponse.SUCCESS.newBuilder().toResult();
+		}
 		Object o = redisService.get(goodsDetailKey);
-		GoodsFrontListView views = null;
 		if (o == null) {
-			views = beanSearcher.searchFirst(GoodsFrontListView.class, MapUtils.builder().field(GoodsFrontListView::getId, id)
+			GoodsFrontListView views = beanSearcher.searchFirst(GoodsFrontListView.class, MapUtils.builder().field(GoodsFrontListView::getId, id)
 					.build());
 
 			views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
@@ -352,10 +363,26 @@ public class GoodsDonController {
 			o = redisService.get(goodsDetailKey);
 		}
 		Long fUid = StpUserUtil.getUserIdAfterLogin();
-		if (views == null) {
-			views = Jsons.parseObject(o, GoodsFrontListView.class);
+		GoodsFrontListView views = Jsons.parseObject(o, GoodsFrontListView.class);
+		AtomicLong dsUserId = new AtomicLong();
+		AtomicBoolean existsChannel = new AtomicBoolean(true);
+		if (StrUtil.isNotBlank(dsCode)) {
+			UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
+			dsUserId.set(userSharedDto.getSharedId());
 		}
-		for (GoodsDonSkuFrontView sku : views.getSkuList()) {
+		views.setSkuList(views.getSkuList().stream().filter(sku -> {
+			if (StrUtil.isNotBlank(sku.getUserOwns())) {
+				if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
+					Long sharedId = userService.getSharedIdByUserId(fUid);
+					if (sharedId == 0) {
+						existsChannel.set(false);
+					}
+					dsUserId.set(sharedId);
+				}
+				if (dsUserId.get() == 0 || !sku.getUserOwns().contains(String.valueOf(dsUserId.get()))) {
+					return false;
+				}
+			}
 			if (sku.getIsDp()) {
 				sku.setDpSkuViews(beanSearcher.searchAll(GoodsDiscountPlusPurchaseRelationFrontView.class, MapUtils.builder()
 						.field(GoodsDiscountPlusPurchaseRelationFrontView::getSkuId, sku.getId())
@@ -365,27 +392,28 @@ public class GoodsDonController {
 				if (fUid == null) {
 					sku.setSpecificPrice(null);
 					sku.setSpecificGoodsIds(null);
-					continue;
-				}
-				//设置特定价格
-				if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
-					sku.setSpecificGoodsIds(null);
-					sku.setSpecificPrice(null);
-				} else {
-					BigDecimal specificPrice = views.getSpecificPrice();
-
-					BigDecimal skuSpecificPrice = sku.getSpecificPrice();
-					Long specificSkuId = sku.getId();
-					if (specificPrice == null) {
-						views.setSpecificPrice(skuSpecificPrice);
-						views.setSpecificSkuId(specificSkuId);
-					} else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
-						views.setSpecificPrice(skuSpecificPrice);
-						views.setSpecificSkuId(specificSkuId);
+				}else {
+					//设置特定价格
+					if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
+						sku.setSpecificGoodsIds(null);
+						sku.setSpecificPrice(null);
+					} else {
+						BigDecimal specificPrice = views.getSpecificPrice();
+
+						BigDecimal skuSpecificPrice = sku.getSpecificPrice();
+						Long specificSkuId = sku.getId();
+						if (specificPrice == null) {
+							views.setSpecificPrice(skuSpecificPrice);
+							views.setSpecificSkuId(specificSkuId);
+						} else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
+							views.setSpecificPrice(skuSpecificPrice);
+							views.setSpecificSkuId(specificSkuId);
+						}
 					}
 				}
 			}
-		}
+			return true;
+		}).collect(Collectors.toList()));
 		Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
 				.eq(OrderDon::getGoodsId, views.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
 		views.setSold(sold + views.getSold());
@@ -403,7 +431,7 @@ public class GoodsDonController {
      * 获取商品推荐平台
      */
     @GetMapping("/get/recommend/{id}")
-    public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id, String customId) throws Exception {
+    public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id, String customId, String dsCode) throws Exception {
 	    String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "recommend:" + id;
 	    Long yhsId = null;
 	    if (StrUtil.isNotBlank(customId)) {
@@ -435,13 +463,36 @@ public class GoodsDonController {
 	    if (goodsRecommendViews == null) {
 		    goodsRecommendViews = Jsons.parseList(o.toString(), GoodsFrontListView.class);
 	    }
-	    goodsRecommendViews.forEach(data -> {
+	    AtomicLong dsUserId = new AtomicLong();
+	    AtomicBoolean existsChannel = new AtomicBoolean(true);
+	    if (StrUtil.isNotBlank(dsCode)) {
+		    UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
+		    dsUserId.set(userSharedDto.getSharedId());
+	    }
+	    goodsRecommendViews = goodsRecommendViews.stream().filter(data -> {
+		    if (data.getIsOwns()) {
+			    if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
+				    Long sharedId = userService.getSharedIdByUserId(fUid);
+				    if (sharedId == 0) {
+					    existsChannel.set(false);
+				    }
+				    dsUserId.set(sharedId);
+			    }
+			    GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getId(), dsUserId.get());
+			    if (minPriceUserOwnsSku == null) {
+				    return false;
+			    }
+			    data.setPrice(minPriceUserOwnsSku.getPrice());
+			    data.setMonths(minPriceUserOwnsSku.getMonths());
+			    data.setDays(minPriceUserOwnsSku.getDays());
+		    }
 		    Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
 				    .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
-			data.setSold(data.getSold() + sold);
+		    data.setSold(data.getSold() + sold);
 		    //设置特定价格
-		    setSpecificPrice(data, fUid);
-	    });
+		    setSpecificPrice(data, fUid, dsUserId.get());
+		    return true;
+	    }).collect(Collectors.toList());
 	    return GatewayResponse.SUCCESS.newBuilder().toResult(goodsRecommendViews);
     }
 
@@ -485,13 +536,17 @@ public class GoodsDonController {
 	 * 获取首页配置列表
 	 */
 	@GetMapping("/get/homeManage")
-	public Result<Map<String, List<HomeManagementFrontView>>> getHomeManagementFrontPage(String customId) {
+	public Result<Map<String, List<HomeManagementFrontView>>> getHomeManagementFrontPage(String customId, String dsCode) {
 		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage";
 		Long yhsId = null;
 		if (StrUtil.isNotBlank(customId)) {
 			yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
 			key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":homeManage";
 		}
+		List<Long> filter_goodsIds = getFilterGoodsIds();
+		if (CollUtil.isNotEmpty(filter_goodsIds)) {
+			key += ":hz-ip";
+		}
 		Long fUid = StpUserUtil.getUserIdAfterLogin();
 		Object o = redisService.get(key);
 		if (o == null) {
@@ -507,6 +562,9 @@ public class GoodsDonController {
 								.field(HomeManagementFrontView::getType, type.name());
 						if (type == HomeManagementConfig.Type.ex || type == HomeManagementConfig.Type.vg) {
 							builder.put("condition", conditionSql);
+							if (CollUtil.isNotEmpty(filter_goodsIds)) {
+								builder.field(HomeManagementFrontView::getGoodsId, filter_goodsIds).op(Operator.NotIn);
+							}
 						}
 						List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
 						map.putIfAbsent(type.name(), homeManagementFrontViews);
@@ -514,21 +572,22 @@ public class GoodsDonController {
 			redisService.setNx(key, map, 50 * 60l);
 			o = redisService.get(key);
 		}
+		AtomicLong dsUserId = new AtomicLong();
+		AtomicBoolean existsChannel = new AtomicBoolean(true);
+		if (StrUtil.isNotBlank(dsCode)) {
+			UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
+			dsUserId.set(userSharedDto.getSharedId());
+		}
 		Map<String, List<HomeManagementFrontView>> map = Jsons.parseObject(o, Map.class);
 		if (map.containsKey(HomeManagementConfig.Type.ex.name()) || map.containsKey(HomeManagementConfig.Type.vg.name())) {
 			try {
-				//设置特定价格
+				//精彩推荐
 				List<HomeManagementFrontView> exList = Jsons.parseList(Jsons.toJson(map.get(HomeManagementConfig.Type.ex.name())), HomeManagementFrontView.class);
-				if (CollUtil.isNotEmpty(exList)) {
-					setHomeManageSpecific(exList, fUid);
-					map.put(HomeManagementConfig.Type.ex.name(), exList);
-				}
-				//设置特定价格
+				setHomeConfigGoods(map, HomeManagementConfig.Type.ex, exList, dsUserId, existsChannel, fUid);
+
+				//虚拟平台
 				List<HomeManagementFrontView> vgList = Jsons.parseList(Jsons.toJson(map.get(HomeManagementConfig.Type.vg.name())), HomeManagementFrontView.class);
-				if (CollUtil.isNotEmpty(vgList)) {
-					setHomeManageSpecific(vgList, fUid);
-					map.put(HomeManagementConfig.Type.vg.name(), vgList);
-				}
+				setHomeConfigGoods(map, HomeManagementConfig.Type.vg, vgList, dsUserId, existsChannel, fUid);
 			} catch (Exception e) {
 			}
 		}
@@ -546,19 +605,19 @@ public class GoodsDonController {
 	}
 
     public List<Long> getFilterGoodsIds() {
-        //过滤杭州Ai ChatGPT平台
-        //获取当前ip地址
-        SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
-                .eq(SysConfig::getSysKey, Constant.LOCATION_FOR_GOODS_IDS).last("limit 1"));
         List<Long> filter_goodsIds = null;
-        if (sysConfig != null && StrUtil.isNotBlank(sysConfig.getSysValue())) {
-            if (StringUtil.getRealAddressByIP(ServletUtil.getClientIP(request)).contains("杭州")) {
-                try {
-                    filter_goodsIds = Jsons.parseList(sysConfig.getSysValue(), Long.class);
-                } catch (Exception e) {
-                }
-            }
-        }
+	    //获取当前ip地址
+	    if (StringUtil.getRealAddressByIP(ServletUtil.getClientIP(request)).contains("杭州")) {
+		    //过滤杭州Ai ChatGPT平台
+		    SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
+				    .eq(SysConfig::getSysKey, Constant.LOCATION_FOR_GOODS_IDS).last("limit 1"));
+		    if (sysConfig != null && StrUtil.isNotBlank(sysConfig.getSysValue())) {
+			    try {
+				    filter_goodsIds = Jsons.parseList(sysConfig.getSysValue(), Long.class);
+			    } catch (Exception e) {
+			    }
+		    }
+	    }
         return filter_goodsIds;
     }
 
@@ -640,7 +699,7 @@ public class GoodsDonController {
     /**
      * 设置平台 特定价格
      */
-    public void setSpecificPrice(GoodsFrontListView data, Long fUid) {
+    public void setSpecificPrice(GoodsFrontListView data, Long fUid, Long dsUserId) {
 	    if (fUid != null) {
 		    if (data.getIsSp()) {
 			    //查找所有特定规格最小价格 满足条件
@@ -658,6 +717,9 @@ public class GoodsDonController {
 				    redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
 			    }
 			    specificSkus.forEach(specificSku -> {
+				    if (StrUtil.isNotEmpty(specificSku.getUserOwns()) && (dsUserId == null || !specificSku.getUserOwns().contains(dsUserId.toString()))) {
+					    return;
+				    }
 				    String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
 				    if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
 					    BigDecimal specificPrice = data.getSpecificPrice();
@@ -689,7 +751,7 @@ public class GoodsDonController {
 	/**
 	 * 设置平台 特定价格
 	 */
-	public void setGcSpecificPrice(GoodsFrontListCategoryView data, Long fUid) {
+	public void setGcSpecificPrice(GoodsFrontListCategoryView data, Long fUid, Long dsUserId) {
 		if (fUid != null) {
 			if (data.getIsSp()) {
 				//查找所有特定规格最小价格 满足条件
@@ -707,6 +769,9 @@ public class GoodsDonController {
 					redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
 				}
 				specificSkus.forEach(specificSku -> {
+					if (StrUtil.isNotEmpty(specificSku.getUserOwns()) && (dsUserId == null || !specificSku.getUserOwns().contains(dsUserId.toString()))) {
+						return;
+					}
 					String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
 					if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
 						BigDecimal specificPrice = data.getSpecificPrice();
@@ -760,13 +825,16 @@ public class GoodsDonController {
 	/**
 	 * 设置首页配置 涉及平台特定价格
 	 */
-	public void setHomeManageSpecific(List<HomeManagementFrontView> list, Long fUid) {
+	public void setHomeManageSpecific(List<HomeManagementFrontView> list, Long fUid, Long dsUserId) {
 		DateTime now = DateTime.now();
 		list.forEach(data -> {
 			if (data.getIsSp() != null && data.getIsSp() && fUid != null) {
 				//查找所有特定规格最小价格 满足条件
 				List<GoodsDonSku> specificSkus = getSpecificSku(data.getGoodsId());
 				specificSkus.forEach(specificSku -> {
+					if (StrUtil.isNotEmpty(specificSku.getUserOwns()) && (dsUserId == null || !specificSku.getUserOwns().contains(dsUserId.toString()))) {
+						return;
+					}
 					String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
 					if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
 						BigDecimal specificPrice = data.getSpecificPrice();
@@ -789,6 +857,33 @@ public class GoodsDonController {
 		});
 	}
 
+	public void setHomeConfigGoods(Map<String, List<HomeManagementFrontView>> map, HomeManagementConfig.Type type, List<HomeManagementFrontView> list, AtomicLong dsUserId, AtomicBoolean existsChannel, Long fUid) throws Exception {
+		//设置特定价格
+		if (CollUtil.isNotEmpty(list)) {
+			list = list.stream().filter(data -> {
+				if (data.getIsOwns()) {
+					if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
+						Long sharedId = userService.getSharedIdByUserId(fUid);
+						if (sharedId == 0) {
+							existsChannel.set(false);
+						}
+						dsUserId.set(sharedId);
+					}
+					GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getGoodsId(), dsUserId.get());
+					if (minPriceUserOwnsSku == null) {
+						return false;
+					}
+					data.setPrice(minPriceUserOwnsSku.getPrice());
+					data.setMonths(minPriceUserOwnsSku.getMonths());
+					data.setDays(minPriceUserOwnsSku.getDays());
+				}
+				return true;
+			}).collect(Collectors.toList());
+			setHomeManageSpecific(list, fUid, dsUserId.get());
+			map.put(type.name(), list);
+		}
+	}
+
     /**
      * 店铺平台列表
      */
@@ -846,7 +941,7 @@ public class GoodsDonController {
 	 * 根据分类获取对应平台
 	 */
 	@GetMapping("/get/categoryGoods")
-	public Result<? extends Object> getGoodsByCategory(Long cgy, String customId) {
+	public Result<? extends Object> getGoodsByCategory(Long cgy, String customId, String dsCode) {
 		if (StrUtil.isNotBlank(customId)) {
 			Result<List<YhShopGoodsFrontCategoryView>> shopGoods = getShopCategoryGoods(yhShopFrontService.getYhsIdByCustomId(customId), cgy);
 			return shopGoods;
@@ -856,6 +951,10 @@ public class GoodsDonController {
 		if (cgy != null) {
 			categoryGoodsKey += ":" + cgy;
 		}
+		List<Long> filter_goodsIds = getFilterGoodsIds();
+		if (CollUtil.isNotEmpty(filter_goodsIds)) {
+			categoryGoodsKey += ":hz-ip";
+		}
 		Object o = redisService.get(categoryGoodsKey);
 		if (o == null) {
 			MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
@@ -863,20 +962,46 @@ public class GoodsDonController {
 				String condition = String.format(" and gcr.category = %s", cgy);
 				mapBuilder.put("condition", condition);
 			}
+			if (CollUtil.isNotEmpty(filter_goodsIds)) {
+				mapBuilder.field(GoodsFrontListCategoryView::getId, filter_goodsIds).op(Operator.NotIn);
+			}
 			List<GoodsFrontListCategoryView> goodsFrontListViews = beanSearcher.searchAll(GoodsFrontListCategoryView.class, mapBuilder.build());
 			redisService.setNx(categoryGoodsKey, goodsFrontListViews, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 10 * 60);
 			o = redisService.get(categoryGoodsKey);
 		}
 		List<GoodsFrontListCategoryView> goodsFrontListViews = Jsons.parseList(o, GoodsFrontListCategoryView.class);
 		DateTime now = DateTime.now();
-		goodsFrontListViews.forEach(data -> {
+		AtomicLong dsUserId = new AtomicLong();
+		AtomicBoolean existsChannel = new AtomicBoolean(true);
+		if (StrUtil.isNotBlank(dsCode)) {
+			UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
+			dsUserId.set(userSharedDto.getSharedId());
+		}
+		goodsFrontListViews = goodsFrontListViews.stream().filter(data -> {
+			if (data.getIsOwns()) {
+				if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
+					Long sharedId = userService.getSharedIdByUserId(fUid);
+					if (sharedId == 0) {
+						existsChannel.set(false);
+					}
+					dsUserId.set(sharedId);
+				}
+				GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getId(), dsUserId.get());
+				if (minPriceUserOwnsSku == null) {
+					return false;
+				}
+				data.setPrice(minPriceUserOwnsSku.getPrice());
+				data.setMonths(minPriceUserOwnsSku.getMonths());
+				data.setDays(minPriceUserOwnsSku.getDays());
+			}
 			Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
 					.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
 			data.setSold(sold + data.getSold());
 			data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
 			//设置特定价格
-			setGcSpecificPrice(data, fUid);
-		});
+			setGcSpecificPrice(data, fUid, dsUserId.get());
+			return true;
+		}).collect(Collectors.toList());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsFrontListViews);
 	}
 
@@ -910,6 +1035,21 @@ public class GoodsDonController {
 		return GatewayResponse.SUCCESS.newBuilder().toResult(list);
 	}
 
+	/**
+	 * 获取设备活动详情
+	 */
+	@GetMapping("/get/equipment/activity")
+	public Result<EquipmentActivityReduce> getEpActivity() {
+		DateTime now = DateTime.now();
+		EquipmentActivityReduce equipmentActivityReduce = beanSearcher.searchFirst(EquipmentActivityReduce.class, MapUtils.builder()
+				.field(EquipmentActivityReduce::getSt, now).op(Operator.LessEqual)
+				.field(EquipmentActivityReduce::getEt, now).op(Operator.GreaterThan)
+				.field(EquipmentActivityReduce::getDeleted, 1)
+				.onlySelect(EquipmentActivityReduce::getF, EquipmentActivityReduce::getQ, EquipmentActivityReduce::getTq, EquipmentActivityReduce::getSt, EquipmentActivityReduce::getEt)
+				.build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(equipmentActivityReduce);
+	}
+
 	/**
 	 * 获取pc广告配置
 	 */

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

@@ -3,6 +3,8 @@ package com.cyksj.web.controller.manage;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.dev33.satoken.stp.StpUtil;
 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 com.alipay.api.AlipayApiException;
 import com.baomidou.mybatisplus.core.toolkit.Assert;
@@ -405,4 +407,31 @@ public class CmsUserController{
                 .build());
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
     }
+
+    /**
+     * 大额度用户 列表
+     */
+    @GetMapping("/get/consume/large/user")
+    public Result<SearchResult<UserView>> getLargeConsumer() {
+        MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
+        String largeLimit = "200000";
+        String fu = String.format("(select distinct user_id from order_don o where o.relation_id != 0 and o.status not in ('close','noPayment','refund') group by user_id, date_format(o.created_time,'%%Y-%%m-%%d')" +
+                "having sum(money) > %s) ln inner join", largeLimit);
+        String fuOn = " on ln.user_id = u.id";
+        builder.put("fu", fu);
+        builder.put("fu_on", fuOn);
+        SearchResult<UserView> search = beanSearcher.search(UserView.class, builder.build());
+        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+    }
+
+    /**
+     * 是否有最新的用户产生
+     */
+    @GetMapping("/get/consume/large/newUser")
+    public Result<Boolean> getLargeNewConsumer() {
+        String largeLimit = "200000";
+        DateTime beginOfDay = DateUtil.beginOfDay(DateTime.now());
+        Integer newConsumerCount = userMapper.getLargeNewConsumer(beginOfDay, largeLimit);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(newConsumerCount > 0 ? true : false);
+    }
 }

+ 2 - 5
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgAuditController.java

@@ -51,7 +51,7 @@ public class CorpMsgAuditController {
      * @return
      */
     @GetMapping
-    public Result<SearchResult<CorpMsgAuditUserView>> get(String textKey, String tagId,String followId) {
+    public Result<SearchResult<CorpMsgAuditUserView>> get(String textKey, String tagId) {
         Set<String> userIds = new HashSet<>();
         if(StringUtils.isNotBlank(textKey)){
             List<QyMsgContent> text = corpQyMsgContentService.list(Wrappers.lambdaQuery(QyMsgContent.class).select(QyMsgContent::getFrom, QyMsgContent::getExternalUserid,QyMsgContent::getTolist).like(QyMsgContent::getText, textKey).eq(QyMsgContent::getRoomid,"").eq(QyMsgContent::getMsgtype, "text"));
@@ -62,12 +62,9 @@ public class CorpMsgAuditController {
             builder.field(CorpMsgAuditUserView::getExternalUserid,userIds).op(InList.class);
         }
         if(StringUtils.isNotBlank(tagId)){
-            builder.put("tag", String.format( "and cr.id = t.relation_id and t.tag_id = %s", tagId));
+            builder.put("tag", String.format( "and cr.id = t.relation_id and t.tag_id = '%s'", tagId));
             builder.put("tagTable", ",corp_user_tag t");
         }
-        if (StringUtils.isNotBlank(followId)) {
-            builder.field(CorpMsgAuditUserView::getFollowId, followId).op(Operator.Equal);
-        }
         SearchResult<CorpMsgAuditUserView> search = beanSearcher.search(CorpMsgAuditUserView.class, builder.build());
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 

+ 4 - 6
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpMsgFollowController.java

@@ -48,9 +48,8 @@ public class CorpMsgFollowController {
      */
     @GetMapping
     public Result<SearchResult<CorpMsgFollowAssociationView>> getPermitUserList() throws Exception {
-        //List<String> res = wxCorpOps.getPermitUserList(corpConfig.getCorpId(), null);
-        //SearchResult<CorpMsgFollowAssociationView> search = beanSearcher.search(CorpMsgFollowAssociationView.class, MapUtils.flatBuilder(request.getParameterMap()).field(CorpMsgFollowAssociationView::getUserid, res).op(Operator.InList).build());
-        SearchResult<CorpMsgFollowAssociationView> search = beanSearcher.search(CorpMsgFollowAssociationView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
+        List<String> res = wxCorpOps.getPermitUserList(corpConfig.getCorpId(), null);
+        SearchResult<CorpMsgFollowAssociationView> search = beanSearcher.search(CorpMsgFollowAssociationView.class, MapUtils.flatBuilder(request.getParameterMap()).field(CorpMsgFollowAssociationView::getUserid, res).op(Operator.InList).build());
         search.getDataList().forEach((data)->{
             List<CorpMsgFollowAssociation> corpMsgFollowAssociations = beanSearcher.searchAll(CorpMsgFollowAssociation.class, MapUtils.builder().field(CorpMsgFollowAssociation::getFollowId, data.getUserid()).build());
             List<String> followIds = corpMsgFollowAssociations.stream().map(CorpMsgFollowAssociation::getAssociationFollowId).collect(Collectors.toList());
@@ -70,9 +69,8 @@ public class CorpMsgFollowController {
      */
     @GetMapping("/all")
     public Result<List<CorpMsgFollowAssociationView>> getAll() throws Exception {
-        //List<String> res = wxCorpOps.getPermitUserList(corpConfig.getCorpId(), null);
-        //List<CorpMsgFollowAssociationView> search = beanSearcher.searchAll(CorpMsgFollowAssociationView.class, MapUtils.flatBuilder(request.getParameterMap()).field(CorpMsgFollowAssociationView::getUserid, res).op(Operator.InList).build());
-        List<CorpMsgFollowAssociationView> search = beanSearcher.searchAll(CorpMsgFollowAssociationView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
+        List<String> res = wxCorpOps.getPermitUserList(corpConfig.getCorpId(), null);
+        List<CorpMsgFollowAssociationView> search = beanSearcher.searchAll(CorpMsgFollowAssociationView.class, MapUtils.flatBuilder(request.getParameterMap()).field(CorpMsgFollowAssociationView::getUserid, res).op(Operator.InList).build());
 
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
     }

+ 2 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/WxCorpController.java

@@ -136,6 +136,8 @@ public class WxCorpController {
 
 		CorpOauth2UserInfo corpOauth2UserInfo = corpService.getUserInfo(re.getCorpId(), code);
 
+		log.info("企业微信客服授权信息:{}", Jsons.toJson(corpOauth2UserInfo));
+
 		CorpFollow corpFollow = corpService.saveFollowUser(re.getCorpId(), corpOauth2UserInfo);
 
 		String url = redisService.getStr(RedisService.key.CORP_AUTH_MAPPING_KEY.getName() + re.getMappingId().toString());

+ 51 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/coupon/CouponController.java

@@ -23,6 +23,7 @@ import com.cyksj.model.request.CouponDistributeReq;
 import com.cyksj.model.request.corp.CorpXmlMessage;
 import com.cyksj.model.views.*;
 import com.cyksj.service.corp.msg.CorpEventActionService;
+import com.cyksj.service.coupon.EquipmentActivityReduceService;
 import com.cyksj.service.mange.coupon.CouponCommonService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
@@ -38,6 +39,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.constraints.Min;
 import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 /*
@@ -79,6 +81,8 @@ public class CouponController {
 
 	private final HttpServletRequest request;
 
+	private final EquipmentActivityReduceService equipmentActivityReduceService;
+
 	/**
 	 * 新增优惠券
 	 */
@@ -460,4 +464,51 @@ public class CouponController {
 		}
 		return corpUser.getUnionid();
 	}
+
+
+	/**
+	 * 设置 设备活动满减配置
+	 */
+	@PostMapping("/set/equipment/activity/reduce")
+	public Result<String> setEquipmentAcReduceConfig(@RequestBody EquipmentActivityReduce equipmentActivityReduce) {
+		equipmentActivityReduceService.saveOrUpdateEquipmentAcReduceConfig(equipmentActivityReduce);
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+
+	/**
+	 * 编辑 设备活动满减配置
+	 */
+	@PutMapping("/put/equipment/activity/reduce")
+	public Result<String> updateEquipmentAcReduceConfig(@RequestBody EquipmentActivityReduce equipmentActivityReduce) {
+		if (equipmentActivityReduce.getId() == null) {
+			throw BusinessRuntimeException.getInstance("记录不存在..");
+		}
+		equipmentActivityReduceService.saveOrUpdateEquipmentAcReduceConfig(equipmentActivityReduce);
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+
+	/**
+	 * 设备活动满减列表
+	 */
+	@GetMapping("/get/equipment/activity/reduce")
+	public Result<SearchResult<EquipmentActivityReduce>> getEquipmentAcReduceConfig() {
+		SearchResult<EquipmentActivityReduce> search = beanSearcher.search(EquipmentActivityReduce.class, MapUtils.flatBuilder(request.getParameterMap())
+				.field(EquipmentActivityReduce::getDeleted, true)
+				.orderBy(EquipmentActivityReduce::getId).desc()
+				.build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	}
+
+
+	/**
+	 * 删除设备满减活动
+	 */
+	@DeleteMapping("/del/equipment/activity/reduce/{id}")
+	public Result<String> getEquipmentAcReduceConfig(@PathVariable Long id) {
+		Optional.ofNullable(equipmentActivityReduceService.getById(id)).ifPresent(e -> {
+			e.setDeleted(false);
+			equipmentActivityReduceService.updateById(e);
+		});
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
 }

+ 27 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributeController.java

@@ -338,7 +338,7 @@ public class DistributeController {
 	public Result<SearchResult<RegisterDistributeOrdersView>> getRegisterDistributeUserDetail() {
 		SearchResult<RegisterDistributeOrdersView> search = beanSearcher.search(RegisterDistributeOrdersView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
 		search.getDataList().forEach(data -> {
-			List<RegisterDistributeOrdersDetailView> ordersDetailViewList = beanSearcher.searchAll(RegisterDistributeOrdersDetailView.class, MapUtils.builder().field(RegisterDistributeOrdersDetailView::getUserId, data.getUserId()).op(Operator.Equal).build());
+			List<RegisterDistributeOrdersDetailView> ordersDetailViewList = beanSearcher.searchAll(RegisterDistributeOrdersDetailView.class, MapUtils.flatBuilder(request.getParameterMap()).field(RegisterDistributeOrdersDetailView::getUserId, data.getUserId()).op(Operator.Equal).build());
 			data.setOrderNums(ordersDetailViewList.size());
 			Optional<BigDecimal> money = ordersDetailViewList.stream().filter(order -> {
 				if (!Constant.noOrderAllStatus.contains(order.getStatus().name())) {
@@ -1241,4 +1241,30 @@ public class DistributeController {
 		SearchResult<UserDistributeSharedWhite> search = beanSearcher.search(UserDistributeSharedWhite.class, MapUtils.flatBuilder(request.getParameterMap()).build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
+
+	/**
+	 * 普通渠道列表
+	 */
+	@GetMapping("/get/common/distribute")
+	public Result<SearchResult<UserCommonDistributeView>> getCommonDistribute(Long userId, String nickname) {
+		String condition = StrUtil.EMPTY;
+		if (userId != null) {
+			condition += String.format(" and id = %s", userId);
+		}
+		if (StrUtil.isNotEmpty(nickname)) {
+			condition += String.format(" and nickname like '%%%s%%'", nickname);
+		}
+		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
+		if (StrUtil.isNotEmpty(condition)) {
+			builder.put("condition", condition);
+		}
+		SearchResult<UserCommonDistributeView> search = beanSearcher.search(UserCommonDistributeView.class,
+				builder.build());
+		search.getDataList().forEach(view -> {
+			if (view.getDistributeOrdersMoney().compareTo(BigDecimal.ZERO) > 0) {
+				Optional.ofNullable(userDistributeMapper.selectSoldMaxGoods(view.getUserId())).ifPresent(title -> view.setGoodsTitle(title));
+			}
+		});
+		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	}
 }

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

@@ -12,6 +12,7 @@ import com.cyksj.common.constant.Constant;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.util.IoKit;
 import com.cyksj.common.util.Jsons;
+import com.cyksj.common.util.StringUtil;
 import com.cyksj.common.util.Xmls;
 import com.cyksj.config.zfb.BaseZfbConfig;
 import com.cyksj.config.zfb.ZfbProductCode;
@@ -135,6 +136,9 @@ public class OrderController {
         log.info("{}[start] params:{}", methodName, payRequest);
 
         String ip = ServletUtil.getClientIP(request);
+        if (StringUtil.getInternalAddressByIP(ip).contains("柬埔寨")) {
+            throw BusinessRuntimeException.getInstance("系统异常");
+        }
         payRequest.setIp(ip);
 
         OrderDon orderDon = orderDonService.submit(payRequest);

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

@@ -511,7 +511,7 @@ public class AuthorizationController {
     @PostMapping("/google/login")
     public Result<UserAuthLoginResp> googleLogin(LoginReq loginReq,String credential) throws Exception {
         log.info("google loginReq:{},credential:{}", loginReq, credential);
-        String result = HttpUtil.post("https://galaxydvd.com/8081/api/auth/google/login/inner?credential=" + credential, new HashMap<>());
+        String result = HttpUtil.post("https://galaxyva.com/8081/api/auth/google/login/inner?credential=" + credential, new HashMap<>());
         log.info("google result:{}",result);
         GoogleLoginRep googleLoginRep = Jsons.parseObject(Jsons.toMap(result).get("data"), GoogleLoginRep.class);
         loginReq.setType(3);