|
|
@ -118,7 +118,7 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD |
|
|
|
|
|
|
|
CustomerFootBarEntity entity = new CustomerFootBarEntity(); |
|
|
|
entity.setAppType(form.getAppType()); |
|
|
|
entity.setCustomerId(form.getCustomerId()); |
|
|
|
entity.setCustomerId("default"); // 只能为默认客户创建
|
|
|
|
entity.setBarKey(form.getBarKey()); |
|
|
|
entity.setBarName(form.getBarName()); |
|
|
|
entity.setIconPath(form.getIconPath()); |
|
|
@ -127,6 +127,33 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD |
|
|
|
entity.setOrderIndex(baseDao.fetchNextOrder(form.getCustomerId(), form.getAppType())); |
|
|
|
entity.setDisplay(true); |
|
|
|
baseDao.insert(entity); |
|
|
|
|
|
|
|
sync2Customers(entity); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 同步到客户 |
|
|
|
* @param entity |
|
|
|
*/ |
|
|
|
private void sync2Customers(CustomerFootBarEntity entity) { |
|
|
|
List<String> customerIds = baseDao.listFootBarOwnerCustomerIds(); |
|
|
|
for (String customerId : customerIds) { |
|
|
|
CustomerFootBarEntity bar = baseDao.getByAppTypeAndBarKeyOfCustomer(customerId, entity.getAppType(), entity.getBarKey()); |
|
|
|
if (bar == null) { |
|
|
|
// 该客户还没有该bar
|
|
|
|
CustomerFootBarEntity newBar = new CustomerFootBarEntity(); |
|
|
|
newBar.setCustomerId(customerId); |
|
|
|
newBar.setIconPath(entity.getIconPath()); |
|
|
|
newBar.setPageTitle(entity.getPageTitle()); |
|
|
|
newBar.setBarKey(entity.getBarKey()); |
|
|
|
newBar.setBarName(entity.getBarName()); |
|
|
|
newBar.setSelectedIconPath(entity.getSelectedIconPath()); |
|
|
|
newBar.setOrderIndex(baseDao.fetchNextOrder(customerId, entity.getAppType())); |
|
|
|
newBar.setAppType(entity.getAppType()); |
|
|
|
newBar.setDisplay(true); |
|
|
|
baseDao.insert(newBar); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -180,14 +207,14 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD |
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
public void addDefault4Customer(String customerId, String appType) { |
|
|
|
List<CustomerFootBarEntity> footBarsOfCustomer = baseDao.listByAppTypeAndCustomerId(customerId, appType); |
|
|
|
if (!CollectionUtils.isEmpty(footBarsOfCustomer)) { |
|
|
|
throw new RenException(EpmetErrorCode.OPER_CUSTOMER_FOOTBAR_EXISTS.getCode(), |
|
|
|
EpmetErrorCode.OPER_CUSTOMER_FOOTBAR_EXISTS.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
List<CustomerFootBarEntity> defaultBars = baseDao.listByAppTypeAndCustomerId("default", appType); |
|
|
|
for (CustomerFootBarEntity defaultBar : defaultBars) { |
|
|
|
CustomerFootBarEntity bar = baseDao.getByAppTypeAndBarKeyOfCustomer(customerId, appType, defaultBar.getBarKey()); |
|
|
|
if (bar != null) { |
|
|
|
// 该客户已经有该bar了,不再添加
|
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
defaultBar.setCustomerId(customerId); |
|
|
|
defaultBar.setId(null); |
|
|
|
defaultBar.setCreatedTime(null); |
|
|
|