|
|
|
@@ -9,6 +9,8 @@ import com.iformall.service.PushLimitService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class PushLimitServiceImpl implements PushLimitService { |
|
|
|
|
|
|
|
@@ -28,26 +30,50 @@ public class PushLimitServiceImpl implements PushLimitService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveOrUpdate(PushLimit record) { |
|
|
|
if (record.getId() == null) { |
|
|
|
//record.setId(UUID.randomUUID().toString().replaceAll("-", "")); |
|
|
|
PushLimit params=new PushLimit(); |
|
|
|
params.setTenantId(record.getTenantId()); |
|
|
|
List<PushLimit> list = pushLimitMapper.findList(params); |
|
|
|
if(list.size()>0){ |
|
|
|
pushLimitMapper.updateByPrimaryKeySelective(record); |
|
|
|
}else{ |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
record.setId(idWorker.nextId()); |
|
|
|
pushLimitMapper.insertSelective(record); |
|
|
|
} else { |
|
|
|
pushLimitMapper.updateByPrimaryKeySelective(record); |
|
|
|
} |
|
|
|
// if (record.getId() == null) { |
|
|
|
// //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); |
|
|
|
// final IdWorker idWorker = IdWorker.get(); |
|
|
|
// record.setId(idWorker.nextId()); |
|
|
|
// pushLimitMapper.insertSelective(record); |
|
|
|
// return record.getId(); |
|
|
|
// } else { |
|
|
|
// pushLimitMapper.updateByPrimaryKeySelective(record); |
|
|
|
// return record.getId(); |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void deleteById(Long id) { |
|
|
|
pushLimitMapper.deleteByPrimaryKey(id); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PushLimit getDefaultData(String tenantId) { |
|
|
|
PushLimit record =new PushLimit(); |
|
|
|
record.setTenantId(tenantId); |
|
|
|
List<PushLimit> list = pushLimitMapper.findList(record); |
|
|
|
if(list.size()>0){ |
|
|
|
record=list.get(0); |
|
|
|
}else{ |
|
|
|
record=new PushLimit(); |
|
|
|
record.setMsgAmount(3); |
|
|
|
record.setRefuseTimeStart("00:00"); |
|
|
|
record.setRefuseTimeEnd("23:45"); |
|
|
|
record.setCouponDay(10); |
|
|
|
record.setCouponAmount(10); |
|
|
|
} |
|
|
|
return record; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |