ExpenseCountsServiceImpl.java 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package com.goafanti.expenseAccount.service.impl;
  2. import com.goafanti.common.dao.TOrderNewMapper;
  3. import com.goafanti.common.utils.LoggerUtils;
  4. import com.goafanti.expenseAccount.bo.ExpenseCountsInput;
  5. import com.goafanti.expenseAccount.service.ExpenseCountsService;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.cache.annotation.CacheEvict;
  8. import org.springframework.cache.annotation.Cacheable;
  9. import org.springframework.stereotype.Service;
  10. @Service
  11. public class ExpenseCountsServiceImpl implements ExpenseCountsService {
  12. @Autowired
  13. private TOrderNewMapper tOrderNewMapper;
  14. @Override
  15. @Cacheable(value = "getCounts#300", key = "'getCounts:key='+#in.startTime+#in.endTime+#in.depId+#in.contactNo+#in.targetType")
  16. public Object getCounts(ExpenseCountsInput in) {
  17. if (in.getTargetType()==null)in.setTargetType(1);
  18. if (in.getTargetType()==1){
  19. return tOrderNewMapper.selectExpenseCount(in);
  20. }else {
  21. return tOrderNewMapper.selectExpenseDepCount(in);
  22. }
  23. }
  24. @Override
  25. @CacheEvict(value = "getCounts#300",allEntries = true)
  26. public Object getCountsClear() {
  27. LoggerUtils.debug(getClass(),"报销统计缓存清除。");
  28. return 1;
  29. }
  30. }