|
|
@@ -1,10 +1,16 @@
|
|
|
package com.cyksj.web.controller.manage.corp;
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
+import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkMapper;
|
|
|
+import com.cyksj.mapper.corp.CorpFollowActiveCodeMapper;
|
|
|
import com.cyksj.mapper.manage.coupon.CouponMapper;
|
|
|
+import com.cyksj.model.entity.CorpCustomerAcquisitionLink;
|
|
|
+import com.cyksj.model.entity.CorpFollowActiveCode;
|
|
|
import com.cyksj.model.entity.CorpWelcomeTemplate;
|
|
|
import com.cyksj.model.request.corp.Attachments;
|
|
|
import com.cyksj.service.corp.CorpWelcomeTemplateService;
|
|
|
@@ -35,6 +41,10 @@ public class CorpWelcomeTemplateController {
|
|
|
|
|
|
private final CouponMapper couponMapper;
|
|
|
|
|
|
+ private final CorpFollowActiveCodeMapper corpFollowActiveCodeMapper;
|
|
|
+
|
|
|
+ private final CorpCustomerAcquisitionLinkMapper acquisitionLinkMapper;
|
|
|
+
|
|
|
private final BeanSearcher beanSearcher;
|
|
|
|
|
|
private final HttpServletRequest request;
|
|
|
@@ -54,6 +64,17 @@ public class CorpWelcomeTemplateController {
|
|
|
@DeleteMapping("/delete/{id}")
|
|
|
public Result<String> deleteById(@PathVariable Long id) {
|
|
|
CorpWelcomeTemplate byId = corpWelcomeTemplateService.getById(id);
|
|
|
+ Integer count = null;
|
|
|
+ if (byId.getType() == 1) {
|
|
|
+ count = corpFollowActiveCodeMapper.selectCount(Wrappers.lambdaQuery(CorpFollowActiveCode.class)
|
|
|
+ .eq(CorpFollowActiveCode::getMsgId, byId.getId()));
|
|
|
+ } else if (byId.getType() == 2) {
|
|
|
+ count = acquisitionLinkMapper.selectCount(Wrappers.lambdaQuery(CorpCustomerAcquisitionLink.class)
|
|
|
+ .eq(CorpCustomerAcquisitionLink::getMsgId, byId.getId()));
|
|
|
+ }
|
|
|
+ if (count != null && count > 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("该欢迎语已使用");
|
|
|
+ }
|
|
|
if (byId != null) {
|
|
|
byId.setDeleted(false);
|
|
|
corpWelcomeTemplateService.updateById(byId);
|