|
@@ -78,11 +78,11 @@ public class BizSupplierController extends BaseController {
|
|
|
queryWrapper.eq("name", bizSupplier.getName());
|
|
|
if(bizSupplier.getId() == null) {
|
|
|
List<BizSupplier> supplierList = iBizSupplierService.query().eq("code", bizSupplier.getCode()).list();
|
|
|
- if (supplierList.size() > 0) {
|
|
|
+ if (!supplierList.isEmpty()) {
|
|
|
return AjaxResult.error("供应商编号不能重复");
|
|
|
}
|
|
|
supplierList = iBizSupplierService.query().eq("mnemonic_code", bizSupplier.getMnemonicCode()).list();
|
|
|
- if (supplierList.size() > 0) {
|
|
|
+ if (!supplierList.isEmpty()) {
|
|
|
return AjaxResult.error("助记码不能重复");
|
|
|
}
|
|
|
}
|
|
@@ -97,7 +97,22 @@ public class BizSupplierController extends BaseController {
|
|
|
return AjaxResult.warn("该外协商已存在");
|
|
|
}
|
|
|
boolean bool = iBizSupplierService.saveOrUpdate(bizSupplier);
|
|
|
- return bool ? success(bizSupplier) : error("操作失败!");
|
|
|
+ String msg = "";
|
|
|
+ if (bool && currentSupplierId == 0L) {
|
|
|
+ BizSupplierUser user = new BizSupplierUser();
|
|
|
+ user.setTenantId(bizSupplier.getTenantId());
|
|
|
+ user.setSupplierId(bizSupplier.getId());
|
|
|
+ user.setSupplierCode(bizSupplier.getCode());
|
|
|
+ user.setSupplierName(bizSupplier.getName());
|
|
|
+ user.setUsername(bizSupplier.getCode());
|
|
|
+ user.setPassword(SecurityUtils.encryptPassword("123456"));
|
|
|
+ user.setIsAdmin("1");
|
|
|
+ bool = iBizSupplierUserService.save(user);
|
|
|
+ msg = !bool ? "外协商管理员保存失败!" : "";
|
|
|
+ } else {
|
|
|
+ msg = "外协商保存失败!";
|
|
|
+ }
|
|
|
+ return bool ? success(bizSupplier) : error(msg);
|
|
|
}
|
|
|
/**
|
|
|
* 新增外协商联系人
|
|
@@ -208,6 +223,4 @@ public class BizSupplierController extends BaseController {
|
|
|
boolean bool = iBizSupplierUserService.saveOrUpdate(user);
|
|
|
return bool ? success("操作成功!") : error("操作失败!");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|