Procházet zdrojové kódy

欢迎语多个优惠券

zoujiajian před 2 roky
rodič
revize
b14558320c

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/entity/CorpFollowActiveCode.java

@@ -77,7 +77,7 @@ public class CorpFollowActiveCode extends BaseEntity{
 	 */
 	private String operator;
 
-	private Long couponId;
+	private String couponIds;
 
 	private Boolean deleted;
 }

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/entity/CorpWelcomeTemplate.java

@@ -47,7 +47,7 @@ public class CorpWelcomeTemplate extends BaseEntity {
 	 * 优惠券id
 	 */
 	@TableField(updateStrategy = FieldStrategy.IGNORED)
-	private Long couponId;
+	private String couponIds;
 
 	@DbIgnore
 	@TableField(exist = false)

+ 47 - 0
netflix-dao/src/main/java/com/cyksj/model/views/CorpCustomerAcquisitionLinkExtraCustomerView.java

@@ -0,0 +1,47 @@
+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.util.Date;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: CorpCustomerAcquisitionLinkExtraCustomerView
+ * 创建者: JavaZou
+ * 创建时间:2024/3/5 11:52
+ */
+@Getter
+@Setter
+@SearchBean(tables = "corp_customer_acquisition_link_extra_customer cc inner join corp_customer_acquisition_link cl on cl.id = cc.ac_id",
+		where = "cc.deleted is true")
+public class CorpCustomerAcquisitionLinkExtraCustomerView {
+	@DbField("cc.id")
+	private Long id;
+
+	@DbField("cc.ac_id")
+	private Long acId;
+
+	@DbField("cl.link_name")
+	private String linkName;
+
+	@DbField("cc.service_id")
+	private Integer serviceId;
+
+	@DbIgnore
+	private String serviceName;
+
+	@DbField("cc.start_time")
+	private String startTime;
+
+	@DbField("cc.end_time")
+	private String endTime;
+
+	@DbField("cc.created_time")
+	private Date createdTime;
+}

+ 6 - 2
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpEventActionServiceImpl.java

@@ -800,8 +800,12 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
 				isJoinFixedCustomer(user.getId(), message.getUserId());
 
 				//活码 优惠券发送
-				if (corpFollowActiveCode != null && corpFollowActiveCode.getCouponId() > 0) {
-					couponCommonService.sendCouponToUser(user.getId(), corpFollowActiveCode.getCouponId(), 0l, 0l, 0l, CouponUser.Channel.corp_active_code);
+				if (corpFollowActiveCode != null && StrUtil.isNotBlank(corpFollowActiveCode.getCouponIds())) {
+					try {
+						List<Long> couponIds = Jsons.parseList(corpFollowActiveCode.getCouponIds(), Long.class);
+						couponIds.forEach(couponId -> couponCommonService.sendCouponToUser(user.getId(), couponId, 0l, 0l, 0l, CouponUser.Channel.corp_active_code));
+					} catch (Exception e) {
+					}
 				}
 			}
 			corpUserMapper.insert(corpUser);

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpFollowServiceImpl.java

@@ -156,8 +156,8 @@ public class CorpFollowServiceImpl implements CorpFollowService {
 		} else if (isUpdateAcCode) {
 			corpFollowDynamicConfigService.updateCorpFollowActiveCode(dbActiveCode.getMarkTag(), activeCode.getMarkTag());
 		}
-		if (activeCode.getCouponId() == null) {
-			activeCode.setCouponId(0l);
+		if (StrUtil.isEmpty(activeCode.getCouponIds())) {
+			activeCode.setCouponIds(null);
 		}
 		if (activeCode.getMsgId() == null) {
 			activeCode.setMsgId(0l);

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

@@ -686,8 +686,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 			}
 			if (msgId != null) {
 				CorpWelcomeTemplate corpWelcomeTemplate = corpWelcomeTemplateMapper.selectById(msgId);
-				if (corpWelcomeTemplate != null && corpWelcomeTemplate.getCouponId() != null) {
-					couponCommonService.sendCouponToUser(fUid, corpWelcomeTemplate.getCouponId(), 0l, 0l, 0l, channel);
+				if (corpWelcomeTemplate != null && StrUtil.isNotBlank(corpWelcomeTemplate.getCouponIds())) {
+					final CouponUser.Channel fChannel = channel;
+					try {
+						List<Long> couponIds = Jsons.parseList(corpWelcomeTemplate.getCouponIds(), Long.class);
+						couponIds.forEach(couponId -> couponCommonService.sendCouponToUser(fUid, couponId, 0l, 0l, 0l, fChannel));
+					} catch (Exception e) {
+					}
 				}
 			}
 

+ 6 - 3
netflix-web/src/main/java/com/cyksj/web/controller/manage/corp/CorpWelcomeTemplateController.java

@@ -23,7 +23,6 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
-import java.util.Optional;
 
 /**
  * admin/企业微信/欢迎语模板
@@ -114,8 +113,12 @@ public class CorpWelcomeTemplateController {
 				} catch (Exception ex) {
 				}
 			}
-			if (e.getCouponId() != null) {
-				Optional.ofNullable(couponMapper.selectById(e.getCouponId())).ifPresent(c -> e.setCouponName(c.getName()));
+			if (StrUtil.isNotBlank(e.getCouponIds())) {
+				try {
+					List<Long> couponIds = Jsons.parseList(e.getCouponIds(), Long.class);
+					e.setCouponName(couponMapper.getCouponNameByIds(couponIds));
+				} catch (Exception ex) {
+				}
 			}
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);