Commit 42f2530d by xugaojun

9月迭代: 关闭标签选项优化,检查是否有执行中任务

parent 3b2a41a2
......@@ -225,6 +225,11 @@
<artifactId>sharing-core-api</artifactId>
<version>${sharing-core-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-app-customer-api</artifactId>
<version>${haoban-app-customer-api}</version>
</dependency>
</dependencies>
<build>
......
......@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
......@@ -53,6 +54,8 @@ public class EnterpriseController extends WebBaseController {
private StoreService storeService;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private QywxTagSyncApiService qywxTagSyncApiService;
// @Autowired
// private WxEnterpriseRelatedApiService wxEnterpriseRelllatedApiService;
......@@ -129,6 +132,9 @@ public class EnterpriseController extends WebBaseController {
if (StringUtils.isEmpty(wxEnterpriseId)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
if (Objects.isNull(flag)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
// 操作缓存
String key = "qywx-tag-open";
String lockKey = "qywx-tag-open-lock";
......@@ -148,6 +154,15 @@ public class EnterpriseController extends WebBaseController {
RedisUtil.setCache(key, wxEntIdStr);
}
if (flag == 0) {
// 关闭标签检查是否有任务在进行
boolean tagSync = qywxTagSyncApiService.checkQywxTagSync(wxEnterpriseId);
if (!tagSync) {
// 有同步任务
return resultResponse(HaoBanErrCode.ERR_30001);
}
}
if (flag == 0 && StringUtils.isNotEmpty(wxEntIdStr)) {
// 关闭标签同步,只有在字符串不为空时才能关
List<String> filterList = Arrays.stream(wxEntIdStr.split(","))
......
......@@ -77,6 +77,9 @@ public enum HaoBanErrCode {
ERR_20002(20002,"门店不存在"),
ERR_30001(30001,"已存在同步任务, 无法关闭"),
ERR_DEFINE(-888, "自定义错误"),
ERR_OTHER(-999, "未知错误code");
private int code;
......
......@@ -57,4 +57,7 @@
<dubbo:reference interface="com.gic.sharing.core.service.api.service.MqApiService"
id="mqApiService"/>
<dubbo:reference interface="com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService"
id="qywxTagSyncApiService"/>
</beans>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment