|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkMapper;
|
|
import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkMapper;
|
|
|
import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkPopularizeMapper;
|
|
import com.cyksj.mapper.corp.CorpCustomerAcquisitionLinkPopularizeMapper;
|
|
@@ -15,9 +16,12 @@ import com.cyksj.model.request.corp.link.WxCpLinkAddResp;
|
|
|
import com.cyksj.model.request.corp.link.WxCpLinkUpd;
|
|
import com.cyksj.model.request.corp.link.WxCpLinkUpd;
|
|
|
import com.cyksj.service.corp.CorpCustomerAcquisitionLinkService;
|
|
import com.cyksj.service.corp.CorpCustomerAcquisitionLinkService;
|
|
|
import com.cyksj.service.corp.WxCorpOps;
|
|
import com.cyksj.service.corp.WxCorpOps;
|
|
|
|
|
+import com.cyksj.xxljob.XxlJobInfo;
|
|
|
|
|
+import com.cyksj.xxljob.XxlJobUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
|
|
|
|
|
@@ -35,6 +39,7 @@ public class CorpCustomerAcquisitionLinkServiceImpl extends ServiceImpl<CorpCust
|
|
|
private final CorpCustomerAcquisitionLinkPopularizeMapper corpCustomerAcquisitionLinkPopularizeMapper;
|
|
private final CorpCustomerAcquisitionLinkPopularizeMapper corpCustomerAcquisitionLinkPopularizeMapper;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
public void add(CorpCustomerAcquisitionLink corpCustomerAcquisitionLink) throws Exception {
|
|
public void add(CorpCustomerAcquisitionLink corpCustomerAcquisitionLink) throws Exception {
|
|
|
WxCpLinkAdd wxCpLinkAdd = new WxCpLinkAdd();
|
|
WxCpLinkAdd wxCpLinkAdd = new WxCpLinkAdd();
|
|
|
wxCpLinkAdd.setLinkName(corpCustomerAcquisitionLink.getLinkName());
|
|
wxCpLinkAdd.setLinkName(corpCustomerAcquisitionLink.getLinkName());
|
|
@@ -48,11 +53,17 @@ public class CorpCustomerAcquisitionLinkServiceImpl extends ServiceImpl<CorpCust
|
|
|
|
|
|
|
|
corpCustomerAcquisitionLink.setChooseDutyUsers(corpCustomerAcquisitionLink.getUserList());
|
|
corpCustomerAcquisitionLink.setChooseDutyUsers(corpCustomerAcquisitionLink.getUserList());
|
|
|
this.save(corpCustomerAcquisitionLink);
|
|
this.save(corpCustomerAcquisitionLink);
|
|
|
|
|
+
|
|
|
|
|
+ if (corpCustomerAcquisitionLink.getIsDuty() != null && corpCustomerAcquisitionLink.getIsDuty()) {
|
|
|
|
|
+ handleCorpLinkSchedulerJob();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
public void up(CorpCustomerAcquisitionLink corpCustomerAcquisitionLink) throws Exception {
|
|
public void up(CorpCustomerAcquisitionLink corpCustomerAcquisitionLink) throws Exception {
|
|
|
CorpCustomerAcquisitionLink link = getById(corpCustomerAcquisitionLink.getId());
|
|
CorpCustomerAcquisitionLink link = getById(corpCustomerAcquisitionLink.getId());
|
|
|
|
|
+ String oldUserList = link.getUserList();
|
|
|
link.setLinkName(corpCustomerAcquisitionLink.getLinkName());
|
|
link.setLinkName(corpCustomerAcquisitionLink.getLinkName());
|
|
|
link.setUserList(corpCustomerAcquisitionLink.getUserList());
|
|
link.setUserList(corpCustomerAcquisitionLink.getUserList());
|
|
|
|
|
|
|
@@ -79,6 +90,10 @@ public class CorpCustomerAcquisitionLinkServiceImpl extends ServiceImpl<CorpCust
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.updateById(corpCustomerAcquisitionLink);
|
|
this.updateById(corpCustomerAcquisitionLink);
|
|
|
|
|
+
|
|
|
|
|
+ if (corpCustomerAcquisitionLink.getIsDuty() != null && corpCustomerAcquisitionLink.getIsDuty() && !StrUtil.equals(oldUserList, corpCustomerAcquisitionLink.getUserList())) {
|
|
|
|
|
+ handleCorpLinkSchedulerJob();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -98,4 +113,9 @@ public class CorpCustomerAcquisitionLinkServiceImpl extends ServiceImpl<CorpCust
|
|
|
WxCpLinkAddResp wxCpLinkAddResp = corpOps.customerAcquisitionDeleteLink(null, wxCpLinkUpd);
|
|
WxCpLinkAddResp wxCpLinkAddResp = corpOps.customerAcquisitionDeleteLink(null, wxCpLinkUpd);
|
|
|
removeById(id);
|
|
removeById(id);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void handleCorpLinkSchedulerJob() throws Exception {
|
|
|
|
|
+ //立即执行客服值班定时任务
|
|
|
|
|
+ XxlJobUtil.executeMarkDynamicRuleTagJob(XxlJobInfo.getExecuteTaskInstance(Constant.CORP_LINK_JOB_ID, StrUtil.EMPTY).toString());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|