|
@@ -7,6 +7,7 @@ import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
|
import com.gree.mall.manager.bean.material.base.WorkerGoodsBean;
|
|
|
import com.gree.mall.manager.bean.material.base.WorkerGoodsVO;
|
|
|
import com.gree.mall.manager.commonmapper.MaterialMapper;
|
|
|
+import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
import com.gree.mall.manager.plus.entity.WorkerGoods;
|
|
|
import com.gree.mall.manager.plus.entity.WorkerGoodsRela;
|
|
@@ -62,9 +63,18 @@ public class WorkerGoodsLogic {
|
|
|
workerGoods.insert();
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getItems())) {
|
|
|
+ // 检查是否已有绑定关系
|
|
|
for (WorkerGoodsRela item : bean.getItems()) {
|
|
|
+ final Integer count = workerGoodsRelaService.lambdaQuery()
|
|
|
+ .eq(WorkerGoodsRela::getCompanyWechatId, workerGoods.getCompanyWechatId())
|
|
|
+ .eq(WorkerGoodsRela::getWebsitGoodsId, item.getWebsitGoodsId())
|
|
|
+ .count();
|
|
|
+ if (count > 0) {
|
|
|
+ throw new RemoteServiceException("网点辅材: ”" + item.getWebsitGoodsName() + "“已有绑定关系");
|
|
|
+ }
|
|
|
item.setCompanyWechatId(workerGoods.getCompanyWechatId())
|
|
|
- .setWorkerGoodsId(workerGoods.getGoodsId());
|
|
|
+ .setWorkerGoodsId(workerGoods.getGoodsId())
|
|
|
+ .setWorkerGoodsName(workerGoods.getGoodsName());
|
|
|
}
|
|
|
workerGoodsRelaService.saveBatch(bean.getItems());
|
|
|
}
|
|
@@ -86,6 +96,13 @@ public class WorkerGoodsLogic {
|
|
|
.eq(WorkerGoodsRela::getWorkerGoodsId, workerGoods.getGoodsId())
|
|
|
.remove();
|
|
|
for (WorkerGoodsRela item : bean.getItems()) {
|
|
|
+ final Integer count = workerGoodsRelaService.lambdaQuery()
|
|
|
+ .eq(WorkerGoodsRela::getCompanyWechatId, workerGoods.getCompanyWechatId())
|
|
|
+ .eq(WorkerGoodsRela::getWebsitGoodsId, item.getWebsitGoodsId())
|
|
|
+ .count();
|
|
|
+ if (count > 0) {
|
|
|
+ throw new RemoteServiceException("网点辅材: ”" + item.getWebsitGoodsName() + "“已有绑定关系");
|
|
|
+ }
|
|
|
item.setCompanyWechatId(workerGoods.getCompanyWechatId())
|
|
|
.setWorkerGoodsId(workerGoods.getGoodsId());
|
|
|
}
|