|
@@ -113,7 +113,7 @@ public class SettleRelaConfigLogic {
|
|
|
throw new RemoteServiceException("平台账号禁止操作");
|
|
|
}
|
|
|
|
|
|
- this.checkConfigInfo(adminUser.getCompanyWechatId(), bean.getWebsitId());
|
|
|
+ this.checkConfigInfo(adminUser.getCompanyWechatId(), bean.getWebsitId(), false);
|
|
|
|
|
|
WebsitFollowConfig config = new WebsitFollowConfig();
|
|
|
config.setCompanyWechatId(adminUser.getCompanyWechatId())
|
|
@@ -230,12 +230,14 @@ public class SettleRelaConfigLogic {
|
|
|
for (Map.Entry<String, List<String>> entry : importMap.entrySet()) {
|
|
|
WebsitFollowConfig config = new WebsitFollowConfig();
|
|
|
|
|
|
- this.checkConfigInfo(companyWechatId, entry.getKey());
|
|
|
+ boolean isInsert = this.checkConfigInfo(companyWechatId, entry.getKey(), true);
|
|
|
|
|
|
- config.setCompanyWechatId(companyWechatId)
|
|
|
- .setCompanyWechatName(companyName)
|
|
|
- .setWebsitId(entry.getKey())
|
|
|
- .insert();
|
|
|
+ if (isInsert) {
|
|
|
+ config.setCompanyWechatId(companyWechatId)
|
|
|
+ .setCompanyWechatName(companyName)
|
|
|
+ .setWebsitId(entry.getKey())
|
|
|
+ .insert();
|
|
|
+ }
|
|
|
|
|
|
final List<WebsitFollowConfigItem> existItems = websitFollowConfigItemService.lambdaQuery()
|
|
|
.eq(WebsitFollowConfigItem::getCompanyWechatId, config.getCompanyWechatId())
|
|
@@ -258,14 +260,21 @@ public class SettleRelaConfigLogic {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void checkConfigInfo(String companyWechatId, String websitId) {
|
|
|
+ private boolean checkConfigInfo(String companyWechatId, String websitId, Boolean isImport) {
|
|
|
+ boolean isInsert = false;
|
|
|
+
|
|
|
final Integer existData = websitFollowConfigService.lambdaQuery()
|
|
|
.eq(WebsitFollowConfig::getCompanyWechatId, companyWechatId)
|
|
|
.eq(WebsitFollowConfig::getWebsitId, websitId)
|
|
|
.count();
|
|
|
- if (existData > 0) {
|
|
|
+ if (!isImport && existData > 0) {
|
|
|
throw new RemoteServiceException(websitId + "已配置过关系, 添加失败");
|
|
|
}
|
|
|
+
|
|
|
+ if (isImport && existData == 0) {
|
|
|
+ isInsert = true;
|
|
|
+ }
|
|
|
+
|
|
|
final Integer count = adminWebsitService.lambdaQuery()
|
|
|
.eq(AdminWebsit::getCompanyWechatId, companyWechatId)
|
|
|
.eq(AdminWebsit::getWebsitId, websitId)
|
|
@@ -274,5 +283,6 @@ public class SettleRelaConfigLogic {
|
|
|
if (count == 0) {
|
|
|
throw new RemoteServiceException(websitId + "不是一级网点, 添加失败");
|
|
|
}
|
|
|
+ return isInsert;
|
|
|
}
|
|
|
}
|