Browse Source

Merge remote-tracking branch 'origin/dev_footbar' into dev_temp

master
wxz 5 years ago
parent
commit
14854e26cc
  1. 14
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java
  2. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java
  3. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java
  4. 41
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java
  5. 6
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml

14
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java

@ -15,27 +15,27 @@ public class CustomerFootBarFormDTO {
public interface CreateFootBarGroup extends CustomerClientShowGroup {} public interface CreateFootBarGroup extends CustomerClientShowGroup {}
// 查询footbar列表分组 // 查询footbar列表分组
public interface ListFootBarGroup {} public interface ListFootBarGroup extends CustomerClientShowGroup {}
// 更新footbar // 更新footbar
public interface UpdateFootBarGroup {} public interface UpdateFootBarGroup extends CustomerClientShowGroup {}
// 保存顺序 // 保存顺序
public interface SaveOrderGroup {} public interface SaveOrderGroup extends CustomerClientShowGroup {}
// 明细分组 // 明细分组
public interface FootBarDetailGroup {} public interface FootBarDetailGroup extends CustomerClientShowGroup {}
// 更新显示状态分组 // 更新显示状态分组
public interface UpdateDisplayStatusGroup {} public interface UpdateDisplayStatusGroup extends CustomerClientShowGroup {}
// 为客户添加默认footbar // 为客户添加默认footbar
public interface AddDefaultFootbars4Customer {} public interface AddDefaultFootbars4Customer extends CustomerClientShowGroup {}
@NotBlank(message = "FootBar的ID不能为空", groups = { UpdateFootBarGroup.class, FootBarDetailGroup.class, UpdateDisplayStatusGroup.class }) @NotBlank(message = "FootBar的ID不能为空", groups = { UpdateFootBarGroup.class, FootBarDetailGroup.class, UpdateDisplayStatusGroup.class })
private String id; private String id;
@NotBlank(message = "客户ID不能为空", groups = { CreateFootBarGroup.class, AddDefaultFootbars4Customer.class }) @NotBlank(message = "客户ID不能为空", groups = { AddDefaultFootbars4Customer.class })
private String customerId; private String customerId;
// 哪一个端:gov,resi // 哪一个端:gov,resi

2
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java

@ -121,7 +121,7 @@ public class CustomerFootBarController {
} }
/** /**
* 创建footbar * 创建footbar只能创建默认的不能直接为客户创建
* @param form * @param form
* @return * @return
*/ */

2
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java

@ -71,4 +71,6 @@ public interface CustomerFootBarDao extends BaseDao<CustomerFootBarEntity> {
@Param("appType") String appType); @Param("appType") String appType);
void updateDisplayStatus(@Param("id") String id, @Param("display") Boolean display); void updateDisplayStatus(@Param("id") String id, @Param("display") Boolean display);
List<String> listFootBarOwnerCustomerIds();
} }

41
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java

@ -118,7 +118,7 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
CustomerFootBarEntity entity = new CustomerFootBarEntity(); CustomerFootBarEntity entity = new CustomerFootBarEntity();
entity.setAppType(form.getAppType()); entity.setAppType(form.getAppType());
entity.setCustomerId(form.getCustomerId()); entity.setCustomerId("default"); // 只能为默认客户创建
entity.setBarKey(form.getBarKey()); entity.setBarKey(form.getBarKey());
entity.setBarName(form.getBarName()); entity.setBarName(form.getBarName());
entity.setIconPath(form.getIconPath()); entity.setIconPath(form.getIconPath());
@ -127,6 +127,33 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
entity.setOrderIndex(baseDao.fetchNextOrder(form.getCustomerId(), form.getAppType())); entity.setOrderIndex(baseDao.fetchNextOrder(form.getCustomerId(), form.getAppType()));
entity.setDisplay(true); entity.setDisplay(true);
baseDao.insert(entity); 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 @Override
@ -180,14 +207,14 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD
@Transactional @Transactional
@Override @Override
public void addDefault4Customer(String customerId, String appType) { 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); List<CustomerFootBarEntity> defaultBars = baseDao.listByAppTypeAndCustomerId("default", appType);
for (CustomerFootBarEntity defaultBar : defaultBars) { for (CustomerFootBarEntity defaultBar : defaultBars) {
CustomerFootBarEntity bar = baseDao.getByAppTypeAndBarKeyOfCustomer(customerId, appType, defaultBar.getBarKey());
if (bar != null) {
// 该客户已经有该bar了,不再添加
continue;
}
defaultBar.setCustomerId(customerId); defaultBar.setCustomerId(customerId);
defaultBar.setId(null); defaultBar.setId(null);
defaultBar.setCreatedTime(null); defaultBar.setCreatedTime(null);

6
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml

@ -124,5 +124,11 @@
and app_type = #{appType} and app_type = #{appType}
</select> </select>
<select id="listFootBarOwnerCustomerIds" resultType="java.lang.String">
select distinct CUSTOMER_ID
from customer_foot_bar fb
where CUSTOMER_ID != 'default'
</select>
</mapper> </mapper>
Loading…
Cancel
Save