|
|
@ -23,6 +23,8 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.dao.CustomerFootBarDao; |
|
|
@ -36,10 +38,12 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
/** |
|
|
|
* APP底部菜单栏信息 |
|
|
@ -53,6 +57,9 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD |
|
|
|
@Autowired |
|
|
|
private CustomerFootBarRedis customerFootBarRedis; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RedisUtils redisUtils; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<CustomerFootBarDTO> page(Map<String, Object> params) { |
|
|
|
IPage<CustomerFootBarEntity> page = baseDao.selectPage( |
|
|
@ -160,6 +167,7 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
public void updateFootBar(CustomerFootBarFormDTO form) { |
|
|
|
validateBeforeUpdate(form); |
|
|
@ -174,6 +182,9 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD |
|
|
|
entity.setIconPath(form.getIconPath()); |
|
|
|
|
|
|
|
baseDao.updateById(entity); |
|
|
|
|
|
|
|
// 删除缓存中的footbar。若缓存删除失败,则事务回滚,db中的不应该成功
|
|
|
|
redisUtils.delete(RedisKeys.getCustomerFootbarKey(entity.getCustomerId(), entity.getAppType())); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -197,6 +208,18 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD |
|
|
|
for (CustomerFootBarFormDTO.OrderIndexDTO idx : orderList) { |
|
|
|
baseDao.updateOrder(idx.getId(), idx.getOrderIndex()); |
|
|
|
} |
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(orderList)) { |
|
|
|
String footbarId = orderList.get(0).getId(); |
|
|
|
|
|
|
|
CustomerFootBarEntity footBarEntity = baseDao.selectById(footbarId); |
|
|
|
|
|
|
|
Optional.of(footBarEntity).ifPresent(c -> { |
|
|
|
// 删除缓存中的footbar。若缓存删除失败,则事务回滚,db中的不应该成功
|
|
|
|
redisUtils.delete(RedisKeys.getCustomerFootbarKey(c.getCustomerId(), c.getAppType())); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -204,9 +227,17 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD |
|
|
|
return baseDao.getByAppTypeAndBarKeyOfCustomer(customerId, appType, barKey); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
public void updateDisplayStatus(String id, Boolean display) { |
|
|
|
baseDao.updateDisplayStatus(id, display); |
|
|
|
|
|
|
|
CustomerFootBarEntity footBarEntity = baseDao.selectById(id); |
|
|
|
|
|
|
|
Optional.of(footBarEntity).ifPresent(c -> { |
|
|
|
// 删除缓存中的footbar。若缓存删除失败,则事务回滚,db中的不应该成功
|
|
|
|
redisUtils.delete(RedisKeys.getCustomerFootbarKey(c.getCustomerId(), c.getAppType())); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional |
|
|
@ -230,10 +261,14 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl<CustomerFootBarD |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
public void deleteFootBar(String id) { |
|
|
|
CustomerFootBarEntity defaultFootbar = baseDao.selectById(id); |
|
|
|
baseDao.physicsDeleteByAppTypeAndBarKey(defaultFootbar.getAppType(), defaultFootbar.getBarKey()); |
|
|
|
|
|
|
|
// 删除缓存中的footbar。若缓存删除失败,则事务回滚,db中的不应该成功
|
|
|
|
redisUtils.delete(RedisKeys.getCustomerFootbarKey(defaultFootbar.getCustomerId(), defaultFootbar.getAppType())); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|